diff options
author | Dan <danjm.com@gmail.com> | 2018-05-24 00:43:25 +0800 |
---|---|---|
committer | Dan <danjm.com@gmail.com> | 2018-05-31 07:24:31 +0800 |
commit | 0f20fce9b761fc0aa16d61b2b739fa7f9b9f6a7d (patch) | |
tree | d3c566fdb0485a690da5048264372514661e3830 /app/scripts/metamask-controller.js | |
parent | 3d597cd1d2bfe74abdb945f8ec3ffe96853ed90a (diff) | |
download | tangerine-wallet-browser-0f20fce9b761fc0aa16d61b2b739fa7f9b9f6a7d.tar.gz tangerine-wallet-browser-0f20fce9b761fc0aa16d61b2b739fa7f9b9f6a7d.tar.zst tangerine-wallet-browser-0f20fce9b761fc0aa16d61b2b739fa7f9b9f6a7d.zip |
Auto update gas estimate when to changes.
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r-- | app/scripts/metamask-controller.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 1b1d26886..d3d15e737 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -383,6 +383,8 @@ module.exports = class MetamaskController extends EventEmitter { updateAndApproveTransaction: nodeify(txController.updateAndApproveTransaction, txController), retryTransaction: nodeify(this.retryTransaction, this), getFilteredTxList: nodeify(txController.getFilteredTxList, txController), + isNonceTaken: nodeify(txController.isNonceTaken, txController), + estimateGas: nodeify(this.estimateGas, this), // messageManager signMessage: nodeify(this.signMessage, this), @@ -921,6 +923,18 @@ module.exports = class MetamaskController extends EventEmitter { return state } + estimateGas (estimateGasParams) { + return new Promise((resolve, reject) => { + return this.txController.txGasUtil.query.estimateGas(estimateGasParams, (err, res) => { + if (err) { + return reject(err) + } + + return resolve(res) + }) + }) + } + //============================================================================= // PASSWORD MANAGEMENT //============================================================================= |