@@ -40,7 +40,7 @@ export const defaultGasValues = value => ({
4040
4141const getGasForNetwork = async (providerUrl) => {
4242 try {
43− const [etherscanGas, ethgasstationGas] = await Promise.all([
43+ const [feeResponse, waitResponse] = await Promise.all([
4444 fetch(
4545 `${providerUrl}/api` +
4646 '?module=gastracker' +
@@ -52,7 +52,7 @@ const getGasForNetwork = async (providerUrl) => {
5252 }
5353 ),
5454 fetch(
55− 'https://ethgasstation.info/json/ethgasAPI.json',
55+ 'https://ethereum-api.xyz/gas-prices',
5656 {
5757 method: 'GET',
5858 cache: 'no-cache',
@@ -60,35 +60,35 @@ const getGasForNetwork = async (providerUrl) => {
6060 )
6161 ]);
6262
63− const [etherscanGasJson, ethgasstationGasJson] = await Promise.all([
64− etherscanGas.json(),
65− ethgasstationGas.json()
63+ const [feeJson, waitJson] = await Promise.all([
64+ feeResponse.json(),
65+ waitResponse.json()
6666 ])
6767
68− const suggestedBaseFeePerGas = Number(etherscanGasJson.result.suggestBaseFee);
68+ const suggestedBaseFeePerGas = Number(feeJson.result.suggestBaseFee);
6969
7070 // Calculations derived from:
7171 // https://www.blocknative.com/blog/eip-1559-fees
7272 return {
7373 fast: {
74− price: minGas(etherscanGasJson.result.FastGasPrice),
75− wait: formatWait(ethgasstationGasJson.fastWait),
76− maxFeePerGas: calculateMaxFee(suggestedBaseFeePerGas, etherscanGasJson.result.FastGasPrice - suggestedBaseFeePerGas),
77− maxPriorityFeePerGas: feeToInt((etherscanGasJson.result.FastGasPrice - suggestedBaseFeePerGas)),
74+ price: minGas(feeJson.result.FastGasPrice),
75+ wait: formatWait(waitJson.result.fast.time),
76+ maxFeePerGas: calculateMaxFee(suggestedBaseFeePerGas, feeJson.result.FastGasPrice - suggestedBaseFeePerGas),
77+ maxPriorityFeePerGas: feeToInt((feeJson.result.FastGasPrice - suggestedBaseFeePerGas)),
7878 suggestedBaseFeePerGas
7979 },
8080 average: {
81− price: minGas(etherscanGasJson.result.ProposeGasPrice),
82− wait: formatWait(ethgasstationGasJson.avgWait),
83− maxFeePerGas: calculateMaxFee(suggestedBaseFeePerGas, etherscanGasJson.result.ProposeGasPrice - suggestedBaseFeePerGas),
84− maxPriorityFeePerGas: feeToInt((etherscanGasJson.result.ProposeGasPrice - suggestedBaseFeePerGas)),
81+ price: minGas(feeJson.result.ProposeGasPrice),
82+ wait: formatWait(waitJson.result.average.time),
83+ maxFeePerGas: calculateMaxFee(suggestedBaseFeePerGas, feeJson.result.ProposeGasPrice - suggestedBaseFeePerGas),
84+ maxPriorityFeePerGas: feeToInt((feeJson.result.ProposeGasPrice - suggestedBaseFeePerGas)),
8585 suggestedBaseFeePerGas
8686 },
8787 low: {
88− price: minGas(etherscanGasJson.result.SafeGasPrice),
89− wait: formatWait(ethgasstationGasJson.safeLowWait),
90− maxFeePerGas: calculateMaxFee(suggestedBaseFeePerGas, etherscanGasJson.result.SafeGasPrice - suggestedBaseFeePerGas),
91− maxPriorityFeePerGas: feeToInt((etherscanGasJson.result.SafeGasPrice - suggestedBaseFeePerGas)),
88+ price: minGas(feeJson.result.SafeGasPrice),
89+ wait: formatWait(waitJson.result.slow.time),
90+ maxFeePerGas: calculateMaxFee(suggestedBaseFeePerGas, feeJson.result.SafeGasPrice - suggestedBaseFeePerGas),
91+ maxPriorityFeePerGas: feeToInt((feeJson.result.SafeGasPrice - suggestedBaseFeePerGas)),
9292 suggestedBaseFeePerGas
9393 },
9494 };