mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 01:37:40 +00:00
flutter update fixes
This commit is contained in:
parent
c34c3b0737
commit
a6d5a145b9
1 changed files with 106 additions and 258 deletions
|
@ -137,272 +137,120 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
|||
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: 62);
|
||||
|
||||
static const mapFromInt = {
|
||||
0: CryptoCurrency.xmr,
|
||||
1: CryptoCurrency.ada,
|
||||
2: CryptoCurrency.bch,
|
||||
3: CryptoCurrency.bnb,
|
||||
4: CryptoCurrency.btc,
|
||||
5: CryptoCurrency.dai,
|
||||
6: CryptoCurrency.dash,
|
||||
7: CryptoCurrency.eos,
|
||||
8: CryptoCurrency.eth,
|
||||
9: CryptoCurrency.ltc,
|
||||
10: CryptoCurrency.nano,
|
||||
11: CryptoCurrency.trx,
|
||||
12: CryptoCurrency.usdt,
|
||||
13: CryptoCurrency.usdterc20,
|
||||
14: CryptoCurrency.xlm,
|
||||
15: CryptoCurrency.xrp,
|
||||
16: CryptoCurrency.xhv,
|
||||
17: CryptoCurrency.xag,
|
||||
18: CryptoCurrency.xau,
|
||||
19: CryptoCurrency.xaud,
|
||||
20: CryptoCurrency.xbtc,
|
||||
21: CryptoCurrency.xcad,
|
||||
22: CryptoCurrency.xchf,
|
||||
23: CryptoCurrency.xcny,
|
||||
24: CryptoCurrency.xeur,
|
||||
25: CryptoCurrency.xgbp,
|
||||
26: CryptoCurrency.xjpy,
|
||||
27: CryptoCurrency.xnok,
|
||||
28: CryptoCurrency.xnzd,
|
||||
29: CryptoCurrency.xusd,
|
||||
30: CryptoCurrency.ape,
|
||||
31: CryptoCurrency.avaxc,
|
||||
32: CryptoCurrency.btt,
|
||||
33: CryptoCurrency.bttbsc,
|
||||
34: CryptoCurrency.doge,
|
||||
35: CryptoCurrency.firo,
|
||||
36: CryptoCurrency.usdttrc20,
|
||||
37: CryptoCurrency.hbar,
|
||||
38: CryptoCurrency.sc,
|
||||
39: CryptoCurrency.sol,
|
||||
40: CryptoCurrency.usdc,
|
||||
41: CryptoCurrency.usdcsol,
|
||||
42: CryptoCurrency.zaddr,
|
||||
43: CryptoCurrency.zec,
|
||||
44: CryptoCurrency.zen,
|
||||
45: CryptoCurrency.xvg
|
||||
};
|
||||
|
||||
static const mapFromString = {
|
||||
'xmr': CryptoCurrency.xmr,
|
||||
'ada': CryptoCurrency.ada,
|
||||
'bch': CryptoCurrency.bch,
|
||||
'bnb': CryptoCurrency.bnb,
|
||||
'btc': CryptoCurrency.btc,
|
||||
'dai': CryptoCurrency.dai,
|
||||
'dash': CryptoCurrency.dash,
|
||||
'eos': CryptoCurrency.eos,
|
||||
'eth': CryptoCurrency.eth,
|
||||
'ltc': CryptoCurrency.ltc,
|
||||
'nano': CryptoCurrency.nano,
|
||||
'trx': CryptoCurrency.trx,
|
||||
'usdt': CryptoCurrency.usdt,
|
||||
'usdterc20': CryptoCurrency.usdterc20,
|
||||
'xlm': CryptoCurrency.xlm,
|
||||
'xrp': CryptoCurrency.xrp,
|
||||
'xhv': CryptoCurrency.xhv,
|
||||
'xag': CryptoCurrency.xag,
|
||||
'xau': CryptoCurrency.xau,
|
||||
'xaud': CryptoCurrency.xaud,
|
||||
'xbtc': CryptoCurrency.xbtc,
|
||||
'xcad': CryptoCurrency.xcad,
|
||||
'xchf': CryptoCurrency.xchf,
|
||||
'xcny': CryptoCurrency.xcny,
|
||||
'xeur': CryptoCurrency.xeur,
|
||||
'xgbp': CryptoCurrency.xgbp,
|
||||
'xjpy': CryptoCurrency.xjpy,
|
||||
'xnok': CryptoCurrency.xnok,
|
||||
'xnzd': CryptoCurrency.xnzd,
|
||||
'xusd': CryptoCurrency.xusd,
|
||||
'ape': CryptoCurrency.ape,
|
||||
'avaxc': CryptoCurrency.avaxc,
|
||||
'btt': CryptoCurrency.btt,
|
||||
'bttbsc': CryptoCurrency.bttbsc,
|
||||
'doge': CryptoCurrency.doge,
|
||||
'firo': CryptoCurrency.firo,
|
||||
'usdttrc20': CryptoCurrency.usdttrc20,
|
||||
'hbar': CryptoCurrency.hbar,
|
||||
'sc': CryptoCurrency.sc,
|
||||
'sol': CryptoCurrency.sol,
|
||||
'usdc': CryptoCurrency.usdc,
|
||||
'usdcsol': CryptoCurrency.usdcsol,
|
||||
'zaddr': CryptoCurrency.zaddr,
|
||||
'zec': CryptoCurrency.zec,
|
||||
'zen': CryptoCurrency.zen,
|
||||
'xvg': CryptoCurrency.xvg
|
||||
};
|
||||
|
||||
static CryptoCurrency deserialize({required int raw}) {
|
||||
switch (raw) {
|
||||
case 0:
|
||||
return CryptoCurrency.xmr;
|
||||
case 1:
|
||||
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');
|
||||
|
||||
if (CryptoCurrency.mapFromInt[raw] == null) {
|
||||
final s = 'Unexpected token: $raw for CryptoCurrency deserialize';
|
||||
throw ArgumentError.value(raw, 'raw', s);
|
||||
}
|
||||
return CryptoCurrency.mapFromInt[raw]!;
|
||||
}
|
||||
|
||||
static CryptoCurrency fromString(String raw) {
|
||||
switch (raw.toLowerCase()) {
|
||||
case 'xmr':
|
||||
return CryptoCurrency.xmr;
|
||||
case 'ada':
|
||||
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');
|
||||
|
||||
if (CryptoCurrency.mapFromString[raw.toLowerCase()] == null) {
|
||||
final s = 'Unexpected token: $raw for CryptoCurrency fromString';
|
||||
throw ArgumentError.value(raw, 'raw', s);
|
||||
}
|
||||
return CryptoCurrency.mapFromString[raw.toLowerCase()]!;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
Loading…
Reference in a new issue