chore: update big number package

This commit is contained in:
José Oliveira 2021-06-15 22:34:36 +01:00 committed by Josh Harvey
parent 8aa18dd21c
commit ea44478b48
30 changed files with 186 additions and 144 deletions

View file

@ -11,7 +11,7 @@ function ticker (fiatCode, cryptoCode) {
return axios.get('https://bitpay.com/rates/' + cryptoCode + '/' + fiatCode)
.then(r => {
const data = r.data.data
const price = BN(data.rate.toString())
const price = new BN(data.rate.toString())
return {
rates: {
ask: price,

View file

@ -40,8 +40,8 @@ function getCurrencyRates (ticker, fiatCode, cryptoCode) {
return ticker.fetchTicker(symbol)
.then(res => ({
rates: {
ask: BN(res.ask),
bid: BN(res.bid)
ask: new BN(res.ask),
bid: new BN(res.bid)
}
}))
} catch (e) {
@ -52,7 +52,7 @@ function getCurrencyRates (ticker, fiatCode, cryptoCode) {
function findCurrencyRates (fxRates, fiatCode) {
const rates = _.find(_.matchesProperty('code', fiatCode), fxRates)
if (!rates || !rates.rate) throw new Error(`Unsupported currency: ${fiatCode}`)
return BN(rates.rate.toString())
return new BN(rates.rate.toString())
}
module.exports = { ticker }

View file

@ -3,8 +3,8 @@ const BN = require('../../bn')
function ticker (fiatCode, cryptoCode) {
return Promise.resolve({
rates: {
ask: BN(105),
bid: BN(100)
ask: new BN(105),
bid: new BN(100)
}
})
}