diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38214d1c66..eeff7bfb91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: - toolchain: ${{ env.RUST_VERSION }} + toolchain: nightly components: rustfmt - uses: Swatinem/rust-cache@v2 diff --git a/Cargo.toml b/Cargo.toml index b887053ac4..7972be9b0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ cairo-lang-lowering = "2.1.0-rc4" cairo-lang-parser = "2.1.0-rc4" cairo-lang-plugins = "2.1.0-rc4" cairo-lang-project = "2.1.0-rc4" -cairo-lang-semantic = { version = "2.1.0-rc4", features = ["testing"] } +cairo-lang-semantic = { version = "2.1.0-rc4", features = [ "testing" ] } cairo-lang-sierra = "2.1.0-rc4" cairo-lang-sierra-generator = "2.1.0-rc4" cairo-lang-sierra-to-casm = "2.1.0-rc4" @@ -50,9 +50,9 @@ cairo-lang-test-runner = "2.1.0-rc4" cairo-lang-test-utils = "2.1.0-rc4" cairo-lang-utils = "2.1.0-rc4" cairo-vm = "0.8.2" -camino = { version = "1.1.2", features = ["serde1"] } -chrono = { version = "0.4.24", features = ["serde"] } -clap = { version = "4.2", features = ["derive"] } +camino = { version = "1.1.2", features = [ "serde1" ] } +chrono = { version = "0.4.24", features = [ "serde" ] } +clap = { version = "4.2", features = [ "derive" ] } clap_complete = "4.3" colored = "2" console = "0.15.7" @@ -68,16 +68,16 @@ rayon = "0.9.0" salsa = "0.16.1" scarb = { git = "https://github.com/software-mansion/scarb", rev = "a3e7b16" } semver = "1.0.5" -serde = { version = "1.0.156", features = ["derive"] } +serde = { version = "1.0.156", features = [ "derive" ] } serde_json = "1.0" serde_with = "2.3.1" -smol_str = { version = "0.2.0", features = ["serde"] } +smol_str = { version = "0.2.0", features = [ "serde" ] } starknet = "0.4.0" starknet-crypto = "0.5.1" starknet_api = { git = "https://github.com/starkware-libs/starknet-api", rev = "ecc9b6946ef13003da202838e4124a9ad2efabb0" } test-log = "0.2.11" thiserror = "1.0.32" -tokio = { version = "1.16", features = ["full"] } +tokio = { version = "1.16", features = [ "full" ] } toml = "0.7.4" tracing = "0.1" tracing-subscriber = "0.3.16" diff --git a/crates/dojo-client/Cargo.toml b/crates/dojo-client/Cargo.toml index b8e6d04afa..71c077b312 100644 --- a/crates/dojo-client/Cargo.toml +++ b/crates/dojo-client/Cargo.toml @@ -14,5 +14,5 @@ thiserror.workspace = true [dev-dependencies] camino.workspace = true -dojo-test-utils = { path = "../dojo-test-utils", features = ["build-examples"] } +dojo-test-utils = { path = "../dojo-test-utils", features = [ "build-examples" ] } tokio.workspace = true diff --git a/crates/dojo-client/src/contract/system.rs b/crates/dojo-client/src/contract/system.rs index 5402370d83..9717beb8a5 100644 --- a/crates/dojo-client/src/contract/system.rs +++ b/crates/dojo-client/src/contract/system.rs @@ -108,8 +108,10 @@ impl<'a, P: Provider + Sync> SystemReader<'a, P> { .call( FunctionCall { contract_address: world.address, - calldata: vec![cairo_short_string_to_felt(&name) - .map_err(SystemReaderError::CairoShortStringToFeltError)?], + calldata: vec![ + cairo_short_string_to_felt(&name) + .map_err(SystemReaderError::CairoShortStringToFeltError)?, + ], entry_point_selector: get_selector_from_name("system").unwrap(), }, block_id, diff --git a/crates/dojo-core/Scarb.toml b/crates/dojo-core/Scarb.toml index c231c34fe0..d3f313eafb 100644 --- a/crates/dojo-core/Scarb.toml +++ b/crates/dojo-core/Scarb.toml @@ -1,8 +1,8 @@ [package] -name = "dojo" -version = "0.1.0" cairo-version = "2.1.0-rc4" description = "The Dojo Core library for autonomous worlds." +name = "dojo" +version = "0.1.0" [dependencies] dojo_plugin = { git = "https://github.com/dojoengine/dojo" } diff --git a/crates/dojo-core/tests/Scarb.toml b/crates/dojo-core/tests/Scarb.toml index b1425eac22..7d559f8056 100644 --- a/crates/dojo-core/tests/Scarb.toml +++ b/crates/dojo-core/tests/Scarb.toml @@ -1,7 +1,7 @@ [package] +description = "Tests for Dojo Core" name = "dojo_tests" version = "0.1.0" -description = "Tests for Dojo Core" [dependencies] dojo = { path = "../" } diff --git a/crates/dojo-defi/Scarb.toml b/crates/dojo-defi/Scarb.toml index b6b6d086ad..06fe95c841 100644 --- a/crates/dojo-defi/Scarb.toml +++ b/crates/dojo-defi/Scarb.toml @@ -1,8 +1,8 @@ [package] -name = "dojo_defi" -version = "0.1.0" cairo-version = "2.0.0-rc4" description = "Implementations of a defi primitives for the Dojo framework" +name = "dojo_defi" +version = "0.1.0" [dependencies] cubit = { git = "https://github.com/influenceth/cubit" } diff --git a/crates/dojo-erc/Scarb.toml b/crates/dojo-erc/Scarb.toml index 124b931293..053f587026 100644 --- a/crates/dojo-erc/Scarb.toml +++ b/crates/dojo-erc/Scarb.toml @@ -1,8 +1,8 @@ [package] -name = "dojo_erc" -version = "0.1.0" cairo-version = "2.1.0-rc4" description = "Implementations of ERC standards for the Dojo framework" +name = "dojo_erc" +version = "0.1.0" [dependencies] dojo = { path = "../dojo-core" } diff --git a/crates/dojo-lang/Cargo.toml b/crates/dojo-lang/Cargo.toml index 2d5a4a56e3..796fe360f6 100644 --- a/crates/dojo-lang/Cargo.toml +++ b/crates/dojo-lang/Cargo.toml @@ -1,54 +1,54 @@ [package] -name = "dojo-lang" -version.workspace = true +description = "Dojo capabilities and utilities on top of Starknet." edition.workspace = true -repository.workspace = true license-file.workspace = true -description = "Dojo capabilities and utilities on top of Starknet." +name = "dojo-lang" +repository.workspace = true +version.workspace = true [features] -testing = [] +testing = [ ] [dependencies] anyhow.workspace = true assert_fs = "1.0.9" -camino.workspace = true cairo-lang-compiler.workspace = true cairo-lang-defs.workspace = true cairo-lang-diagnostics.workspace = true -cairo-lang-lowering.workspace = true cairo-lang-filesystem.workspace = true +cairo-lang-lowering.workspace = true cairo-lang-parser.workspace = true cairo-lang-plugins.workspace = true cairo-lang-project.workspace = true cairo-lang-semantic.workspace = true cairo-lang-sierra-generator.workspace = true -cairo-lang-syntax.workspace = true cairo-lang-starknet.workspace = true +cairo-lang-syntax.workspace = true cairo-lang-utils.workspace = true +camino.workspace = true convert_case.workspace = true dojo-types = { path = "../dojo-types" } dojo-world = { path = "../dojo-world" } indoc.workspace = true itertools.workspace = true +salsa.workspace = true +sanitizer = "0.1.6" scarb.workspace = true semver.workspace = true serde.workspace = true serde_json.workspace = true serde_with = "2.3.1" smol_str.workspace = true +starknet.workspace = true thiserror = "1.0.32" tracing.workspace = true -salsa.workspace = true -sanitizer = "0.1.6" -starknet.workspace = true url = "2.2.2" [dev-dependencies] cairo-lang-formatter.workspace = true cairo-lang-semantic.workspace = true cairo-lang-test-utils.workspace = true +dojo-test-utils = { path = "../dojo-test-utils" } env_logger = "0.10.0" pretty_assertions.workspace = true test-log.workspace = true -dojo-test-utils = { path = "../dojo-test-utils" } diff --git a/crates/dojo-lang/src/manifest_test_crate/Scarb.toml b/crates/dojo-lang/src/manifest_test_crate/Scarb.toml index df6cc84002..f8a458fac8 100644 --- a/crates/dojo-lang/src/manifest_test_crate/Scarb.toml +++ b/crates/dojo-lang/src/manifest_test_crate/Scarb.toml @@ -1,4 +1,4 @@ [package] +cairo_version = "1.1.0" name = "manifest_test" version = "0.1.0" -cairo_version = "1.1.0" diff --git a/crates/dojo-lang/src/plugin.rs b/crates/dojo-lang/src/plugin.rs index 86c99e8ccf..5961fc777a 100644 --- a/crates/dojo-lang/src/plugin.rs +++ b/crates/dojo-lang/src/plugin.rs @@ -62,11 +62,7 @@ impl GeneratedFileAuxData for DojoAuxData { self } fn eq(&self, other: &dyn GeneratedFileAuxData) -> bool { - if let Some(other) = other.as_any().downcast_ref::() { - self == other - } else { - false - } + if let Some(other) = other.as_any().downcast_ref::() { self == other } else { false } } } impl AsDynGeneratedFileAuxData for DojoAuxData { diff --git a/crates/dojo-language-server/Cargo.toml b/crates/dojo-language-server/Cargo.toml index f034217a7f..c5a55670ba 100644 --- a/crates/dojo-language-server/Cargo.toml +++ b/crates/dojo-language-server/Cargo.toml @@ -1,7 +1,7 @@ [package] +edition = "2021" name = "dojo-languge-server" version = "0.1.0" -edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [[bin]] @@ -10,16 +10,16 @@ path = "src/bin/language_server.rs" [dependencies] anyhow.workspace = true -dojo-lang = { path = "../dojo-lang" } cairo-lang-compiler.workspace = true +cairo-lang-filesystem.workspace = true cairo-lang-language-server.workspace = true -cairo-lang-starknet.workspace = true -cairo-lang-semantic.workspace = true cairo-lang-plugins.workspace = true -cairo-lang-filesystem.workspace = true +cairo-lang-semantic.workspace = true +cairo-lang-starknet.workspace = true cairo-lang-utils.workspace = true +dojo-lang = { path = "../dojo-lang" } log = "0.4.14" -tokio = { version = "1.18.2", features = ["full", "sync"] } -tower-lsp = "0.19.0" salsa = "0.16.1" smol_str.workspace = true +tokio = { version = "1.18.2", features = [ "full", "sync" ] } +tower-lsp = "0.19.0" diff --git a/crates/dojo-physics/Scarb.toml b/crates/dojo-physics/Scarb.toml index b002cdde7c..6e950cba39 100644 --- a/crates/dojo-physics/Scarb.toml +++ b/crates/dojo-physics/Scarb.toml @@ -1,11 +1,11 @@ [package] -name = "dojo_physics" -version = "0.1.0" cairo-version = "2.0.0-rc4" description = "Implementations of a physics library for the Dojo framework" +name = "dojo_physics" +version = "0.1.0" [dependencies] -dojo = { path = "../dojo-core" } cubit = { git = "https://github.com/influenceth/cubit" } +dojo = { path = "../dojo-core" } [[target.dojo]] diff --git a/crates/dojo-physics/examples/projectile/Scarb.toml b/crates/dojo-physics/examples/projectile/Scarb.toml index 64d9a97880..dbf46e5628 100644 --- a/crates/dojo-physics/examples/projectile/Scarb.toml +++ b/crates/dojo-physics/examples/projectile/Scarb.toml @@ -4,4 +4,4 @@ version = "0.1.0" [dependencies] cubit = { git = "https://github.com/influenceth/cubit" } -dojo_physics = { path = "../.."} +dojo_physics = { path = "../.." } diff --git a/crates/dojo-physics/examples/projectile/cairo_project.toml b/crates/dojo-physics/examples/projectile/cairo_project.toml index 4ae8ffba4e..5ec5b278ba 100644 --- a/crates/dojo-physics/examples/projectile/cairo_project.toml +++ b/crates/dojo-physics/examples/projectile/cairo_project.toml @@ -1,3 +1,3 @@ [crate_roots] -projectile = "src" dojo_physics = "../../src" +projectile = "src" diff --git a/crates/dojo-signers/Cargo.toml b/crates/dojo-signers/Cargo.toml index 36208112de..1165853427 100644 --- a/crates/dojo-signers/Cargo.toml +++ b/crates/dojo-signers/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "dojo-signers" -version.workspace = true +description = "Dojo Signer implementations" edition.workspace = true -repository.workspace = true license-file.workspace = true -description = "Dojo Signer implementations" +name = "dojo-signers" +repository.workspace = true +version.workspace = true [dependencies] anyhow.workspace = true diff --git a/crates/dojo-test-utils/Cargo.toml b/crates/dojo-test-utils/Cargo.toml index 27e57e0331..c84848d640 100644 --- a/crates/dojo-test-utils/Cargo.toml +++ b/crates/dojo-test-utils/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "dojo-test-utils" -version.workspace = true edition.workspace = true -repository.workspace = true license-file.workspace = true +name = "dojo-test-utils" +repository.workspace = true +version.workspace = true [dependencies] anyhow.workspace = true @@ -11,24 +11,24 @@ assert_fs = "1.0.9" async-trait.workspace = true cairo-lang-compiler.workspace = true cairo-lang-filesystem.workspace = true -cairo-lang-starknet.workspace = true cairo-lang-project.workspace = true +cairo-lang-starknet.workspace = true camino.workspace = true dojo-lang = { path = "../dojo-lang" } -jsonrpsee = { version = "0.16.2", features = ["server"] } +jsonrpsee = { version = "0.16.2", features = [ "server" ] } katana-core = { path = "../katana/core" } katana-rpc = { path = "../katana/rpc" } -tokio = { version = "1.28.0", features = ["full"] } -thiserror.workspace = true -toml = "0.7.1" scarb.workspace = true serde.workspace = true serde_json.workspace = true serde_with.workspace = true smol_str.workspace = true starknet.workspace = true -url = "2.2.2" +thiserror.workspace = true +tokio = { version = "1.28.0", features = [ "full" ] } +toml = "0.7.1" tracing.workspace = true +url = "2.2.2" [build-dependencies] assert_fs = "1.0.9" @@ -37,4 +37,4 @@ dojo-lang = { path = "../dojo-lang" } scarb.workspace = true [features] -build-examples = [] +build-examples = [ ] diff --git a/crates/dojo-world/Cargo.toml b/crates/dojo-world/Cargo.toml index f0a964379f..09ac15acaa 100644 --- a/crates/dojo-world/Cargo.toml +++ b/crates/dojo-world/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "dojo-world" -version.workspace = true +description = "Dojo world specification. For example, crates and flags used for compilation." edition.workspace = true -repository.workspace = true license-file.workspace = true -description = "Dojo world specification. For example, crates and flags used for compilation." +name = "dojo-world" +repository.workspace = true +version.workspace = true [dependencies] anyhow.workspace = true @@ -16,24 +16,21 @@ camino.workspace = true convert_case.workspace = true dojo-types = { path = "../dojo-types" } futures = "0.3.28" -reqwest = { version = "0.11.18", default-features = false, features = [ - "rustls-tls", -] } +reqwest = { version = "0.11.18", default-features = false, features = [ "rustls-tls" ] } serde.workspace = true serde_json.workspace = true serde_with.workspace = true smol_str.workspace = true -starknet.workspace = true starknet-crypto.workspace = true +starknet.workspace = true thiserror.workspace = true -tracing.workspace = true tokio.workspace = true +tracing.workspace = true url = "2.2.2" [dev-dependencies] assert_fs = "1.0.9" assert_matches = "1.5.0" -dojo-test-utils = { path = "../dojo-test-utils" } dojo-lang = { path = "../dojo-lang" } -tokio = { version = "1.28.0", features = ["full"] } - +dojo-test-utils = { path = "../dojo-test-utils" } +tokio = { version = "1.28.0", features = [ "full" ] } diff --git a/crates/dojo-world/src/manifest.rs b/crates/dojo-world/src/manifest.rs index b5ff74b51f..429a229f20 100644 --- a/crates/dojo-world/src/manifest.rs +++ b/crates/dojo-world/src/manifest.rs @@ -151,8 +151,10 @@ impl Manifest { .call( FunctionCall { contract_address: world_address, - calldata: vec![cairo_short_string_to_felt(&component.name) - .map_err(ManifestError::InvalidNameError)?], + calldata: vec![ + cairo_short_string_to_felt(&component.name) + .map_err(ManifestError::InvalidNameError)?, + ], entry_point_selector: get_selector_from_name("component").unwrap(), }, BlockId::Tag(BlockTag::Pending), @@ -172,12 +174,14 @@ impl Manifest { .call( FunctionCall { contract_address: world_address, - calldata: vec![cairo_short_string_to_felt( - // because the name returns by the `name` method of - // a system contract is without the 'System' suffix - system.name.strip_suffix("System").unwrap_or(&system.name), - ) - .map_err(ManifestError::InvalidNameError)?], + calldata: vec![ + cairo_short_string_to_felt( + // because the name returns by the `name` method of + // a system contract is without the 'System' suffix + system.name.strip_suffix("System").unwrap_or(&system.name), + ) + .map_err(ManifestError::InvalidNameError)?, + ], entry_point_selector: get_selector_from_name("system").unwrap(), }, BlockId::Tag(BlockTag::Pending), diff --git a/crates/dojo-world/src/migration/class.rs b/crates/dojo-world/src/migration/class.rs index b06cfc3d89..dfcb98acb5 100644 --- a/crates/dojo-world/src/migration/class.rs +++ b/crates/dojo-world/src/migration/class.rs @@ -16,11 +16,7 @@ pub struct ClassDiff { impl StateDiff for ClassDiff { fn is_same(&self) -> bool { - if let Some(remote) = self.remote { - self.local == remote - } else { - false - } + if let Some(remote) = self.remote { self.local == remote } else { false } } } diff --git a/crates/dojo-world/src/migration/contract.rs b/crates/dojo-world/src/migration/contract.rs index 6a1f099b2b..ee8fc2dae7 100644 --- a/crates/dojo-world/src/migration/contract.rs +++ b/crates/dojo-world/src/migration/contract.rs @@ -18,11 +18,7 @@ pub struct ContractDiff { impl StateDiff for ContractDiff { fn is_same(&self) -> bool { - if let Some(remote) = self.remote { - self.local == remote - } else { - false - } + if let Some(remote) = self.remote { self.local == remote } else { false } } } diff --git a/crates/katana/Cargo.toml b/crates/katana/Cargo.toml index 578e80601f..5ffa8a298f 100644 --- a/crates/katana/Cargo.toml +++ b/crates/katana/Cargo.toml @@ -1,20 +1,20 @@ [package] -name = "katana" -version.workspace = true +description = "A fast and lightweight local Starknet development sequencer." edition.workspace = true -repository.workspace = true license-file.workspace = true -description = "A fast and lightweight local Starknet development sequencer." +name = "katana" +repository.workspace = true +version.workspace = true [dependencies] clap.workspace = true clap_complete.workspace = true env_logger.workspace = true -log.workspace = true -tokio.workspace = true katana-core = { path = "core" } katana-rpc = { path = "rpc" } +log.workspace = true starknet_api.workspace = true +tokio.workspace = true yansi.workspace = true [dev-dependencies] diff --git a/crates/katana/rpc/Cargo.toml b/crates/katana/rpc/Cargo.toml index 17f3649483..73b506b5d5 100644 --- a/crates/katana/rpc/Cargo.toml +++ b/crates/katana/rpc/Cargo.toml @@ -14,7 +14,7 @@ cairo-vm.workspace = true flate2.workspace = true hex = { version = "0.4.3", default-features = false } hyper = "0.14.20" -jsonrpsee = { version = "0.16.2", features = ["server", "macros"] } +jsonrpsee = { version = "0.16.2", features = [ "macros", "server" ] } katana-core = { path = "../core" } serde.workspace = true serde_json.workspace = true @@ -23,8 +23,8 @@ starknet.workspace = true starknet_api.workspace = true thiserror.workspace = true tokio.workspace = true -tower = { version = "0.4.13", features = ["full"] } -tower-http = { version = "0.4.0", features = ["full"] } +tower = { version = "0.4.13", features = [ "full" ] } +tower-http = { version = "0.4.0", features = [ "full" ] } tracing.workspace = true [dev-dependencies] diff --git a/crates/katana/rpc/src/api/starknet.rs b/crates/katana/rpc/src/api/starknet.rs index b3ac2fac48..5103b16323 100644 --- a/crates/katana/rpc/src/api/starknet.rs +++ b/crates/katana/rpc/src/api/starknet.rs @@ -70,7 +70,7 @@ pub trait StarknetApi { #[method(name = "getNonce")] async fn nonce(&self, block_id: BlockId, contract_address: FieldElement) - -> Result; + -> Result; #[method(name = "blockNumber")] async fn block_number(&self) -> Result; diff --git a/crates/sozo/Cargo.toml b/crates/sozo/Cargo.toml index e320aee3f1..82fc70cc87 100644 --- a/crates/sozo/Cargo.toml +++ b/crates/sozo/Cargo.toml @@ -1,49 +1,49 @@ [package] +edition = "2021" name = "sozo" version = "0.1.0" -edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anyhow.workspace = true async-trait.workspace = true -camino.workspace = true -clap.workspace = true -clap_complete.workspace = true -dojo-client = { path = "../dojo-client" } -dojo-lang = { path = "../dojo-lang" } -dojo-world = { path = "../dojo-world" } -log.workspace = true cairo-lang-compiler.workspace = true cairo-lang-filesystem.workspace = true cairo-lang-plugins.workspace = true cairo-lang-project.workspace = true -cairo-lang-sierra.workspace = true cairo-lang-sierra-to-casm.workspace = true +cairo-lang-sierra.workspace = true cairo-lang-starknet.workspace = true cairo-lang-test-runner.workspace = true +camino.workspace = true +clap-verbosity-flag = "2.0.1" +clap.workspace = true +clap_complete.workspace = true +console.workspace = true +dojo-client = { path = "../dojo-client" } +dojo-lang = { path = "../dojo-lang" } +dojo-world = { path = "../dojo-world" } +log.workspace = true scarb.workspace = true semver.workspace = true serde.workspace = true -console.workspace = true serde_json.workspace = true smol_str.workspace = true starknet.workspace = true thiserror.workspace = true -tokio = { version = "1.15.0", features = ["full"] } +tokio = { version = "1.15.0", features = [ "full" ] } toml.workspace = true +tracing-log = "0.1.3" +tracing.workspace = true url = "2.2.2" -clap-verbosity-flag = "2.0.1" yansi.workspace = true -tracing.workspace = true -tracing-log = "0.1.3" [dev-dependencies] assert_fs = "1.0.10" -dojo-test-utils = { path = "../dojo-test-utils", features = ["build-examples"]} +dojo-test-utils = { path = "../dojo-test-utils", features = [ "build-examples" ] } snapbox = "0.4.6" -tokio = { version = "1.28.0", features = ["full"] } +tokio = { version = "1.28.0", features = [ "full" ] } [[bin]] name = "sozo" diff --git a/crates/sozo/src/ops/auth.rs b/crates/sozo/src/ops/auth.rs index 979ca4f14a..801f59db48 100644 --- a/crates/sozo/src/ops/auth.rs +++ b/crates/sozo/src/ops/auth.rs @@ -1,7 +1,8 @@ use anyhow::{Context, Result}; use dojo_client::contract::world::WorldContract; -use crate::commands::{auth::AuthCommand, options::Environment}; +use crate::commands::auth::AuthCommand; +use crate::commands::options::Environment; pub async fn execute(command: AuthCommand, env_metadata: Option) -> Result<()> { match command { diff --git a/crates/sozo/src/ops/component.rs b/crates/sozo/src/ops/component.rs index 9383b02e34..756deba61d 100644 --- a/crates/sozo/src/ops/component.rs +++ b/crates/sozo/src/ops/component.rs @@ -2,7 +2,8 @@ use anyhow::Result; use dojo_client::contract::world::WorldContractReader; use starknet::core::types::{BlockId, BlockTag}; -use crate::commands::{component::ComponentCommands, options::Environment}; +use crate::commands::component::ComponentCommands; +use crate::commands::options::Environment; pub async fn execute(command: ComponentCommands, env_metadata: Option) -> Result<()> { match command { diff --git a/crates/sozo/src/ops/execute.rs b/crates/sozo/src/ops/execute.rs index 5c2bb89667..ec26421698 100644 --- a/crates/sozo/src/ops/execute.rs +++ b/crates/sozo/src/ops/execute.rs @@ -1,7 +1,8 @@ use anyhow::{Context, Result}; use dojo_client::contract::world::WorldContract; -use crate::commands::{execute::ExecuteArgs, options::Environment}; +use crate::commands::execute::ExecuteArgs; +use crate::commands::options::Environment; pub async fn execute(args: ExecuteArgs, env_metadata: Option) -> Result<()> { let ExecuteArgs { system, calldata, world, starknet, account } = args; diff --git a/crates/sozo/src/ops/register.rs b/crates/sozo/src/ops/register.rs index d33a3b4c9a..4e69a055ce 100644 --- a/crates/sozo/src/ops/register.rs +++ b/crates/sozo/src/ops/register.rs @@ -1,7 +1,8 @@ use anyhow::{Context, Result}; use dojo_client::contract::world::WorldContract; -use crate::commands::{options::Environment, register::RegisterCommand}; +use crate::commands::options::Environment; +use crate::commands::register::RegisterCommand; pub async fn execute(command: RegisterCommand, env_metadata: Option) -> Result<()> { match command { diff --git a/crates/sozo/src/ops/system.rs b/crates/sozo/src/ops/system.rs index 30a4e81ed8..bf9caf16e9 100644 --- a/crates/sozo/src/ops/system.rs +++ b/crates/sozo/src/ops/system.rs @@ -3,7 +3,8 @@ use dojo_client::contract::world::WorldContractReader; use starknet::core::types::{BlockId, BlockTag}; use yansi::Paint; -use crate::commands::{options::Environment, system::SystemCommands}; +use crate::commands::options::Environment; +use crate::commands::system::SystemCommands; pub async fn execute(command: SystemCommands, env_metadata: Option) -> Result<()> { match command { @@ -33,11 +34,7 @@ pub async fn execute(command: SystemCommands, env_metadata: Option) .iter() .enumerate() .filter_map(|(i, d)| { - if d.read { - Some(format!("{}.{}", i + 1, d.name.clone())) - } else { - None - } + if d.read { Some(format!("{}.{}", i + 1, d.name.clone())) } else { None } }) .collect::>(); @@ -45,11 +42,7 @@ pub async fn execute(command: SystemCommands, env_metadata: Option) .iter() .enumerate() .filter_map(|(i, d)| { - if d.write { - Some(format!("{}. {}", i + 1, d.name.clone())) - } else { - None - } + if d.write { Some(format!("{}. {}", i + 1, d.name.clone())) } else { None } }) .collect::>(); diff --git a/crates/torii/Cargo.toml b/crates/torii/Cargo.toml index 927d9fbaa2..f783895165 100644 --- a/crates/torii/Cargo.toml +++ b/crates/torii/Cargo.toml @@ -1,48 +1,42 @@ [package] +edition = "2021" name = "torii" version = "0.1.0" -edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -camino.workspace = true -dojo-types = { path = "../dojo-types" } -dojo-world = { path = "../dojo-world" } -async-trait.workspace = true anyhow.workspace = true +async-graphql = { version = "5.0.8", features = [ "chrono", "dynamic-schema" ] } +async-graphql-poem = "5.0.8" +async-trait.workspace = true +camino.workspace = true +chrono.workspace = true clap.workspace = true ctrlc = "3.2.5" +dojo-types = { path = "../dojo-types" } +dojo-world = { path = "../dojo-world" } +indexmap = "1.9.3" log = "0.4.17" +poem = "1.3.48" serde.workspace = true serde_json.workspace = true -sqlx = { version = "0.6.2", features = [ - "chrono", - "macros", - "offline", - "runtime-actix-rustls", - "uuid", -] } -starknet.workspace = true +sqlx = { version = "0.6.2", features = [ "chrono", "macros", "offline", "runtime-actix-rustls", "uuid" ] } starknet-crypto.workspace = true -tokio = { version = "1.20.1", features = ["full"] } +starknet.workspace = true +tokio = { version = "1.20.1", features = [ "full" ] } tokio-stream = "0.1.11" tokio-util = "0.7.7" -tracing.workspace = true tracing-subscriber.workspace = true +tracing.workspace = true url = "2.2.2" -chrono.workspace = true -async-graphql = { version = "5.0.8", features = ["chrono", "dynamic-schema"] } -async-graphql-poem = "5.0.8" -poem = "1.3.48" -indexmap = "1.9.3" [dev-dependencies] camino.workspace = true [features] -default = ["sqlite"] -sqlite = ["sqlx/sqlite"] +default = [ "sqlite" ] +sqlite = [ "sqlx/sqlite" ] [[bin]] name = "torii" diff --git a/crates/torii/src/graphql/types.rs b/crates/torii/src/graphql/types.rs index 24901c06ea..7d5edc397e 100644 --- a/crates/torii/src/graphql/types.rs +++ b/crates/torii/src/graphql/types.rs @@ -107,10 +107,6 @@ impl ScalarType { } pub fn as_sql_type(&self) -> &'static str { - if self.is_numeric_type() { - "INTEGER" - } else { - "TEXT" - } + if self.is_numeric_type() { "INTEGER" } else { "TEXT" } } } diff --git a/examples/ecs/Scarb.toml b/examples/ecs/Scarb.toml index e5d0863c35..58fb665bb5 100644 --- a/examples/ecs/Scarb.toml +++ b/examples/ecs/Scarb.toml @@ -1,7 +1,7 @@ [package] +cairo-version = "2.1.0-rc4" name = "dojo_examples" version = "0.1.0" -cairo-version = "2.1.0-rc4" [cairo] sierra-replace-ids = true diff --git a/rustfmt.toml b/rustfmt.toml index d0caa84954..5299973c49 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,33 +1,28 @@ edition = "2021" -newline_style = "unix" +max_width = 100 +newline_style = "Unix" use_field_init_shorthand = true use_small_heuristics = "Max" use_try_shorthand = true -max_width = 100 # Unstable features below -# unstable_features = true -# version = "Two" -# comment_width = 100 -# format_code_in_doc_comments = true -# format_macro_bodies = true -# format_macro_matchers = true -# format_strings = true -# imports_granularity = "Module" -# group_imports = "StdExternalCrate" -# normalize_comments = true -# normalize_doc_attributes = true -# wrap_comments = true +comment_width = 100 +format_code_in_doc_comments = true +format_macro_bodies = true +format_macro_matchers = true +format_strings = true +group_imports = "StdExternalCrate" +imports_granularity = "Module" +normalize_comments = true +normalize_doc_attributes = true +unstable_features = true +version = "Two" +wrap_comments = true -# To use these settings in vscode, add the following line to your settings: -# "rust-analyzer.rustfmt.overrideCommand": [ -# "rustup", -# "run", -# "1.70.0", -# "--", -# "rustfmt", -# "--edition", -# "2021", -# "--" -# ] -# and run "rustup toolchain install 1.70.0". +# To use these settings in vscode, add the following line to your settings.json file: +# +# "rust-analyzer.rustfmt.extraArgs": [ +# "+nightly" +# ], +# +# and run "rustup toolchain install nightly". diff --git a/scripts/rust_fmt.sh b/scripts/rust_fmt.sh index eee907a697..62a418693a 100755 --- a/scripts/rust_fmt.sh +++ b/scripts/rust_fmt.sh @@ -1,3 +1,3 @@ #!/bin/bash -cargo fmt --check --all -- "$@" +cargo +nightly fmt --check --all -- "$@" diff --git a/taplo.toml b/taplo.toml index b5773eed05..5a9b7659e5 100644 --- a/taplo.toml +++ b/taplo.toml @@ -1,14 +1,13 @@ -exclude = ["cairo/**/*.toml"] - [formatting] -alignComments = false -alignEntries = false -arrayAutoCollapse = true -arrayAutoExpand = true -arrayTrailingComma = true -compactArrays = false -indentEntries = false -inlineTableExpand = false -reorderKeys = true +align_comments = false +align_entries = false allowed_blank_lines = 1 +array_auto_collapse = true +array_auto_expand = true +array_trailing_comma = true +column_width = 80 +compact_arrays = false +indent_entries = false +inline_table_expand = false reorder_arrays = true +reorder_keys = true