mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
Merge branch 'bitcoin-derivations' of https://github.com/cake-tech/cake_wallet into bip39-less-confusing [skip ci]
This commit is contained in:
commit
cf653cbe97
3 changed files with 14 additions and 6 deletions
|
@ -64,7 +64,7 @@ Map<DerivationType, List<DerivationInfo>> bitcoin_derivations = {
|
||||||
description: "Samourai Deposit",
|
description: "Samourai Deposit",
|
||||||
scriptType: "p2wpkh",
|
scriptType: "p2wpkh",
|
||||||
),
|
),
|
||||||
DerivationInfo(
|
DerivationInfo(
|
||||||
derivationType: DerivationType.bip39,
|
derivationType: DerivationType.bip39,
|
||||||
derivationPath: "m/84'/0'/0'",
|
derivationPath: "m/84'/0'/0'",
|
||||||
description: "Samourai Deposit",
|
description: "Samourai Deposit",
|
||||||
|
@ -106,5 +106,11 @@ Map<DerivationType, List<DerivationInfo>> bitcoin_derivations = {
|
||||||
description: "Samourai Ricochet native segwit",
|
description: "Samourai Ricochet native segwit",
|
||||||
scriptType: "p2wpkh",
|
scriptType: "p2wpkh",
|
||||||
),
|
),
|
||||||
|
DerivationInfo(
|
||||||
|
derivationType: DerivationType.bip39,
|
||||||
|
derivationPath: "m/84'/2'/0'",
|
||||||
|
description: "Default Litecoin",
|
||||||
|
scriptType: "p2wpkh",
|
||||||
|
),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -106,8 +106,9 @@ class CWNano extends Nano {
|
||||||
required String mnemonic,
|
required String mnemonic,
|
||||||
required DerivationType derivationType,
|
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(
|
return NanoRestoreWalletFromSeedCredentials(
|
||||||
|
@ -125,8 +126,9 @@ class CWNano extends Nano {
|
||||||
required String seedKey,
|
required String seedKey,
|
||||||
required DerivationType derivationType,
|
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(
|
return NanoRestoreWalletFromKeysCredentials(
|
||||||
|
|
|
@ -387,7 +387,7 @@ class WalletRestorePage extends BasePage {
|
||||||
} else {
|
} else {
|
||||||
// if we have multiple possible derivations, and none have histories
|
// if we have multiple possible derivations, and none have histories
|
||||||
// we just default to the most common one:
|
// we just default to the most common one:
|
||||||
dInfo = walletRestoreViewModel.getMostCommonDerivation();
|
dInfo = walletRestoreViewModel.getCommonRestoreDerivation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue