Loading...
Loading...
Compare original and translation side by side
torii --world <WORLD_ADDRESS>http://localhost:8080/graphqlhttp://localhost:8080torii --world <WORLD_ADDRESS> --indexing.controllerstorii --world <WORLD_ADDRESS> --db-dir ./torii-db --indexing.controllerstorii --world <WORLD_ADDRESS>http://localhost:8080/graphqlhttp://localhost:8080torii --world <WORLD_ADDRESS> --indexing.controllerstorii --world <WORLD_ADDRESS> --db-dir ./torii-db --indexing.controllershttp://localhost:8080/graphqlhttp://localhost:8080/graphqlentitiesmodelstransactions{modelName}ModelspositionModelsmovesModelsentitiesmodelstransactions{modelName}ModelspositionModelsmovesModelsquery {
movesModels {
edges {
node {
player
remaining
last_direction
}
}
}
}query {
models {
edges {
node {
id
name
classHash
contractAddress
}
}
totalCount
}
}query {
movesModels {
edges {
node {
player
remaining
last_direction
}
}
}
}query {
models {
edges {
node {
id
name
classHash
contractAddress
}
}
totalCount
}
}query {
entities(first: 10) {
edges {
cursor
node {
id
}
}
pageInfo {
hasNextPage
endCursor
}
}
}query {
entities(first: 10, after: "cursor_value") {
edges {
cursor
node { id }
}
}
}query {
entities(offset: 20, limit: 10) {
edges {
node { id }
}
totalCount
}
}query {
entities(first: 10) {
edges {
cursor
node {
id
}
}
pageInfo {
hasNextPage
endCursor
}
}
}query {
entities(first: 10, after: "cursor_value") {
edges {
cursor
node { id }
}
}
}query {
entities(offset: 20, limit: 10) {
edges {
node { id }
}
totalCount
}
}subscription {
entityUpdated(id: "0x54f58...") {
id
updatedAt
models {
__typename
... on Position {
vec {
x
y
}
}
... on Moves {
remaining
}
}
}
}subscription {
entityUpdated(id: "0x54f58...") {
id
updatedAt
models {
__typename
... on Position {
vec {
x
y
}
}
... on Moves {
remaining
}
}
}
}subscription {
eventEmitted {
id
keys
data
transactionHash
}
}subscription {
eventEmitted {
id
keys
data
transactionHash
}
}subscription {
modelRegistered {
id
name
namespace
}
}subscription {
modelRegistered {
id
name
namespace
}
}sqlite3 torii.db-- Count entities
SELECT COUNT(*) FROM entities;
-- Custom aggregations
SELECT AVG(value) FROM model_data WHERE model_name = 'Health';sqlite3 torii.db-- 统计实体数量
SELECT COUNT(*) FROM entities;
-- 自定义聚合查询
SELECT AVG(value) FROM model_data WHERE model_name = 'Health';import { createClient } from '@dojoengine/torii-client';
const client = await createClient({
rpcUrl: "http://localhost:5050",
toriiUrl: "http://localhost:8080",
worldAddress: WORLD_ADDRESS,
});
// Query entities
const positions = await client.getEntities({
model: "Position",
limit: 10
});
// Subscribe to updates
await client.onEntityUpdated(
[{ model: "Position", keys: [playerId] }],
(entity) => console.log("Position updated:", entity)
);import { createClient } from '@dojoengine/torii-client';
const client = await createClient({
rpcUrl: "http://localhost:5050",
toriiUrl: "http://localhost:8080",
worldAddress: WORLD_ADDRESS,
});
// 查询实体
const positions = await client.getEntities({
model: "Position",
limit: 10
});
// 订阅更新
await client.onEntityUpdated(
[{ model: "Position", keys: [playerId] }],
(entity) => console.log("Position updated:", entity)
);import { ApolloClient, InMemoryCache, gql } from '@apollo/client';
const client = new ApolloClient({
uri: 'http://localhost:8080/graphql',
cache: new InMemoryCache(),
});
const { data } = await client.query({
query: gql`
query GetMoves {
movesModels {
edges {
node {
player
remaining
}
}
}
}
`
});import { ApolloClient, InMemoryCache, gql } from '@apollo/client';
const client = new ApolloClient({
uri: 'http://localhost:8080/graphql',
cache: new InMemoryCache(),
});
const { data } = await client.query({
query: gql`
query GetMoves {
movesModels {
edges {
node {
player
remaining
}
}
}
}
`
});| Option | Description | Default |
|---|---|---|
| World contract address | Optional (since Torii 1.6.0) |
| RPC endpoint URL | |
| Database directory | In-memory |
| Path to TOML configuration file | None |
| CORS origins | |
| 选项 | 描述 | 默认值 |
|---|---|---|
| World合约地址 | 可选(Torii 1.6.0及以上版本) |
| RPC端点URL | |
| 数据库目录 | 内存数据库 |
| TOML配置文件路径 | 无 |
| CORS允许的源 | |
undefinedundefined
See the [Torii configuration guide](/toolchain/torii/configuration) for all TOML options (indexing, polling, namespaces, etc.).
查看[Torii配置指南](/toolchain/torii/configuration)以获取所有TOML配置选项(索引、轮询、命名空间等)。slot auth login
slot deployments create <PROJECT_NAME> torii --config torii.toml --version <DOJO_VERSION>slot auth login
slot deployments create <PROJECT_NAME> torii --config torii.toml --version <DOJO_VERSION>undefinedundefinedundefinedundefinedkatana --dev --dev.no-feesozo build && sozo migratetorii --world <WORLD_ADDRESS> --http.cors_origins "*"katana --dev --dev.no-feesozo build && sozo migratetorii --world <WORLD_ADDRESS> --http.cors_origins "*"entitiesentitiesdojo-clientdojo-client