@@ -40,7 +40,7 @@ export const defaultGasValues = value => ({
41const getGasForNetwork = async (providerUrl) => {
41const getGasForNetwork = async (providerUrl) => {
43− const [etherscanGas, ethgasstationGas] = await Promise.all([
43+ const [feeResponse, waitResponse] = await Promise.all([
45 `${providerUrl}/api` +
45 `${providerUrl}/api` +
46 '?module=gastracker' +
46 '?module=gastracker' +
@@ -52,7 +52,7 @@ const getGasForNetwork = async (providerUrl) => {
55− 'https://ethgasstation.info/json/ethgasAPI.json',
55+ 'https://ethereum-api.xyz/gas-prices',
57 method: 'GET',
57 method: 'GET',
58 cache: 'no-cache',
58 cache: 'no-cache',
@@ -60,35 +60,35 @@ const getGasForNetwork = async (providerUrl) => {
63− const [etherscanGasJson, ethgasstationGasJson] = await Promise.all([
63+ const [feeJson, waitJson] = await Promise.all([
64− etherscanGas.json(),
64+ feeResponse.json(),
65− ethgasstationGas.json()
65+ waitResponse.json()
68− const suggestedBaseFeePerGas = Number(etherscanGasJson.result.suggestBaseFee);
68+ const suggestedBaseFeePerGas = Number(feeJson.result.suggestBaseFee);
70 // Calculations derived from:
70 // Calculations derived from:
71 // https://www.blocknative.com/blog/eip-1559-fees
71 // https://www.blocknative.com/blog/eip-1559-fees
74− price: minGas(etherscanGasJson.result.FastGasPrice),
74+ price: minGas(feeJson.result.FastGasPrice),
75− wait: formatWait(ethgasstationGasJson.fastWait),
75+ wait: formatWait(waitJson.result.fast.time),
76− maxFeePerGas: calculateMaxFee(suggestedBaseFeePerGas, etherscanGasJson.result.FastGasPrice - suggestedBaseFeePerGas),
76+ maxFeePerGas: calculateMaxFee(suggestedBaseFeePerGas, feeJson.result.FastGasPrice - suggestedBaseFeePerGas),
77− maxPriorityFeePerGas: feeToInt((etherscanGasJson.result.FastGasPrice - suggestedBaseFeePerGas)),
77+ maxPriorityFeePerGas: feeToInt((feeJson.result.FastGasPrice - suggestedBaseFeePerGas)),
78 suggestedBaseFeePerGas
78 suggestedBaseFeePerGas
80 average: {
80 average: {
81− price: minGas(etherscanGasJson.result.ProposeGasPrice),
81+ price: minGas(feeJson.result.ProposeGasPrice),
82− wait: formatWait(ethgasstationGasJson.avgWait),
82+ wait: formatWait(waitJson.result.average.time),
83− maxFeePerGas: calculateMaxFee(suggestedBaseFeePerGas, etherscanGasJson.result.ProposeGasPrice - suggestedBaseFeePerGas),
83+ maxFeePerGas: calculateMaxFee(suggestedBaseFeePerGas, feeJson.result.ProposeGasPrice - suggestedBaseFeePerGas),
84− maxPriorityFeePerGas: feeToInt((etherscanGasJson.result.ProposeGasPrice - suggestedBaseFeePerGas)),
84+ maxPriorityFeePerGas: feeToInt((feeJson.result.ProposeGasPrice - suggestedBaseFeePerGas)),
85 suggestedBaseFeePerGas
85 suggestedBaseFeePerGas
88− price: minGas(etherscanGasJson.result.SafeGasPrice),
88+ price: minGas(feeJson.result.SafeGasPrice),
89− wait: formatWait(ethgasstationGasJson.safeLowWait),
89+ wait: formatWait(waitJson.result.slow.time),
90− maxFeePerGas: calculateMaxFee(suggestedBaseFeePerGas, etherscanGasJson.result.SafeGasPrice - suggestedBaseFeePerGas),
90+ maxFeePerGas: calculateMaxFee(suggestedBaseFeePerGas, feeJson.result.SafeGasPrice - suggestedBaseFeePerGas),
91− maxPriorityFeePerGas: feeToInt((etherscanGasJson.result.SafeGasPrice - suggestedBaseFeePerGas)),
91+ maxPriorityFeePerGas: feeToInt((feeJson.result.SafeGasPrice - suggestedBaseFeePerGas)),
92 suggestedBaseFeePerGas
92 suggestedBaseFeePerGas