Skip to content

Commit

Permalink
feat: use of WorldContractReader from abigen! (#1010)
Browse files Browse the repository at this point in the history
* feat: add cainome abigen to sozo

* feat: add cainome abigen to torii

* fix: adjust test and fmt

* fix: remove additional calldata input

* feat(katana-rpc): add ContractErrorData when it applies

* fix: fix tests

* fix: adjust indexes for executor call results

* fix: restore Scarb.lock and add .tool-versions

* chore: bump cainome to 0.1.5

* fix: embed world and executor ABI in .git

* chore: bump cainome to 0.1.7

* chore: update Scarb.lock

* docs: update README for contract ABI

* fix: fmt clippy from merge

* fix: fix PR comments

* fix: fix typo after test being run

* fix: fix Scarb.lock version
  • Loading branch information
glihm authored Dec 20, 2023
1 parent 1840d72 commit 792194c
Show file tree
Hide file tree
Showing 22 changed files with 1,046 additions and 381 deletions.
48 changes: 48 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/dojo-core/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scarb 2.4.0
1 change: 1 addition & 0 deletions crates/dojo-world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ starknet.workspace = true
thiserror.workspace = true
tracing.workspace = true

cainome = { git = "https://github.com/cartridge-gg/cainome", tag = "v0.1.7", features = ["abigen-rs"] }
dojo-types = { path = "../dojo-types", optional = true }
http = { version = "0.2.9", optional = true }
ipfs-api-backend-hyper = { git = "https://github.com/ferristseng/rust-ipfs-api", rev = "af2c17f7b19ef5b9898f458d97a90055c3605633", features = [ "with-hyper-rustls" ], optional = true }
Expand Down
13 changes: 13 additions & 0 deletions crates/dojo-world/src/contracts/abi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Embedded ABI for contracts

Currently, the ABIs for `world` and `executor` are embedded in the repo.
To build them, consider the following:

1. Change directory into `examples/spawn-and-move` at the root of the workspace.
2. Build the example with `sozo`.
3. Extract the ABI key only for `world` and `executor`:
```
sozo build
jq .abi ./target/dev/dojo\:\:world\:\:world.json > ../../crates/dojo-world/src/contracts/abi/world.json
jq .abi ./target/dev/dojo\:\:executor\:\:executor.json > ../../crates/dojo-world/src/contracts/abi/executor.json
```
53 changes: 53 additions & 0 deletions crates/dojo-world/src/contracts/abi/executor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[
{
"type": "impl",
"name": "Executor",
"interface_name": "dojo::executor::IExecutor"
},
{
"type": "struct",
"name": "core::array::Span::<core::felt252>",
"members": [
{
"name": "snapshot",
"type": "@core::array::Array::<core::felt252>"
}
]
},
{
"type": "interface",
"name": "dojo::executor::IExecutor",
"items": [
{
"type": "function",
"name": "call",
"inputs": [
{
"name": "class_hash",
"type": "core::starknet::class_hash::ClassHash"
},
{
"name": "entrypoint",
"type": "core::felt252"
},
{
"name": "calldata",
"type": "core::array::Span::<core::felt252>"
}
],
"outputs": [
{
"type": "core::array::Span::<core::felt252>"
}
],
"state_mutability": "view"
}
]
},
{
"type": "event",
"name": "dojo::executor::executor::Event",
"kind": "enum",
"variants": []
}
]
Loading

0 comments on commit 792194c

Please sign in to comment.