frost wallet backup screen bugfix

This commit is contained in:
julian 2024-05-02 09:41:57 -06:00
parent 969e7f2dcd
commit 7276cd41f0
2 changed files with 16 additions and 20 deletions

View file

@ -35,12 +35,12 @@ import 'package:stackwallet/widgets/stack_dialog.dart';
class WalletBackupView extends ConsumerWidget { class WalletBackupView extends ConsumerWidget {
const WalletBackupView({ const WalletBackupView({
Key? key, super.key,
required this.walletId, required this.walletId,
required this.mnemonic, required this.mnemonic,
this.frostWalletData, this.frostWalletData,
this.clipboardInterface = const ClipboardWrapper(), this.clipboardInterface = const ClipboardWrapper(),
}) : super(key: key); });
static const String routeName = "/walletBackup"; static const String routeName = "/walletBackup";

View file

@ -53,13 +53,13 @@ import 'package:tuple/tuple.dart';
/// [eventBus] should only be set during testing /// [eventBus] should only be set during testing
class WalletSettingsView extends ConsumerStatefulWidget { class WalletSettingsView extends ConsumerStatefulWidget {
const WalletSettingsView({ const WalletSettingsView({
Key? key, super.key,
required this.walletId, required this.walletId,
required this.coin, required this.coin,
required this.initialSyncStatus, required this.initialSyncStatus,
required this.initialNodeStatus, required this.initialNodeStatus,
this.eventBus, this.eventBus,
}) : super(key: key); });
static const String routeName = "/walletSettings"; static const String routeName = "/walletSettings";
@ -267,31 +267,27 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
})? prevGen, })? prevGen,
})? frostWalletData; })? frostWalletData;
if (wallet is BitcoinFrostWallet) { if (wallet is BitcoinFrostWallet) {
List<Future<dynamic>> futures = []; final futures = [
wallet.getSerializedKeys(),
futures.addAll( wallet.getMultisigConfig(),
[ wallet.getSerializedKeysPrevGen(),
wallet.getSerializedKeys(), wallet.getMultisigConfigPrevGen(),
wallet.getMultisigConfig(), ];
wallet.getSerializedKeysPrevGen(),
wallet.getMultisigConfigPrevGen(),
],
);
final results = final results =
await Future.wait(futures); await Future.wait(futures);
if (results.length == 5) { if (results.length == 4) {
frostWalletData = ( frostWalletData = (
myName: wallet.frostInfo.myName, myName: wallet.frostInfo.myName,
config: results[1], config: results[1]!,
keys: results[0], keys: results[0]!,
prevGen: results[2] == null || prevGen: results[2] == null ||
results[3] == null results[3] == null
? null ? null
: ( : (
config: results[3], config: results[3]!,
keys: results[2], keys: results[2]!,
), ),
); );
} }
@ -301,7 +297,7 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
await wallet.getMnemonicAsWords(); await wallet.getMnemonicAsWords();
} }
if (mounted) { if (context.mounted) {
await Navigator.push( await Navigator.push(
context, context,
RouteGenerator.getRoute( RouteGenerator.getRoute(