Skip to content

Commit

Permalink
Add dojo-utils crate
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyFate committed Mar 21, 2024
1 parent d313435 commit 43a1f6e
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 47 deletions.
17 changes: 16 additions & 1 deletion Cargo.lock

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

70 changes: 36 additions & 34 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,41 @@
resolver = "2"

members = [
"bin/dojo-language-server",
"bin/katana",
"bin/saya",
"bin/sozo",
"bin/torii",
"crates/benches",
"crates/common",
"crates/dojo-bindgen",
"crates/dojo-core",
"crates/dojo-lang",
"crates/dojo-test-utils",
"crates/dojo-types",
"crates/dojo-world",
"crates/dojo-world/abigen",
"crates/katana/core",
"crates/katana/executor",
"crates/katana/primitives",
"crates/katana/rpc/rpc",
"crates/katana/rpc/rpc-api",
"crates/katana/rpc/rpc-types",
"crates/katana/rpc/rpc-types-builder",
"crates/katana/runner",
"crates/katana/runner/runner-macro",
"crates/katana/storage/codecs",
"crates/katana/storage/codecs/derive",
"crates/katana/storage/db",
"crates/katana/storage/provider",
"crates/metrics",
"crates/saya/core",
"crates/sozo/signers",
"crates/torii/client",
"crates/torii/server",
"crates/torii/types-test",
"examples/spawn-and-move",
"bin/dojo-language-server",
"bin/katana",
"bin/saya",
"bin/sozo",
"bin/torii",
"crates/benches",
"crates/common",
"crates/dojo-bindgen",
"crates/dojo-core",
"crates/dojo-lang",
"crates/dojo-test-utils",
"crates/dojo-types",
"crates/dojo-utils",
"crates/dojo-world",
"crates/dojo-world/abigen",
"crates/katana/core",
"crates/katana/executor",
"crates/katana/primitives",
"crates/katana/rpc/rpc",
"crates/katana/rpc/rpc-api",
"crates/katana/rpc/rpc-types",
"crates/katana/rpc/rpc-types-builder",
"crates/katana/runner",
"crates/katana/runner/runner-macro",
"crates/katana/storage/codecs",
"crates/katana/storage/codecs/derive",
"crates/katana/storage/db",
"crates/katana/storage/provider",
"crates/metrics",
"crates/saya/core",
"crates/sozo/signers",
"crates/torii/client",
"crates/torii/server",
"crates/torii/types-test",
"examples/spawn-and-move",
]

[workspace.package]
Expand Down Expand Up @@ -63,6 +64,7 @@ dojo-core = { path = "crates/dojo-core" }
dojo-lang = { path = "crates/dojo-lang" }
dojo-test-utils = { path = "crates/dojo-test-utils" }
dojo-types = { path = "crates/dojo-types" }
dojo-utils = { path = "crates/dojo-utils" }
dojo-world = { path = "crates/dojo-world" }

# katana
Expand Down
1 change: 1 addition & 0 deletions bin/sozo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ console.workspace = true
dojo-bindgen.workspace = true
dojo-lang.workspace = true
dojo-types.workspace = true
dojo-utils.workspace = true
dojo-world = { workspace = true, features = [ "contracts", "metadata", "migration" ] }
futures.workspace = true
notify = "6.0.1"
Expand Down
19 changes: 19 additions & 0 deletions crates/dojo-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
edition.workspace = true
license-file.workspace = true
license.workspace = true
name = "dojo-utils"
repository.workspace = true
version.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
futures.workspace = true
starknet.workspace = true
thiserror.workspace = true
tokio = { version = "1.32.0", features = [ "time" ], default-features = false }

[dev-dependencies]
assert_matches.workspace = true
dojo-test-utils.workspace = true
File renamed without changes.
5 changes: 3 additions & 2 deletions crates/dojo-world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ repository.workspace = true
version.workspace = true

[dependencies]
dojo-utils.workspace = true

