Merge pull request #1142 from josepfo/fix/kraken-trade-error

fix: trade promises chain errors
This commit is contained in:
Rafael Taranto 2022-03-03 15:07:58 +00:00 committed by GitHub
commit a6d0d608c7
2 changed files with 6 additions and 3 deletions

View file

@ -1,4 +1,4 @@
const { toUnit } = require('@lamassu/coins')
const { utils: coinUtils } = require('@lamassu/coins')
const _ = require('lodash/fp')
const ccxt = require('ccxt')
@ -19,7 +19,7 @@ function trade (side, account, tradeEntry, exchangeName) {
const symbol = buildMarket(fiatCode, cryptoCode, exchangeName)
const precision = _.defaultTo(DEFAULT_AMOUNT_PRECISION, AMOUNT_PRECISION)
const amount = toUnit(cryptoAtoms, cryptoCode).toFixed(precision)
const amount = coinUtils.toUnit(cryptoAtoms, cryptoCode).toFixed(precision)
const accountOptions = _.isFunction(loadOptions) ? loadOptions(account) : {}
const withCustomKey = USER_REF ? { [USER_REF]: tradeId } : {}
const options = _.assign(accountOptions, withCustomKey)