chore: replace imports to point to lamassu-coins module

This commit is contained in:
Sérgio Salgado 2020-12-29 17:30:05 +00:00 committed by Josh Harvey
parent 70495deb67
commit 3423e2ddd0
30 changed files with 230 additions and 175 deletions

View file

@ -4,17 +4,17 @@ const settingsLoader = require('../../new-settings-loader')
const configManager = require('../../new-config-manager')
const wallet = require('../../wallet')
const ticker = require('../../ticker')
const coinUtils = require('../../coin-utils')
const { utils } = require('lamassu-coins')
function computeCrypto (cryptoCode, _balance) {
const cryptoRec = coinUtils.getCryptoCurrency(cryptoCode)
const cryptoRec = utils.getCryptoCurrency(cryptoCode)
const unitScale = cryptoRec.unitScale
return BN(_balance).shift(-unitScale).round(5)
}
function computeFiat (rate, cryptoCode, _balance) {
const cryptoRec = coinUtils.getCryptoCurrency(cryptoCode)
const cryptoRec = utils.getCryptoCurrency(cryptoCode)
const unitScale = cryptoRec.unitScale
return BN(_balance).shift(-unitScale).mul(rate).round(5)
@ -35,7 +35,7 @@ function getSingleCoinFunding (settings, fiatCode, cryptoCode) {
const pending = fundingRec.fundingPendingBalance
const fiatPending = computeFiat(rate, cryptoCode, pending)
const fundingAddress = fundingRec.fundingAddress
const fundingAddressUrl = coinUtils.buildUrl(cryptoCode, fundingAddress)
const fundingAddressUrl = utils.buildUrl(cryptoCode, fundingAddress)
return {
cryptoCode,
@ -58,7 +58,7 @@ function getFunding () {
const cryptoCodes = configManager.getAllCryptoCurrencies(settings.config)
const fiatCode = configManager.getGlobalLocale(settings.config).fiatCurrency
const pareCoins = c => _.includes(c.cryptoCode, cryptoCodes)
const cryptoCurrencies = coinUtils.cryptoCurrencies()
const cryptoCurrencies = utils.cryptoCurrencies()
const cryptoDisplays = _.filter(pareCoins, cryptoCurrencies)
const promises = cryptoDisplays.map(it => getSingleCoinFunding(settings, fiatCode, it.cryptoCode))