aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components
diff options
context:
space:
mode:
authorDan Finlay <flyswatter@users.noreply.github.com>2017-06-13 01:30:25 +0800
committerGitHub <noreply@github.com>2017-06-13 01:30:25 +0800
commit2e6e6e41250011b451412608e455fe6402634729 (patch)
tree7e84df2522037578f6761854f8316d0484d4b8a0 /ui/app/components
parentcd3362f941b8eae12adbb6ffe9d60d4a6195755f (diff)
parent3e1d648ec012af9a8fe6fc3b329338f7f7fc80e2 (diff)
downloadtangerine-wallet-browser-2e6e6e41250011b451412608e455fe6402634729.tar.gz
tangerine-wallet-browser-2e6e6e41250011b451412608e455fe6402634729.tar.zst
tangerine-wallet-browser-2e6e6e41250011b451412608e455fe6402634729.zip
Merge pull request #1535 from MetaMask/gasupdater
Update GasBlockLimits on every new block
Diffstat (limited to 'ui/app/components')
-rw-r--r--ui/app/components/pending-tx.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js
index e3b307b0b..4b1a00eca 100644
--- a/ui/app/components/pending-tx.js
+++ b/ui/app/components/pending-tx.js
@@ -32,7 +32,7 @@ function PendingTx () {
PendingTx.prototype.render = function () {
const props = this.props
- const { currentCurrency } = props
+ const { currentCurrency, blockGasLimit } = props
const conversionRate = props.conversionRate
const txMeta = this.gatherTxMeta()
@@ -50,7 +50,8 @@ PendingTx.prototype.render = function () {
// Gas
const gas = txParams.gas
const gasBn = hexToBn(gas)
- const safeGasLimit = parseInt(txMeta.blockGasLimit)
+ const gasLimit = new BN(parseInt(blockGasLimit))
+ const safeGasLimit = this.bnMultiplyByFraction(gasLimit, 19, 20).toString(10)
// Gas Price
const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16)
@@ -458,6 +459,12 @@ PendingTx.prototype._notZeroOrEmptyString = function (obj) {
return obj !== '' && obj !== '0x0'
}
+PendingTx.prototype.bnMultiplyByFraction = function (targetBN, numerator, denominator) {
+ const numBN = new BN(numerator)
+ const denomBN = new BN(denominator)
+ return targetBN.mul(numBN).div(denomBN)
+}
+
function forwardCarrat () {
return (
h('img', {