fix: correctly show fees on tx's with no balance_delta or value (updates)

This commit is contained in:
Sean Yesmunt 2018-12-06 00:32:42 -05:00
parent b79eb17d42
commit 7087586ad4
2 changed files with 8 additions and 4 deletions

6
dist/bundle.js vendored
View file

@ -4573,14 +4573,16 @@ var selectTransactionItems = exports.selectTransactionItems = (0, _reselect.crea
items.push.apply(items, _toConsumableArray(append.map(function (item) {
// value on transaction, amount on outpoint
// amount is always positive, but should match sign of value
var amount = parseFloat(item.balance_delta ? item.balance_delta : item.value);
var balanceDelta = parseFloat(item.balance_delta);
var value = parseFloat(item.value);
var amount = balanceDelta ? balanceDelta : value;
return {
txid: txid,
timestamp: tx.timestamp,
date: tx.timestamp ? new Date(Number(tx.timestamp) * 1000) : null,
amount: amount,
fee: amount < 0 ? -1 * tx.fee / append.length : 0,
fee: amount <= 0 ? -1 * tx.fee / append.length : 0,
claim_id: item.claim_id,
claim_name: item.claim_name,
type: item.type || TRANSACTIONS.SPEND,

View file

@ -127,14 +127,16 @@ export const selectTransactionItems = createSelector(selectTransactionsById, (by
...append.map((item) => {
// value on transaction, amount on outpoint
// amount is always positive, but should match sign of value
const amount = parseFloat(item.balance_delta ? item.balance_delta : item.value);
const balanceDelta = parseFloat(item.balance_delta);
const value = parseFloat(item.value);
const amount = balanceDelta || value;
return {
txid,
timestamp: tx.timestamp,
date: tx.timestamp ? new Date(Number(tx.timestamp) * 1000) : null,
amount,
fee: amount < 0 ? -1 * tx.fee / append.length : 0,
fee: amount <= 0 ? -1 * tx.fee / append.length : 0,
claim_id: item.claim_id,
claim_name: item.claim_name,
type: item.type || TRANSACTIONS.SPEND,