add more db fields for fixed fee
This commit is contained in:
parent
8ecc8ce510
commit
8cdad0bc15
10 changed files with 74 additions and 65 deletions
10
lib/tx.js
10
lib/tx.js
|
|
@ -21,7 +21,15 @@ function massage (tx) {
|
|||
const transformDate = (v, k) => isDateField(k) ? new Date(v) : v
|
||||
const mapValuesWithKey = _.mapValues.convert({'cap': false})
|
||||
const transformDates = r => mapValuesWithKey(transformDate, r)
|
||||
const mapBN = r => _.assign(r, {cryptoAtoms: BN(r.cryptoAtoms), fiat: BN(r.fiat)})
|
||||
|
||||
const mapBN = r => {
|
||||
const update = r.direction === 'cashIn'
|
||||
? {cryptoAtoms: BN(r.cryptoAtoms), fiat: BN(r.fiat), cashInFee: BN(r.cashInFee)}
|
||||
: {cryptoAtoms: BN(r.cryptoAtoms), fiat: BN(r.fiat)}
|
||||
|
||||
return _.assign(r, update)
|
||||
}
|
||||
|
||||
const mapper = _.flow(transformDates, mapBN, _.unset('dirty'))
|
||||
|
||||
return mapper(tx)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue