Merge branch 'bitcoin-derivations' of https://github.com/cake-tech/cake_wallet into bip39-less-confusing [skip ci]

This commit is contained in:
Matthew Fosse 2024-04-29 14:42:04 -07:00
commit cf653cbe97
3 changed files with 14 additions and 6 deletions

View file

@ -106,5 +106,11 @@ Map<DerivationType, List<DerivationInfo>> bitcoin_derivations = {
description: "Samourai Ricochet native segwit",
scriptType: "p2wpkh",
),
DerivationInfo(
derivationType: DerivationType.bip39,
derivationPath: "m/84'/2'/0'",
description: "Default Litecoin",
scriptType: "p2wpkh",
),
],
};

View file

@ -106,8 +106,9 @@ class CWNano extends Nano {
required String mnemonic,
required DerivationType derivationType,
}) {
if (mnemonic.split(" ").length == 12) {
derivationType = DerivationType.bip39;
if (mnemonic.split(" ").length == 12 && derivationType != DerivationType.bip39) {
throw Exception("Invalid mnemonic for derivation type!");
}
return NanoRestoreWalletFromSeedCredentials(
@ -125,8 +126,9 @@ class CWNano extends Nano {
required String seedKey,
required DerivationType derivationType,
}) {
if (seedKey.length == 128) {
derivationType = DerivationType.bip39;
if (seedKey.length == 128 && derivationType != DerivationType.bip39) {
throw Exception("Invalid seed key length for derivation type!");
}
return NanoRestoreWalletFromKeysCredentials(

View file

@ -387,7 +387,7 @@ class WalletRestorePage extends BasePage {
} else {
// if we have multiple possible derivations, and none have histories
// we just default to the most common one:
dInfo = walletRestoreViewModel.getMostCommonDerivation();
dInfo = walletRestoreViewModel.getCommonRestoreDerivation();
}
}