aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-03-24 07:36:33 +0800
committerDan Finlay <dan@danfinlay.com>2017-03-24 07:37:29 +0800
commit9bea31a402d0b343bae6a9ef055efa2b83be9071 (patch)
tree5f267d4ff69d2e959e6c1bc500f9ac26dfec3d1b /ui
parent3400ed0955b7f31ddb0be182736fc1e7ae20d4da (diff)
downloadtangerine-wallet-browser-9bea31a402d0b343bae6a9ef055efa2b83be9071.tar
tangerine-wallet-browser-9bea31a402d0b343bae6a9ef055efa2b83be9071.tar.gz
tangerine-wallet-browser-9bea31a402d0b343bae6a9ef055efa2b83be9071.tar.bz2
tangerine-wallet-browser-9bea31a402d0b343bae6a9ef055efa2b83be9071.tar.lz
tangerine-wallet-browser-9bea31a402d0b343bae6a9ef055efa2b83be9071.tar.xz
tangerine-wallet-browser-9bea31a402d0b343bae6a9ef055efa2b83be9071.tar.zst
tangerine-wallet-browser-9bea31a402d0b343bae6a9ef055efa2b83be9071.zip
Fix initial tx fee estimation
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/hex-as-decimal-input.js1
-rw-r--r--ui/app/components/pending-tx.js8
2 files changed, 5 insertions, 4 deletions
diff --git a/ui/app/components/hex-as-decimal-input.js b/ui/app/components/hex-as-decimal-input.js
index 96a11b84f..e37aaa8c3 100644
--- a/ui/app/components/hex-as-decimal-input.js
+++ b/ui/app/components/hex-as-decimal-input.js
@@ -116,7 +116,6 @@ HexAsDecimalInput.prototype.updateValidity = function (event) {
}
const valid = target.checkValidity()
- console.log('change triggered checking validity and found ' + valid)
if (valid) {
this.setState({ invalid: null })
}
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js
index 82d9b9fe7..9a3ef272d 100644
--- a/ui/app/components/pending-tx.js
+++ b/ui/app/components/pending-tx.js
@@ -44,11 +44,13 @@ PendingTx.prototype.render = function () {
const account = props.accounts[address]
const balance = account ? account.balance : '0x0'
+
const gas = (state.gas === undefined) ? txParams.gas : state.gas
const gasPrice = (state.gasPrice === undefined) ? txData.gasPrice : state.gasPrice
+ const gasBn = new BN(gas, 16)
+ const gasPriceBn = new BN(gasPrice, 16)
- const txFee = state.txFee || txData.txFee || ''
- const txFeeBn = new BN(txFee, 16)
+ const txFeeBn = gasBn.mul(gasPriceBn)
const maxCost = state.maxCost || txData.maxCost || ''
const dataLength = txParams.data ? (txParams.data.length - 2) / 2 : 0
const imageify = props.imageifyIdenticons === undefined ? true : props.imageifyIdenticons
@@ -380,7 +382,7 @@ PendingTx.prototype.calculateGas = function () {
const txParams = txMeta.txParams
const gasLimit = new BN(ethUtil.stripHexPrefix(txParams.gas || txMeta.estimatedGas), 16)
- const gasPriceHex = state.gasPrice || txData.gasPrice
+ const gasPriceHex = (state.gasPrice === undefined) ? txData.gasPrice : state.gasPrice
const gasPrice = new BN(ethUtil.stripHexPrefix(gasPriceHex), 16)
const valid = !gasPrice.lt(MIN_GAS_PRICE_BN)