mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-09 10:16:04 +00:00
split default derivation in to defaultCreation and mostCommon
This commit is contained in:
parent
7b49b2ad87
commit
34f7ed4eae
3 changed files with 21 additions and 6 deletions
|
@ -377,8 +377,6 @@ class WalletRestorePage extends BasePage {
|
||||||
) as DerivationInfo?;
|
) as DerivationInfo?;
|
||||||
} else if (derivationsWithHistory == 1) {
|
} else if (derivationsWithHistory == 1) {
|
||||||
dInfo = derivations[derivationWithHistoryIndex];
|
dInfo = derivations[derivationWithHistoryIndex];
|
||||||
} else if (derivationsWithHistory == 0 && derivations.isNotEmpty) {
|
|
||||||
dInfo = derivations.first;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dInfo == null) {
|
if (dInfo == null) {
|
||||||
|
@ -390,7 +388,7 @@ class WalletRestorePage extends BasePage {
|
||||||
|
|
||||||
// get the default derivation for this wallet type:
|
// get the default derivation for this wallet type:
|
||||||
if (this.derivationInfo == null) {
|
if (this.derivationInfo == null) {
|
||||||
this.derivationInfo = walletRestoreViewModel.getDefaultDerivation();
|
this.derivationInfo = walletRestoreViewModel.getMostCommonDerivation();
|
||||||
}
|
}
|
||||||
|
|
||||||
walletRestoreViewModel.state = InitialExecutionState();
|
walletRestoreViewModel.state = InitialExecutionState();
|
||||||
|
|
|
@ -59,7 +59,7 @@ abstract class WalletRestorationFromQRVMBase extends WalletCreationVM with Store
|
||||||
derivationInfo = options["derivationInfo"] as DerivationInfo?;
|
derivationInfo = options["derivationInfo"] as DerivationInfo?;
|
||||||
passphrase = options["passphrase"] as String?;
|
passphrase = options["passphrase"] as String?;
|
||||||
}
|
}
|
||||||
derivationInfo ??= getDefaultDerivation();
|
derivationInfo ??= getDefaultCreationDerivation();
|
||||||
|
|
||||||
switch (restoreWallet.restoreMode) {
|
switch (restoreWallet.restoreMode) {
|
||||||
case WalletRestoreMode.keys:
|
case WalletRestoreMode.keys:
|
||||||
|
|
|
@ -71,7 +71,7 @@ abstract class WalletCreationVMBase with Store {
|
||||||
dirPath: dirPath,
|
dirPath: dirPath,
|
||||||
address: '',
|
address: '',
|
||||||
showIntroCakePayCard: (!walletCreationService.typeExists(type)) && type != WalletType.haven,
|
showIntroCakePayCard: (!walletCreationService.typeExists(type)) && type != WalletType.haven,
|
||||||
derivationInfo: credentials.derivationInfo ?? getDefaultDerivation(),
|
derivationInfo: credentials.derivationInfo ?? getDefaultCreationDerivation(),
|
||||||
);
|
);
|
||||||
|
|
||||||
credentials.walletInfo = walletInfo;
|
credentials.walletInfo = walletInfo;
|
||||||
|
@ -89,7 +89,7 @@ abstract class WalletCreationVMBase with Store {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DerivationInfo? getDefaultDerivation() {
|
DerivationInfo? getDefaultCreationDerivation() {
|
||||||
switch (this.type) {
|
switch (this.type) {
|
||||||
case WalletType.nano:
|
case WalletType.nano:
|
||||||
return DerivationInfo(
|
return DerivationInfo(
|
||||||
|
@ -106,6 +106,23 @@ abstract class WalletCreationVMBase with Store {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DerivationInfo? getMostCommonDerivation() {
|
||||||
|
switch (this.type) {
|
||||||
|
case WalletType.nano:
|
||||||
|
return DerivationInfo(
|
||||||
|
derivationType: DerivationType.nano,
|
||||||
|
);
|
||||||
|
case WalletType.bitcoin:
|
||||||
|
case WalletType.litecoin:
|
||||||
|
return DerivationInfo(
|
||||||
|
derivationType: DerivationType.electrum,
|
||||||
|
derivationPath: "m/84'/0'/0'/0",
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WalletCredentials getCredentials(dynamic options) => throw UnimplementedError();
|
WalletCredentials getCredentials(dynamic options) => throw UnimplementedError();
|
||||||
|
|
||||||
Future<WalletBase> process(WalletCredentials credentials) => throw UnimplementedError();
|
Future<WalletBase> process(WalletCredentials credentials) => throw UnimplementedError();
|
||||||
|
|
Loading…
Reference in a new issue