Skip to content

Commit

Permalink
Fix get block error issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zzq0826 committed Aug 14, 2024
1 parent c76b25c commit 9e22596
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hooks/useBlockNumbers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const useBlockNumbers = () => {
const [isL2Available, setIsL2Available] = useState(true)

const fetchBlockNumber = async () => {
const fetchL1BlockNumber = getPublicClient(config, { chainId: CHAIN_ID.L1 })!.getBlock({ blockTag: "finalized" })
const fetchL1BlockNumber = getPublicClient(config, { chainId: CHAIN_ID.L1 })!.getBlock({ blockTag: "latest" })
const fetchL2BlockNumber = getPublicClient(config, { chainId: CHAIN_ID.L2 })!.getBlock({ blockTag: "latest" })
const blockNumbers = await Promise.allSettled([fetchL1BlockNumber, fetchL2BlockNumber])
return blockNumbers.map(item => (item.status === "fulfilled" ? Number(item.value.number) : item.reason))
Expand Down

0 comments on commit 9e22596

Please sign in to comment.