Skip to content

Commit 4f5797f

Browse files
committed
tezos bandaid fixes
1 parent 949df69 commit 4f5797f

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

lib/wallets/wallet/impl/tezos_wallet.dart

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'dart:async';
12
import 'dart:io';
23

34
import 'package:isar/isar.dart';
@@ -128,6 +129,7 @@ class TezosWallet extends Bip39Wallet<Tezos> {
128129
// customFee: customFee?.raw.toInt(),
129130
// customGasLimit: customGasLimit,
130131
// reveal: false,
132+
customGasLimit: 10600,
131133
);
132134

133135
// if (reveal) {
@@ -286,8 +288,38 @@ class TezosWallet extends Bip39Wallet<Tezos> {
286288
@override
287289
Future<TxData> confirmSend({required TxData txData}) async {
288290
_hackedCheckTorNodePrefs();
291+
292+
final completer = Completer<void>();
293+
final sub = mainDB.isar.transactions
294+
.where()
295+
.walletIdEqualTo(walletId)
296+
.watch(fireImmediately: true)
297+
.listen((event) {
298+
if (!completer.isCompleted &&
299+
event
300+
.where((e) => e.txid == txData.tezosOperationsList!.result.id)
301+
.isNotEmpty) {
302+
completer.complete();
303+
}
304+
});
305+
289306
await txData.tezosOperationsList!.inject();
290-
await txData.tezosOperationsList!.monitor();
307+
308+
final completerFuture = completer.future.timeout(
309+
const Duration(minutes: 2),
310+
onTimeout: () {
311+
throw Exception("Tezos confirm send timeout");
312+
},
313+
);
314+
315+
while (!completer.isCompleted) {
316+
await updateTransactions();
317+
await Future<void>.delayed(const Duration(seconds: 3));
318+
}
319+
320+
await completerFuture;
321+
322+
unawaited(sub.cancel());
291323
return txData.copyWith(txid: txData.tezosOperationsList!.result.id);
292324
}
293325

0 commit comments

Comments
 (0)