Skip to content

Commit 79335cc

Browse files
kronosapiensclaude
andauthored
docs: update Slot CLI and add Controller integration (#432)
docs: update Slot CLI commands and add Controller integration Fix deprecated slot deployments flags (--world, --rpc) by using --config instead. Add Controller integration to dojo-client skill using starknet-react pattern. Enable controllers indexing by default in Torii across all deployments. Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent 09e1dd6 commit 79335cc

File tree

5 files changed

+199
-13
lines changed

5 files changed

+199
-13
lines changed

docs/pages/tutorials/deploy-to-mainnet/main.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,22 @@ slotup
159159
slot auth login
160160
```
161161

162+
- Create a [Torii configuration file](/toolchain/torii/configuration) with your world address and RPC endpoint:
163+
- `WORLD_ADDRESS`: from your Dojo config file `dojo_sepolia.toml` or from the deployment output
164+
- `RPC_URL`: your RPC provider url
165+
166+
```toml
167+
# torii.toml
168+
world_address = "<WORLD_ADDRESS>"
169+
rpc = "<RPC_URL>"
170+
```
171+
162172
- Create Torii service with this command, replacing...
163173
- `SERVICE_NAME` can be the name of the game/dapp. Once you create it, you own that name.
164174
- `DOJO_VERSION`: your Dojo version (ex: `v1.0.1`)
165-
- `WORLD_ADDRESS`: from your Dojo config file `dojo_sepolia.toml` or from the deployment output
166-
- `RPC_URL`: your RPC provider url
167175

168176
```sh
169-
slot deployments create <PROJECT_NAME> torii --version <DOJO_VERSION> --world <WORLD_ADDRESS> --rpc <RPC_URL>
177+
slot deployments create <SERVICE_NAME> torii --config torii.toml --version <DOJO_VERSION>
170178
```
171179

172180
- slot will output something like this. Save it for later, you will need the endpoints on your client.

docs/pages/tutorials/deploy-using-slot/main.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,18 @@ slot auth login
2828
rm ~/Library/Application\ Support/slot/credentials.json
2929
```
3030

31-
Once successful, you can create a new deployment with a unique `DEPLOYMENT_NAME`. To do this, run the following command:
31+
Once successful, you can create a new deployment with a unique `DEPLOYMENT_NAME`.
32+
33+
The simplest way to get started is using `--optimistic` mode:
3234

3335
```sh
34-
slot deployments create DEPLOYMENT_NAME katana
36+
slot deployments create DEPLOYMENT_NAME katana --optimistic
37+
```
38+
39+
Alternatively, you can provide a [Katana configuration file](/toolchain/katana/configuration) via `--config`:
40+
41+
```sh
42+
slot deployments create DEPLOYMENT_NAME katana --config katana.toml
3543
```
3644

3745
After that, you should receive the RPC endpoint for the katana slot. Now, you can use that and update your `Scarb.toml` file with the new RPC endpoint as follows:
@@ -85,10 +93,24 @@ Congratulations! You have successfully deployed your project with a Katana slot.
8593

8694
## Torii
8795

88-
To initiate a Torri indexer slot, execute the following command:
96+
To deploy a Torii indexer slot, first create a [Torii configuration file](/toolchain/torii/configuration) with your world address and RPC endpoint:
97+
98+
```toml
99+
# torii.toml
100+
world_address = "YOUR_WORLD_ADDRESS"
101+
rpc = "YOUR_NEW_RPC_URL"
102+
```
103+
104+
Then create the deployment:
105+
106+
```sh
107+
slot deployments create DEPLOYMENT_NAME torii --config torii.toml
108+
```
109+
110+
You can also specify a Dojo version with `--version`:
89111

90112
```sh
91-
slot deployments create DEPLOYMENT_NAME torii --world YOUR_WORLD_ADDRESS --rpc YOUR_NEW_RPC_URL --start-block 1
113+
slot deployments create DEPLOYMENT_NAME torii --config torii.toml --version v1.8.0
92114
```
93115

94116
Once deployment is successful, you should receive the endpoints for GraphQL and gRPC.

skills/dojo-client/SKILL.md

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ pnpx @dojoengine/create-dojo start
5252
# Essential packages
5353
pnpm add @dojoengine/core @dojoengine/sdk @dojoengine/torii-client
5454

55-
# For React integration
56-
pnpm add @dojoengine/create-burner @dojoengine/utils
55+
# Controller + starknet-react (recommended)
56+
pnpm add @cartridge/connector @cartridge/controller @starknet-react/core @starknet-react/chains starknet
5757

5858
# For state management
5959
pnpm add @dojoengine/state zustand immer
@@ -104,12 +104,81 @@ async function main() {
104104
// Use in React
105105
createRoot(document.getElementById("root")!).render(
106106
<DojoSdkProvider sdk={sdk} dojoConfig={dojoConfig} clientFn={setupWorld}>
107-
<App />
107+
<StarknetProvider>
108+
<App />
109+
</StarknetProvider>
108110
</DojoSdkProvider>
109111
);
110112
}
111113
```
112114

115+
### Controller Integration (starknet-react)
116+
117+
[Cartridge Controller](https://docs.cartridge.gg/controller/getting-started) is the recommended way to handle account management in Dojo games.
118+
It provides session-based authentication via starknet-react.
119+
120+
**Define policies and create the connector (outside React components):**
121+
122+
```typescript
123+
import { ControllerConnector } from "@cartridge/connector";
124+
import { SessionPolicies } from "@cartridge/controller";
125+
126+
const policies: SessionPolicies = {
127+
contracts: {
128+
[ACTIONS_CONTRACT_ADDRESS]: {
129+
methods: [
130+
{ name: "spawn", entrypoint: "spawn" },
131+
{ name: "move", entrypoint: "move" },
132+
],
133+
},
134+
},
135+
};
136+
137+
const connector = new ControllerConnector({ policies });
138+
```
139+
140+
**Wrap your app with StarknetConfig:**
141+
142+
```typescript
143+
import { StarknetConfig } from "@starknet-react/core";
144+
import { sepolia, mainnet } from "@starknet-react/chains";
145+
146+
function StarknetProvider({ children }: { children: React.ReactNode }) {
147+
return (
148+
<StarknetConfig
149+
autoConnect
150+
chains={[mainnet, sepolia]}
151+
connectors={[connector]}
152+
provider={provider}
153+
>
154+
{children}
155+
</StarknetConfig>
156+
);
157+
}
158+
```
159+
160+
**Connect/disconnect:**
161+
162+
```typescript
163+
import { useConnect, useDisconnect, useAccount } from "@starknet-react/core";
164+
165+
function ConnectWallet() {
166+
const { connect, connectors } = useConnect();
167+
const { disconnect } = useDisconnect();
168+
const { address } = useAccount();
169+
170+
return address ? (
171+
<button onClick={() => disconnect()}>Disconnect</button>
172+
) : (
173+
<button onClick={() => connect({ connector: connectors[0] })}>
174+
Connect
175+
</button>
176+
);
177+
}
178+
```
179+
180+
The `useAccount()` hook used in the "Executing Systems" section below returns the Controller session account once connected.
181+
113182
### Querying Entities
114183

115184
```typescript

skills/dojo-deploy/SKILL.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ sozo build && sozo migrate
234234

235235
**Terminal 3: Start Torii**
236236
```bash
237-
torii --world <WORLD_ADDRESS>
237+
torii --world <WORLD_ADDRESS> --indexing.controllers
238238
```
239239

240240
## Sample Deploy Script
@@ -270,6 +270,52 @@ PROFILE=staging ./scripts/deploy_local.sh
270270
- `TORII_URL`: Torii endpoint (default: `http://localhost:8080`)
271271
- Add project-specific post-deploy steps (e.g., seeding data, running migrations)
272272

273+
## Slot Deployment (Remote)
274+
275+
[Slot](https://docs.cartridge.gg/slot) provides hosted Katana and Torii instances.
276+
277+
### Authentication
278+
279+
```bash
280+
slot auth login
281+
```
282+
283+
### Katana on Slot
284+
285+
**Optimistic mode (simplest):**
286+
```bash
287+
slot deployments create <PROJECT_NAME> katana --optimistic
288+
```
289+
290+
**With configuration file:**
291+
```bash
292+
slot deployments create <PROJECT_NAME> katana --config katana.toml
293+
```
294+
295+
See the [Katana configuration guide](/toolchain/katana/configuration) for TOML options.
296+
297+
### Torii on Slot
298+
299+
Create a `torii.toml` with your world address and RPC endpoint, then deploy:
300+
301+
```bash
302+
slot deployments create <PROJECT_NAME> torii --config torii.toml --version <DOJO_VERSION>
303+
```
304+
305+
See the `dojo-indexer` skill for full Torii configuration details.
306+
307+
### Useful Commands
308+
309+
```bash
310+
# Stream logs
311+
slot deployments logs <PROJECT_NAME> katana -f
312+
slot deployments logs <PROJECT_NAME> torii -f
313+
314+
# Delete a deployment
315+
slot deployments delete <PROJECT_NAME> katana
316+
slot deployments delete <PROJECT_NAME> torii
317+
```
318+
273319
## Manifest File
274320

275321
After deployment, `manifest_<profile>.json` contains:

skills/dojo-indexer/SKILL.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,14 @@ This starts Torii with default settings:
3535
- gRPC API at `http://localhost:8080`
3636
- In-memory database (for development)
3737

38+
**With Controller indexing (recommended):**
39+
```bash
40+
torii --world <WORLD_ADDRESS> --indexing.controllers
41+
```
42+
3843
**Production configuration:**
3944
```bash
40-
torii --world <WORLD_ADDRESS> --db-dir ./torii-db
45+
torii --world <WORLD_ADDRESS> --db-dir ./torii-db --indexing.controllers
4146
```
4247

4348
## What is Torii?
@@ -282,11 +287,47 @@ const { data } = await client.query({
282287

283288
| Option | Description | Default |
284289
|--------|-------------|---------|
285-
| `--world` | World contract address | Required |
290+
| `--world` | World contract address | Optional (since Torii 1.6.0) |
286291
| `--rpc` | RPC endpoint URL | `http://localhost:5050` |
287292
| `--db-dir` | Database directory | In-memory |
293+
| `--config` | Path to TOML configuration file | None |
288294
| `--http.cors_origins` | CORS origins | `*` |
289295

296+
## Slot Deployment (Remote)
297+
298+
[Slot](https://docs.cartridge.gg/slot) provides hosted Torii instances. Slot requires a TOML configuration file.
299+
300+
### Create Configuration
301+
302+
```toml
303+
# torii.toml
304+
world_address = "<WORLD_ADDRESS>"
305+
rpc = "<RPC_URL>"
306+
307+
[indexing]
308+
controllers = true
309+
```
310+
311+
See the [Torii configuration guide](/toolchain/torii/configuration) for all TOML options (indexing, polling, namespaces, etc.).
312+
313+
### Deploy
314+
315+
```bash
316+
slot auth login
317+
318+
slot deployments create <PROJECT_NAME> torii --config torii.toml --version <DOJO_VERSION>
319+
```
320+
321+
### Manage
322+
323+
```bash
324+
# Stream logs
325+
slot deployments logs <PROJECT_NAME> torii -f
326+
327+
# Delete and recreate (safe — all data is on-chain)
328+
slot deployments delete <PROJECT_NAME> torii
329+
```
330+
290331
## Development Workflow
291332

292333
**Terminal 1: Start Katana**

0 commit comments

Comments
 (0)