mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Remove blockscale, replace with ethgasstation
This commit is contained in:
parent
732e76a3cb
commit
f9bdc80436
@ -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,
|
||||
},
|
||||
}]
|
||||
)
|
||||
|
@ -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,
|
||||
|
@ -239,10 +239,10 @@ function getRenderableBasicEstimateData (state, gasLimit) {
|
||||
gas: {
|
||||
basicEstimates: {
|
||||
safeLow,
|
||||
average,
|
||||
fast,
|
||||
fastest,
|
||||
safeLowWait,
|
||||
fastestWait,
|
||||
avgWait,
|
||||
fastWait,
|
||||
},
|
||||
},
|
||||
@ -260,6 +260,15 @@ function getRenderableBasicEstimateData (state, gasLimit) {
|
||||
},
|
||||
{
|
||||
labelKey: 'average',
|
||||
feeInPrimaryCurrency: getRenderableEthFee(average, gasLimit),
|
||||
feeInSecondaryCurrency: showFiat
|
||||
? getRenderableConvertedCurrencyFee(average, gasLimit, currentCurrency, conversionRate)
|
||||
: '',
|
||||
timeEstimate: avgWait && getRenderableTimeEstimate(avgWait),
|
||||
priceInHexWei: getGasPriceInHexWei(average),
|
||||
},
|
||||
{
|
||||
labelKey: 'fast',
|
||||
feeInPrimaryCurrency: getRenderableEthFee(fast, gasLimit),
|
||||
feeInSecondaryCurrency: showFiat
|
||||
? getRenderableConvertedCurrencyFee(fast, gasLimit, currentCurrency, conversionRate)
|
||||
@ -267,15 +276,6 @@ function getRenderableBasicEstimateData (state, gasLimit) {
|
||||
timeEstimate: fastWait && getRenderableTimeEstimate(fastWait),
|
||||
priceInHexWei: getGasPriceInHexWei(fast),
|
||||
},
|
||||
{
|
||||
labelKey: 'fast',
|
||||
feeInPrimaryCurrency: getRenderableEthFee(fastest, gasLimit),
|
||||
feeInSecondaryCurrency: showFiat
|
||||
? getRenderableConvertedCurrencyFee(fastest, gasLimit, currentCurrency, conversionRate)
|
||||
: '',
|
||||
timeEstimate: fastestWait && getRenderableTimeEstimate(fastestWait),
|
||||
priceInHexWei: getGasPriceInHexWei(fastest),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@ -294,8 +294,8 @@ function getRenderableEstimateDataForSmallButtonsFromGWEI (state) {
|
||||
gas: {
|
||||
basicEstimates: {
|
||||
safeLow,
|
||||
average,
|
||||
fast,
|
||||
fastest,
|
||||
},
|
||||
},
|
||||
} = state
|
||||
@ -311,19 +311,19 @@ function getRenderableEstimateDataForSmallButtonsFromGWEI (state) {
|
||||
},
|
||||
{
|
||||
labelKey: 'average',
|
||||
feeInSecondaryCurrency: showFiat
|
||||
? getRenderableConvertedCurrencyFee(average, gasLimit, currentCurrency, conversionRate)
|
||||
: '',
|
||||
feeInPrimaryCurrency: getRenderableEthFee(average, gasLimit, NUMBER_OF_DECIMALS_SM_BTNS, true),
|
||||
priceInHexWei: getGasPriceInHexWei(average, true),
|
||||
},
|
||||
{
|
||||
labelKey: 'fast',
|
||||
feeInSecondaryCurrency: showFiat
|
||||
? getRenderableConvertedCurrencyFee(fast, gasLimit, currentCurrency, conversionRate)
|
||||
: '',
|
||||
feeInPrimaryCurrency: getRenderableEthFee(fast, gasLimit, NUMBER_OF_DECIMALS_SM_BTNS, true),
|
||||
priceInHexWei: getGasPriceInHexWei(fast, true),
|
||||
},
|
||||
{
|
||||
labelKey: 'fast',
|
||||
feeInSecondaryCurrency: showFiat
|
||||
? getRenderableConvertedCurrencyFee(fastest, gasLimit, currentCurrency, conversionRate)
|
||||
: '',
|
||||
feeInPrimaryCurrency: getRenderableEthFee(fastest, gasLimit, NUMBER_OF_DECIMALS_SM_BTNS, true),
|
||||
priceInHexWei: getGasPriceInHexWei(fastest, true),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@ -85,18 +85,18 @@ describe('custom-gas selectors', () => {
|
||||
},
|
||||
{
|
||||
labelKey: 'average',
|
||||
feeInPrimaryCurrency: '0.000084 ETH',
|
||||
feeInSecondaryCurrency: '$0.02',
|
||||
priceInHexWei: '0xee6b2800',
|
||||
timeEstimate: '~5 min 18 sec',
|
||||
},
|
||||
{
|
||||
labelKey: 'fast',
|
||||
feeInSecondaryCurrency: '$0.03',
|
||||
feeInPrimaryCurrency: '0.000105 ETH',
|
||||
timeEstimate: '~3 min 18 sec',
|
||||
priceInHexWei: '0x12a05f200',
|
||||
},
|
||||
{
|
||||
labelKey: 'fast',
|
||||
feeInSecondaryCurrency: '$0.05',
|
||||
feeInPrimaryCurrency: '0.00021 ETH',
|
||||
timeEstimate: '~30 sec',
|
||||
priceInHexWei: '0x2540be400',
|
||||
},
|
||||
],
|
||||
mockState: {
|
||||
metamask: {
|
||||
@ -114,6 +114,8 @@ describe('custom-gas selectors', () => {
|
||||
blockTime: 14.16326530612245,
|
||||
safeLow: 2.5,
|
||||
safeLowWait: 6.6,
|
||||
average: 4,
|
||||
avgWait: 5.3,
|
||||
fast: 5,
|
||||
fastWait: 3.3,
|
||||
fastest: 10,
|
||||
@ -132,19 +134,19 @@ describe('custom-gas selectors', () => {
|
||||
priceInHexWei: '0x12a05f200',
|
||||
},
|
||||
{
|
||||
feeInPrimaryCurrency: '0.000147 ETH',
|
||||
feeInSecondaryCurrency: '$0.38',
|
||||
labelKey: 'average',
|
||||
priceInHexWei: '0x1a13b8600',
|
||||
timeEstimate: '~10 min 6 sec',
|
||||
},
|
||||
{
|
||||
labelKey: 'fast',
|
||||
feeInSecondaryCurrency: '$0.54',
|
||||
feeInPrimaryCurrency: '0.00021 ETH',
|
||||
timeEstimate: '~6 min 36 sec',
|
||||
priceInHexWei: '0x2540be400',
|
||||
},
|
||||
{
|
||||
labelKey: 'fast',
|
||||
feeInSecondaryCurrency: '$1.07',
|
||||
feeInPrimaryCurrency: '0.00042 ETH',
|
||||
timeEstimate: '~1 min',
|
||||
priceInHexWei: '0x4a817c800',
|
||||
},
|
||||
],
|
||||
mockState: {
|
||||
metamask: {
|
||||
@ -165,6 +167,8 @@ describe('custom-gas selectors', () => {
|
||||
blockTime: 14.16326530612245,
|
||||
safeLow: 5,
|
||||
safeLowWait: 13.2,
|
||||
average: 7,
|
||||
avgWait: 10.1,
|
||||
fast: 10,
|
||||
fastWait: 6.6,
|
||||
fastest: 20,
|
||||
@ -184,17 +188,17 @@ describe('custom-gas selectors', () => {
|
||||
},
|
||||
{
|
||||
labelKey: 'average',
|
||||
feeInPrimaryCurrency: '0.000147 ETH',
|
||||
feeInSecondaryCurrency: '',
|
||||
feeInPrimaryCurrency: '0.00021 ETH',
|
||||
timeEstimate: '~6 min 36 sec',
|
||||
priceInHexWei: '0x2540be400',
|
||||
timeEstimate: '~10 min 6 sec',
|
||||
priceInHexWei: '0x1a13b8600',
|
||||
},
|
||||
{
|
||||
labelKey: 'fast',
|
||||
feeInSecondaryCurrency: '',
|
||||
feeInPrimaryCurrency: '0.00042 ETH',
|
||||
timeEstimate: '~1 min',
|
||||
priceInHexWei: '0x4a817c800',
|
||||
feeInPrimaryCurrency: '0.00021 ETH',
|
||||
timeEstimate: '~6 min 36 sec',
|
||||
priceInHexWei: '0x2540be400',
|
||||
},
|
||||
],
|
||||
mockState: {
|
||||
@ -216,6 +220,8 @@ describe('custom-gas selectors', () => {
|
||||
blockTime: 14.16326530612245,
|
||||
safeLow: 5,
|
||||
safeLowWait: 13.2,
|
||||
average: 7,
|
||||
avgWait: 10.1,
|
||||
fast: 10,
|
||||
fastWait: 6.6,
|
||||
fastest: 20,
|
||||
@ -235,18 +241,18 @@ describe('custom-gas selectors', () => {
|
||||
},
|
||||
{
|
||||
labelKey: 'average',
|
||||
feeInPrimaryCurrency: '0.000147 ETH',
|
||||
feeInSecondaryCurrency: '$0.38',
|
||||
priceInHexWei: '0x1a13b8600',
|
||||
timeEstimate: '~10 min 6 sec',
|
||||
},
|
||||
{
|
||||
labelKey: 'fast',
|
||||
feeInSecondaryCurrency: '$0.54',
|
||||
feeInPrimaryCurrency: '0.00021 ETH',
|
||||
timeEstimate: '~6 min 36 sec',
|
||||
priceInHexWei: '0x2540be400',
|
||||
},
|
||||
{
|
||||
labelKey: 'fast',
|
||||
feeInSecondaryCurrency: '$1.07',
|
||||
feeInPrimaryCurrency: '0.00042 ETH',
|
||||
timeEstimate: '~1 min',
|
||||
priceInHexWei: '0x4a817c800',
|
||||
},
|
||||
],
|
||||
mockState: {
|
||||
metamask: {
|
||||
@ -267,6 +273,8 @@ describe('custom-gas selectors', () => {
|
||||
blockTime: 14.16326530612245,
|
||||
safeLow: 5,
|
||||
safeLowWait: 13.2,
|
||||
average: 7,
|
||||
avgWait: 10.1,
|
||||
fast: 10,
|
||||
fastWait: 6.6,
|
||||
fastest: 20,
|
||||
@ -286,18 +294,18 @@ describe('custom-gas selectors', () => {
|
||||
},
|
||||
{
|
||||
labelKey: 'average',
|
||||
feeInPrimaryCurrency: '0.000147 ETH',
|
||||
feeInSecondaryCurrency: '$0.38',
|
||||
priceInHexWei: '0x1a13b8600',
|
||||
timeEstimate: '~10 min 6 sec',
|
||||
},
|
||||
{
|
||||
labelKey: 'fast',
|
||||
feeInSecondaryCurrency: '$0.54',
|
||||
feeInPrimaryCurrency: '0.00021 ETH',
|
||||
timeEstimate: '~6 min 36 sec',
|
||||
priceInHexWei: '0x2540be400',
|
||||
},
|
||||
{
|
||||
labelKey: 'fast',
|
||||
feeInSecondaryCurrency: '$1.07',
|
||||
feeInPrimaryCurrency: '0.00042 ETH',
|
||||
timeEstimate: '~1 min',
|
||||
priceInHexWei: '0x4a817c800',
|
||||
},
|
||||
],
|
||||
mockState: {
|
||||
metamask: {
|
||||
@ -318,6 +326,8 @@ describe('custom-gas selectors', () => {
|
||||
blockTime: 14.16326530612245,
|
||||
safeLow: 5,
|
||||
safeLowWait: 13.2,
|
||||
average: 7,
|
||||
avgWait: 10.1,
|
||||
fast: 10,
|
||||
fastWait: 6.6,
|
||||
fastest: 20,
|
||||
@ -349,16 +359,16 @@ describe('custom-gas selectors', () => {
|
||||
priceInHexWei: '0x5d21dba00',
|
||||
},
|
||||
{
|
||||
feeInSecondaryCurrency: '$0.27',
|
||||
feeInPrimaryCurrency: '0.00105 ETH',
|
||||
feeInSecondaryCurrency: '$0.16',
|
||||
feeInPrimaryCurrency: '0.00063 ETH',
|
||||
labelKey: 'average',
|
||||
priceInHexWei: '0xba43b7400',
|
||||
priceInHexWei: '0x6fc23ac00',
|
||||
},
|
||||
{
|
||||
feeInSecondaryCurrency: '$0.54',
|
||||
feeInPrimaryCurrency: '0.0021 ETH',
|
||||
feeInSecondaryCurrency: '$0.27',
|
||||
feeInPrimaryCurrency: '0.00105 ETH',
|
||||
labelKey: 'fast',
|
||||
priceInHexWei: '0x174876e800',
|
||||
priceInHexWei: '0xba43b7400',
|
||||
},
|
||||
],
|
||||
mockState: {
|
||||
@ -380,6 +390,8 @@ describe('custom-gas selectors', () => {
|
||||
blockTime: 14.16326530612245,
|
||||
safeLow: 25,
|
||||
safeLowWait: 6.6,
|
||||
average: 30,
|
||||
avgWait: 5.5,
|
||||
fast: 50,
|
||||
fastWait: 3.3,
|
||||
fastest: 100,
|
||||
@ -397,16 +409,16 @@ describe('custom-gas selectors', () => {
|
||||
priceInHexWei: '0xba43b7400',
|
||||
},
|
||||
{
|
||||
feeInSecondaryCurrency: '$5.37',
|
||||
feeInPrimaryCurrency: '0.0021 ETH',
|
||||
feeInSecondaryCurrency: '$4.03',
|
||||
feeInPrimaryCurrency: '0.00157 ETH',
|
||||
labelKey: 'average',
|
||||
priceInHexWei: '0x174876e800',
|
||||
priceInHexWei: '0x1176592e00',
|
||||
},
|
||||
{
|
||||
feeInSecondaryCurrency: '$10.74',
|
||||
feeInPrimaryCurrency: '0.0042 ETH',
|
||||
feeInSecondaryCurrency: '$5.37',
|
||||
feeInPrimaryCurrency: '0.0021 ETH',
|
||||
labelKey: 'fast',
|
||||
priceInHexWei: '0x2e90edd000',
|
||||
priceInHexWei: '0x174876e800',
|
||||
},
|
||||
],
|
||||
mockState: {
|
||||
@ -428,6 +440,8 @@ describe('custom-gas selectors', () => {
|
||||
blockTime: 14.16326530612245,
|
||||
safeLow: 50,
|
||||
safeLowWait: 13.2,
|
||||
average: 75,
|
||||
avgWait: 9.6,
|
||||
fast: 100,
|
||||
fastWait: 6.6,
|
||||
fastest: 200,
|
||||
@ -446,15 +460,15 @@ describe('custom-gas selectors', () => {
|
||||
},
|
||||
{
|
||||
feeInSecondaryCurrency: '',
|
||||
feeInPrimaryCurrency: '0.0021 ETH',
|
||||
feeInPrimaryCurrency: '0.00157 ETH',
|
||||
labelKey: 'average',
|
||||
priceInHexWei: '0x174876e800',
|
||||
priceInHexWei: '0x1176592e00',
|
||||
},
|
||||
{
|
||||
feeInSecondaryCurrency: '',
|
||||
feeInPrimaryCurrency: '0.0042 ETH',
|
||||
feeInPrimaryCurrency: '0.0021 ETH',
|
||||
labelKey: 'fast',
|
||||
priceInHexWei: '0x2e90edd000',
|
||||
priceInHexWei: '0x174876e800',
|
||||
},
|
||||
],
|
||||
mockState: {
|
||||
@ -476,6 +490,8 @@ describe('custom-gas selectors', () => {
|
||||
blockTime: 14.16326530612245,
|
||||
safeLow: 50,
|
||||
safeLowWait: 13.2,
|
||||
average: 75,
|
||||
avgWait: 9.6,
|
||||
fast: 100,
|
||||
fastWait: 6.6,
|
||||
fastest: 200,
|
||||
@ -493,16 +509,16 @@ describe('custom-gas selectors', () => {
|
||||
priceInHexWei: '0xba43b7400',
|
||||
},
|
||||
{
|
||||
feeInSecondaryCurrency: '$5.37',
|
||||
feeInPrimaryCurrency: '0.0021 ETH',
|
||||
feeInSecondaryCurrency: '$4.03',
|
||||
feeInPrimaryCurrency: '0.00157 ETH',
|
||||
labelKey: 'average',
|
||||
priceInHexWei: '0x174876e800',
|
||||
priceInHexWei: '0x1176592e00',
|
||||
},
|
||||
{
|
||||
feeInSecondaryCurrency: '$10.74',
|
||||
feeInPrimaryCurrency: '0.0042 ETH',
|
||||
feeInSecondaryCurrency: '$5.37',
|
||||
feeInPrimaryCurrency: '0.0021 ETH',
|
||||
labelKey: 'fast',
|
||||
priceInHexWei: '0x2e90edd000',
|
||||
priceInHexWei: '0x174876e800',
|
||||
},
|
||||
],
|
||||
mockState: {
|
||||
@ -524,6 +540,8 @@ describe('custom-gas selectors', () => {
|
||||
blockTime: 14.16326530612245,
|
||||
safeLow: 50,
|
||||
safeLowWait: 13.2,
|
||||
average: 75,
|
||||
avgWait: 9.6,
|
||||
fast: 100,
|
||||
fastWait: 6.6,
|
||||
fastest: 200,
|
||||
@ -541,16 +559,16 @@ describe('custom-gas selectors', () => {
|
||||
priceInHexWei: '0xba43b7400',
|
||||
},
|
||||
{
|
||||
feeInSecondaryCurrency: '$5.37',
|
||||
feeInPrimaryCurrency: '0.0021 ETH',
|
||||
feeInSecondaryCurrency: '$4.03',
|
||||
feeInPrimaryCurrency: '0.00157 ETH',
|
||||
labelKey: 'average',
|
||||
priceInHexWei: '0x174876e800',
|
||||
priceInHexWei: '0x1176592e00',
|
||||
},
|
||||
{
|
||||
feeInSecondaryCurrency: '$10.74',
|
||||
feeInPrimaryCurrency: '0.0042 ETH',
|
||||
feeInSecondaryCurrency: '$5.37',
|
||||
feeInPrimaryCurrency: '0.0021 ETH',
|
||||
labelKey: 'fast',
|
||||
priceInHexWei: '0x2e90edd000',
|
||||
priceInHexWei: '0x174876e800',
|
||||
},
|
||||
],
|
||||
mockState: {
|
||||
@ -572,6 +590,8 @@ describe('custom-gas selectors', () => {
|
||||
blockTime: 14.16326530612245,
|
||||
safeLow: 50,
|
||||
safeLowWait: 13.2,
|
||||
average: 75,
|
||||
avgWait: 9.6,
|
||||
fast: 100,
|
||||
fastWait: 6.6,
|
||||
fastest: 200,
|
||||
|
Loading…
Reference in New Issue
Block a user