mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-12 09:32:33 +00:00
fixes
This commit is contained in:
parent
287f3e06f7
commit
30c870b726
2 changed files with 22 additions and 1 deletions
|
@ -114,6 +114,10 @@ class BitcoinWalletService extends WalletService<BitcoinNewWalletCredentials,
|
|||
static Future<List<DerivationType>> compareDerivationMethods(
|
||||
{required String mnemonic, required Node node}) async {
|
||||
|
||||
if (!validateMnemonic(mnemonic)) {
|
||||
throw BitcoinMnemonicIsIncorrectException();
|
||||
}
|
||||
|
||||
if (await checkIfMnemonicIsElectrum2(mnemonic)) {
|
||||
return [DerivationType.electrum2];
|
||||
}
|
||||
|
|
|
@ -30,8 +30,25 @@ abstract class WalletRestoreChooseDerivationViewModelBase with Store {
|
|||
switch (walletType) {
|
||||
case WalletType.bitcoin:
|
||||
String? mnemonic = credentials['seed'] as String?;
|
||||
return await BitcoinWalletService.getDerivationsFromMnemonic(mnemonic: mnemonic!, node: node);
|
||||
var derivations = await BitcoinWalletService.getDerivationsFromMnemonic(mnemonic: mnemonic!, node: node);
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < derivations.length; i++) {
|
||||
if (derivations[i].height != 0) {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
if (count == 1) {
|
||||
for (int i = 0; i < derivations.length; i++) {
|
||||
if (derivations[i].height != 0) {
|
||||
list.add(derivations[i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return derivations;
|
||||
}
|
||||
|
||||
|
||||
// var standardInfo = await NanoWalletService.getInfoFromSeedOrMnemonic(
|
||||
// DerivationType.nano,
|
||||
// mnemonic: mnemonic,
|
||||
|
|
Loading…
Reference in a new issue