From 8ba998af8f71690920b8d34fe7def1e648217a22 Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 15 Nov 2023 11:40:43 -0600 Subject: [PATCH] slight change to wallet constructors --- lib/wallets/wallet/impl/bitcoin_wallet.dart | 3 +- .../wallet/impl/bitcoincash_wallet.dart | 4 +- lib/wallets/wallet/impl/ecash_wallet.dart | 3 +- lib/wallets/wallet/impl/epiccash_wallet.dart | 3 +- lib/wallets/wallet/impl/wownero_wallet.dart | 3 +- lib/wallets/wallet/wallet.dart | 41 ++++++------------- 6 files changed, 24 insertions(+), 33 deletions(-) diff --git a/lib/wallets/wallet/impl/bitcoin_wallet.dart b/lib/wallets/wallet/impl/bitcoin_wallet.dart index 23ad82f7d..d257a7ae6 100644 --- a/lib/wallets/wallet/impl/bitcoin_wallet.dart +++ b/lib/wallets/wallet/impl/bitcoin_wallet.dart @@ -4,6 +4,7 @@ import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/extensions/extensions.dart'; import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin.dart'; +import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart'; import 'package:stackwallet/wallets/wallet/mixins/coin_control.dart'; import 'package:stackwallet/wallets/wallet/mixins/electrumx.dart'; @@ -13,7 +14,7 @@ class BitcoinWallet extends Bip39HDWallet with ElectrumX, CoinControl { @override int get isarTransactionVersion => 1; // TODO actually set this to 2 - BitcoinWallet(Bitcoin cryptoCurrency) : super(cryptoCurrency); + BitcoinWallet(CryptoCurrencyNetwork network) : super(Bitcoin(network)); @override FilterOperation? get changeAddressFilterOperation => diff --git a/lib/wallets/wallet/impl/bitcoincash_wallet.dart b/lib/wallets/wallet/impl/bitcoincash_wallet.dart index 0ff644c1f..1f7430c10 100644 --- a/lib/wallets/wallet/impl/bitcoincash_wallet.dart +++ b/lib/wallets/wallet/impl/bitcoincash_wallet.dart @@ -14,6 +14,7 @@ import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart'; import 'package:stackwallet/utilities/extensions/extensions.dart'; import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/wallets/crypto_currency/coins/bitcoincash.dart'; +import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart'; import 'package:stackwallet/wallets/wallet/mixins/cash_fusion.dart'; import 'package:stackwallet/wallets/wallet/mixins/coin_control.dart'; @@ -24,7 +25,8 @@ class BitcoincashWallet extends Bip39HDWallet @override int get isarTransactionVersion => 2; - BitcoincashWallet(Bitcoincash cryptoCurrency) : super(cryptoCurrency); + BitcoincashWallet(CryptoCurrencyNetwork network) + : super(Bitcoincash(network)); @override FilterOperation? get changeAddressFilterOperation => FilterGroup.and( diff --git a/lib/wallets/wallet/impl/ecash_wallet.dart b/lib/wallets/wallet/impl/ecash_wallet.dart index 9d38f082a..31b4ab617 100644 --- a/lib/wallets/wallet/impl/ecash_wallet.dart +++ b/lib/wallets/wallet/impl/ecash_wallet.dart @@ -14,6 +14,7 @@ import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart'; import 'package:stackwallet/utilities/extensions/extensions.dart'; import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/wallets/crypto_currency/coins/ecash.dart'; +import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart'; import 'package:stackwallet/wallets/wallet/mixins/cash_fusion.dart'; import 'package:stackwallet/wallets/wallet/mixins/coin_control.dart'; @@ -24,7 +25,7 @@ class EcashWallet extends Bip39HDWallet @override int get isarTransactionVersion => 2; - EcashWallet(Ecash cryptoCurrency) : super(cryptoCurrency); + EcashWallet(CryptoCurrencyNetwork network) : super(Ecash(network)); @override FilterOperation? get changeAddressFilterOperation => FilterGroup.and( diff --git a/lib/wallets/wallet/impl/epiccash_wallet.dart b/lib/wallets/wallet/impl/epiccash_wallet.dart index e11f384cf..4d842c8e6 100644 --- a/lib/wallets/wallet/impl/epiccash_wallet.dart +++ b/lib/wallets/wallet/impl/epiccash_wallet.dart @@ -5,11 +5,12 @@ import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/utilities/test_epic_box_connection.dart'; import 'package:stackwallet/wallets/crypto_currency/coins/epiccash.dart'; +import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/wallets/models/tx_data.dart'; import 'package:stackwallet/wallets/wallet/intermediate/bip39_wallet.dart'; class EpiccashWallet extends Bip39Wallet { - EpiccashWallet(Epiccash cryptoCurrency) : super(cryptoCurrency); + EpiccashWallet(CryptoCurrencyNetwork network) : super(Epiccash(network)); @override FilterOperation? get changeAddressFilterOperation => diff --git a/lib/wallets/wallet/impl/wownero_wallet.dart b/lib/wallets/wallet/impl/wownero_wallet.dart index bc9fe90a1..a3e27d6ce 100644 --- a/lib/wallets/wallet/impl/wownero_wallet.dart +++ b/lib/wallets/wallet/impl/wownero_wallet.dart @@ -39,13 +39,14 @@ import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart'; import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/utilities/stack_file_system.dart'; import 'package:stackwallet/wallets/crypto_currency/coins/wownero.dart'; +import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/wallets/models/tx_data.dart'; import 'package:stackwallet/wallets/wallet/intermediate/cryptonote_wallet.dart'; import 'package:stackwallet/wallets/wallet/mixins/multi_address.dart'; import 'package:tuple/tuple.dart'; class WowneroWallet extends CryptonoteWallet with MultiAddress { - WowneroWallet(Wownero wownero) : super(wownero); + WowneroWallet(CryptoCurrencyNetwork network) : super(Wownero(network)); @override FilterOperation? get changeAddressFilterOperation => null; diff --git a/lib/wallets/wallet/wallet.dart b/lib/wallets/wallet/wallet.dart index dcef51581..3b46e8dd3 100644 --- a/lib/wallets/wallet/wallet.dart +++ b/lib/wallets/wallet/wallet.dart @@ -19,16 +19,12 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'; import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/utilities/prefs.dart'; -import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin.dart'; -import 'package:stackwallet/wallets/crypto_currency/coins/bitcoincash.dart'; -import 'package:stackwallet/wallets/crypto_currency/coins/ecash.dart'; -import 'package:stackwallet/wallets/crypto_currency/coins/epiccash.dart'; -import 'package:stackwallet/wallets/crypto_currency/coins/wownero.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/wallets/isar/models/wallet_info.dart'; import 'package:stackwallet/wallets/models/tx_data.dart'; import 'package:stackwallet/wallets/wallet/impl/bitcoin_wallet.dart'; import 'package:stackwallet/wallets/wallet/impl/bitcoincash_wallet.dart'; +import 'package:stackwallet/wallets/wallet/impl/dogecoin_wallet.dart'; import 'package:stackwallet/wallets/wallet/impl/ecash_wallet.dart'; import 'package:stackwallet/wallets/wallet/impl/epiccash_wallet.dart'; import 'package:stackwallet/wallets/wallet/impl/wownero_wallet.dart'; @@ -243,39 +239,28 @@ abstract class Wallet { }) { switch (walletInfo.coin) { case Coin.bitcoin: - return BitcoinWallet( - Bitcoin(CryptoCurrencyNetwork.main), - ); - + return BitcoinWallet(CryptoCurrencyNetwork.main); case Coin.bitcoinTestNet: - return BitcoinWallet( - Bitcoin(CryptoCurrencyNetwork.test), - ); + return BitcoinWallet(CryptoCurrencyNetwork.test); case Coin.bitcoincash: - return BitcoincashWallet( - Bitcoincash(CryptoCurrencyNetwork.main), - ); - + return BitcoincashWallet(CryptoCurrencyNetwork.main); case Coin.bitcoincashTestnet: - return BitcoincashWallet( - Bitcoincash(CryptoCurrencyNetwork.test), - ); + return BitcoincashWallet(CryptoCurrencyNetwork.test); + + case Coin.dogecoin: + return DogecoinWallet(CryptoCurrencyNetwork.main); + case Coin.dogecoinTestNet: + return DogecoinWallet(CryptoCurrencyNetwork.test); case Coin.eCash: - return EcashWallet( - Ecash(CryptoCurrencyNetwork.main), - ); + return EcashWallet(CryptoCurrencyNetwork.main); case Coin.epicCash: - return EpiccashWallet( - Epiccash(CryptoCurrencyNetwork.main), - ); + return EpiccashWallet(CryptoCurrencyNetwork.main); case Coin.wownero: - return WowneroWallet( - Wownero(CryptoCurrencyNetwork.main), - ); + return WowneroWallet(CryptoCurrencyNetwork.main); default: // should never hit in reality