anyhow.workspace = true
async-trait.workspace = true
cairo-lang-filesystem.workspace = true
cairo-lang-project.workspace = true
cairo-lang-starknet.workspace = true
camino.workspace = true
convert_case.workspace = true
futures.workspace = true
serde.workspace = true
serde_json.workspace = true
serde_with.workspace = true
Expand Down Expand Up @@ -45,4 +46,4 @@ tokio.workspace = true
contracts = [ "dep:dojo-types", "dep:http" ]
manifest = [ "contracts", "dep:dojo-types", "dep:url" ]
metadata = [ "dep:ipfs-api-backend-hyper", "dep:scarb", "dep:url" ]
migration = [ "dep:tokio" ]
migration = [ ]
2 changes: 0 additions & 2 deletions crates/dojo-world/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ pub mod manifest;
pub mod metadata;
#[cfg(feature = "migration")]
pub mod migration;
#[cfg(feature = "migration")]
pub mod utils; // TODO: move to somewhere else
3 changes: 1 addition & 2 deletions crates/dojo-world/src/migration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use anyhow::{anyhow, Result};
use async_trait::async_trait;
use cairo_lang_starknet::casm_contract_class::CasmContractClass;
use cairo_lang_starknet::contract_class::ContractClass;
use dojo_utils::{TransactionWaiter, TransactionWaitingError};
use starknet::accounts::{Account, AccountError, Call, ConnectedAccount, SingleOwnerAccount};
use starknet::core::types::contract::{CompiledClass, SierraClass};
use starknet::core::types::{
Expand All @@ -20,8 +21,6 @@ use starknet::providers::{Provider, ProviderError};
use starknet::signers::Signer;
use thiserror::Error;

use crate::utils::{TransactionWaiter, TransactionWaitingError};

pub mod class;
pub mod contract;
pub mod strategy;
Expand Down
1 change: 1 addition & 0 deletions crates/sozo/ops/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ console.workspace = true
dojo-bindgen.workspace = true
dojo-lang.workspace = true
dojo-types.workspace = true
dojo-utils.workspace = true
dojo-world = { workspace = true, features = [ "contracts", "metadata", "migration" ] }
futures.workspace = true
notify = "6.0.1"
Expand Down
2 changes: 1 addition & 1 deletion crates/sozo/ops/src/migration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::path::Path;
use anyhow::{anyhow, bail, Context, Result};
use camino::Utf8PathBuf;
use dojo_lang::compiler::{ABIS_DIR, BASE_DIR, DEPLOYMENTS_DIR, MANIFESTS_DIR, OVERLAYS_DIR};
use dojo_utils::TransactionWaiter;
use dojo_world::contracts::abi::world::ResourceMetadata;
use dojo_world::contracts::cairo_utils;
use dojo_world::contracts::world::WorldContract;
Expand All @@ -17,7 +18,6 @@ use dojo_world::migration::world::WorldDiff;
use dojo_world::migration::{
Declarable, DeployOutput, Deployable, MigrationError, RegisterOutput, StateDiff, TxConfig,
};
use dojo_world::utils::TransactionWaiter;
use scarb::core::Workspace;
use scarb_ui::Ui;
use starknet::accounts::{Account, ConnectedAccount, SingleOwnerAccount};
Expand Down
2 changes: 1 addition & 1 deletion crates/sozo/ops/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;
use dojo_world::utils::{execution_status_from_maybe_pending_receipt, TransactionWaiter};
use dojo_utils::{execution_status_from_maybe_pending_receipt, TransactionWaiter};
use starknet::core::types::{ExecutionResult, InvokeTransactionResult};
use starknet::providers::Provider;

Expand Down
7 changes: 4 additions & 3 deletions crates/torii/graphql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ async-trait.workspace = true
base64.workspace = true
chrono.workspace = true
convert_case = "0.6.0"
dojo-types = { path = "../../dojo-types" }
dojo-types.workspace = true
dojo-utils.workspace = true
lazy_static.workspace = true
scarb-ui.workspace = true
serde.workspace = true
Expand All @@ -39,8 +40,8 @@ sozo-ops.workspace = true

[dev-dependencies]
camino.workspace = true
dojo-test-utils = { path = "../../dojo-test-utils", features = [ "build-examples" ] }
dojo-world = { path = "../../dojo-world" }
dojo-test-utils = { workspace = true, features = [ "build-examples" ] }
dojo-world.workspace = true
scarb.workspace = true
serial_test = "2.0.0"
sozo = { path = "../../../bin/sozo" }
Expand Down
2 changes: 1 addition & 1 deletion crates/torii/graphql/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use dojo_test_utils::sequencer::{
};
use dojo_types::primitive::Primitive;
use dojo_types::schema::{Enum, EnumOption, Member, Struct, Ty};
use dojo_utils::TransactionWaiter;
use dojo_world::contracts::WorldContractReader;
use dojo_world::manifest::DeploymentManifest;
use dojo_world::utils::TransactionWaiter;
use scarb::ops;
use serde::Deserialize;
use serde_json::Value;
Expand Down

0 comments on commit 43a1f6e

Please sign in to comment.