From 0cace4d7bc976987940698168e56aa77c1ea776e Mon Sep 17 00:00:00 2001 From: julian Date: Thu, 9 Mar 2023 15:08:13 -0600 Subject: [PATCH] partial derivation not found null fix --- lib/services/coins/bitcoin/bitcoin_wallet.dart | 15 +++++++++++++++ lib/services/coins/dogecoin/dogecoin_wallet.dart | 15 +++++++++++++++ lib/services/coins/firo/firo_wallet.dart | 15 +++++++++++++++ lib/services/coins/litecoin/litecoin_wallet.dart | 15 +++++++++++++++ lib/services/coins/namecoin/namecoin_wallet.dart | 15 +++++++++++++++ lib/services/coins/particl/particl_wallet.dart | 15 +++++++++++++++ 6 files changed, 90 insertions(+) diff --git a/lib/services/coins/bitcoin/bitcoin_wallet.dart b/lib/services/coins/bitcoin/bitcoin_wallet.dart index 235422e2e..f2cb481a0 100644 --- a/lib/services/coins/bitcoin/bitcoin_wallet.dart +++ b/lib/services/coins/bitcoin/bitcoin_wallet.dart @@ -2720,6 +2720,21 @@ class BitcoinWallet extends CoinServiceAPI } } + if (wif == null || pubKey == null) { + final address = await db.getAddress(walletId, sd.utxo.address!); + if (address?.derivationPath != null) { + final node = await Bip32Utils.getBip32Node( + (await mnemonicString)!, + (await mnemonicPassphrase)!, + _network, + address!.derivationPath!.value, + ); + + wif = node.toWIF(); + pubKey = Format.uint8listToString(node.publicKey); + } + } + if (wif != null && pubKey != null) { final PaymentData data; final Uint8List? redeemScript; diff --git a/lib/services/coins/dogecoin/dogecoin_wallet.dart b/lib/services/coins/dogecoin/dogecoin_wallet.dart index 137b5a2be..22fa35b0b 100644 --- a/lib/services/coins/dogecoin/dogecoin_wallet.dart +++ b/lib/services/coins/dogecoin/dogecoin_wallet.dart @@ -2485,6 +2485,21 @@ class DogecoinWallet extends CoinServiceAPI } } + if (wif == null || pubKey == null) { + final address = await db.getAddress(walletId, sd.utxo.address!); + if (address?.derivationPath != null) { + final node = await Bip32Utils.getBip32Node( + (await mnemonicString)!, + (await mnemonicPassphrase)!, + network, + address!.derivationPath!.value, + ); + + wif = node.toWIF(); + pubKey = Format.uint8listToString(node.publicKey); + } + } + if (wif != null && pubKey != null) { final PaymentData data; final Uint8List? redeemScript; diff --git a/lib/services/coins/firo/firo_wallet.dart b/lib/services/coins/firo/firo_wallet.dart index 85560d88a..1653a0a8a 100644 --- a/lib/services/coins/firo/firo_wallet.dart +++ b/lib/services/coins/firo/firo_wallet.dart @@ -1711,6 +1711,21 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive { } } + if (wif == null || pubKey == null) { + final address = await db.getAddress(walletId, sd.utxo.address!); + if (address?.derivationPath != null) { + final node = await Bip32Utils.getBip32Node( + (await mnemonicString)!, + (await mnemonicPassphrase)!, + _network, + address!.derivationPath!.value, + ); + + wif = node.toWIF(); + pubKey = Format.uint8listToString(node.publicKey); + } + } + if (wif != null && pubKey != null) { final PaymentData data; final Uint8List? redeemScript; diff --git a/lib/services/coins/litecoin/litecoin_wallet.dart b/lib/services/coins/litecoin/litecoin_wallet.dart index fa4c0e22d..9a45c314b 100644 --- a/lib/services/coins/litecoin/litecoin_wallet.dart +++ b/lib/services/coins/litecoin/litecoin_wallet.dart @@ -2660,6 +2660,21 @@ class LitecoinWallet extends CoinServiceAPI } } + if (wif == null || pubKey == null) { + final address = await db.getAddress(walletId, sd.utxo.address!); + if (address?.derivationPath != null) { + final node = await Bip32Utils.getBip32Node( + (await mnemonicString)!, + (await mnemonicPassphrase)!, + _network, + address!.derivationPath!.value, + ); + + wif = node.toWIF(); + pubKey = Format.uint8listToString(node.publicKey); + } + } + if (wif != null && pubKey != null) { final PaymentData data; final Uint8List? redeemScript; diff --git a/lib/services/coins/namecoin/namecoin_wallet.dart b/lib/services/coins/namecoin/namecoin_wallet.dart index cc254ca31..ad6a9776c 100644 --- a/lib/services/coins/namecoin/namecoin_wallet.dart +++ b/lib/services/coins/namecoin/namecoin_wallet.dart @@ -2653,6 +2653,21 @@ class NamecoinWallet extends CoinServiceAPI } } + if (wif == null || pubKey == null) { + final address = await db.getAddress(walletId, sd.utxo.address!); + if (address?.derivationPath != null) { + final node = await Bip32Utils.getBip32Node( + (await mnemonicString)!, + (await mnemonicPassphrase)!, + _network, + address!.derivationPath!.value, + ); + + wif = node.toWIF(); + pubKey = Format.uint8listToString(node.publicKey); + } + } + if (wif != null && pubKey != null) { final PaymentData data; final Uint8List? redeemScript; diff --git a/lib/services/coins/particl/particl_wallet.dart b/lib/services/coins/particl/particl_wallet.dart index 560f58532..0e2c14923 100644 --- a/lib/services/coins/particl/particl_wallet.dart +++ b/lib/services/coins/particl/particl_wallet.dart @@ -2814,6 +2814,21 @@ class ParticlWallet extends CoinServiceAPI } } + if (wif == null || pubKey == null) { + final address = await db.getAddress(walletId, sd.utxo.address!); + if (address?.derivationPath != null) { + final node = await Bip32Utils.getBip32Node( + (await mnemonicString)!, + (await mnemonicPassphrase)!, + _network, + address!.derivationPath!.value, + ); + + wif = node.toWIF(); + pubKey = Format.uint8listToString(node.publicKey); + } + } + if (wif != null && pubKey != null) { final PaymentData data; final Uint8List? redeemScript;