sui_types/
sui_sdk_types_conversions.rs

1// Copyright (c) Mysten Labs, Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4//! Module for conversions between sui-core types and sui-sdk types
5//!
6//! For now this module makes heavy use of the `bcs_convert_impl` macro to implement the `From` trait
7//! for converting between core and external sdk types, relying on the fact that the BCS format of
8//! these types are strictly identical. As time goes on we'll slowly hand implement these impls
9//! directly to avoid going through the BCS machinery.
10
11use fastcrypto::traits::ToFromBytes;
12use sui_sdk_types::{
13    self, AccumulatorWrite, ActiveJwk, Address, Argument, AuthenticatorStateExpire, Bitmap,
14    Bls12381PublicKey, Bls12381Signature, CanceledTransaction, CanceledTransactionV2, ChangeEpoch,
15    CheckpointCommitment, CheckpointContents, CheckpointData, CheckpointSummary, Command,
16    CommandArgumentError, ConsensusDeterminedVersionAssignments, Digest, Ed25519PublicKey,
17    Ed25519Signature, EndOfEpochTransactionKind, ExecutionError, ExecutionStatus,
18    ExecutionTimeObservationKey, ExecutionTimeObservations, FundsWithdrawal, IdOperation,
19    Identifier, Input, Jwk, JwkId, MakeMoveVector, MergeCoins, MoveCall, MoveLocation, MovePackage,
20    MultisigMemberPublicKey, MultisigMemberSignature, Mutability, Object, ObjectIn, ObjectOut,
21    ObjectReference, Owner, PackageUpgradeError, PasskeyAuthenticator, PasskeyPublicKey, Publish,
22    Secp256k1PublicKey, Secp256k1Signature, Secp256r1PublicKey, Secp256r1Signature, SharedInput,
23    SignatureScheme, SignedCheckpointSummary, SignedTransaction, SimpleSignature, SplitCoins,
24    StructTag, SystemPackage, Transaction, TransactionEffects, TransactionEffectsV1,
25    TransactionEffectsV2, TransactionEvents, TransactionExpiration, TransactionKind,
26    TransferObjects, TypeArgumentError, TypeParseError, TypeTag, UnchangedConsensusKind, Upgrade,
27    UserSignature, ValidatorAggregatedSignature, ValidatorCommittee, ValidatorCommitteeMember,
28    ValidatorExecutionTimeObservation, VersionAssignment, VersionAssignmentV2,
29    ZkLoginAuthenticator, ZkLoginPublicIdentifier,
30};
31use tap::Pipe;
32
33use crate::crypto::SuiSignature as _;
34
35#[derive(Debug)]
36pub struct SdkTypeConversionError(String);
37
38impl std::fmt::Display for SdkTypeConversionError {
39    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40        f.write_str(&self.0)
41    }
42}
43
44impl std::error::Error for SdkTypeConversionError {}
45
46impl From<TypeParseError> for SdkTypeConversionError {
47    fn from(value: TypeParseError) -> Self {
48        Self(value.to_string())
49    }
50}
51
52impl From<anyhow::Error> for SdkTypeConversionError {
53    fn from(value: anyhow::Error) -> Self {
54        Self(value.to_string())
55    }
56}
57
58impl From<bcs::Error> for SdkTypeConversionError {
59    fn from(value: bcs::Error) -> Self {
60        Self(value.to_string())
61    }
62}
63
64impl From<std::array::TryFromSliceError> for SdkTypeConversionError {
65    fn from(value: std::array::TryFromSliceError) -> Self {
66        Self(value.to_string())
67    }
68}
69
70macro_rules! bcs_convert_impl {
71    ($core:ty, $external:ty) => {
72        impl TryFrom<$core> for $external {
73            type Error = bcs::Error;
74
75            fn try_from(value: $core) -> Result<Self, Self::Error> {
76                let bytes = bcs::to_bytes(&value)?;
77                bcs::from_bytes(&bytes)
78            }
79        }
80
81        impl TryFrom<$external> for $core {
82            type Error = bcs::Error;
83
84            fn try_from(value: $external) -> Result<Self, Self::Error> {
85                let bytes = bcs::to_bytes(&value)?;
86                bcs::from_bytes(&bytes)
87            }
88        }
89    };
90}
91
92bcs_convert_impl!(crate::object::Object, Object);
93bcs_convert_impl!(crate::transaction::TransactionData, Transaction);
94bcs_convert_impl!(crate::effects::TransactionEffectsV1, TransactionEffectsV1);
95bcs_convert_impl!(crate::effects::TransactionEffectsV2, TransactionEffectsV2);
96bcs_convert_impl!(
97    crate::messages_checkpoint::CheckpointSummary,
98    CheckpointSummary
99);
100bcs_convert_impl!(
101    crate::messages_checkpoint::CertifiedCheckpointSummary,
102    SignedCheckpointSummary
103);
104bcs_convert_impl!(
105    crate::messages_checkpoint::CheckpointContents,
106    CheckpointContents
107);
108bcs_convert_impl!(
109    crate::full_checkpoint_content::CheckpointData,
110    CheckpointData
111);
112bcs_convert_impl!(crate::signature::GenericSignature, UserSignature);
113bcs_convert_impl!(
114    crate::crypto::ZkLoginPublicIdentifier,
115    ZkLoginPublicIdentifier
116);
117bcs_convert_impl!(
118    crate::crypto::ZkLoginAuthenticatorAsBytes,
119    ZkLoginAuthenticator
120);
121bcs_convert_impl!(
122    crate::zk_login_authenticator::ZkLoginAuthenticator,
123    ZkLoginAuthenticator
124);
125bcs_convert_impl!(
126    crate::crypto::PasskeyAuthenticatorAsBytes,
127    PasskeyAuthenticator
128);
129bcs_convert_impl!(
130    crate::passkey_authenticator::PasskeyAuthenticator,
131    PasskeyAuthenticator
132);
133bcs_convert_impl!(crate::effects::TransactionEvents, TransactionEvents);
134bcs_convert_impl!(crate::transaction::TransactionKind, TransactionKind);
135bcs_convert_impl!(crate::move_package::MovePackage, MovePackage);
136
137impl<const T: bool> From<crate::crypto::AuthorityQuorumSignInfo<T>>
138    for ValidatorAggregatedSignature
139{
140    fn from(value: crate::crypto::AuthorityQuorumSignInfo<T>) -> Self {
141        let crate::crypto::AuthorityQuorumSignInfo {
142            epoch,
143            signature,
144            signers_map,
145        } = value;
146
147        Self {
148            epoch,
149            signature: Bls12381Signature::from_bytes(signature.as_ref()).unwrap(),
150            bitmap: Bitmap::from_iter(signers_map),
151        }
152    }
153}
154
155impl<const T: bool> From<ValidatorAggregatedSignature>
156    for crate::crypto::AuthorityQuorumSignInfo<T>
157{
158    fn from(value: ValidatorAggregatedSignature) -> Self {
159        let ValidatorAggregatedSignature {
160            epoch,
161            signature,
162            bitmap,
163        } = value;
164
165        Self {
166            epoch,
167            signature: crate::crypto::AggregateAuthoritySignature::from_bytes(signature.as_bytes())
168                .unwrap(),
169            signers_map: roaring::RoaringBitmap::from_iter(bitmap.iter()),
170        }
171    }
172}
173
174impl From<crate::object::Owner> for Owner {
175    fn from(value: crate::object::Owner) -> Self {
176        match value {
177            crate::object::Owner::AddressOwner(address) => Self::Address(address.into()),
178            crate::object::Owner::ObjectOwner(object_id) => Self::Object(object_id.into()),
179            crate::object::Owner::Shared {
180                initial_shared_version,
181            } => Self::Shared(initial_shared_version.value()),
182            crate::object::Owner::Immutable => Self::Immutable,
183            crate::object::Owner::ConsensusAddressOwner {
184                start_version,
185                owner,
186            } => Self::ConsensusAddress {
187                start_version: start_version.value(),
188                owner: owner.into(),
189            },
190        }
191    }
192}
193
194impl From<Owner> for crate::object::Owner {
195    fn from(value: Owner) -> Self {
196        match value {
197            Owner::Address(address) => crate::object::Owner::AddressOwner(address.into()),
198            Owner::Object(object_id) => crate::object::Owner::ObjectOwner(object_id.into()),
199            Owner::Shared(initial_shared_version) => crate::object::Owner::Shared {
200                initial_shared_version: initial_shared_version.into(),
201            },
202            Owner::Immutable => crate::object::Owner::Immutable,
203            Owner::ConsensusAddress {
204                start_version,
205                owner,
206            } => crate::object::Owner::ConsensusAddressOwner {
207                start_version: start_version.into(),
208                owner: owner.into(),
209            },
210            _ => unreachable!("sdk shouldn't have a variant that the mono repo doesn't"),
211        }
212    }
213}
214
215impl From<crate::base_types::SuiAddress> for Address {
216    fn from(value: crate::base_types::SuiAddress) -> Self {
217        Self::new(value.to_inner())
218    }
219}
220
221impl From<Address> for crate::base_types::SuiAddress {
222    fn from(value: Address) -> Self {
223        crate::base_types::ObjectID::new(value.into_inner()).into()
224    }
225}
226
227impl From<crate::base_types::ObjectID> for Address {
228    fn from(value: crate::base_types::ObjectID) -> Self {
229        Self::new(value.into_bytes())
230    }
231}
232
233impl From<Address> for crate::base_types::ObjectID {
234    fn from(value: Address) -> Self {
235        Self::new(value.into_inner())
236    }
237}
238
239impl TryFrom<crate::transaction::SenderSignedData> for SignedTransaction {
240    type Error = SdkTypeConversionError;
241
242    fn try_from(value: crate::transaction::SenderSignedData) -> Result<Self, Self::Error> {
243        let crate::transaction::SenderSignedTransaction {
244            intent_message,
245            tx_signatures,
246        } = value.into_inner();
247
248        Self {
249            transaction: intent_message.value.try_into()?,
250            signatures: tx_signatures
251                .into_iter()
252                .map(TryInto::try_into)
253                .collect::<Result<_, _>>()?,
254        }
255        .pipe(Ok)
256    }
257}
258
259impl TryFrom<SignedTransaction> for crate::transaction::SenderSignedData {
260    type Error = SdkTypeConversionError;
261
262    fn try_from(value: SignedTransaction) -> Result<Self, Self::Error> {
263        let SignedTransaction {
264            transaction,
265            signatures,
266        } = value;
267
268        Self::new(
269            transaction.try_into()?,
270            signatures
271                .into_iter()
272                .map(TryInto::try_into)
273                .collect::<Result<_, _>>()?,
274        )
275        .pipe(Ok)
276    }
277}
278
279impl TryFrom<crate::transaction::Transaction> for SignedTransaction {
280    type Error = SdkTypeConversionError;
281
282    fn try_from(value: crate::transaction::Transaction) -> Result<Self, Self::Error> {
283        value.into_data().try_into()
284    }
285}
286
287impl TryFrom<SignedTransaction> for crate::transaction::Transaction {
288    type Error = SdkTypeConversionError;
289
290    fn try_from(value: SignedTransaction) -> Result<Self, Self::Error> {
291        Ok(Self::new(value.try_into()?))
292    }
293}
294
295pub fn type_tag_core_to_sdk(
296    value: move_core_types::language_storage::TypeTag,
297) -> Result<TypeTag, SdkTypeConversionError> {
298    match value {
299        move_core_types::language_storage::TypeTag::Bool => TypeTag::Bool,
300        move_core_types::language_storage::TypeTag::U8 => TypeTag::U8,
301        move_core_types::language_storage::TypeTag::U64 => TypeTag::U64,
302        move_core_types::language_storage::TypeTag::U128 => TypeTag::U128,
303        move_core_types::language_storage::TypeTag::Address => TypeTag::Address,
304        move_core_types::language_storage::TypeTag::Signer => TypeTag::Signer,
305        move_core_types::language_storage::TypeTag::Vector(type_tag) => {
306            TypeTag::Vector(Box::new(type_tag_core_to_sdk(*type_tag)?))
307        }
308        move_core_types::language_storage::TypeTag::Struct(struct_tag) => {
309            TypeTag::Struct(Box::new(struct_tag_core_to_sdk(*struct_tag)?))
310        }
311        move_core_types::language_storage::TypeTag::U16 => TypeTag::U16,
312        move_core_types::language_storage::TypeTag::U32 => TypeTag::U32,
313        move_core_types::language_storage::TypeTag::U256 => TypeTag::U256,
314    }
315    .pipe(Ok)
316}
317
318pub fn struct_tag_core_to_sdk(
319    value: move_core_types::language_storage::StructTag,
320) -> Result<StructTag, SdkTypeConversionError> {
321    let move_core_types::language_storage::StructTag {
322        address,
323        module,
324        name,
325        type_params,
326    } = value;
327
328    let address = Address::new(address.into_bytes());
329    let module = Identifier::new(module.as_str())?;
330    let name = Identifier::new(name.as_str())?;
331    let type_params = type_params
332        .into_iter()
333        .map(type_tag_core_to_sdk)
334        .collect::<Result<_, _>>()?;
335    StructTag::new(address, module, name, type_params).pipe(Ok)
336}
337
338pub fn type_tag_sdk_to_core(
339    value: TypeTag,
340) -> Result<move_core_types::language_storage::TypeTag, SdkTypeConversionError> {
341    match value {
342        TypeTag::Bool => move_core_types::language_storage::TypeTag::Bool,
343        TypeTag::U8 => move_core_types::language_storage::TypeTag::U8,
344        TypeTag::U64 => move_core_types::language_storage::TypeTag::U64,
345        TypeTag::U128 => move_core_types::language_storage::TypeTag::U128,
346        TypeTag::Address => move_core_types::language_storage::TypeTag::Address,
347        TypeTag::Signer => move_core_types::language_storage::TypeTag::Signer,
348        TypeTag::Vector(type_tag) => move_core_types::language_storage::TypeTag::Vector(Box::new(
349            type_tag_sdk_to_core(*type_tag)?,
350        )),
351        TypeTag::Struct(struct_tag) => move_core_types::language_storage::TypeTag::Struct(
352            Box::new(struct_tag_sdk_to_core(*struct_tag)?),
353        ),
354        TypeTag::U16 => move_core_types::language_storage::TypeTag::U16,
355        TypeTag::U32 => move_core_types::language_storage::TypeTag::U32,
356        TypeTag::U256 => move_core_types::language_storage::TypeTag::U256,
357    }
358    .pipe(Ok)
359}
360
361pub fn struct_tag_sdk_to_core(
362    value: StructTag,
363) -> Result<move_core_types::language_storage::StructTag, SdkTypeConversionError> {
364    let address = value.address();
365    let module = value.module();
366    let name = value.name();
367    let type_params = value.type_params();
368
369    let address = move_core_types::account_address::AccountAddress::new(address.into_inner());
370    let module = move_core_types::identifier::Identifier::new(module.as_str())?;
371    let name = move_core_types::identifier::Identifier::new(name.as_str())?;
372    let type_params = type_params
373        .iter()
374        .cloned()
375        .map(type_tag_sdk_to_core)
376        .collect::<Result<_, _>>()?;
377    move_core_types::language_storage::StructTag {
378        address,
379        module,
380        name,
381        type_params,
382    }
383    .pipe(Ok)
384}
385
386impl TryFrom<crate::type_input::TypeInput> for TypeTag {
387    type Error = SdkTypeConversionError;
388
389    fn try_from(value: crate::type_input::TypeInput) -> Result<Self, Self::Error> {
390        match value {
391            crate::type_input::TypeInput::Bool => Self::Bool,
392            crate::type_input::TypeInput::U8 => Self::U8,
393            crate::type_input::TypeInput::U64 => Self::U64,
394            crate::type_input::TypeInput::U128 => Self::U128,
395            crate::type_input::TypeInput::Address => Self::Address,
396            crate::type_input::TypeInput::Signer => Self::Signer,
397            crate::type_input::TypeInput::Vector(type_input) => {
398                Self::Vector(Box::new((*type_input).try_into()?))
399            }
400            crate::type_input::TypeInput::Struct(struct_input) => {
401                Self::Struct(Box::new((*struct_input).try_into()?))
402            }
403            crate::type_input::TypeInput::U16 => Self::U16,
404            crate::type_input::TypeInput::U32 => Self::U32,
405            crate::type_input::TypeInput::U256 => Self::U256,
406        }
407        .pipe(Ok)
408    }
409}
410
411impl TryFrom<crate::type_input::StructInput> for StructTag {
412    type Error = SdkTypeConversionError;
413
414    fn try_from(value: crate::type_input::StructInput) -> Result<Self, Self::Error> {
415        Self::new(
416            Address::new(value.address.into_bytes()),
417            Identifier::new(value.module)?,
418            Identifier::new(value.name)?,
419            value
420                .type_params
421                .into_iter()
422                .map(TryInto::try_into)
423                .collect::<Result<_, _>>()?,
424        )
425        .pipe(Ok)
426    }
427}
428
429impl From<TypeTag> for crate::type_input::TypeInput {
430    fn from(value: TypeTag) -> Self {
431        match value {
432            TypeTag::U8 => Self::U8,
433            TypeTag::U16 => Self::U16,
434            TypeTag::U32 => Self::U32,
435            TypeTag::U64 => Self::U64,
436            TypeTag::U128 => Self::U128,
437            TypeTag::U256 => Self::U256,
438            TypeTag::Bool => Self::Bool,
439            TypeTag::Address => Self::Address,
440            TypeTag::Signer => Self::Signer,
441            TypeTag::Vector(type_tag) => Self::Vector(Box::new((*type_tag).into())),
442            TypeTag::Struct(struct_tag) => Self::Struct(Box::new((*struct_tag).into())),
443        }
444    }
445}
446
447impl From<StructTag> for crate::type_input::StructInput {
448    fn from(value: StructTag) -> Self {
449        Self {
450            address: move_core_types::account_address::AccountAddress::new(
451                value.address().into_inner(),
452            ),
453            module: value.module().as_str().into(),
454            name: value.name().as_str().into(),
455            type_params: value
456                .type_params()
457                .iter()
458                .cloned()
459                .map(crate::type_input::TypeInput::from)
460                .collect(),
461        }
462    }
463}
464
465impl From<crate::digests::ObjectDigest> for Digest {
466    fn from(value: crate::digests::ObjectDigest) -> Self {
467        Self::new(value.into_inner())
468    }
469}
470
471impl From<Digest> for crate::digests::ObjectDigest {
472    fn from(value: Digest) -> Self {
473        Self::new(value.into_inner())
474    }
475}
476
477impl From<crate::digests::TransactionDigest> for Digest {
478    fn from(value: crate::digests::TransactionDigest) -> Self {
479        Self::new(value.into_inner())
480    }
481}
482
483impl From<Digest> for crate::digests::TransactionDigest {
484    fn from(value: Digest) -> Self {
485        Self::new(value.into_inner())
486    }
487}
488
489impl From<crate::messages_checkpoint::CheckpointDigest> for Digest {
490    fn from(value: crate::messages_checkpoint::CheckpointDigest) -> Self {
491        Self::new(value.into_inner())
492    }
493}
494
495impl From<Digest> for crate::messages_checkpoint::CheckpointDigest {
496    fn from(value: Digest) -> Self {
497        Self::new(value.into_inner())
498    }
499}
500
501impl From<crate::digests::Digest> for Digest {
502    fn from(value: crate::digests::Digest) -> Self {
503        Self::new(value.into_inner())
504    }
505}
506
507impl From<Digest> for crate::digests::Digest {
508    fn from(value: Digest) -> Self {
509        Self::new(value.into_inner())
510    }
511}
512
513impl From<crate::digests::CheckpointArtifactsDigest> for Digest {
514    fn from(value: crate::digests::CheckpointArtifactsDigest) -> Self {
515        Self::new(value.into_inner())
516    }
517}
518
519impl From<Digest> for crate::digests::CheckpointArtifactsDigest {
520    fn from(value: Digest) -> Self {
521        Self::new(value.into_inner())
522    }
523}
524
525impl From<crate::committee::Committee> for ValidatorCommittee {
526    fn from(value: crate::committee::Committee) -> Self {
527        Self {
528            epoch: value.epoch(),
529            members: value
530                .voting_rights
531                .into_iter()
532                .map(|(name, stake)| ValidatorCommitteeMember {
533                    public_key: name.into(),
534                    stake,
535                })
536                .collect(),
537        }
538    }
539}
540
541impl From<ValidatorCommittee> for crate::committee::Committee {
542    fn from(value: ValidatorCommittee) -> Self {
543        let ValidatorCommittee { epoch, members } = value;
544
545        Self::new(
546            epoch,
547            members
548                .into_iter()
549                .map(|member| (member.public_key.into(), member.stake))
550                .collect(),
551        )
552    }
553}
554
555impl From<crate::crypto::AuthorityPublicKeyBytes> for Bls12381PublicKey {
556    fn from(value: crate::crypto::AuthorityPublicKeyBytes) -> Self {
557        Self::new(value.0)
558    }
559}
560
561impl From<Bls12381PublicKey> for crate::crypto::AuthorityPublicKeyBytes {
562    fn from(value: Bls12381PublicKey) -> Self {
563        Self::new(value.into_inner())
564    }
565}
566
567impl From<UnchangedConsensusKind> for crate::effects::UnchangedConsensusKind {
568    fn from(value: UnchangedConsensusKind) -> Self {
569        match value {
570            UnchangedConsensusKind::ReadOnlyRoot { version, digest } => {
571                Self::ReadOnlyRoot((version.into(), digest.into()))
572            }
573            UnchangedConsensusKind::MutateDeleted { version } => {
574                Self::MutateConsensusStreamEnded(version.into())
575            }
576            UnchangedConsensusKind::ReadDeleted { version } => {
577                Self::ReadConsensusStreamEnded(version.into())
578            }
579            UnchangedConsensusKind::Canceled { version } => Self::Cancelled(version.into()),
580            UnchangedConsensusKind::PerEpochConfig => Self::PerEpochConfig,
581            _ => unreachable!("sdk shouldn't have a variant that the mono repo doesn't"),
582        }
583    }
584}
585
586impl From<crate::effects::UnchangedConsensusKind> for UnchangedConsensusKind {
587    fn from(value: crate::effects::UnchangedConsensusKind) -> Self {
588        match value {
589            crate::effects::UnchangedConsensusKind::ReadOnlyRoot((version, digest)) => {
590                Self::ReadOnlyRoot {
591                    version: version.into(),
592                    digest: digest.into(),
593                }
594            }
595            crate::effects::UnchangedConsensusKind::MutateConsensusStreamEnded(version) => {
596                Self::MutateDeleted {
597                    version: version.into(),
598                }
599            }
600            crate::effects::UnchangedConsensusKind::ReadConsensusStreamEnded(version) => {
601                Self::ReadDeleted {
602                    version: version.into(),
603                }
604            }
605            crate::effects::UnchangedConsensusKind::Cancelled(version) => Self::Canceled {
606                version: version.into(),
607            },
608            crate::effects::UnchangedConsensusKind::PerEpochConfig => Self::PerEpochConfig,
609        }
610    }
611}
612
613impl From<crate::effects::ObjectIn> for ObjectIn {
614    fn from(value: crate::effects::ObjectIn) -> Self {
615        match value {
616            crate::effects::ObjectIn::NotExist => Self::NotExist,
617            crate::effects::ObjectIn::Exist(((version, digest), owner)) => Self::Exist {
618                version: version.value(),
619                digest: digest.into(),
620                owner: owner.into(),
621            },
622        }
623    }
624}
625
626impl From<crate::effects::ObjectOut> for ObjectOut {
627    fn from(value: crate::effects::ObjectOut) -> Self {
628        match value {
629            crate::effects::ObjectOut::NotExist => Self::NotExist,
630            crate::effects::ObjectOut::ObjectWrite((digest, owner)) => Self::ObjectWrite {
631                digest: digest.into(),
632                owner: owner.into(),
633            },
634            crate::effects::ObjectOut::PackageWrite((version, digest)) => Self::PackageWrite {
635                version: version.value(),
636                digest: digest.into(),
637            },
638
639            crate::effects::ObjectOut::AccumulatorWriteV1(accumulator_write) => {
640                Self::AccumulatorWrite(accumulator_write.into())
641            }
642        }
643    }
644}
645
646impl From<crate::effects::AccumulatorWriteV1> for AccumulatorWrite {
647    fn from(value: crate::effects::AccumulatorWriteV1) -> Self {
648        let operation = match value.operation {
649            crate::effects::AccumulatorOperation::Merge => {
650                sui_sdk_types::AccumulatorOperation::Merge
651            }
652            crate::effects::AccumulatorOperation::Split => {
653                sui_sdk_types::AccumulatorOperation::Split
654            }
655        };
656        Self::new(
657            value.address.address.into(),
658            type_tag_core_to_sdk(value.address.ty).unwrap(),
659            operation,
660            match value.value {
661                crate::effects::AccumulatorValue::Integer(value) => value,
662                crate::effects::AccumulatorValue::IntegerTuple(_, _)
663                | crate::effects::AccumulatorValue::EventDigest(_) => todo!(),
664            },
665        )
666    }
667}
668
669impl From<crate::effects::IDOperation> for IdOperation {
670    fn from(value: crate::effects::IDOperation) -> Self {
671        match value {
672            crate::effects::IDOperation::None => Self::None,
673            crate::effects::IDOperation::Created => Self::Created,
674            crate::effects::IDOperation::Deleted => Self::Deleted,
675        }
676    }
677}
678
679impl From<crate::transaction::TransactionExpiration> for TransactionExpiration {
680    fn from(value: crate::transaction::TransactionExpiration) -> Self {
681        match value {
682            crate::transaction::TransactionExpiration::None => Self::None,
683            crate::transaction::TransactionExpiration::Epoch(epoch) => Self::Epoch(epoch),
684            crate::transaction::TransactionExpiration::ValidDuring {
685                min_epoch,
686                max_epoch,
687                min_timestamp,
688                max_timestamp,
689                chain,
690                nonce,
691            } => Self::ValidDuring {
692                min_epoch,
693                max_epoch,
694                min_timestamp,
695                max_timestamp,
696                chain: Digest::new(*chain.as_bytes()),
697                nonce,
698            },
699        }
700    }
701}
702
703impl From<TransactionExpiration> for crate::transaction::TransactionExpiration {
704    fn from(value: TransactionExpiration) -> Self {
705        match value {
706            TransactionExpiration::None => Self::None,
707            TransactionExpiration::Epoch(epoch) => Self::Epoch(epoch),
708            TransactionExpiration::ValidDuring {
709                min_epoch,
710                max_epoch,
711                min_timestamp,
712                max_timestamp,
713                chain,
714                nonce,
715            } => Self::ValidDuring {
716                min_epoch,
717                max_epoch,
718                min_timestamp,
719                max_timestamp,
720                chain: crate::digests::CheckpointDigest::from(chain).into(),
721                nonce,
722            },
723            _ => unreachable!("sdk shouldn't have a variant that the mono repo doesn't"),
724        }
725    }
726}
727
728impl From<crate::execution_status::TypeArgumentError> for TypeArgumentError {
729    fn from(value: crate::execution_status::TypeArgumentError) -> Self {
730        match value {
731            crate::execution_status::TypeArgumentError::TypeNotFound => Self::TypeNotFound,
732            crate::execution_status::TypeArgumentError::ConstraintNotSatisfied => {
733                Self::ConstraintNotSatisfied
734            }
735        }
736    }
737}
738
739impl From<TypeArgumentError> for crate::execution_status::TypeArgumentError {
740    fn from(value: TypeArgumentError) -> Self {
741        match value {
742            TypeArgumentError::TypeNotFound => Self::TypeNotFound,
743            TypeArgumentError::ConstraintNotSatisfied => Self::ConstraintNotSatisfied,
744            _ => unreachable!("sdk shouldn't have a variant that the mono repo doesn't"),
745        }
746    }
747}
748
749impl From<crate::execution_status::PackageUpgradeError> for PackageUpgradeError {
750    fn from(value: crate::execution_status::PackageUpgradeError) -> Self {
751        match value {
752            crate::execution_status::PackageUpgradeError::UnableToFetchPackage { package_id } => {
753                Self::UnableToFetchPackage {
754                    package_id: package_id.into(),
755                }
756            }
757            crate::execution_status::PackageUpgradeError::NotAPackage { object_id } => {
758                Self::NotAPackage {
759                    object_id: object_id.into(),
760                }
761            }
762            crate::execution_status::PackageUpgradeError::IncompatibleUpgrade => {
763                Self::IncompatibleUpgrade
764            }
765            crate::execution_status::PackageUpgradeError::DigestDoesNotMatch { digest } => {
766                Self::DigestDoesNotMatch {
767                    digest: Digest::from_bytes(digest).unwrap(),
768                }
769            }
770            crate::execution_status::PackageUpgradeError::UnknownUpgradePolicy { policy } => {
771                Self::UnknownUpgradePolicy { policy }
772            }
773            crate::execution_status::PackageUpgradeError::PackageIDDoesNotMatch {
774                package_id,
775                ticket_id,
776            } => Self::PackageIdDoesNotMatch {
777                package_id: package_id.into(),
778                ticket_id: ticket_id.into(),
779            },
780        }
781    }
782}
783
784impl From<PackageUpgradeError> for crate::execution_status::PackageUpgradeError {
785    fn from(value: PackageUpgradeError) -> Self {
786        match value {
787            PackageUpgradeError::UnableToFetchPackage { package_id } => {
788                Self::UnableToFetchPackage {
789                    package_id: package_id.into(),
790                }
791            }
792            PackageUpgradeError::NotAPackage { object_id } => Self::NotAPackage {
793                object_id: object_id.into(),
794            },
795            PackageUpgradeError::IncompatibleUpgrade => Self::IncompatibleUpgrade,
796            PackageUpgradeError::DigestDoesNotMatch { digest } => Self::DigestDoesNotMatch {
797                digest: digest.into_inner().to_vec(),
798            },
799            PackageUpgradeError::UnknownUpgradePolicy { policy } => {
800                Self::UnknownUpgradePolicy { policy }
801            }
802            PackageUpgradeError::PackageIdDoesNotMatch {
803                package_id,
804                ticket_id,
805            } => Self::PackageIDDoesNotMatch {
806                package_id: package_id.into(),
807                ticket_id: ticket_id.into(),
808            },
809            _ => unreachable!("sdk shouldn't have a variant that the mono repo doesn't"),
810        }
811    }
812}
813
814impl From<crate::execution_status::CommandArgumentError> for CommandArgumentError {
815    fn from(value: crate::execution_status::CommandArgumentError) -> Self {
816        match value {
817            crate::execution_status::CommandArgumentError::TypeMismatch => Self::TypeMismatch,
818            crate::execution_status::CommandArgumentError::InvalidBCSBytes => Self::InvalidBcsBytes,
819            crate::execution_status::CommandArgumentError::InvalidUsageOfPureArg => Self::InvalidUsageOfPureArgument,
820            crate::execution_status::CommandArgumentError::InvalidArgumentToPrivateEntryFunction => Self::InvalidArgumentToPrivateEntryFunction,
821            crate::execution_status::CommandArgumentError::IndexOutOfBounds { idx } => Self::IndexOutOfBounds { index: idx },
822            crate::execution_status::CommandArgumentError::SecondaryIndexOutOfBounds { result_idx, secondary_idx } => Self::SecondaryIndexOutOfBounds { result: result_idx, subresult: secondary_idx },
823            crate::execution_status::CommandArgumentError::InvalidResultArity { result_idx } => Self::InvalidResultArity { result: result_idx },
824            crate::execution_status::CommandArgumentError::InvalidGasCoinUsage => Self::InvalidGasCoinUsage,
825            crate::execution_status::CommandArgumentError::InvalidValueUsage => Self::InvalidValueUsage,
826            crate::execution_status::CommandArgumentError::InvalidObjectByValue => Self::InvalidObjectByValue,
827            crate::execution_status::CommandArgumentError::InvalidObjectByMutRef => Self::InvalidObjectByMutRef,
828            crate::execution_status::CommandArgumentError::SharedObjectOperationNotAllowed => Self::ConsensusObjectOperationNotAllowed,
829            crate::execution_status::CommandArgumentError::InvalidArgumentArity => Self::InvalidArgumentArity,
830            crate::execution_status::CommandArgumentError::InvalidTransferObject  => Self::InvalidTransferObject,
831            crate::execution_status::CommandArgumentError::InvalidMakeMoveVecNonObjectArgument =>
832                Self::InvalidMakeMoveVecNonObjectArgument,
833            crate::execution_status::CommandArgumentError::ArgumentWithoutValue  =>
834                Self::ArgumentWithoutValue,
835            crate::execution_status::CommandArgumentError::CannotMoveBorrowedValue =>
836                Self::CannotMoveBorrowedValue,
837            crate::execution_status::CommandArgumentError::CannotWriteToExtendedReference =>
838                Self::CannotWriteToExtendedReference,
839            crate::execution_status::CommandArgumentError::InvalidReferenceArgument =>
840                Self::InvalidReferenceArgument,
841        }
842    }
843}
844
845impl From<CommandArgumentError> for crate::execution_status::CommandArgumentError {
846    fn from(value: CommandArgumentError) -> Self {
847        match value {
848            CommandArgumentError::TypeMismatch => Self::TypeMismatch,
849            CommandArgumentError::InvalidBcsBytes => Self::InvalidBCSBytes,
850            CommandArgumentError::InvalidUsageOfPureArgument => Self::InvalidUsageOfPureArg,
851            CommandArgumentError::InvalidArgumentToPrivateEntryFunction => {
852                Self::InvalidArgumentToPrivateEntryFunction
853            }
854            CommandArgumentError::IndexOutOfBounds { index } => {
855                Self::IndexOutOfBounds { idx: index }
856            }
857            CommandArgumentError::SecondaryIndexOutOfBounds { result, subresult } => {
858                Self::SecondaryIndexOutOfBounds {
859                    result_idx: result,
860                    secondary_idx: subresult,
861                }
862            }
863            CommandArgumentError::InvalidResultArity { result } => {
864                Self::InvalidResultArity { result_idx: result }
865            }
866            CommandArgumentError::InvalidGasCoinUsage => Self::InvalidGasCoinUsage,
867            CommandArgumentError::InvalidValueUsage => Self::InvalidValueUsage,
868            CommandArgumentError::InvalidObjectByValue => Self::InvalidObjectByValue,
869            CommandArgumentError::InvalidObjectByMutRef => Self::InvalidObjectByMutRef,
870            CommandArgumentError::ConsensusObjectOperationNotAllowed => {
871                Self::SharedObjectOperationNotAllowed
872            }
873            CommandArgumentError::InvalidArgumentArity => Self::InvalidArgumentArity,
874            CommandArgumentError::InvalidTransferObject => Self::InvalidTransferObject,
875            CommandArgumentError::InvalidMakeMoveVecNonObjectArgument => {
876                Self::InvalidMakeMoveVecNonObjectArgument
877            }
878            CommandArgumentError::ArgumentWithoutValue => Self::ArgumentWithoutValue,
879            CommandArgumentError::CannotMoveBorrowedValue => Self::CannotMoveBorrowedValue,
880            CommandArgumentError::CannotWriteToExtendedReference => {
881                Self::CannotWriteToExtendedReference
882            }
883            CommandArgumentError::InvalidReferenceArgument => Self::InvalidReferenceArgument,
884            _ => unreachable!("sdk shouldn't have a variant that the mono repo doesn't"),
885        }
886    }
887}
888
889impl From<crate::execution_status::ExecutionFailureStatus> for ExecutionError {
890    fn from(value: crate::execution_status::ExecutionFailureStatus) -> Self {
891        match value {
892            crate::execution_status::ExecutionFailureStatus::InsufficientGas => Self::InsufficientGas,
893            crate::execution_status::ExecutionFailureStatus::InvalidGasObject => Self::InvalidGasObject,
894            crate::execution_status::ExecutionFailureStatus::InvariantViolation => Self::InvariantViolation,
895            crate::execution_status::ExecutionFailureStatus::FeatureNotYetSupported => Self::FeatureNotYetSupported,
896            crate::execution_status::ExecutionFailureStatus::MoveObjectTooBig { object_size, max_object_size } => Self::ObjectTooBig { object_size, max_object_size },
897            crate::execution_status::ExecutionFailureStatus::MovePackageTooBig { object_size, max_object_size } => Self::PackageTooBig { object_size, max_object_size },
898            crate::execution_status::ExecutionFailureStatus::CircularObjectOwnership { object } => Self::CircularObjectOwnership { object: object.into() },
899            crate::execution_status::ExecutionFailureStatus::InsufficientCoinBalance => Self::InsufficientCoinBalance,
900            crate::execution_status::ExecutionFailureStatus::CoinBalanceOverflow => Self::CoinBalanceOverflow,
901            crate::execution_status::ExecutionFailureStatus::PublishErrorNonZeroAddress => Self::PublishErrorNonZeroAddress,
902            crate::execution_status::ExecutionFailureStatus::SuiMoveVerificationError => Self::SuiMoveVerificationError,
903            crate::execution_status::ExecutionFailureStatus::MovePrimitiveRuntimeError(move_location_opt) => Self::MovePrimitiveRuntimeError { location: move_location_opt.0.map(Into::into) },
904            crate::execution_status::ExecutionFailureStatus::MoveAbort(move_location, code) => Self::MoveAbort { location: move_location.into(), code },
905            crate::execution_status::ExecutionFailureStatus::VMVerificationOrDeserializationError => Self::VmVerificationOrDeserializationError,
906            crate::execution_status::ExecutionFailureStatus::VMInvariantViolation => Self::VmInvariantViolation,
907            crate::execution_status::ExecutionFailureStatus::FunctionNotFound => Self::FunctionNotFound,
908            crate::execution_status::ExecutionFailureStatus::ArityMismatch => Self::ArityMismatch,
909            crate::execution_status::ExecutionFailureStatus::TypeArityMismatch => Self::TypeArityMismatch,
910            crate::execution_status::ExecutionFailureStatus::NonEntryFunctionInvoked => Self::NonEntryFunctionInvoked,
911            crate::execution_status::ExecutionFailureStatus::CommandArgumentError { arg_idx, kind } => Self::CommandArgumentError { argument: arg_idx, kind: kind.into() },
912            crate::execution_status::ExecutionFailureStatus::TypeArgumentError { argument_idx, kind } => Self::TypeArgumentError { type_argument: argument_idx, kind: kind.into() },
913            crate::execution_status::ExecutionFailureStatus::UnusedValueWithoutDrop { result_idx, secondary_idx } => Self::UnusedValueWithoutDrop { result: result_idx, subresult: secondary_idx },
914            crate::execution_status::ExecutionFailureStatus::InvalidPublicFunctionReturnType { idx } => Self::InvalidPublicFunctionReturnType { index: idx },
915            crate::execution_status::ExecutionFailureStatus::InvalidTransferObject => Self::InvalidTransferObject,
916            crate::execution_status::ExecutionFailureStatus::EffectsTooLarge { current_size, max_size } => Self::EffectsTooLarge { current_size, max_size },
917            crate::execution_status::ExecutionFailureStatus::PublishUpgradeMissingDependency => Self::PublishUpgradeMissingDependency,
918            crate::execution_status::ExecutionFailureStatus::PublishUpgradeDependencyDowngrade => Self::PublishUpgradeDependencyDowngrade,
919            crate::execution_status::ExecutionFailureStatus::PackageUpgradeError { upgrade_error } => Self::PackageUpgradeError { kind: upgrade_error.into() },
920            crate::execution_status::ExecutionFailureStatus::WrittenObjectsTooLarge { current_size, max_size } => Self::WrittenObjectsTooLarge { object_size: current_size, max_object_size:max_size },
921            crate::execution_status::ExecutionFailureStatus::CertificateDenied => Self::CertificateDenied,
922            crate::execution_status::ExecutionFailureStatus::SuiMoveVerificationTimedout => Self::SuiMoveVerificationTimedout,
923            crate::execution_status::ExecutionFailureStatus::SharedObjectOperationNotAllowed => Self::ConsensusObjectOperationNotAllowed,
924            crate::execution_status::ExecutionFailureStatus::InputObjectDeleted => Self::InputObjectDeleted,
925            crate::execution_status::ExecutionFailureStatus::ExecutionCancelledDueToSharedObjectCongestion { congested_objects } => Self::ExecutionCanceledDueToConsensusObjectCongestion { congested_objects: congested_objects.0.into_iter().map(Into::into).collect() },
926            crate::execution_status::ExecutionFailureStatus::AddressDeniedForCoin { address, coin_type } => Self::AddressDeniedForCoin { address: address.into(), coin_type },
927            crate::execution_status::ExecutionFailureStatus::CoinTypeGlobalPause { coin_type } => Self::CoinTypeGlobalPause { coin_type },
928            crate::execution_status::ExecutionFailureStatus::ExecutionCancelledDueToRandomnessUnavailable => Self::ExecutionCanceledDueToRandomnessUnavailable,
929            crate::execution_status::ExecutionFailureStatus::MoveVectorElemTooBig { value_size, max_scaled_size } => Self::MoveVectorElemTooBig { value_size, max_scaled_size },
930            crate::execution_status::ExecutionFailureStatus::MoveRawValueTooBig { value_size, max_scaled_size } => Self::MoveRawValueTooBig { value_size, max_scaled_size },
931            crate::execution_status::ExecutionFailureStatus::InvalidLinkage => Self::InvalidLinkage,
932            crate::execution_status::ExecutionFailureStatus::InsufficientFundsForWithdraw => {
933                Self::InsufficientFundsForWithdraw
934            }
935            crate::execution_status::ExecutionFailureStatus::NonExclusiveWriteInputObjectModified { id } => {
936                Self::NonExclusiveWriteInputObjectModified { object: id.into() }
937            }
938        }
939    }
940}
941
942impl From<ExecutionError> for crate::execution_status::ExecutionFailureStatus {
943    fn from(value: ExecutionError) -> Self {
944        match value {
945            ExecutionError::InsufficientGas => Self::InsufficientGas,
946            ExecutionError::InvalidGasObject => Self::InvalidGasObject,
947            ExecutionError::InvariantViolation => Self::InvariantViolation,
948            ExecutionError::FeatureNotYetSupported => Self::FeatureNotYetSupported,
949            ExecutionError::ObjectTooBig {
950                object_size,
951                max_object_size,
952            } => Self::MoveObjectTooBig {
953                object_size,
954                max_object_size,
955            },
956            ExecutionError::PackageTooBig {
957                object_size,
958                max_object_size,
959            } => Self::MovePackageTooBig {
960                object_size,
961                max_object_size,
962            },
963            ExecutionError::CircularObjectOwnership { object } => Self::CircularObjectOwnership {
964                object: object.into(),
965            },
966            ExecutionError::InsufficientCoinBalance => Self::InsufficientCoinBalance,
967            ExecutionError::CoinBalanceOverflow => Self::CoinBalanceOverflow,
968            ExecutionError::PublishErrorNonZeroAddress => Self::PublishErrorNonZeroAddress,
969            ExecutionError::SuiMoveVerificationError => Self::SuiMoveVerificationError,
970            ExecutionError::MovePrimitiveRuntimeError { location } => {
971                Self::MovePrimitiveRuntimeError(crate::execution_status::MoveLocationOpt(
972                    location.map(Into::into),
973                ))
974            }
975            ExecutionError::MoveAbort { location, code } => Self::MoveAbort(location.into(), code),
976            ExecutionError::VmVerificationOrDeserializationError => {
977                Self::VMVerificationOrDeserializationError
978            }
979            ExecutionError::VmInvariantViolation => Self::VMInvariantViolation,
980            ExecutionError::FunctionNotFound => Self::FunctionNotFound,
981            ExecutionError::ArityMismatch => Self::ArityMismatch,
982            ExecutionError::TypeArityMismatch => Self::TypeArityMismatch,
983            ExecutionError::NonEntryFunctionInvoked => Self::NonEntryFunctionInvoked,
984            ExecutionError::CommandArgumentError { argument, kind } => Self::CommandArgumentError {
985                arg_idx: argument,
986                kind: kind.into(),
987            },
988            ExecutionError::TypeArgumentError {
989                type_argument,
990                kind,
991            } => Self::TypeArgumentError {
992                argument_idx: type_argument,
993                kind: kind.into(),
994            },
995            ExecutionError::UnusedValueWithoutDrop { result, subresult } => {
996                Self::UnusedValueWithoutDrop {
997                    result_idx: result,
998                    secondary_idx: subresult,
999                }
1000            }
1001            ExecutionError::InvalidPublicFunctionReturnType { index } => {
1002                Self::InvalidPublicFunctionReturnType { idx: index }
1003            }
1004            ExecutionError::InvalidTransferObject => Self::InvalidTransferObject,
1005            ExecutionError::EffectsTooLarge {
1006                current_size,
1007                max_size,
1008            } => Self::EffectsTooLarge {
1009                current_size,
1010                max_size,
1011            },
1012            ExecutionError::PublishUpgradeMissingDependency => {
1013                Self::PublishUpgradeMissingDependency
1014            }
1015            ExecutionError::PublishUpgradeDependencyDowngrade => {
1016                Self::PublishUpgradeDependencyDowngrade
1017            }
1018            ExecutionError::PackageUpgradeError { kind } => Self::PackageUpgradeError {
1019                upgrade_error: kind.into(),
1020            },
1021            ExecutionError::WrittenObjectsTooLarge {
1022                object_size,
1023                max_object_size,
1024            } => Self::WrittenObjectsTooLarge {
1025                current_size: object_size,
1026                max_size: max_object_size,
1027            },
1028            ExecutionError::CertificateDenied => Self::CertificateDenied,
1029            ExecutionError::SuiMoveVerificationTimedout => Self::SuiMoveVerificationTimedout,
1030            ExecutionError::ConsensusObjectOperationNotAllowed => {
1031                Self::SharedObjectOperationNotAllowed
1032            }
1033            ExecutionError::InputObjectDeleted => Self::InputObjectDeleted,
1034            ExecutionError::ExecutionCanceledDueToConsensusObjectCongestion {
1035                congested_objects,
1036            } => Self::ExecutionCancelledDueToSharedObjectCongestion {
1037                congested_objects: crate::execution_status::CongestedObjects(
1038                    congested_objects.into_iter().map(Into::into).collect(),
1039                ),
1040            },
1041            ExecutionError::AddressDeniedForCoin { address, coin_type } => {
1042                Self::AddressDeniedForCoin {
1043                    address: address.into(),
1044                    coin_type,
1045                }
1046            }
1047            ExecutionError::CoinTypeGlobalPause { coin_type } => {
1048                Self::CoinTypeGlobalPause { coin_type }
1049            }
1050            ExecutionError::ExecutionCanceledDueToRandomnessUnavailable => {
1051                Self::ExecutionCancelledDueToRandomnessUnavailable
1052            }
1053            ExecutionError::MoveVectorElemTooBig {
1054                value_size,
1055                max_scaled_size,
1056            } => Self::MoveVectorElemTooBig {
1057                value_size,
1058                max_scaled_size,
1059            },
1060            ExecutionError::MoveRawValueTooBig {
1061                value_size,
1062                max_scaled_size,
1063            } => Self::MoveRawValueTooBig {
1064                value_size,
1065                max_scaled_size,
1066            },
1067            ExecutionError::InvalidLinkage => Self::InvalidLinkage,
1068            _ => unreachable!("sdk shouldn't have a variant that the mono repo doesn't"),
1069        }
1070    }
1071}
1072
1073impl From<crate::execution_status::MoveLocation> for MoveLocation {
1074    fn from(value: crate::execution_status::MoveLocation) -> Self {
1075        Self {
1076            package: Address::new(value.module.address().into_bytes()),
1077            module: Identifier::new(value.module.name().as_str()).unwrap(),
1078            function: value.function,
1079            instruction: value.instruction,
1080            function_name: value
1081                .function_name
1082                .map(|name| Identifier::new(name).unwrap()),
1083        }
1084    }
1085}
1086
1087impl From<MoveLocation> for crate::execution_status::MoveLocation {
1088    fn from(value: MoveLocation) -> Self {
1089        Self {
1090            module: move_core_types::language_storage::ModuleId::new(
1091                move_core_types::account_address::AccountAddress::new(value.package.into_inner()),
1092                move_core_types::identifier::Identifier::new(value.module.as_str()).unwrap(),
1093            ),
1094            function: value.function,
1095            instruction: value.instruction,
1096            function_name: value.function_name.map(|ident| ident.as_str().into()),
1097        }
1098    }
1099}
1100
1101impl From<crate::execution_status::ExecutionStatus> for ExecutionStatus {
1102    fn from(value: crate::execution_status::ExecutionStatus) -> Self {
1103        match value {
1104            crate::execution_status::ExecutionStatus::Success => Self::Success,
1105            crate::execution_status::ExecutionStatus::Failure { error, command } => Self::Failure {
1106                error: error.into(),
1107                command: command.map(|c| c as u64),
1108            },
1109        }
1110    }
1111}
1112
1113impl From<crate::messages_checkpoint::CheckpointCommitment> for CheckpointCommitment {
1114    fn from(value: crate::messages_checkpoint::CheckpointCommitment) -> Self {
1115        match value {
1116            crate::messages_checkpoint::CheckpointCommitment::ECMHLiveObjectSetDigest(digest) => {
1117                Self::EcmhLiveObjectSet {
1118                    digest: digest.digest.into(),
1119                }
1120            }
1121            crate::messages_checkpoint::CheckpointCommitment::CheckpointArtifactsDigest(digest) => {
1122                Self::CheckpointArtifacts {
1123                    digest: digest.into(),
1124                }
1125            }
1126        }
1127    }
1128}
1129
1130impl TryFrom<crate::crypto::PublicKey> for MultisigMemberPublicKey {
1131    type Error = SdkTypeConversionError;
1132
1133    fn try_from(value: crate::crypto::PublicKey) -> Result<Self, Self::Error> {
1134        match value {
1135            crate::crypto::PublicKey::Ed25519(bytes_representation) => {
1136                Self::Ed25519(Ed25519PublicKey::new(bytes_representation.0))
1137            }
1138            crate::crypto::PublicKey::Secp256k1(bytes_representation) => {
1139                Self::Secp256k1(Secp256k1PublicKey::new(bytes_representation.0))
1140            }
1141            crate::crypto::PublicKey::Secp256r1(bytes_representation) => {
1142                Self::Secp256r1(Secp256r1PublicKey::new(bytes_representation.0))
1143            }
1144            crate::crypto::PublicKey::ZkLogin(z) => Self::ZkLogin(z.try_into()?),
1145            crate::crypto::PublicKey::Passkey(p) => {
1146                Self::Passkey(PasskeyPublicKey::new(Secp256r1PublicKey::new(p.0)))
1147            }
1148        }
1149        .pipe(Ok)
1150    }
1151}
1152
1153impl TryFrom<crate::crypto::CompressedSignature> for MultisigMemberSignature {
1154    type Error = SdkTypeConversionError;
1155
1156    fn try_from(value: crate::crypto::CompressedSignature) -> Result<Self, Self::Error> {
1157        match value {
1158            crate::crypto::CompressedSignature::Ed25519(bytes_representation) => {
1159                Self::Ed25519(Ed25519Signature::new(bytes_representation.0))
1160            }
1161            crate::crypto::CompressedSignature::Secp256k1(bytes_representation) => {
1162                Self::Secp256k1(Secp256k1Signature::new(bytes_representation.0))
1163            }
1164            crate::crypto::CompressedSignature::Secp256r1(bytes_representation) => {
1165                Self::Secp256r1(Secp256r1Signature::new(bytes_representation.0))
1166            }
1167            crate::crypto::CompressedSignature::ZkLogin(z) => {
1168                Self::ZkLogin(Box::new(z.try_into()?))
1169            }
1170            crate::crypto::CompressedSignature::Passkey(p) => Self::Passkey(p.try_into()?),
1171        }
1172        .pipe(Ok)
1173    }
1174}
1175
1176impl TryFrom<crate::crypto::Signature> for SimpleSignature {
1177    type Error = SdkTypeConversionError;
1178
1179    fn try_from(value: crate::crypto::Signature) -> Result<Self, Self::Error> {
1180        match value {
1181            crate::crypto::Signature::Ed25519SuiSignature(ed25519_sui_signature) => Self::Ed25519 {
1182                signature: Ed25519Signature::from_bytes(ed25519_sui_signature.signature_bytes())?,
1183                public_key: Ed25519PublicKey::from_bytes(ed25519_sui_signature.public_key_bytes())?,
1184            },
1185            crate::crypto::Signature::Secp256k1SuiSignature(secp256k1_sui_signature) => {
1186                Self::Secp256k1 {
1187                    signature: Secp256k1Signature::from_bytes(
1188                        secp256k1_sui_signature.signature_bytes(),
1189                    )?,
1190                    public_key: Secp256k1PublicKey::from_bytes(
1191                        secp256k1_sui_signature.public_key_bytes(),
1192                    )?,
1193                }
1194            }
1195
1196            crate::crypto::Signature::Secp256r1SuiSignature(secp256r1_sui_signature) => {
1197                Self::Secp256r1 {
1198                    signature: Secp256r1Signature::from_bytes(
1199                        secp256r1_sui_signature.signature_bytes(),
1200                    )?,
1201                    public_key: Secp256r1PublicKey::from_bytes(
1202                        secp256r1_sui_signature.public_key_bytes(),
1203                    )?,
1204                }
1205            }
1206        }
1207        .pipe(Ok)
1208    }
1209}
1210
1211impl From<crate::crypto::SignatureScheme> for SignatureScheme {
1212    fn from(value: crate::crypto::SignatureScheme) -> Self {
1213        match value {
1214            crate::crypto::SignatureScheme::ED25519 => Self::Ed25519,
1215            crate::crypto::SignatureScheme::Secp256k1 => Self::Secp256k1,
1216            crate::crypto::SignatureScheme::Secp256r1 => Self::Secp256r1,
1217            crate::crypto::SignatureScheme::BLS12381 => Self::Bls12381,
1218            crate::crypto::SignatureScheme::MultiSig => Self::Multisig,
1219            crate::crypto::SignatureScheme::ZkLoginAuthenticator => Self::ZkLogin,
1220            crate::crypto::SignatureScheme::PasskeyAuthenticator => Self::Passkey,
1221        }
1222    }
1223}
1224
1225impl From<crate::transaction::SharedObjectMutability> for Mutability {
1226    fn from(value: crate::transaction::SharedObjectMutability) -> Self {
1227        match value {
1228            crate::transaction::SharedObjectMutability::Immutable => Self::Immutable,
1229            crate::transaction::SharedObjectMutability::Mutable => Self::Mutable,
1230            crate::transaction::SharedObjectMutability::NonExclusiveWrite => {
1231                Self::NonExclusiveWrite
1232            }
1233        }
1234    }
1235}
1236
1237impl From<crate::transaction::CallArg> for Input {
1238    fn from(value: crate::transaction::CallArg) -> Self {
1239        match value {
1240            crate::transaction::CallArg::Pure(value) => Self::Pure(value),
1241            crate::transaction::CallArg::Object(object_arg) => match object_arg {
1242                crate::transaction::ObjectArg::ImmOrOwnedObject((id, version, digest)) => {
1243                    Self::ImmutableOrOwned(ObjectReference::new(
1244                        id.into(),
1245                        version.value(),
1246                        digest.into(),
1247                    ))
1248                }
1249                crate::transaction::ObjectArg::SharedObject {
1250                    id,
1251                    initial_shared_version,
1252                    mutability,
1253                } => Self::Shared(SharedInput::new(
1254                    id.into(),
1255                    initial_shared_version.value(),
1256                    mutability,
1257                )),
1258                crate::transaction::ObjectArg::Receiving((id, version, digest)) => Self::Receiving(
1259                    ObjectReference::new(id.into(), version.value(), digest.into()),
1260                ),
1261            },
1262            crate::transaction::CallArg::FundsWithdrawal(withdrawal) => {
1263                let crate::transaction::Reservation::MaxAmountU64(amount) = withdrawal.reservation;
1264                let crate::transaction::WithdrawalTypeArg::Balance(coin_type) = withdrawal.type_arg;
1265                let source = match withdrawal.withdraw_from {
1266                    crate::transaction::WithdrawFrom::Sender => sui_sdk_types::WithdrawFrom::Sender,
1267                    crate::transaction::WithdrawFrom::Sponsor => {
1268                        sui_sdk_types::WithdrawFrom::Sponsor
1269                    }
1270                };
1271
1272                Self::FundsWithdrawal(FundsWithdrawal::new(
1273                    amount,
1274                    type_tag_core_to_sdk(coin_type).unwrap(),
1275                    source,
1276                ))
1277            }
1278        }
1279    }
1280}
1281
1282impl From<Input> for crate::transaction::CallArg {
1283    fn from(value: Input) -> Self {
1284        use crate::transaction::ObjectArg;
1285
1286        match value {
1287            Input::Pure(value) => Self::Pure(value),
1288            Input::ImmutableOrOwned(object_reference) => {
1289                let (id, version, digest) = object_reference.into_parts();
1290                Self::Object(ObjectArg::ImmOrOwnedObject((
1291                    id.into(),
1292                    version.into(),
1293                    digest.into(),
1294                )))
1295            }
1296            Input::Shared(shared_input) => Self::Object(ObjectArg::SharedObject {
1297                id: shared_input.object_id().into(),
1298                initial_shared_version: shared_input.version().into(),
1299                mutability: match shared_input.mutability() {
1300                    Mutability::Immutable => crate::transaction::SharedObjectMutability::Immutable,
1301                    Mutability::Mutable => crate::transaction::SharedObjectMutability::Mutable,
1302                    Mutability::NonExclusiveWrite => {
1303                        crate::transaction::SharedObjectMutability::NonExclusiveWrite
1304                    }
1305                },
1306            }),
1307            Input::Receiving(object_reference) => {
1308                let (id, version, digest) = object_reference.into_parts();
1309                Self::Object(ObjectArg::Receiving((
1310                    id.into(),
1311                    version.into(),
1312                    digest.into(),
1313                )))
1314            }
1315            Input::FundsWithdrawal(withdrawal) => {
1316                Self::FundsWithdrawal(crate::transaction::FundsWithdrawalArg {
1317                    reservation: withdrawal
1318                        .amount()
1319                        .map(crate::transaction::Reservation::MaxAmountU64)
1320                        .unwrap(),
1321                    type_arg: crate::transaction::WithdrawalTypeArg::Balance(
1322                        type_tag_sdk_to_core(withdrawal.coin_type().to_owned()).unwrap(),
1323                    ),
1324                    withdraw_from: match withdrawal.source() {
1325                        sui_sdk_types::WithdrawFrom::Sender => {
1326                            crate::transaction::WithdrawFrom::Sender
1327                        }
1328                        sui_sdk_types::WithdrawFrom::Sponsor => {
1329                            crate::transaction::WithdrawFrom::Sponsor
1330                        }
1331                        _ => {
1332                            unreachable!("sdk shouldn't have a variant that the mono repo doesn't")
1333                        }
1334                    },
1335                })
1336            }
1337            _ => unreachable!("sdk shouldn't have a variant that the mono repo doesn't"),
1338        }
1339    }
1340}
1341
1342impl From<crate::transaction::Argument> for Argument {
1343    fn from(value: crate::transaction::Argument) -> Self {
1344        match value {
1345            crate::transaction::Argument::GasCoin => Self::Gas,
1346            crate::transaction::Argument::Input(idx) => Self::Input(idx),
1347            crate::transaction::Argument::Result(idx) => Self::Result(idx),
1348            crate::transaction::Argument::NestedResult(idx, sub_idx) => {
1349                Self::NestedResult(idx, sub_idx)
1350            }
1351        }
1352    }
1353}
1354
1355impl From<Argument> for crate::transaction::Argument {
1356    fn from(value: Argument) -> Self {
1357        match value {
1358            Argument::Gas => Self::GasCoin,
1359            Argument::Input(idx) => Self::Input(idx),
1360            Argument::Result(idx) => Self::Result(idx),
1361            Argument::NestedResult(idx, sub_idx) => Self::NestedResult(idx, sub_idx),
1362        }
1363    }
1364}
1365
1366impl TryFrom<TransactionEffects> for crate::effects::TransactionEffects {
1367    type Error = SdkTypeConversionError;
1368
1369    fn try_from(value: TransactionEffects) -> Result<Self, Self::Error> {
1370        match value {
1371            TransactionEffects::V1(v1) => Self::V1((*v1).try_into()?),
1372            TransactionEffects::V2(v2) => Self::V2((*v2).try_into()?),
1373        }
1374        .pipe(Ok)
1375    }
1376}
1377
1378impl TryFrom<crate::effects::TransactionEffects> for TransactionEffects {
1379    type Error = SdkTypeConversionError;
1380
1381    fn try_from(value: crate::effects::TransactionEffects) -> Result<Self, Self::Error> {
1382        match value {
1383            crate::effects::TransactionEffects::V1(v1) => Self::V1(Box::new(v1.try_into()?)),
1384            crate::effects::TransactionEffects::V2(v2) => Self::V2(Box::new(v2.try_into()?)),
1385        }
1386        .pipe(Ok)
1387    }
1388}
1389
1390impl TryFrom<crate::transaction::Command> for Command {
1391    type Error = SdkTypeConversionError;
1392
1393    fn try_from(value: crate::transaction::Command) -> Result<Self, Self::Error> {
1394        match value {
1395            crate::transaction::Command::MoveCall(programmable_move_call) => {
1396                Self::MoveCall((*programmable_move_call).try_into()?)
1397            }
1398            crate::transaction::Command::TransferObjects(vec, argument) => {
1399                Self::TransferObjects(TransferObjects {
1400                    objects: vec.into_iter().map(Into::into).collect(),
1401                    address: argument.into(),
1402                })
1403            }
1404            crate::transaction::Command::SplitCoins(argument, vec) => {
1405                Self::SplitCoins(SplitCoins {
1406                    coin: argument.into(),
1407                    amounts: vec.into_iter().map(Into::into).collect(),
1408                })
1409            }
1410            crate::transaction::Command::MergeCoins(argument, vec) => {
1411                Self::MergeCoins(MergeCoins {
1412                    coin: argument.into(),
1413                    coins_to_merge: vec.into_iter().map(Into::into).collect(),
1414                })
1415            }
1416            crate::transaction::Command::Publish(vec, vec1) => Self::Publish(Publish {
1417                modules: vec,
1418                dependencies: vec1.into_iter().map(Into::into).collect(),
1419            }),
1420            crate::transaction::Command::MakeMoveVec(type_input, elements) => {
1421                Self::MakeMoveVector(MakeMoveVector {
1422                    type_: type_input.map(TryInto::try_into).transpose()?,
1423                    elements: elements.into_iter().map(Into::into).collect(),
1424                })
1425            }
1426            crate::transaction::Command::Upgrade(modules, deps, object_id, ticket) => {
1427                Self::Upgrade(Upgrade {
1428                    modules,
1429                    dependencies: deps.into_iter().map(Into::into).collect(),
1430                    package: object_id.into(),
1431                    ticket: ticket.into(),
1432                })
1433            }
1434        }
1435        .pipe(Ok)
1436    }
1437}
1438
1439impl TryFrom<crate::transaction::ProgrammableMoveCall> for MoveCall {
1440    type Error = SdkTypeConversionError;
1441
1442    fn try_from(value: crate::transaction::ProgrammableMoveCall) -> Result<Self, Self::Error> {
1443        Self {
1444            package: value.package.into(),
1445            module: Identifier::new(value.module)?,
1446            function: Identifier::new(value.function)?,
1447            type_arguments: value
1448                .type_arguments
1449                .into_iter()
1450                .map(TryInto::try_into)
1451                .collect::<Result<_, _>>()?,
1452            arguments: value.arguments.into_iter().map(Into::into).collect(),
1453        }
1454        .pipe(Ok)
1455    }
1456}
1457
1458impl From<MoveCall> for crate::transaction::ProgrammableMoveCall {
1459    fn from(value: MoveCall) -> Self {
1460        Self {
1461            package: value.package.into(),
1462            module: value.module.as_str().into(),
1463            function: value.function.as_str().into(),
1464            type_arguments: value.type_arguments.into_iter().map(Into::into).collect(),
1465            arguments: value.arguments.into_iter().map(Into::into).collect(),
1466        }
1467    }
1468}
1469
1470impl From<Command> for crate::transaction::Command {
1471    fn from(value: Command) -> Self {
1472        match value {
1473            Command::MoveCall(move_call) => Self::MoveCall(Box::new(move_call.into())),
1474            Command::TransferObjects(TransferObjects { objects, address }) => {
1475                Self::TransferObjects(
1476                    objects.into_iter().map(Into::into).collect(),
1477                    address.into(),
1478                )
1479            }
1480            Command::SplitCoins(SplitCoins { coin, amounts }) => {
1481                Self::SplitCoins(coin.into(), amounts.into_iter().map(Into::into).collect())
1482            }
1483            Command::MergeCoins(MergeCoins {
1484                coin,
1485                coins_to_merge,
1486            }) => Self::MergeCoins(
1487                coin.into(),
1488                coins_to_merge.into_iter().map(Into::into).collect(),
1489            ),
1490            Command::Publish(Publish {
1491                modules,
1492                dependencies,
1493            }) => Self::Publish(modules, dependencies.into_iter().map(Into::into).collect()),
1494            Command::MakeMoveVector(MakeMoveVector { type_, elements }) => Self::MakeMoveVec(
1495                type_.map(Into::into),
1496                elements.into_iter().map(Into::into).collect(),
1497            ),
1498            Command::Upgrade(Upgrade {
1499                modules,
1500                dependencies,
1501                package,
1502                ticket,
1503            }) => Self::Upgrade(
1504                modules,
1505                dependencies.into_iter().map(Into::into).collect(),
1506                package.into(),
1507                ticket.into(),
1508            ),
1509            _ => unreachable!("sdk shouldn't have a variant that the mono repo doesn't"),
1510        }
1511    }
1512}
1513
1514impl From<crate::transaction::StoredExecutionTimeObservations> for ExecutionTimeObservations {
1515    fn from(value: crate::transaction::StoredExecutionTimeObservations) -> Self {
1516        match value {
1517            crate::transaction::StoredExecutionTimeObservations::V1(vec) => Self::V1(
1518                vec.into_iter()
1519                    .map(|(key, value)| {
1520                        (
1521                            key.into(),
1522                            value
1523                                .into_iter()
1524                                .map(|(name, duration)| ValidatorExecutionTimeObservation {
1525                                    validator: name.into(),
1526                                    duration,
1527                                })
1528                                .collect(),
1529                        )
1530                    })
1531                    .collect(),
1532            ),
1533        }
1534    }
1535}
1536
1537impl From<crate::execution::ExecutionTimeObservationKey> for ExecutionTimeObservationKey {
1538    fn from(value: crate::execution::ExecutionTimeObservationKey) -> Self {
1539        match value {
1540            crate::execution::ExecutionTimeObservationKey::MoveEntryPoint {
1541                package,
1542                module,
1543                function,
1544                type_arguments,
1545            } => Self::MoveEntryPoint {
1546                package: package.into(),
1547                module,
1548                function,
1549                type_arguments: type_arguments
1550                    .into_iter()
1551                    .map(TryInto::try_into)
1552                    .collect::<Result<_, _>>()
1553                    .unwrap(),
1554            },
1555            crate::execution::ExecutionTimeObservationKey::TransferObjects => Self::TransferObjects,
1556            crate::execution::ExecutionTimeObservationKey::SplitCoins => Self::SplitCoins,
1557            crate::execution::ExecutionTimeObservationKey::MergeCoins => Self::MergeCoins,
1558            crate::execution::ExecutionTimeObservationKey::Publish => Self::Publish,
1559            crate::execution::ExecutionTimeObservationKey::MakeMoveVec => Self::MakeMoveVec,
1560            crate::execution::ExecutionTimeObservationKey::Upgrade => Self::Upgrade,
1561        }
1562    }
1563}
1564
1565impl From<crate::transaction::EndOfEpochTransactionKind> for EndOfEpochTransactionKind {
1566    fn from(value: crate::transaction::EndOfEpochTransactionKind) -> Self {
1567        match value {
1568            crate::transaction::EndOfEpochTransactionKind::ChangeEpoch(change_epoch) => {
1569                Self::ChangeEpoch(change_epoch.into())
1570            }
1571            crate::transaction::EndOfEpochTransactionKind::AuthenticatorStateCreate => {
1572                Self::AuthenticatorStateCreate
1573            }
1574            crate::transaction::EndOfEpochTransactionKind::AuthenticatorStateExpire(
1575                authenticator_state_expire,
1576            ) => Self::AuthenticatorStateExpire(authenticator_state_expire.into()),
1577            crate::transaction::EndOfEpochTransactionKind::RandomnessStateCreate => {
1578                Self::RandomnessStateCreate
1579            }
1580            crate::transaction::EndOfEpochTransactionKind::DenyListStateCreate => {
1581                Self::DenyListStateCreate
1582            }
1583            crate::transaction::EndOfEpochTransactionKind::BridgeStateCreate(chain_identifier) => {
1584                Self::BridgeStateCreate {
1585                    chain_id: Digest::new(chain_identifier.as_bytes().to_owned()),
1586                }
1587            }
1588            crate::transaction::EndOfEpochTransactionKind::BridgeCommitteeInit(sequence_number) => {
1589                Self::BridgeCommitteeInit {
1590                    bridge_object_version: sequence_number.value(),
1591                }
1592            }
1593            crate::transaction::EndOfEpochTransactionKind::StoreExecutionTimeObservations(
1594                stored_execution_time_observations,
1595            ) => Self::StoreExecutionTimeObservations(stored_execution_time_observations.into()),
1596            crate::transaction::EndOfEpochTransactionKind::AccumulatorRootCreate => {
1597                Self::AccumulatorRootCreate
1598            }
1599            crate::transaction::EndOfEpochTransactionKind::CoinRegistryCreate => {
1600                Self::CoinRegistryCreate
1601            }
1602            crate::transaction::EndOfEpochTransactionKind::DisplayRegistryCreate => {
1603                Self::DisplayRegistryCreate
1604            }
1605            crate::transaction::EndOfEpochTransactionKind::AddressAliasStateCreate => {
1606                Self::AddressAliasStateCreate
1607            }
1608            crate::transaction::EndOfEpochTransactionKind::WriteAccumulatorStorageCost(
1609                storage_cost,
1610            ) => Self::WriteAccumulatorStorageCost {
1611                storage_cost: storage_cost.storage_cost,
1612            },
1613        }
1614    }
1615}
1616
1617impl From<crate::transaction::ChangeEpoch> for ChangeEpoch {
1618    fn from(
1619        crate::transaction::ChangeEpoch {
1620            epoch,
1621            protocol_version,
1622            storage_charge,
1623            computation_charge,
1624            storage_rebate,
1625            non_refundable_storage_fee,
1626            epoch_start_timestamp_ms,
1627            system_packages,
1628        }: crate::transaction::ChangeEpoch,
1629    ) -> Self {
1630        Self {
1631            epoch,
1632            protocol_version: protocol_version.as_u64(),
1633            storage_charge,
1634            computation_charge,
1635            storage_rebate,
1636            non_refundable_storage_fee,
1637            epoch_start_timestamp_ms,
1638            system_packages: system_packages
1639                .into_iter()
1640                .map(|(version, modules, dependencies)| SystemPackage {
1641                    version: version.value(),
1642                    modules,
1643                    dependencies: dependencies.into_iter().map(Into::into).collect(),
1644                })
1645                .collect(),
1646        }
1647    }
1648}
1649
1650impl From<crate::transaction::AuthenticatorStateExpire> for AuthenticatorStateExpire {
1651    fn from(value: crate::transaction::AuthenticatorStateExpire) -> Self {
1652        Self {
1653            min_epoch: value.min_epoch,
1654            authenticator_object_initial_shared_version: value
1655                .authenticator_obj_initial_shared_version
1656                .value(),
1657        }
1658    }
1659}
1660
1661impl From<crate::messages_consensus::ConsensusDeterminedVersionAssignments>
1662    for ConsensusDeterminedVersionAssignments
1663{
1664    fn from(value: crate::messages_consensus::ConsensusDeterminedVersionAssignments) -> Self {
1665        use crate::messages_consensus::ConsensusDeterminedVersionAssignments::*;
1666        match value {
1667            CancelledTransactions(vec) => Self::CanceledTransactions {
1668                canceled_transactions: vec
1669                    .into_iter()
1670                    .map(|(digest, assignments)| CanceledTransaction {
1671                        digest: digest.into(),
1672                        version_assignments: assignments
1673                            .into_iter()
1674                            .map(|(id, version)| VersionAssignment {
1675                                object_id: id.into(),
1676                                version: version.value(),
1677                            })
1678                            .collect(),
1679                    })
1680                    .collect(),
1681            },
1682            CancelledTransactionsV2(canceled_transactions) => Self::CanceledTransactionsV2 {
1683                canceled_transactions: canceled_transactions
1684                    .into_iter()
1685                    .map(|(digest, assignments)| CanceledTransactionV2 {
1686                        digest: digest.into(),
1687                        version_assignments: assignments
1688                            .into_iter()
1689                            .map(|((id, start_version), version)| VersionAssignmentV2 {
1690                                object_id: id.into(),
1691                                start_version: start_version.value(),
1692                                version: version.value(),
1693                            })
1694                            .collect(),
1695                    })
1696                    .collect(),
1697            },
1698        }
1699    }
1700}
1701
1702impl From<crate::authenticator_state::ActiveJwk> for ActiveJwk {
1703    fn from(value: crate::authenticator_state::ActiveJwk) -> Self {
1704        let crate::authenticator_state::ActiveJwk { jwk_id, jwk, epoch } = value;
1705        Self {
1706            jwk_id: JwkId {
1707                iss: jwk_id.iss,
1708                kid: jwk_id.kid,
1709            },
1710            jwk: Jwk {
1711                kty: jwk.kty,
1712                e: jwk.e,
1713                n: jwk.n,
1714                alg: jwk.alg,
1715            },
1716            epoch,
1717        }
1718    }
1719}
1720
1721// TODO remaining set of enums to add impls for to ensure new additions are caught during review
1722//
1723// impl From<crate::transaction::TransactionKind> for TransactionKind {
1724//     fn from(value: crate::transaction::TransactionKind) -> Self {
1725//         todo!()
1726//     }
1727// }
1728// src/object.rs:pub enum ObjectData {