mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-20 17:54:41 +00:00
[wip] fixing
This commit is contained in:
parent
66194ac2ba
commit
a5f6378bb9
3 changed files with 9 additions and 8 deletions
|
@ -54,11 +54,6 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
|
||||||
initialBalance: initialBalance,
|
initialBalance: initialBalance,
|
||||||
seedBytes: seedBytes,
|
seedBytes: seedBytes,
|
||||||
currency: CryptoCurrency.btc) {
|
currency: CryptoCurrency.btc) {
|
||||||
// in a standard BIP44 wallet, mainHd derivation path = m/84'/0'/0'/0 (account 0, index unspecified here)
|
|
||||||
// the sideHd derivation path = m/84'/0'/0'/1 (account 1, index unspecified here)
|
|
||||||
// String derivationPath = walletInfo.derivationInfo!.derivationPath!;
|
|
||||||
// String sideDerivationPath = derivationPath.substring(0, derivationPath.length - 1) + "1";
|
|
||||||
// final hd = bitcoin.HDWallet.fromSeed(seedBytes, network: networkType);
|
|
||||||
walletAddresses = BitcoinWalletAddresses(
|
walletAddresses = BitcoinWalletAddresses(
|
||||||
walletInfo,
|
walletInfo,
|
||||||
electrumClient: electrumClient,
|
electrumClient: electrumClient,
|
||||||
|
@ -134,7 +129,7 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
|
||||||
);
|
);
|
||||||
|
|
||||||
// set the default if not present:
|
// set the default if not present:
|
||||||
walletInfo.derivationInfo!.derivationPath = snp.derivationPath ?? "m/0'/0";
|
walletInfo.derivationInfo!.derivationPath = snp.derivationPath ?? "m/0'";
|
||||||
walletInfo.derivationInfo!.derivationType = snp.derivationType ?? DerivationType.electrum;
|
walletInfo.derivationInfo!.derivationType = snp.derivationType ?? DerivationType.electrum;
|
||||||
|
|
||||||
Uint8List? seedBytes = null;
|
Uint8List? seedBytes = null;
|
||||||
|
@ -154,6 +149,10 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print(walletInfo.derivationInfo!.derivationType);
|
||||||
|
print(walletInfo.derivationInfo!.derivationPath);
|
||||||
|
print("@@@@@@@@@@@@@@@");
|
||||||
|
|
||||||
return BitcoinWallet(
|
return BitcoinWallet(
|
||||||
mnemonic: snp.mnemonic,
|
mnemonic: snp.mnemonic,
|
||||||
xpub: snp.xpub,
|
xpub: snp.xpub,
|
||||||
|
|
|
@ -51,6 +51,7 @@ class ElectrumWallet = ElectrumWalletBase with _$ElectrumWallet;
|
||||||
abstract class ElectrumWalletBase
|
abstract class ElectrumWalletBase
|
||||||
extends WalletBase<ElectrumBalance, ElectrumTransactionHistory, ElectrumTransactionInfo>
|
extends WalletBase<ElectrumBalance, ElectrumTransactionHistory, ElectrumTransactionInfo>
|
||||||
with Store {
|
with Store {
|
||||||
|
String ELECTRUM_DERIVATION = "m/0'";
|
||||||
ElectrumWalletBase(
|
ElectrumWalletBase(
|
||||||
{required String password,
|
{required String password,
|
||||||
required WalletInfo walletInfo,
|
required WalletInfo walletInfo,
|
||||||
|
@ -120,6 +121,7 @@ abstract class ElectrumWalletBase
|
||||||
final String? _mnemonic;
|
final String? _mnemonic;
|
||||||
|
|
||||||
bitcoin.HDWallet get hd => accountHD.derive(0);
|
bitcoin.HDWallet get hd => accountHD.derive(0);
|
||||||
|
bitcoin.HDWallet get sideHd => accountHD.derive(1);
|
||||||
final String? passphrase;
|
final String? passphrase;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ElectrumWalletSnapshot {
|
||||||
|
|
||||||
final derivationType =
|
final derivationType =
|
||||||
DerivationType.values[(data['derivationTypeIndex'] as int?) ?? DerivationType.electrum.index];
|
DerivationType.values[(data['derivationTypeIndex'] as int?) ?? DerivationType.electrum.index];
|
||||||
final derivationPath = data['derivationPath'] as String? ?? "m/0'/0";
|
final derivationPath = data['derivationPath'] as String? ?? "m/0'";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
regularAddressIndexByType = {
|
regularAddressIndexByType = {
|
||||||
|
|
Loading…
Reference in a new issue