From 078b0756f07899a54a79535822c6fe9cefea2855 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Sat, 8 Jun 2024 14:04:01 -0500 Subject: [PATCH] types: add helper ObjectInfo::from_object --- crates/sui-types/src/base_types.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/sui-types/src/base_types.rs b/crates/sui-types/src/base_types.rs index 61d065d6822f9..d5d7fc3380f18 100644 --- a/crates/sui-types/src/base_types.rs +++ b/crates/sui-types/src/base_types.rs @@ -499,6 +499,17 @@ impl ObjectInfo { previous_transaction: o.previous_transaction, } } + + pub fn from_object(object: &Object) -> Self { + Self { + object_id: object.id(), + version: object.version(), + digest: object.digest(), + type_: object.into(), + owner: object.owner, + previous_transaction: object.previous_transaction, + } + } } const PACKAGE: &str = "package"; impl ObjectType {