From 4bcf6162f11d45273d509c0e158c4fe07fa7372d Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Fri, 8 Sep 2023 19:12:54 +0200 Subject: [PATCH] CW-476 Only get Transactions of one Account on tx-history refresh (#1077) --- cw_monero/lib/api/transaction_history.dart | 2 +- cw_monero/lib/monero_wallet.dart | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cw_monero/lib/api/transaction_history.dart b/cw_monero/lib/api/transaction_history.dart index 6f848cb3d..1964c4067 100644 --- a/cw_monero/lib/api/transaction_history.dart +++ b/cw_monero/lib/api/transaction_history.dart @@ -55,7 +55,7 @@ void refreshTransactions() => transactionsRefreshNative(); int countOfTransactions() => transactionsCountNative(); -List getAllTransations() { +List getAllTransactions() { final size = transactionsCountNative(); final transactionsPointer = transactionsGetAllNative(); final transactionsAddresses = transactionsPointer.asTypedList(size); diff --git a/cw_monero/lib/monero_wallet.dart b/cw_monero/lib/monero_wallet.dart index 39c0604a3..69cd5458e 100644 --- a/cw_monero/lib/monero_wallet.dart +++ b/cw_monero/lib/monero_wallet.dart @@ -482,7 +482,7 @@ abstract class MoneroWalletBase extends WalletBase> fetchTransactions() async { transaction_history.refreshTransactions(); - return _getAllTransactions(null).fold>( + return _getAllTransactionsOfAccount(walletAddresses.account?.id).fold>( {}, (Map acc, MoneroTransactionInfo tx) { acc[tx.id] = tx; @@ -497,6 +497,7 @@ abstract class MoneroWalletBase extends WalletBase _getAllTransactions(dynamic _) => + List _getAllTransactionsOfAccount(int? accountIndex) => transaction_history - .getAllTransations() + .getAllTransactions() .map((row) => MoneroTransactionInfo.fromRow(row)) + .where((element) => element.accountIndex == (accountIndex ?? 0)) .toList(); void _setListeners() {