From a4c82ff432b05c175acd885644b5b76ae7a065bb Mon Sep 17 00:00:00 2001 From: Chris Li <666lcz@gmail.com> Date: Sat, 19 Feb 2022 21:19:30 -0800 Subject: [PATCH] Change Type id::ID in Rust to id::VersionedID --- sui_types/src/coin.rs | 8 ++++---- sui_types/src/gas_coin.rs | 4 ++-- sui_types/src/id.rs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sui_types/src/coin.rs b/sui_types/src/coin.rs index dfc3e53e12821..57d93c67cff09 100644 --- a/sui_types/src/coin.rs +++ b/sui_types/src/coin.rs @@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize}; use crate::{ base_types::{ObjectID, SequenceNumber}, - id::ID, + id::VersionedID, SUI_FRAMEWORK_ADDRESS, }; @@ -21,12 +21,12 @@ pub const COIN_STRUCT_NAME: &IdentStr = COIN_MODULE_NAME; // Rust version of the Move FastX::Coin::Coin type #[derive(Debug, Serialize, Deserialize)] pub struct Coin { - id: ID, + id: VersionedID, value: u64, } impl Coin { - pub fn new(id: ID, value: u64) -> Self { + pub fn new(id: VersionedID, value: u64) -> Self { Self { id, value } } @@ -61,7 +61,7 @@ impl Coin { fields: vec![ MoveFieldLayout::new( ident_str!("id").to_owned(), - MoveTypeLayout::Struct(ID::layout()), + MoveTypeLayout::Struct(VersionedID::layout()), ), MoveFieldLayout::new(ident_str!("value").to_owned(), MoveTypeLayout::U64), ], diff --git a/sui_types/src/gas_coin.rs b/sui_types/src/gas_coin.rs index fe858c19761e9..2d847d5f61585 100644 --- a/sui_types/src/gas_coin.rs +++ b/sui_types/src/gas_coin.rs @@ -14,7 +14,7 @@ use crate::{ base_types::{ObjectID, SequenceNumber}, coin::Coin, error::{SuiError, SuiResult}, - id::ID, + id::VersionedID, object::{Data, MoveObject, Object}, SUI_FRAMEWORK_ADDRESS, }; @@ -44,7 +44,7 @@ pub struct GasCoin(Coin); impl GasCoin { pub fn new(id: ObjectID, version: SequenceNumber, value: u64) -> Self { - Self(Coin::new(ID::new(id, version), value)) + Self(Coin::new(VersionedID::new(id, version), value)) } pub fn value(&self) -> u64 { diff --git a/sui_types/src/id.rs b/sui_types/src/id.rs index 6da82b2ca81d3..a888d57509c40 100644 --- a/sui_types/src/id.rs +++ b/sui_types/src/id.rs @@ -20,7 +20,7 @@ pub const ID_BYTES_STRUCT_NAME: &IdentStr = ident_str!("IDBytes"); /// Rust version of the Move FastX::ID::VersionedID type #[derive(Debug, Serialize, Deserialize)] -pub struct ID { +pub struct VersionedID { id: IDBytes, version: u64, } @@ -31,7 +31,7 @@ struct IDBytes { bytes: ObjectID, } -impl ID { +impl VersionedID { pub fn new(bytes: ObjectID, version: SequenceNumber) -> Self { Self { id: IDBytes::new(bytes),