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 /ui | |
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 '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 6d5b1ef3f..ae7d3b761 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 @@ -1766,6 +1768,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 // |