From 3389a57a465d8a696c82a9b9158771e0a5ee8c98 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 27 Aug 2026 16:54:56 +0200 Subject: [PATCH] chore: prepare Talus Move crates 0.2.0 --- CHANGELOG.md | 11 ++++++--- Cargo.lock | 12 +++++----- Cargo.toml | 15 ++++++------ README.md | 18 +++++++------- sui-move-call/Cargo.toml | 3 +-- sui-move-call/README.md | 34 +++++++++++++++----------- sui-move-call/src/lib.rs | 20 ++++++++++++---- sui-move-codegen/Cargo.toml | 3 +-- sui-move-codegen/README.md | 13 +++++----- sui-move-codegen/src/render/mod.rs | 2 +- sui-move-derive/Cargo.toml | 3 +-- sui-move-derive/README.md | 20 +++++++++------- sui-move-ptb/Cargo.toml | 3 +-- sui-move-ptb/README.md | 38 ++++++++++++++++++++++-------- sui-move-runtime/Cargo.toml | 3 +-- sui-move-runtime/README.md | 35 ++++++++++++++++++++------- sui-move-runtime/src/handles.rs | 10 ++++++-- sui-move/Cargo.toml | 3 +-- sui-move/README.md | 20 +++++++++------- 19 files changed, 163 insertions(+), 103 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f65171..49b9573 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ The format is based on [Keep a Changelog], and this project adheres to ## [Unreleased] +## [0.2.0] - 2026-08-27 + +### Changed + +- Correct crate documentation and examples for the stable release. + ## [0.2.0-rc.1] - 2026-08-27 ### Added @@ -29,12 +35,11 @@ The format is based on [Keep a Changelog], and this project adheres to ### Changed -- Publish the workspace under the `talus-sui-move-*` crates.io package names owned by Talus and use - the matching `talus_sui_move*` Rust library names. - Generated package scopes now resolve type identity by module and datatype while calls continue to use the current package address. [Keep a Changelog]: https://keepachangelog.com/en/1.1.0/ [Semantic Versioning]: https://semver.org/spec/v2.0.0.html -[Unreleased]: https://github.com/Talus-Network/move-binding/compare/v0.2.0-rc.1...HEAD +[Unreleased]: https://github.com/Talus-Network/move-binding/compare/v0.2.0...HEAD +[0.2.0]: https://github.com/Talus-Network/move-binding/compare/v0.2.0-rc.1...v0.2.0 [0.2.0-rc.1]: https://github.com/Talus-Network/move-binding/compare/v0.1.0...v0.2.0-rc.1 diff --git a/Cargo.lock b/Cargo.lock index 1b56f1b..94d1010 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -970,7 +970,7 @@ checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" [[package]] name = "talus-sui-move" -version = "0.2.0-rc.1" +version = "0.2.0" dependencies = [ "bcs", "ethnum", @@ -982,7 +982,7 @@ dependencies = [ [[package]] name = "talus-sui-move-call" -version = "0.2.0-rc.1" +version = "0.2.0" dependencies = [ "bcs", "serde", @@ -993,7 +993,7 @@ dependencies = [ [[package]] name = "talus-sui-move-codegen" -version = "0.2.0-rc.1" +version = "0.2.0" dependencies = [ "prettyplease", "proc-macro2", @@ -1008,7 +1008,7 @@ dependencies = [ [[package]] name = "talus-sui-move-derive" -version = "0.2.0-rc.1" +version = "0.2.0" dependencies = [ "proc-macro2", "quote", @@ -1018,7 +1018,7 @@ dependencies = [ [[package]] name = "talus-sui-move-ptb" -version = "0.2.0-rc.1" +version = "0.2.0" dependencies = [ "sui-sdk-types", "talus-sui-move", @@ -1028,7 +1028,7 @@ dependencies = [ [[package]] name = "talus-sui-move-runtime" -version = "0.2.0-rc.1" +version = "0.2.0" dependencies = [ "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 246198c..f3cae6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,20 +10,19 @@ members = [ ] [workspace.package] -version = "0.2.0-rc.1" +version = "0.2.0" edition = "2021" rust-version = "1.90" license = "Apache-2.0" repository = "https://github.com/Talus-Network/move-binding" -homepage = "https://github.com/Talus-Network/move-binding" [workspace.dependencies] -talus-sui-move = { version = "=0.2.0-rc.1", path = "sui-move" } -talus-sui-move-derive = { version = "=0.2.0-rc.1", path = "sui-move-derive" } -talus-sui-move-call = { version = "=0.2.0-rc.1", path = "sui-move-call" } -talus-sui-move-ptb = { version = "=0.2.0-rc.1", path = "sui-move-ptb" } -talus-sui-move-runtime = { version = "=0.2.0-rc.1", path = "sui-move-runtime" } -talus-sui-move-codegen = { version = "=0.2.0-rc.1", path = "sui-move-codegen" } +talus-sui-move = { version = "=0.2.0", path = "sui-move" } +talus-sui-move-derive = { version = "=0.2.0", path = "sui-move-derive" } +talus-sui-move-call = { version = "=0.2.0", path = "sui-move-call" } +talus-sui-move-ptb = { version = "=0.2.0", path = "sui-move-ptb" } +talus-sui-move-runtime = { version = "=0.2.0", path = "sui-move-runtime" } +talus-sui-move-codegen = { version = "=0.2.0", path = "sui-move-codegen" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "1.0" diff --git a/README.md b/README.md index 9fca49e..165d103 100644 --- a/README.md +++ b/README.md @@ -2,24 +2,22 @@ Layered crates for writing typed, ergonomic Move interactions on Sui from Rust. -This workspace is intentionally “deep”: each crate is a small abstraction that solves one problem, -and higher layers build on lower ones. +Each crate is a small abstraction that solves one problem, and the crates can be adopted +individually. The primary mental model is **Read → Tx → Commit** with a **cursor** that advances your local frontier by applying transaction effects. See `MODEL.md`. ## Status -The `0.2.0-rc.1` release candidate is the first release under crates.io package names owned by Talus. -Public APIs may change before `1.0`; treat the crate boundaries and the `MODEL.md` invariants as -more stable than individual function names. +This is a pre-1.0 project. Public APIs may change before `1.0`; treat the crate boundaries and the +`MODEL.md` invariants as more stable than individual function names. -## Packages (low → high) +## Crates -The crates.io package names and Rust library names use the same Talus prefix. This gives consumers -one consistent name in Cargo and source code. +Cargo package names use hyphens, while Rust imports use underscores. -| crates.io package | Rust crate | Role | +| Cargo package | Rust import | Role | | --- | --- | --- | | `talus-sui-move` | `talus_sui_move` | Rust representations of Move types, abilities, and decoding helpers | | `talus-sui-move-derive` | `talus_sui_move_derive` | Derive macros for Rust structs that represent Move structs | @@ -32,7 +30,7 @@ For example: ```toml [dependencies] -talus-sui-move = { version = "=0.2.0-rc.1", features = ["derive"] } +talus-sui-move = { version = "=0.2.0", features = ["derive"] } ``` ```rust diff --git a/sui-move-call/Cargo.toml b/sui-move-call/Cargo.toml index d51cc0c..2843381 100644 --- a/sui-move-call/Cargo.toml +++ b/sui-move-call/Cargo.toml @@ -8,9 +8,8 @@ readme = "README.md" publish = ["crates-io"] license.workspace = true repository.workspace = true -homepage.workspace = true documentation = "https://docs.rs/talus-sui-move-call" -keywords = ["sui", "move", "blockchain", "transactions"] +keywords = ["sui", "move", "blockchain", "transactions", "talus"] categories = ["api-bindings", "development-tools"] [dependencies] diff --git a/sui-move-call/README.md b/sui-move-call/README.md index e003b0b..5cea831 100644 --- a/sui-move-call/README.md +++ b/sui-move-call/README.md @@ -2,25 +2,21 @@ Typed building blocks for describing Move calls on Sui. -The crates.io package is `talus-sui-move-call`; Rust code imports it as `talus_sui_move_call`. - This crate builds on top of [`talus-sui-move`](https://docs.rs/talus-sui-move) and solves one problem: **describe a Move call in a typed way** (object handles + type arguments + arguments) without building or executing transactions. -## Where it fits +## Relationship to the other crates -`talus-sui-move-call` is the “Call” layer in the repository’s -[Read → Tx → Commit model](https://github.com/Talus-Network/move-binding/blob/main/MODEL.md): +`talus-sui-move-call` uses `MoveType` and `MoveStruct` from `talus-sui-move` to build call +descriptions whose types are checked by Rust: -- **Read** (runtime) fetches objects and classifies ownership from chain state. -- **Call** (this crate) describes *what* to call and how to encode arguments. -- **PTB** builds a `ProgrammableTransaction` from a `CallSpec`. -- **Commit** (runtime) submits and applies effects to advance the cursor. +- `talus-sui-move-call` describes what to call and how to encode arguments. +- `talus-sui-move-ptb` can turn a `CallSpec` into a `ProgrammableTransaction`. +- `talus-sui-move-runtime` can submit that transaction and update typed handles. -This crate sits directly above `talus-sui-move`: it uses `MoveType` and `MoveStruct` to build call -descriptions (`CallSpec`) whose types are checked by Rust. Transaction building and execution are -intentionally out of scope. +This crate can be used independently when an application only needs typed call descriptions. +Transaction building and execution are intentionally out of scope. ## Core types @@ -78,9 +74,14 @@ use talus_sui_move::prelude::*; use talus_sui_move_call::{CallSpec, MoveObject}; use sui_sdk_types::{Address, Digest, ObjectReference, TypeTag}; +#[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +pub struct ID { + pub bytes: Address, +} + #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] pub struct UID { - pub id: u64, + pub id: ID, } #[talus_sui_move::move_struct(address = "0x1", module = "vault", abilities = "key")] @@ -122,9 +123,14 @@ use std::str::FromStr; use talus_sui_move_call::{CallArg, CallSpec, ReceivingMoveObject, SharedMoveObject}; use sui_sdk_types::{Address, Digest, ObjectReference}; +#[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +struct ID { + bytes: Address, +} + #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] struct UID { - id: u64, + id: ID, } #[talus_sui_move::move_struct(address = "0x1", module = "demo", abilities = "key")] diff --git a/sui-move-call/src/lib.rs b/sui-move-call/src/lib.rs index f6550e5..ee16f8e 100644 --- a/sui-move-call/src/lib.rs +++ b/sui-move-call/src/lib.rs @@ -31,8 +31,11 @@ pub use sui_sdk_types::Input as CallArg; /// use talus_sui_move_call::MoveObject; /// use sui_sdk_types::{Address, Digest, ObjectReference}; /// +/// # #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +/// # struct ID { bytes: Address } +/// # /// # #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] -/// # struct UID { id: u64 } +/// # struct UID { id: ID } /// # /// #[talus_sui_move::move_struct(address = "0x1", module = "demo", abilities = "key")] /// struct Demo { @@ -85,8 +88,11 @@ impl MoveObject { /// use talus_sui_move_call::SharedMoveObject; /// use sui_sdk_types::Address; /// +/// # #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +/// # struct ID { bytes: Address } +/// # /// # #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] -/// # struct UID { id: u64 } +/// # struct UID { id: ID } /// # /// #[talus_sui_move::move_struct(address = "0x1", module = "demo", abilities = "key")] /// struct SharedThing { @@ -174,8 +180,11 @@ impl SharedMoveObject { /// use talus_sui_move_call::ReceivingMoveObject; /// use sui_sdk_types::{Address, Digest, ObjectReference}; /// +/// # #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +/// # struct ID { bytes: Address } +/// # /// # #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] -/// # struct UID { id: u64 } +/// # struct UID { id: ID } /// # /// #[talus_sui_move::move_struct(address = "0x1", module = "demo", abilities = "key")] /// struct ReceivingThing { @@ -427,8 +436,11 @@ impl CallTarget { /// use talus_sui_move_call::{CallSpec, MoveObject}; /// use sui_sdk_types::{Address, Digest, ObjectReference, TypeTag}; /// +/// # #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +/// # struct ID { bytes: Address } +/// # /// # #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] -/// # struct UID { id: u64 } +/// # struct UID { id: ID } /// # /// #[talus_sui_move::move_struct(address = "0x1", module = "vault", abilities = "key")] /// struct Vault { diff --git a/sui-move-codegen/Cargo.toml b/sui-move-codegen/Cargo.toml index a0a372a..df2335a 100644 --- a/sui-move-codegen/Cargo.toml +++ b/sui-move-codegen/Cargo.toml @@ -8,9 +8,8 @@ readme = "README.md" publish = ["crates-io"] license.workspace = true repository.workspace = true -homepage.workspace = true documentation = "https://docs.rs/talus-sui-move-codegen" -keywords = ["sui", "move", "blockchain", "codegen"] +keywords = ["sui", "move", "blockchain", "codegen", "talus"] categories = ["api-bindings", "development-tools"] [dependencies] diff --git a/sui-move-codegen/README.md b/sui-move-codegen/README.md index dabe0e0..414bf75 100644 --- a/sui-move-codegen/README.md +++ b/sui-move-codegen/README.md @@ -2,10 +2,8 @@ Generate typed Rust bindings for a Move package on Sui. -The crates.io package is `talus-sui-move-codegen`; Rust code imports it as `talus_sui_move_codegen`. - This crate solves one problem: **turn Move package metadata fetched from Sui into Rust source -code** that fits the layered `talus-sui-move*` stack. +code** compatible with the Talus Sui Move crates: - `talus-sui-move`: Rust representations of Move types (`MoveType`, `MoveStruct`, abilities) - `talus-sui-move-call`: `CallSpec` + typed argument traits (`ToCallArg`, `ObjectArg`) @@ -80,7 +78,8 @@ Given a `NormalizedPackage` (either fetched from gRPC or loaded from JSON), this - (optional) A `TxExt` trait implemented for `talus_sui_move_runtime::Tx` (enable with `RenderOptions::emit_tx_ext`) -Those generated call builders are designed to be used directly in higher layers: +Those generated call builders can be used directly with: + - `talus-sui-move-ptb` can consume `CallSpec` to build a `ProgrammableTransaction` - `talus-sui-move-runtime` can consume `CallSpec` via its tx builder (or `talus_sui_move_runtime::tx!`) @@ -525,9 +524,9 @@ expects these crates in the consumer’s `Cargo.toml`: ```toml [dependencies] -talus-sui-move = "=0.2.0-rc.1" -talus-sui-move-derive = "=0.2.0-rc.1" -talus-sui-move-call = "=0.2.0-rc.1" +talus-sui-move = "=0.2.0" +talus-sui-move-derive = "=0.2.0" +talus-sui-move-call = "=0.2.0" ``` If you want to execute calls, add higher layers (`talus-sui-move-ptb`, diff --git a/sui-move-codegen/src/render/mod.rs b/sui-move-codegen/src/render/mod.rs index 2bc7e19..2ffb1f4 100644 --- a/sui-move-codegen/src/render/mod.rs +++ b/sui-move-codegen/src/render/mod.rs @@ -5,7 +5,7 @@ //! - commit that IR as JSON (optional), //! - render Rust source from the IR in CI/builds (offline). //! -//! The generated code is designed to plug into the rest of the workspace: +//! The generated code is designed to work with the other Talus Sui Move crates: //! - generated types implement `talus-sui-move` traits (`MoveType` / `MoveStruct`) and ability markers //! - generated call targets identify Move functions for PTB builders //! - generated call specification builders can return `talus-sui-move-call::CallSpec` diff --git a/sui-move-derive/Cargo.toml b/sui-move-derive/Cargo.toml index fbef175..b94cb86 100644 --- a/sui-move-derive/Cargo.toml +++ b/sui-move-derive/Cargo.toml @@ -8,9 +8,8 @@ readme = "README.md" publish = ["crates-io"] license.workspace = true repository.workspace = true -homepage.workspace = true documentation = "https://docs.rs/talus-sui-move-derive" -keywords = ["sui", "move", "blockchain", "proc-macro"] +keywords = ["sui", "move", "blockchain", "proc-macro", "talus"] categories = ["development-tools::procedural-macro-helpers"] [lib] diff --git a/sui-move-derive/README.md b/sui-move-derive/README.md index d17f8d6..3704c68 100644 --- a/sui-move-derive/README.md +++ b/sui-move-derive/README.md @@ -1,18 +1,15 @@ # talus-sui-move-derive Procedural macros for [`talus-sui-move`](https://docs.rs/talus-sui-move): define Rust types that -represent Move types with minimal boilerplate. The package is `talus-sui-move-derive`; Rust code -imports it as `talus_sui_move_derive`. +represent Move types with minimal boilerplate. This crate exists to solve one problem: **turn a Rust struct into a representation of a Move type** with the correct `TypeTag`, `StructTag`, and ability markers. It can then use the type tag plumbing and verified decoding in `talus-sui-move`. -## Where it fits +## Relationship to `talus-sui-move` -In the repository’s layered -[stack](https://github.com/Talus-Network/move-binding/blob/main/MODEL.md), -`talus-sui-move-derive` is a convenience layer for the bottom type system (`talus-sui-move`): +`talus-sui-move-derive` is the optional procedural macro companion to `talus-sui-move`: - you describe the Move identity (`address`, `module`, `abilities`) as attributes, - the macro generates the corresponding `talus_sui_move::MoveType` / `talus_sui_move::MoveStruct` impls and @@ -57,7 +54,7 @@ Most users should depend on `talus-sui-move` and enable its `derive` feature, wh ```toml [dependencies] -talus-sui-move = { version = "=0.2.0-rc.1", features = ["derive"] } +talus-sui-move = { version = "=0.2.0", features = ["derive"] } ``` Then use: @@ -172,12 +169,17 @@ pub struct MissingId { Similarly, invalid ability combinations are rejected: ```rust,compile_fail +use talus_sui_move::prelude::Address; use talus_sui_move_derive::move_struct; -/// Minimal UID fixture defined by a package for the compilation failure example. +#[move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +pub struct ID { + pub bytes: Address, +} + #[move_struct(address = "0x2", module = "object", abilities = "store")] pub struct UID { - pub id: u64, + pub id: ID, } // A struct cannot be both `key` and `copy`. diff --git a/sui-move-ptb/Cargo.toml b/sui-move-ptb/Cargo.toml index de97f34..a10aa66 100644 --- a/sui-move-ptb/Cargo.toml +++ b/sui-move-ptb/Cargo.toml @@ -8,9 +8,8 @@ readme = "README.md" publish = ["crates-io"] license.workspace = true repository.workspace = true -homepage.workspace = true documentation = "https://docs.rs/talus-sui-move-ptb" -keywords = ["sui", "move", "blockchain", "transactions"] +keywords = ["sui", "move", "blockchain", "transactions", "talus"] categories = ["api-bindings", "development-tools"] [dependencies] diff --git a/sui-move-ptb/README.md b/sui-move-ptb/README.md index 1049de4..22044c6 100644 --- a/sui-move-ptb/README.md +++ b/sui-move-ptb/README.md @@ -2,13 +2,11 @@ Programmable transaction building blocks for typed Move calls on Sui. -The crates.io package is `talus-sui-move-ptb`; Rust code imports it as `talus_sui_move_ptb`. +This crate uses [`talus-sui-move-call`](https://docs.rs/talus-sui-move-call) and solves one +problem: **turn typed Move call descriptions into a +`sui_sdk_types::ProgrammableTransaction`** while hiding input/argument indexing. -This crate sits on top of [`talus-sui-move-call`](https://docs.rs/talus-sui-move-call) and solves one problem: -**turn typed Move call descriptions into a `sui_sdk_types::ProgrammableTransaction`** while -hiding input/argument indexing. - -## Where it fits +## Relationship to the other crates - `talus-sui-move`: Rust representations of Move types (`MoveType`, `MoveStruct`, abilities) - `talus-sui-move-call`: typed call descriptions (`CallSpec`, typed input wrappers) @@ -73,9 +71,14 @@ use talus_sui_move_call::{CallSpec, MoveObject}; use talus_sui_move_ptb::ptb; use sui_sdk_types::{Address, Digest, ObjectReference}; +#[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +struct ID { + bytes: Address, +} + #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] struct UID { - id: u64, + id: ID, } #[talus_sui_move::move_struct(address = "0x1", module = "vault", abilities = "key")] @@ -115,9 +118,14 @@ use talus_sui_move_call::{CallSpec, MoveObject}; use talus_sui_move_ptb::ptb; use sui_sdk_types::{Address, Digest, ObjectReference}; +#[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +struct ID { + bytes: Address, +} + #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] struct UID { - id: u64, + id: ID, } #[talus_sui_move::move_struct(address = "0x1", module = "vault", abilities = "key")] @@ -160,9 +168,14 @@ use talus_sui_move_call::{CallArg, SharedMoveObject}; use talus_sui_move_ptb::PtbBuilder; use sui_sdk_types::{Address, Argument, Mutability}; +#[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +struct ID { + bytes: Address, +} + #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] struct UID { - id: u64, + id: ID, } #[talus_sui_move::move_struct(address = "0x1", module = "demo", abilities = "key")] @@ -204,9 +217,14 @@ use talus_sui_move_call::{CallArg, MoveObject, ReceivingMoveObject}; use talus_sui_move_ptb::{BuildError, PtbBuilder}; use sui_sdk_types::{Address, Digest, ObjectReference}; +#[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +struct ID { + bytes: Address, +} + #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] struct UID { - id: u64, + id: ID, } #[talus_sui_move::move_struct(address = "0x1", module = "demo", abilities = "key")] diff --git a/sui-move-runtime/Cargo.toml b/sui-move-runtime/Cargo.toml index 21173e8..b1777df 100644 --- a/sui-move-runtime/Cargo.toml +++ b/sui-move-runtime/Cargo.toml @@ -8,9 +8,8 @@ readme = "README.md" publish = ["crates-io"] license.workspace = true repository.workspace = true -homepage.workspace = true documentation = "https://docs.rs/talus-sui-move-runtime" -keywords = ["sui", "move", "blockchain", "transactions"] +keywords = ["sui", "move", "blockchain", "transactions", "talus"] categories = ["api-bindings", "development-tools"] [dependencies] diff --git a/sui-move-runtime/README.md b/sui-move-runtime/README.md index fcd263d..154d063 100644 --- a/sui-move-runtime/README.md +++ b/sui-move-runtime/README.md @@ -2,9 +2,7 @@ Runtime layer for typed Move interactions on Sui. -The crates.io package is `talus-sui-move-runtime`; Rust code imports it as `talus_sui_move_runtime`. - -This crate sits at the top of this stack: +It combines the other Talus Sui Move crates where needed: - [`talus-sui-move`](https://docs.rs/talus-sui-move): Rust representations of Move types (`MoveType`, `MoveStruct`, abilities) @@ -40,8 +38,11 @@ use sui_sdk_types::{Address, PersonalMessage, Transaction, UserSignature}; # } # } # +# #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +# struct ID { bytes: Address } +# # #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] -# struct UID { id: u64 } +# struct UID { id: ID } # # #[talus_sui_move::move_struct(address = "0x1", module = "demo", abilities = "key")] # struct Demo { @@ -108,8 +109,11 @@ If you want a single action, use the `tx!` macro variants: use talus_sui_move_runtime::prelude::*; use sui_sdk_types::Address; +# #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +# struct ID { bytes: Address } +# # #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] -# struct UID { id: u64 } +# struct UID { id: ID } # # #[talus_sui_move::move_struct(address = "0x1", module = "demo", abilities = "key")] # struct Demo { id: UID } @@ -188,9 +192,14 @@ If you need a specific input mode, derive an explicit view at the moment it matt ```rust,no_run use talus_sui_move_runtime::prelude::*; +#[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +struct ID { + bytes: Address, +} + #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] struct UID { - id: u64, + id: ID, } #[talus_sui_move::move_struct(address = "0x1", module = "demo", abilities = "key")] @@ -347,9 +356,14 @@ says X but BCS layout expects Y” becomes an explicit error instead of a silent use talus_sui_move_runtime::prelude::*; use sui_sdk_types::Address; +#[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +struct ID { + bytes: Address, +} + #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] struct UID { - id: u64, + id: ID, } #[talus_sui_move::move_struct(address = "0x1", module = "demo", abilities = "key")] @@ -423,9 +437,14 @@ threading `&mut ObjectReference` everywhere. ```rust,no_run use talus_sui_move_runtime::prelude::*; +#[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +struct ID { + bytes: Address, +} + #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] struct UID { - id: u64, + id: ID, } #[talus_sui_move::move_struct(address = "0x1", module = "demo", abilities = "key")] diff --git a/sui-move-runtime/src/handles.rs b/sui-move-runtime/src/handles.rs index 69699a9..4cb1640 100644 --- a/sui-move-runtime/src/handles.rs +++ b/sui-move-runtime/src/handles.rs @@ -105,9 +105,12 @@ struct TrackedObjectSnapshot { /// ```rust,no_run /// use talus_sui_move_runtime::prelude::*; /// +/// # #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +/// # struct ID { bytes: Address } +/// # /// # #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] /// # struct UID { -/// # id: u64, +/// # id: ID, /// # } /// # #[talus_sui_move::move_struct(address = "0x1", module = "demo", abilities = "key, store")] /// # struct Demo { @@ -395,9 +398,12 @@ impl ToCallArgMut for Re /// use talus_sui_move_runtime::SharedObject; /// use sui_sdk_types::Address; /// +/// # #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] +/// # struct ID { bytes: Address } +/// # /// # #[talus_sui_move::move_struct(address = "0x2", module = "object", abilities = "store")] /// # struct UID { -/// # id: u64, +/// # id: ID, /// # } /// # #[talus_sui_move::move_struct(address = "0x1", module = "demo", abilities = "key, store")] /// # struct Demo { diff --git a/sui-move/Cargo.toml b/sui-move/Cargo.toml index d53e67e..4475a67 100644 --- a/sui-move/Cargo.toml +++ b/sui-move/Cargo.toml @@ -8,9 +8,8 @@ readme = "README.md" publish = ["crates-io"] license.workspace = true repository.workspace = true -homepage.workspace = true documentation = "https://docs.rs/talus-sui-move" -keywords = ["sui", "move", "blockchain", "bindings"] +keywords = ["sui", "move", "blockchain", "bindings", "talus"] categories = ["api-bindings", "development-tools"] [package.metadata.docs.rs] diff --git a/sui-move/README.md b/sui-move/README.md index f2facb4..e740ffe 100644 --- a/sui-move/README.md +++ b/sui-move/README.md @@ -2,16 +2,14 @@ Rust representations of Move types, built on top of `sui-sdk-types`. -The crates.io package is `talus-sui-move`; Rust code imports it as `talus_sui_move`. - This crate solves one problem: **represent Move types precisely in Rust** (including their `TypeTag`/`StructTag` and ability surface), so you can build strongly typed Sui clients and helpers that can **verify type tags and decode BCS safely**. -## Where it fits +## How to use it -`talus-sui-move` is the bottom layer of this repository’s -[stack](https://github.com/Talus-Network/move-binding/blob/main/MODEL.md). Higher layers use it to: +`talus-sui-move` provides shared type traits used by the other Talus Sui Move crates. It can also +be used independently to: - name types precisely when building Move calls (`TypeTag`/`StructTag`), - express Move ability constraints as normal Rust bounds, @@ -77,11 +75,16 @@ represent Move structs. ```rust #[cfg(feature = "derive")] mod example { - use talus_sui_move::move_struct; + use talus_sui_move::{move_struct, prelude::Address}; + + #[move_struct(address = "0x2", module = "object", abilities = "copy, drop, store")] + pub struct ID { + pub bytes: Address, + } #[move_struct(address = "0x2", module = "object", abilities = "store")] pub struct UID { - pub id: u64, + pub id: ID, } #[move_struct(address = "0x1", module = "vault", abilities = "key, store")] @@ -150,8 +153,7 @@ Those are datatypes defined by a package, not language atoms. If application code needs framework types, generate them from package metadata or define them in the consuming crate using the same `MoveType` / `MoveStruct` machinery used for user packages. This -keeps the core crate small enough to serve as the trusted type kernel for generated bindings in -higher layers. +keeps this crate focused and lets generated bindings represent each package exactly. ### What is deliberately excluded