com um clique
dojo-setup
// Use when setting up dojo.js SDK in a frontend project. Triggers: setup dojo, initialize dojo, configure dojo, dojoengine setup, sdk init, DojoSdkProvider, world address, torii url, dojo config
// Use when setting up dojo.js SDK in a frontend project. Triggers: setup dojo, initialize dojo, configure dojo, dojoengine setup, sdk init, DojoSdkProvider, world address, torii url, dojo config
| name | dojo-setup |
| description | Use when setting up dojo.js SDK in a frontend project. Triggers: setup dojo, initialize dojo, configure dojo, dojoengine setup, sdk init, DojoSdkProvider, world address, torii url, dojo config |
Use this skill when:
import { init } from "@dojoengine/sdk";
import { DojoConfig } from "@dojoengine/core";
import { schema } from "./models.gen"; // Generated from ABI
const sdk = await init<typeof schema>({
client: {
worldAddress: "0x...",
toriiUrl: "http://localhost:8080",
},
domain: {
name: "MyGame",
version: "1.0.0",
chainId: "SN_MAIN", // or "SN_SEPOLIA"
},
});
Note:
masterAddressandmasterPrivateKeyare for local development only. In production, use wallet connections instead.
import { DojoSdkProvider } from "@dojoengine/sdk/react";
import { DojoConfig, DojoProvider } from "@dojoengine/core";
const dojoConfig: DojoConfig = {
manifest: manifest, // From manifest.json
rpcUrl: process.env.VITE_RPC_URL || "http://localhost:5050",
toriiUrl: process.env.VITE_TORII_URL || "http://localhost:8080",
// For local development only - never hardcode in production
masterAddress: process.env.VITE_MASTER_ADDRESS || "0x...",
masterPrivateKey: process.env.VITE_MASTER_PRIVATE_KEY || "",
};
function App() {
return (
<DojoSdkProvider
dojoConfig={dojoConfig}
sdk={sdk}
// clientFn is a user-provided factory to create your game client
clientFn={(provider) => new GameClient(provider)}
>
{children}
</DojoSdkProvider>
);
}
VITE_WORLD_ADDRESS=0x...
VITE_TORII_URL=http://localhost:8080
VITE_RPC_URL=http://localhost:5050
VITE_CHAIN_ID=SN_SEPOLIA
| Option | Description |
|---|---|
worldAddress | Deployed world contract address |
toriiUrl | Torii indexer URL (default: http://localhost:8080) |
rpcUrl | Starknet RPC URL |
chainId | SN_MAIN, SN_SEPOLIA, or custom |
manifest | Dojo manifest.json for contract ABIs |
import { useDojoSDK } from "@dojoengine/sdk/react";
function GameComponent() {
const { sdk, config, provider, useDojoStore } = useDojoSDK();
// sdk: SDK instance for queries/subscriptions
// config: DojoConfig
// provider: DojoProvider for contract calls
// useDojoStore: Zustand store hook
}
@dojoengine/core CLIDojoSdkProvider must wrap all Dojo-consuming componentsUse this skill when the user asks to "test dojo contracts", "run integration tests", "start dojo stack", "test with torii", "verify contract behavior", mentions integration testing for Dojo/Cairo contracts, or needs to set up local katana/torii infrastructure.
Update @dojoengine/grpc proto files from Torii repository
Use when debugging and troubleshooting dojo.js applications. Triggers: dojo error, torii connection, entity not found, type mismatch, debug dojo, troubleshoot, subscription error, sync issues
Use when querying, fetching, or subscribing to game entities in dojo.js. Triggers: entity query, fetch entities, useModel, useEntityQuery, ToriiQueryBuilder, subscribe entities, getEntities, entity subscription, model data
Use when subscribing to game events and tracking tokens in dojo.js. Triggers: subscribe events, game events, token balance, event query, achievements, event subscription, onTokenBalanceUpdated, activity tracking
Use for React integration patterns and best practices in dojo.js. Triggers: dojo react, react hooks, effect atoms, Result.match, infinite scroll dojo, DojoSdkProvider, useDojoSDK, react patterns