diff options
author | Hsuan Lee <boczeratul@gmail.com> | 2019-05-08 00:33:11 +0800 |
---|---|---|
committer | Hsuan Lee <boczeratul@gmail.com> | 2019-05-08 00:33:11 +0800 |
commit | 4668d419842e2f7c0c1af36447ba1c3716babadf (patch) | |
tree | 303c86f862b40955ca7118d871a26882d54acd84 | |
parent | b709322da8ef794c74683b413ccfe34fd267d347 (diff) | |
download | dexon-wallet-4668d419842e2f7c0c1af36447ba1c3716babadf.tar.gz dexon-wallet-4668d419842e2f7c0c1af36447ba1c3716babadf.tar.zst dexon-wallet-4668d419842e2f7c0c1af36447ba1c3716babadf.zip |
Fix gas estimation
-rw-r--r-- | app/scripts/controllers/transactions/tx-gas-utils.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/app/scripts/controllers/transactions/tx-gas-utils.js b/app/scripts/controllers/transactions/tx-gas-utils.js index b296dc5e..4a037d30 100644 --- a/app/scripts/controllers/transactions/tx-gas-utils.js +++ b/app/scripts/controllers/transactions/tx-gas-utils.js @@ -6,6 +6,7 @@ const { } = require('../../lib/util') const { addHexPrefix } = require('ethereumjs-util') const SIMPLE_GAS_COST = '0x5208' // Hex for 21000, cost of a simple send. +const BASE_TOKEN_GAS_COST = '0x186a0' // Hex for 100000 import { TRANSACTION_NO_CONTRACT_ERROR_KEY } from '../../../../ui/app/constants/error-keys' @@ -94,10 +95,8 @@ class TxGasUtil { } } - // fallback to block gasLimit - const blockGasLimitBN = hexToBn(blockGasLimitHex) - const saferGasLimitBN = BnMultiplyByFraction(blockGasLimitBN, 19, 20) - txParams.gas = bnToHex(saferGasLimitBN) + // fallback to safe limit + txParams.gas = BASE_TOKEN_GAS_COST // estimate tx gas requirements return await this.query.estimateGas(txParams) |