Skip to content

Commit

Permalink
[sui-json-rpc-types] Add back read_dynamic_field_value to SuiMoveSt…
Browse files Browse the repository at this point in the history
…ruct (#18193)

## Description 

Got removed in the enums PR for some reason, so adding it back in.

## Test plan 

CI
  • Loading branch information
tzakian authored Jun 12, 2024
1 parent 3f67d9d commit f7e47e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/sui-json-rpc-types/src/sui_move.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,14 @@ impl SuiMoveStruct {
}
}
}

pub fn field_value(&self, field_name: &str) -> Option<SuiMoveValue> {
match self {
SuiMoveStruct::WithFields(fields) => fields.get(field_name).cloned(),
SuiMoveStruct::WithTypes { type_: _, fields } => fields.get(field_name).cloned(),
_ => None,
}
}
}

impl Display for SuiMoveStruct {
Expand Down

0 comments on commit f7e47e4

Please sign in to comment.