mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-05 10:29:23 +00:00
Cw 772 restore from qr generates different wallet (#1742)
* fix derivation info for QR restoring * allow all available seed languages for Monero * set default derivation info for an empty wallet * fix electrum case
This commit is contained in:
parent
cb75f08b35
commit
605d164998
2 changed files with 34 additions and 19 deletions
|
@ -37,7 +37,8 @@ abstract class WalletRestorationFromQRVMBase extends WalletCreationVM with Store
|
||||||
spendKey = '',
|
spendKey = '',
|
||||||
wif = '',
|
wif = '',
|
||||||
address = '',
|
address = '',
|
||||||
super(appStore, walletInfoSource, walletCreationService, seedSettingsViewModel, type: type, isRecovery: true);
|
super(appStore, walletInfoSource, walletCreationService, seedSettingsViewModel,
|
||||||
|
type: type, isRecovery: true);
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
int height;
|
int height;
|
||||||
|
@ -112,7 +113,14 @@ abstract class WalletRestorationFromQRVMBase extends WalletCreationVM with Store
|
||||||
);
|
);
|
||||||
case WalletType.bitcoin:
|
case WalletType.bitcoin:
|
||||||
case WalletType.litecoin:
|
case WalletType.litecoin:
|
||||||
final derivationInfo = (await getDerivationInfoFromQRCredentials(restoreWallet)).first;
|
|
||||||
|
final derivationInfoList = await getDerivationInfoFromQRCredentials(restoreWallet);
|
||||||
|
DerivationInfo derivationInfo;
|
||||||
|
if (derivationInfoList.isEmpty) {
|
||||||
|
derivationInfo = getDefaultCreateDerivation()!;
|
||||||
|
} else {
|
||||||
|
derivationInfo = derivationInfoList.first;
|
||||||
|
}
|
||||||
return bitcoin!.createBitcoinRestoreWalletFromSeedCredentials(
|
return bitcoin!.createBitcoinRestoreWalletFromSeedCredentials(
|
||||||
name: name,
|
name: name,
|
||||||
mnemonic: restoreWallet.mnemonicSeed ?? '',
|
mnemonic: restoreWallet.mnemonicSeed ?? '',
|
||||||
|
|
|
@ -198,11 +198,18 @@ abstract class WalletCreationVMBase with Store {
|
||||||
switch (walletType) {
|
switch (walletType) {
|
||||||
case WalletType.bitcoin:
|
case WalletType.bitcoin:
|
||||||
case WalletType.litecoin:
|
case WalletType.litecoin:
|
||||||
return bitcoin!.getDerivationsFromMnemonic(
|
|
||||||
|
final derivationList = await bitcoin!.getDerivationsFromMnemonic(
|
||||||
mnemonic: restoreWallet.mnemonicSeed!,
|
mnemonic: restoreWallet.mnemonicSeed!,
|
||||||
node: node,
|
node: node,
|
||||||
passphrase: restoreWallet.passphrase,
|
passphrase: restoreWallet.passphrase,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
if (derivationList.first.transactionsCount == 0 && derivationList.length > 1) return [];
|
||||||
|
|
||||||
|
return derivationList;
|
||||||
|
|
||||||
case WalletType.nano:
|
case WalletType.nano:
|
||||||
return nanoUtil!.getDerivationsFromMnemonic(
|
return nanoUtil!.getDerivationsFromMnemonic(
|
||||||
mnemonic: restoreWallet.mnemonicSeed!,
|
mnemonic: restoreWallet.mnemonicSeed!,
|
||||||
|
|
Loading…
Reference in a new issue