aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/actions.js
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-07-07 07:21:18 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-07-07 07:21:18 +0800
commit7c9d942ba165ff53f44985793f28ffb48fa578e1 (patch)
treec588281c58c8bae4a4da228b2e27ea708c4eb09d /ui/app/actions.js
parent6b2511f94f436a30c6c683f9da2c3142d9a6461c (diff)
parentb4aaf30d6fe829f18dea68a5e6cc321b9fb00d4e (diff)
downloadtangerine-wallet-browser-7c9d942ba165ff53f44985793f28ffb48fa578e1.tar.gz
tangerine-wallet-browser-7c9d942ba165ff53f44985793f28ffb48fa578e1.tar.zst
tangerine-wallet-browser-7c9d942ba165ff53f44985793f28ffb48fa578e1.zip
Merge branch 'develop' of github.com:MetaMask/metamask-extension into initial-trezor-support
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r--ui/app/actions.js34
1 files changed, 20 insertions, 14 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index c822ef3ee..f04de8fe8 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -6,7 +6,6 @@ const {
calcGasTotal,
calcTokenBalance,
estimateGas,
- estimateGasPriceFromRecentBlocks,
} = require('./components/send_/send.utils')
const ethUtil = require('ethereumjs-util')
const { fetchLocale } = require('../i18n-helper')
@@ -788,19 +787,26 @@ function updateGasData ({
}) {
return (dispatch) => {
dispatch(actions.gasLoadingStarted())
- const estimatedGasPrice = estimateGasPriceFromRecentBlocks(recentBlocks)
- return Promise.all([
- Promise.resolve(estimatedGasPrice),
- estimateGas({
- estimateGasMethod: background.estimateGas,
- blockGasLimit,
- selectedAddress,
- selectedToken,
- to,
- value,
- gasPrice: estimatedGasPrice,
- }),
- ])
+ 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,
+ }),
+ ])
+ })
.then(([gasPrice, gas]) => {
dispatch(actions.setGasPrice(gasPrice))
dispatch(actions.setGasLimit(gas))