Merge branch 'fix-havne-currencies-error' of https://github.com/cake-tech/cake_wallet into haven-update

This commit is contained in:
OmarHatem 2022-12-29 16:22:43 +02:00
commit 4e8ad2fa5f

View file

@ -67,6 +67,22 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
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,13 +150,13 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
static const stx = CryptoCurrency(title: 'STX', iconPath: 'assets/images/stx_icon.png', raw: 61, name: 'stx');
static final Map<int, CryptoCurrency> _rawCurrencyMap =
all.fold<Map<int, CryptoCurrency>>(<int, CryptoCurrency>{}, (acc, item) {
[...all, ...havenCurrencies].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) {
[...all, ...havenCurrencies].fold<Map<String, CryptoCurrency>>(<String, CryptoCurrency>{}, (acc, item) {
acc.addAll({item.name: item});
return acc;
});