From 50f7dc0640ac4fa470f1c826817b140440bff116 Mon Sep 17 00:00:00 2001 From: M Date: Wed, 12 Jan 2022 15:33:56 +0200 Subject: [PATCH] Fixes for casting Litecoin wallets to Bitcoin wallets. Instead of that is using Electrum wallet class. --- lib/bitcoin/cw_bitcoin.dart | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/bitcoin/cw_bitcoin.dart b/lib/bitcoin/cw_bitcoin.dart index 650b5771b..b514cd6d4 100644 --- a/lib/bitcoin/cw_bitcoin.dart +++ b/lib/bitcoin/cw_bitcoin.dart @@ -21,7 +21,7 @@ class CWBitcoin extends Bitcoin { @override Map getWalletKeys(Object wallet) { - final bitcoinWallet = wallet as BitcoinWallet; + final bitcoinWallet = wallet as ElectrumWallet; final keys = bitcoinWallet.keys; return { @@ -41,25 +41,25 @@ class CWBitcoin extends Bitcoin { @override int getFeeRate(Object wallet, TransactionPriority priority) { - final bitcoinWallet = wallet as BitcoinWallet; + final bitcoinWallet = wallet as ElectrumWallet; return bitcoinWallet.feeRate(priority); } @override Future generateNewAddress(Object wallet) async { - final bitcoinWallet = wallet as BitcoinWallet; + final bitcoinWallet = wallet as ElectrumWallet; await bitcoinWallet.walletAddresses.generateNewAddress(); } @override Future nextAddress(Object wallet) { - final bitcoinWallet = wallet as BitcoinWallet; + final bitcoinWallet = wallet as ElectrumWallet; bitcoinWallet.walletAddresses.nextAddress(); } @override Future randomAddress(Object wallet) { - final bitcoinWallet = wallet as BitcoinWallet; + final bitcoinWallet = wallet as ElectrumWallet; bitcoinWallet.walletAddresses.randomizeAddress(); } @@ -80,7 +80,7 @@ class CWBitcoin extends Bitcoin { @override List getAddresses(Object wallet) { - final bitcoinWallet = wallet as BitcoinWallet; + final bitcoinWallet = wallet as ElectrumWallet; return bitcoinWallet.walletAddresses.addresses .map((BitcoinAddressRecord addr) => addr.address) .toList(); @@ -88,7 +88,7 @@ class CWBitcoin extends Bitcoin { @override String getAddress(Object wallet) { - final bitcoinWallet = wallet as BitcoinWallet; + final bitcoinWallet = wallet as ElectrumWallet; return bitcoinWallet.walletAddresses.address; } @@ -106,7 +106,7 @@ class CWBitcoin extends Bitcoin { @override List getUnspents(Object wallet) { - final bitcoinWallet = wallet as BitcoinWallet; + final bitcoinWallet = wallet as ElectrumWallet; return bitcoinWallet.unspentCoins .map((BitcoinUnspent bitcoinUnspent) => Unspent( bitcoinUnspent.address.address, @@ -117,7 +117,7 @@ class CWBitcoin extends Bitcoin { } void updateUnspents(Object wallet) async { - final bitcoinWallet = wallet as BitcoinWallet; + final bitcoinWallet = wallet as ElectrumWallet; await bitcoinWallet.updateUnspent(); }