From fdaa6bbcd5eb94b57a780ad8eaefc117ff1a317d Mon Sep 17 00:00:00 2001 From: jose Date: Sat, 16 Aug 2025 12:42:58 +0200 Subject: [PATCH 01/11] feat: start package isolation --- Cargo.lock | 36 ++++++++--------- Cargo.toml | 8 ++-- packages/injective-cosmwasm/Cargo.toml | 54 ++++++++++++++++---------- packages/injective-math/Cargo.toml | 24 +++++++----- 4 files changed, 69 insertions(+), 53 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 763b93f6..035acc88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -196,8 +196,8 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus", "cw2", - "injective-cosmwasm 0.3.3", - "injective-math 0.3.3", + "injective-cosmwasm 0.3.4-1", + "injective-math 0.3.4-1", "injective-std", "prost 0.13.5", "schemars", @@ -894,7 +894,7 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus", "cw2", - "injective-cosmwasm 0.3.3", + "injective-cosmwasm 0.3.4-1", "injective-std", "schemars", "serde", @@ -1581,8 +1581,9 @@ dependencies = [ [[package]] name = "injective-cosmwasm" version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7734038badc19fad9bead5584004313843a527c8ec902448e17de675d0b2a73a" dependencies = [ - "cosmwasm-schema 1.5.11", "cosmwasm-std", "cw-storage-plus", "ethereum-types", @@ -1590,27 +1591,25 @@ dependencies = [ "injective-math 0.3.3", "schemars", "serde", - "serde-json-wasm", "serde_repr", - "serde_test", "subtle-encoding", "tiny-keccak", ] [[package]] name = "injective-cosmwasm" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7734038badc19fad9bead5584004313843a527c8ec902448e17de675d0b2a73a" +version = "0.3.4-1" dependencies = [ "cosmwasm-std", "cw-storage-plus", "ethereum-types", "hex", - "injective-math 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "injective-math 0.3.3", "schemars", "serde", + "serde-json-wasm", "serde_repr", + "serde_test", "subtle-encoding", "tiny-keccak", ] @@ -1624,8 +1623,8 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus", "cw2", - "injective-cosmwasm 0.3.3", - "injective-math 0.3.3", + "injective-cosmwasm 0.3.4-1", + "injective-math 0.3.4-1", "injective-std", "injective-test-tube", "injective-testing", @@ -1645,8 +1644,8 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus", "cw2", - "injective-cosmwasm 0.3.3", - "injective-math 0.3.3", + "injective-cosmwasm 0.3.4-1", + "injective-math 0.3.4-1", "injective-std", "injective-test-tube", "injective-testing", @@ -1660,8 +1659,9 @@ dependencies = [ [[package]] name = "injective-math" version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6acb63f2c2e4c8831b63b71a710f79da09981f8e6ff2b01975b87b12bc016fb5" dependencies = [ - "cosmwasm-schema 1.5.11", "cosmwasm-std", "primitive-types", "schemars", @@ -1670,9 +1670,7 @@ dependencies = [ [[package]] name = "injective-math" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6acb63f2c2e4c8831b63b71a710f79da09981f8e6ff2b01975b87b12bc016fb5" +version = "0.3.4-1" dependencies = [ "cosmwasm-std", "primitive-types", @@ -1718,7 +1716,7 @@ dependencies = [ "bindgen", "cosmrs", "cosmwasm-std", - "injective-cosmwasm 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "injective-cosmwasm 0.3.3", "injective-std", "prost 0.13.5", "serde", diff --git a/Cargo.toml b/Cargo.toml index 96ca815a..e6730532 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = [ "contracts/*", "packages/*" ] +members = [ "contracts/*"] resolver = "2" [profile.release.package.injective-cosmwasm] @@ -17,13 +17,13 @@ cw-storage-plus = { version = "2.0.0" } cw2 = { version = "2.0.0" } ethereum-types = { version = "0.5.2" } hex = { version = "0.4.3", features = [ "serde" ] } -injective-cosmwasm = { version = "0.3.3", path = "./packages/injective-cosmwasm" } -injective-math = { version = "0.3.3", path = "./packages/injective-math" } +injective-cosmwasm = { version = "0.3.3" } +injective-math = { version = "0.3.3" } injective-std = { version = "1.16.0-beta.2" } injective-test-tube = { version = "1.16.0-beta.3" } injective-testing = { version = "1.1.10", path = "./packages/injective-testing" } primitive-types = { version = "0.12.2", default-features = false } -prost = { version = "0.13.4", features = [ "prost-derive" ] } +prost = { version = "0.13.5", features = [ "prost-derive" ] } rand = { version = "0.4.6" } regex = { version = "1.11.1" } schemars = { version = "0.8.16" } diff --git a/packages/injective-cosmwasm/Cargo.toml b/packages/injective-cosmwasm/Cargo.toml index fd727da0..6188b4aa 100644 --- a/packages/injective-cosmwasm/Cargo.toml +++ b/packages/injective-cosmwasm/Cargo.toml @@ -1,27 +1,39 @@ [package] -authors = [ "Albert Chon ", "F Grabner ", "Markus Waas " ] +authors = [ "Albert Chon albert@injectivelabs.org", "F Grabner friedrich@injectivelabs.org", "Markus Waas markus@injectivelabs.org", "Jose Luis joseluis@injectivelabs.org" ] description = "Bindings for CosmWasm contracts to call into custom modules of Injective Core" -edition = "2021" -license = "Apache-2.0" -name = "injective-cosmwasm" -readme = "README.md" -repository = "https://github.com/InjectiveLabs/cw-injective/tree/dev/packages/injective-cosmwasm" -version = "0.3.3" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +edition = "2021" +license = "Apache-2.0" +name = "injective-cosmwasm" +readme = "README.md" +repository = "https://github.com/InjectiveLabs/cw-injective/tree/dev/packages/injective-cosmwasm" +version = "0.3.4-1" [dependencies] -cosmwasm-std = { workspace = true } -cw-storage-plus = { workspace = true } -ethereum-types = { workspace = true } -hex = { workspace = true } -injective-math = { workspace = true } -schemars = { workspace = true } -serde = { workspace = true } -serde_repr = { workspace = true } -subtle-encoding = { workspace = true } -tiny-keccak = { workspace = true } +cosmwasm-std = { version = "2.2.2", features = [ "abort", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] } +cw-storage-plus = { version = "2.0.0" } +ethereum-types = { version = "0.5.2" } +hex = { version = "0.4.3", features = [ "serde" ] } +injective-math = { version = "0.3.3" } +schemars = { version = "0.8.16" } +serde = { version = "1.0.196", default-features = false, features = [ "derive" ] } +serde_repr = { version = "0.1.17" } +subtle-encoding = { version = "0.5.1", features = [ "bech32-preview" ] } +tiny-keccak = { version = "1.2.1" } + [dev-dependencies] -cosmwasm-schema = { workspace = true } -serde-json-wasm = { workspace = true } -serde_test = { workspace = true } +serde-json-wasm = { version = "1.0.0" } +serde_test = { version = "1.0.176" } + +[profile.release] +codegen-units = 1 +debug = false +debug-assertions = false +incremental = false +lto = true +opt-level = 3 +overflow-checks = true +panic = 'abort' +rpath = false + + diff --git a/packages/injective-math/Cargo.toml b/packages/injective-math/Cargo.toml index 3d1b81f7..d8c8e68d 100644 --- a/packages/injective-math/Cargo.toml +++ b/packages/injective-math/Cargo.toml @@ -6,17 +6,23 @@ license = "Apache-2.0" name = "injective-math" readme = "README.md" repository = "https://github.com/InjectiveLabs/cw-injective/tree/dev/packages/injective-math" -version = "0.3.3" +version = "0.3.4-1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[features] - [dependencies] -cosmwasm-std = { workspace = true } -primitive-types = { workspace = true } -schemars = { workspace = true } -serde = { workspace = true } +cosmwasm-std = { version = "2.2.2", features = [ "abort", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] } +primitive-types = { version = "0.12.2", default-features = false } +schemars = { version = "0.8.16" } +serde = { version = "1.0.196", default-features = false, features = [ "derive" ] } -[dev-dependencies] -cosmwasm-schema = { workspace = true } +[profile.release] +codegen-units = 1 +debug = false +debug-assertions = false +incremental = false +lto = true +opt-level = 3 +overflow-checks = true +panic = 'abort' +rpath = false From d19667b15d18f8c629b329e36478d27e368036dd Mon Sep 17 00:00:00 2001 From: jose Date: Sat, 16 Aug 2025 13:07:45 +0200 Subject: [PATCH 02/11] feat: injective cosmos wasm. --- packages/injective-cosmwasm/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/injective-cosmwasm/Cargo.toml b/packages/injective-cosmwasm/Cargo.toml index 6188b4aa..c8c3e433 100644 --- a/packages/injective-cosmwasm/Cargo.toml +++ b/packages/injective-cosmwasm/Cargo.toml @@ -13,12 +13,13 @@ cosmwasm-std = { version = "2.2.2", features = [ "abort", "cosmwasm_1_2", "co cw-storage-plus = { version = "2.0.0" } ethereum-types = { version = "0.5.2" } hex = { version = "0.4.3", features = [ "serde" ] } -injective-math = { version = "0.3.3" } +injective-math = { version = "0.3.4-1" } schemars = { version = "0.8.16" } serde = { version = "1.0.196", default-features = false, features = [ "derive" ] } serde_repr = { version = "0.1.17" } subtle-encoding = { version = "0.5.1", features = [ "bech32-preview" ] } tiny-keccak = { version = "1.2.1" } +ed25519-zebra = { version = "4.1.0", features = ["alloc"] } [dev-dependencies] From 00a85756acee3d7668590375e608f833b99df2e7 Mon Sep 17 00:00:00 2001 From: jose Date: Sat, 16 Aug 2025 15:39:05 +0200 Subject: [PATCH 03/11] feat: bump injective testing. --- packages/injective-testing/Cargo.toml | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/injective-testing/Cargo.toml b/packages/injective-testing/Cargo.toml index aa3554e4..f41c3d62 100644 --- a/packages/injective-testing/Cargo.toml +++ b/packages/injective-testing/Cargo.toml @@ -5,19 +5,19 @@ edition = "2021" license = "Apache-2.0" name = "injective-testing" repository = "https://github.com/InjectiveLabs/cw-injective/tree/dev/packages/injective-testing" -version = "1.1.11" +version = "1.1.12-1" [dependencies] -anyhow = { workspace = true } -cosmwasm-std = { workspace = true } -cw-multi-test = { workspace = true } -injective-cosmwasm = { workspace = true } -injective-math = { workspace = true } -injective-std = { workspace = true } -injective-test-tube = { workspace = true } -prost = { workspace = true, features = [ "prost-derive" ] } -rand = { workspace = true } -regex = { workspace = true } -secp256k1 = { workspace = true } -serde = { workspace = true } -tiny-keccak = { workspace = true } +anyhow = { version = "1.0.66" } +cosmwasm-std = { version = "2.2.2", features = [ "abort", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] } +cw-multi-test = { version = "2.2.1" } +injective-test-tube = { version = "1.16.3-1"} +injective-cosmwasm = { version = "0.3.4-1" } +injective-math = { version = "0.3.4-1" } +injective-std = { version = "1.16.3-1" } +prost = { version = "0.13.5", features = [ "prost-derive" ] } +rand = { version = "0.4.6" } +regex = { version = "1.11.1" } +secp256k1 = { version = "0.30.0", features = [ "rand" ] } +serde = { version = "1.0.196", default-features = false, features = [ "derive" ] } +tiny-keccak = { version = "1.2.1" } From 092bcfa3313e27828375d8c74e1f7c99ad5aae0c Mon Sep 17 00:00:00 2001 From: jose Date: Sat, 16 Aug 2025 15:49:00 +0200 Subject: [PATCH 04/11] feat: aling versions --- Cargo.lock | 253 ++++++++++++++++++++++++++++------------------------- Cargo.toml | 15 ++-- 2 files changed, 139 insertions(+), 129 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 035acc88..5b947e03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -200,7 +200,7 @@ dependencies = [ "injective-math 0.3.4-1", "injective-std", "prost 0.13.5", - "schemars", + "schemars 0.8.22", "serde", "thiserror 1.0.69", ] @@ -501,22 +501,22 @@ dependencies = [ [[package]] name = "cosmos-sdk-proto" -version = "0.25.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8ce7f4797cdf5cd18be6555ff3f0a8d37023c2d60f3b2708895d601b85c1c46" +checksum = "95ac39be7373404accccaede7cc1ec942ccef14f0ca18d209967a756bf1dbb1f" dependencies = [ "prost 0.13.5", - "tendermint-proto 0.39.1", + "tendermint-proto 0.40.4", ] [[package]] name = "cosmrs" -version = "0.20.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f90935b72d9fa65a2a784e09f25778637b7e88e9d6f87c717081470f7fa726" +checksum = "34e74fa7a22930fe0579bef560f2d64b78415d4c47b9dd976c0635136809471d" dependencies = [ "bip32", - "cosmos-sdk-proto 0.25.0", + "cosmos-sdk-proto 0.27.0", "ecdsa", "eyre", "k256", @@ -578,7 +578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5526ea839acb47bbf8fff031ed9aad86e74d43f77b089255417328c3664367d5" dependencies = [ "cosmwasm-schema-derive 1.5.11", - "schemars", + "schemars 0.8.22", "serde", "serde_json", "thiserror 1.0.69", @@ -591,7 +591,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6984ab21b47a096e17ae4c73cea2123a704d4b6686c39421247ad67020d76f95" dependencies = [ "cosmwasm-schema-derive 2.2.2", - "schemars", + "schemars 0.8.22", "serde", "serde_json", "thiserror 1.0.69", @@ -635,7 +635,7 @@ dependencies = [ "hex", "rand_core 0.6.4", "rmp-serde", - "schemars", + "schemars 0.8.22", "serde", "serde-json-wasm", "sha2 0.10.9", @@ -759,7 +759,7 @@ dependencies = [ "cw-utils", "itertools 0.14.0", "prost 0.13.5", - "schemars", + "schemars 0.8.22", "serde", "sha2 0.10.9", "thiserror 2.0.12", @@ -772,7 +772,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f13360e9007f51998d42b1bc6b7fa0141f74feae61ed5fd1e5b0a89eec7b5de1" dependencies = [ "cosmwasm-std", - "schemars", + "schemars 0.8.22", "serde", ] @@ -784,7 +784,7 @@ checksum = "07dfee7f12f802431a856984a32bce1cb7da1e6c006b5409e3981035ce562dec" dependencies = [ "cosmwasm-schema 2.2.2", "cosmwasm-std", - "schemars", + "schemars 0.8.22", "serde", "thiserror 1.0.69", ] @@ -798,7 +798,7 @@ dependencies = [ "cosmwasm-schema 2.2.2", "cosmwasm-std", "cw-storage-plus", - "schemars", + "schemars 0.8.22", "semver", "serde", "thiserror 1.0.69", @@ -811,6 +811,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" dependencies = [ "const-oid", + "pem-rfc7468", "zeroize", ] @@ -896,7 +897,7 @@ dependencies = [ "cw2", "injective-cosmwasm 0.3.4-1", "injective-std", - "schemars", + "schemars 0.8.22", "serde", "thiserror 1.0.69", ] @@ -928,6 +929,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ "pkcs8", + "serde", "signature", ] @@ -946,16 +948,18 @@ dependencies = [ [[package]] name = "ed25519-zebra" -version = "4.0.3" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d9ce6874da5d4415896cd45ffbc4d1cfc0c4f9c079427bd870742c30f2f65a9" +checksum = "0017d969298eec91e3db7a2985a8cab4df6341d86e6f3a6f5878b13fb7846bc9" dependencies = [ "curve25519-dalek", "ed25519", - "hashbrown 0.14.5", - "hex", + "hashbrown 0.15.3", + "pkcs8", "rand_core 0.6.4", + "serde", "sha2 0.10.9", + "subtle", "zeroize", ] @@ -1122,6 +1126,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1281,20 +1291,15 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.5" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" dependencies = [ - "ahash", "allocator-api2", + "equivalent", + "foldhash", ] -[[package]] -name = "hashbrown" -version = "0.15.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" - [[package]] name = "heapsize" version = "0.4.2" @@ -1580,18 +1585,19 @@ dependencies = [ [[package]] name = "injective-cosmwasm" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7734038badc19fad9bead5584004313843a527c8ec902448e17de675d0b2a73a" +version = "0.3.4-1" dependencies = [ "cosmwasm-std", "cw-storage-plus", + "ed25519-zebra", "ethereum-types", "hex", - "injective-math 0.3.3", - "schemars", + "injective-math 0.3.4-1 (registry+https://github.com/rust-lang/crates.io-index)", + "schemars 0.8.22", "serde", + "serde-json-wasm", "serde_repr", + "serde_test", "subtle-encoding", "tiny-keccak", ] @@ -1599,17 +1605,18 @@ dependencies = [ [[package]] name = "injective-cosmwasm" version = "0.3.4-1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fefbce09af1416ae5f61066b2c202bb91dec43705b243958130698cc30a2bda" dependencies = [ "cosmwasm-std", "cw-storage-plus", + "ed25519-zebra", "ethereum-types", "hex", - "injective-math 0.3.3", - "schemars", + "injective-math 0.3.4-1 (registry+https://github.com/rust-lang/crates.io-index)", + "schemars 0.8.22", "serde", - "serde-json-wasm", "serde_repr", - "serde_test", "subtle-encoding", "tiny-keccak", ] @@ -1629,7 +1636,7 @@ dependencies = [ "injective-test-tube", "injective-testing", "prost 0.13.5", - "schemars", + "schemars 0.8.22", "serde", "thiserror 1.0.69", ] @@ -1650,7 +1657,7 @@ dependencies = [ "injective-test-tube", "injective-testing", "prost 0.13.5", - "schemars", + "schemars 0.8.22", "serde", "serde_json", "thiserror 1.0.69", @@ -1658,50 +1665,50 @@ dependencies = [ [[package]] name = "injective-math" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6acb63f2c2e4c8831b63b71a710f79da09981f8e6ff2b01975b87b12bc016fb5" +version = "0.3.4-1" dependencies = [ "cosmwasm-std", "primitive-types", - "schemars", + "schemars 0.8.22", "serde", ] [[package]] name = "injective-math" version = "0.3.4-1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0986b4862ff230179c400dffdbeba716cc5e3e7f257c7dee5a3c162f094aec3" dependencies = [ "cosmwasm-std", "primitive-types", - "schemars", + "schemars 0.8.22", "serde", ] [[package]] name = "injective-std" -version = "1.16.0-beta.2" +version = "1.16.3-1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f8fe66be84f5660728856c6cfce222351bab86f3be29fb7043d1dd52cb0094" +checksum = "801859bfbf443a2787850cc720b0f83f33b2f73dd90bff12f5ff2fd74d407825" dependencies = [ "chrono", "cosmwasm-std", "injective-std-derive", "prost 0.13.5", "prost-types 0.13.5", - "schemars", + "schemars 1.0.4", "serde", "serde-cw-value", ] [[package]] name = "injective-std-derive" -version = "1.13.4" +version = "1.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cfe3fc8519277af8e09e51b8987435e401d345d4466402e6a5b991143fdfa53" +checksum = "26378d1e6c59c2ad94f5fee7207abd365a1c8721188cedcfa21f1c1ac74addf1" dependencies = [ "cosmwasm-std", - "itertools 0.10.5", + "itertools 0.14.0", "proc-macro2", "quote", "syn 1.0.109", @@ -1709,14 +1716,15 @@ dependencies = [ [[package]] name = "injective-test-tube" -version = "1.16.0-beta.3" +version = "1.16.3-1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643bd3780018d0c26d0f1a6efb623e94578e3ede1e59984e131be34d761571b9" +checksum = "3775604cc110650f6c5065903df9354d18c1ac2a82931e7d288056c9ad1a459a" dependencies = [ "bindgen", "cosmrs", "cosmwasm-std", - "injective-cosmwasm 0.3.3", + "ed25519-zebra", + "injective-cosmwasm 0.3.4-1 (registry+https://github.com/rust-lang/crates.io-index)", "injective-std", "prost 0.13.5", "serde", @@ -1726,13 +1734,13 @@ dependencies = [ [[package]] name = "injective-testing" -version = "1.1.11" +version = "1.1.12-1" dependencies = [ "anyhow", "cosmwasm-std", "cw-multi-test", - "injective-cosmwasm 0.3.3", - "injective-math 0.3.3", + "injective-cosmwasm 0.3.4-1 (registry+https://github.com/rust-lang/crates.io-index)", + "injective-math 0.3.4-1 (registry+https://github.com/rust-lang/crates.io-index)", "injective-std", "injective-test-tube", "prost 0.13.5", @@ -2027,6 +2035,15 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "132dca9b868d927b35b5dd728167b2dee150eb1ad686008fc71ccb298b776fca" +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -2127,16 +2144,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "prost" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" -dependencies = [ - "bytes", - "prost-derive 0.11.9", -] - [[package]] name = "prost" version = "0.12.6" @@ -2157,19 +2164,6 @@ dependencies = [ "prost-derive 0.13.5", ] -[[package]] -name = "prost-derive" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" -dependencies = [ - "anyhow", - "itertools 0.10.5", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "prost-derive" version = "0.12.6" @@ -2196,15 +2190,6 @@ dependencies = [ "syn 2.0.101", ] -[[package]] -name = "prost-types" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" -dependencies = [ - "prost 0.11.9", -] - [[package]] name = "prost-types" version = "0.12.6" @@ -2332,6 +2317,26 @@ dependencies = [ "rand_core 0.3.1", ] +[[package]] +name = "ref-cast" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + [[package]] name = "regex" version = "1.11.1" @@ -2586,7 +2591,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" dependencies = [ "dyn-clone", - "schemars_derive", + "schemars_derive 0.8.22", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0" +dependencies = [ + "dyn-clone", + "ref-cast", + "schemars_derive 1.0.4", "serde", "serde_json", ] @@ -2603,6 +2621,18 @@ dependencies = [ "syn 2.0.101", ] +[[package]] +name = "schemars_derive" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33d020396d1d138dc19f1165df7545479dcd58d93810dc5d646a16e55abefa80" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.101", +] + [[package]] name = "sct" version = "0.7.1" @@ -2987,9 +3017,9 @@ dependencies = [ [[package]] name = "tendermint" -version = "0.39.1" +version = "0.40.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f3afea7809ffaaf1e5d9c3c9997cb3a834df7e94fbfab2fad2bc4577f1cde41" +checksum = "fc997743ecfd4864bbca8170d68d9b2bee24653b034210752c2d883ef4b838b1" dependencies = [ "bytes", "digest 0.10.7", @@ -3010,16 +3040,16 @@ dependencies = [ "signature", "subtle", "subtle-encoding", - "tendermint-proto 0.39.1", + "tendermint-proto 0.40.4", "time", "zeroize", ] [[package]] name = "tendermint-config" -version = "0.39.1" +version = "0.40.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8add7b85b0282e5901521f78fe441956ac1e2752452f4e1f2c0ce7e1f10d485" +checksum = "069d1791f9b02a596abcd26eb72003b2e9906c6169a60fa82ffc080dd3a43fda" dependencies = [ "flex-error", "serde", @@ -3029,24 +3059,6 @@ dependencies = [ "url", ] -[[package]] -name = "tendermint-proto" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0cec054567d16d85e8c3f6a3139963d1a66d9d3051ed545d31562550e9bcc3d" -dependencies = [ - "bytes", - "flex-error", - "num-derive", - "num-traits", - "prost 0.11.9", - "prost-types 0.11.9", - "serde", - "serde_bytes", - "subtle-encoding", - "time", -] - [[package]] name = "tendermint-proto" version = "0.34.1" @@ -3067,9 +3079,9 @@ dependencies = [ [[package]] name = "tendermint-proto" -version = "0.39.1" +version = "0.40.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf3abf34ecf33125621519e9952688e7a59a98232d51538037ba21fbe526a802" +checksum = "d2c40e13d39ca19082d8a7ed22de7595979350319833698f8b1080f29620a094" dependencies = [ "bytes", "flex-error", @@ -3082,9 +3094,9 @@ dependencies = [ [[package]] name = "tendermint-rpc" -version = "0.39.1" +version = "0.40.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9693f42544bf3b41be3cbbfa418650c86e137fb8f5a57981659a84b677721ecf" +checksum = "35e0569a4b4cc42ff00df5a665be2858a39ff79df4790b176f1cd0e169bc0fc2" dependencies = [ "async-trait", "bytes", @@ -3103,7 +3115,7 @@ dependencies = [ "subtle-encoding", "tendermint", "tendermint-config", - "tendermint-proto 0.39.1", + "tendermint-proto 0.40.4", "thiserror 1.0.69", "time", "tokio", @@ -3124,17 +3136,16 @@ dependencies = [ [[package]] name = "test-tube-inj" -version = "2.0.6" +version = "2.0.8-1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8f626718589436030c6e4c6fa22d242cc5d7127720886f7954337d1b3d65f2f" +checksum = "8f0daa3d865f9071fc1b5f8b31075aec31eec3b1841c0175b04d2d0e40b85046" dependencies = [ "base64 0.21.7", "cosmrs", "cosmwasm-std", + "ed25519-zebra", "prost 0.13.5", - "serde", "serde_json", - "tendermint-proto 0.32.2", "thiserror 1.0.69", ] diff --git a/Cargo.toml b/Cargo.toml index e6730532..3476709d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,17 +11,17 @@ anyhow = { version = "1.0.66" } base64 = { version = "0.21.5" } cosmos-sdk-proto = { version = "0.20.0", default-features = false } cosmwasm-schema = { version = "1.5.0" } -cosmwasm-std = { version = "2.1.0", features = [ "abort", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] } -cw-multi-test = { version = "2.1.0" } +cosmwasm-std = { version = "2.2.0", features = [ "abort", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] } +cw-multi-test = { version = "2.2.0" } cw-storage-plus = { version = "2.0.0" } cw2 = { version = "2.0.0" } ethereum-types = { version = "0.5.2" } hex = { version = "0.4.3", features = [ "serde" ] } -injective-cosmwasm = { version = "0.3.3" } -injective-math = { version = "0.3.3" } -injective-std = { version = "1.16.0-beta.2" } -injective-test-tube = { version = "1.16.0-beta.3" } -injective-testing = { version = "1.1.10", path = "./packages/injective-testing" } +injective-cosmwasm = { version = "0.3.4-1" } +injective-math = { version = "0.3.4-1" } +injective-std = { version = "1.16.3-1" } +injective-test-tube = { version = "1.16.3-1" } +injective-testing = { version = "1.1.12-1", path = "./packages/injective-testing" } primitive-types = { version = "0.12.2", default-features = false } prost = { version = "0.13.5", features = [ "prost-derive" ] } rand = { version = "0.4.6" } @@ -34,7 +34,6 @@ serde_json = { version = "1.0.111" } serde_repr = { version = "0.1.17" } serde_test = { version = "1.0.176" } subtle-encoding = { version = "0.5.1", features = [ "bech32-preview" ] } -test-tube-inj = { version = "2.0.6" } thiserror = { version = "1.0.56" } tiny-keccak = { version = "1.2.1" } From 5df2142ef9854f3b355c7a68a8565aa7934b4350 Mon Sep 17 00:00:00 2001 From: jose Date: Tue, 16 Sep 2025 23:14:04 +0200 Subject: [PATCH 05/11] feat: injective math 0.3.5-1 --- packages/injective-math/Cargo.toml | 4 ++-- packages/injective-math/README.md | 2 +- packages/injective-math/src/fp_decimal/from_str.rs | 10 +++++----- packages/injective-math/src/fp_decimal/mod.rs | 2 +- packages/injective-math/src/utils.rs | 12 ++++++------ 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/injective-math/Cargo.toml b/packages/injective-math/Cargo.toml index d8c8e68d..481b8eb1 100644 --- a/packages/injective-math/Cargo.toml +++ b/packages/injective-math/Cargo.toml @@ -6,12 +6,12 @@ license = "Apache-2.0" name = "injective-math" readme = "README.md" repository = "https://github.com/InjectiveLabs/cw-injective/tree/dev/packages/injective-math" -version = "0.3.4-1" +version = "0.3.5-1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -cosmwasm-std = { version = "2.2.2", features = [ "abort", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] } +cosmwasm-std = { version = "3.0.2", features = ["cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] } primitive-types = { version = "0.12.2", default-features = false } schemars = { version = "0.8.16" } serde = { version = "1.0.196", default-features = false, features = [ "derive" ] } diff --git a/packages/injective-math/README.md b/packages/injective-math/README.md index c50703c3..8de558d9 100644 --- a/packages/injective-math/README.md +++ b/packages/injective-math/README.md @@ -62,7 +62,7 @@ The analysis above was generated based on the provided directory structure and c └── / ├── .cargo/ │ └── config - ├── Cargo.toml + ├── pCargo.toml └── src/ ├── fp_decimal/ │ ├── arithmetic.rs diff --git a/packages/injective-math/src/fp_decimal/from_str.rs b/packages/injective-math/src/fp_decimal/from_str.rs index 16760335..404ce6b4 100644 --- a/packages/injective-math/src/fp_decimal/from_str.rs +++ b/packages/injective-math/src/fp_decimal/from_str.rs @@ -16,7 +16,7 @@ impl FromStr for FPDecimal { let parts = input.trim_start_matches('-').split('.').collect::>(); match parts.len() { 1 => { - let integer = U256::from_dec_str(parts[0]).map_err(|_| StdError::generic_err("Error parsing integer"))?; + let integer = U256::from_dec_str(parts[0]).map_err(|_| StdError::msg("Error parsing integer"))?; if integer == U256([0, 0, 0, 0]) { sign = 1; } @@ -26,18 +26,18 @@ impl FromStr for FPDecimal { }) } 2 => { - let integer = U256::from_dec_str(parts[0]).map_err(|_| StdError::generic_err("Error parsing integer"))?; - let fraction = U256::from_dec_str(parts[1]).map_err(|_| StdError::generic_err("Error parsing fraction"))?; + let integer = U256::from_dec_str(parts[0]).map_err(|_| StdError::msg("Error parsing integer"))?; + let fraction = U256::from_dec_str(parts[1]).map_err(|_| StdError::msg("Error parsing fraction"))?; let exp = FPDecimal::DIGITS .checked_sub(parts[1].len()) - .ok_or_else(|| StdError::generic_err(format!("Cannot parse more than {} fractional digits", FPDecimal::DIGITS)))?; + .ok_or_else(|| StdError::msg(format!("Cannot parse more than {} fractional digits", FPDecimal::DIGITS)))?; Ok(FPDecimal { num: integer * FPDecimal::ONE.num + fraction * U256::exp10(exp), sign, }) } - _ => Err(StdError::generic_err("Unexpected number of dots")), + _ => Err(StdError::msg("Unexpected number of dots")), } } } diff --git a/packages/injective-math/src/fp_decimal/mod.rs b/packages/injective-math/src/fp_decimal/mod.rs index fc973692..ebc6170c 100644 --- a/packages/injective-math/src/fp_decimal/mod.rs +++ b/packages/injective-math/src/fp_decimal/mod.rs @@ -101,7 +101,7 @@ impl TryFrom for Decimal256 { fn try_from(fp_decimal: FPDecimal) -> Result { if fp_decimal.is_negative() { - return Err(StdError::generic_err(format!("Value {} must be >= {}", fp_decimal.num, 0))); + return Err(StdError::msg(format!("Value {} must be >= {}", fp_decimal.num, 0))); } let fp_decimal_num_uint256 = fp_decimal.to_u256(); diff --git a/packages/injective-math/src/utils.rs b/packages/injective-math/src/utils.rs index 53060d3e..63cafaa6 100644 --- a/packages/injective-math/src/utils.rs +++ b/packages/injective-math/src/utils.rs @@ -29,7 +29,7 @@ where ensure_band(&v, min, max, range_ends)?; Ok(v) } - Err(e) => Err(StdError::generic_err(e.to_string())), + Err(e) => Err(StdError::msg(e.to_string())), } } @@ -38,12 +38,12 @@ pub fn ensure_band(v: &T, min: Option<&T>, max: Option<&T>, ra match range_ends { RangeEnds::BothInclusive | RangeEnds::MinInclusive => { if v < minv { - return Err(StdError::generic_err(format!("value {v} must be >= {minv}"))); + return Err(StdError::msg(format!("value {v} must be >= {minv}"))); } } RangeEnds::MaxInclusive | RangeEnds::Exclusive => { if v <= minv { - return Err(StdError::generic_err(format!("value {v} must be > {minv}"))); + return Err(StdError::msg(format!("value {v} must be > {minv}"))); } } } @@ -52,12 +52,12 @@ pub fn ensure_band(v: &T, min: Option<&T>, max: Option<&T>, ra match range_ends { RangeEnds::BothInclusive | RangeEnds::MaxInclusive => { if v > maxv { - return Err(StdError::generic_err(format!("value {v} must be <= {maxv}"))); + return Err(StdError::msg(format!("value {v} must be <= {maxv}"))); } } RangeEnds::MinInclusive | RangeEnds::Exclusive => { if v >= maxv { - return Err(StdError::generic_err(format!("value {v} must be < {maxv}"))); + return Err(StdError::msg(format!("value {v} must be < {maxv}"))); } } } @@ -66,7 +66,7 @@ pub fn ensure_band(v: &T, min: Option<&T>, max: Option<&T>, ra } pub fn band_error_to_human(err: StdError, value_name: &str) -> StdError { - StdError::generic_err(format!("Value '{value_name}' failed validation due to: '{err}'")) + StdError::msg(format!("Value '{value_name}' failed validation due to: '{err}'")) } pub fn div_dec(num: FPDecimal, denom: FPDecimal) -> FPDecimal { From 5bf8e6343657a175d5a1aa64e969e0cec438bd1b Mon Sep 17 00:00:00 2001 From: jose Date: Wed, 17 Sep 2025 00:16:40 +0200 Subject: [PATCH 06/11] feat: injective cosmwasm 0.3.5-1 --- packages/injective-cosmwasm/Cargo.toml | 9 ++-- .../injective-cosmwasm/src/exchange/types.rs | 14 ++--- .../src/exchange_mock_querier.rs | 54 ++++--------------- packages/injective-cosmwasm/src/msg.rs | 2 +- .../injective-cosmwasm/src/test_helpers.rs | 6 +-- 5 files changed, 23 insertions(+), 62 deletions(-) diff --git a/packages/injective-cosmwasm/Cargo.toml b/packages/injective-cosmwasm/Cargo.toml index c8c3e433..60f6d138 100644 --- a/packages/injective-cosmwasm/Cargo.toml +++ b/packages/injective-cosmwasm/Cargo.toml @@ -6,20 +6,19 @@ license = "Apache-2.0" name = "injective-cosmwasm" readme = "README.md" repository = "https://github.com/InjectiveLabs/cw-injective/tree/dev/packages/injective-cosmwasm" -version = "0.3.4-1" +version = "0.3.5-1" [dependencies] -cosmwasm-std = { version = "2.2.2", features = [ "abort", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] } -cw-storage-plus = { version = "2.0.0" } +cosmwasm-std = { version = "3.0.2", features = ["cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] } +cw-storage-plus = { version = "3.0.1" } ethereum-types = { version = "0.5.2" } hex = { version = "0.4.3", features = [ "serde" ] } -injective-math = { version = "0.3.4-1" } +injective-math = { version = "0.3.5-1", path="../injective-math" } schemars = { version = "0.8.16" } serde = { version = "1.0.196", default-features = false, features = [ "derive" ] } serde_repr = { version = "0.1.17" } subtle-encoding = { version = "0.5.1", features = [ "bech32-preview" ] } tiny-keccak = { version = "1.2.1" } -ed25519-zebra = { version = "4.1.0", features = ["alloc"] } [dev-dependencies] diff --git a/packages/injective-cosmwasm/src/exchange/types.rs b/packages/injective-cosmwasm/src/exchange/types.rs index 6c765388..a3ef3ef4 100644 --- a/packages/injective-cosmwasm/src/exchange/types.rs +++ b/packages/injective-cosmwasm/src/exchange/types.rs @@ -106,11 +106,11 @@ impl MarketId { let market_id = market_id_s.into(); if !market_id.starts_with("0x") { - return Err(StdError::generic_err("Invalid prefix: market_id must start with 0x")); + return Err(StdError::msg("Invalid prefix: market_id must start with 0x")); } if market_id.len() != 66 { - return Err(StdError::generic_err("Invalid length: market_id must be exactly 66 characters")); + return Err(StdError::msg("Invalid length: market_id must be exactly 66 characters")); } Ok(Self(market_id.to_lowercase())) @@ -191,11 +191,11 @@ impl SubaccountId { let subaccount_id = subaccount_id_s.into(); if !subaccount_id.starts_with("0x") { - return Err(StdError::generic_err("Invalid prefix: subaccount_id must start with 0x")); + return Err(StdError::msg("Invalid prefix: subaccount_id must start with 0x")); } if subaccount_id.len() != 66 { - return Err(StdError::generic_err("Invalid length: subaccount_id must be exactly 66 characters")); + return Err(StdError::msg("Invalid length: subaccount_id must be exactly 66 characters")); } Ok(Self(subaccount_id.to_lowercase())) @@ -283,7 +283,7 @@ impl ShortSubaccountId { pub fn validate(&self) -> StdResult { let as_decimal = match u32::from_str_radix(self.as_str(), 16) { Ok(dec) => Ok(dec), - Err(_) => Err(StdError::generic_err(format!( + Err(_) => Err(StdError::msg(format!( "Invalid value: ShortSubaccountId was not a hexadecimal number: {}", &self.0 ))), @@ -291,7 +291,7 @@ impl ShortSubaccountId { match as_decimal?.to_string().parse::() { Ok(value) if value <= MAX_SHORT_SUBACCOUNT_NONCE => Ok(self.clone()), - _ => Err(StdError::generic_err(format!( + _ => Err(StdError::msg(format!( "Invalid value: ShortSubaccountId must be a number between 0-999, but {} was received", &self.0 ))), @@ -430,7 +430,7 @@ impl Hash { pub fn from_hex>(s: T) -> StdResult { let mut bytes = [0u8; 32]; - hex::decode_to_slice(s, &mut bytes).map_err(|e| StdError::generic_err(e.to_string()))?; + hex::decode_to_slice(s, &mut bytes).map_err(|e| StdError::msg(e.to_string()))?; Ok(Hash::new(bytes)) } } diff --git a/packages/injective-cosmwasm/src/exchange_mock_querier.rs b/packages/injective-cosmwasm/src/exchange_mock_querier.rs index f7422d5e..9e2498b5 100644 --- a/packages/injective-cosmwasm/src/exchange_mock_querier.rs +++ b/packages/injective-cosmwasm/src/exchange_mock_querier.rs @@ -2,10 +2,7 @@ use std::marker::PhantomData; use std::str::FromStr; use cosmwasm_std::testing::{MockApi, MockStorage}; -use cosmwasm_std::{ - from_json, to_json_binary, Addr, AllBalanceResponse, BalanceResponse, BankQuery, Binary, Coin, ContractResult, OwnedDeps, Querier, QuerierResult, - QueryRequest, SupplyResponse, SystemError, SystemResult, Uint128, WasmQuery, -}; +use cosmwasm_std::{from_json, to_json_binary, Addr, BalanceResponse, BankQuery, Binary, Coin, ContractResult, OwnedDeps, Querier, QuerierResult, QueryRequest, SupplyResponse, SystemError, SystemResult, Uint128, Uint256, WasmQuery}; use injective_math::FPDecimal; @@ -248,7 +245,7 @@ fn default_token_factory_denom_total_supply_handler() -> QuerierResult { fn default_bank_total_supply_handler() -> QuerierResult { let response = SupplyResponse::new(Coin { denom: "inj".to_string(), - amount: Uint128::from(1000u128), + amount: Uint256::from(1000u128), }); SystemResult::Ok(ContractResult::from(to_json_binary(&response))) } @@ -270,11 +267,6 @@ fn default_balance_bank_query_handler(denom: impl Into) -> QuerierResult SystemResult::Ok(ContractResult::from(to_json_binary(&response))) } -fn default_all_balances_bank_query_handler() -> QuerierResult { - let response = AllBalanceResponse::new(vec![Coin::new(1000000000000000u128, "inj")]); - SystemResult::Ok(ContractResult::from(to_json_binary(&response))) -} - fn default_exchange_params_response_handler() -> QuerierResult { let denom = "inj"; @@ -434,9 +426,6 @@ pub trait HandlesBankBalanceQuery { fn handle(&self, address: String, denom: String) -> QuerierResult; } -pub trait HandlesBankAllBalancesQuery { - fn handle(&self, address: String) -> QuerierResult; -} pub trait HandlesByAddressQuery { fn handle(&self, address: String) -> QuerierResult; @@ -504,7 +493,6 @@ pub struct WasmMockQuerier { pub token_factory_denom_total_supply_handler: Option>, pub token_factory_denom_creation_fee_handler: Option>, pub balance_query_handler: Option>, - pub all_balances_query_handler: Option>, pub total_supply_handler: Option>, pub registered_contract_info_query_handler: Option>, pub spot_market_orderbook_response_handler: Option>, @@ -555,11 +543,6 @@ impl WasmMockQuerier { Some(handler) => handler.handle(address.to_string(), denom.to_string()), None => default_balance_bank_query_handler(denom), }, - #[allow(deprecated)] - BankQuery::AllBalances { address } => match &self.all_balances_query_handler { - Some(handler) => handler.handle(address.to_string()), - None => default_all_balances_bank_query_handler(), - }, BankQuery::Supply { denom } => match &self.total_supply_handler { Some(handler) => handler.handle(denom.to_string()), None => default_bank_total_supply_handler(), @@ -767,7 +750,6 @@ impl WasmMockQuerier { token_factory_denom_total_supply_handler: None, token_factory_denom_creation_fee_handler: None, balance_query_handler: None, - all_balances_query_handler: None, registered_contract_info_query_handler: None, denom_decimals_handler: None, spot_market_orderbook_response_handler: None, @@ -801,10 +783,7 @@ impl TestDeposit { } pub mod handlers { - use cosmwasm_std::{ - to_json_binary, Addr, AllBalanceResponse, BalanceResponse, Binary, Checksum, CodeInfoResponse, Coin, ContractInfoResponse, ContractResult, - QuerierResult, StdResult, SupplyResponse, SystemError, SystemResult, Uint128, - }; + use cosmwasm_std::{to_json_binary, Addr, BalanceResponse, Binary, Checksum, CodeInfoResponse, Coin, ContractInfoResponse, ContractResult, QuerierResult, SupplyResponse, SystemError, SystemResult, Uint128, Uint256}; use std::collections::HashMap; use injective_math::FPDecimal; @@ -824,7 +803,7 @@ pub mod handlers { TrimmedSpotLimitOrder, }; use crate::{ - HandlesBankAllBalancesQuery, HandlesBankBalanceQuery, HandlesCodeInfo, HandlesContractInfo, + HandlesBankBalanceQuery, HandlesCodeInfo, HandlesContractInfo, HandlesTraderDerivativeOrdersToCancelUpToAmountQuery, MarketMidPriceAndTOBResponse, OracleType, }; @@ -1202,9 +1181,9 @@ pub mod handlers { })) } - pub fn create_bank_supply_handler(supply: Uint128) -> Option> { + pub fn create_bank_supply_handler(supply: Uint256) -> Option> { struct Temp { - supply: Uint128, + supply: Uint256, } impl HandlesDenomSupplyQuery for Temp { fn handle(&self, denom: String) -> QuerierResult { @@ -1273,20 +1252,6 @@ pub mod handlers { Some(Box::new(Temp { balances })) } - pub fn create_simple_all_balances_bank_query_handler(balances: Vec) -> Option> { - struct Temp { - balances: Vec, - } - impl HandlesBankAllBalancesQuery for Temp { - fn handle(&self, _: String) -> QuerierResult { - let res = AllBalanceResponse::new(self.balances.to_owned()); - - SystemResult::Ok(ContractResult::from(to_json_binary(&res))) - } - } - Some(Box::new(Temp { balances })) - } - pub fn create_atomic_order_fee_multiplier_handler(multiplier: FPDecimal) -> Option> { struct Temp { multiplier: FPDecimal, @@ -1307,7 +1272,7 @@ pub mod handlers { impl HandlesSmartQuery for Temp { fn handle(&self, _contract_addr: &str, _msg: &Binary) -> QuerierResult { match self.result.clone() { - Ok(resp) => SystemResult::Ok(ContractResult::from(StdResult::Ok(resp))), + Ok(resp) => SystemResult::Ok(ContractResult::from(Ok::(resp))), Err(err) => SystemResult::Err(err), } } @@ -1322,7 +1287,7 @@ pub mod handlers { impl HandlesRawQuery for Temp { fn handle(&self, _contract_addr: &str, _key: &Binary) -> QuerierResult { match self.result.clone() { - Ok(resp) => SystemResult::Ok(ContractResult::from(StdResult::Ok(resp))), + Ok(resp) => SystemResult::Ok(ContractResult::from(Ok::(resp))), Err(err) => SystemResult::Err(err), } } @@ -1338,8 +1303,7 @@ pub mod handlers { impl HandlesContractInfo for Temp { fn handle(&self, _contract_addr: &str) -> QuerierResult { - let response = ContractInfoResponse::new(self.code_id, self.creator.to_owned(), None, false, None); - + let response = ContractInfoResponse::new(self.code_id, self.creator.to_owned(), None, false, None, None); SystemResult::Ok(ContractResult::from(to_json_binary(&response))) } } diff --git a/packages/injective-cosmwasm/src/msg.rs b/packages/injective-cosmwasm/src/msg.rs index 9f3f4c8e..0eb593ef 100644 --- a/packages/injective-cosmwasm/src/msg.rs +++ b/packages/injective-cosmwasm/src/msg.rs @@ -234,7 +234,7 @@ pub fn create_external_transfer_msg( } if is_default_subaccount(source_subaccount_id) { - return Err(StdError::generic_err("Cannot send from default subaccount to external subaccount")); + return Err(StdError::msg("Cannot send from default subaccount to external subaccount")); } Ok(vec![InjectiveMsgWrapper { diff --git a/packages/injective-cosmwasm/src/test_helpers.rs b/packages/injective-cosmwasm/src/test_helpers.rs index 130614a9..3cdc8409 100644 --- a/packages/injective-cosmwasm/src/test_helpers.rs +++ b/packages/injective-cosmwasm/src/test_helpers.rs @@ -6,9 +6,7 @@ pub(crate) mod testing_helpers { use std::string::ToString; use cosmwasm_std::testing::{MockApi, MockStorage}; - use cosmwasm_std::{ - Addr, Api, BlockInfo, ContractInfo, CustomQuery, DepsMut, Env, OwnedDeps, Querier, QuerierWrapper, Storage, Timestamp, TransactionInfo, - }; + use cosmwasm_std::{Addr, Api, BlockInfo, ContractInfo, CustomQuery, DepsMut, Env, OwnedDeps, Querier, QuerierWrapper, Storage, Timestamp}; use injective_math::FPDecimal; @@ -53,7 +51,7 @@ pub(crate) mod testing_helpers { time: Timestamp::from_nanos(1_571_797_419_879_305_533), chain_id: "cosmos-testnet-14002".to_string(), }, - transaction: Some(TransactionInfo { index: 3 }), + transaction: None, contract: ContractInfo { address: Addr::unchecked(TEST_CONTRACT_ADDR), }, From 58f324a042274bb42f4e0799663529f4eaae004f Mon Sep 17 00:00:00 2001 From: jose Date: Wed, 17 Sep 2025 10:59:17 +0200 Subject: [PATCH 07/11] fix: injective cosmwasm 0.3.5-1 tests --- packages/injective-cosmwasm/Cargo.toml | 2 +- .../injective-cosmwasm/src/exchange/types.rs | 23 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/injective-cosmwasm/Cargo.toml b/packages/injective-cosmwasm/Cargo.toml index 60f6d138..8b16214c 100644 --- a/packages/injective-cosmwasm/Cargo.toml +++ b/packages/injective-cosmwasm/Cargo.toml @@ -13,7 +13,7 @@ cosmwasm-std = { version = "3.0.2", features = ["cosmwasm_1_2", "cosmwasm_1_3 cw-storage-plus = { version = "3.0.1" } ethereum-types = { version = "0.5.2" } hex = { version = "0.4.3", features = [ "serde" ] } -injective-math = { version = "0.3.5-1", path="../injective-math" } +injective-math = { version = "0.3.5-1"} schemars = { version = "0.8.16" } serde = { version = "1.0.196", default-features = false, features = [ "derive" ] } serde_repr = { version = "0.1.17" } diff --git a/packages/injective-cosmwasm/src/exchange/types.rs b/packages/injective-cosmwasm/src/exchange/types.rs index a3ef3ef4..6ee87ad8 100644 --- a/packages/injective-cosmwasm/src/exchange/types.rs +++ b/packages/injective-cosmwasm/src/exchange/types.rs @@ -443,7 +443,6 @@ impl fmt::Display for Hash { #[cfg(test)] mod tests { - use cosmwasm_std::StdError; use serde_test::{assert_de_tokens, assert_ser_tokens, Token}; use std::panic::catch_unwind; @@ -493,38 +492,38 @@ mod tests { fn subaccount_id_checks() { let wrong_prefix_err = SubaccountId::new("00B5e09b93aCEb70C1711aF078922fA256011D7e56000000000000000000000045").unwrap_err(); assert_eq!( - wrong_prefix_err, - StdError::generic_err("Invalid prefix: subaccount_id must start with 0x") + wrong_prefix_err.to_string(), + "kind: Other, error: Invalid prefix: subaccount_id must start with 0x" ); let wrong_length_err = SubaccountId::new("0xB5e09b93aCEb70C1711aF078922fA256011D7e5600000000000000000000004").unwrap_err(); assert_eq!( - wrong_length_err, - StdError::generic_err("Invalid length: subaccount_id must be exactly 66 characters") + wrong_length_err.to_string(), + "kind: Other, error: Invalid length: subaccount_id must be exactly 66 characters" ); let wrong_length_err = SubaccountId::new("0xB5e09b93aCEb70C1711aF078922fA256011D7e560000000000000000000000451").unwrap_err(); assert_eq!( - wrong_length_err, - StdError::generic_err("Invalid length: subaccount_id must be exactly 66 characters") + wrong_length_err.to_string(), + "kind: Other, error: Invalid length: subaccount_id must be exactly 66 characters" ); } #[test] fn market_id_checks() { let wrong_prefix_err = MarketId::new("0001EDFAB47F124748DC89998EB33144AF734484BA07099014594321729A0CA16B").unwrap_err(); - assert_eq!(wrong_prefix_err, StdError::generic_err("Invalid prefix: market_id must start with 0x")); + assert_eq!(wrong_prefix_err.to_string(), "kind: Other, error: Invalid prefix: market_id must start with 0x"); let wrong_length_err = MarketId::new("0x01EDFAB47F124748DC89998EB33144AF734484BA07099014594321729A0CA16").unwrap_err(); assert_eq!( - wrong_length_err, - StdError::generic_err("Invalid length: market_id must be exactly 66 characters") + wrong_length_err.to_string(), + "kind: Other, error: Invalid length: market_id must be exactly 66 characters" ); let wrong_length_err = MarketId::new("0x01EDFAB47F124748DC89998EB33144AF734484BA07099014594321729A0CA16B2").unwrap_err(); assert_eq!( - wrong_length_err, - StdError::generic_err("Invalid length: market_id must be exactly 66 characters") + wrong_length_err.to_string(), + "kind: Other, error: Invalid length: market_id must be exactly 66 characters" ); } From 717366e8fa1a9a2312b68a02173803affed184de Mon Sep 17 00:00:00 2001 From: jose Date: Wed, 17 Sep 2025 14:48:18 +0200 Subject: [PATCH 08/11] feat: injective-testing 1.1.13-1 --- .../src/multi_test/address_generator.rs | 6 +++--- .../src/multi_test/chain_mock.rs | 19 ++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/packages/injective-testing/src/multi_test/address_generator.rs b/packages/injective-testing/src/multi_test/address_generator.rs index 4a86a58b..67354e9f 100644 --- a/packages/injective-testing/src/multi_test/address_generator.rs +++ b/packages/injective-testing/src/multi_test/address_generator.rs @@ -13,7 +13,7 @@ const ADDRESS_BYTE_INDEX: usize = KECCAK_OUTPUT_BYTES - ADDRESS_BYTES; pub struct InjectiveAddressGenerator(); impl AddressGenerator for InjectiveAddressGenerator { - fn contract_address(&self, _api: &dyn cosmwasm_std::Api, _storage: &mut dyn Storage, _code_id: u64, _instance_id: u64) -> anyhow::Result { + fn contract_address(&self, _api: &dyn cosmwasm_std::Api, _storage: &mut dyn Storage, _code_id: u64, _instance_id: u64) -> Result { Ok(generate_inj_address()) } @@ -26,7 +26,7 @@ impl AddressGenerator for InjectiveAddressGenerator { checksum: &[u8], creator: &cosmwasm_std::CanonicalAddr, salt: &[u8], - ) -> anyhow::Result { + ) -> Result { let canonical_addr = cosmwasm_std::instantiate2_address(checksum, creator, salt)?; Ok(api.addr_humanize(&canonical_addr)?) } @@ -45,7 +45,7 @@ impl Default for StorageAwareInjectiveAddressGenerator { } impl AddressGenerator for StorageAwareInjectiveAddressGenerator { - fn contract_address(&self, _api: &dyn cosmwasm_std::Api, storage: &mut dyn Storage, _code_id: u64, _instance_id: u64) -> anyhow::Result { + fn contract_address(&self, _api: &dyn cosmwasm_std::Api, storage: &mut dyn Storage, _code_id: u64, _instance_id: u64) -> Result{ let generated_address = generate_inj_address(); let key = self.key.as_bytes(); let stored = storage.get(key); diff --git a/packages/injective-testing/src/multi_test/chain_mock.rs b/packages/injective-testing/src/multi_test/chain_mock.rs index 5acd5d0b..c7f21466 100644 --- a/packages/injective-testing/src/multi_test/chain_mock.rs +++ b/packages/injective-testing/src/multi_test/chain_mock.rs @@ -1,8 +1,5 @@ use crate::multi_test::address_generator::InjectiveAddressGenerator; - -use anyhow::{bail, Result as AnyResult}; -use cosmwasm_std::{testing::MockApi, Addr, Api, Binary, BlockInfo, Coin, CustomQuery, Empty, MemoryStorage, Querier, Storage}; -use cosmwasm_std::{to_json_binary, StdError}; +use cosmwasm_std::{testing::{MockApi, MockStorage}, Addr, Api, Binary, BlockInfo, Coin, CustomQuery, Empty, Querier, Storage, to_json_binary, StdError}; use cw_multi_test::{ no_init, AddressGenerator, App, AppResponse, BankKeeper, BasicAppBuilder, CosmosRouter, Module, StargateAccepting, StargateFailing, WasmKeeper, }; @@ -19,7 +16,7 @@ pub enum StargateT { Failing(StargateFailing), } -pub type MockedInjectiveApp = App>; +pub type MockedInjectiveApp = App>; #[derive(Clone)] pub struct InitialBalance { @@ -194,7 +191,7 @@ impl Module for CustomInjectiveHandler { _block: &BlockInfo, _sender: Addr, msg: Self::ExecT, - ) -> AnyResult { + ) -> Result { let mut exec_calls_count = self.state.execs.borrow().len(); if !self.assertions.executes.is_empty() @@ -230,11 +227,11 @@ impl Module for CustomInjectiveHandler { }), &None => Ok(AppResponse::default()), }, - Err(e) => Err(anyhow::Error::new(StdError::generic_err(e.to_string()))), + Err(e) => Err(StdError::msg(e.to_string())), } } - fn query(&self, _api: &dyn Api, _storage: &dyn Storage, _querier: &dyn Querier, _block: &BlockInfo, request: Self::QueryT) -> AnyResult { + fn query(&self, _api: &dyn Api, _storage: &dyn Storage, _querier: &dyn Querier, _block: &BlockInfo, request: Self::QueryT) -> Result { let mut query_calls_count = self.state.queries.borrow().len(); if !self.assertions.queries.is_empty() @@ -263,7 +260,7 @@ impl Module for CustomInjectiveHandler { // and that's the reason why I'm manually copying the underlying [u8] in order to return owned data match &stored_result { Ok(optional_data) => Ok(copy_binary(optional_data)), - Err(e) => Err(anyhow::Error::new(StdError::generic_err(e.to_string()))), + Err(e) => Err(StdError::msg(e.to_string())), } } } @@ -275,8 +272,8 @@ impl Module for CustomInjectiveHandler { _router: &dyn CosmosRouter, _block: &BlockInfo, msg: Self::SudoT, - ) -> AnyResult { - bail!("Unexpected sudo msg {:?}", msg) + ) -> Result { + Err(StdError::msg(format!("Unexpected sudo msg {:?}", msg))) } } From 96dccc08b31dc7a582548e295c496b40f12964cd Mon Sep 17 00:00:00 2001 From: jose Date: Fri, 19 Sep 2025 09:56:45 +0200 Subject: [PATCH 09/11] feat: injective testing v1.1.13-1 --- packages/injective-testing/Cargo.toml | 16 ++++++++-------- .../src/multi_test/address_generator.rs | 16 ++++++++++++++-- .../src/multi_test/chain_mock.rs | 14 ++++++++++++-- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/packages/injective-testing/Cargo.toml b/packages/injective-testing/Cargo.toml index f41c3d62..66735212 100644 --- a/packages/injective-testing/Cargo.toml +++ b/packages/injective-testing/Cargo.toml @@ -1,20 +1,20 @@ [package] -authors = [ "Markus Waas " ] +authors = ["Markus Waas ", "Jose Luis Bernal Castillo " ] description = "Testing utils for Injective Cosmwasm and core modules" edition = "2021" license = "Apache-2.0" name = "injective-testing" repository = "https://github.com/InjectiveLabs/cw-injective/tree/dev/packages/injective-testing" -version = "1.1.12-1" +version = "1.1.13-1" [dependencies] anyhow = { version = "1.0.66" } -cosmwasm-std = { version = "2.2.2", features = [ "abort", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] } -cw-multi-test = { version = "2.2.1" } -injective-test-tube = { version = "1.16.3-1"} -injective-cosmwasm = { version = "0.3.4-1" } -injective-math = { version = "0.3.4-1" } -injective-std = { version = "1.16.3-1" } +cosmwasm-std = { version = "3.0.2", features = ["cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] } +cw-multi-test = { version = "3.0.1" } +injective-test-tube = { version = "1.16.4-1"} +injective-cosmwasm = { version = "0.3.5-1"} +injective-math = { version = "0.3.5-1"} +injective-std = { version = "1.16.4-1"} prost = { version = "0.13.5", features = [ "prost-derive" ] } rand = { version = "0.4.6" } regex = { version = "1.11.1" } diff --git a/packages/injective-testing/src/multi_test/address_generator.rs b/packages/injective-testing/src/multi_test/address_generator.rs index 67354e9f..eb715b5a 100644 --- a/packages/injective-testing/src/multi_test/address_generator.rs +++ b/packages/injective-testing/src/multi_test/address_generator.rs @@ -13,7 +13,13 @@ const ADDRESS_BYTE_INDEX: usize = KECCAK_OUTPUT_BYTES - ADDRESS_BYTES; pub struct InjectiveAddressGenerator(); impl AddressGenerator for InjectiveAddressGenerator { - fn contract_address(&self, _api: &dyn cosmwasm_std::Api, _storage: &mut dyn Storage, _code_id: u64, _instance_id: u64) -> Result { + fn contract_address( + &self, + _api: &dyn cosmwasm_std::Api, + _storage: &mut dyn Storage, + _code_id: u64, + _instance_id: u64, + ) -> Result { Ok(generate_inj_address()) } @@ -45,7 +51,13 @@ impl Default for StorageAwareInjectiveAddressGenerator { } impl AddressGenerator for StorageAwareInjectiveAddressGenerator { - fn contract_address(&self, _api: &dyn cosmwasm_std::Api, storage: &mut dyn Storage, _code_id: u64, _instance_id: u64) -> Result{ + fn contract_address( + &self, + _api: &dyn cosmwasm_std::Api, + storage: &mut dyn Storage, + _code_id: u64, + _instance_id: u64, + ) -> Result { let generated_address = generate_inj_address(); let key = self.key.as_bytes(); let stored = storage.get(key); diff --git a/packages/injective-testing/src/multi_test/chain_mock.rs b/packages/injective-testing/src/multi_test/chain_mock.rs index c7f21466..98ae2987 100644 --- a/packages/injective-testing/src/multi_test/chain_mock.rs +++ b/packages/injective-testing/src/multi_test/chain_mock.rs @@ -1,5 +1,8 @@ use crate::multi_test::address_generator::InjectiveAddressGenerator; -use cosmwasm_std::{testing::{MockApi, MockStorage}, Addr, Api, Binary, BlockInfo, Coin, CustomQuery, Empty, Querier, Storage, to_json_binary, StdError}; +use cosmwasm_std::{ + testing::{MockApi, MockStorage}, + to_json_binary, Addr, Api, Binary, BlockInfo, Coin, CustomQuery, Empty, Querier, StdError, Storage, +}; use cw_multi_test::{ no_init, AddressGenerator, App, AppResponse, BankKeeper, BasicAppBuilder, CosmosRouter, Module, StargateAccepting, StargateFailing, WasmKeeper, }; @@ -231,7 +234,14 @@ impl Module for CustomInjectiveHandler { } } - fn query(&self, _api: &dyn Api, _storage: &dyn Storage, _querier: &dyn Querier, _block: &BlockInfo, request: Self::QueryT) -> Result { + fn query( + &self, + _api: &dyn Api, + _storage: &dyn Storage, + _querier: &dyn Querier, + _block: &BlockInfo, + request: Self::QueryT, + ) -> Result { let mut query_calls_count = self.state.queries.borrow().len(); if !self.assertions.queries.is_empty() From eb95beedb76358e62d88c071dd2788a8b250287a Mon Sep 17 00:00:00 2001 From: jose Date: Fri, 19 Sep 2025 10:11:44 +0200 Subject: [PATCH 10/11] chore: other packages --- .gitignore | 1 + Cargo.toml | 18 +++++++++--------- build.sh | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 62abf6fb..5b41714c 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ tarpaulin-report.* packages/*/schema contracts/*/schema +/packages/injective-cosmwasm/Cargo.lock diff --git a/Cargo.toml b/Cargo.toml index 3476709d..deb63f03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,17 +11,17 @@ anyhow = { version = "1.0.66" } base64 = { version = "0.21.5" } cosmos-sdk-proto = { version = "0.20.0", default-features = false } cosmwasm-schema = { version = "1.5.0" } -cosmwasm-std = { version = "2.2.0", features = [ "abort", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] } -cw-multi-test = { version = "2.2.0" } -cw-storage-plus = { version = "2.0.0" } -cw2 = { version = "2.0.0" } +cosmwasm-std = { version = "3.0.2", features = ["cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0", "iterator", "stargate" ] } +cw-multi-test = { version = "3.0.0" } +cw-storage-plus = { version = "3.0.1" } +cw2 = { version = "3.0.0" } ethereum-types = { version = "0.5.2" } hex = { version = "0.4.3", features = [ "serde" ] } -injective-cosmwasm = { version = "0.3.4-1" } -injective-math = { version = "0.3.4-1" } -injective-std = { version = "1.16.3-1" } -injective-test-tube = { version = "1.16.3-1" } -injective-testing = { version = "1.1.12-1", path = "./packages/injective-testing" } +injective-cosmwasm = { version = "0.3.5-1" } +injective-math = { version = "0.3.5-1" } +injective-std = { version = "1.16.4-1" } +injective-test-tube = { version = "1.16.4-1" } +injective-testing = { version = "1.1.13-1"} primitive-types = { version = "0.12.2", default-features = false } prost = { version = "0.13.5", features = [ "prost-derive" ] } rand = { version = "0.4.6" } diff --git a/build.sh b/build.sh index 2381d25e..477e78a5 100755 --- a/build.sh +++ b/build.sh @@ -4,7 +4,7 @@ # - Defaults to building the 'injective-cosmwasm-mock' contract if no argument is provided. # - Specify a contract name (e.g., 'atomic-order-example') to build a different contract. # - The contract must be a directory in 'contracts/' (e.g., 'contracts/[contract-name]'). -# - Run from the workspace root (e.g., cw-injective) to ensure access to the workspace Cargo.toml. +# - Run from the workspace root (e.g., cw-injective) to ensure access to the workspace pCargo.toml. # Examples: # ./build.sh # Builds injective-cosmwasm-mock # ./build.sh atomic-order-example # Builds atomic-order-example From bf7ce9226b90a9831c3e32eda5c2d8d0a8da67b4 Mon Sep 17 00:00:00 2001 From: jose Date: Fri, 19 Sep 2025 10:19:05 +0200 Subject: [PATCH 11/11] chore: format --- packages/injective-cosmwasm/src/exchange/types.rs | 5 ++++- .../src/exchange_mock_querier.rs | 15 ++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/injective-cosmwasm/src/exchange/types.rs b/packages/injective-cosmwasm/src/exchange/types.rs index 6ee87ad8..61b6709f 100644 --- a/packages/injective-cosmwasm/src/exchange/types.rs +++ b/packages/injective-cosmwasm/src/exchange/types.rs @@ -512,7 +512,10 @@ mod tests { #[test] fn market_id_checks() { let wrong_prefix_err = MarketId::new("0001EDFAB47F124748DC89998EB33144AF734484BA07099014594321729A0CA16B").unwrap_err(); - assert_eq!(wrong_prefix_err.to_string(), "kind: Other, error: Invalid prefix: market_id must start with 0x"); + assert_eq!( + wrong_prefix_err.to_string(), + "kind: Other, error: Invalid prefix: market_id must start with 0x" + ); let wrong_length_err = MarketId::new("0x01EDFAB47F124748DC89998EB33144AF734484BA07099014594321729A0CA16").unwrap_err(); assert_eq!( diff --git a/packages/injective-cosmwasm/src/exchange_mock_querier.rs b/packages/injective-cosmwasm/src/exchange_mock_querier.rs index 9e2498b5..93a54e04 100644 --- a/packages/injective-cosmwasm/src/exchange_mock_querier.rs +++ b/packages/injective-cosmwasm/src/exchange_mock_querier.rs @@ -2,7 +2,10 @@ use std::marker::PhantomData; use std::str::FromStr; use cosmwasm_std::testing::{MockApi, MockStorage}; -use cosmwasm_std::{from_json, to_json_binary, Addr, BalanceResponse, BankQuery, Binary, Coin, ContractResult, OwnedDeps, Querier, QuerierResult, QueryRequest, SupplyResponse, SystemError, SystemResult, Uint128, Uint256, WasmQuery}; +use cosmwasm_std::{ + from_json, to_json_binary, Addr, BalanceResponse, BankQuery, Binary, Coin, ContractResult, OwnedDeps, Querier, QuerierResult, QueryRequest, + SupplyResponse, SystemError, SystemResult, Uint128, Uint256, WasmQuery, +}; use injective_math::FPDecimal; @@ -426,7 +429,6 @@ pub trait HandlesBankBalanceQuery { fn handle(&self, address: String, denom: String) -> QuerierResult; } - pub trait HandlesByAddressQuery { fn handle(&self, address: String) -> QuerierResult; } @@ -783,7 +785,10 @@ impl TestDeposit { } pub mod handlers { - use cosmwasm_std::{to_json_binary, Addr, BalanceResponse, Binary, Checksum, CodeInfoResponse, Coin, ContractInfoResponse, ContractResult, QuerierResult, SupplyResponse, SystemError, SystemResult, Uint128, Uint256}; + use cosmwasm_std::{ + to_json_binary, Addr, BalanceResponse, Binary, Checksum, CodeInfoResponse, Coin, ContractInfoResponse, ContractResult, QuerierResult, + SupplyResponse, SystemError, SystemResult, Uint128, Uint256, + }; use std::collections::HashMap; use injective_math::FPDecimal; @@ -803,8 +808,8 @@ pub mod handlers { TrimmedSpotLimitOrder, }; use crate::{ - HandlesBankBalanceQuery, HandlesCodeInfo, HandlesContractInfo, - HandlesTraderDerivativeOrdersToCancelUpToAmountQuery, MarketMidPriceAndTOBResponse, OracleType, + HandlesBankBalanceQuery, HandlesCodeInfo, HandlesContractInfo, HandlesTraderDerivativeOrdersToCancelUpToAmountQuery, + MarketMidPriceAndTOBResponse, OracleType, }; use super::{HandlesOraclePriceQuery, TestDeposit};