diff options
author | Mark Stacey <markjstacey@gmail.com> | 2019-09-01 00:29:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-01 00:29:31 +0800 |
commit | 0f1edce403bd6fcb8a6efacf1fe537c0ca8f9134 (patch) | |
tree | dc744d2b913942c1a44b9d6c95f9948d3a251e83 /ui/app/pages | |
parent | 87cf0ced1344e9db55f9bb9e1b4c050ec8fd7d88 (diff) | |
download | tangerine-wallet-browser-0f1edce403bd6fcb8a6efacf1fe537c0ca8f9134.tar.gz tangerine-wallet-browser-0f1edce403bd6fcb8a6efacf1fe537c0ca8f9134.tar.zst tangerine-wallet-browser-0f1edce403bd6fcb8a6efacf1fe537c0ca8f9134.zip |
Fix BigNumber conversion error (#7088)
In the case where the block gas limit in the MetaMask state is blank,
an exception is sometimes thrown when that blank value is passed to
`multiplyCurrencies` to be parsed as a hex number.
Instead the minimum gas limit is now used instead whenever the block
gas limit is falsy. This was already being done in one case anyway.
Diffstat (limited to 'ui/app/pages')
-rw-r--r-- | ui/app/pages/send/send.utils.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ui/app/pages/send/send.utils.js b/ui/app/pages/send/send.utils.js index 1f9bc202a..32c293701 100644 --- a/ui/app/pages/send/send.utils.js +++ b/ui/app/pages/send/send.utils.js @@ -13,6 +13,7 @@ const { BASE_TOKEN_GAS_COST, INSUFFICIENT_FUNDS_ERROR, INSUFFICIENT_TOKENS_ERROR, + MIN_GAS_LIMIT_HEX, NEGATIVE_ETH_ERROR, ONE_GWEI_IN_WEI_HEX, SIMPLE_GAS_COST, @@ -202,7 +203,7 @@ function doesAmountErrorRequireUpdate ({ async function estimateGas ({ selectedAddress, selectedToken, - blockGasLimit, + blockGasLimit = MIN_GAS_LIMIT_HEX, to, value, data, @@ -242,7 +243,7 @@ async function estimateGas ({ } // if not, fall back to block gasLimit - paramsForGasEstimate.gas = ethUtil.addHexPrefix(multiplyCurrencies(blockGasLimit || '0x5208', 0.95, { + paramsForGasEstimate.gas = ethUtil.addHexPrefix(multiplyCurrencies(blockGasLimit, 0.95, { multiplicandBase: 16, multiplierBase: 10, roundDown: '0', |