mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
Merge pull request #525 from cake-tech/CW-175-Refactoring-of-crypto-currency-list
[CW-175] refactoring of crypto currency list
This commit is contained in:
commit
4bf2fa6216
6 changed files with 93 additions and 337 deletions
Binary file not shown.
Before Width: | Height: | Size: 68 KiB |
|
@ -1,20 +1,18 @@
|
||||||
import 'package:cw_core/enumerable_item.dart';
|
import 'package:cw_core/enumerable_item.dart';
|
||||||
import 'package:hive/hive.dart';
|
|
||||||
|
|
||||||
part 'crypto_currency.g.dart';
|
|
||||||
|
|
||||||
@HiveType(typeId: 0)
|
|
||||||
class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||||
const CryptoCurrency({
|
const CryptoCurrency({
|
||||||
String title = '',
|
String title = '',
|
||||||
int raw = -1,
|
int raw = -1,
|
||||||
this.name,
|
required this.name,
|
||||||
|
this.fullName,
|
||||||
this.iconPath,
|
this.iconPath,
|
||||||
this.tag,})
|
this.tag})
|
||||||
: super(title: title, raw: raw);
|
: super(title: title, raw: raw);
|
||||||
|
|
||||||
|
final String name;
|
||||||
final String? tag;
|
final String? tag;
|
||||||
final String? name;
|
final String? fullName;
|
||||||
final String? iconPath;
|
final String? iconPath;
|
||||||
|
|
||||||
static const all = [
|
static const all = [
|
||||||
|
@ -38,7 +36,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||||
CryptoCurrency.ape,
|
CryptoCurrency.ape,
|
||||||
CryptoCurrency.avaxc,
|
CryptoCurrency.avaxc,
|
||||||
CryptoCurrency.btt,
|
CryptoCurrency.btt,
|
||||||
CryptoCurrency.bttbsc,
|
CryptoCurrency.bttc,
|
||||||
CryptoCurrency.doge,
|
CryptoCurrency.doge,
|
||||||
CryptoCurrency.firo,
|
CryptoCurrency.firo,
|
||||||
CryptoCurrency.usdttrc20,
|
CryptoCurrency.usdttrc20,
|
||||||
|
@ -53,7 +51,6 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||||
CryptoCurrency.xvg,
|
CryptoCurrency.xvg,
|
||||||
CryptoCurrency.usdcpoly,
|
CryptoCurrency.usdcpoly,
|
||||||
CryptoCurrency.dcr,
|
CryptoCurrency.dcr,
|
||||||
CryptoCurrency.husd,
|
|
||||||
CryptoCurrency.kmd,
|
CryptoCurrency.kmd,
|
||||||
CryptoCurrency.mana,
|
CryptoCurrency.mana,
|
||||||
CryptoCurrency.maticpoly,
|
CryptoCurrency.maticpoly,
|
||||||
|
@ -70,339 +67,100 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||||
CryptoCurrency.stx,
|
CryptoCurrency.stx,
|
||||||
];
|
];
|
||||||
|
|
||||||
static const xmr = CryptoCurrency(title: 'XMR', iconPath: 'assets/images/monero_icon.png', name: 'Monero', raw: 0);
|
static const xmr = CryptoCurrency(title: 'XMR', iconPath: 'assets/images/monero_icon.png', fullName: 'Monero', raw: 0, name: 'xmr');
|
||||||
static const ada = CryptoCurrency(title: 'ADA', iconPath: 'assets/images/ada_icon.png', name: 'Cardano', raw: 1);
|
static const ada = CryptoCurrency(title: 'ADA', iconPath: 'assets/images/ada_icon.png', fullName: 'Cardano', raw: 1, name: 'ada');
|
||||||
static const bch = CryptoCurrency(title: 'BCH', iconPath: 'assets/images/bch_icon.png',name: 'Bitcoin Cash', raw: 2);
|
static const bch = CryptoCurrency(title: 'BCH', iconPath: 'assets/images/bch_icon.png',fullName: 'Bitcoin Cash', raw: 2, name: 'bch');
|
||||||
static const bnb = CryptoCurrency(title: 'BNB', iconPath: 'assets/images/bnb_icon.png', tag: 'BSC', name: 'Binance Coin', raw: 3);
|
static const bnb = CryptoCurrency(title: 'BNB', iconPath: 'assets/images/bnb_icon.png', tag: 'BSC', fullName: 'Binance Coin', raw: 3, name: 'bnb');
|
||||||
static const btc = CryptoCurrency(title: 'BTC', iconPath: 'assets/images/btc.png', name: 'Bitcoin', raw: 4);
|
static const btc = CryptoCurrency(title: 'BTC', iconPath: 'assets/images/btc.png', fullName: 'Bitcoin', raw: 4, name: 'btc');
|
||||||
static const dai = CryptoCurrency(title: 'DAI', iconPath: 'assets/images/dai_icon.png', tag: 'ETH', name: 'Dai', raw: 5);
|
static const dai = CryptoCurrency(title: 'DAI', iconPath: 'assets/images/dai_icon.png', tag: 'ETH', fullName: 'Dai', raw: 5, name: 'dai');
|
||||||
static const dash = CryptoCurrency(title: 'DASH', iconPath: 'assets/images/dash_icon.png', name: 'Dash', raw: 6);
|
static const dash = CryptoCurrency(title: 'DASH', iconPath: 'assets/images/dash_icon.png', fullName: 'Dash', raw: 6, name: 'dash');
|
||||||
static const eos = CryptoCurrency(title: 'EOS', iconPath: 'assets/images/eos_icon.png', name: 'EOS', raw: 7);
|
static const eos = CryptoCurrency(title: 'EOS', iconPath: 'assets/images/eos_icon.png', fullName: 'EOS', raw: 7, name: 'eos');
|
||||||
static const eth = CryptoCurrency(title: 'ETH', iconPath: 'assets/images/eth_icon.png', name: 'Ethereum', raw: 8);
|
static const eth = CryptoCurrency(title: 'ETH', iconPath: 'assets/images/eth_icon.png', fullName: 'Ethereum', raw: 8, name: 'eth');
|
||||||
static const ltc = CryptoCurrency(title: 'LTC', iconPath: 'assets/images/litecoin-ltc_icon.png', name: 'Litecoin', raw: 9);
|
static const ltc = CryptoCurrency(title: 'LTC', iconPath: 'assets/images/litecoin-ltc_icon.png', fullName: 'Litecoin', raw: 9, name: 'ltc');
|
||||||
static const nano = CryptoCurrency(title: 'NANO', raw: 10);
|
static const nano = CryptoCurrency(title: 'NANO', raw: 10, name: 'nano');
|
||||||
static const trx = CryptoCurrency(title: 'TRX', iconPath: 'assets/images/trx_icon.png', name: 'TRON', raw: 11);
|
static const trx = CryptoCurrency(title: 'TRX', iconPath: 'assets/images/trx_icon.png', fullName: 'TRON', raw: 11, name: 'trx');
|
||||||
static const usdt = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdt_icon.png', tag: 'OMNI', name: 'USDT', raw: 12);
|
static const usdt = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdt_icon.png', tag: 'OMNI', fullName: 'USDT', raw: 12, name: 'usdt');
|
||||||
static const usdterc20 = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdterc20_icon.png', tag: 'ETH', name: 'USDT', raw: 13);
|
static const usdterc20 = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdterc20_icon.png', tag: 'ETH', fullName: 'USDT', raw: 13, name: 'usdterc20');
|
||||||
static const xlm = CryptoCurrency(title: 'XLM', iconPath: 'assets/images/xlm_icon.png', name: 'Stellar', raw: 14);
|
static const xlm = CryptoCurrency(title: 'XLM', iconPath: 'assets/images/xlm_icon.png', fullName: 'Stellar', raw: 14, name: 'xlm');
|
||||||
static const xrp = CryptoCurrency(title: 'XRP', iconPath: 'assets/images/xrp_icon.png', name: 'Ripple', raw: 15);
|
static const xrp = CryptoCurrency(title: 'XRP', iconPath: 'assets/images/xrp_icon.png', fullName: 'Ripple', raw: 15, name: 'xrp');
|
||||||
static const xhv = CryptoCurrency(title: 'XHV', iconPath: 'assets/images/xhv_logo.png', name: 'Haven Protocol', raw: 16);
|
static const xhv = CryptoCurrency(title: 'XHV', iconPath: 'assets/images/xhv_logo.png', fullName: 'Haven Protocol', raw: 16, name: 'xhv');
|
||||||
|
|
||||||
static const xag = CryptoCurrency(title: 'XAG', tag: 'XHV', raw: 17);
|
static const xag = CryptoCurrency(title: 'XAG', tag: 'XHV', raw: 17, name: 'xag');
|
||||||
static const xau = CryptoCurrency(title: 'XAU', tag: 'XHV', raw: 18);
|
static const xau = CryptoCurrency(title: 'XAU', tag: 'XHV', raw: 18, name: 'xau');
|
||||||
static const xaud = CryptoCurrency(title: 'XAUD', tag: 'XHV', raw: 19);
|
static const xaud = CryptoCurrency(title: 'XAUD', tag: 'XHV', raw: 19, name: 'xaud');
|
||||||
static const xbtc = CryptoCurrency(title: 'XBTC', tag: 'XHV', raw: 20);
|
static const xbtc = CryptoCurrency(title: 'XBTC', tag: 'XHV', raw: 20, name: 'xbtc');
|
||||||
static const xcad = CryptoCurrency(title: 'XCAD', tag: 'XHV', raw: 21);
|
static const xcad = CryptoCurrency(title: 'XCAD', tag: 'XHV', raw: 21, name: 'xcad');
|
||||||
static const xchf = CryptoCurrency(title: 'XCHF', tag: 'XHV', raw: 22);
|
static const xchf = CryptoCurrency(title: 'XCHF', tag: 'XHV', raw: 22, name: 'xchf');
|
||||||
static const xcny = CryptoCurrency(title: 'XCNY', tag: 'XHV', raw: 23);
|
static const xcny = CryptoCurrency(title: 'XCNY', tag: 'XHV', raw: 23, name: 'xcny');
|
||||||
static const xeur = CryptoCurrency(title: 'XEUR', tag: 'XHV', raw: 24);
|
static const xeur = CryptoCurrency(title: 'XEUR', tag: 'XHV', raw: 24, name: 'xeur');
|
||||||
static const xgbp = CryptoCurrency(title: 'XGBP', tag: 'XHV', raw: 25);
|
static const xgbp = CryptoCurrency(title: 'XGBP', tag: 'XHV', raw: 25, name: 'xgbp');
|
||||||
static const xjpy = CryptoCurrency(title: 'XJPY', tag: 'XHV', raw: 26);
|
static const xjpy = CryptoCurrency(title: 'XJPY', tag: 'XHV', raw: 26, name: 'xjpy');
|
||||||
static const xnok = CryptoCurrency(title: 'XNOK', tag: 'XHV', raw: 27);
|
static const xnok = CryptoCurrency(title: 'XNOK', tag: 'XHV', raw: 27, name: 'xnok');
|
||||||
static const xnzd = CryptoCurrency(title: 'XNZD', tag: 'XHV', raw: 28);
|
static const xnzd = CryptoCurrency(title: 'XNZD', tag: 'XHV', raw: 28, name: 'xnzd');
|
||||||
static const xusd = CryptoCurrency(title: 'XUSD', tag: 'XHV', raw: 29);
|
static const xusd = CryptoCurrency(title: 'XUSD', tag: 'XHV', raw: 29, name: 'xusd');
|
||||||
|
|
||||||
static const ape = CryptoCurrency(title: 'APE', iconPath: 'assets/images/ape_icon.png', tag: 'ETH', raw: 30);
|
static const ape = CryptoCurrency(title: 'APE', iconPath: 'assets/images/ape_icon.png', tag: 'ETH', raw: 30, name: 'ape');
|
||||||
static const avaxc = CryptoCurrency(title: 'AVAX', iconPath: 'assets/images/avaxc_icon.png', tag: 'C-CHAIN', raw: 31);
|
static const avaxc = CryptoCurrency(title: 'AVAX', iconPath: 'assets/images/avaxc_icon.png', tag: 'C-CHAIN', raw: 31, name: 'avaxc');
|
||||||
static const btt = CryptoCurrency(title: 'BTT', iconPath: 'assets/images/btt_icon.png', raw: 32);
|
static const btt = CryptoCurrency(title: 'BTT', iconPath: 'assets/images/btt_icon.png', raw: 32, name: 'btt');
|
||||||
static const bttbsc = CryptoCurrency(title: 'BTT', iconPath: 'assets/images/bttbsc_icon.png', tag: 'BSC', raw: 33);
|
static const bttc = CryptoCurrency(title: 'BTTC', iconPath: 'assets/images/bttbsc_icon.png',fullName: 'BitTorrent-NEW (Binance Smart Chain)', tag: 'BSC', raw: 33, name: 'bttc');
|
||||||
static const doge = CryptoCurrency(title: 'DOGE', iconPath: 'assets/images/doge_icon.png', raw: 34);
|
static const doge = CryptoCurrency(title: 'DOGE', iconPath: 'assets/images/doge_icon.png', raw: 34, name: 'doge');
|
||||||
static const firo = CryptoCurrency(title: 'FIRO', iconPath: 'assets/images/firo_icon.png', raw: 35);
|
static const firo = CryptoCurrency(title: 'FIRO', iconPath: 'assets/images/firo_icon.png', raw: 35, name: 'firo');
|
||||||
static const usdttrc20 = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdttrc20_icon.png', tag: 'TRX', raw: 36);
|
static const usdttrc20 = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdttrc20_icon.png', tag: 'TRX', raw: 36, name: 'usdttrc20');
|
||||||
static const hbar = CryptoCurrency(title: 'HBAR', iconPath: 'assets/images/hbar_icon.png', raw: 37);
|
static const hbar = CryptoCurrency(title: 'HBAR', iconPath: 'assets/images/hbar_icon.png', raw: 37, name: 'hbar');
|
||||||
static const sc = CryptoCurrency(title: 'SC', iconPath: 'assets/images/sc_icon.png', raw: 38);
|
static const sc = CryptoCurrency(title: 'SC', iconPath: 'assets/images/sc_icon.png', raw: 38, name: 'sc');
|
||||||
static const sol = CryptoCurrency(title: 'SOL', iconPath: 'assets/images/sol_icon.png', raw: 39);
|
static const sol = CryptoCurrency(title: 'SOL', iconPath: 'assets/images/sol_icon.png', raw: 39, name: 'sol');
|
||||||
static const usdc = CryptoCurrency(title: 'USDC', iconPath: 'assets/images/usdc_icon.png', tag: 'ETH', raw: 40);
|
static const usdc = CryptoCurrency(title: 'USDC', iconPath: 'assets/images/usdc_icon.png', tag: 'ETH', raw: 40, name: 'usdc');
|
||||||
static const usdcsol = CryptoCurrency(title: 'USDC', iconPath: 'assets/images/usdcsol_icon.png', tag: 'SOL', raw: 41);
|
static const usdcsol = CryptoCurrency(title: 'USDC', iconPath: 'assets/images/usdcsol_icon.png', tag: 'SOL', raw: 41, name: 'usdcsol');
|
||||||
static const zaddr = CryptoCurrency(title: 'ZZEC', tag: 'ZEC', name: 'Shielded Zcash', iconPath: 'assets/images/zaddr_icon.png', raw: 42);
|
static const zaddr = CryptoCurrency(title: 'ZZEC', tag: 'ZEC', fullName: 'Shielded Zcash', iconPath: 'assets/images/zaddr_icon.png', raw: 42, name: 'zaddr');
|
||||||
static const zec = CryptoCurrency(title: 'TZEC', tag: 'ZEC', name: 'Transparent Zcash', iconPath: 'assets/images/zec_icon.png', raw: 43);
|
static const zec = CryptoCurrency(title: 'TZEC', tag: 'ZEC', fullName: 'Transparent Zcash', iconPath: 'assets/images/zec_icon.png', raw: 43, name: 'zec');
|
||||||
static const zen = CryptoCurrency(title: 'ZEN', iconPath: 'assets/images/zen_icon.png', raw: 44);
|
static const zen = CryptoCurrency(title: 'ZEN', iconPath: 'assets/images/zen_icon.png', raw: 44, name: 'zen');
|
||||||
static const xvg = CryptoCurrency(title: 'XVG', name: 'Verge', iconPath: 'assets/images/xvg_icon.png', raw: 45);
|
static const xvg = CryptoCurrency(title: 'XVG', fullName: 'Verge', iconPath: 'assets/images/xvg_icon.png', raw: 45, name: 'xvg');
|
||||||
|
|
||||||
static const usdcpoly = CryptoCurrency(title: 'USDC', iconPath: 'assets/images/usdc_icon.png', tag: 'POLY', raw: 46);
|
static const usdcpoly = CryptoCurrency(title: 'USDC', iconPath: 'assets/images/usdc_icon.png', tag: 'POLY', raw: 46, name: 'usdcpoly');
|
||||||
static const dcr = CryptoCurrency(title: 'DCR', iconPath: 'assets/images/dcr_icon.png', raw: 47);
|
static const dcr = CryptoCurrency(title: 'DCR', iconPath: 'assets/images/dcr_icon.png', raw: 47, name: 'dcr');
|
||||||
static const husd = CryptoCurrency(title: 'HUSD', iconPath: 'assets/images/husd_icon.png', tag: 'ETH', raw: 48);
|
static const kmd = CryptoCurrency(title: 'KMD', iconPath: 'assets/images/kmd_icon.png', raw: 48, name: 'kmd');
|
||||||
static const kmd = CryptoCurrency(title: 'KMD', iconPath: 'assets/images/kmd_icon.png', raw: 49);
|
static const mana = CryptoCurrency(title: 'MANA', iconPath: 'assets/images/mana_icon.png', tag: 'ETH', raw: 49, name: 'mana');
|
||||||
static const mana = CryptoCurrency(title: 'MANA', iconPath: 'assets/images/mana_icon.png', tag: 'ETH', raw: 50);
|
static const maticpoly = CryptoCurrency(title: 'MATIC', iconPath: 'assets/images/matic_icon.png', tag: 'POLY', raw: 50, name: 'maticpoly');
|
||||||
static const maticpoly = CryptoCurrency(title: 'MATIC', iconPath: 'assets/images/matic_icon.png', tag: 'POLY', raw: 51);
|
static const matic = CryptoCurrency(title: 'MATIC', iconPath: 'assets/images/matic_icon.png', tag: 'ETH', raw: 51, name: 'matic');
|
||||||
static const matic = CryptoCurrency(title: 'MATIC', iconPath: 'assets/images/matic_icon.png', tag: 'ETH', raw: 52);
|
static const mkr = CryptoCurrency(title: 'MKR', iconPath: 'assets/images/mkr_icon.png', tag: 'ETH', raw: 52, name: 'mkr');
|
||||||
static const mkr = CryptoCurrency(title: 'MKR', iconPath: 'assets/images/mkr_icon.png', tag: 'ETH', raw: 53);
|
static const near = CryptoCurrency(title: 'NEAR', iconPath: 'assets/images/near_icon.png', raw: 53, name: 'near');
|
||||||
static const near = CryptoCurrency(title: 'NEAR', iconPath: 'assets/images/near_icon.png', raw: 54);
|
static const oxt = CryptoCurrency(title: 'OXT', iconPath: 'assets/images/oxt_icon.png', tag: 'ETH', raw: 54, name: 'oxt');
|
||||||
static const oxt = CryptoCurrency(title: 'OXT', iconPath: 'assets/images/oxt_icon.png', tag: 'ETH', raw: 55);
|
static const paxg = CryptoCurrency(title: 'PAXG', iconPath: 'assets/images/paxg_icon.png', tag: 'ETH', raw: 55, name: 'paxg');
|
||||||
static const paxg = CryptoCurrency(title: 'PAXG', iconPath: 'assets/images/paxg_icon.png', tag: 'ETH', raw: 56);
|
static const pivx = CryptoCurrency(title: 'PIVX', iconPath: 'assets/images/pivx_icon.png', raw: 56, name: 'pivx');
|
||||||
static const pivx = CryptoCurrency(title: 'PIVX', iconPath: 'assets/images/pivx_icon.png', raw: 57);
|
static const rune = CryptoCurrency(title: 'RUNE', iconPath: 'assets/images/rune_icon.png', raw: 57, name: 'rune');
|
||||||
static const rune = CryptoCurrency(title: 'RUNE', iconPath: 'assets/images/rune_icon.png', raw: 58);
|
static const rvn = CryptoCurrency(title: 'RVN', iconPath: 'assets/images/rvn_icon.png', raw: 58, name: 'rvn');
|
||||||
static const rvn = CryptoCurrency(title: 'RVN', iconPath: 'assets/images/rvn_icon.png', raw: 59);
|
static const scrt = CryptoCurrency(title: 'SCRT', iconPath: 'assets/images/scrt_icon.png', raw: 59, name: 'scrt');
|
||||||
static const scrt = CryptoCurrency(title: 'SCRT', iconPath: 'assets/images/scrt_icon.png', raw: 60);
|
static const uni = CryptoCurrency(title: 'UNI', iconPath: 'assets/images/uni_icon.png', tag: 'ETH', raw: 60, name: 'uni');
|
||||||
static const uni = CryptoCurrency(title: 'UNI', iconPath: 'assets/images/uni_icon.png', tag: 'ETH', raw: 61);
|
static const stx = CryptoCurrency(title: 'STX', iconPath: 'assets/images/stx_icon.png', raw: 61, name: 'stx');
|
||||||
static const stx = CryptoCurrency(title: 'STX', iconPath: 'assets/images/stx_icon.png', raw: 62);
|
|
||||||
|
|
||||||
|
static final Map<int, CryptoCurrency> _rawCurrencyMap =
|
||||||
|
all.fold<Map<int, CryptoCurrency>>(<int, CryptoCurrency>{}, (acc, item) {
|
||||||
|
acc.addAll({item.raw: item});
|
||||||
|
return acc;
|
||||||
|
});
|
||||||
|
|
||||||
|
static final Map<String, CryptoCurrency> _nameCurrencyMap =
|
||||||
|
all.fold<Map<String, CryptoCurrency>>(<String, CryptoCurrency>{}, (acc, item) {
|
||||||
|
acc.addAll({item.name: item});
|
||||||
|
return acc;
|
||||||
|
});
|
||||||
|
|
||||||
static CryptoCurrency deserialize({required int raw}) {
|
static CryptoCurrency deserialize({required int raw}) {
|
||||||
switch (raw) {
|
|
||||||
case 0:
|
if (CryptoCurrency._rawCurrencyMap[raw] == null) {
|
||||||
return CryptoCurrency.xmr;
|
final s = 'Unexpected token: $raw for CryptoCurrency deserialize';
|
||||||
case 1:
|
throw ArgumentError.value(raw, 'raw', s);
|
||||||
return CryptoCurrency.ada;
|
|
||||||
case 2:
|
|
||||||
return CryptoCurrency.bch;
|
|
||||||
case 3:
|
|
||||||
return CryptoCurrency.bnb;
|
|
||||||
case 4:
|
|
||||||
return CryptoCurrency.btc;
|
|
||||||
case 5:
|
|
||||||
return CryptoCurrency.dai;
|
|
||||||
case 6:
|
|
||||||
return CryptoCurrency.dash;
|
|
||||||
case 7:
|
|
||||||
return CryptoCurrency.eos;
|
|
||||||
case 8:
|
|
||||||
return CryptoCurrency.eth;
|
|
||||||
case 9:
|
|
||||||
return CryptoCurrency.ltc;
|
|
||||||
case 10:
|
|
||||||
return CryptoCurrency.nano;
|
|
||||||
case 11:
|
|
||||||
return CryptoCurrency.trx;
|
|
||||||
case 12:
|
|
||||||
return CryptoCurrency.usdt;
|
|
||||||
case 13:
|
|
||||||
return CryptoCurrency.usdterc20;
|
|
||||||
case 14:
|
|
||||||
return CryptoCurrency.xlm;
|
|
||||||
case 15:
|
|
||||||
return CryptoCurrency.xrp;
|
|
||||||
case 16:
|
|
||||||
return CryptoCurrency.xhv;
|
|
||||||
case 17:
|
|
||||||
return CryptoCurrency.xag;
|
|
||||||
case 18:
|
|
||||||
return CryptoCurrency.xau;
|
|
||||||
case 19:
|
|
||||||
return CryptoCurrency.xaud;
|
|
||||||
case 20:
|
|
||||||
return CryptoCurrency.xbtc;
|
|
||||||
case 21:
|
|
||||||
return CryptoCurrency.xcad;
|
|
||||||
case 22:
|
|
||||||
return CryptoCurrency.xchf;
|
|
||||||
case 23:
|
|
||||||
return CryptoCurrency.xcny;
|
|
||||||
case 24:
|
|
||||||
return CryptoCurrency.xeur;
|
|
||||||
case 25:
|
|
||||||
return CryptoCurrency.xgbp;
|
|
||||||
case 26:
|
|
||||||
return CryptoCurrency.xjpy;
|
|
||||||
case 27:
|
|
||||||
return CryptoCurrency.xnok;
|
|
||||||
case 28:
|
|
||||||
return CryptoCurrency.xnzd;
|
|
||||||
case 29:
|
|
||||||
return CryptoCurrency.xusd;
|
|
||||||
case 30:
|
|
||||||
return CryptoCurrency.ape;
|
|
||||||
case 31:
|
|
||||||
return CryptoCurrency.avaxc;
|
|
||||||
case 32:
|
|
||||||
return CryptoCurrency.btt;
|
|
||||||
case 33:
|
|
||||||
return CryptoCurrency.bttbsc;
|
|
||||||
case 34:
|
|
||||||
return CryptoCurrency.doge;
|
|
||||||
case 35:
|
|
||||||
return CryptoCurrency.firo;
|
|
||||||
case 36:
|
|
||||||
return CryptoCurrency.usdttrc20;
|
|
||||||
case 37:
|
|
||||||
return CryptoCurrency.hbar;
|
|
||||||
case 38:
|
|
||||||
return CryptoCurrency.sc;
|
|
||||||
case 39:
|
|
||||||
return CryptoCurrency.sol;
|
|
||||||
case 40:
|
|
||||||
return CryptoCurrency.usdc;
|
|
||||||
case 41:
|
|
||||||
return CryptoCurrency.usdcsol;
|
|
||||||
case 42:
|
|
||||||
return CryptoCurrency.zaddr;
|
|
||||||
case 43:
|
|
||||||
return CryptoCurrency.zec;
|
|
||||||
case 44:
|
|
||||||
return CryptoCurrency.zen;
|
|
||||||
case 45:
|
|
||||||
return CryptoCurrency.xvg;
|
|
||||||
case 46:
|
|
||||||
return CryptoCurrency.usdcpoly;
|
|
||||||
case 47:
|
|
||||||
return CryptoCurrency.dcr;
|
|
||||||
case 48:
|
|
||||||
return CryptoCurrency.husd;
|
|
||||||
case 49:
|
|
||||||
return CryptoCurrency.kmd;
|
|
||||||
case 50:
|
|
||||||
return CryptoCurrency.mana;
|
|
||||||
case 51:
|
|
||||||
return CryptoCurrency.maticpoly;
|
|
||||||
case 52:
|
|
||||||
return CryptoCurrency.matic;
|
|
||||||
case 53:
|
|
||||||
return CryptoCurrency.mkr;
|
|
||||||
case 54:
|
|
||||||
return CryptoCurrency.near;
|
|
||||||
case 55:
|
|
||||||
return CryptoCurrency.oxt;
|
|
||||||
case 56:
|
|
||||||
return CryptoCurrency.paxg;
|
|
||||||
case 57:
|
|
||||||
return CryptoCurrency.pivx;
|
|
||||||
case 58:
|
|
||||||
return CryptoCurrency.rune;
|
|
||||||
case 59:
|
|
||||||
return CryptoCurrency.rvn;
|
|
||||||
case 60:
|
|
||||||
return CryptoCurrency.scrt;
|
|
||||||
case 61:
|
|
||||||
return CryptoCurrency.uni;
|
|
||||||
case 62:
|
|
||||||
return CryptoCurrency.stx;
|
|
||||||
default:
|
|
||||||
throw Exception('Unexpected token: $raw for CryptoCurrency deserialize');
|
|
||||||
}
|
}
|
||||||
|
return CryptoCurrency._rawCurrencyMap[raw]!;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CryptoCurrency fromString(String raw) {
|
static CryptoCurrency fromString(String name) {
|
||||||
switch (raw.toLowerCase()) {
|
|
||||||
case 'xmr':
|
if (CryptoCurrency._nameCurrencyMap[name.toLowerCase()] == null) {
|
||||||
return CryptoCurrency.xmr;
|
final s = 'Unexpected token: $name for CryptoCurrency fromString';
|
||||||
case 'ada':
|
throw ArgumentError.value(name, 'name', s);
|
||||||
return CryptoCurrency.ada;
|
|
||||||
case 'bch':
|
|
||||||
return CryptoCurrency.bch;
|
|
||||||
case 'bnbmainnet':
|
|
||||||
return CryptoCurrency.bnb;
|
|
||||||
case 'btc':
|
|
||||||
return CryptoCurrency.btc;
|
|
||||||
case 'dai':
|
|
||||||
return CryptoCurrency.dai;
|
|
||||||
case 'dash':
|
|
||||||
return CryptoCurrency.dash;
|
|
||||||
case 'eos':
|
|
||||||
return CryptoCurrency.eos;
|
|
||||||
case 'eth':
|
|
||||||
return CryptoCurrency.eth;
|
|
||||||
case 'ltc':
|
|
||||||
return CryptoCurrency.ltc;
|
|
||||||
case 'nano':
|
|
||||||
return CryptoCurrency.nano;
|
|
||||||
case 'trx':
|
|
||||||
return CryptoCurrency.trx;
|
|
||||||
case 'usdc':
|
|
||||||
return CryptoCurrency.usdc;
|
|
||||||
case 'usdterc20':
|
|
||||||
return CryptoCurrency.usdterc20;
|
|
||||||
case 'xlm':
|
|
||||||
return CryptoCurrency.xlm;
|
|
||||||
case 'xrp':
|
|
||||||
return CryptoCurrency.xrp;
|
|
||||||
case 'xhv':
|
|
||||||
return CryptoCurrency.xhv;
|
|
||||||
case 'xag':
|
|
||||||
return CryptoCurrency.xag;
|
|
||||||
case 'xau':
|
|
||||||
return CryptoCurrency.xau;
|
|
||||||
case 'xaud':
|
|
||||||
return CryptoCurrency.xaud;
|
|
||||||
case 'xbtc':
|
|
||||||
return CryptoCurrency.xbtc;
|
|
||||||
case 'xcad':
|
|
||||||
return CryptoCurrency.xcad;
|
|
||||||
case 'xchf':
|
|
||||||
return CryptoCurrency.xchf;
|
|
||||||
case 'xcny':
|
|
||||||
return CryptoCurrency.xcny;
|
|
||||||
case 'xeur':
|
|
||||||
return CryptoCurrency.xeur;
|
|
||||||
case 'xgbp':
|
|
||||||
return CryptoCurrency.xgbp;
|
|
||||||
case 'xjpy':
|
|
||||||
return CryptoCurrency.xjpy;
|
|
||||||
case 'xnok':
|
|
||||||
return CryptoCurrency.xnok;
|
|
||||||
case 'xnzd':
|
|
||||||
return CryptoCurrency.xnzd;
|
|
||||||
case 'xusd':
|
|
||||||
return CryptoCurrency.xusd;
|
|
||||||
case 'ape':
|
|
||||||
return CryptoCurrency.ape;
|
|
||||||
case 'avax':
|
|
||||||
return CryptoCurrency.avaxc;
|
|
||||||
case 'btt':
|
|
||||||
return CryptoCurrency.btt;
|
|
||||||
case 'bttbsc':
|
|
||||||
return CryptoCurrency.bttbsc;
|
|
||||||
case 'doge':
|
|
||||||
return CryptoCurrency.doge;
|
|
||||||
case 'firo':
|
|
||||||
return CryptoCurrency.firo;
|
|
||||||
case 'usdttrc20':
|
|
||||||
return CryptoCurrency.usdttrc20;
|
|
||||||
case 'hbar':
|
|
||||||
return CryptoCurrency.hbar;
|
|
||||||
case 'sc':
|
|
||||||
return CryptoCurrency.sc;
|
|
||||||
case 'sol':
|
|
||||||
return CryptoCurrency.sol;
|
|
||||||
case 'usdt':
|
|
||||||
return CryptoCurrency.usdt;
|
|
||||||
case 'usdcsol':
|
|
||||||
return CryptoCurrency.usdcsol;
|
|
||||||
case 'zaddr':
|
|
||||||
return CryptoCurrency.zaddr;
|
|
||||||
case 'zec':
|
|
||||||
return CryptoCurrency.zec;
|
|
||||||
case 'zen':
|
|
||||||
return CryptoCurrency.zen;
|
|
||||||
case 'xvg':
|
|
||||||
return CryptoCurrency.xvg;
|
|
||||||
case 'usdcpoly':
|
|
||||||
return CryptoCurrency.usdcpoly;
|
|
||||||
case 'dcr':
|
|
||||||
return CryptoCurrency.dcr;
|
|
||||||
case 'husd':
|
|
||||||
return CryptoCurrency.husd;
|
|
||||||
case 'kmd':
|
|
||||||
return CryptoCurrency.kmd;
|
|
||||||
case 'mana':
|
|
||||||
return CryptoCurrency.mana;
|
|
||||||
case 'maticpoly':
|
|
||||||
return CryptoCurrency.maticpoly;
|
|
||||||
case 'matic':
|
|
||||||
return CryptoCurrency.matic;
|
|
||||||
case 'mkr':
|
|
||||||
return CryptoCurrency.mkr;
|
|
||||||
case 'near':
|
|
||||||
return CryptoCurrency.near;
|
|
||||||
case 'oxt':
|
|
||||||
return CryptoCurrency.oxt;
|
|
||||||
case 'paxg':
|
|
||||||
return CryptoCurrency.paxg;
|
|
||||||
case 'pivx':
|
|
||||||
return CryptoCurrency.pivx;
|
|
||||||
case 'rune':
|
|
||||||
return CryptoCurrency.rune;
|
|
||||||
case 'rvn':
|
|
||||||
return CryptoCurrency.rvn;
|
|
||||||
case 'scrt':
|
|
||||||
return CryptoCurrency.scrt;
|
|
||||||
case 'uni':
|
|
||||||
return CryptoCurrency.uni;
|
|
||||||
case 'stx':
|
|
||||||
return CryptoCurrency.stx;
|
|
||||||
default:
|
|
||||||
throw Exception('Unexpected token: $raw for CryptoCurrency fromString');
|
|
||||||
}
|
}
|
||||||
|
return CryptoCurrency._nameCurrencyMap[name.toLowerCase()]!;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -24,7 +24,6 @@ class AddressValidator extends TextValidator {
|
||||||
return '[0-9a-zA-Z_]';
|
return '[0-9a-zA-Z_]';
|
||||||
case CryptoCurrency.usdc:
|
case CryptoCurrency.usdc:
|
||||||
case CryptoCurrency.usdcpoly:
|
case CryptoCurrency.usdcpoly:
|
||||||
case CryptoCurrency.husd:
|
|
||||||
case CryptoCurrency.ape:
|
case CryptoCurrency.ape:
|
||||||
case CryptoCurrency.avaxc:
|
case CryptoCurrency.avaxc:
|
||||||
case CryptoCurrency.eth:
|
case CryptoCurrency.eth:
|
||||||
|
@ -156,7 +155,7 @@ class AddressValidator extends TextValidator {
|
||||||
return [98, 99, 106];
|
return [98, 99, 106];
|
||||||
case CryptoCurrency.btt:
|
case CryptoCurrency.btt:
|
||||||
return [34];
|
return [34];
|
||||||
case CryptoCurrency.bttbsc:
|
case CryptoCurrency.bttc:
|
||||||
return [34];
|
return [34];
|
||||||
case CryptoCurrency.doge:
|
case CryptoCurrency.doge:
|
||||||
return [34];
|
return [34];
|
||||||
|
@ -181,7 +180,6 @@ class AddressValidator extends TextValidator {
|
||||||
case CryptoCurrency.stx:
|
case CryptoCurrency.stx:
|
||||||
return [40, 41, 42];
|
return [40, 41, 42];
|
||||||
case CryptoCurrency.usdcpoly:
|
case CryptoCurrency.usdcpoly:
|
||||||
case CryptoCurrency.husd:
|
|
||||||
case CryptoCurrency.mana:
|
case CryptoCurrency.mana:
|
||||||
case CryptoCurrency.matic:
|
case CryptoCurrency.matic:
|
||||||
case CryptoCurrency.maticpoly:
|
case CryptoCurrency.maticpoly:
|
||||||
|
|
|
@ -27,7 +27,6 @@ class SideShiftExchangeProvider extends ExchangeProvider {
|
||||||
static const List<CryptoCurrency> _notSupported = [
|
static const List<CryptoCurrency> _notSupported = [
|
||||||
CryptoCurrency.xhv,
|
CryptoCurrency.xhv,
|
||||||
CryptoCurrency.dcr,
|
CryptoCurrency.dcr,
|
||||||
CryptoCurrency.husd,
|
|
||||||
CryptoCurrency.kmd,
|
CryptoCurrency.kmd,
|
||||||
CryptoCurrency.mkr,
|
CryptoCurrency.mkr,
|
||||||
CryptoCurrency.near,
|
CryptoCurrency.near,
|
||||||
|
@ -38,6 +37,7 @@ class SideShiftExchangeProvider extends ExchangeProvider {
|
||||||
CryptoCurrency.rvn,
|
CryptoCurrency.rvn,
|
||||||
CryptoCurrency.scrt,
|
CryptoCurrency.scrt,
|
||||||
CryptoCurrency.stx,
|
CryptoCurrency.stx,
|
||||||
|
CryptoCurrency.bttc,
|
||||||
];
|
];
|
||||||
|
|
||||||
static List<ExchangePair> _supportedPairs() {
|
static List<ExchangePair> _supportedPairs() {
|
||||||
|
|
|
@ -56,7 +56,7 @@ class CurrencyPickerState extends State<CurrencyPicker> {
|
||||||
.where((element) =>
|
.where((element) =>
|
||||||
(element.title != null ? element.title.toLowerCase().contains(subString.toLowerCase()) : false) ||
|
(element.title != null ? element.title.toLowerCase().contains(subString.toLowerCase()) : false) ||
|
||||||
(element.tag != null ? element.tag!.toLowerCase().contains(subString.toLowerCase()) : false) ||
|
(element.tag != null ? element.tag!.toLowerCase().contains(subString.toLowerCase()) : false) ||
|
||||||
(element.name != null ? element.name!.toLowerCase().contains(subString.toLowerCase()) : false))
|
(element.fullName != null ? element.fullName!.toLowerCase().contains(subString.toLowerCase()) : false))
|
||||||
.toList();
|
.toList();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ abstract class WalletAddressEditOrCreateViewModelBase with Store {
|
||||||
{required WalletBase wallet, dynamic item})
|
{required WalletBase wallet, dynamic item})
|
||||||
: isEdit = item != null,
|
: isEdit = item != null,
|
||||||
state = AddressEditOrCreateStateInitial(),
|
state = AddressEditOrCreateStateInitial(),
|
||||||
label = item?.name as String? ?? '',
|
label = item?.fullName as String? ?? '',
|
||||||
_item = item,
|
_item = item,
|
||||||
_wallet = wallet;
|
_wallet = wallet;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue