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 passphrase,
|
||||||
required String seed,
|
required String seed,
|
||||||
int nettype = 0,
|
int nettype = 0,
|
||||||
int restoreHeight = 0}) async {
|
int restoreHeight = 0}) {
|
||||||
txhistory = null;
|
txhistory = null;
|
||||||
final newWptr = monero.WalletManager_recoveryWallet(
|
final newWptr = monero.WalletManager_recoveryWallet(
|
||||||
wmPtr,
|
wmPtr,
|
||||||
|
@ -404,7 +404,7 @@ void _restoreFromSeed(Map<String, dynamic> args) {
|
||||||
final seed = args['seed'] as String;
|
final seed = args['seed'] as String;
|
||||||
final restoreHeight = args['restoreHeight'] as int;
|
final restoreHeight = args['restoreHeight'] as int;
|
||||||
|
|
||||||
restoreWalletFromSeedSync(
|
return restoreWalletFromSeedSync(
|
||||||
path: path, password: password, passphrase: passphrase, seed: seed, restoreHeight: restoreHeight);
|
path: path, password: password, passphrase: passphrase, seed: seed, restoreHeight: restoreHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,13 +472,13 @@ Future<void> createWallet(
|
||||||
'nettype': nettype
|
'nettype': nettype
|
||||||
});
|
});
|
||||||
|
|
||||||
Future<void> restoreFromSeed(
|
void restoreFromSeed(
|
||||||
{required String path,
|
{required String path,
|
||||||
required String password,
|
required String password,
|
||||||
required String passphrase,
|
required String passphrase,
|
||||||
required String seed,
|
required String seed,
|
||||||
int nettype = 0,
|
int nettype = 0,
|
||||||
int restoreHeight = 0}) async =>
|
int restoreHeight = 0}) =>
|
||||||
_restoreFromSeed({
|
_restoreFromSeed({
|
||||||
'path': path,
|
'path': path,
|
||||||
'password': password,
|
'password': password,
|
||||||
|
|
|
@ -292,14 +292,21 @@ class MoneroWalletService extends WalletService<
|
||||||
Future<MoneroWallet> restoreFromSeed(
|
Future<MoneroWallet> restoreFromSeed(
|
||||||
MoneroRestoreWalletFromSeedCredentials credentials,
|
MoneroRestoreWalletFromSeedCredentials credentials,
|
||||||
{bool? isTestnet}) async {
|
{bool? isTestnet}) async {
|
||||||
// Restore from Polyseed
|
if (credentials.mnemonic.split(" ").length == 16) {
|
||||||
if (Polyseed.isValidSeed(credentials.mnemonic)) {
|
// Restore from Polyseed
|
||||||
return restoreFromPolyseed(credentials);
|
try {
|
||||||
|
if (Polyseed.isValidSeed(credentials.mnemonic)) {
|
||||||
|
return restoreFromPolyseed(credentials);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
printV("Polyseed restore failed: $e");
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final path = await pathForWallet(name: credentials.name, type: getType());
|
final path = await pathForWallet(name: credentials.name, type: getType());
|
||||||
await monero_wallet_manager.restoreFromSeed(
|
monero_wallet_manager.restoreFromSeed(
|
||||||
path: path,
|
path: path,
|
||||||
password: credentials.password!,
|
password: credentials.password!,
|
||||||
passphrase: credentials.passphrase,
|
passphrase: credentials.passphrase,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue