aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/actions.js
diff options
context:
space:
mode:
authorDan Miller <danjm.com@gmail.com>2018-09-13 16:47:05 +0800
committerDan Miller <danjm.com@gmail.com>2018-12-04 11:36:04 +0800
commit7de3f22d63748ed5a81e947755db056d4cdef3db (patch)
tree748482505ce65c3de4e71787d27b69d71156b522 /ui/app/actions.js
parent6ada9b4a3c02014f8d00b1f45a149afbf47f700d (diff)
downloadtangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar
tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.gz
tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.bz2
tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.lz
tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.xz
tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.zst
tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.zip
Connects remained of the gas customization component to redux.
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r--ui/app/actions.js42
1 files changed, 14 insertions, 28 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index e3cf57c9e..b747a97fb 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -3,7 +3,6 @@ const pify = require('pify')
const getBuyEthUrl = require('../../app/scripts/lib/buy-eth-url')
const { getTokenAddressFromTokenObject } = require('./util')
const {
- calcGasTotal,
calcTokenBalance,
estimateGas,
} = require('./components/send/send.utils')
@@ -12,6 +11,7 @@ const { fetchLocale } = require('../i18n-helper')
const log = require('loglevel')
const { ENVIRONMENT_TYPE_NOTIFICATION } = require('../../app/scripts/lib/enums')
const { hasUnconfirmedTransactions } = require('./helpers/confirm-transaction/util')
+const gasDuck = require('./ducks/gas.duck')
const WebcamUtils = require('../lib/webcam-utils')
var actions = {
@@ -921,6 +921,7 @@ function setGasTotal (gasTotal) {
}
function updateGasData ({
+ gasPrice,
blockGasLimit,
recentBlocks,
selectedAddress,
@@ -931,34 +932,19 @@ function updateGasData ({
}) {
return (dispatch) => {
dispatch(actions.gasLoadingStarted())
- return new Promise((resolve, reject) => {
- background.getGasPrice((err, data) => {
- if (err) return reject(err)
- return resolve(data)
- })
- })
- .then(estimateGasPrice => {
- return Promise.all([
- Promise.resolve(estimateGasPrice),
- estimateGas({
- estimateGasMethod: background.estimateGas,
- blockGasLimit,
- selectedAddress,
- selectedToken,
- to,
- value,
- estimateGasPrice,
- data,
- }),
- ])
- })
- .then(([gasPrice, gas]) => {
- dispatch(actions.setGasPrice(gasPrice))
+ return estimateGas({
+ estimateGasMethod: background.estimateGas,
+ blockGasLimit,
+ selectedAddress,
+ selectedToken,
+ to,
+ value,
+ estimateGasPrice: gasPrice,
+ data,
+ })
+ .then(gas => {
dispatch(actions.setGasLimit(gas))
- return calcGasTotal(gas, gasPrice)
- })
- .then((gasEstimate) => {
- dispatch(actions.setGasTotal(gasEstimate))
+ dispatch(gasDuck.setCustomGasLimit(gas))
dispatch(updateSendErrors({ gasLoadingError: null }))
dispatch(actions.gasLoadingFinished())
})