diff --git a/helpers/getBlock.ts b/helpers/getBlock.ts index b7c3fc0462..d0f4cbc8e6 100644 --- a/helpers/getBlock.ts +++ b/helpers/getBlock.ts @@ -37,12 +37,13 @@ async function getBlock(timestamp: number, chain: Chain, chainBlocks: ChainBlock block = Number((await retry(async () => (await axios.get(`https://nodes.wavesnodes.com/blocks/heightByTimestamp/${timestamp}`).catch((e) => { throw new Error(`Error getting block: ${chain} ${timestamp} ${e.message}`) }))?.data?.height))); - if (chain === CHAIN.LINEA) + else if (chain === CHAIN.LINEA) block = Number((await retry(async () => (await axios.get("https://explorer.linea.build/api?module=block&action=getblocknobytime×tamp=" + timestamp + "&closest=before").catch((e) => { throw new Error(`Error getting block: ${chain} ${timestamp} ${e.message}`) }))?.data?.result?.blockNumber))); else block = Number((await retry(async () => (await axios.get(`https://coins.llama.fi/block/${chain}/${timestamp}`).catch((e) => { + console.log(`Error getting block: ${chain} ${timestamp} ${e.message}`) throw new Error(`Error getting block: ${chain} ${timestamp} ${e.message}`) }))?.data?.height))); if (block) chainBlocks[chain] = block