Coin enum clean up and bug fixes

This commit is contained in:
julian 2022-10-29 09:14:59 -06:00
parent d75f2ed13d
commit f7dd7b01aa
4 changed files with 13 additions and 10 deletions

View file

@ -206,7 +206,6 @@ class _AddWalletViewState extends State<AddWalletView> {
Expanded( Expanded(
child: MobileCoinList( child: MobileCoinList(
coins: coins, coins: coins,
isDesktop: false,
), ),
), ),
const SizedBox( const SizedBox(

View file

@ -8,11 +8,9 @@ class MobileCoinList extends StatelessWidget {
const MobileCoinList({ const MobileCoinList({
Key? key, Key? key,
required this.coins, required this.coins,
required this.isDesktop,
}) : super(key: key); }) : super(key: key);
final List<Coin> coins; final List<Coin> coins;
final bool isDesktop;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View file

@ -26,7 +26,8 @@ class SearchableCoinList extends ConsumerWidget {
e.name.toLowerCase().contains(lowercaseTerm)); e.name.toLowerCase().contains(lowercaseTerm));
} }
if (!showTestNetCoins) { if (!showTestNetCoins) {
_coins.removeWhere((e) => e.name.endsWith("TestNet")); _coins.removeWhere(
(e) => e.name.endsWith("TestNet") || e == Coin.bitcoincashTestnet);
} }
// remove firo testnet regardless // remove firo testnet regardless
_coins.remove(Coin.firoTestNet); _coins.remove(Coin.firoTestNet);

View file

@ -1,6 +1,4 @@
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart' as btc; import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart' as btc;
import 'package:stackwallet/services/coins/litecoin/litecoin_wallet.dart'
as ltc;
import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.dart' import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.dart'
as bch; as bch;
import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart' import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart'
@ -8,6 +6,8 @@ import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart'
import 'package:stackwallet/services/coins/epiccash/epiccash_wallet.dart' import 'package:stackwallet/services/coins/epiccash/epiccash_wallet.dart'
as epic; as epic;
import 'package:stackwallet/services/coins/firo/firo_wallet.dart' as firo; import 'package:stackwallet/services/coins/firo/firo_wallet.dart' as firo;
import 'package:stackwallet/services/coins/litecoin/litecoin_wallet.dart'
as ltc;
import 'package:stackwallet/services/coins/monero/monero_wallet.dart' as xmr; import 'package:stackwallet/services/coins/monero/monero_wallet.dart' as xmr;
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart' import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart'
as nmc; as nmc;
@ -19,12 +19,12 @@ enum Coin {
dogecoin, dogecoin,
epicCash, epicCash,
firo, firo,
litecoin,
monero, monero,
wownero,
namecoin, namecoin,
wownero,
/// ///
litecoin,
/// ///
/// ///
@ -37,7 +37,7 @@ enum Coin {
} }
// remove firotestnet for now // remove firotestnet for now
const int kTestNetCoinCount = 3; const int kTestNetCoinCount = 4;
extension CoinExt on Coin { extension CoinExt on Coin {
String get prettyName { String get prettyName {
@ -268,7 +268,10 @@ Coin coinFromPrettyName(String name) {
default: default:
throw ArgumentError.value( throw ArgumentError.value(
name, "name", "No Coin enum value with that prettyName"); name,
"name",
"No Coin enum value with that prettyName",
);
} }
} }
@ -290,6 +293,8 @@ Coin coinFromTickerCaseInsensitive(String ticker) {
return Coin.monero; return Coin.monero;
case "nmc": case "nmc":
return Coin.namecoin; return Coin.namecoin;
case "tltc":
return Coin.litecoinTestNet;
case "tbtc": case "tbtc":
return Coin.bitcoinTestNet; return Coin.bitcoinTestNet;
case "tbch": case "tbch":