Make tx calculations account for gas prices

feature/default_network_editable
Dan Finlay 7 years ago
parent 532a4040de
commit fadc0617df
  1. 10
      app/scripts/lib/pending-balance-calculator.js

@ -32,9 +32,15 @@ class PendingBalanceCalculator {
valueFor (tx) {
const txValue = tx.txParams.value
const normalized = normalize(txValue).substring(2)
const value = this.hexToBn(txValue)
return value
const gasPrice = this.hexToBn(tx.txParams.gasPrice)
const gas = tx.txParams.gas
const gasLimit = tx.txParams.gasLimit
const gasLimitBn = this.hexToBn(gas || gasLimit)
const gasCost = gasPrice.mul(gasLimitBn)
return value.add(gasCost)
}
hexToBn (hex) {

Loading…
Cancel
Save