Skip to content

Commit e955210

Browse files
tarrencevgithub-actions[bot]kronosapiens
authored
docs: Update documentation for controller PR #1769 (#42)
Updates documentation to reflect changes made in: fix: switch precedence of cartridgeChains and provided chains Related controller PR: cartridge-gg/controller#1769 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Daniel Kronovet <kronovet@gmail.com>
1 parent ab9594b commit e955210

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/pages/controller/configuration.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type Chain = {
1616

1717
export type ControllerOptions = {
1818
// Chain configuration
19-
chains?: Chain[]; // Custom RPC endpoints for slot katana instances
19+
chains?: Chain[]; // Custom RPC endpoints (takes precedence over default chains)
2020
defaultChainId?: string; // Default chain to use (hex encoded). If using Starknet React, this gets overridden by the same param in StarknetConfig
2121

2222
// Session options
@@ -29,6 +29,30 @@ export type ControllerOptions = {
2929
};
3030
```
3131

32+
## Chain Configuration
33+
34+
Controller provides default Cartridge RPC endpoints for Starknet mainnet and sepolia networks:
35+
- `https://api.cartridge.gg/x/starknet/mainnet`
36+
- `https://api.cartridge.gg/x/starknet/sepolia`
37+
38+
When you provide custom chains via the `chains` option, they take precedence over the default Cartridge chains if they specify the same network. This allows you to:
39+
- Use custom RPC endpoints for mainnet or sepolia
40+
- Add support for additional networks (like Slot katana instances)
41+
- Override default chain configurations
42+
43+
**Example:**
44+
```typescript
45+
const controller = new Controller({
46+
chains: [
47+
{ rpcUrl: "https://api.cartridge.gg/x/my-game/sepolia" }, // Overrides default sepolia
48+
{ rpcUrl: "http://localhost:5050" }, // Adds local development chain
49+
],
50+
chainId: constants.StarknetChainId.SN_SEPOLIA,
51+
});
52+
```
53+
54+
## Configuration Categories
55+
3256
The configuration options are organized into several categories:
3357

3458
- **Chain Options**: Core network configuration and chain settings

0 commit comments

Comments
 (0)