Merge branch 'main' of https://github.com/cake-tech/cake_wallet into CW-459-12-words-btc

This commit is contained in:
fosse 2023-09-11 08:55:12 -04:00
commit d49bd54a72
2 changed files with 6 additions and 4 deletions

View file

@ -55,7 +55,7 @@ void refreshTransactions() => transactionsRefreshNative();
int countOfTransactions() => transactionsCountNative();
List<TransactionInfoRow> getAllTransations() {
List<TransactionInfoRow> getAllTransactions() {
final size = transactionsCountNative();
final transactionsPointer = transactionsGetAllNative();
final transactionsAddresses = transactionsPointer.asTypedList(size);

View file

@ -482,7 +482,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
@override
Future<Map<String, MoneroTransactionInfo>> fetchTransactions() async {
transaction_history.refreshTransactions();
return _getAllTransactions(null).fold<Map<String, MoneroTransactionInfo>>(
return _getAllTransactionsOfAccount(walletAddresses.account?.id).fold<Map<String, MoneroTransactionInfo>>(
<String, MoneroTransactionInfo>{},
(Map<String, MoneroTransactionInfo> acc, MoneroTransactionInfo tx) {
acc[tx.id] = tx;
@ -497,6 +497,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
}
_isTransactionUpdating = true;
transactionHistory.clear();
final transactions = await fetchTransactions();
transactionHistory.addMany(transactions);
await transactionHistory.save();
@ -511,10 +512,11 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
return monero_wallet.getSubaddressLabel(accountIndex, addressIndex);
}
List<MoneroTransactionInfo> _getAllTransactions(dynamic _) =>
List<MoneroTransactionInfo> _getAllTransactionsOfAccount(int? accountIndex) =>
transaction_history
.getAllTransations()
.getAllTransactions()
.map((row) => MoneroTransactionInfo.fromRow(row))
.where((element) => element.accountIndex == (accountIndex ?? 0))
.toList();
void _setListeners() {