diff --git a/.changeset/lazy-windows-sip.md b/.changeset/lazy-windows-sip.md new file mode 100644 index 0000000000..7ec6eaa698 --- /dev/null +++ b/.changeset/lazy-windows-sip.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/explorer": patch +--- + +The latest ABI changes are now consistently fetched correctly. diff --git a/packages/explorer/src/app/(explorer)/api/world-abi/route.ts b/packages/explorer/src/app/(explorer)/api/world-abi/route.ts index 1ac0179117..9c38daf4a0 100644 --- a/packages/explorer/src/app/(explorer)/api/world-abi/route.ts +++ b/packages/explorer/src/app/(explorer)/api/world-abi/route.ts @@ -1,5 +1,6 @@ -import { Address, Hex, createWalletClient, http, parseAbi } from "viem"; +import { Address, Hex, createClient, http, parseAbi } from "viem"; import { getBlockNumber } from "viem/actions"; +import { getAction } from "viem/utils"; import { fetchBlockLogs } from "@latticexyz/block-logs-stream"; import { helloStoreEvent } from "@latticexyz/store"; import { helloWorldEvent } from "@latticexyz/world"; @@ -10,7 +11,7 @@ export const dynamic = "force-dynamic"; async function getClient(chainId: supportedChainId) { const chain = supportedChains[chainIdToName[chainId]]; - const client = createWalletClient({ + const client = createClient({ chain, transport: http(), }); @@ -20,7 +21,7 @@ async function getClient(chainId: supportedChainId) { async function getParameters(chainId: supportedChainId, worldAddress: Address) { const client = await getClient(chainId); - const toBlock = await getBlockNumber(client); + const toBlock = await getAction(client, getBlockNumber, "getBlockNumber")({}); const logs = await fetchBlockLogs({ fromBlock: 0n, toBlock, diff --git a/packages/explorer/src/app/(explorer)/queries/useWorldAbiQuery.ts b/packages/explorer/src/app/(explorer)/queries/useWorldAbiQuery.ts index da48a9739c..083d820412 100644 --- a/packages/explorer/src/app/(explorer)/queries/useWorldAbiQuery.ts +++ b/packages/explorer/src/app/(explorer)/queries/useWorldAbiQuery.ts @@ -28,6 +28,6 @@ export function useWorldAbiQuery(): UseQueryResult { isWorldDeployed: data.isWorldDeployed, }; }, - refetchInterval: 15000, + refetchInterval: 5000, }); }