From 2c4c77256a9e32bf048dccb27f9b7ca1d3ed7d93 Mon Sep 17 00:00:00 2001 From: wslyvh Date: Sat, 10 Aug 2024 16:08:27 +0200 Subject: [PATCH] apiKey --- src/services/indexer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/indexer.ts b/src/services/indexer.ts index 3934c351..3079ab0b 100644 --- a/src/services/indexer.ts +++ b/src/services/indexer.ts @@ -6,7 +6,7 @@ export async function GetGasData(network: NETWORKS = 'mainnet') { console.log('Get GasData', network) try { - const res = await fetch(`https://www.ethgastracker.com/api/gas/history/${network}`) + const res = await fetch(`https://www.ethgastracker.com/api/gas/history/${network}?apiKey=${process.env.ETHGAS_API_KEY}`) const body = await res.json() const blocks = body.data.blocks const average = blocks.map((i: GasFee) => i.baseFee).reduce((a: number, b: number) => a + b, 0) / blocks.length @@ -29,7 +29,7 @@ export async function GetAverage(period: 'hour' | 'day', limit: number = 24, net console.log(`[${network}] Get average by ${period}`) try { - const res = await fetch(`https://www.ethgastracker.com/api/gas/average/${network}`) + const res = await fetch(`https://www.ethgastracker.com/api/gas/average/${network}?apiKey=${process.env.ETHGAS_API_KEY}`) const body = await res.json() return body.data.data } catch (error) {