add new coins to exchange (#499)

* add new coins APE, AVAXC, BTT, BTTBSC, DOGE, FIRO, USDTTRC20, HBAR, SC, SOL, USDC, USDCSOL, ZEN, XVG * remove UST icon * remove xhv from excludeDepositCurrencies * remove xhv from excludeReceiveCurrencies

Serhii committed Sep 7, 2022 at 15:10 UTC f59c2fbd2be9828c11d6931ee6a4ce8e07f3334f
21 files changed +105 -16
assets/images/ape_icon.png
Binary files /dev/null and b/assets/images/ape_icon.png differ
assets/images/avaxc_icon.png
Binary files /dev/null and b/assets/images/avaxc_icon.png differ
assets/images/btt_icon.png
Binary files /dev/null and b/assets/images/btt_icon.png differ
assets/images/bttbsc_icon.png
Binary files /dev/null and b/assets/images/bttbsc_icon.png differ
assets/images/doge_icon.png
Binary files /dev/null and b/assets/images/doge_icon.png differ
assets/images/firo_icon.png
Binary files /dev/null and b/assets/images/firo_icon.png differ
assets/images/hbar_icon.png
Binary files /dev/null and b/assets/images/hbar_icon.png differ
assets/images/nano_icon.png
Binary files /dev/null and b/assets/images/nano_icon.png differ
assets/images/sc_icon.png
Binary files /dev/null and b/assets/images/sc_icon.png differ
assets/images/sol_icon.png
Binary files /dev/null and b/assets/images/sol_icon.png differ
assets/images/usdc_icon.png
Binary files /dev/null and b/assets/images/usdc_icon.png differ
assets/images/usdcsol_icon.png
Binary files /dev/null and b/assets/images/usdcsol_icon.png differ
assets/images/usdttrc20_icon.png
Binary files /dev/null and b/assets/images/usdttrc20_icon.png differ
assets/images/xvg_icon.png
Binary files /dev/null and b/assets/images/xvg_icon.png differ
assets/images/zaddr_icon.png
Binary files a/assets/images/zaddr_icon.png and b/assets/images/zaddr_icon.png differ
assets/images/zec_icon.png
Binary files a/assets/images/zec_icon.png and b/assets/images/zec_icon.png differ
assets/images/zen_icon.png
Binary files /dev/null and b/assets/images/zen_icon.png differ
cw_core/lib/crypto_currency.dart
+99 -10
@@ -23,16 +23,32 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
23 CryptoCurrency.eos,
24 CryptoCurrency.eth,
25 CryptoCurrency.ltc,
26 + CryptoCurrency.nano,
27 CryptoCurrency.trx,
28 CryptoCurrency.usdt,
29 CryptoCurrency.usdterc20,
30 CryptoCurrency.xlm,
31 CryptoCurrency.xrp,
32 CryptoCurrency.xhv,
32 - //CryptoCurrency.zaddr,
33 - //CryptoCurrency.zec
33 + CryptoCurrency.ape,
34 + CryptoCurrency.avaxc,
35 + CryptoCurrency.btt,
36 + CryptoCurrency.bttbsc,
37 + CryptoCurrency.doge,
38 + CryptoCurrency.firo,
39 + CryptoCurrency.usdttrc20,
40 + CryptoCurrency.hbar,
41 + CryptoCurrency.sc,
42 + CryptoCurrency.sol,
43 + CryptoCurrency.usdc,
44 + CryptoCurrency.usdcsol,
45 + CryptoCurrency.zaddr,
46 + CryptoCurrency.zec,
47 + CryptoCurrency.zen,
48 + CryptoCurrency.xvg,
49 ];
35 - static const xmr = CryptoCurrency(title: 'XMR', iconPath: 'assets/images/monero_icon.png', name: 'Monero', raw: 0);
50 +
51 + static const xmr = CryptoCurrency(title: 'XMR', iconPath: 'assets/images/monero_icon.png', name: 'Monero', raw: 0);
52 static const ada = CryptoCurrency(title: 'ADA', iconPath: 'assets/images/ada_icon.png', name: 'Cardano', raw: 1);
53 static const bch = CryptoCurrency(title: 'BCH', iconPath: 'assets/images/bch_icon.png',name: 'Bitcoin Cash', raw: 2);
54 static const bnb = CryptoCurrency(title: 'BNB', iconPath: 'assets/images/bnb_icon.png', tag: 'BSC', name: 'Binance Coin', raw: 3);
@@ -41,7 +57,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
57 static const dash = CryptoCurrency(title: 'DASH', iconPath: 'assets/images/dash_icon.png', name: 'Dash', raw: 6);
58 static const eos = CryptoCurrency(title: 'EOS', iconPath: 'assets/images/eos_icon.png', name: 'EOS', raw: 7);
59 static const eth = CryptoCurrency(title: 'ETH', iconPath: 'assets/images/eth_icon.png', name: 'Ethereum', raw: 8);
44 - static const ltc = CryptoCurrency(title: 'LTC', iconPath: 'assets/images/litecoin-ltc_icon.png', name: 'Litecoin',raw: 9);
60 + static const ltc = CryptoCurrency(title: 'LTC', iconPath: 'assets/images/litecoin-ltc_icon.png', name: 'Litecoin', raw: 9);
61 static const nano = CryptoCurrency(title: 'NANO', raw: 10);
62 static const trx = CryptoCurrency(title: 'TRX', iconPath: 'assets/images/trx_icon.png', name: 'TRON', raw: 11);
63 static const usdt = CryptoCurrency(title: 'USDT', iconPath: 'assets/images/usdt_icon.png', tag: 'OMNI', name: 'USDT', raw: 12);
@@ -64,8 +80,25 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
80 static const xnzd = CryptoCurrency(title: 'XNZD', tag: 'XHV', raw: 28);
81 static const xusd = CryptoCurrency(title: 'XUSD', tag: 'XHV', raw: 29);
82
67 - static const zaddr = CryptoCurrency(title: 'ZZEC', tag: 'ZEC', name: 'Shielded Zcash', iconPath: 'assets/images/zaddr_icon.png', raw: 30);
68 - static const zec = CryptoCurrency(title: 'TZEC', tag: 'ZEC', name: 'Transparent Zcash', iconPath: 'assets/images/zec_icon.png', raw: 31);
83 + static const ape = CryptoCurrency(title: 'APE', iconPath: 'assets/images/ape_icon.png', raw: 30);
84 + static const avaxc = CryptoCurrency(title: 'AVAXC', iconPath: 'assets/images/avaxc_icon.png', raw: 31);
85 + static const btt = CryptoCurrency(title: 'BTT', iconPath: 'assets/images/btt_icon.png', raw: 32);
86 + static const bttbsc = CryptoCurrency(title: 'BTTBSC', iconPath: 'assets/images/bttbsc_icon.png', raw: 33);
87 + static const doge = CryptoCurrency(title: 'DOGE', iconPath: 'assets/images/doge_icon.png', raw: 34);
88 + static const firo = CryptoCurrency(title: 'FIRO', iconPath: 'assets/images/firo_icon.png', raw: 35);
89 + static const usdttrc20 = CryptoCurrency(title: 'USDTTRC20', iconPath: 'assets/images/usdttrc20_icon.png', raw: 36);
90 + static const hbar = CryptoCurrency(title: 'HBAR', iconPath: 'assets/images/hbar_icon.png', raw: 37);
91 + static const sc = CryptoCurrency(title: 'SC', iconPath: 'assets/images/sc_icon.png', raw: 38);
92 + static const sol = CryptoCurrency(title: 'SOL', iconPath: 'assets/images/sol_icon.png', raw: 39);
93 + static const usdc = CryptoCurrency(title: 'USDC', iconPath: 'assets/images/usdc_icon.png', raw: 40);
94 + static const usdcsol = CryptoCurrency(title: 'USDCSOL', iconPath: 'assets/images/usdcsol_icon.png', raw: 41);
95 + static const zaddr = CryptoCurrency(title: 'ZZEC', tag: 'ZEC', name: 'Shielded Zcash', iconPath: 'assets/images/zaddr_icon.png', raw: 42);
96 + static const zec = CryptoCurrency(title: 'TZEC', tag: 'ZEC', name: 'Transparent Zcash', iconPath: 'assets/images/zec_icon.png', raw: 43);
97 + static const zen = CryptoCurrency(title: 'ZEN', iconPath: 'assets/images/zen_icon.png', raw: 44);
98 + static const xvg = CryptoCurrency(title: 'XVG', name: 'Verge', iconPath: 'assets/images/xvg_icon.png', raw: 45);
99 +
100 +
101 +
102
103 static CryptoCurrency deserialize({int raw}) {
104 switch (raw) {
@@ -130,9 +163,37 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
163 case 29:
164 return CryptoCurrency.xusd;
165 case 30:
133 - return CryptoCurrency.zaddr;
166 + return CryptoCurrency.ape;
167 case 31:
168 + return CryptoCurrency.avaxc;
169 + case 32:
170 + return CryptoCurrency.btt;
171 + case 33:
172 + return CryptoCurrency.bttbsc;
173 + case 34:
174 + return CryptoCurrency.doge;
175 + case 35:
176 + return CryptoCurrency.firo;
177 + case 36:
178 + return CryptoCurrency.usdttrc20;
179 + case 37:
180 + return CryptoCurrency.hbar;
181 + case 38:
182 + return CryptoCurrency.sc;
183 + case 39:
184 + return CryptoCurrency.sol;
185 + case 40:
186 + return CryptoCurrency.usdc;
187 + case 41:
188 + return CryptoCurrency.usdcsol;
189 + case 42:
190 + return CryptoCurrency.zaddr;
191 + case 43:
192 return CryptoCurrency.zec;
193 + case 44:
194 + return CryptoCurrency.zen;
195 + case 45:
196 + return CryptoCurrency.xvg;
197 default:
198 return null;
199 }
@@ -164,8 +225,8 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
225 return CryptoCurrency.nano;
226 case 'trx':
227 return CryptoCurrency.trx;
167 - case 'usdt':
168 - return CryptoCurrency.usdt;
228 + case 'usdc':
229 + return CryptoCurrency.usdc;
230 case 'usdterc20':
231 return CryptoCurrency.usdterc20;
232 case 'xlm':
@@ -200,10 +261,38 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
261 return CryptoCurrency.xnzd;
262 case 'xusd':
263 return CryptoCurrency.xusd;
264 + case 'ape':
265 + return CryptoCurrency.ape;
266 + case 'avax':
267 + return CryptoCurrency.avaxc;
268 + case 'btt':
269 + return CryptoCurrency.btt;
270 + case 'bttbsc':
271 + return CryptoCurrency.bttbsc;
272 + case 'doge':
273 + return CryptoCurrency.doge;
274 + case 'firo':
275 + return CryptoCurrency.firo;
276 + case 'usdttrc20':
277 + return CryptoCurrency.usdttrc20;
278 + case 'hbar':
279 + return CryptoCurrency.hbar;
280 + case 'sc':
281 + return CryptoCurrency.sc;
282 + case 'sol':
283 + return CryptoCurrency.sol;
284 + case 'usdt':
285 + return CryptoCurrency.usdt;
286 + case 'usdcsol':
287 + return CryptoCurrency.usdcsol;
288 case 'zaddr':
289 return CryptoCurrency.zaddr;
290 case 'zec':
291 return CryptoCurrency.zec;
292 + case 'zen':
293 + return CryptoCurrency.zen;
294 + case 'xvg':
295 + return CryptoCurrency.xvg;
296 default:
297 return null;
298 }
@@ -211,4 +300,4 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
300
301 @override
302 String toString() => title;
214 -}
303 +}
\ No newline at end of file
lib/exchange/changenow/changenow_exchange_provider.dart
+3 -3
@@ -96,12 +96,12 @@ class ChangeNowExchangeProvider extends ExchangeProvider {
96 'Content-Type': 'application/json'};
97 final flow = getFlow(isFixedRateMode);
98 final body = <String, String>{
99 - 'fromCurrency': normalizeCryptoCurrency(_request.from),
99 + 'fromCurrency': normalizeCryptoCurrency(_request.from),
100 'toCurrency': normalizeCryptoCurrency(_request.to),
101 'fromNetwork': networkFor(_request.from),
102 'toNetwork': networkFor(_request.to),
103 - 'fromAmount': _request.fromAmount,
104 - 'toAmount': _request.toAmount,
103 + 'fromAmount': _request.fromAmount,
104 + 'toAmount': _request.toAmount,
105 'address': _request.address,
106 'flow': flow,
107 'refundAddress': _request.refundAddress
lib/src/screens/exchange/widgets/currency_picker_item_widget.dart
-1
@@ -69,6 +69,5 @@ class PickerItemWidget extends StatelessWidget {
69 ),
70 ),
71 );
72 - ;
72 }
73 }
lib/view_model/exchange/exchange_view_model.dart
+3 -2
@@ -40,8 +40,9 @@ class ExchangeViewModel = ExchangeViewModelBase with _$ExchangeViewModel;
40 abstract class ExchangeViewModelBase with Store {
41 ExchangeViewModelBase(this.wallet, this.trades, this._exchangeTemplateStore,
42 this.tradesStore, this._settingsStore, this.sharedPreferences) {
43 - const excludeDepositCurrencies = <CryptoCurrency>[];
44 - const excludeReceiveCurrencies = [CryptoCurrency.xlm, CryptoCurrency.xrp, CryptoCurrency.bnb];
43 + const excludeDepositCurrencies = [CryptoCurrency.btt, CryptoCurrency.nano];
44 + const excludeReceiveCurrencies = [CryptoCurrency.xlm, CryptoCurrency.xrp,
45 + CryptoCurrency.bnb, CryptoCurrency.btt, CryptoCurrency.nano];
46 providerList = [ChangeNowExchangeProvider(), SideShiftExchangeProvider(), SimpleSwapExchangeProvider()];
47 _initialPairBasedOnWallet();
48 currentTradeAvailableProviders = SplayTreeMap<double, ExchangeProvider>();