mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
Fix errors from seed restore not being shown to user properly (#2019)
This commit is contained in:
parent
92fc6a4a60
commit
637bc1cdc9
2 changed files with 15 additions and 8 deletions
|
@ -100,7 +100,7 @@ void restoreWalletFromSeedSync(
|
|||
required String passphrase,
|
||||
required String seed,
|
||||
int nettype = 0,
|
||||
int restoreHeight = 0}) async {
|
||||
int restoreHeight = 0}) {
|
||||
txhistory = null;
|
||||
final newWptr = monero.WalletManager_recoveryWallet(
|
||||
wmPtr,
|
||||
|
@ -404,7 +404,7 @@ void _restoreFromSeed(Map<String, dynamic> args) {
|
|||
final seed = args['seed'] as String;
|
||||
final restoreHeight = args['restoreHeight'] as int;
|
||||
|
||||
restoreWalletFromSeedSync(
|
||||
return restoreWalletFromSeedSync(
|
||||
path: path, password: password, passphrase: passphrase, seed: seed, restoreHeight: restoreHeight);
|
||||
}
|
||||
|
||||
|
@ -472,13 +472,13 @@ Future<void> createWallet(
|
|||
'nettype': nettype
|
||||
});
|
||||
|
||||
Future<void> restoreFromSeed(
|
||||
void restoreFromSeed(
|
||||
{required String path,
|
||||
required String password,
|
||||
required String passphrase,
|
||||
required String seed,
|
||||
int nettype = 0,
|
||||
int restoreHeight = 0}) async =>
|
||||
int restoreHeight = 0}) =>
|
||||
_restoreFromSeed({
|
||||
'path': path,
|
||||
'password': password,
|
||||
|
|
|
@ -292,14 +292,21 @@ class MoneroWalletService extends WalletService<
|
|||
Future<MoneroWallet> restoreFromSeed(
|
||||
MoneroRestoreWalletFromSeedCredentials credentials,
|
||||
{bool? isTestnet}) async {
|
||||
// Restore from Polyseed
|
||||
if (Polyseed.isValidSeed(credentials.mnemonic)) {
|
||||
return restoreFromPolyseed(credentials);
|
||||
if (credentials.mnemonic.split(" ").length == 16) {
|
||||
// Restore from Polyseed
|
||||
try {
|
||||
if (Polyseed.isValidSeed(credentials.mnemonic)) {
|
||||
return restoreFromPolyseed(credentials);
|
||||
}
|
||||
} catch (e) {
|
||||
printV("Polyseed restore failed: $e");
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
final path = await pathForWallet(name: credentials.name, type: getType());
|
||||
await monero_wallet_manager.restoreFromSeed(
|
||||
monero_wallet_manager.restoreFromSeed(
|
||||
path: path,
|
||||
password: credentials.password!,
|
||||
passphrase: credentials.passphrase,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue