slight change to wallet constructors

This commit is contained in:
julian 2023-11-15 11:40:43 -06:00
parent ae03a9dd49
commit 8ba998af8f
6 changed files with 24 additions and 33 deletions

View file

@ -4,6 +4,7 @@ import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/extensions/extensions.dart'; import 'package:stackwallet/utilities/extensions/extensions.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin.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/intermediate/bip39_hd_wallet.dart';
import 'package:stackwallet/wallets/wallet/mixins/coin_control.dart'; import 'package:stackwallet/wallets/wallet/mixins/coin_control.dart';
import 'package:stackwallet/wallets/wallet/mixins/electrumx.dart'; import 'package:stackwallet/wallets/wallet/mixins/electrumx.dart';
@ -13,7 +14,7 @@ class BitcoinWallet extends Bip39HDWallet with ElectrumX, CoinControl {
@override @override
int get isarTransactionVersion => 1; // TODO actually set this to 2 int get isarTransactionVersion => 1; // TODO actually set this to 2
BitcoinWallet(Bitcoin cryptoCurrency) : super(cryptoCurrency); BitcoinWallet(CryptoCurrencyNetwork network) : super(Bitcoin(network));
@override @override
FilterOperation? get changeAddressFilterOperation => FilterOperation? get changeAddressFilterOperation =>

View file

@ -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/extensions/extensions.dart';
import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoincash.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/intermediate/bip39_hd_wallet.dart';
import 'package:stackwallet/wallets/wallet/mixins/cash_fusion.dart'; import 'package:stackwallet/wallets/wallet/mixins/cash_fusion.dart';
import 'package:stackwallet/wallets/wallet/mixins/coin_control.dart'; import 'package:stackwallet/wallets/wallet/mixins/coin_control.dart';
@ -24,7 +25,8 @@ class BitcoincashWallet extends Bip39HDWallet
@override @override
int get isarTransactionVersion => 2; int get isarTransactionVersion => 2;
BitcoincashWallet(Bitcoincash cryptoCurrency) : super(cryptoCurrency); BitcoincashWallet(CryptoCurrencyNetwork network)
: super(Bitcoincash(network));
@override @override
FilterOperation? get changeAddressFilterOperation => FilterGroup.and( FilterOperation? get changeAddressFilterOperation => FilterGroup.and(

View file

@ -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/extensions/extensions.dart';
import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/ecash.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/intermediate/bip39_hd_wallet.dart';
import 'package:stackwallet/wallets/wallet/mixins/cash_fusion.dart'; import 'package:stackwallet/wallets/wallet/mixins/cash_fusion.dart';
import 'package:stackwallet/wallets/wallet/mixins/coin_control.dart'; import 'package:stackwallet/wallets/wallet/mixins/coin_control.dart';
@ -24,7 +25,7 @@ class EcashWallet extends Bip39HDWallet
@override @override
int get isarTransactionVersion => 2; int get isarTransactionVersion => 2;
EcashWallet(Ecash cryptoCurrency) : super(cryptoCurrency); EcashWallet(CryptoCurrencyNetwork network) : super(Ecash(network));
@override @override
FilterOperation? get changeAddressFilterOperation => FilterGroup.and( FilterOperation? get changeAddressFilterOperation => FilterGroup.and(

View file

@ -5,11 +5,12 @@ import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/test_epic_box_connection.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/coins/epiccash.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
import 'package:stackwallet/wallets/models/tx_data.dart'; import 'package:stackwallet/wallets/models/tx_data.dart';
import 'package:stackwallet/wallets/wallet/intermediate/bip39_wallet.dart'; import 'package:stackwallet/wallets/wallet/intermediate/bip39_wallet.dart';
class EpiccashWallet extends Bip39Wallet { class EpiccashWallet extends Bip39Wallet {
EpiccashWallet(Epiccash cryptoCurrency) : super(cryptoCurrency); EpiccashWallet(CryptoCurrencyNetwork network) : super(Epiccash(network));
@override @override
FilterOperation? get changeAddressFilterOperation => FilterOperation? get changeAddressFilterOperation =>

View file

@ -39,13 +39,14 @@ import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/stack_file_system.dart'; import 'package:stackwallet/utilities/stack_file_system.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/wownero.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/models/tx_data.dart';
import 'package:stackwallet/wallets/wallet/intermediate/cryptonote_wallet.dart'; import 'package:stackwallet/wallets/wallet/intermediate/cryptonote_wallet.dart';
import 'package:stackwallet/wallets/wallet/mixins/multi_address.dart'; import 'package:stackwallet/wallets/wallet/mixins/multi_address.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
class WowneroWallet extends CryptonoteWallet with MultiAddress { class WowneroWallet extends CryptonoteWallet with MultiAddress {
WowneroWallet(Wownero wownero) : super(wownero); WowneroWallet(CryptoCurrencyNetwork network) : super(Wownero(network));
@override @override
FilterOperation? get changeAddressFilterOperation => null; FilterOperation? get changeAddressFilterOperation => null;

View file

@ -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/flutter_secure_storage_interface.dart';
import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/prefs.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/crypto_currency/crypto_currency.dart';
import 'package:stackwallet/wallets/isar/models/wallet_info.dart'; import 'package:stackwallet/wallets/isar/models/wallet_info.dart';
import 'package:stackwallet/wallets/models/tx_data.dart'; import 'package:stackwallet/wallets/models/tx_data.dart';
import 'package:stackwallet/wallets/wallet/impl/bitcoin_wallet.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/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/ecash_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/epiccash_wallet.dart'; import 'package:stackwallet/wallets/wallet/impl/epiccash_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/wownero_wallet.dart'; import 'package:stackwallet/wallets/wallet/impl/wownero_wallet.dart';
@ -243,39 +239,28 @@ abstract class Wallet<T extends CryptoCurrency> {
}) { }) {
switch (walletInfo.coin) { switch (walletInfo.coin) {
case Coin.bitcoin: case Coin.bitcoin:
return BitcoinWallet( return BitcoinWallet(CryptoCurrencyNetwork.main);
Bitcoin(CryptoCurrencyNetwork.main),
);
case Coin.bitcoinTestNet: case Coin.bitcoinTestNet:
return BitcoinWallet( return BitcoinWallet(CryptoCurrencyNetwork.test);
Bitcoin(CryptoCurrencyNetwork.test),
);
case Coin.bitcoincash: case Coin.bitcoincash:
return BitcoincashWallet( return BitcoincashWallet(CryptoCurrencyNetwork.main);
Bitcoincash(CryptoCurrencyNetwork.main),
);
case Coin.bitcoincashTestnet: case Coin.bitcoincashTestnet:
return BitcoincashWallet( return BitcoincashWallet(CryptoCurrencyNetwork.test);
Bitcoincash(CryptoCurrencyNetwork.test),
); case Coin.dogecoin:
return DogecoinWallet(CryptoCurrencyNetwork.main);
case Coin.dogecoinTestNet:
return DogecoinWallet(CryptoCurrencyNetwork.test);
case Coin.eCash: case Coin.eCash:
return EcashWallet( return EcashWallet(CryptoCurrencyNetwork.main);
Ecash(CryptoCurrencyNetwork.main),
);
case Coin.epicCash: case Coin.epicCash:
return EpiccashWallet( return EpiccashWallet(CryptoCurrencyNetwork.main);
Epiccash(CryptoCurrencyNetwork.main),
);
case Coin.wownero: case Coin.wownero:
return WowneroWallet( return WowneroWallet(CryptoCurrencyNetwork.main);
Wownero(CryptoCurrencyNetwork.main),
);
default: default:
// should never hit in reality // should never hit in reality