dev
dart 139 lines 4.28 KB
Raw
1 import 'package:cw_core/enumerable_item.dart';
2
3 class ExchangeProviderDescription extends EnumerableItem<int> with Serializable<int> {
4 const ExchangeProviderDescription(
5 {required String title,
6 required int raw,
7 required this.image,
8 this.horizontalLogo = false,
9 required this.isCentralized})
10 : super(title: title, raw: raw);
11
12 final bool horizontalLogo;
13 final String image;
14 final bool isCentralized;
15
16 static const xmrto = ExchangeProviderDescription(
17 title: 'XMR.TO',
18 raw: 0,
19 image: 'assets/new-ui/trade_providers/xmrto.svg',
20 isCentralized: true);
21 static const changeNow = ExchangeProviderDescription(
22 title: 'ChangeNOW',
23 raw: 1,
24 image: 'assets/new-ui/trade_providers/changenow.svg',
25 isCentralized: true);
26 static const morphToken = ExchangeProviderDescription(
27 title: 'MorphToken',
28 raw: 2,
29 image: 'assets/new-ui/trade_providers/morph.svg',
30 isCentralized: true);
31 static const sideShift = ExchangeProviderDescription(
32 title: 'SideShift',
33 raw: 3,
34 image: 'assets/new-ui/trade_providers/sideshift.svg',
35 isCentralized: true);
36 static const simpleSwap = ExchangeProviderDescription(
37 title: 'SimpleSwap',
38 raw: 4,
39 image: 'assets/new-ui/trade_providers/simpleswap.svg',
40 isCentralized: true);
41 static const trocador = ExchangeProviderDescription(
42 title: 'Trocador',
43 raw: 5,
44 image: 'assets/new-ui/trade_providers/trocador.svg',
45 isCentralized: true);
46 static const exolix = ExchangeProviderDescription(
47 title: 'Exolix',
48 raw: 6,
49 image: 'assets/new-ui/trade_providers/exolix.svg',
50 isCentralized: true);
51 static const all =
52 ExchangeProviderDescription(title: 'All trades', raw: 7, image: '', isCentralized: true);
53 static const thorChain = ExchangeProviderDescription(
54 title: 'ThorChain',
55 raw: 8,
56 image: 'assets/new-ui/trade_providers/thorchain.svg',
57 isCentralized: true);
58 static const swapTrade = ExchangeProviderDescription(
59 title: 'SwapTrade',
60 raw: 9,
61 image: 'assets/new-ui/trade_providers/swaptrade.svg',
62 isCentralized: true);
63 static const letsExchange = ExchangeProviderDescription(
64 title: 'LetsExchange',
65 raw: 10,
66 image: 'assets/new-ui/trade_providers/letsexchange.svg',
67 isCentralized: true);
68 static const stealthEx = ExchangeProviderDescription(
69 title: 'StealthEx',
70 raw: 11,
71 image: 'assets/new-ui/trade_providers/stealthex.svg',
72 isCentralized: true);
73 static const chainflip = ExchangeProviderDescription(
74 title: 'Chainflip',
75 raw: 12,
76 image: 'assets/new-ui/trade_providers/chainflip.svg',
77 isCentralized: false);
78 static const xoSwap = ExchangeProviderDescription(
79 title: 'XOSwap',
80 raw: 13,
81 image: 'assets/new-ui/trade_providers/xoswap.svg',
82 isCentralized: true);
83 static const swapsXyz = ExchangeProviderDescription(
84 title: 'Swaps.XYZ',
85 raw: 14,
86 image: 'assets/new-ui/trade_providers/swaps_xyz.svg',
87 isCentralized: true);
88 static const nearIntents = ExchangeProviderDescription(
89 title: 'Near Intents',
90 raw: 15,
91 image: 'assets/new-ui/trade_providers/near-intents.svg',
92 isCentralized: false);
93 static const jupiter = ExchangeProviderDescription(
94 title: 'Jupiter',
95 raw: 16,
96 image: 'assets/new-ui/trade_providers/jupiter.svg',
97 isCentralized: false);
98
99 static ExchangeProviderDescription deserialize({required int raw}) {
100 switch (raw) {
101 case 0:
102 return xmrto;
103 case 1:
104 return changeNow;
105 case 2:
106 return morphToken;
107 case 3:
108 return sideShift;
109 case 4:
110 return simpleSwap;
111 case 5:
112 return trocador;
113 case 6:
114 return exolix;
115 case 7:
116 return all;
117 case 8:
118 return thorChain;
119 case 9:
120 return swapTrade;
121 case 10:
122 return letsExchange;
123 case 11:
124 return stealthEx;
125 case 12:
126 return chainflip;
127 case 13:
128 return xoSwap;
129 case 14:
130 return swapsXyz;
131 case 15:
132 return nearIntents;
133 case 16:
134 return jupiter;
135 default:
136 throw Exception('Unexpected token: $raw for ExchangeProviderDescription deserialize');
137 }
138 }
139 }