From f736cd3200cab6453c12c9b3b874ef5f5198e76c Mon Sep 17 00:00:00 2001 From: stefan-mysten <135084671+stefan-mysten@users.noreply.github.com> Date: Tue, 1 Oct 2024 21:49:45 -0700 Subject: [PATCH] Remove the flatten of the MoveValue in Event and rename the field to contents --- crates/sui-graphql-rpc/schema.graphql | 27 ++----------------- crates/sui-graphql-rpc/src/types/event/mod.rs | 4 +-- .../snapshot_tests__schema.graphql.snap | 27 ++----------------- 3 files changed, 6 insertions(+), 52 deletions(-) diff --git a/crates/sui-graphql-rpc/schema.graphql b/crates/sui-graphql-rpc/schema.graphql index 48e96fa24f3c7d..49a837ff85cbda 100644 --- a/crates/sui-graphql-rpc/schema.graphql +++ b/crates/sui-graphql-rpc/schema.graphql @@ -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 { diff --git a/crates/sui-graphql-rpc/src/types/event/mod.rs b/crates/sui-graphql-rpc/src/types/event/mod.rs index a0f9ddffe4e077..b00aa1d6caec3a 100644 --- a/crates/sui-graphql-rpc/src/types/event/mod.rs +++ b/crates/sui-graphql-rpc/src/types/event/mod.rs @@ -87,8 +87,8 @@ impl Event { } } - #[graphql(flatten)] - async fn move_value(&self) -> Result { + /// The event's contents as a Move value. + async fn contents(&self) -> Result { Ok(MoveValue::new( self.native.type_.clone().into(), Base64::from(self.native.contents.clone()), diff --git a/crates/sui-graphql-rpc/tests/snapshots/snapshot_tests__schema.graphql.snap b/crates/sui-graphql-rpc/tests/snapshots/snapshot_tests__schema.graphql.snap index b94601fa163cce..be89d44bb87705 100644 --- a/crates/sui-graphql-rpc/tests/snapshots/snapshot_tests__schema.graphql.snap +++ b/crates/sui-graphql-rpc/tests/snapshots/snapshot_tests__schema.graphql.snap @@ -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 {