feat: add galoy config and UI safeguards

This commit is contained in:
José Oliveira 2022-03-14 17:11:56 +00:00 committed by siiky
parent 355434ced3
commit 12a7ed0bd6
6 changed files with 11 additions and 10 deletions

View file

@ -153,7 +153,7 @@ const mapLanguage = lang => {
const supportedLanguages = languageRec.supported const supportedLanguages = languageRec.supported
const languages = supportedLanguages.map(mapLanguage).filter(r => r) const languages = supportedLanguages.map(mapLanguage).filter(r => r)
const ALL_CRYPTOS = ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC', 'BCH'] const ALL_CRYPTOS = ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC', 'BCH', 'LN']
const filterAccounts = (data, isDevMode) => { const filterAccounts = (data, isDevMode) => {
const notAllowed = ['mock-ticker', 'mock-wallet', 'mock-exchange', 'mock-sms', 'mock-id-verify', 'mock-zero-conf'] const notAllowed = ['mock-ticker', 'mock-wallet', 'mock-exchange', 'mock-sms', 'mock-id-verify', 'mock-zero-conf']

View file

@ -3,7 +3,7 @@ const _ = require('lodash/fp')
const { ALL } = require('../../plugins/common/ccxt') const { ALL } = require('../../plugins/common/ccxt')
const { BTC, BCH, DASH, ETH, LTC, USDT, ZEC, XMR, TRX, USDT_TRON } = COINS const { BTC, BCH, DASH, ETH, LTC, USDT, ZEC, XMR, LN, TRX, USDT_TRON } = COINS
const { bitpay, coinbase, itbit, bitstamp, kraken, binanceus, cex, binance } = ALL const { bitpay, coinbase, itbit, bitstamp, kraken, binanceus, cex, binance } = ALL
const TICKER = 'ticker' const TICKER = 'ticker'
@ -37,6 +37,7 @@ const ALL_ACCOUNTS = [
{ code: 'monerod', display: 'monerod', class: WALLET, cryptos: [XMR] }, { code: 'monerod', display: 'monerod', class: WALLET, cryptos: [XMR] },
{ code: 'bitcoincashd', display: 'bitcoincashd', class: WALLET, cryptos: [BCH] }, { code: 'bitcoincashd', display: 'bitcoincashd', class: WALLET, cryptos: [BCH] },
{ code: 'bitgo', display: 'BitGo', class: WALLET, cryptos: [BTC, ZEC, LTC, BCH, DASH] }, { 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: bitstamp.CRYPTO }, { code: 'bitstamp', display: 'Bitstamp', class: EXCHANGE, cryptos: bitstamp.CRYPTO },
{ code: 'itbit', display: 'itBit', class: EXCHANGE, cryptos: itbit.CRYPTO }, { code: 'itbit', display: 'itBit', class: EXCHANGE, cryptos: itbit.CRYPTO },
{ code: 'kraken', display: 'Kraken', class: EXCHANGE, cryptos: kraken.CRYPTO }, { code: 'kraken', display: 'Kraken', class: EXCHANGE, cryptos: kraken.CRYPTO },

View file

@ -57,7 +57,7 @@ const reflect = p => p.then(value => ({ value, status: 'fulfilled' }), error =>
function getFunding () { function getFunding () {
return settingsLoader.loadLatest().then(settings => { return settingsLoader.loadLatest().then(settings => {
const cryptoCodes = configManager.getAllCryptoCurrencies(settings.config) const cryptoCodes = _.filter(code => coinUtils.getExternalCryptoCode(code) === code)(configManager.getAllCryptoCurrencies(settings.config))
const fiatCode = configManager.getGlobalLocale(settings.config).fiatCurrency const fiatCode = configManager.getGlobalLocale(settings.config).fiatCurrency
const pareCoins = c => _.includes(c.cryptoCode, cryptoCodes) const pareCoins = c => _.includes(c.cryptoCode, cryptoCodes)
const cryptoCurrencies = coinUtils.cryptoCurrencies() const cryptoCurrencies = coinUtils.cryptoCurrencies()

View file

@ -1,7 +1,5 @@
const BN = require('../../../bn')
const NAME = 'LN' const NAME = 'LN'
const SUPPORTED_COINS = ['BTC'] const SUPPORTED_COINS = ['LN']
function checkCryptoCode (cryptoCode) { function checkCryptoCode (cryptoCode) {
if (!SUPPORTED_COINS.includes(cryptoCode)) { if (!SUPPORTED_COINS.includes(cryptoCode)) {
@ -23,7 +21,6 @@ function sendCoins (account, tx, settings, operatorId) {
function balance (account, cryptoCode, settings, operatorId) { function balance (account, cryptoCode, settings, operatorId) {
return checkCryptoCode(cryptoCode) return checkCryptoCode(cryptoCode)
.then(() => getWallet(account, cryptoCode)) .then(() => getWallet(account, cryptoCode))
.then(wallet => new BN(wallet._wallet.spendableBalanceString))
} }
function newAddress (account, info, tx, settings, operatorId) { function newAddress (account, info, tx, settings, operatorId) {
@ -41,7 +38,7 @@ function newFunding (account, cryptoCode, settings, operatorId) {
function cryptoNetwork (account, cryptoCode, settings, operatorId) { function cryptoNetwork (account, cryptoCode, settings, operatorId) {
return checkCryptoCode(cryptoCode) return checkCryptoCode(cryptoCode)
.then(() => account.environment === 'test' ? 'test' : 'main') .then(() => {})
} }
function checkBlockchainStatus (cryptoCode) { function checkBlockchainStatus (cryptoCode) {

View file

@ -142,8 +142,9 @@ const Blacklist = () => {
const classes = useStyles() const classes = useStyles()
const blacklistData = R.path(['blacklist'])(blacklistResponse) ?? [] const blacklistData = R.path(['blacklist'])(blacklistResponse) ?? []
const availableCurrencies = const availableCurrencies = R.filter(
R.path(['cryptoCurrencies'], blacklistResponse) ?? [] coin => coinUtils.getExternalCryptoCode(coin.code) === coin.code
)(R.path(['cryptoCurrencies'], blacklistResponse) ?? [])
const formattedData = groupByCode(blacklistData) const formattedData = groupByCode(blacklistData)

View file

@ -60,6 +60,8 @@ const getLogo = code => {
return MoneroLogo return MoneroLogo
case 'TRX': case 'TRX':
return TronLogo return TronLogo
case 'LN':
return BitcoinLogo
default: default:
return null return null
} }