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

feat(common): add indexer URL to chain configs #2771

Merged
merged 13 commits into from
Apr 30, 2024
5 changes: 5 additions & 0 deletions .changeset/rotten-rules-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/common": patch
---

Added an optional `indexerUrl` property to `MUDChain`, along with indexer URL's for the Redstone and Garnet chain configs.
2 changes: 1 addition & 1 deletion e2e/packages/client-vanilla/src/mud/getNetworkConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function getNetworkConfig() {
faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl,
worldAddress,
initialBlockNumber,
indexerUrl: params.get("indexerUrl"),
indexerUrl: params.get("indexerUrl") ?? chain.indexerUrl,
yonadaaa marked this conversation as resolved.
Show resolved Hide resolved
rpcHttpUrl: params.get("rpcHttpUrl"),
};
}
2 changes: 1 addition & 1 deletion e2e/packages/client-vanilla/src/mud/setupNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function setupNetwork() {
address: networkConfig.worldAddress as Hex,
publicClient,
startBlock: BigInt(networkConfig.initialBlockNumber),
indexerUrl: networkConfig.indexerUrl ?? undefined,
indexerUrl: networkConfig.indexerUrl,
yonadaaa marked this conversation as resolved.
Show resolved Hide resolved
filters: Object.entries(mudConfig.tables).map(([, table]) => {
const tableId = table.tableId;
if (table.name === mudConfig.tables.Position.name) {
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/chains/garnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const garnet = {
url: "https://explorer.garnetchain.com",
},
},
indexerUrl: "indexer.mud.garnetchain.com",
yonadaaa marked this conversation as resolved.
Show resolved Hide resolved
contracts: {
multicall3: {
address: "0xca11bde05977b3631167028862be2a173976ca11",
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/chains/redstone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const redstone = {
url: "https://explorer.redstone.xyz",
},
},
indexerUrl: "indexer.mud.redstonechain.com",
yonadaaa marked this conversation as resolved.
Show resolved Hide resolved
contracts: {
multicall3: {
address: "0xca11bde05977b3631167028862be2a173976ca11",
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/chains/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Chain } from "viem/chains";

export type MUDChain = Chain & {
indexerUrl?: string;
faucetUrl?: string;
};
Loading