Skip to content

Commit

Permalink
fix some struct filed issue
Browse files Browse the repository at this point in the history
  • Loading branch information
steelgeek091 committed Jan 9, 2025
1 parent ac84d4c commit 6f5d6d4
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ impl From<KeptVMStatus> for KeptVMStatusView {
location,
function,
code_offset,
message: _message,
} => Self::ExecutionFailure {
location: location.into(),
function,
Expand Down
1 change: 1 addition & 0 deletions crates/rooch-rpc-api/src/jsonrpc_types/module_abi_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ impl MoveStructView {
.map(|f| new_move_struct_field_view(m, f))
.collect(),
),
_ => (false, vec![]),
};

let abilities = handle
Expand Down
10 changes: 5 additions & 5 deletions crates/rooch-rpc-api/src/jsonrpc_types/move_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl From<AnnotatedMoveStruct> for AnnotatedMoveStructView {
fn from(origin: AnnotatedMoveStruct) -> Self {
Self {
abilities: origin.abilities.into_u8(),
type_: StrView(origin.type_),
type_: StrView(origin.ty_tag),
value: origin
.value
.into_iter()
Expand Down Expand Up @@ -179,7 +179,7 @@ impl AnnotatedMoveStructVectorView {
.map(|x| IdentifierView::from(x.0.clone()))
.collect();
let abilities = ele.abilities.into_u8();
let type_ = StrView(ele.type_.clone());
let type_ = StrView(ele.ty_tag.clone());
let value: Vec<Vec<AnnotatedMoveValueView>> = origin
.into_iter()
.map(|v| {
Expand Down Expand Up @@ -217,15 +217,15 @@ pub enum SpecificStructView {

impl SpecificStructView {
pub fn try_from_annotated(move_struct: &AnnotatedMoveStruct) -> Option<Self> {
if MoveString::struct_tag_match(&move_struct.type_) {
if MoveString::struct_tag_match(&move_struct.ty_tag) {
MoveString::try_from(move_struct)
.ok()
.map(SpecificStructView::MoveString)
} else if MoveAsciiString::struct_tag_match(&move_struct.type_) {
} else if MoveAsciiString::struct_tag_match(&move_struct.ty_tag) {
MoveAsciiString::try_from(move_struct)
.ok()
.map(SpecificStructView::MoveAsciiString)
} else if ObjectID::struct_tag_match(&move_struct.type_) {
} else if ObjectID::struct_tag_match(&move_struct.ty_tag) {
ObjectID::try_from(move_struct)
.ok()
.map(SpecificStructView::ObjectID)
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-types/src/bitcoin/ord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ where
address: Self::ADDRESS,
module: Self::MODULE_NAME.to_owned(),
name: Self::STRUCT_NAME.to_owned(),
type_params: vec![T::struct_tag().into()],
type_args: vec![T::struct_tag().into()],
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-types/src/framework/account_authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ where
address: Self::ADDRESS,
module: Self::MODULE_NAME.to_owned(),
name: Self::STRUCT_NAME.to_owned(),
type_params: vec![V::type_tag()],
type_args: vec![V::type_tag()],
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions crates/rooch-types/src/framework/coin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ where
address: Self::ADDRESS,
module: Self::MODULE_NAME.to_owned(),
name: Self::STRUCT_NAME.to_owned(),
type_params: vec![T::struct_tag().into()],
type_args: vec![T::struct_tag().into()],
}
}
}
Expand Down Expand Up @@ -113,7 +113,7 @@ where
address: Self::ADDRESS,
module: Self::MODULE_NAME.to_owned(),
name: Self::STRUCT_NAME.to_owned(),
type_params: vec![CoinType::struct_tag().into()],
type_args: vec![CoinType::struct_tag().into()],
}
}
}
Expand Down Expand Up @@ -143,7 +143,7 @@ where
address: Self::ADDRESS,
module: Self::MODULE_NAME.to_owned(),
name: Self::STRUCT_NAME.to_owned(),
type_params: vec![coin_type.into()],
type_args: vec![coin_type.into()],
}
}
}
Expand All @@ -153,7 +153,7 @@ static INVALID_COIN_TYPE: Lazy<StructTag> = Lazy::new(|| StructTag {
address: ROOCH_FRAMEWORK_ADDRESS,
module: MODULE_NAME.to_owned(),
name: ident_str!("InvalidCoinType").to_owned(),
type_params: vec![],
type_args: vec![],
});

impl<CoinType> CoinInfo<CoinType> {
Expand Down
10 changes: 5 additions & 5 deletions crates/rooch-types/src/framework/coin_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl MoveStructType for Balance {
address: Self::ADDRESS,
module: Self::MODULE_NAME.to_owned(),
name: Self::STRUCT_NAME.to_owned(),
type_params: vec![],
type_args: vec![],
}
}
}
Expand All @@ -54,7 +54,7 @@ impl CoinStore {
address: Self::ADDRESS,
module: Self::MODULE_NAME.to_owned(),
name: Self::STRUCT_NAME.to_owned(),
type_params: vec![],
type_args: vec![],
}
}
}
Expand Down Expand Up @@ -93,7 +93,7 @@ where
address: Self::ADDRESS,
module: Self::MODULE_NAME.to_owned(),
name: Self::STRUCT_NAME.to_owned(),
type_params: vec![coin_type.into()],
type_args: vec![coin_type.into()],
}
}
}
Expand Down Expand Up @@ -169,10 +169,10 @@ impl TryFrom<ObjectState> for CoinStoreInfo {
"Expected CoinStore struct tag"
);
ensure!(
raw_object.value.struct_tag.type_params.len() == 1,
raw_object.value.struct_tag.type_args.len() == 1,
"Expected CoinStore type params length to be 1"
);
let coin_type = raw_object.value.struct_tag.type_params[0].clone();
let coin_type = raw_object.value.struct_tag.type_args[0].clone();
let coin_type = match coin_type {
TypeTag::Struct(coin_type) => *coin_type,
_ => return Err(anyhow::anyhow!("Invalid CoinType TypeTag")),
Expand Down

0 comments on commit 6f5d6d4

Please sign in to comment.