From 857e355ee6d13855a009803687c1ae3b67fc6c89 Mon Sep 17 00:00:00 2001 From: Blazebrain Date: Tue, 11 Jul 2023 10:55:03 +0100 Subject: [PATCH] fix: Add proper state reporting [skip ci] --- lib/view_model/wallet_creation_vm.dart | 28 +++++++++++--------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/lib/view_model/wallet_creation_vm.dart b/lib/view_model/wallet_creation_vm.dart index 885edd7b0..58b3c05a9 100644 --- a/lib/view_model/wallet_creation_vm.dart +++ b/lib/view_model/wallet_creation_vm.dart @@ -68,7 +68,6 @@ abstract class WalletCreationVMBase with Store { bool typeExists(WalletType type) => walletCreationService.typeExists(type); Future create({dynamic options, RestoredWallet? restoreWallet}) async { - // if (restoreWallet != null && // restoreWallet.restoreMode == WalletRestoreMode.txids) { await _createFlowForSweepAll(options, restoreWallet); @@ -109,6 +108,7 @@ abstract class WalletCreationVMBase with Store { dynamic options, RestoredWallet? restoreWallet, ) async { + state = IsExecutingState(); final type = restoreWallet?.type ?? this.type; try { @@ -145,7 +145,7 @@ abstract class WalletCreationVMBase with Store { await restoredWallet.startSync(); await syncCompleter.future; - + // * Sweep all funds from restoredWallet to newWallet await _sweepAllFundsToNewWallet( restoredWallet, @@ -153,7 +153,6 @@ abstract class WalletCreationVMBase with Store { type, restoreWallet?.txId ?? '', ); - } catch (e) { print( 'Error occurred while creating a new wallet from Scan QR using sweep all', @@ -215,17 +214,18 @@ abstract class WalletCreationVMBase with Store { } Future _sweepAllFundsToNewWallet( - WalletBase, - TransactionInfo> - wallet, - WalletBase, - TransactionInfo> - newWallet, - WalletType type, + WalletBase, + TransactionInfo> + wallet, + WalletBase, + TransactionInfo> + newWallet, + WalletType type, String paymentId, ) async { - - final output = Output(wallet, _appStore.settingsStore, + final output = Output( + wallet, + _appStore.settingsStore, _fiatConversationStore, () => wallet.currency, ); @@ -308,14 +308,10 @@ abstract class WalletCreationVMBase with Store { } } - Future _createTransaction(WalletBase wallet, Object credentials) async { try { - print('in here'); - state = IsExecutingState(); print('about to enter wallet create transaction function'); pendingTransaction = await wallet.createTransaction(credentials); - state = ExecutedSuccessfullyState(); } catch (e) { state = FailureState(e.toString()); }