From 509ca3ef0c5c7336833c0fec7bcd024e5cd01889 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 15 Oct 2025 16:57:45 +0200 Subject: [PATCH 1/6] chore: rename `type_` fields --- crates/iota-graphql-client/src/lib.rs | 12 +++---- .../src/output_types/mod.rs | 26 ++++++++------- .../src/query_types/dry_run.rs | 4 +-- .../src/query_types/dynamic_fields.rs | 10 +++--- .../src/query_types/events.rs | 1 + .../src/query_types/normalized_move/module.rs | 2 +- .../src/query_types/object.rs | 2 +- .../src/transaction_builder/mod.rs | 2 +- crates/iota-sdk-ffi/src/types/events.rs | 10 +++--- crates/iota-sdk-ffi/src/types/graphql.rs | 22 ++++++------- crates/iota-sdk-ffi/src/types/object.rs | 4 +-- .../iota-sdk-ffi/src/types/transaction/mod.rs | 4 +-- crates/iota-sdk-types/src/events.rs | 2 +- crates/iota-sdk-types/src/framework.rs | 2 +- crates/iota-sdk-types/src/object.rs | 32 +++++++++---------- crates/iota-sdk-types/src/transaction/mod.rs | 2 +- crates/iota-sdk/examples/dev_inspect.rs | 2 +- crates/iota-sdk/examples/objects_by_type.rs | 2 +- crates/iota-sdk/examples/unstake.rs | 2 +- .../src/builder/mod.rs | 4 +-- .../src/unresolved.rs | 4 +-- 21 files changed, 78 insertions(+), 73 deletions(-) diff --git a/crates/iota-graphql-client/src/lib.rs b/crates/iota-graphql-client/src/lib.rs index 4816ec16e..9a1439a00 100644 --- a/crates/iota-graphql-client/src/lib.rs +++ b/crates/iota-graphql-client/src/lib.rs @@ -633,7 +633,7 @@ impl Client { let response = self .objects( Some(ObjectFilter { - type_: Some( + type_tag: Some( coin_type .into() .map(StructTag::coin) @@ -932,7 +932,7 @@ impl Client { /// /// ```rust,ignore /// let filter = ObjectFilter { - /// type_: None, + /// type_tag: None, /// owner: Some(Address::from_str("test").unwrap().into()), /// object_ids: None, /// }; @@ -1622,14 +1622,14 @@ impl Client { pub async fn dynamic_field( &self, address: Address, - type_: TypeTag, + type_tag: TypeTag, name: impl Into, ) -> Result> { let bcs = name.into().0; let operation = DynamicFieldQuery::build(DynamicFieldArgs { address, name: crate::query_types::DynamicFieldName { - type_: type_.to_string(), + type_tag: type_tag.to_string(), bcs: crate::query_types::Base64(base64ct::Base64::encode_string(&bcs)), }, }); @@ -1662,14 +1662,14 @@ impl Client { pub async fn dynamic_object_field( &self, address: Address, - type_: TypeTag, + type_tag: TypeTag, name: impl Into, ) -> Result> { let bcs = name.into().0; let operation = DynamicObjectFieldQuery::build(DynamicFieldArgs { address, name: crate::query_types::DynamicFieldName { - type_: type_.to_string(), + type_tag: type_tag.to_string(), bcs: crate::query_types::Base64(base64ct::Base64::encode_string(&bcs)), }, }); diff --git a/crates/iota-graphql-client/src/output_types/mod.rs b/crates/iota-graphql-client/src/output_types/mod.rs index c98c72ea4..97898f980 100644 --- a/crates/iota-graphql-client/src/output_types/mod.rs +++ b/crates/iota-graphql-client/src/output_types/mod.rs @@ -76,7 +76,7 @@ pub struct DryRunMutation { /// The transaction argument that was mutated. pub input: TransactionArgument, /// The Move type of the mutated value. - pub type_: TypeTag, + pub type_tag: TypeTag, /// The BCS representation of the mutated value. pub bcs: Vec, } @@ -86,10 +86,14 @@ impl TryFrom<&GraphQLDryRunMutation> for DryRunMutation { fn try_from(mutation: &GraphQLDryRunMutation) -> Result { let input = TransactionArgument::try_from(&mutation.input)?; - let type_ = TypeTag::from_str(&mutation.type_.repr)?; + let type_tag = TypeTag::from_str(&mutation.type_tag.repr)?; let bcs = base64ct::Base64::decode_vec(&mutation.bcs.0)?; - Ok(DryRunMutation { input, type_, bcs }) + Ok(DryRunMutation { + input, + type_tag, + bcs, + }) } } @@ -97,7 +101,7 @@ impl TryFrom<&GraphQLDryRunMutation> for DryRunMutation { #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DryRunReturn { /// The Move type of the return value. - pub type_: TypeTag, + pub type_tag: TypeTag, /// The BCS representation of the return value. pub bcs: Vec, } @@ -106,10 +110,10 @@ impl TryFrom<&GraphQLDryRunReturn> for DryRunReturn { type Error = Error; fn try_from(return_val: &GraphQLDryRunReturn) -> Result { - let type_ = TypeTag::from_str(&return_val.type_.repr)?; + let type_tag = TypeTag::from_str(&return_val.move_type.repr)?; let bcs = base64ct::Base64::decode_vec(&return_val.bcs.0)?; - Ok(DryRunReturn { type_, bcs }) + Ok(DryRunReturn { type_tag, bcs }) } } @@ -171,7 +175,7 @@ pub struct TransactionDataEffects { #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct DynamicFieldName { /// The type name of this dynamic field name - pub type_: TypeTag, + pub type_tag: TypeTag, /// The bcs bytes of this dynamic field name pub bcs: Vec, /// The json representation of the dynamic field name @@ -181,7 +185,7 @@ pub struct DynamicFieldName { /// The value part of a dynamic field. #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct DynamicFieldValue { - pub type_: TypeTag, + pub type_tag: TypeTag, pub bcs: Vec, } @@ -221,9 +225,9 @@ impl DynamicFieldOutput { /// Deserialize the name of the dynamic field into the specified type. pub fn deserialize_name(&self, expected_type: &TypeTag) -> Result { assert_eq!( - expected_type, &self.name.type_, + expected_type, &self.name.type_tag, "Expected type {expected_type}, but got {}", - &self.name.type_ + &self.name.type_tag ); let bcs = &self.name.bcs; @@ -232,7 +236,7 @@ impl DynamicFieldOutput { /// Deserialize the value of the dynamic field into the specified type. pub fn deserialize_value(&self, expected_type: &TypeTag) -> Result { - let typetag = self.value.as_ref().map(|dfv| &dfv.type_); + let typetag = self.value.as_ref().map(|dfv| &dfv.type_tag); assert_eq!( Some(&expected_type), typetag.as_ref(), diff --git a/crates/iota-graphql-client/src/query_types/dry_run.rs b/crates/iota-graphql-client/src/query_types/dry_run.rs index 716b3487b..e91cd70d7 100644 --- a/crates/iota-graphql-client/src/query_types/dry_run.rs +++ b/crates/iota-graphql-client/src/query_types/dry_run.rs @@ -34,7 +34,7 @@ pub struct DryRunEffect { pub struct DryRunMutation { pub input: TransactionArgument, #[cynic(rename = "type")] - pub type_: MoveType, + pub type_tag: MoveType, pub bcs: Base64, } @@ -42,7 +42,7 @@ pub struct DryRunMutation { #[cynic(schema = "rpc", graphql_type = "DryRunReturn")] pub struct DryRunReturn { #[cynic(rename = "type")] - pub type_: MoveType, + pub move_type: MoveType, pub bcs: Base64, } diff --git a/crates/iota-graphql-client/src/query_types/dynamic_fields.rs b/crates/iota-graphql-client/src/query_types/dynamic_fields.rs index 358219efd..28fbb8624 100644 --- a/crates/iota-graphql-client/src/query_types/dynamic_fields.rs +++ b/crates/iota-graphql-client/src/query_types/dynamic_fields.rs @@ -89,7 +89,7 @@ pub enum DynamicFieldValue { #[cynic(schema = "rpc", graphql_type = "DynamicFieldName")] pub struct DynamicFieldName { #[cynic(rename = "type")] - pub type_: String, + pub type_tag: String, pub bcs: Base64, } @@ -123,12 +123,12 @@ impl DynamicFieldValue { match self { DynamicFieldValue::MoveObject(mo) => { mo.contents.as_ref().map(|o| crate::DynamicFieldValue { - type_: TypeTag::from_str(&o.type_.repr.clone()).expect("Invalid TypeTag"), + type_tag: TypeTag::from_str(&o.type_.repr.clone()).expect("Invalid TypeTag"), bcs: base64ct::Base64::decode_vec(&o.bcs.0).expect("Invalid Base64"), }) } DynamicFieldValue::MoveValue(mv) => Some(crate::DynamicFieldValue { - type_: TypeTag::from_str(&mv.type_.repr.clone()).expect("Invalid TypeTag"), + type_tag: TypeTag::from_str(&mv.type_.repr.clone()).expect("Invalid TypeTag"), bcs: base64ct::Base64::decode_vec(&mv.bcs.0).expect("Invalid Base64"), }), _ => None, @@ -147,7 +147,7 @@ impl TryFrom for DynamicFieldOutput { type Error = error::Error; fn try_from(val: DynamicField) -> Result { - let typetag = TypeTag::from_str( + let type_tag = TypeTag::from_str( val.name .as_ref() .expect("There should be a name in this dynamic field") @@ -157,7 +157,7 @@ impl TryFrom for DynamicFieldOutput { )?; Ok(DynamicFieldOutput { name: crate::DynamicFieldName { - type_: typetag, + type_tag: type_tag, bcs: base64ct::Base64::decode_vec(val.name.as_ref().unwrap().bcs.0.as_ref()) .unwrap(), json: val.name.as_ref().unwrap().json.clone(), diff --git a/crates/iota-graphql-client/src/query_types/events.rs b/crates/iota-graphql-client/src/query_types/events.rs index d4185cc09..8a1d6d259 100644 --- a/crates/iota-graphql-client/src/query_types/events.rs +++ b/crates/iota-graphql-client/src/query_types/events.rs @@ -56,6 +56,7 @@ pub struct EventFilter { pub struct Event { pub sending_module: Option, pub sender: Option, + // TODO thibault pub type_: MoveType, pub bcs: Base64, pub timestamp: Option, diff --git a/crates/iota-graphql-client/src/query_types/normalized_move/module.rs b/crates/iota-graphql-client/src/query_types/normalized_move/module.rs index fb5c09571..7ac474741 100644 --- a/crates/iota-graphql-client/src/query_types/normalized_move/module.rs +++ b/crates/iota-graphql-client/src/query_types/normalized_move/module.rs @@ -134,7 +134,7 @@ pub struct MoveEnumVariant { pub struct MoveField { pub name: String, #[cynic(rename = "type")] - pub type_: Option, + pub type_tag: Option, } #[derive(cynic::QueryFragment, Debug, Clone)] diff --git a/crates/iota-graphql-client/src/query_types/object.rs b/crates/iota-graphql-client/src/query_types/object.rs index 5428b048e..3a544552a 100644 --- a/crates/iota-graphql-client/src/query_types/object.rs +++ b/crates/iota-graphql-client/src/query_types/object.rs @@ -56,7 +56,7 @@ pub struct Object { #[cynic(schema = "rpc", graphql_type = "ObjectFilter")] pub struct ObjectFilter { #[cynic(rename = "type")] - pub type_: Option, + pub type_tag: Option, pub owner: Option
, pub object_ids: Option>, } diff --git a/crates/iota-sdk-ffi/src/transaction_builder/mod.rs b/crates/iota-sdk-ffi/src/transaction_builder/mod.rs index 093497600..cc19bbd27 100644 --- a/crates/iota-sdk-ffi/src/transaction_builder/mod.rs +++ b/crates/iota-sdk-ffi/src/transaction_builder/mod.rs @@ -234,7 +234,7 @@ impl TransactionBuilder { use iota_transaction_builder::unresolved::{Command, MakeMoveVector}; self.write(|builder| { let cmd = Command::MakeMoveVector(MakeMoveVector { - type_: Some(type_tag.0.clone()), + type_tag: Some(type_tag.0.clone()), elements: elements .iter() .map(|e| builder.apply_argument(e.as_ref())) diff --git a/crates/iota-sdk-ffi/src/types/events.rs b/crates/iota-sdk-ffi/src/types/events.rs index 4fb32c03a..34fc1970d 100644 --- a/crates/iota-sdk-ffi/src/types/events.rs +++ b/crates/iota-sdk-ffi/src/types/events.rs @@ -32,7 +32,7 @@ pub struct Event { /// emitted. pub sender: Arc
, /// The type of the event emitted - pub type_: String, + pub type_tag: String, /// BCS serialized bytes of the event pub contents: Vec, /// UTC timestamp in milliseconds since epoch (1/1/1970) @@ -52,7 +52,7 @@ impl From for Event { ))), module: sending_module.name.clone(), sender: Arc::new(Address(value.sender.as_ref().unwrap().address)), - type_: value.type_.repr.clone(), + type_tag: value.type_.repr.clone(), contents: base64ct::Base64::decode_vec(&value.bcs.0).unwrap_or_default(), timestamp: value.timestamp.as_ref().unwrap().0.clone(), data: value.data.0.to_string(), @@ -67,7 +67,7 @@ impl From for iota_types::Event { package_id: (**value.package_id), module: Identifier::from_str(&value.module).unwrap(), sender: (**value.sender), - type_: StructTag::from_str(&value.type_).unwrap(), + type_tag: StructTag::from_str(&value.type_tag).unwrap(), contents: value.contents, } } @@ -87,7 +87,7 @@ impl From for iota_graphql_client::query_types::Event { address: (**value.sender), }), type_: MoveType { - repr: value.type_.clone(), + repr: value.type_tag.clone(), }, bcs: Base64(base64ct::Base64::encode_string(&value.contents)), timestamp: Some(DateTime(value.timestamp.clone())), @@ -103,7 +103,7 @@ impl From for Event { package_id: Arc::new(value.package_id.into()), module: value.module.to_string(), sender: Arc::new(value.sender.into()), - type_: value.type_.to_string(), + type_tag: value.type_tag.to_string(), contents: value.contents, timestamp: String::new(), data: String::new(), diff --git a/crates/iota-sdk-ffi/src/types/graphql.rs b/crates/iota-sdk-ffi/src/types/graphql.rs index f6c05ea8d..1270a2b52 100644 --- a/crates/iota-sdk-ffi/src/types/graphql.rs +++ b/crates/iota-sdk-ffi/src/types/graphql.rs @@ -216,7 +216,7 @@ pub struct DryRunReturn { impl From for DryRunReturn { fn from(value: iota_graphql_client::DryRunReturn) -> Self { DryRunReturn { - type_tag: Arc::new(value.type_.into()), + type_tag: Arc::new(value.type_tag.into()), bcs: value.bcs, } } @@ -225,7 +225,7 @@ impl From for DryRunReturn { impl From for iota_graphql_client::DryRunReturn { fn from(value: DryRunReturn) -> Self { iota_graphql_client::DryRunReturn { - type_: value.type_tag.0.clone(), + type_tag: value.type_tag.0.clone(), bcs: value.bcs, } } @@ -246,7 +246,7 @@ impl From for DryRunMutation { fn from(value: iota_graphql_client::DryRunMutation) -> Self { DryRunMutation { input: value.input.into(), - type_tag: Arc::new(value.type_.into()), + type_tag: Arc::new(value.type_tag.into()), bcs: value.bcs, } } @@ -256,7 +256,7 @@ impl From for iota_graphql_client::DryRunMutation { fn from(value: DryRunMutation) -> Self { iota_graphql_client::DryRunMutation { input: value.input.into(), - type_: value.type_tag.0.clone(), + type_tag: value.type_tag.0.clone(), bcs: value.bcs, } } @@ -617,7 +617,7 @@ pub struct ObjectFilter { impl From for ObjectFilter { fn from(value: iota_graphql_client::query_types::ObjectFilter) -> Self { Self { - type_tag: value.type_, + type_tag: value.type_tag, owner: value.owner.map(Into::into).map(Arc::new), object_ids: value .object_ids @@ -629,7 +629,7 @@ impl From for ObjectFilter { impl From for iota_graphql_client::query_types::ObjectFilter { fn from(value: ObjectFilter) -> Self { Self { - type_: value.type_tag, + type_tag: value.type_tag, owner: value.owner.map(|v| **v), object_ids: value .object_ids @@ -688,7 +688,7 @@ pub struct DynamicFieldName { impl From for DynamicFieldName { fn from(value: iota_graphql_client::DynamicFieldName) -> Self { Self { - type_tag: Arc::new(value.type_.into()), + type_tag: Arc::new(value.type_tag.into()), bcs: value.bcs, json: value.json, } @@ -698,7 +698,7 @@ impl From for DynamicFieldName { impl From for iota_graphql_client::DynamicFieldName { fn from(value: DynamicFieldName) -> Self { Self { - type_: value.type_tag.0.clone(), + type_tag: value.type_tag.0.clone(), bcs: value.bcs, json: value.json, } @@ -715,7 +715,7 @@ pub struct DynamicFieldValue { impl From for DynamicFieldValue { fn from(value: iota_graphql_client::DynamicFieldValue) -> Self { Self { - type_tag: Arc::new(value.type_.into()), + type_tag: Arc::new(value.type_tag.into()), bcs: value.bcs, } } @@ -724,7 +724,7 @@ impl From for DynamicFieldValue { impl From for iota_graphql_client::DynamicFieldValue { fn from(value: DynamicFieldValue) -> Self { Self { - type_: value.type_tag.0.clone(), + type_tag: value.type_tag.0.clone(), bcs: value.bcs, } } @@ -1284,7 +1284,7 @@ pub struct MoveField { pub name: String, #[uniffi::field(name = "type")] #[uniffi(default = None)] - pub type_: Option, + pub type_tag: Option, } #[uniffi::remote(Record)] diff --git a/crates/iota-sdk-ffi/src/types/object.rs b/crates/iota-sdk-ffi/src/types/object.rs index 3683586c5..bf7c091ba 100644 --- a/crates/iota-sdk-ffi/src/types/object.rs +++ b/crates/iota-sdk-ffi/src/types/object.rs @@ -465,7 +465,7 @@ pub struct MoveStruct { impl From for MoveStruct { fn from(value: iota_types::MoveStruct) -> Self { Self { - struct_type: Arc::new(value.type_.into()), + struct_type: Arc::new(value.type_tag.into()), version: value.version, contents: value.contents, } @@ -475,7 +475,7 @@ impl From for MoveStruct { impl From for iota_types::MoveStruct { fn from(value: MoveStruct) -> Self { Self { - type_: value.struct_type.0.clone(), + type_tag: value.struct_type.0.clone(), version: value.version, contents: value.contents, } diff --git a/crates/iota-sdk-ffi/src/types/transaction/mod.rs b/crates/iota-sdk-ffi/src/types/transaction/mod.rs index 180afe8e3..0c2a8657f 100644 --- a/crates/iota-sdk-ffi/src/types/transaction/mod.rs +++ b/crates/iota-sdk-ffi/src/types/transaction/mod.rs @@ -538,7 +538,7 @@ impl MakeMoveVector { #[uniffi::constructor] pub fn new(type_tag: Option>, elements: Vec>) -> Self { Self(iota_types::MakeMoveVector { - type_: type_tag.map(|type_tag| type_tag.0.clone()), + type_tag: type_tag.map(|type_tag| type_tag.0.clone()), elements: elements.iter().map(|element| element.0).collect(), }) } @@ -548,7 +548,7 @@ impl MakeMoveVector { /// This is required to be set when the type can't be inferred, for example /// when the set of provided arguments are all pure input values. pub fn type_tag(&self) -> Option> { - self.0.type_.clone().map(Into::into).map(Arc::new) + self.0.type_tag.clone().map(Into::into).map(Arc::new) } /// The set individual elements to build the vector with diff --git a/crates/iota-sdk-types/src/events.rs b/crates/iota-sdk-types/src/events.rs index 900788b68..d3d933fdd 100644 --- a/crates/iota-sdk-types/src/events.rs +++ b/crates/iota-sdk-types/src/events.rs @@ -50,7 +50,7 @@ pub struct Event { pub sender: Address, /// The type of the event emitted #[cfg_attr(feature = "serde", serde(rename = "type"))] - pub type_: StructTag, + pub type_tag: StructTag, /// BCS serialized bytes of the event #[cfg_attr( feature = "serde", diff --git a/crates/iota-sdk-types/src/framework.rs b/crates/iota-sdk-types/src/framework.rs index 5cb9cf478..f38322e43 100644 --- a/crates/iota-sdk-types/src/framework.rs +++ b/crates/iota-sdk-types/src/framework.rs @@ -30,7 +30,7 @@ impl Coin { match &object.data { super::ObjectData::Struct(move_struct) => { let coin_type = move_struct - .type_ + .type_tag .coin_type_opt() .ok_or(CoinFromObjectError::NotACoin)?; diff --git a/crates/iota-sdk-types/src/object.rs b/crates/iota-sdk-types/src/object.rs index 8b5471fdf..6e467f190 100644 --- a/crates/iota-sdk-types/src/object.rs +++ b/crates/iota-sdk-types/src/object.rs @@ -304,7 +304,7 @@ pub struct MoveStruct { feature = "serde", serde(with = "::serde_with::As::") )] - pub type_: StructTag, + pub type_tag: StructTag, /// Number that increases each time a tx takes this object as a mutable /// input This is a lamport timestamp, not a sequentially increasing /// version @@ -412,7 +412,7 @@ impl Object { /// Return this object's type pub fn object_type(&self) -> ObjectType { match &self.data { - ObjectData::Struct(struct_) => ObjectType::Struct(struct_.type_.clone()), + ObjectData::Struct(struct_) => ObjectType::Struct(struct_.type_tag.clone()), ObjectData::Package(_) => ObjectType::Package, } } @@ -526,7 +526,7 @@ impl GenesisObject { pub fn object_type(&self) -> ObjectType { match &self.data { - ObjectData::Struct(struct_) => ObjectType::Struct(struct_.type_.clone()), + ObjectData::Struct(struct_) => ObjectType::Struct(struct_.type_tag.clone()), ObjectData::Package(_) => ObjectType::Package, } } @@ -708,7 +708,7 @@ mod serialization { #[serde(with = "::serde_with::As::")] #[serde(rename = "type")] #[cfg_attr(feature = "schemars", schemars(with = "String"))] - type_: ObjectType, + object_type: ObjectType, #[serde(flatten)] data: ReadableObjectData, previous_transaction: Digest, @@ -799,7 +799,7 @@ mod serialization { owner: self.owner, previous_transaction: self.previous_transaction, storage_rebate: self.storage_rebate, - type_: self.object_type(), + object_type: self.object_type(), data: self.readable_object_data(), }; readable.serialize(serializer) @@ -827,12 +827,12 @@ mod serialization { owner, previous_transaction, storage_rebate, - type_, + object_type, data, } = Deserialize::deserialize(deserializer)?; // check if package or struct - let data = match (type_, data) { + let data = match (object_type, data) { ( ObjectType::Package, ReadableObjectData::Package(ReadablePackage { @@ -848,7 +848,7 @@ mod serialization { linkage_table, }), ( - ObjectType::Struct(type_), + ObjectType::Struct(type_tag), ReadableObjectData::Move(ReadableMoveStruct { contents }), ) => { // check id matches in contents @@ -857,7 +857,7 @@ mod serialization { } ObjectData::Struct(MoveStruct { - type_, + type_tag, version, contents, }) @@ -909,7 +909,7 @@ mod serialization { #[serde(with = "::serde_with::As::")] #[serde(rename = "type")] #[cfg_attr(feature = "schemars", schemars(with = "String"))] - type_: ObjectType, + object_type: ObjectType, #[serde(flatten)] data: ReadableObjectData, } @@ -955,7 +955,7 @@ mod serialization { object_id: self.object_id(), version: self.version(), owner: self.owner, - type_: self.object_type(), + object_type: self.object_type(), data: self.readable_object_data(), }; readable.serialize(serializer) @@ -979,12 +979,12 @@ mod serialization { object_id, version, owner, - type_, + object_type, data, } = Deserialize::deserialize(deserializer)?; // check if package or struct - let data = match (type_, data) { + let data = match (object_type, data) { ( ObjectType::Package, ReadableObjectData::Package(ReadablePackage { @@ -1000,7 +1000,7 @@ mod serialization { linkage_table, }), ( - ObjectType::Struct(type_), + ObjectType::Struct(type_tag), ReadableObjectData::Move(ReadableMoveStruct { contents }), ) => { // check id matches in contents @@ -1009,7 +1009,7 @@ mod serialization { } ObjectData::Struct(MoveStruct { - type_, + type_tag, version, contents, }) @@ -1039,7 +1039,7 @@ mod serialization { fn obj() { let o = Object { data: ObjectData::Struct(MoveStruct { - type_: StructTag { + type_tag: StructTag { address: Address::FRAMEWORK, module: Identifier::new("bar").unwrap(), name: Identifier::new("foo").unwrap(), diff --git a/crates/iota-sdk-types/src/transaction/mod.rs b/crates/iota-sdk-types/src/transaction/mod.rs index 6cfde807b..6d1468b9f 100644 --- a/crates/iota-sdk-types/src/transaction/mod.rs +++ b/crates/iota-sdk-types/src/transaction/mod.rs @@ -1043,7 +1043,7 @@ pub struct MakeMoveVector { /// This is required to be set when the type can't be inferred, for example /// when the set of provided arguments are all pure input values. #[cfg_attr(feature = "serde", serde(rename = "type"))] - pub type_: Option, + pub type_tag: Option, /// The set individual elements to build the vector with #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))] pub elements: Vec, diff --git a/crates/iota-sdk/examples/dev_inspect.rs b/crates/iota-sdk/examples/dev_inspect.rs index 34bb469b1..0b30ae91d 100644 --- a/crates/iota-sdk/examples/dev_inspect.rs +++ b/crates/iota-sdk/examples/dev_inspect.rs @@ -85,7 +85,7 @@ async fn main() -> Result<()> { .results .last() .and_then(|effect| effect.return_values.first()) - .filter(|rv| matches!(rv.type_, TypeTag::Address)) + .filter(|rv| matches!(rv.type_tag, TypeTag::Address)) .and_then(|rv| TryInto::<[u8; 32]>::try_into(rv.bcs.as_slice()).ok()) .map(Address::from) { diff --git a/crates/iota-sdk/examples/objects_by_type.rs b/crates/iota-sdk/examples/objects_by_type.rs index 1d91c9ba9..8c8d996d5 100644 --- a/crates/iota-sdk/examples/objects_by_type.rs +++ b/crates/iota-sdk/examples/objects_by_type.rs @@ -10,7 +10,7 @@ async fn main() -> Result<()> { let staked_iotas = client .objects( ObjectFilter { - type_: "0x3::staking_pool::StakedIota".to_owned().into(), + type_tag: "0x3::staking_pool::StakedIota".to_owned().into(), ..Default::default() }, Default::default(), diff --git a/crates/iota-sdk/examples/unstake.rs b/crates/iota-sdk/examples/unstake.rs index c094f9fae..24ecaea50 100644 --- a/crates/iota-sdk/examples/unstake.rs +++ b/crates/iota-sdk/examples/unstake.rs @@ -13,7 +13,7 @@ async fn main() -> Result<()> { let staked_iota = client .objects( ObjectFilter { - type_: "0x3::staking_pool::StakedIota".to_owned().into(), + type_tag: "0x3::staking_pool::StakedIota".to_owned().into(), ..Default::default() }, Default::default(), diff --git a/crates/iota-transaction-builder/src/builder/mod.rs b/crates/iota-transaction-builder/src/builder/mod.rs index 0fd3097fa..33d211330 100644 --- a/crates/iota-transaction-builder/src/builder/mod.rs +++ b/crates/iota-transaction-builder/src/builder/mod.rs @@ -478,7 +478,7 @@ impl TransactionBuilder { .map(|e| self.apply_argument(e)) .collect(); self.cmd_state_change(MakeMoveVector { - type_: Some(T::type_tag()), + type_tag: Some(T::type_tag()), elements, }) } @@ -608,7 +608,7 @@ impl TransactionBuilder { .client .objects( ObjectFilter { - type_: Some(StructTag::gas_coin().to_string()), + type_tag: Some(StructTag::gas_coin().to_string()), owner: Some(self.data.sender), ..Default::default() }, diff --git a/crates/iota-transaction-builder/src/unresolved.rs b/crates/iota-transaction-builder/src/unresolved.rs index b8ea30769..bfa93cb2c 100644 --- a/crates/iota-transaction-builder/src/unresolved.rs +++ b/crates/iota-transaction-builder/src/unresolved.rs @@ -141,14 +141,14 @@ impl Upgrade { #[derive(Debug, Clone)] pub struct MakeMoveVector { - pub type_: Option, + pub type_tag: Option, pub elements: Vec, } impl MakeMoveVector { fn resolve(self, input_map: &HashMap) -> iota_types::MakeMoveVector { iota_types::MakeMoveVector { - type_: self.type_, + type_tag: self.type_tag, elements: self .elements .into_iter() From 6a9b1d04aa9ad8c780b54ba3e4401b903a37bc96 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 15 Oct 2025 16:58:55 +0200 Subject: [PATCH 2/6] update bindings --- bindings/go/iota_sdk_ffi/iota_sdk_ffi.go | 12 +++---- bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt | 14 ++++---- bindings/python/lib/iota_sdk_ffi.py | 36 ++++++++++---------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/bindings/go/iota_sdk_ffi/iota_sdk_ffi.go b/bindings/go/iota_sdk_ffi/iota_sdk_ffi.go index bfdbc524b..2c354330c 100644 --- a/bindings/go/iota_sdk_ffi/iota_sdk_ffi.go +++ b/bindings/go/iota_sdk_ffi/iota_sdk_ffi.go @@ -26136,7 +26136,7 @@ type Event struct { // emitted. Sender *Address // The type of the event emitted - Type string + TypeTag string // BCS serialized bytes of the event Contents []byte // UTC timestamp in milliseconds since epoch (1/1/1970) @@ -26151,7 +26151,7 @@ func (r *Event) Destroy() { FfiDestroyerObjectId{}.Destroy(r.PackageId); FfiDestroyerString{}.Destroy(r.Module); FfiDestroyerAddress{}.Destroy(r.Sender); - FfiDestroyerString{}.Destroy(r.Type); + FfiDestroyerString{}.Destroy(r.TypeTag); FfiDestroyerBytes{}.Destroy(r.Contents); FfiDestroyerString{}.Destroy(r.Timestamp); FfiDestroyerString{}.Destroy(r.Data); @@ -26187,7 +26187,7 @@ func (c FfiConverterEvent) Write(writer io.Writer, value Event) { FfiConverterObjectIdINSTANCE.Write(writer, value.PackageId); FfiConverterStringINSTANCE.Write(writer, value.Module); FfiConverterAddressINSTANCE.Write(writer, value.Sender); - FfiConverterStringINSTANCE.Write(writer, value.Type); + FfiConverterStringINSTANCE.Write(writer, value.TypeTag); FfiConverterBytesINSTANCE.Write(writer, value.Contents); FfiConverterStringINSTANCE.Write(writer, value.Timestamp); FfiConverterStringINSTANCE.Write(writer, value.Data); @@ -26760,12 +26760,12 @@ func (_ FfiDestroyerMoveEnumVariant) Destroy(value MoveEnumVariant) { } type MoveField struct { Name string - Type *OpenMoveType + TypeTag *OpenMoveType } func (r *MoveField) Destroy() { FfiDestroyerString{}.Destroy(r.Name); - FfiDestroyerOptionalOpenMoveType{}.Destroy(r.Type); + FfiDestroyerOptionalOpenMoveType{}.Destroy(r.TypeTag); } type FfiConverterMoveField struct {} @@ -26789,7 +26789,7 @@ func (c FfiConverterMoveField) Lower(value MoveField) C.RustBuffer { func (c FfiConverterMoveField) Write(writer io.Writer, value MoveField) { FfiConverterStringINSTANCE.Write(writer, value.Name); - FfiConverterOptionalOpenMoveTypeINSTANCE.Write(writer, value.Type); + FfiConverterOptionalOpenMoveTypeINSTANCE.Write(writer, value.TypeTag); } type FfiDestroyerMoveField struct {} diff --git a/bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt b/bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt index f4f3c06f3..322710a47 100644 --- a/bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt +++ b/bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt @@ -46296,7 +46296,7 @@ data class Event ( /** * The type of the event emitted */ - var `type`: kotlin.String, + var `typeTag`: kotlin.String, /** * BCS serialized bytes of the event */ @@ -46322,7 +46322,7 @@ data class Event ( this.`packageId`, this.`module`, this.`sender`, - this.`type`, + this.`typeTag`, this.`contents`, this.`timestamp`, this.`data`, @@ -46354,7 +46354,7 @@ public object FfiConverterTypeEvent: FfiConverterRustBuffer { FfiConverterTypeObjectId.allocationSize(value.`packageId`) + FfiConverterString.allocationSize(value.`module`) + FfiConverterTypeAddress.allocationSize(value.`sender`) + - FfiConverterString.allocationSize(value.`type`) + + FfiConverterString.allocationSize(value.`typeTag`) + FfiConverterByteArray.allocationSize(value.`contents`) + FfiConverterString.allocationSize(value.`timestamp`) + FfiConverterString.allocationSize(value.`data`) + @@ -46365,7 +46365,7 @@ public object FfiConverterTypeEvent: FfiConverterRustBuffer { FfiConverterTypeObjectId.write(value.`packageId`, buf) FfiConverterString.write(value.`module`, buf) FfiConverterTypeAddress.write(value.`sender`, buf) - FfiConverterString.write(value.`type`, buf) + FfiConverterString.write(value.`typeTag`, buf) FfiConverterByteArray.write(value.`contents`, buf) FfiConverterString.write(value.`timestamp`, buf) FfiConverterString.write(value.`data`, buf) @@ -46948,7 +46948,7 @@ public object FfiConverterTypeMoveEnumVariant: FfiConverterRustBuffer { override fun allocationSize(value: MoveField) = ( FfiConverterString.allocationSize(value.`name`) + - FfiConverterOptionalTypeOpenMoveType.allocationSize(value.`type`) + FfiConverterOptionalTypeOpenMoveType.allocationSize(value.`typeTag`) ) override fun write(value: MoveField, buf: ByteBuffer) { FfiConverterString.write(value.`name`, buf) - FfiConverterOptionalTypeOpenMoveType.write(value.`type`, buf) + FfiConverterOptionalTypeOpenMoveType.write(value.`typeTag`, buf) } } diff --git a/bindings/python/lib/iota_sdk_ffi.py b/bindings/python/lib/iota_sdk_ffi.py index 65813b446..d3ec0ae2a 100644 --- a/bindings/python/lib/iota_sdk_ffi.py +++ b/bindings/python/lib/iota_sdk_ffi.py @@ -11201,7 +11201,7 @@ class Event: emitted. """ - type: "str" + type_tag: "str" """ The type of the event emitted """ @@ -11226,18 +11226,18 @@ class Event: Representation of a Move value in JSON """ - def __init__(self, *, package_id: "ObjectId", module: "str", sender: "Address", type: "str", contents: "bytes", timestamp: "str", data: "str", json: "str"): + def __init__(self, *, package_id: "ObjectId", module: "str", sender: "Address", type_tag: "str", contents: "bytes", timestamp: "str", data: "str", json: "str"): self.package_id = package_id self.module = module self.sender = sender - self.type = type + self.type_tag = type_tag self.contents = contents self.timestamp = timestamp self.data = data self.json = json def __str__(self): - return "Event(package_id={}, module={}, sender={}, type={}, contents={}, timestamp={}, data={}, json={})".format(self.package_id, self.module, self.sender, self.type, self.contents, self.timestamp, self.data, self.json) + return "Event(package_id={}, module={}, sender={}, type_tag={}, contents={}, timestamp={}, data={}, json={})".format(self.package_id, self.module, self.sender, self.type_tag, self.contents, self.timestamp, self.data, self.json) def __eq__(self, other): if self.package_id != other.package_id: @@ -11246,7 +11246,7 @@ def __eq__(self, other): return False if self.sender != other.sender: return False - if self.type != other.type: + if self.type_tag != other.type_tag: return False if self.contents != other.contents: return False @@ -11265,7 +11265,7 @@ def read(buf): package_id=_UniffiConverterTypeObjectId.read(buf), module=_UniffiConverterString.read(buf), sender=_UniffiConverterTypeAddress.read(buf), - type=_UniffiConverterString.read(buf), + type_tag=_UniffiConverterString.read(buf), contents=_UniffiConverterBytes.read(buf), timestamp=_UniffiConverterString.read(buf), data=_UniffiConverterString.read(buf), @@ -11277,7 +11277,7 @@ def check_lower(value): _UniffiConverterTypeObjectId.check_lower(value.package_id) _UniffiConverterString.check_lower(value.module) _UniffiConverterTypeAddress.check_lower(value.sender) - _UniffiConverterString.check_lower(value.type) + _UniffiConverterString.check_lower(value.type_tag) _UniffiConverterBytes.check_lower(value.contents) _UniffiConverterString.check_lower(value.timestamp) _UniffiConverterString.check_lower(value.data) @@ -11288,7 +11288,7 @@ def write(value, buf): _UniffiConverterTypeObjectId.write(value.package_id, buf) _UniffiConverterString.write(value.module, buf) _UniffiConverterTypeAddress.write(value.sender, buf) - _UniffiConverterString.write(value.type, buf) + _UniffiConverterString.write(value.type_tag, buf) _UniffiConverterBytes.write(value.contents, buf) _UniffiConverterString.write(value.timestamp, buf) _UniffiConverterString.write(value.data, buf) @@ -11937,21 +11937,21 @@ def write(value, buf): class MoveField: name: "str" - type: "typing.Optional[OpenMoveType]" - def __init__(self, *, name: "str", type: "typing.Optional[OpenMoveType]" = _DEFAULT): + type_tag: "typing.Optional[OpenMoveType]" + def __init__(self, *, name: "str", type_tag: "typing.Optional[OpenMoveType]" = _DEFAULT): self.name = name - if type is _DEFAULT: - self.type = None + if type_tag is _DEFAULT: + self.type_tag = None else: - self.type = type + self.type_tag = type_tag def __str__(self): - return "MoveField(name={}, type={})".format(self.name, self.type) + return "MoveField(name={}, type_tag={})".format(self.name, self.type_tag) def __eq__(self, other): if self.name != other.name: return False - if self.type != other.type: + if self.type_tag != other.type_tag: return False return True @@ -11960,18 +11960,18 @@ class _UniffiConverterTypeMoveField(_UniffiConverterRustBuffer): def read(buf): return MoveField( name=_UniffiConverterString.read(buf), - type=_UniffiConverterOptionalTypeOpenMoveType.read(buf), + type_tag=_UniffiConverterOptionalTypeOpenMoveType.read(buf), ) @staticmethod def check_lower(value): _UniffiConverterString.check_lower(value.name) - _UniffiConverterOptionalTypeOpenMoveType.check_lower(value.type) + _UniffiConverterOptionalTypeOpenMoveType.check_lower(value.type_tag) @staticmethod def write(value, buf): _UniffiConverterString.write(value.name, buf) - _UniffiConverterOptionalTypeOpenMoveType.write(value.type, buf) + _UniffiConverterOptionalTypeOpenMoveType.write(value.type_tag, buf) class MoveFunctionConnection: From 026a63feec8accd57b3595266bd2d600d07099d6 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 15 Oct 2025 17:02:04 +0200 Subject: [PATCH 3/6] nit --- crates/iota-graphql-client/src/output_types/mod.rs | 2 +- crates/iota-graphql-client/src/query_types/dry_run.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/iota-graphql-client/src/output_types/mod.rs b/crates/iota-graphql-client/src/output_types/mod.rs index 97898f980..00b88a7ce 100644 --- a/crates/iota-graphql-client/src/output_types/mod.rs +++ b/crates/iota-graphql-client/src/output_types/mod.rs @@ -86,7 +86,7 @@ impl TryFrom<&GraphQLDryRunMutation> for DryRunMutation { fn try_from(mutation: &GraphQLDryRunMutation) -> Result { let input = TransactionArgument::try_from(&mutation.input)?; - let type_tag = TypeTag::from_str(&mutation.type_tag.repr)?; + let type_tag = TypeTag::from_str(&mutation.move_type.repr)?; let bcs = base64ct::Base64::decode_vec(&mutation.bcs.0)?; Ok(DryRunMutation { diff --git a/crates/iota-graphql-client/src/query_types/dry_run.rs b/crates/iota-graphql-client/src/query_types/dry_run.rs index e91cd70d7..d415ba1a1 100644 --- a/crates/iota-graphql-client/src/query_types/dry_run.rs +++ b/crates/iota-graphql-client/src/query_types/dry_run.rs @@ -34,7 +34,7 @@ pub struct DryRunEffect { pub struct DryRunMutation { pub input: TransactionArgument, #[cynic(rename = "type")] - pub type_tag: MoveType, + pub move_type: MoveType, pub bcs: Base64, } From 48810939ef28d4e937669a1147efd3a503275314 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 29 Oct 2025 14:57:26 +0100 Subject: [PATCH 4/6] type_filter --- bindings/go/iota_sdk_ffi/iota_sdk_ffi.go | 6 +++--- bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt | 8 ++++---- bindings/python/lib/iota_sdk_ffi.py | 20 +++++++++---------- crates/iota-sdk-ffi/src/types/graphql.rs | 6 +++--- crates/iota-sdk-graphql-client/src/lib.rs | 2 +- .../src/query_types/object.rs | 2 +- .../src/builder/mod.rs | 2 +- crates/iota-sdk/examples/objects_by_type.rs | 2 +- crates/iota-sdk/examples/publish_upgrade.rs | 2 +- crates/iota-sdk/examples/unstake.rs | 2 +- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/bindings/go/iota_sdk_ffi/iota_sdk_ffi.go b/bindings/go/iota_sdk_ffi/iota_sdk_ffi.go index d0e1feeba..e872d2413 100644 --- a/bindings/go/iota_sdk_ffi/iota_sdk_ffi.go +++ b/bindings/go/iota_sdk_ffi/iota_sdk_ffi.go @@ -30321,13 +30321,13 @@ func (_ FfiDestroyerNameRegistrationPage) Destroy(value NameRegistrationPage) { value.Destroy() } type ObjectFilter struct { - TypeTag *string + TypeFilter *string Owner **Address ObjectIds *[]*ObjectId } func (r *ObjectFilter) Destroy() { - FfiDestroyerOptionalString{}.Destroy(r.TypeTag); + FfiDestroyerOptionalString{}.Destroy(r.TypeFilter); FfiDestroyerOptionalAddress{}.Destroy(r.Owner); FfiDestroyerOptionalSequenceObjectId{}.Destroy(r.ObjectIds); } @@ -30353,7 +30353,7 @@ func (c FfiConverterObjectFilter) Lower(value ObjectFilter) C.RustBuffer { } func (c FfiConverterObjectFilter) Write(writer io.Writer, value ObjectFilter) { - FfiConverterOptionalStringINSTANCE.Write(writer, value.TypeTag); + FfiConverterOptionalStringINSTANCE.Write(writer, value.TypeFilter); FfiConverterOptionalAddressINSTANCE.Write(writer, value.Owner); FfiConverterOptionalSequenceObjectIdINSTANCE.Write(writer, value.ObjectIds); } diff --git a/bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt b/bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt index a7b48cf0b..f5e8565a8 100644 --- a/bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt +++ b/bindings/kotlin/lib/iota_sdk/iota_sdk_ffi.kt @@ -51204,7 +51204,7 @@ public object FfiConverterTypeNameRegistrationPage: FfiConverterRustBuffer? = null ) : Disposable { @@ -51213,7 +51213,7 @@ data class ObjectFilter ( override fun destroy() { Disposable.destroy( - this.`typeTag`, + this.`typeFilter`, this.`owner`, this.`objectIds` ) @@ -51235,13 +51235,13 @@ public object FfiConverterTypeObjectFilter: FfiConverterRustBuffer } override fun allocationSize(value: ObjectFilter) = ( - FfiConverterOptionalString.allocationSize(value.`typeTag`) + + FfiConverterOptionalString.allocationSize(value.`typeFilter`) + FfiConverterOptionalTypeAddress.allocationSize(value.`owner`) + FfiConverterOptionalSequenceTypeObjectId.allocationSize(value.`objectIds`) ) override fun write(value: ObjectFilter, buf: ByteBuffer) { - FfiConverterOptionalString.write(value.`typeTag`, buf) + FfiConverterOptionalString.write(value.`typeFilter`, buf) FfiConverterOptionalTypeAddress.write(value.`owner`, buf) FfiConverterOptionalSequenceTypeObjectId.write(value.`objectIds`, buf) } diff --git a/bindings/python/lib/iota_sdk_ffi.py b/bindings/python/lib/iota_sdk_ffi.py index c9e537a4e..89b0f6667 100644 --- a/bindings/python/lib/iota_sdk_ffi.py +++ b/bindings/python/lib/iota_sdk_ffi.py @@ -15265,14 +15265,14 @@ def write(value, buf): class ObjectFilter: - type_tag: "typing.Optional[str]" + type_filter: "typing.Optional[str]" owner: "typing.Optional[Address]" object_ids: "typing.Optional[typing.List[ObjectId]]" - def __init__(self, *, type_tag: "typing.Optional[str]" = _DEFAULT, owner: "typing.Optional[Address]" = _DEFAULT, object_ids: "typing.Optional[typing.List[ObjectId]]" = _DEFAULT): - if type_tag is _DEFAULT: - self.type_tag = None + def __init__(self, *, type_filter: "typing.Optional[str]" = _DEFAULT, owner: "typing.Optional[Address]" = _DEFAULT, object_ids: "typing.Optional[typing.List[ObjectId]]" = _DEFAULT): + if type_filter is _DEFAULT: + self.type_filter = None else: - self.type_tag = type_tag + self.type_filter = type_filter if owner is _DEFAULT: self.owner = None else: @@ -15283,10 +15283,10 @@ def __init__(self, *, type_tag: "typing.Optional[str]" = _DEFAULT, owner: "typin self.object_ids = object_ids def __str__(self): - return "ObjectFilter(type_tag={}, owner={}, object_ids={})".format(self.type_tag, self.owner, self.object_ids) + return "ObjectFilter(type_filter={}, owner={}, object_ids={})".format(self.type_filter, self.owner, self.object_ids) def __eq__(self, other): - if self.type_tag != other.type_tag: + if self.type_filter != other.type_filter: return False if self.owner != other.owner: return False @@ -15298,20 +15298,20 @@ class _UniffiConverterTypeObjectFilter(_UniffiConverterRustBuffer): @staticmethod def read(buf): return ObjectFilter( - type_tag=_UniffiConverterOptionalString.read(buf), + type_filter=_UniffiConverterOptionalString.read(buf), owner=_UniffiConverterOptionalTypeAddress.read(buf), object_ids=_UniffiConverterOptionalSequenceTypeObjectId.read(buf), ) @staticmethod def check_lower(value): - _UniffiConverterOptionalString.check_lower(value.type_tag) + _UniffiConverterOptionalString.check_lower(value.type_filter) _UniffiConverterOptionalTypeAddress.check_lower(value.owner) _UniffiConverterOptionalSequenceTypeObjectId.check_lower(value.object_ids) @staticmethod def write(value, buf): - _UniffiConverterOptionalString.write(value.type_tag, buf) + _UniffiConverterOptionalString.write(value.type_filter, buf) _UniffiConverterOptionalTypeAddress.write(value.owner, buf) _UniffiConverterOptionalSequenceTypeObjectId.write(value.object_ids, buf) diff --git a/crates/iota-sdk-ffi/src/types/graphql.rs b/crates/iota-sdk-ffi/src/types/graphql.rs index d4b8a35a8..cf3dbf52c 100644 --- a/crates/iota-sdk-ffi/src/types/graphql.rs +++ b/crates/iota-sdk-ffi/src/types/graphql.rs @@ -609,7 +609,7 @@ impl From for iota_sdk::graphql_client::query_types::EventFilter { #[derive(uniffi::Record)] pub struct ObjectFilter { #[uniffi(default = None)] - pub type_tag: Option, + pub type_filter: Option, #[uniffi(default = None)] pub owner: Option>, #[uniffi(default = None)] @@ -619,7 +619,7 @@ pub struct ObjectFilter { impl From for ObjectFilter { fn from(value: iota_sdk::graphql_client::query_types::ObjectFilter) -> Self { Self { - type_tag: value.type_tag, + type_filter: value.type_filter, owner: value.owner.map(Into::into).map(Arc::new), object_ids: value .object_ids @@ -631,7 +631,7 @@ impl From for ObjectFilter impl From for iota_sdk::graphql_client::query_types::ObjectFilter { fn from(value: ObjectFilter) -> Self { Self { - type_tag: value.type_tag, + type_filter: value.type_filter, owner: value.owner.map(|v| **v), object_ids: value .object_ids diff --git a/crates/iota-sdk-graphql-client/src/lib.rs b/crates/iota-sdk-graphql-client/src/lib.rs index 0c456669a..c0353e85a 100644 --- a/crates/iota-sdk-graphql-client/src/lib.rs +++ b/crates/iota-sdk-graphql-client/src/lib.rs @@ -633,7 +633,7 @@ impl Client { let response = self .objects( Some(ObjectFilter { - type_tag: Some( + type_filter: Some( coin_type .into() .map(StructTag::coin) diff --git a/crates/iota-sdk-graphql-client/src/query_types/object.rs b/crates/iota-sdk-graphql-client/src/query_types/object.rs index 3a544552a..091566c3f 100644 --- a/crates/iota-sdk-graphql-client/src/query_types/object.rs +++ b/crates/iota-sdk-graphql-client/src/query_types/object.rs @@ -56,7 +56,7 @@ pub struct Object { #[cynic(schema = "rpc", graphql_type = "ObjectFilter")] pub struct ObjectFilter { #[cynic(rename = "type")] - pub type_tag: Option, + pub type_filter: Option, pub owner: Option
, pub object_ids: Option>, } diff --git a/crates/iota-sdk-transaction-builder/src/builder/mod.rs b/crates/iota-sdk-transaction-builder/src/builder/mod.rs index 28477337a..177ed1e01 100644 --- a/crates/iota-sdk-transaction-builder/src/builder/mod.rs +++ b/crates/iota-sdk-transaction-builder/src/builder/mod.rs @@ -881,7 +881,7 @@ impl TransactionBuilder { .client .objects( ObjectFilter { - type_tag: Some(StructTag::gas_coin().to_string()), + type_filter: Some(StructTag::gas_coin().to_string()), owner: Some(self.data.sender), ..Default::default() }, diff --git a/crates/iota-sdk/examples/objects_by_type.rs b/crates/iota-sdk/examples/objects_by_type.rs index 8c8d996d5..046ed62dc 100644 --- a/crates/iota-sdk/examples/objects_by_type.rs +++ b/crates/iota-sdk/examples/objects_by_type.rs @@ -10,7 +10,7 @@ async fn main() -> Result<()> { let staked_iotas = client .objects( ObjectFilter { - type_tag: "0x3::staking_pool::StakedIota".to_owned().into(), + type_filter: "0x3::staking_pool::StakedIota".to_owned().into(), ..Default::default() }, Default::default(), diff --git a/crates/iota-sdk/examples/publish_upgrade.rs b/crates/iota-sdk/examples/publish_upgrade.rs index 6aa890704..6737bda3c 100644 --- a/crates/iota-sdk/examples/publish_upgrade.rs +++ b/crates/iota-sdk/examples/publish_upgrade.rs @@ -101,7 +101,7 @@ async fn main() -> Result<()> { let Some(obj) = client.object(object_id, None).await? else { bail!("Missing object {object_id}"); }; - if obj.as_struct().type_ + if obj.as_struct().type_tag == (StructTag { address: Address::FRAMEWORK, module: iota_types::IdentifierRef::const_new("package").into(), diff --git a/crates/iota-sdk/examples/unstake.rs b/crates/iota-sdk/examples/unstake.rs index d11f121e1..3a4a7555e 100644 --- a/crates/iota-sdk/examples/unstake.rs +++ b/crates/iota-sdk/examples/unstake.rs @@ -13,7 +13,7 @@ async fn main() -> Result<()> { let staked_iota = client .objects( ObjectFilter { - type_tag: Some(StructTag::staked_iota().to_string()), + type_filter: Some(StructTag::staked_iota().to_string()), ..Default::default() }, Default::default(), From 54bd772b991ad8b1917000bd125d74cadb31837c Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 29 Oct 2025 15:04:41 +0100 Subject: [PATCH 5/6] struct_tag --- crates/iota-sdk-ffi/src/types/object.rs | 4 ++-- crates/iota-sdk-types/src/framework.rs | 2 +- crates/iota-sdk-types/src/object.rs | 16 ++++++++-------- crates/iota-sdk/examples/publish_upgrade.rs | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/iota-sdk-ffi/src/types/object.rs b/crates/iota-sdk-ffi/src/types/object.rs index 8187cd195..5286eba4f 100644 --- a/crates/iota-sdk-ffi/src/types/object.rs +++ b/crates/iota-sdk-ffi/src/types/object.rs @@ -465,7 +465,7 @@ pub struct MoveStruct { impl From for MoveStruct { fn from(value: iota_sdk::types::MoveStruct) -> Self { Self { - struct_type: Arc::new(value.type_tag.into()), + struct_type: Arc::new(value.struct_tag.into()), version: value.version, contents: value.contents, } @@ -475,7 +475,7 @@ impl From for MoveStruct { impl From for iota_sdk::types::MoveStruct { fn from(value: MoveStruct) -> Self { Self { - type_tag: value.struct_type.0.clone(), + struct_tag: value.struct_type.0.clone(), version: value.version, contents: value.contents, } diff --git a/crates/iota-sdk-types/src/framework.rs b/crates/iota-sdk-types/src/framework.rs index f38322e43..6c757ada4 100644 --- a/crates/iota-sdk-types/src/framework.rs +++ b/crates/iota-sdk-types/src/framework.rs @@ -30,7 +30,7 @@ impl Coin { match &object.data { super::ObjectData::Struct(move_struct) => { let coin_type = move_struct - .type_tag + .struct_tag .coin_type_opt() .ok_or(CoinFromObjectError::NotACoin)?; diff --git a/crates/iota-sdk-types/src/object.rs b/crates/iota-sdk-types/src/object.rs index fea8f5ebe..a59b2d23d 100644 --- a/crates/iota-sdk-types/src/object.rs +++ b/crates/iota-sdk-types/src/object.rs @@ -304,7 +304,7 @@ pub struct MoveStruct { feature = "serde", serde(with = "::serde_with::As::") )] - pub type_tag: StructTag, + pub struct_tag: StructTag, /// Number that increases each time a tx takes this object as a mutable /// input This is a lamport timestamp, not a sequentially increasing /// version @@ -412,7 +412,7 @@ impl Object { /// Return this object's type pub fn object_type(&self) -> ObjectType { match &self.data { - ObjectData::Struct(struct_) => ObjectType::Struct(struct_.type_tag.clone()), + ObjectData::Struct(struct_) => ObjectType::Struct(struct_.struct_tag.clone()), ObjectData::Package(_) => ObjectType::Package, } } @@ -526,7 +526,7 @@ impl GenesisObject { pub fn object_type(&self) -> ObjectType { match &self.data { - ObjectData::Struct(struct_) => ObjectType::Struct(struct_.type_tag.clone()), + ObjectData::Struct(struct_) => ObjectType::Struct(struct_.struct_tag.clone()), ObjectData::Package(_) => ObjectType::Package, } } @@ -848,7 +848,7 @@ mod serialization { linkage_table, }), ( - ObjectType::Struct(type_tag), + ObjectType::Struct(struct_tag), ReadableObjectData::Move(ReadableMoveStruct { contents }), ) => { // check id matches in contents @@ -857,7 +857,7 @@ mod serialization { } ObjectData::Struct(MoveStruct { - type_tag, + struct_tag, version, contents, }) @@ -1000,7 +1000,7 @@ mod serialization { linkage_table, }), ( - ObjectType::Struct(type_tag), + ObjectType::Struct(struct_tag), ReadableObjectData::Move(ReadableMoveStruct { contents }), ) => { // check id matches in contents @@ -1009,7 +1009,7 @@ mod serialization { } ObjectData::Struct(MoveStruct { - type_tag, + struct_tag, version, contents, }) @@ -1039,7 +1039,7 @@ mod serialization { fn obj() { let o = Object { data: ObjectData::Struct(MoveStruct { - type_tag: StructTag { + struct_tag: StructTag { address: Address::FRAMEWORK, module: Identifier::new("bar").unwrap(), name: Identifier::new("foo").unwrap(), diff --git a/crates/iota-sdk/examples/publish_upgrade.rs b/crates/iota-sdk/examples/publish_upgrade.rs index 6737bda3c..0d161f71d 100644 --- a/crates/iota-sdk/examples/publish_upgrade.rs +++ b/crates/iota-sdk/examples/publish_upgrade.rs @@ -101,7 +101,7 @@ async fn main() -> Result<()> { let Some(obj) = client.object(object_id, None).await? else { bail!("Missing object {object_id}"); }; - if obj.as_struct().type_tag + if obj.as_struct().struct_tag == (StructTag { address: Address::FRAMEWORK, module: iota_types::IdentifierRef::const_new("package").into(), From 4a03d5a1c45566dda0637269599ef97a85421cec Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 29 Oct 2025 15:10:30 +0100 Subject: [PATCH 6/6] clippy --- .../iota-sdk-graphql-client/src/query_types/dynamic_fields.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/iota-sdk-graphql-client/src/query_types/dynamic_fields.rs b/crates/iota-sdk-graphql-client/src/query_types/dynamic_fields.rs index 28fbb8624..5f60b5e32 100644 --- a/crates/iota-sdk-graphql-client/src/query_types/dynamic_fields.rs +++ b/crates/iota-sdk-graphql-client/src/query_types/dynamic_fields.rs @@ -157,7 +157,7 @@ impl TryFrom for DynamicFieldOutput { )?; Ok(DynamicFieldOutput { name: crate::DynamicFieldName { - type_tag: type_tag, + type_tag, bcs: base64ct::Base64::decode_vec(val.name.as_ref().unwrap().bcs.0.as_ref()) .unwrap(), json: val.name.as_ref().unwrap().json.clone(),