fix: Wallet seeds not coming up for new wallets and flow to display seeds

This commit is contained in:
Blazebrain 2023-07-18 13:08:21 +01:00
parent 3a37aab595
commit 12f54bd8e6
2 changed files with 23 additions and 8 deletions

View file

@ -1,4 +1,6 @@
import 'package:cake_wallet/core/execution_state.dart'; import 'package:cake_wallet/core/execution_state.dart';
import 'package:cake_wallet/main.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
@ -72,6 +74,13 @@ class _SweepingWalletWidgetState extends State<SweepingWalletWidget> {
await widget.restoreFromQRViewModel await widget.restoreFromQRViewModel
.createFlowForSweepAll(restoreWallet: widget.restoredWallet); .createFlowForSweepAll(restoreWallet: widget.restoredWallet);
if (widget.restoreFromQRViewModel.state is ExecutedSuccessfullyState) {
await Navigator.of(navigatorKey.currentContext!).pushNamed(
Routes.preSeed,
arguments: widget.restoreFromQRViewModel.type,
);
}
if (widget.restoreFromQRViewModel.state is FailureState) { if (widget.restoreFromQRViewModel.state is FailureState) {
final errorState = widget.restoreFromQRViewModel.state as FailureState; final errorState = widget.restoreFromQRViewModel.state as FailureState;
_onWalletCreateFailure( _onWalletCreateFailure(

View file

@ -4,7 +4,6 @@ import 'package:cake_wallet/core/wallet_creation_service.dart';
import 'package:cake_wallet/entities/load_current_wallet.dart'; import 'package:cake_wallet/entities/load_current_wallet.dart';
import 'package:cake_wallet/entities/transaction_description.dart'; import 'package:cake_wallet/entities/transaction_description.dart';
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart'; import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
import 'package:cake_wallet/view_model/restore/restore_mode.dart';
import 'package:cake_wallet/view_model/restore/restore_wallet.dart'; import 'package:cake_wallet/view_model/restore/restore_wallet.dart';
import 'package:cake_wallet/view_model/send/output.dart'; import 'package:cake_wallet/view_model/send/output.dart';
import 'package:cw_core/balance.dart'; import 'package:cw_core/balance.dart';
@ -74,6 +73,7 @@ abstract class WalletCreationVMBase with Store {
options: options, options: options,
restoreWallet: restoreWallet, restoreWallet: restoreWallet,
regenerateName: true, regenerateName: true,
isRecovery: true,
); );
print( print(
@ -102,8 +102,11 @@ abstract class WalletCreationVMBase with Store {
final type = restoreWallet?.type ?? this.type; final type = restoreWallet?.type ?? this.type;
try { try {
final newWallet = final newWallet = await _createNewWalletWithoutSwitching(
await _createNewWalletWithoutSwitching(options: options); options: 'English',
regenerateName: true,
isRecovery: false,
);
final newWalletAddress = newWallet.walletAddresses.address; final newWalletAddress = newWallet.walletAddresses.address;
@ -113,6 +116,7 @@ abstract class WalletCreationVMBase with Store {
options: options, options: options,
restoreWallet: restoreWallet, restoreWallet: restoreWallet,
regenerateName: true, regenerateName: true,
isRecovery: true,
); );
print( print(
@ -161,10 +165,12 @@ abstract class WalletCreationVMBase with Store {
Future< Future<
WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, WalletBase<Balance, TransactionHistoryBase<TransactionInfo>,
TransactionInfo>> _createNewWalletWithoutSwitching( TransactionInfo>> _createNewWalletWithoutSwitching({
{dynamic options, dynamic options,
RestoredWallet? restoreWallet, RestoredWallet? restoreWallet,
bool regenerateName = false}) async { bool regenerateName = false,
bool isRecovery = false,
}) async {
state = IsExecutingState(); state = IsExecutingState();
if (name.isEmpty) { if (name.isEmpty) {
name = await generateName(); name = await generateName();
@ -185,7 +191,7 @@ abstract class WalletCreationVMBase with Store {
name: name, name: name,
type: type, type: type,
//TODO(David): Ask Omar about this, was previous isRecovery //TODO(David): Ask Omar about this, was previous isRecovery
isRecovery: restoreWallet != null, isRecovery: isRecovery,
restoreHeight: credentials.height ?? 0, restoreHeight: credentials.height ?? 0,
date: DateTime.now(), date: DateTime.now(),
path: path, path: path,