aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2016-07-14 14:39:44 +0800
committerDan Finlay <somniac@me.com>2016-07-14 14:39:44 +0800
commit97e38b4983629eb76a130da4f9782152f2cb1860 (patch)
treef4072553c3235a31106cb182bb75bb92e4588f81 /ui
parentdbc9008295f96b8917c5b66d8df2c2e2360c2814 (diff)
downloadtangerine-wallet-browser-97e38b4983629eb76a130da4f9782152f2cb1860.tar
tangerine-wallet-browser-97e38b4983629eb76a130da4f9782152f2cb1860.tar.gz
tangerine-wallet-browser-97e38b4983629eb76a130da4f9782152f2cb1860.tar.bz2
tangerine-wallet-browser-97e38b4983629eb76a130da4f9782152f2cb1860.tar.lz
tangerine-wallet-browser-97e38b4983629eb76a130da4f9782152f2cb1860.tar.xz
tangerine-wallet-browser-97e38b4983629eb76a130da4f9782152f2cb1860.tar.zst
tangerine-wallet-browser-97e38b4983629eb76a130da4f9782152f2cb1860.zip
new tx - calculate estimatedGas and show thing in tx-details (#441)
* new tx - calculate estimatedGas and show thing in tx-details * Bump changelog
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/pending-tx-details.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/ui/app/components/pending-tx-details.js b/ui/app/components/pending-tx-details.js
index 9a06ad09e..a6f72a89b 100644
--- a/ui/app/components/pending-tx-details.js
+++ b/ui/app/components/pending-tx-details.js
@@ -11,9 +11,6 @@ const nameForAddress = require('../../lib/contract-namer')
const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN
-const baseGasFee = new BN('21000', 10)
-const gasCost = new BN('4a817c800', 16)
-const baseFeeHex = baseGasFee.mul(gasCost).toString(16)
module.exports = PendingTxDetails
@@ -33,9 +30,11 @@ PTXP.render = function () {
var identity = props.identities[address] || { address: address }
var balance = props.accounts[address].balance
- var gasCost = ethUtil.stripHexPrefix(txParams.gas || baseFeeHex)
- var txValue = ethUtil.stripHexPrefix(txParams.value || '0x0')
- var maxCost = ((new BN(txValue, 16)).add(new BN(gasCost, 16))).toString(16)
+ var gasCost = new BN(ethUtil.stripHexPrefix(txParams.gas || txData.estimatedGas), 16)
+ var gasPrice = new BN(ethUtil.stripHexPrefix(txParams.gasPrice || '0x4a817c800'), 16)
+ var txFee = gasCost.mul(gasPrice)
+ var txValue = new BN(ethUtil.stripHexPrefix(txParams.value || '0x0'), 16)
+ var maxCost = txValue.add(txFee)
var dataLength = txParams.data ? (txParams.data.length - 2) / 2 : 0
var imageify = props.imageifyIdenticons === undefined ? true : props.imageifyIdenticons
@@ -112,7 +111,7 @@ PTXP.render = function () {
h('.cell.row', [
h('.cell.label', 'Max Transaction Fee'),
- h('.cell.value', formatBalance(gasCost)),
+ h('.cell.value', formatBalance(txFee.toString(16))),
]),
h('.cell.row', {
@@ -130,7 +129,7 @@ PTXP.render = function () {
},
}, [
h(EtherBalance, {
- value: maxCost,
+ value: maxCost.toString(16),
inline: true,
labelColor: 'black',
fontSize: '16px',