mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
CW 1080: fix(cw_monero): call store() directly after commiting tx (#2312)
* fix(cw_monero): call store() directly after commiting tx to make sure that tx key is written to cache also, store it in TransactionDescription hive box * Update lib/view_model/send/send_view_model.dart --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
parent
fe0c9ecc0e
commit
a96b493b60
7 changed files with 31 additions and 15 deletions
|
@ -590,16 +590,25 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
|||
}
|
||||
|
||||
if (pendingTransaction!.id.isNotEmpty) {
|
||||
TransactionInfo? tx;
|
||||
if (walletType == WalletType.monero) {
|
||||
await Future.delayed(Duration(milliseconds: 450));
|
||||
await wallet.fetchTransactions();
|
||||
final txhistory = monero!.getTransactionHistory(wallet);
|
||||
tx = txhistory.transactions.values.last;
|
||||
}
|
||||
final descriptionKey = '${pendingTransaction!.id}_${wallet.walletAddresses.primaryAddress}';
|
||||
_settingsStore.shouldSaveRecipientAddress
|
||||
? await transactionDescriptionBox.add(TransactionDescription(
|
||||
id: descriptionKey,
|
||||
recipientAddress: address,
|
||||
transactionNote: note,
|
||||
transactionKey: tx?.additionalInfo["key"] as String?,
|
||||
))
|
||||
: await transactionDescriptionBox.add(TransactionDescription(
|
||||
id: descriptionKey,
|
||||
transactionNote: note,
|
||||
transactionKey: tx?.additionalInfo["key"] as String?,
|
||||
));
|
||||
}
|
||||
final sharedPreferences = await SharedPreferences.getInstance();
|
||||
|
|
|
@ -233,7 +233,13 @@ abstract class TransactionDetailsViewModelBase with Store {
|
|||
}
|
||||
|
||||
void _addMoneroListItems(TransactionInfo tx, DateFormat dateFormat) {
|
||||
final key = tx.additionalInfo['key'] as String?;
|
||||
final descriptionKey = '${transactionInfo.txHash}_${wallet.walletAddresses.primaryAddress}';
|
||||
final description = transactionDescriptionBox.values.firstWhere(
|
||||
(val) => val.id == descriptionKey || val.id == transactionInfo.txHash,
|
||||
orElse: () => TransactionDescription(id: descriptionKey));
|
||||
|
||||
|
||||
final key = tx.additionalInfo['key'] as String? ?? description.transactionKey;
|
||||
final accountIndex = tx.additionalInfo['accountIndex'] as int;
|
||||
final addressIndex = tx.additionalInfo['addressIndex'] as int;
|
||||
final feeFormatted = tx.feeFormatted();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue