feat: Implement sweep all WIP [skip ci]

This commit is contained in:
Blazebrain 2023-06-27 01:50:47 +01:00
parent 0667e7fdcc
commit 5d51cd5459

View file

@ -69,33 +69,33 @@ abstract class WalletCreationVMBase with Store {
// if (restoreWallet != null && // if (restoreWallet != null &&
// restoreWallet.restoreMode == WalletRestoreMode.txids) { // restoreWallet.restoreMode == WalletRestoreMode.txids) {
//* Create the newWallet that will receive the funds //* Create the newWallet that will receive the funds
final newWallet = await createNewWalletWithoutSwitching( // final newWallet = await createNewWalletWithoutSwitching(
options: options, // options: options,
regenerateName: true, // regenerateName: true,
); // );
final newWalletAddress = newWallet.walletAddresses.address; // final newWalletAddress = newWallet.walletAddresses.address;
print('New Wallet Address ' + newWalletAddress); // print('New Wallet Address ' + newWalletAddress);
//* Switch to the restoredWallet in order to activate the node connection // //* Switch to the restoredWallet in order to activate the node connection
_appStore.changeCurrentWallet(restoredWallet); // _appStore.changeCurrentWallet(restoredWallet);
await restoredWallet.startSync(); // await restoredWallet.startSync();
print('Before syncing starts'); // print('Before syncing starts');
await syncCompleter.future; // await syncCompleter.future;
print('After syncing ends'); // print('After syncing ends');
//* Sweep all funds from restoredWallet to newWallet //* Sweep all funds from restoredWallet to newWallet
await sweepAllFundsToNewWallet( // await sweepAllFundsToNewWallet(
restoredWallet, // restoredWallet,
type, // type,
newWalletAddress, // newWalletAddress,
restoreWallet?.txId ?? '', // restoreWallet?.txId ?? '',
); // );
// } else { // } else {
// await _walletInfoSource.add(restoredWallet.walletInfo); await _walletInfoSource.add(restoredWallet.walletInfo);
// _appStore.changeCurrentWallet(restoredWallet); _appStore.changeCurrentWallet(restoredWallet);
// _appStore.authenticationStore.allowed(); _appStore.authenticationStore.allowed();
// state = ExecutedSuccessfullyState(); state = ExecutedSuccessfullyState();
// } // }
} catch (e) { } catch (e) {
print('Errorrrrr'); print('Errorrrrr');