mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
fix(cw_monero): properly await transaction commit (#2284)
This commit is contained in:
parent
939e5d9279
commit
fd3158293e
2 changed files with 7 additions and 7 deletions
|
@ -251,13 +251,13 @@ Future<PendingTransactionDescription> createTransactionMultDest(
|
|||
);
|
||||
}
|
||||
|
||||
String? commitTransactionFromPointerAddress({required int address, required bool useUR}) =>
|
||||
Future<String?> commitTransactionFromPointerAddress({required int address, required bool useUR}) =>
|
||||
commitTransaction(tx: MoneroPendingTransaction(Pointer.fromAddress(address)), useUR: useUR);
|
||||
|
||||
String? commitTransaction({required Wallet2PendingTransaction tx, required bool useUR}) {
|
||||
Future<String?> commitTransaction({required Wallet2PendingTransaction tx, required bool useUR}) async {
|
||||
final txCommit = useUR
|
||||
? tx.commitUR(120)
|
||||
: Isolate.run(() {
|
||||
: await Isolate.run(() {
|
||||
monero.PendingTransaction_commit(
|
||||
Pointer.fromAddress(tx.ffiAddress()),
|
||||
filename: '',
|
||||
|
@ -286,9 +286,9 @@ String? commitTransaction({required Wallet2PendingTransaction tx, required bool
|
|||
throw CreationTransactionException(message: error);
|
||||
}
|
||||
if (useUR) {
|
||||
return txCommit as String?;
|
||||
return Future.value(txCommit as String?);
|
||||
} else {
|
||||
return null;
|
||||
return Future.value(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class PendingMoneroTransaction with PendingTransaction {
|
|||
@override
|
||||
Future<void> commit() async {
|
||||
try {
|
||||
monero_transaction_history.commitTransactionFromPointerAddress(
|
||||
await monero_transaction_history.commitTransactionFromPointerAddress(
|
||||
address: pendingTransactionDescription.pointerAddress,
|
||||
useUR: false);
|
||||
} catch (e) {
|
||||
|
@ -68,7 +68,7 @@ class PendingMoneroTransaction with PendingTransaction {
|
|||
@override
|
||||
Future<String?> commitUR() async {
|
||||
try {
|
||||
final ret = monero_transaction_history.commitTransactionFromPointerAddress(
|
||||
final ret = await monero_transaction_history.commitTransactionFromPointerAddress(
|
||||
address: pendingTransactionDescription.pointerAddress,
|
||||
useUR: true);
|
||||
storeSync(force: true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue