feat: monero files and config feat: monero interface feat: monero rpc digest request feat: add monero to wallet wizard splash fix: tarball unzipping fix: monero files fix: monero zipped folder path fix: undefined variable chore: xmr stagenet fix: prune-blockchain flag fix: monero wallet arguments chore: rpc-bind-port on monero wallet chore: monero wallet directory fix: fetch digest request fix: monero authentication fix: monero address creation fix: monero config port fix: wallet creation fix: wallet rpc daemon login fix: get monero funding fix: unauthorized issue with multiple requests on Promise.all fix: generate funding addresses fix: destination address balance for XMR cashout fix: transaction creation feat: transaction recommended mixin and ring size fix: monero wallet error handling fix: error handling fix: monero wallet error feat: guide to add new cryptos chore: small code shortcuts fix: crypto implementation guide chore: add XMR to exchange files
48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
const { COINS } = require('lamassu-coins')
|
|
const _ = require('lodash/fp')
|
|
|
|
const kraken = require('../exchange/kraken')
|
|
const bitstamp = require('../exchange/bitstamp')
|
|
const itbit = require('../exchange/itbit')
|
|
const binanceus = require('../exchange/binanceus')
|
|
const cex = require('../exchange/cex')
|
|
const ftx = require('../exchange/ftx')
|
|
const bitpay = require('../ticker/bitpay')
|
|
const { BTC, BCH, DASH, ETH, LTC, ZEC, USDT, XMR } = COINS
|
|
|
|
const ALL = {
|
|
cex: cex,
|
|
ftx: ftx,
|
|
binanceus: binanceus,
|
|
kraken: kraken,
|
|
bitstamp: bitstamp,
|
|
itbit: itbit,
|
|
bitpay: bitpay,
|
|
coinbase: {
|
|
CRYPTO: [BTC, ETH, LTC, DASH, ZEC, BCH, USDT, XMR],
|
|
FIAT: 'ALL_CURRENCIES'
|
|
}
|
|
}
|
|
|
|
function buildMarket (fiatCode, cryptoCode, serviceName) {
|
|
if (!_.includes(cryptoCode, ALL[serviceName].CRYPTO)) {
|
|
throw new Error('Unsupported crypto: ' + cryptoCode)
|
|
}
|
|
const fiatSupported = ALL[serviceName].FIAT
|
|
if (fiatSupported !== 'ALL_CURRENCIES' && !_.includes(fiatCode, fiatSupported)) {
|
|
throw new Error('Unsupported fiat: ' + fiatCode)
|
|
}
|
|
return cryptoCode + '/' + fiatCode
|
|
}
|
|
|
|
function verifyFiatSupport (fiatCode, serviceName) {
|
|
const fiat = ALL[serviceName].FIAT
|
|
return fiat === 'ALL_CURRENCIES' ? true : _.includes(fiatCode, fiat)
|
|
}
|
|
|
|
function isConfigValid (config, fields) {
|
|
const values = _.map(it => _.get(it)(config))(fields)
|
|
return _.every(it => it || it === 0)(values)
|
|
}
|
|
|
|
module.exports = { buildMarket, ALL, verifyFiatSupport, isConfigValid }
|