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);
|
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
|
final txCommit = useUR
|
||||||
? tx.commitUR(120)
|
? tx.commitUR(120)
|
||||||
: Isolate.run(() {
|
: await Isolate.run(() {
|
||||||
monero.PendingTransaction_commit(
|
monero.PendingTransaction_commit(
|
||||||
Pointer.fromAddress(tx.ffiAddress()),
|
Pointer.fromAddress(tx.ffiAddress()),
|
||||||
filename: '',
|
filename: '',
|
||||||
|
@ -286,9 +286,9 @@ String? commitTransaction({required Wallet2PendingTransaction tx, required bool
|
||||||
throw CreationTransactionException(message: error);
|
throw CreationTransactionException(message: error);
|
||||||
}
|
}
|
||||||
if (useUR) {
|
if (useUR) {
|
||||||
return txCommit as String?;
|
return Future.value(txCommit as String?);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return Future.value(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ class PendingMoneroTransaction with PendingTransaction {
|
||||||
@override
|
@override
|
||||||
Future<void> commit() async {
|
Future<void> commit() async {
|
||||||
try {
|
try {
|
||||||
monero_transaction_history.commitTransactionFromPointerAddress(
|
await monero_transaction_history.commitTransactionFromPointerAddress(
|
||||||
address: pendingTransactionDescription.pointerAddress,
|
address: pendingTransactionDescription.pointerAddress,
|
||||||
useUR: false);
|
useUR: false);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -68,7 +68,7 @@ class PendingMoneroTransaction with PendingTransaction {
|
||||||
@override
|
@override
|
||||||
Future<String?> commitUR() async {
|
Future<String?> commitUR() async {
|
||||||
try {
|
try {
|
||||||
final ret = monero_transaction_history.commitTransactionFromPointerAddress(
|
final ret = await monero_transaction_history.commitTransactionFromPointerAddress(
|
||||||
address: pendingTransactionDescription.pointerAddress,
|
address: pendingTransactionDescription.pointerAddress,
|
||||||
useUR: true);
|
useUR: true);
|
||||||
storeSync(force: true);
|
storeSync(force: true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue