diff options
Diffstat (limited to 'ui/app/ducks')
-rw-r--r-- | ui/app/ducks/gas/gas-duck.test.js | 24 | ||||
-rw-r--r-- | ui/app/ducks/gas/gas.duck.js | 29 |
2 files changed, 31 insertions, 22 deletions
diff --git a/ui/app/ducks/gas/gas-duck.test.js b/ui/app/ducks/gas/gas-duck.test.js index 82a91d5e7..85450489d 100644 --- a/ui/app/ducks/gas/gas-duck.test.js +++ b/ui/app/ducks/gas/gas-duck.test.js @@ -321,10 +321,10 @@ describe('Gas Duck', () => { assert.deepEqual( global.fetch.getCall(0).args, [ - 'https://dev.blockscale.net/api/gasexpress.json', + 'https://ethgasstation.info/json/ethgasAPI.json', { 'headers': {}, - 'referrer': 'https://dev.blockscale.net/api/', + 'referrer': 'http://ethgasstation.info/json/', 'referrerPolicy': 'no-referrer-when-downgrade', 'body': null, 'method': 'GET', @@ -341,12 +341,12 @@ describe('Gas Duck', () => { [{ type: SET_BASIC_GAS_ESTIMATE_DATA, value: { - average: 20, + average: 2, blockTime: 'mockBlock_time', blockNum: 'mockBlockNum', - fast: 30, - fastest: 40, - safeLow: 10, + fast: 3, + fastest: 4, + safeLow: 1, }, }] ) @@ -420,10 +420,10 @@ describe('Gas Duck', () => { assert.deepEqual( global.fetch.getCall(0).args, [ - 'https://dev.blockscale.net/api/gasexpress.json', + 'https://ethgasstation.info/json/ethgasAPI.json', { 'headers': {}, - 'referrer': 'https://dev.blockscale.net/api/', + 'referrer': 'http://ethgasstation.info/json/', 'referrerPolicy': 'no-referrer-when-downgrade', 'body': null, 'method': 'GET', @@ -440,12 +440,12 @@ describe('Gas Duck', () => { [{ type: SET_BASIC_GAS_ESTIMATE_DATA, value: { - average: 20, + average: 2, blockTime: 'mockBlock_time', blockNum: 'mockBlockNum', - fast: 30, - fastest: 40, - safeLow: 10, + fast: 3, + fastest: 4, + safeLow: 1, }, }] ) diff --git a/ui/app/ducks/gas/gas.duck.js b/ui/app/ducks/gas/gas.duck.js index e272455fc..700fec6b0 100644 --- a/ui/app/ducks/gas/gas.duck.js +++ b/ui/app/ducks/gas/gas.duck.js @@ -198,23 +198,31 @@ export function fetchBasicGasEstimates () { } async function fetchExternalBasicGasEstimates (dispatch) { - const response = await fetch('https://dev.blockscale.net/api/gasexpress.json', { + const response = await fetch('https://ethgasstation.info/json/ethgasAPI.json', { 'headers': {}, - 'referrer': 'https://dev.blockscale.net/api/', + 'referrer': 'http://ethgasstation.info/json/', 'referrerPolicy': 'no-referrer-when-downgrade', 'body': null, 'method': 'GET', - 'mode': 'cors'} - ) + 'mode': 'cors', + }) + const { - safeLow, - standard: average, - fast, - fastest, + safeLow: safeLowTimes10, + average: averageTimes10, + fast: fastTimes10, + fastest: fastestTimes10, block_time: blockTime, blockNum, } = await response.json() + const [average, fast, fastest, safeLow] = [ + averageTimes10, + fastTimes10, + fastestTimes10, + safeLowTimes10, + ].map(price => (new BigNumber(price)).div(10).toNumber()) + const basicEstimates = { safeLow, average, @@ -260,8 +268,9 @@ async function fetchExternalBasicGasAndTimeEstimates (dispatch) { 'referrerPolicy': 'no-referrer-when-downgrade', 'body': null, 'method': 'GET', - 'mode': 'cors'} - ) + 'mode': 'cors', + }) + const { average: averageTimes10, avgWait, |