diff --git a/lib/wallet.js b/lib/wallet.js index 84480499..4b090cf6 100644 --- a/lib/wallet.js +++ b/lib/wallet.js @@ -60,18 +60,11 @@ function _balance (settings, cryptoCode) { function sendCoins (settings, tx) { return fetchWallet(settings, tx.cryptoCode) .then(r => { - if (tx.cryptoCode === 'BTC') { - return loadLatestConfig() - .then(config => { - const feeDiscount = config.wallets_BTC_feeDiscount - return r.wallet.sendCoins(r.account, tx, settings, r.operatorId, feeDiscount) - }) - .then(res => { - mem.clear(module.exports.balance) - return res - }) - } - return r.wallet.sendCoins(r.account, tx, settings, r.operatorId) + return loadLatestConfig() + .then(config => { + const feeMultiplier = config[`wallets_${tx.cryptoCode}_feeMultiplier`] + return r.wallet.sendCoins(r.account, tx, settings, r.operatorId, feeMultiplier) + }) .then(res => { mem.clear(module.exports.balance) return res diff --git a/migrations/1620954224627-add-fee-priority.js b/migrations/1620954224627-add-fee-priority.js index 332f22ea..e1a46496 100644 --- a/migrations/1620954224627-add-fee-priority.js +++ b/migrations/1620954224627-add-fee-priority.js @@ -1,11 +1,13 @@ +const _ = require('lodash/fp') const { saveConfig, loadLatest } = require('../lib/new-settings-loader') +const { getCryptosFromWalletNamespace } = require('../lib/new-config-manager') exports.up = function (next) { - const newConfig = { - wallets_BTC_feeDiscount: '1' - } + const newConfig = {} return loadLatest() .then(config => { + const coins = getCryptosFromWalletNamespace(config) + _.map(coin => { newConfig[`wallets_${coin}_feeMultiplier`] = '1' }, coins) return saveConfig(newConfig) }) .then(next) diff --git a/new-lamassu-admin/src/pages/Wallet/Wallet.js b/new-lamassu-admin/src/pages/Wallet/Wallet.js index 41f26b37..57a51644 100644 --- a/new-lamassu-admin/src/pages/Wallet/Wallet.js +++ b/new-lamassu-admin/src/pages/Wallet/Wallet.js @@ -227,7 +227,7 @@ const Wallet = ({ name: SCREEN_KEY }) => {