Skip to content
Merged
Changes from all 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
26 changes: 25 additions & 1 deletion src/pages/controller/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type Chain = {

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

// Session options
Expand All @@ -29,6 +29,30 @@ export type ControllerOptions = {
};
```

## Chain Configuration

Controller provides default Cartridge RPC endpoints for Starknet mainnet and sepolia networks:
- `https://api.cartridge.gg/x/starknet/mainnet`
- `https://api.cartridge.gg/x/starknet/sepolia`

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:
- Use custom RPC endpoints for mainnet or sepolia
- Add support for additional networks (like Slot katana instances)
- Override default chain configurations

**Example:**
```typescript
const controller = new Controller({
chains: [
{ rpcUrl: "https://api.cartridge.gg/x/my-game/sepolia" }, // Overrides default sepolia
{ rpcUrl: "http://localhost:5050" }, // Adds local development chain
],
chainId: constants.StarknetChainId.SN_SEPOLIA,
});
```

## Configuration Categories

The configuration options are organized into several categories:

- **Chain Options**: Core network configuration and chain settings
Expand Down