mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
litecoin fixes
This commit is contained in:
parent
4052d7edd5
commit
a008c1f2dd
2 changed files with 38 additions and 35 deletions
|
@ -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",
|
||||||
|
),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -355,12 +355,9 @@ class WalletRestorePage extends BasePage {
|
||||||
|
|
||||||
walletRestoreViewModel.state = IsExecutingState();
|
walletRestoreViewModel.state = IsExecutingState();
|
||||||
|
|
||||||
List<DerivationType> derivationTypes =
|
|
||||||
await walletRestoreViewModel.getDerivationTypes(_credentials());
|
|
||||||
DerivationInfo? dInfo;
|
DerivationInfo? dInfo;
|
||||||
|
|
||||||
if (derivationTypes.length > 1) {
|
// get info about the different derivations:
|
||||||
// push screen to choose the derivation type:
|
|
||||||
List<DerivationInfo> derivations =
|
List<DerivationInfo> derivations =
|
||||||
await walletRestoreViewModel.getDerivationInfo(_credentials());
|
await walletRestoreViewModel.getDerivationInfo(_credentials());
|
||||||
|
|
||||||
|
@ -373,32 +370,32 @@ class WalletRestorePage extends BasePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// dInfo = await Navigator.of(context).pushNamed(Routes.restoreWalletChooseDerivation,
|
|
||||||
// arguments: derivations) as DerivationInfo?;
|
|
||||||
|
|
||||||
if (derivationsWithHistory > 1) {
|
if (derivationsWithHistory > 1) {
|
||||||
dInfo = await Navigator.of(context).pushNamed(Routes.restoreWalletChooseDerivation,
|
dInfo = await Navigator.of(context).pushNamed(
|
||||||
arguments: derivations) as DerivationInfo?;
|
Routes.restoreWalletChooseDerivation,
|
||||||
|
arguments: derivations,
|
||||||
|
) as DerivationInfo?;
|
||||||
} else if (derivationsWithHistory == 1) {
|
} else if (derivationsWithHistory == 1) {
|
||||||
dInfo = derivations[derivationWithHistoryIndex];
|
dInfo = derivations[derivationWithHistoryIndex];
|
||||||
} else {
|
|
||||||
dInfo = walletRestoreViewModel.getCommonRestoreDerivation();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dInfo == null) {
|
|
||||||
walletRestoreViewModel.state = InitialExecutionState();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.derivationInfo = dInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the default derivation for this wallet type:
|
// get the default derivation for this wallet type:
|
||||||
if (this.derivationInfo == null) {
|
if (dInfo == null) {
|
||||||
this.derivationInfo = walletRestoreViewModel.getDefaultDerivation();
|
// we only return 1 derivation if we're pretty sure we know which one to use:
|
||||||
|
if (derivations.length == 1) {
|
||||||
|
dInfo = derivations.first;
|
||||||
|
} else {
|
||||||
|
// if we have multiple possible derivations, and none have histories
|
||||||
|
// we just default to the most common one:
|
||||||
|
dInfo = walletRestoreViewModel.getCommonRestoreDerivation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.derivationInfo = dInfo;
|
||||||
|
if (this.derivationInfo == null) {
|
||||||
walletRestoreViewModel.state = InitialExecutionState();
|
walletRestoreViewModel.state = InitialExecutionState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
walletRestoreViewModel.create(options: _credentials());
|
walletRestoreViewModel.create(options: _credentials());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue