feat: ObjectData improvements#1125
Merged
thibault-martinez merged 3 commits intodevelopfrom May 7, 2026
Merged
Conversation
Alex6323
approved these changes
May 7, 2026
Thoralf-M
reviewed
May 7, 2026
ObjectData improvements (#1045)ObjectData improvements
Base automatically changed from
sdk-replacement/23-ProgrammableTransaction
to
develop
May 7, 2026 08:54
* feat: `ObjectData` improvements * remove methods * add mut versions in macro
dee951f to
3626046
Compare
1 task
Thoralf-M
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Continues the SDK replacement series, stacked on top of
sdk-replacement/23-ProgrammableTransaction. Rounds outObjectDatawith the accessors the monorepo expects (object id, type, struct tag) and extends thedef_is_as_into_opt!macro with mutable-borrow accessors so enums generated via the macro support in-place mutation of their inner values.Changes
ObjectDataNew methods on
ObjectDatain crates/iota-sdk-types/src/object.rs:id()— returns the innerObjectIdregardless of variant (Structdelegates toMoveStruct::id,Packagedelegates toMovePackage::id).object_type()— returnsSome(&MoveObjectType)forStruct,NoneforPackage.struct_tag()— returnsSome(StructTag)(cloned) forStruct,NoneforPackage.def_is_as_into_opt!macroAdds mutable-borrow accessors to the plain-
$innerarm of the macro in crates/iota-sdk-types/src/lib.rs:as_<rename>_mut(&mut self) -> &mut $inner— panicking variant.as_<rename>_mut_opt(&mut self) -> Option<&mut $inner>— fallible variant.These mirror the existing
as_<rename>/as_<rename>_optpair and let callers mutate the inner value of an enum variant without re-matching. TheBox<$inner>arm is intentionally left unchanged.