add more db fields for fixed fee

This commit is contained in:
Josh Harvey 2017-05-19 01:34:09 +03:00
parent 8ecc8ce510
commit 8cdad0bc15
10 changed files with 74 additions and 65 deletions

View file

@ -165,6 +165,19 @@ function plugins (settings, deviceId) {
.then(row => row.id)
}
function mapCoinSettings (coin) {
const config = configManager.scoped(coin, deviceId, settings.config)
const minimumTx = BN(config.minimumTx)
const cashInFee = BN(config.cashInFee)
const coinSettings = {
minimumTx: BN.max(minimumTx, cashInFee),
cashInFee: cashInFee
}
return [coin, coinSettings]
}
function pollQueries (serialNumber, deviceTime, deviceRec) {
const config = configManager.machineScoped(deviceId, settings.config)
const fiatCode = config.fiatCurrency
@ -184,7 +197,7 @@ function plugins (settings, deviceId) {
return Promise.all(promises)
.then(arr => {
const cassettes = arr[0]
const currentConfigVersion = arr[2]
const configVersion = arr[2]
const tickers = arr.slice(3, cryptoCodes.length + 3)
const balances = arr.slice(cryptoCodes.length + 3)
@ -192,7 +205,8 @@ function plugins (settings, deviceId) {
cassettes,
rates: buildRates(tickers),
balances: buildBalances(balances),
currentConfigVersion
coinSettings: _.fromPairs(_.map(mapCoinSettings, cryptoCodes)),
configVersion
}
})
}