public async Task <string> SignTransactionAsync(IEnumerable <string> walletIds, string transactionRaw) { IEnumerable <IWallet> wallets = null; try { wallets = await walletIds.SelectAsync(async walletId => { IWallet wallet = await _walletRepository.GetWalletByPublicAddressAsync(walletId); if (wallet == null) { throw new ClientSideException($"Wallet with id {walletId} does not exist in DB", ClientSideException.ClientSideExceptionType.EntityDoesNotExist); } return(wallet); }); } catch (AggregateException exc) { foreach (var exception in exc.InnerExceptions) { if (exception is ClientSideException clientSideExc) { throw clientSideExc; } } } catch (Exception exc) { throw; } IEnumerable <string> privateKeys = wallets.Select(wallet => { string privateKey = _encryptionService.DecryptAesString(wallet.EncryptedPrivateKey, _passwordBytes); return(privateKey); }); SignedTransactionResponse signedTransaction = await _internalSignServiceCaller.SignTransactionAsync(privateKeys, transactionRaw); return(signedTransaction.SignedTransaction); }