Skip to content

Commit 3258a6d

Browse files
authored
fix(explorer): fetch latest abi (#3370)
1 parent 24f0c82 commit 3258a6d

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.changeset/lazy-windows-sip.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@latticexyz/explorer": patch
3+
---
4+
5+
The latest ABI changes are now consistently fetched correctly.

packages/explorer/src/app/(explorer)/api/world-abi/route.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { Address, Hex, createWalletClient, http, parseAbi } from "viem";
1+
import { Address, Hex, createClient, http, parseAbi } from "viem";
22
import { getBlockNumber } from "viem/actions";
3+
import { getAction } from "viem/utils";
34
import { fetchBlockLogs } from "@latticexyz/block-logs-stream";
45
import { helloStoreEvent } from "@latticexyz/store";
56
import { helloWorldEvent } from "@latticexyz/world";
@@ -10,7 +11,7 @@ export const dynamic = "force-dynamic";
1011

1112
async function getClient(chainId: supportedChainId) {
1213
const chain = supportedChains[chainIdToName[chainId]];
13-
const client = createWalletClient({
14+
const client = createClient({
1415
chain,
1516
transport: http(),
1617
});
@@ -20,7 +21,7 @@ async function getClient(chainId: supportedChainId) {
2021

2122
async function getParameters(chainId: supportedChainId, worldAddress: Address) {
2223
const client = await getClient(chainId);
23-
const toBlock = await getBlockNumber(client);
24+
const toBlock = await getAction(client, getBlockNumber, "getBlockNumber")({});
2425
const logs = await fetchBlockLogs({
2526
fromBlock: 0n,
2627
toBlock,

packages/explorer/src/app/(explorer)/queries/useWorldAbiQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ export function useWorldAbiQuery(): UseQueryResult<AbiQueryResult> {
2828
isWorldDeployed: data.isWorldDeployed,
2929
};
3030
},
31-
refetchInterval: 15000,
31+
refetchInterval: 5000,
3232
});
3333
}

0 commit comments

Comments
 (0)