aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/actions.js
diff options
context:
space:
mode:
authorDan J Miller <danjm.com@gmail.com>2018-06-28 03:57:51 +0800
committerGitHub <noreply@github.com>2018-06-28 03:57:51 +0800
commit08b69a0cb07c46a7adfa180463e97d802f24d0dd (patch)
tree0e8ae94f69204bc0443a8066b4a48ef204a26283 /ui/app/actions.js
parent1839ab53461913716d573a54511a408eb7865077 (diff)
parent957d729c17fcf49881d5e403afb9bfc9d0fd852a (diff)
downloadtangerine-wallet-browser-08b69a0cb07c46a7adfa180463e97d802f24d0dd.tar
tangerine-wallet-browser-08b69a0cb07c46a7adfa180463e97d802f24d0dd.tar.gz
tangerine-wallet-browser-08b69a0cb07c46a7adfa180463e97d802f24d0dd.tar.bz2
tangerine-wallet-browser-08b69a0cb07c46a7adfa180463e97d802f24d0dd.tar.lz
tangerine-wallet-browser-08b69a0cb07c46a7adfa180463e97d802f24d0dd.tar.xz
tangerine-wallet-browser-08b69a0cb07c46a7adfa180463e97d802f24d0dd.tar.zst
tangerine-wallet-browser-08b69a0cb07c46a7adfa180463e97d802f24d0dd.zip
Merge pull request #4677 from MetaMask/customize-gas-loading-wait
Only show the customize gas modal if the estimateGas call is not currently in flight.
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r--ui/app/actions.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 1edf692b6..41fc3c504 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -175,6 +175,8 @@ var actions = {
CLEAR_SEND: 'CLEAR_SEND',
OPEN_FROM_DROPDOWN: 'OPEN_FROM_DROPDOWN',
CLOSE_FROM_DROPDOWN: 'CLOSE_FROM_DROPDOWN',
+ GAS_LOADING_STARTED: 'GAS_LOADING_STARTED',
+ GAS_LOADING_FINISHED: 'GAS_LOADING_FINISHED',
setGasLimit,
setGasPrice,
updateGasData,
@@ -190,6 +192,8 @@ var actions = {
updateSendErrors,
clearSend,
setSelectedAddress,
+ gasLoadingStarted,
+ gasLoadingFinished,
// app messages
confirmSeedWords: confirmSeedWords,
showAccountDetail: showAccountDetail,
@@ -740,8 +744,9 @@ function updateGasData ({
to,
value,
}) {
- const estimatedGasPrice = estimateGasPriceFromRecentBlocks(recentBlocks)
return (dispatch) => {
+ dispatch(actions.gasLoadingStarted())
+ const estimatedGasPrice = estimateGasPriceFromRecentBlocks(recentBlocks)
return Promise.all([
Promise.resolve(estimatedGasPrice),
estimateGas({
@@ -762,14 +767,28 @@ function updateGasData ({
.then((gasEstimate) => {
dispatch(actions.setGasTotal(gasEstimate))
dispatch(updateSendErrors({ gasLoadingError: null }))
+ dispatch(actions.gasLoadingFinished())
})
.catch(err => {
log.error(err)
dispatch(updateSendErrors({ gasLoadingError: 'gasLoadingError' }))
+ dispatch(actions.gasLoadingFinished())
})
}
}
+function gasLoadingStarted () {
+ return {
+ type: actions.GAS_LOADING_STARTED,
+ }
+}
+
+function gasLoadingFinished () {
+ return {
+ type: actions.GAS_LOADING_FINISHED,
+ }
+}
+
function updateSendTokenBalance ({
selectedToken,
tokenContract,