Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
246b4b1
Add hash impls
DaughterOfMars Dec 5, 2025
c82e34a
more hash impls
DaughterOfMars Dec 5, 2025
8482344
add constants
DaughterOfMars Dec 5, 2025
81c11c0
add system tx fn
DaughterOfMars Dec 5, 2025
fab0914
add is_sponsored_tx
DaughterOfMars Dec 5, 2025
564c52a
add is_system_package
DaughterOfMars Dec 5, 2025
6573248
more stuff
DaughterOfMars Dec 5, 2025
f8f47e6
moore
DaughterOfMars Dec 5, 2025
80252fc
is_struct/is_package
DaughterOfMars Dec 5, 2025
2bc2c0c
obj ref derives
DaughterOfMars Dec 8, 2025
3996b7c
add input objects
DaughterOfMars Dec 8, 2025
057a646
impl Display for txn kind
DaughterOfMars Dec 8, 2025
274ced2
serde fot object type
DaughterOfMars Dec 8, 2025
d73c916
upper hex digest
DaughterOfMars Dec 10, 2025
8cd26ed
digest const improvements
DaughterOfMars Dec 10, 2025
9b9fe51
add version consts
DaughterOfMars Dec 10, 2025
8913b34
add more fns and rename
DaughterOfMars Dec 10, 2025
a22fec5
genesis marker
DaughterOfMars Dec 10, 2025
1b8d82f
const address/object_id conversions
DaughterOfMars Dec 10, 2025
2e7f9f1
const objs ref fns
DaughterOfMars Dec 10, 2025
ece613f
object id from_bytes
DaughterOfMars Dec 10, 2025
c959393
add next_lexicographical to more things
DaughterOfMars Dec 11, 2025
263fde8
add is_alive, is_deleted, is_wrapped
DaughterOfMars Dec 11, 2025
ed118cf
more const fns for identifier
DaughterOfMars Dec 11, 2025
119ac84
more eq impls
DaughterOfMars Dec 11, 2025
d4eb114
display for ident ref
DaughterOfMars Dec 12, 2025
36f5f47
Merge branch 'develop' into feat/more-core-fns
DaughterOfMars Jan 14, 2026
5a96363
fix errors
DaughterOfMars Jan 14, 2026
97d9372
add IdentifierRef new method
DaughterOfMars Jan 14, 2026
c3b4004
add struct tag is_ methods
DaughterOfMars Jan 14, 2026
a7d405f
const lexicographical
DaughterOfMars Jan 14, 2026
9d9ec59
Replace version trait with struct wrapper
DaughterOfMars Jan 14, 2026
2c44ab8
add feature-gated random fns
DaughterOfMars Jan 14, 2026
77bf207
remove unnecessary feature
DaughterOfMars Jan 14, 2026
bfd5a3a
add `iota-sdk-move-types` crate
DaughterOfMars Jan 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pre_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ on:
required: true
description: The package to publish.
options:
- iota-sdk-move-types
- iota-sdk-types
- iota-sdk-crypto
- iota-sdk-graphql-client-build
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"crates/iota-sdk-ffi",
"crates/iota-sdk-graphql-client",
"crates/iota-sdk-graphql-client-build",
"crates/iota-sdk-move-types",
"crates/iota-sdk-transaction-builder",
"crates/iota-sdk-types",
]
Expand Down Expand Up @@ -37,6 +38,7 @@ tokio = "1.40.0"
iota-crypto = { version = "0.0.1-alpha.1", package = "iota-sdk-crypto", path = "crates/iota-sdk-crypto", default-features = false }
iota-graphql-client = { version = "0.0.1-alpha.1", package = "iota-sdk-graphql-client", path = "crates/iota-sdk-graphql-client", default-features = false }
iota-graphql-client-build = { version = "0.0.1-alpha.1", package = "iota-sdk-graphql-client-build", path = "crates/iota-sdk-graphql-client-build", default-features = false }
iota-move-types = { version = "0.0.1-alpha.0", package = "iota-sdk-move-types", path = "crates/iota-sdk-move-types", default-features = false }
iota-sdk = { version = "3.0.0-alpha.1", package = "iota-sdk", path = "crates/iota-sdk", default-features = false }
iota-transaction-builder = { version = "0.0.1-alpha.1", package = "iota-sdk-transaction-builder", path = "crates/iota-sdk-transaction-builder", default-features = false }
iota-types = { version = "0.0.1-alpha.1", package = "iota-sdk-types", path = "crates/iota-sdk-types", default-features = false }
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ all:: ci ## Default target, runs the CI process

