Skip to content

Commit

Permalink
Implement storage object graphql (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
broody authored Jun 2, 2023
1 parent 6b14b01 commit eea378e
Show file tree
Hide file tree
Showing 20 changed files with 367 additions and 538 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/torii/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
dojo-world = { path = "../dojo-world" }
async-trait.workspace = true
anyhow.workspace = true
clap.workspace = true
Expand All @@ -30,7 +31,6 @@ tracing-subscriber.workspace = true
url = "2.2.2"
chrono.workspace = true
async-graphql = { version = "5.0.8", features = ["chrono", "dynamic-schema"] }
async-graphql-parser = "5.0.8"
async-graphql-poem = "5.0.8"
poem = "1.3.48"
indexmap = "1.9.3"
Expand Down
2 changes: 1 addition & 1 deletion crates/torii/migrations/20230316154230_setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CREATE TABLE components (
address TEXT NOT NULL,
class_hash TEXT NOT NULL,
transaction_hash TEXT NOT NULL,
storage_schema TEXT NOT NULL,
storage_definition TEXT NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);

Expand Down
4 changes: 4 additions & 0 deletions crates/torii/scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
pushd $(dirname "$0")/..

cargo test --bin torii -- --nocapture
278 changes: 1 addition & 277 deletions crates/torii/sqlx-data.json
Original file line number Diff line number Diff line change
@@ -1,279 +1,3 @@
{
"db": "SQLite",
"10810b95e7e69620fcd832eee2b9342277df3641f84d8b88998d78a9c4b0f5d1": {
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "name",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "address",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "class_hash",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "transaction_hash",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "created_at: _",
"ordinal": 5,
"type_info": "Datetime"
}
],
"nullable": [
false,
false,
false,
false,
false,
false
],
"parameters": {
"Right": 1
}
},
"query": "\n SELECT\n id,\n name,\n address,\n class_hash,\n transaction_hash,\n created_at as \"created_at: _\"\n FROM systems WHERE id = $1\n "
},
"17b656fd8893b11234fb631d819e11a21acc26d2ee1e12c1c7338843e6c8a1d0": {
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "data",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "transaction_hash",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "system_id",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "created_at: _",
"ordinal": 4,
"type_info": "Datetime"
}
],
"nullable": [
false,
false,
false,
false,
false
],
"parameters": {
"Right": 1
}
},
"query": "\n SELECT\n id,\n data,\n transaction_hash,\n system_id,\n created_at as \"created_at: _\"\n FROM system_calls WHERE system_id = $1\n "
},
"2327896fe4f909df1221a2ce203cded743b34566fbb94ad803c963c22b341a0c": {
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "name",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "partition_id",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "keys",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "transaction_hash",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "created_at: _",
"ordinal": 5,
"type_info": "Datetime"
}
],
"nullable": [
false,
false,
false,
true,
false,
false
],
"parameters": {
"Right": 1
}
},
"query": "\n SELECT \n id,\n name,\n partition_id,\n keys,\n transaction_hash,\n created_at as \"created_at: _\"\n FROM entities \n WHERE id = $1\n "
},
"30dedd997ece2ccf165a611708f7ddf4e7987a3d53ded127a76a6e5dc4de3cbd": {
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "system_call_id",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "keys",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "data",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "created_at: _",
"ordinal": 4,
"type_info": "Datetime"
}
],
"nullable": [
false,
false,
false,
false,
false
],
"parameters": {
"Right": 1
}
},
"query": "\n SELECT \n id,\n system_call_id,\n keys,\n data,\n created_at as \"created_at: _\"\n FROM events \n WHERE id = $1\n "
},
"9874396c6908c9499799e95a31b482c2dedcde7ea856419370b8e83a75636583": {
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Text"
},
{
"name": "name",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "address",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "class_hash",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "transaction_hash",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "storage_schema",
"ordinal": 5,
"type_info": "Text"
},
{
"name": "created_at: _",
"ordinal": 6,
"type_info": "Datetime"
}
],
"nullable": [
false,
false,
false,
false,
false,
false,
false
],
"parameters": {
"Right": 1
}
},
"query": "\n SELECT \n id,\n name,\n address,\n class_hash,\n transaction_hash,\n storage_schema,\n created_at as \"created_at: _\"\n FROM components WHERE id = $1\n "
},
"f7b294431f97b0186f93a660ff986788f94febd42c44ebcceee2db9fa10a854f": {
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "data",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "transaction_hash",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "system_id",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "created_at: _",
"ordinal": 4,
"type_info": "Datetime"
}
],
"nullable": [
false,
false,
false,
false,
false
],
"parameters": {
"Right": 1
}
},
"query": "\n SELECT\n id,\n data,\n transaction_hash,\n system_id,\n created_at as \"created_at: _\"\n FROM system_calls WHERE id = $1\n "
}
"db": "SQLite"
}
2 changes: 1 addition & 1 deletion crates/torii/src/graphql/base.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Component {
address: Address!
classHash: Address!
transactionHash: FieldElement!
storageSchema: String!
storageDefinition: String!
storageStates: [Storage_NAME_!]
createdAt: DateTime!
}
Expand Down
Loading

0 comments on commit eea378e

Please sign in to comment.