aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/ducks/gas
diff options
context:
space:
mode:
authorThomas <thomas.b.huang@gmail.com>2019-08-22 22:04:52 +0800
committerThomas <thomas.b.huang@gmail.com>2019-08-22 22:04:52 +0800
commitf9bdc8043609d54048180c3eda25b299037749e4 (patch)
tree0edb0f0c4487af90934f56af7e09b223dcbe84b5 /ui/app/ducks/gas
parent732e76a3cbfe62da5217f93b59b269a478555b72 (diff)
downloadtangerine-wallet-browser-f9bdc8043609d54048180c3eda25b299037749e4.tar.gz
tangerine-wallet-browser-f9bdc8043609d54048180c3eda25b299037749e4.tar.zst
tangerine-wallet-browser-f9bdc8043609d54048180c3eda25b299037749e4.zip
Remove blockscale, replace with ethgasstation
Diffstat (limited to 'ui/app/ducks/gas')
-rw-r--r--ui/app/ducks/gas/gas-duck.test.js24
-rw-r--r--ui/app/ducks/gas/gas.duck.js29
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,