mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
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:
parent
557e1c9839
commit
bc52cf485e
3 changed files with 7 additions and 9 deletions
|
@ -446,7 +446,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
||||||
|
|
||||||
// final status = monero.PendingTransaction_status(pendingTransactionDescription);
|
// final status = monero.PendingTransaction_status(pendingTransactionDescription);
|
||||||
|
|
||||||
return PendingMoneroTransaction(pendingTransactionDescription);
|
return PendingMoneroTransaction(pendingTransactionDescription, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -7,6 +7,7 @@ import 'package:cw_core/amount_converter.dart';
|
||||||
|
|
||||||
import 'package:cw_core/pending_transaction.dart';
|
import 'package:cw_core/pending_transaction.dart';
|
||||||
import 'package:cw_monero/api/wallet.dart';
|
import 'package:cw_monero/api/wallet.dart';
|
||||||
|
import 'package:cw_monero/monero_wallet.dart';
|
||||||
|
|
||||||
class DoubleSpendException implements Exception {
|
class DoubleSpendException implements Exception {
|
||||||
DoubleSpendException();
|
DoubleSpendException();
|
||||||
|
@ -17,9 +18,10 @@ class DoubleSpendException implements Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
class PendingMoneroTransaction with PendingTransaction {
|
class PendingMoneroTransaction with PendingTransaction {
|
||||||
PendingMoneroTransaction(this.pendingTransactionDescription);
|
PendingMoneroTransaction(this.pendingTransactionDescription, this.wallet);
|
||||||
|
|
||||||
final PendingTransactionDescription pendingTransactionDescription;
|
final PendingTransactionDescription pendingTransactionDescription;
|
||||||
|
final MoneroWalletBase wallet;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get id => pendingTransactionDescription.hash;
|
String get id => pendingTransactionDescription.hash;
|
||||||
|
@ -54,6 +56,7 @@ class PendingMoneroTransaction with PendingTransaction {
|
||||||
|
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
|
await wallet.fetchTransactions();
|
||||||
storeSync(force: true);
|
storeSync(force: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +66,8 @@ class PendingMoneroTransaction with PendingTransaction {
|
||||||
final ret = monero_transaction_history.commitTransactionFromPointerAddress(
|
final ret = monero_transaction_history.commitTransactionFromPointerAddress(
|
||||||
address: pendingTransactionDescription.pointerAddress,
|
address: pendingTransactionDescription.pointerAddress,
|
||||||
useUR: true);
|
useUR: true);
|
||||||
|
await wallet.fetchTransactions();
|
||||||
|
storeSync(force: true);
|
||||||
return ret;
|
return ret;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
final message = e.toString();
|
final message = e.toString();
|
||||||
|
|
|
@ -593,13 +593,6 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||||
}
|
}
|
||||||
final sharedPreferences = await SharedPreferences.getInstance();
|
final sharedPreferences = await SharedPreferences.getInstance();
|
||||||
await sharedPreferences.setString(PreferencesKey.backgroundSyncLastTrigger(wallet.name), DateTime.now().add(Duration(minutes: 1)).toIso8601String());
|
await sharedPreferences.setString(PreferencesKey.backgroundSyncLastTrigger(wallet.name), DateTime.now().add(Duration(minutes: 1)).toIso8601String());
|
||||||
unawaited(() {
|
|
||||||
try {
|
|
||||||
wallet.fetchTransactions();
|
|
||||||
} catch (e) {
|
|
||||||
printV(e);
|
|
||||||
}
|
|
||||||
}());
|
|
||||||
state = TransactionCommitted();
|
state = TransactionCommitted();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
state = FailureState(translateErrorMessage(e, wallet.type, wallet.currency));
|
state = FailureState(translateErrorMessage(e, wallet.type, wallet.currency));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue