From 76774a7d4f182f3bfbee7823cca23f7d61150d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Tue, 12 Apr 2022 17:42:14 +0100 Subject: [PATCH] fix: revert old admin code changes --- lib/admin/config.js | 31 +++++++++++++++---------------- lib/admin/schemas/gajoy.json | 23 ----------------------- 2 files changed, 15 insertions(+), 39 deletions(-) delete mode 100644 lib/admin/schemas/gajoy.json diff --git a/lib/admin/config.js b/lib/admin/config.js index 4ad3c96d..642d55c9 100644 --- a/lib/admin/config.js +++ b/lib/admin/config.js @@ -13,6 +13,7 @@ const settingsLoader = require('./settings-loader') const configValidate = require('./config-validate') const jsonSchema = require('./lamassu-schema.json') + function fetchSchema () { return _.cloneDeep(jsonSchema) } @@ -147,18 +148,18 @@ const mapLanguage = lang => { 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}]` } + 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 ALL_CRYPTOS = ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC', 'BCH', 'LN'] +const ALL_CRYPTOS = ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC', 'BCH'] const filterAccounts = (data, isDevMode) => { const notAllowed = ['mock-ticker', 'mock-wallet', 'mock-exchange', 'mock-sms', 'mock-id-verify', 'mock-zero-conf'] const filterOut = o => _.includes(o.code, notAllowed) - return isDevMode ? data : { ...data, accounts: _.filter(a => !filterOut(a), data.accounts) } + return isDevMode ? data : {...data, accounts: _.filter(a => !filterOut(a), data.accounts)} } function fetchData () { @@ -171,17 +172,16 @@ function fetchData () { { crypto: 'LTC', display: 'Litecoin' }, { crypto: 'DASH', display: 'Dash' }, { crypto: 'ZEC', display: 'Zcash' }, - { crypto: 'BCH', display: 'Bitcoin Cash' }, - { crypto: 'LN', display: 'Lightning Network' } + { crypto: 'BCH', display: 'Bitcoin Cash' } ], languages: languages, countries, accounts: [ - { code: 'bitpay', display: 'Bitpay', class: 'ticker', cryptos: ['BTC', 'BCH', 'LN'] }, - { code: 'kraken', display: 'Kraken', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC', 'BCH', 'LN'] }, - { code: 'bitstamp', display: 'Bitstamp', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'BCH', 'LN'] }, - { code: 'coinbase', display: 'Coinbase', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'BCH', 'ZEC', 'DASH', 'LN'] }, - { code: 'itbit', display: 'itBit', class: 'ticker', cryptos: ['BTC', 'ETH', 'LN'] }, + { 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', 'ZEC', 'DASH'] }, + { code: 'itbit', display: 'itBit', class: 'ticker', cryptos: ['BTC', 'ETH'] }, { 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: 'layer2', cryptos: ALL_CRYPTOS }, @@ -192,10 +192,9 @@ function fetchData () { { 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: 'galoy', display: 'Galoy', class: 'wallet', cryptos: ['LN'] }, - { code: 'bitstamp', display: 'Bitstamp', class: 'exchange', cryptos: ['BTC', 'ETH', 'LTC', 'BCH', 'LN'] }, - { code: 'itbit', display: 'itBit', class: 'exchange', cryptos: ['BTC', 'ETH', 'LN'] }, - { code: 'kraken', display: 'Kraken', class: 'exchange', cryptos: ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC', 'BCH', 'LN'] }, + { code: 'bitstamp', display: 'Bitstamp', class: 'exchange', cryptos: ['BTC', 'ETH', 'LTC', 'BCH'] }, + { code: 'itbit', display: 'itBit', class: 'exchange', cryptos: ['BTC', 'ETH'] }, + { 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 }, @@ -208,7 +207,7 @@ function fetchData () { { code: 'blockcypher', display: 'Blockcypher', class: 'zeroConf', cryptos: ['BTC'] }, { code: 'mock-zero-conf', display: 'Mock 0-conf', class: 'zeroConf', cryptos: ['BTC', 'ZEC', 'LTC', 'DASH', 'BCH', 'ETH'] } ], - machines: machineList.map(machine => ({ machine: machine.deviceId, display: machine.name })) + machines: machineList.map(machine => ({machine: machine.deviceId, display: machine.name})) })) .then((data) => { return filterAccounts(data, devMode) diff --git a/lib/admin/schemas/gajoy.json b/lib/admin/schemas/gajoy.json deleted file mode 100644 index 5076cc8a..00000000 --- a/lib/admin/schemas/gajoy.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "code": "galoy", - "display": "Galoy", - "fields": [ - { - "code": "apiKey", - "display": "API Key", - "fieldType": "string", - "secret": true, - "required": true, - "value": "" - }, - { - "code": "walletId", - "display": "Wallet ID", - "fieldType": "password", - "secret": true, - "required": true, - "value": "" - } - ] - } - \ No newline at end of file