[wip] fixing

This commit is contained in:
Matthew Fosse 2024-05-09 08:49:20 -07:00
parent 66194ac2ba
commit a5f6378bb9
3 changed files with 9 additions and 8 deletions

View file

@ -54,11 +54,6 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
initialBalance: initialBalance,
seedBytes: seedBytes,
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(
walletInfo,
electrumClient: electrumClient,
@ -134,7 +129,7 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
);
// 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;
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(
mnemonic: snp.mnemonic,
xpub: snp.xpub,

View file

@ -51,6 +51,7 @@ class ElectrumWallet = ElectrumWalletBase with _$ElectrumWallet;
abstract class ElectrumWalletBase
extends WalletBase<ElectrumBalance, ElectrumTransactionHistory, ElectrumTransactionInfo>
with Store {
String ELECTRUM_DERIVATION = "m/0'";
ElectrumWalletBase(
{required String password,
required WalletInfo walletInfo,
@ -120,6 +121,7 @@ abstract class ElectrumWalletBase
final String? _mnemonic;
bitcoin.HDWallet get hd => accountHD.derive(0);
bitcoin.HDWallet get sideHd => accountHD.derive(1);
final String? passphrase;
@override

View file

@ -59,7 +59,7 @@ class ElectrumWalletSnapshot {
final derivationType =
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 {
regularAddressIndexByType = {