feat: add graphql support (#349)
* fix: eslint warnings * refactor: use ramda + sanctuary instead of lodash * refactor: use prettier-standard for formatting * feat: enable security * feat: add graphql * chore: remove trailing commas from linter * docs: new scripts on react and new-admin-server * feat: handle authentication on graphql * fix: perf improvement to date picker * chore: add insecure-dev script to run servers
This commit is contained in:
parent
49f434f1d1
commit
b8e0c2175b
182 changed files with 8827 additions and 4623 deletions
46
lib/new-admin/config/accounts.js
Normal file
46
lib/new-admin/config/accounts.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
const { COINS, ALL_CRYPTOS } = require('./coins')
|
||||
|
||||
const { BTC, BCH, DASH, ETH, LTC, ZEC } = COINS
|
||||
|
||||
const TICKER = 'ticker'
|
||||
const WALLET = 'wallet'
|
||||
const LAYER_2 = 'layer2'
|
||||
const EXCHANGE = 'exchange'
|
||||
const SMS = 'sms'
|
||||
const ID_VERIFIER = 'idVerifier'
|
||||
const EMAIL = 'email'
|
||||
const ZERO_CONF = 'zeroConf'
|
||||
|
||||
const ACCOUNT_LIST = [
|
||||
{ code: 'bitpay', display: 'Bitpay', class: TICKER, cryptos: [BTC, BCH] },
|
||||
{ code: 'kraken', display: 'Kraken', class: TICKER, cryptos: [BTC, ETH, LTC, DASH, ZEC, BCH] },
|
||||
{ code: 'bitstamp', display: 'Bitstamp', class: TICKER, cryptos: [BTC, ETH, LTC, BCH] },
|
||||
{ code: 'coinbase', display: 'Coinbase', class: TICKER, cryptos: [BTC, ETH, LTC, BCH] },
|
||||
{ code: 'itbit', display: 'itBit', class: TICKER, cryptos: [BTC] },
|
||||
{ code: 'mock-ticker', display: 'Mock (Caution!)', class: TICKER, cryptos: ALL_CRYPTOS },
|
||||
{ code: 'bitcoind', display: 'bitcoind', class: WALLET, cryptos: [BTC] },
|
||||
{ code: 'no-layer2', display: 'No Layer 2', class: LAYER_2, cryptos: ALL_CRYPTOS },
|
||||
{ code: 'infura', display: 'Infura', class: WALLET, cryptos: [ETH] },
|
||||
{ code: 'geth', display: 'geth', class: WALLET, cryptos: [ETH] },
|
||||
{ code: 'zcashd', display: 'zcashd', class: WALLET, cryptos: [ZEC] },
|
||||
{ code: 'litecoind', display: 'litecoind', class: WALLET, cryptos: [LTC] },
|
||||
{ code: 'dashd', display: 'dashd', class: WALLET, cryptos: [DASH] },
|
||||
{ code: 'bitcoincashd', display: 'bitcoincashd', class: WALLET, cryptos: [BCH] },
|
||||
{ code: 'bitgo', display: 'BitGo', class: WALLET, cryptos: [BTC, ZEC, LTC, BCH, DASH] },
|
||||
{ code: 'bitstamp', display: 'Bitstamp', class: EXCHANGE, cryptos: [BTC, ETH, LTC, BCH] },
|
||||
{ code: 'itbit', display: 'itBit', class: EXCHANGE, cryptos: [BTC] },
|
||||
{ code: 'kraken', display: 'Kraken', class: EXCHANGE, cryptos: [BTC, ETH, LTC, DASH, ZEC, BCH] },
|
||||
{ code: 'mock-wallet', display: 'Mock (Caution!)', class: WALLET, cryptos: ALL_CRYPTOS },
|
||||
{ code: 'no-exchange', display: 'No exchange', class: EXCHANGE, cryptos: ALL_CRYPTOS },
|
||||
{ code: 'mock-exchange', display: 'Mock exchange', class: EXCHANGE, cryptos: ALL_CRYPTOS },
|
||||
{ code: 'mock-sms', display: 'Mock SMS', class: SMS },
|
||||
{ code: 'mock-id-verify', display: 'Mock ID verifier', class: ID_VERIFIER },
|
||||
{ code: 'twilio', display: 'Twilio', class: SMS },
|
||||
{ code: 'mailgun', display: 'Mailgun', class: EMAIL },
|
||||
{ code: 'all-zero-conf', display: 'Always 0-conf', class: ZERO_CONF, cryptos: [BTC, ZEC, LTC, DASH, BCH] },
|
||||
{ code: 'no-zero-conf', display: 'Always 1-conf', class: ZERO_CONF, cryptos: ALL_CRYPTOS },
|
||||
{ code: 'blockcypher', display: 'Blockcypher', class: ZERO_CONF, cryptos: [BTC] },
|
||||
{ code: 'mock-zero-conf', display: 'Mock 0-conf', class: ZERO_CONF, cryptos: [BTC, ZEC, LTC, DASH, BCH, ETH] }
|
||||
]
|
||||
|
||||
module.exports = { ACCOUNT_LIST }
|
||||
23
lib/new-admin/config/coins.js
Normal file
23
lib/new-admin/config/coins.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
const _ = require('lodash/fp')
|
||||
|
||||
const COINS = {
|
||||
BTC: 'BTC',
|
||||
ETH: 'ETH',
|
||||
LTC: 'LTC',
|
||||
DASH: 'DASH',
|
||||
ZEC: 'ZEC',
|
||||
BCH: 'BCH'
|
||||
}
|
||||
|
||||
const COIN_LIST = [
|
||||
{ code: COINS.BTC, display: 'Bitcoin' },
|
||||
{ code: COINS.ETH, display: 'Ethereum' },
|
||||
{ code: COINS.LTC, display: 'Litecoin' },
|
||||
{ code: COINS.DASH, display: 'Dash' },
|
||||
{ code: COINS.ZEC, display: 'Zcash' },
|
||||
{ code: COINS.BCH, display: 'Bitcoin Cash' }
|
||||
]
|
||||
|
||||
const ALL_CRYPTOS = _.keys(COINS)
|
||||
|
||||
module.exports = { COINS, ALL_CRYPTOS, COIN_LIST }
|
||||
39
lib/new-admin/config/index.js
Normal file
39
lib/new-admin/config/index.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
const _ = require('lodash/fp')
|
||||
|
||||
const { COIN_LIST: coins } = require('./coins')
|
||||
const { ACCOUNT_LIST: accounts } = require('./accounts')
|
||||
|
||||
const countries = require('../../../countries.json')
|
||||
const currenciesRec = require('../../../currencies.json')
|
||||
const languageRec = require('../../../languages.json')
|
||||
|
||||
function massageCurrencies (currencies) {
|
||||
const convert = r => ({
|
||||
code: r['Alphabetic Code'],
|
||||
display: r['Currency']
|
||||
})
|
||||
const top5Codes = ['USD', 'EUR', 'GBP', 'CAD', 'AUD']
|
||||
const mapped = _.map(convert, currencies)
|
||||
const codeToRec = code => _.find(_.matchesProperty('code', code), mapped)
|
||||
const top5 = _.map(codeToRec, top5Codes)
|
||||
const raw = _.uniqBy(_.get('code'), _.concat(top5, mapped))
|
||||
return raw.filter(r => r.code[0] !== 'X' && r.display.indexOf('(') === -1)
|
||||
}
|
||||
|
||||
const mapLanguage = lang => {
|
||||
const arr = lang.split('-')
|
||||
const code = arr[0]
|
||||
const country = arr[1]
|
||||
const langNameArr = languageRec.lang[code]
|
||||
if (!langNameArr) return null
|
||||
const langName = langNameArr[0]
|
||||
if (!country) return { code: lang, display: langName }
|
||||
return { code: lang, display: `${langName} [${country}]` }
|
||||
}
|
||||
|
||||
const supportedLanguages = languageRec.supported
|
||||
|
||||
const languages = supportedLanguages.map(mapLanguage).filter(r => r)
|
||||
const currencies = massageCurrencies(currenciesRec)
|
||||
|
||||
module.exports = { coins, accounts, countries, currencies, languages }
|
||||
Loading…
Add table
Add a link
Reference in a new issue