.PHONY: check-features
check-features: ## Check feature flags for crates
$(MAKE) -C crates/iota-sdk-move-types check-features
$(MAKE) -C crates/iota-sdk-types check-features
$(MAKE) -C crates/iota-sdk-crypto check-features

Expand All @@ -21,7 +22,7 @@ clippy: ## Run Clippy linter

.PHONY: test
test: ## Run unit tests
cargo nextest run --all-features -p iota-sdk-types -p iota-sdk-crypto
cargo nextest run --all-features -p iota-sdk-move-types -p iota-sdk-types -p iota-sdk-crypto

.PHONY: test-docs
test-docs: ## Run doc tests
Expand All @@ -45,6 +46,7 @@ wasm: ## Build WASM modules
$(MAKE) -C crates/iota-sdk-graphql-client wasm
$(MAKE) -C crates/iota-sdk-transaction-builder wasm
$(MAKE) -C crates/iota-sdk-types wasm
$(MAKE) -C crates/iota-sdk-move-types wasm

.PHONY: doc
doc: ## Generate documentation
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ In an effort to be modular, functionality is split between a number of crates. T
- [`iota-sdk-transaction-builder`](crates/iota-sdk-transaction-builder)
[![iota-sdk-transaction-builder on crates.io](https://img.shields.io/crates/v/iota-sdk-transaction-builder)](https://crates.io/crates/iota-sdk-transaction-builder)
[![Documentation (latest release)](https://img.shields.io/badge/docs-latest-brightgreen)](https://docs.rs/iota-sdk-transaction-builder)
- [`iota-sdk-move-types`](crates/iota-sdk-move-types)
[![iota-sdk-move-types on crates.io](https://img.shields.io/crates/v/iota-sdk-move-types)](https://crates.io/crates/iota-sdk-move-types)
[![Documentation (latest release)](https://img.shields.io/badge/docs-latest-brightgreen)](https://docs.rs/iota-sdk-move-types)
- [`iota-sdk-types`](crates/iota-sdk-types)
[![iota-sdk-types on crates.io](https://img.shields.io/crates/v/iota-sdk-types)](https://crates.io/crates/iota-sdk-types)
[![Documentation (latest release)](https://img.shields.io/badge/docs-latest-brightgreen)](https://docs.rs/iota-sdk-types)
Expand Down
9 changes: 5 additions & 4 deletions crates/iota-sdk-crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ rustdoc-args = [

[features]
default = []
ed25519 = ["dep:ed25519-dalek", "dep:rand_core"]
secp256r1 = ["dep:p256", "dep:rand_core"]
ed25519 = ["dep:ed25519-dalek"]
secp256r1 = ["dep:p256"]
passkey = ["secp256r1", "dep:sha2"]
secp256k1 = ["dep:k256", "dep:rand_core", "signature/std"]
secp256k1 = ["dep:k256", "signature/std"]
bech32 = ["dep:bech32", "signature/std"]
zklogin = [
"dep:ark-bn254",
Expand All @@ -51,8 +51,9 @@ pem = [
"p256?/pem",
"k256?/pem",
]
bls12381 = ["dep:blst", "dep:rand_core", "dep:roaring", "signature/std"]
bls12381 = ["dep:blst", "dep:roaring", "signature/std"]
mnemonic = ["dep:bip32", "dep:bip39", "dep:slip10_ed25519"]
rand = ["dep:rand_core"]

[dependencies]
iota-types = { workspace = true, features = ["hash", "serde"] }
Expand Down
8 changes: 8 additions & 0 deletions crates/iota-sdk-crypto/src/bls12381.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ impl Bls12381PrivateKey {
self.verifying_key().public_key()
}

#[cfg(feature = "rand")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "rand")))]
pub fn generate<R>(mut rng: R) -> Self
where
R: rand_core::RngCore + rand_core::CryptoRng,
Expand All @@ -84,6 +86,12 @@ impl Bls12381PrivateKey {
Self(secret_key)
}

#[cfg(feature = "rand")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "rand")))]
pub fn random() -> Self {
Self::generate(rand_core::OsRng)
}

pub fn sign_checkpoint_summary(&self, summary: &CheckpointSummary) -> ValidatorSignature {
let message = summary.signing_message();
let signature = self.sign(&message);
Expand Down
8 changes: 8 additions & 0 deletions crates/iota-sdk-crypto/src/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ impl Ed25519PrivateKey {
self.verifying_key().public_key()
}

#[cfg(feature = "rand")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "rand")))]
pub fn generate<R>(mut rng: R) -> Self
where
R: rand_core::RngCore + rand_core::CryptoRng,
Expand All @@ -62,6 +64,12 @@ impl Ed25519PrivateKey {
Self(buf.into())
}

#[cfg(feature = "rand")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "rand")))]
pub fn random() -> Self {
Self::generate(rand_core::OsRng)
}

#[cfg(feature = "pem")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "pem")))]
/// Deserialize PKCS#8 private key from ASN.1 DER-encoded data (binary
Expand Down
8 changes: 8 additions & 0 deletions crates/iota-sdk-crypto/src/secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,21 @@ impl Secp256k1PrivateKey {
Secp256k1PublicKey::new(self.0.verifying_key().as_ref().to_bytes().into())
}

#[cfg(feature = "rand")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "rand")))]
pub fn generate<R>(mut rng: R) -> Self
where
R: rand_core::RngCore + rand_core::CryptoRng,
{
Self(SigningKey::random(&mut rng))
}

#[cfg(feature = "rand")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "rand")))]
pub fn random() -> Self {
Self::generate(rand_core::OsRng)
}

#[cfg(feature = "pem")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "pem")))]
/// Deserialize PKCS#8 private key from ASN.1 DER-encoded data (binary
Expand Down
8 changes: 8 additions & 0 deletions crates/iota-sdk-crypto/src/secp256r1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ impl Secp256r1PrivateKey {
Secp256r1PublicKey::new(self.0.verifying_key().as_ref().to_bytes().into())
}

#[cfg(feature = "rand")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "rand")))]
pub fn generate<R>(mut rng: R) -> Self
where
R: rand_core::RngCore + rand_core::CryptoRng,
Expand All @@ -67,6 +69,12 @@ impl Secp256r1PrivateKey {
Self::new(buf)
}

#[cfg(feature = "rand")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "rand")))]
pub fn random() -> Self {
Self::generate(rand_core::OsRng)
}

#[cfg(feature = "pem")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "pem")))]
/// Deserialize PKCS#8 private key from ASN.1 DER-encoded data (binary
Expand Down
1 change: 0 additions & 1 deletion crates/iota-sdk-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ derive_more = { workspace = true, features = ["from", "deref", "display"] }
hex.workspace = true
paste.workspace = true
primitive-types.workspace = true
rand.workspace = true
roaring.workspace = true
serde.workspace = true
serde_json.workspace = true
Expand Down
7 changes: 2 additions & 5 deletions crates/iota-sdk-ffi/src/crypto/bls12381.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0

use iota_sdk::types::SignatureScheme;
use rand::rngs::OsRng;

use crate::{
error::{Result, SdkFfiError},
Expand Down Expand Up @@ -40,10 +39,8 @@ impl Bls12381PrivateKey {
}

#[uniffi::constructor]
pub fn generate() -> Self {
Self(iota_sdk::crypto::bls12381::Bls12381PrivateKey::generate(
OsRng,
))
pub fn random() -> Self {
Self(iota_sdk::crypto::bls12381::Bls12381PrivateKey::random())
}

pub fn sign_checkpoint_summary(&self, summary: &CheckpointSummary) -> ValidatorSignature {
Expand Down
7 changes: 2 additions & 5 deletions crates/iota-sdk-ffi/src/crypto/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use iota_sdk::{
crypto::{FromMnemonic, ToFromBech32, ToFromBytes},
types::SignatureScheme,
};
use rand::rngs::OsRng;

use crate::{
error::{Result, SdkFfiError},
Expand Down Expand Up @@ -43,10 +42,8 @@ impl Ed25519PrivateKey {
}

#[uniffi::constructor]
pub fn generate() -> Self {
Self(iota_sdk::crypto::ed25519::Ed25519PrivateKey::generate(
OsRng,
))
pub fn random() -> Self {
Self(iota_sdk::crypto::ed25519::Ed25519PrivateKey::random())
}

/// Deserialize PKCS#8 private key from ASN.1 DER-encoded data (binary
Expand Down
7 changes: 2 additions & 5 deletions crates/iota-sdk-ffi/src/crypto/secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use iota_sdk::{
crypto::{FromMnemonic, ToFromBech32, ToFromBytes},
types::SignatureScheme,
};
use rand::rngs::OsRng;

use crate::{
error::{Result, SdkFfiError},
Expand Down Expand Up @@ -43,10 +42,8 @@ impl Secp256k1PrivateKey {
}

#[uniffi::constructor]
pub fn generate() -> Self {
Self(iota_sdk::crypto::secp256k1::Secp256k1PrivateKey::generate(
OsRng,
))
pub fn random() -> Self {
Self(iota_sdk::crypto::secp256k1::Secp256k1PrivateKey::random())
}

/// Deserialize PKCS#8 private key from ASN.1 DER-encoded data (binary
Expand Down
7 changes: 2 additions & 5 deletions crates/iota-sdk-ffi/src/crypto/secp256r1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use iota_sdk::{
crypto::{FromMnemonic, ToFromBech32, ToFromBytes, Verifier},
types::SignatureScheme,
};
use rand::rngs::OsRng;

use crate::{
error::{Result, SdkFfiError},
Expand Down Expand Up @@ -89,10 +88,8 @@ impl Secp256r1PrivateKey {

/// Generate a new random Secp256r1PrivateKey
#[uniffi::constructor]
pub fn generate() -> Self {
Self(iota_sdk::crypto::secp256r1::Secp256r1PrivateKey::generate(
OsRng,
))
pub fn random() -> Self {
Self(iota_sdk::crypto::secp256r1::Secp256r1PrivateKey::random())
}

/// Deserialize PKCS#8 private key from ASN.1 DER-encoded data (binary
Expand Down
5 changes: 2 additions & 3 deletions crates/iota-sdk-ffi/src/types/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ impl Address {
}

#[uniffi::constructor]
pub fn generate() -> Self {
let mut rng = rand::thread_rng();
Self(iota_sdk::types::Address::generate(&mut rng))
pub fn random() -> Self {
Self(iota_sdk::types::Address::random())
}

pub fn to_bytes(&self) -> Vec<u8> {
Expand Down
5 changes: 2 additions & 3 deletions crates/iota-sdk-ffi/src/types/crypto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ macro_rules! impl_crypto_object {
}

#[uniffi::constructor]
pub fn generate() -> Self {
let mut rng = rand::thread_rng();
Self(iota_sdk::types::$t::generate(&mut rng))
pub fn random() -> Self {
Self(iota_sdk::types::$t::random())
}

pub fn to_bytes(&self) -> Vec<u8> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl MoveAuthenticator {
call_args.into_iter().map(|v| v.0.clone()).collect(),
type_args.into_iter().map(|v| v.0.clone()).collect(),
**object_to_authenticate,
initial_shared_version,
iota_sdk::types::Version(initial_shared_version),
))
}

Expand Down
5 changes: 2 additions & 3 deletions crates/iota-sdk-ffi/src/types/digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ impl Digest {
}

#[uniffi::constructor]
pub fn generate() -> Self {
let mut rng = rand::thread_rng();
Self(iota_sdk::types::Digest::generate(&mut rng))
pub fn random() -> Self {
Self(iota_sdk::types::Digest::random())
}

pub fn to_bytes(&self) -> Vec<u8> {
Expand Down
1 change: 1 addition & 0 deletions crates/iota-sdk-ffi/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub mod struct_tag;
pub mod transaction;
pub mod type_tag;
pub mod validator;
pub mod version;

#[derive(Debug, PartialEq, Eq, derive_more::From, uniffi::Object)]
#[uniffi::export(Debug, Eq)]
Expand Down
Loading