From 17751f236336a6736548298cd5d86328c164200e Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Thu, 29 Dec 2022 16:02:09 +0200 Subject: [PATCH] Fix haven currencies not getting serialized --- cw_core/lib/crypto_currency.dart | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/cw_core/lib/crypto_currency.dart b/cw_core/lib/crypto_currency.dart index 42e72d2eb..3ee2b5e15 100644 --- a/cw_core/lib/crypto_currency.dart +++ b/cw_core/lib/crypto_currency.dart @@ -67,6 +67,22 @@ class CryptoCurrency extends EnumerableItem with Serializable { CryptoCurrency.stx, ]; + static const havenCurrencies = [ + xag, + xau, + xaud, + xbtc, + xcad, + xchf, + xcny, + xeur, + xgbp, + xjpy, + xnok, + xnzd, + xusd, + ]; + 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', fullName: 'Cardano', raw: 1, name: 'ada'); static const bch = CryptoCurrency(title: 'BCH', iconPath: 'assets/images/bch_icon.png',fullName: 'Bitcoin Cash', raw: 2, name: 'bch'); @@ -134,16 +150,16 @@ class CryptoCurrency extends EnumerableItem with Serializable { static const stx = CryptoCurrency(title: 'STX', iconPath: 'assets/images/stx_icon.png', raw: 61, name: 'stx'); static final Map _rawCurrencyMap = - all.fold>({}, (acc, item) { - acc.addAll({item.raw: item}); - return acc; - }); + [...all, ...havenCurrencies].fold>({}, (acc, item) { + acc.addAll({item.raw: item}); + return acc; + }); static final Map _nameCurrencyMap = - all.fold>({}, (acc, item) { - acc.addAll({item.name: item}); - return acc; - }); + [...all, ...havenCurrencies].fold>({}, (acc, item) { + acc.addAll({item.name: item}); + return acc; + }); static CryptoCurrency deserialize({required int raw}) {