fix(cw_monero): transaction not appearing after send (#2268)

* fix: catch error in newly added fetchTransactions call
fix: null handling in cw_monero

* fix(cw_monero): transaction not appearing after send
This commit is contained in:
cyan
2025-05-15 19:48:43 +03:00
committed by GitHub
parent 557e1c9839
commit bc52cf485e
3 changed files with 7 additions and 9 deletions
+1 -1
View File
@@ -446,7 +446,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
// final status = monero.PendingTransaction_status(pendingTransactionDescription);
return PendingMoneroTransaction(pendingTransactionDescription);
return PendingMoneroTransaction(pendingTransactionDescription, this);
}
@override
@@ -7,6 +7,7 @@ import 'package:cw_core/amount_converter.dart';
import 'package:cw_core/pending_transaction.dart';
import 'package:cw_monero/api/wallet.dart';
import 'package:cw_monero/monero_wallet.dart';
class DoubleSpendException implements Exception {
DoubleSpendException();
@@ -17,9 +18,10 @@ class DoubleSpendException implements Exception {
}
class PendingMoneroTransaction with PendingTransaction {
PendingMoneroTransaction(this.pendingTransactionDescription);
PendingMoneroTransaction(this.pendingTransactionDescription, this.wallet);
final PendingTransactionDescription pendingTransactionDescription;
final MoneroWalletBase wallet;
@override
String get id => pendingTransactionDescription.hash;
@@ -54,6 +56,7 @@ class PendingMoneroTransaction with PendingTransaction {
rethrow;
}
await wallet.fetchTransactions();
storeSync(force: true);
}
@@ -63,6 +66,8 @@ class PendingMoneroTransaction with PendingTransaction {
final ret = monero_transaction_history.commitTransactionFromPointerAddress(
address: pendingTransactionDescription.pointerAddress,
useUR: true);
await wallet.fetchTransactions();
storeSync(force: true);
return ret;
} catch (e) {
final message = e.toString();
-7
View File
@@ -593,13 +593,6 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
}
final sharedPreferences = await SharedPreferences.getInstance();
await sharedPreferences.setString(PreferencesKey.backgroundSyncLastTrigger(wallet.name), DateTime.now().add(Duration(minutes: 1)).toIso8601String());
unawaited(() {
try {
wallet.fetchTransactions();
} catch (e) {
printV(e);
}
}());
state = TransactionCommitted();
} catch (e) {
state = FailureState(translateErrorMessage(e, wallet.type, wallet.currency));