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