aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2018-09-11 07:29:29 +0800
committerGitHub <noreply@github.com>2018-09-11 07:29:29 +0800
commit1552fe1c3eb8571036f8e32a3b2c5895849d19f1 (patch)
treeccb2b157cbc249e8b750202763299a59fa57a9ff /app/scripts/metamask-controller.js
parenta43e71693f87290ac1610ae9bc3cc2887a86555b (diff)
parent43de189d067f8cf03cdd97380cbe2487319271eb (diff)
downloadtangerine-wallet-browser-1552fe1c3eb8571036f8e32a3b2c5895849d19f1.tar
tangerine-wallet-browser-1552fe1c3eb8571036f8e32a3b2c5895849d19f1.tar.gz
tangerine-wallet-browser-1552fe1c3eb8571036f8e32a3b2c5895849d19f1.tar.bz2
tangerine-wallet-browser-1552fe1c3eb8571036f8e32a3b2c5895849d19f1.tar.lz
tangerine-wallet-browser-1552fe1c3eb8571036f8e32a3b2c5895849d19f1.tar.xz
tangerine-wallet-browser-1552fe1c3eb8571036f8e32a3b2c5895849d19f1.tar.zst
tangerine-wallet-browser-1552fe1c3eb8571036f8e32a3b2c5895849d19f1.zip
Merge pull request #5216 from MetaMask/tx-cancel
Add createCancelTransaction method
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 1060f508a..3ab256314 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) => {