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(
child: MobileCoinList(
coins: coins,
isDesktop: false,
),
),
const SizedBox(

View file

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

View file

@ -26,7 +26,8 @@ class SearchableCoinList extends ConsumerWidget {
e.name.toLowerCase().contains(lowercaseTerm));
}
if (!showTestNetCoins) {
_coins.removeWhere((e) => e.name.endsWith("TestNet"));
_coins.removeWhere(
(e) => e.name.endsWith("TestNet") || e == Coin.bitcoincashTestnet);
}
// remove firo testnet regardless
_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/litecoin/litecoin_wallet.dart'
as ltc;
import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.dart'
as bch;
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'
as epic;
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/namecoin/namecoin_wallet.dart'
as nmc;
@ -19,12 +19,12 @@ enum Coin {
dogecoin,
epicCash,
firo,
litecoin,
monero,
wownero,
namecoin,
wownero,
///
litecoin,
///
///
@ -37,7 +37,7 @@ enum Coin {
}
// remove firotestnet for now
const int kTestNetCoinCount = 3;
const int kTestNetCoinCount = 4;
extension CoinExt on Coin {
String get prettyName {
@ -268,7 +268,10 @@ Coin coinFromPrettyName(String name) {
default:
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;
case "nmc":
return Coin.namecoin;
case "tltc":
return Coin.litecoinTestNet;
case "tbtc":
return Coin.bitcoinTestNet;
case "tbch":