diff --git a/cw_bitcoin/lib/bitcoin_wallet.dart b/cw_bitcoin/lib/bitcoin_wallet.dart index ea2c60642..dd7820aa2 100644 --- a/cw_bitcoin/lib/bitcoin_wallet.dart +++ b/cw_bitcoin/lib/bitcoin_wallet.dart @@ -151,10 +151,6 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store { } } - print(walletInfo.derivationInfo!.derivationType); - print(walletInfo.derivationInfo!.derivationPath); - print("@@@@@@@@@@@@@@@"); - return BitcoinWallet( mnemonic: snp.mnemonic, xpub: snp.xpub, diff --git a/cw_bitcoin/lib/electrum_derivations.dart b/cw_bitcoin/lib/electrum_derivations.dart index 19d444a41..1f87dabc1 100644 --- a/cw_bitcoin/lib/electrum_derivations.dart +++ b/cw_bitcoin/lib/electrum_derivations.dart @@ -4,7 +4,7 @@ Map> electrum_derivations = { DerivationType.electrum: [ DerivationInfo( derivationType: DerivationType.electrum, - derivationPath: "m/0'", + derivationPath: "m/0'/0", description: "Electrum", scriptType: "p2wpkh", ), @@ -30,19 +30,19 @@ Map> electrum_derivations = { ), DerivationInfo( derivationType: DerivationType.bip39, - derivationPath: "m/0'", + derivationPath: "m/0'/0", description: "Non-standard legacy", scriptType: "p2pkh", ), DerivationInfo( derivationType: DerivationType.bip39, - derivationPath: "m/0'", + derivationPath: "m/0'/0", description: "Non-standard compatibility segwit", scriptType: "p2wpkh-p2sh", ), DerivationInfo( derivationType: DerivationType.bip39, - derivationPath: "m/0'", + derivationPath: "m/0'/0", description: "Non-standard native segwit", scriptType: "p2wpkh", ), diff --git a/cw_bitcoin/lib/electrum_wallet.dart b/cw_bitcoin/lib/electrum_wallet.dart index 2b86570f9..b70ac054f 100644 --- a/cw_bitcoin/lib/electrum_wallet.dart +++ b/cw_bitcoin/lib/electrum_wallet.dart @@ -1371,7 +1371,9 @@ abstract class ElectrumWalletBase final HD = index == null ? hd : hd.derive(index); final priv = ECPrivate.fromHex(HD.privKey!); String messagePrefix = '\x18Bitcoin Signed Message:\n'; - return priv.signMessage(utf8.encode(message), messagePrefix: messagePrefix); + final hexEncoded = priv.signMessage(utf8.encode(message), messagePrefix: messagePrefix); + final decodedSig = hex.decode(hexEncoded); + return base64Encode(decodedSig); } @override diff --git a/lib/entities/default_settings_migration.dart b/lib/entities/default_settings_migration.dart index e67bd2fc6..f2a905f56 100644 --- a/lib/entities/default_settings_migration.dart +++ b/lib/entities/default_settings_migration.dart @@ -766,6 +766,17 @@ Future changeDefaultMoneroNode( } } +Future fixBtcDerivationPaths(Box walletsInfoSource) async { + for (WalletInfo walletInfo in walletsInfoSource.values) { + if (walletInfo.type == WalletType.bitcoin) { + if (walletInfo.derivationInfo?.derivationPath == "m/0'") { + walletInfo.derivationInfo!.derivationPath = "m/0'/0"; + } + } + await walletInfo.save(); + } +} + Future updateBtcNanoWalletInfos(Box walletsInfoSource) async { for (WalletInfo walletInfo in walletsInfoSource.values) { if (walletInfo.type == WalletType.nano || walletInfo.type == WalletType.bitcoin) {