Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(explorer): fetch latest abi #3370

Merged
merged 6 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lazy-windows-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/explorer": patch
---

The latest ABI changes are now consistently fetched correctly.
6 changes: 3 additions & 3 deletions packages/explorer/src/app/(explorer)/api/world-abi/route.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address, Hex, createWalletClient, http, parseAbi } from "viem";
import { Address, Hex, createPublicClient, http, parseAbi } from "viem";
import { getBlockNumber } from "viem/actions";
import { fetchBlockLogs } from "@latticexyz/block-logs-stream";
import { helloStoreEvent } from "@latticexyz/store";
Expand All @@ -10,7 +10,7 @@ export const dynamic = "force-dynamic";

async function getClient(chainId: supportedChainId) {
const chain = supportedChains[chainIdToName[chainId]];
const client = createWalletClient({
const client = createPublicClient({
chain,
transport: http(),
});
Expand All @@ -20,7 +20,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 getBlockNumber(client, { cacheTime: 0 });
const logs = await fetchBlockLogs({
fromBlock: 0n,
toBlock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ export function useWorldAbiQuery(): UseQueryResult<AbiQueryResult> {
isWorldDeployed: data.isWorldDeployed,
};
},
refetchInterval: 15000,
refetchInterval: 5000,
});
}
Loading