update wallet restore page to be less confusing for nano users (#1186)

* update wallet restore page to be less confusing for nano users

* update translations

* only include private key if seed phrase is null

* restore fixes

* fix default derivation being wrong on restore

* fix default nano derivationType & qr code parameters

* update language on nano restore (hex form)

* support hex seed from qr restore
This commit is contained in:
Matthew Fosse
2023-11-25 01:35:00 +02:00
committed by GitHub
parent fa25a4b224
commit eeb9976d09
32 changed files with 125 additions and 81 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ class RestoredWallet {
factory RestoredWallet.fromSeed(Map<String, dynamic> json) {
final height = json['height'] as String?;
final mnemonic_seed = json['mnemonic_seed'] as String?;
final seed = json['seed'] as String?;
final seed = json['seed'] as String? ?? json['hexSeed'] as String?;
return RestoredWallet(
restoreMode: json['mode'] as WalletRestoreMode,
type: json['type'] as WalletType,
@@ -151,6 +151,14 @@ class WalletRestoreFromQRCode {
return WalletRestoreMode.keys;
}
if ((type == WalletType.nano || type == WalletType.banano) && credentials.containsKey('hexSeed')) {
final hexSeed = credentials['hexSeed'] as String;
if (hexSeed.isEmpty) {
throw Exception('Unexpected restore mode: hexSeed');
}
return WalletRestoreMode.seed;
}
throw Exception('Unexpected restore mode: restore params are invalid');
}
}