aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-05-17 23:14:46 +0800
committerDan <danjm.com@gmail.com>2018-05-31 07:24:31 +0800
commit8b6d08a15dc40b4cd8159a543b5cc6855f7848a8 (patch)
tree7b5b1632f3768f3983c6fcd6b50a27f138a56298 /ui
parent6d8344d0d0af3734255a0e9e79d857d84b5fe2aa (diff)
downloadtangerine-wallet-browser-8b6d08a15dc40b4cd8159a543b5cc6855f7848a8.tar
tangerine-wallet-browser-8b6d08a15dc40b4cd8159a543b5cc6855f7848a8.tar.gz
tangerine-wallet-browser-8b6d08a15dc40b4cd8159a543b5cc6855f7848a8.tar.bz2
tangerine-wallet-browser-8b6d08a15dc40b4cd8159a543b5cc6855f7848a8.tar.lz
tangerine-wallet-browser-8b6d08a15dc40b4cd8159a543b5cc6855f7848a8.tar.xz
tangerine-wallet-browser-8b6d08a15dc40b4cd8159a543b5cc6855f7848a8.tar.zst
tangerine-wallet-browser-8b6d08a15dc40b4cd8159a543b5cc6855f7848a8.zip
Split out getGasEstimate logic from updateGasTotal
Diffstat (limited to 'ui')
-rw-r--r--ui/app/actions.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index fc2a838d4..3aa046345 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -161,6 +161,7 @@ var actions = {
UPDATE_TRANSACTION_PARAMS: 'UPDATE_TRANSACTION_PARAMS',
// send screen
estimateGas,
+ getGasEstimate,
getGasPrice,
UPDATE_GAS_LIMIT: 'UPDATE_GAS_LIMIT',
UPDATE_GAS_PRICE: 'UPDATE_GAS_PRICE',
@@ -757,7 +758,7 @@ function setGasTotal (gasTotal) {
}
}
-function updateGasTotal ({ selectedAddress, selectedToken, data }) {
+function getGasEstimate ({ selectedAddress, selectedToken, data }) {
return (dispatch) => {
const { symbol } = selectedToken || {}
const estimateGasParams = getParamsForGasEstimate(selectedAddress, symbol, data)
@@ -766,8 +767,16 @@ function updateGasTotal ({ selectedAddress, selectedToken, data }) {
dispatch(actions.estimateGas(estimateGasParams)),
])
.then(([gasPrice, gas]) => {
- const newGasTotal = calcGasTotal(gas, gasPrice)
- dispatch(actions.setGasTotal(newGasTotal))
+ return calcGasTotal(gas, gasPrice)
+ })
+ }
+}
+
+function updateGasTotal ({ selectedAddress, selectedToken, data }) {
+ return (dispatch) => {
+ return dispatch(actions.getGasEstimate({ selectedAddress, selectedToken, data }))
+ .then((gasEstimate) => {
+ dispatch(actions.setGasTotal(gasEstimate))
dispatch(updateSendErrors({ gasLoadingError: null }))
})
.catch(err => {