Skip to content

Commit

Permalink
Remove the flatten of the MoveValue in Event and rename the field to …
Browse files Browse the repository at this point in the history
…contents
  • Loading branch information
stefan-mysten committed Oct 2, 2024
1 parent ff0a47c commit f736cd3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 52 deletions.
27 changes: 2 additions & 25 deletions crates/sui-graphql-rpc/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1218,32 +1218,9 @@ type Event {
"""
timestamp: DateTime
"""
The value's Move type.
"""
type: MoveType!
"""
The BCS representation of this value, Base64 encoded.
"""
bcs: Base64!
The contents of the event as a Move value.
"""
Structured contents of a Move value.
"""
data: MoveData!
"""
Representation of a Move value in JSON, where:
- Addresses, IDs, and UIDs are represented in canonical form, as JSON strings.
- Bools are represented by JSON boolean literals.
- u8, u16, and u32 are represented as JSON numbers.
- u64, u128, and u256 are represented as JSON strings.
- Vectors are represented by JSON arrays.
- Structs are represented by JSON objects.
- Empty optional values are represented by `null`.
This form is offered as a less verbose convenience in cases where the layout of the type is
known by the client.
"""
json: JSON!
contents: MoveValue!
}

type EventConnection {
Expand Down
4 changes: 2 additions & 2 deletions crates/sui-graphql-rpc/src/types/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ impl Event {
}
}

#[graphql(flatten)]
async fn move_value(&self) -> Result<MoveValue> {
/// The event's contents as a Move value.
async fn contents(&self) -> Result<MoveValue> {
Ok(MoveValue::new(
self.native.type_.clone().into(),
Base64::from(self.native.contents.clone()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1222,32 +1222,9 @@ type Event {
"""
timestamp: DateTime
"""
The value's Move type.
"""
type: MoveType!
"""
The BCS representation of this value, Base64 encoded.
"""
bcs: Base64!
The contents of the event as a Move value.
"""
Structured contents of a Move value.
"""
data: MoveData!
"""
Representation of a Move value in JSON, where:

- Addresses, IDs, and UIDs are represented in canonical form, as JSON strings.
- Bools are represented by JSON boolean literals.
- u8, u16, and u32 are represented as JSON numbers.
- u64, u128, and u256 are represented as JSON strings.
- Vectors are represented by JSON arrays.
- Structs are represented by JSON objects.
- Empty optional values are represented by `null`.

This form is offered as a less verbose convenience in cases where the layout of the type is
known by the client.
"""
json: JSON!
contents: MoveValue!
}

type EventConnection {
Expand Down

0 comments on commit f736cd3

Please sign in to comment.