diff options
author | Frankie <frankie.diamond@gmail.com> | 2018-09-11 07:29:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-11 07:29:29 +0800 |
commit | 1552fe1c3eb8571036f8e32a3b2c5895849d19f1 (patch) | |
tree | ccb2b157cbc249e8b750202763299a59fa57a9ff /ui | |
parent | a43e71693f87290ac1610ae9bc3cc2887a86555b (diff) | |
parent | 43de189d067f8cf03cdd97380cbe2487319271eb (diff) | |
download | tangerine-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 'ui')
-rw-r--r-- | ui/app/actions.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 846a8cb8f..462d75d13 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -315,6 +315,8 @@ var actions = { CLEAR_PENDING_TOKENS: 'CLEAR_PENDING_TOKENS', setPendingTokens, clearPendingTokens, + + createCancelTransaction, } module.exports = actions @@ -1772,6 +1774,29 @@ function retryTransaction (txId) { } } +function createCancelTransaction (txId, customGasPrice) { + log.debug('background.cancelTransaction') + let newTxId + + return dispatch => { + return new Promise((resolve, reject) => { + background.createCancelTransaction(txId, customGasPrice, (err, newState) => { + if (err) { + dispatch(actions.displayWarning(err.message)) + reject(err) + } + + const { selectedAddressTxList } = newState + const { id } = selectedAddressTxList[selectedAddressTxList.length - 1] + newTxId = id + resolve(newState) + }) + }) + .then(newState => dispatch(actions.updateMetamaskState(newState))) + .then(() => newTxId) + } +} + // // config // |