aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan J Miller <danjm.com@gmail.com>2018-07-05 18:31:03 +0800
committerGitHub <noreply@github.com>2018-07-05 18:31:03 +0800
commit46cda26f3b982fb7ff26c29d2137540a5dc49457 (patch)
tree212cdcad5a11c77098905743ee06d1279fd94261 /ui
parentfd218142acb6dab0b2f921b9729f17ff90cffc2d (diff)
parent7d7662191af708621549cfd67592375436263eb3 (diff)
downloadtangerine-wallet-browser-46cda26f3b982fb7ff26c29d2137540a5dc49457.tar
tangerine-wallet-browser-46cda26f3b982fb7ff26c29d2137540a5dc49457.tar.gz
tangerine-wallet-browser-46cda26f3b982fb7ff26c29d2137540a5dc49457.tar.bz2
tangerine-wallet-browser-46cda26f3b982fb7ff26c29d2137540a5dc49457.tar.lz
tangerine-wallet-browser-46cda26f3b982fb7ff26c29d2137540a5dc49457.tar.xz
tangerine-wallet-browser-46cda26f3b982fb7ff26c29d2137540a5dc49457.tar.zst
tangerine-wallet-browser-46cda26f3b982fb7ff26c29d2137540a5dc49457.zip
Merge pull request #4685 from MetaMask/estimate-gasprice-background-newui
Use background gas price estimation method in new ui.
Diffstat (limited to 'ui')
-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 41fc3c504..ad890f565 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')
@@ -746,19 +745,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))