feat: migrate fee discount config field for each installed coin

This commit is contained in:
José Oliveira 2021-09-24 18:48:04 +01:00
parent d6771840bd
commit 32f79bc450
3 changed files with 11 additions and 16 deletions

View file

@ -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