diff options
author | Dan <danjm.com@gmail.com> | 2018-06-28 23:47:44 +0800 |
---|---|---|
committer | Dan <danjm.com@gmail.com> | 2018-06-29 07:58:59 +0800 |
commit | de01a6f112716cad8ebc1fd56dd304f1818704f4 (patch) | |
tree | 38f9ce74e5ca0c7ed7ca70e308bf27cec77708c6 /ui/app | |
parent | 9f5ee94b6937c741684de5e70ac0f9fea5f50226 (diff) | |
download | tangerine-wallet-browser-de01a6f112716cad8ebc1fd56dd304f1818704f4.tar.gz tangerine-wallet-browser-de01a6f112716cad8ebc1fd56dd304f1818704f4.tar.zst tangerine-wallet-browser-de01a6f112716cad8ebc1fd56dd304f1818704f4.zip |
Use background gas price estimation method in new ui.
Diffstat (limited to 'ui/app')
-rw-r--r-- | ui/app/actions.js | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 41fc3c504..f118251eb 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -746,20 +746,26 @@ function updateGasData ({ }) { return (dispatch) => { dispatch(actions.gasLoadingStarted()) - const estimatedGasPrice = estimateGasPriceFromRecentBlocks(recentBlocks) - return Promise.all([ - Promise.resolve(estimatedGasPrice), - estimateGas({ + let gasPrice + return (() => new Promise((resolve, reject) => { + background.getGasPrice((err, data) => { + if(err !== null) return reject(err); + return resolve(data); + }) + }))() + .then(estimateGasPrice => { + gasPrice = estimateGasPrice + return estimateGas({ estimateGasMethod: background.estimateGas, blockGasLimit, selectedAddress, selectedToken, to, value, - gasPrice: estimatedGasPrice, - }), - ]) - .then(([gasPrice, gas]) => { + gasPrice, + }) + }) + .then(gas => { dispatch(actions.setGasPrice(gasPrice)) dispatch(actions.setGasLimit(gas)) return calcGasTotal(gas, gasPrice) |