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,7 +4,8 @@ const settingsLoader = require('./settings-loader')
const configManager = require('./config-manager')
const wallet = require('../wallet')
const ticker = require('../ticker')
const coinUtils = require('../coin-utils')
const { utils } = require('lamassu-coins')
// const coinUtils = require('../coin-utils')
const machineLoader = require('../machine-loader')
module.exports = {getFunding}
@ -40,14 +41,14 @@ function fetchMachines () {
}
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)
@ -61,9 +62,9 @@ function getFunding (_cryptoCode) {
const cryptoCode = _cryptoCode || cryptoCodes[0]
const fiatCode = config.fiatCurrency
const pareCoins = c => _.includes(c.cryptoCode, cryptoCodes)
const cryptoCurrencies = coinUtils.cryptoCurrencies()
const cryptoCurrencies = utils.cryptoCurrencies()
const cryptoDisplays = _.filter(pareCoins, cryptoCurrencies)
const cryptoRec = coinUtils.getCryptoCurrency(cryptoCode)
const cryptoRec = utils.getCryptoCurrency(cryptoCode)
if (!cryptoRec) throw new Error(`Unsupported coin: ${cryptoCode}`)
@ -81,7 +82,7 @@ function getFunding (_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,