diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-09-10 01:07:23 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-09-11 03:48:01 +0800 |
commit | 43de189d067f8cf03cdd97380cbe2487319271eb (patch) | |
tree | abd398ce47dc9c204959f4d235adf6af106e3461 /app/scripts/metamask-controller.js | |
parent | fdb023381be323bd3198d5e102447e6591e7e73e (diff) | |
download | tangerine-wallet-browser-43de189d067f8cf03cdd97380cbe2487319271eb.tar tangerine-wallet-browser-43de189d067f8cf03cdd97380cbe2487319271eb.tar.gz tangerine-wallet-browser-43de189d067f8cf03cdd97380cbe2487319271eb.tar.bz2 tangerine-wallet-browser-43de189d067f8cf03cdd97380cbe2487319271eb.tar.lz tangerine-wallet-browser-43de189d067f8cf03cdd97380cbe2487319271eb.tar.xz tangerine-wallet-browser-43de189d067f8cf03cdd97380cbe2487319271eb.tar.zst tangerine-wallet-browser-43de189d067f8cf03cdd97380cbe2487319271eb.zip |
Add createCancelTransaction method
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 98cb62bfa..9b373de9b 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -407,6 +407,7 @@ module.exports = class MetamaskController extends EventEmitter { updateTransaction: nodeify(txController.updateTransaction, txController), updateAndApproveTransaction: nodeify(txController.updateAndApproveTransaction, txController), retryTransaction: nodeify(this.retryTransaction, this), + createCancelTransaction: nodeify(this.createCancelTransaction, this), getFilteredTxList: nodeify(txController.getFilteredTxList, txController), isNonceTaken: nodeify(txController.isNonceTaken, txController), estimateGas: nodeify(this.estimateGas, this), @@ -1109,6 +1110,19 @@ module.exports = class MetamaskController extends EventEmitter { return state } + /** + * Allows a user to attempt to cancel a previously submitted transaction by creating a new + * transaction. + * @param {number} originalTxId - the id of the txMeta that you want to attempt to cancel + * @param {string=} customGasPrice - the hex value to use for the cancel transaction + * @returns {object} MetaMask state + */ + async createCancelTransaction (originalTxId, customGasPrice, cb) { + await this.txController.createCancelTransaction(originalTxId, customGasPrice) + const state = await this.getState() + return state + } + estimateGas (estimateGasParams) { return new Promise((resolve, reject) => { return this.txController.txGasUtil.query.estimateGas(estimateGasParams, (err, res) => { |