Skip to content

Commit 10ce339

Browse files
authored
fix(entrykit): require bundler (#3570)
1 parent 6bd1695 commit 10ce339

4 files changed

Lines changed: 34 additions & 0 deletions

File tree

.changeset/long-dolls-jam.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
"@latticexyz/entrykit": patch
3+
---
4+
5+
Using EntryKit without a configured bundler will now throw an error.
6+
7+
Redstone, Garnet, Rhodolite, and Anvil chains come preconfigured. For other chains, you can a bundler RPC URL to your chain config via
8+
9+
```ts
10+
import type { Chain } from "viem";
11+
12+
const chain = {
13+
...
14+
rpcUrls: {
15+
...
16+
bundler: {
17+
http: ["https://..."],
18+
},
19+
},
20+
} as const satisfies Chain;
21+
```

.changeset/shy-adults-train.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@latticexyz/common": patch
3+
---
4+
5+
Added bundler RPC URL to Garnet chain config.

packages/common/src/chains/garnet.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import type { MUDChain } from "./types";
33

44
export const garnet = {
55
...garnetConfig,
6+
rpcUrls: {
7+
...garnetConfig.rpcUrls,
8+
bundler: garnetConfig.rpcUrls.default,
9+
},
610
iconUrls: ["https://redstone.xyz/chain-icons/garnet.png"],
711
indexerUrl: "https://indexer.mud.garnetchain.com",
812
} as const satisfies MUDChain;

packages/entrykit/src/EntryKitConfigProvider.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { RainbowKitProvider, midnightTheme } from "@rainbow-me/rainbowkit";
44
import { EntryKitConfig } from "./config/output";
55
import { Chain } from "viem";
66
import { useChains } from "wagmi";
7+
import { getBundlerTransport } from "./getBundlerTransport";
78

89
type ContextValue = EntryKitConfig & {
910
chain: Chain;
@@ -27,6 +28,9 @@ export function EntryKitConfigProvider({ config, children }: Props) {
2728
const chain = chains.find(({ id }) => id === config.chainId);
2829
if (!chain) throw new Error(`Could not find configured chain for chain ID ${config.chainId}.`);
2930

31+
// This throws when no we can't find a bundler to talk to, so use it to validate the chain.
32+
getBundlerTransport(chain);
33+
3034
return (
3135
<RainbowKitProvider
3236
// Prevent RainbowKit/Wagmi trying to switch chains after connection

0 commit comments

Comments
 (0)