Browse Source

whitelist crypto currencies supported

master
Gaëtan Renaudeau 7 years ago
parent
commit
8b55b95e28
  1. 6
      src/components/DeviceConnect/stories.js
  2. 34
      src/config/cryptocurrencies.js
  3. 2
      src/reducers/settings.js
  4. 2
      src/stories/currencies.stories.js

6
src/components/DeviceConnect/stories.js

@ -4,10 +4,8 @@ import React from 'react'
import { storiesOf } from '@storybook/react'
import { boolean, select, text } from '@storybook/addon-knobs'
import { action } from '@storybook/addon-actions'
import {
getCryptoCurrencyById,
listCryptoCurrencies,
} from '@ledgerhq/live-common/lib/helpers/currencies'
import { getCryptoCurrencyById } from '@ledgerhq/live-common/lib/helpers/currencies'
import { listCryptoCurrencies } from 'config/cryptocurrencies'
import type { Currency } from '@ledgerhq/live-common/lib/types'

34
src/config/cryptocurrencies.js

@ -0,0 +1,34 @@
// @flow
import memoize from 'lodash/memoize'
import { listCryptoCurrencies as listCC } from '@ledgerhq/live-common/lib/helpers/currencies'
import type { CryptoCurrencyIds } from '@ledgerhq/live-common/lib/types'
const supported: CryptoCurrencyIds[] = [
'bitcoin',
'ethereum',
'ripple',
'bitcoin_cash',
'litecoin',
'dash',
'ethereum_classic',
'qtum',
'zcash',
'bitcoin_gold',
'stratis',
'dogecoin',
'digibyte',
'hcash',
'komodo',
'pivx',
'zencash',
'vertcoin',
'peercoin',
'viacoin',
'stealthcoin',
'poswallet',
'bitcoin_testnet',
]
export const listCryptoCurrencies = memoize((withDevCrypto?: boolean) =>
listCC(withDevCrypto).filter(c => supported.includes(c.id)),
)

2
src/reducers/settings.js

@ -5,8 +5,8 @@ import {
findCurrencyByTicker,
getCryptoCurrencyById,
getFiatCurrencyByTicker,
listCryptoCurrencies,
} from '@ledgerhq/live-common/lib/helpers/currencies'
import { listCryptoCurrencies } from 'config/cryptocurrencies'
import languages from 'config/languages'
import { createSelector } from 'reselect'
import type { InputSelector as Selector } from 'reselect'

2
src/stories/currencies.stories.js

@ -2,7 +2,7 @@
import React, { Fragment } from 'react'
import { storiesOf } from '@storybook/react'
import { listCryptoCurrencies } from '@ledgerhq/live-common/lib/helpers/currencies'
import { listCryptoCurrencies } from 'config/cryptocurrencies'
import { getCryptoCurrencyIcon } from '@ledgerhq/live-common/lib/react'
import type { CryptoCurrency } from '@ledgerhq/live-common/lib/types'

Loading…
Cancel
Save