Skip to content

Commit

Permalink
apiKey
Browse files Browse the repository at this point in the history
  • Loading branch information
wslyvh committed Aug 10, 2024
1 parent e70b133 commit 2c4c772
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/services/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit 2c4c772

Please sign in to comment.