refactor: exchanges config validation and error handling

This commit is contained in:
José Oliveira 2021-05-11 18:57:46 +01:00 committed by Josh Harvey
parent 60a19af1a8
commit dabe21f834
6 changed files with 34 additions and 20 deletions

View file

@ -18,6 +18,9 @@ const loadConfig = (account) => {
return { ...mapped, timeout: 3000 }
}
const isConfigValid = ({ key, clientId, secret }) => key && secret && clientId
const isConfigValid = options => {
const requiredOptions = _.pick(['key', 'secret', 'clientId'], options)
return _.isEqual(options, requiredOptions)
}
module.exports = { loadConfig, isConfigValid, CRYPTO, FIAT, ORDER_TYPE, AMOUNT_PRECISION }