From ad58cb92a6c0fc6663818226b043fab8fdc7b7c1 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Fri, 20 Dec 2024 10:51:30 -0600 Subject: [PATCH] rpc: change all options to default to false when not provided Change all gRPC method options to default to false when not provided. This will result push clients to explicitly ask for the fields that they want instead of relying on any defaults that could change. This also will also make it easier to rely on the generated protobuf option types where if a field isn't present, its accessor will provide the default value of `false`. --- crates/sui-e2e-tests/tests/rpc/checkpoints.rs | 14 ++-- crates/sui-e2e-tests/tests/rpc/objects.rs | 2 +- .../sui-e2e-tests/tests/rpc/transactions.rs | 8 +- crates/sui-rpc-api/openapi/openapi.json | 64 ++++++++-------- crates/sui-rpc-api/proto/sui.node.v2.proto | 73 ++++++++++--------- crates/sui-rpc-api/src/client/sdk.rs | 10 ++- .../src/proto/generated/sui.node.v2.rs | 72 +++++++++--------- crates/sui-rpc-api/src/types.rs | 69 +++++++----------- 8 files changed, 159 insertions(+), 153 deletions(-) diff --git a/crates/sui-e2e-tests/tests/rpc/checkpoints.rs b/crates/sui-e2e-tests/tests/rpc/checkpoints.rs index 27d66cfc1e509..3f2c552384990 100644 --- a/crates/sui-e2e-tests/tests/rpc/checkpoints.rs +++ b/crates/sui-e2e-tests/tests/rpc/checkpoints.rs @@ -71,9 +71,9 @@ async fn get_checkpoint() { assert!(sequence_number.is_some()); assert!(digest.is_some()); - assert!(summary.is_some()); + assert!(summary.is_none()); assert!(summary_bcs.is_none()); - assert!(signature.is_some()); + assert!(signature.is_none()); assert!(contents.is_none()); assert!(contents_bcs.is_none()); @@ -210,9 +210,9 @@ async fn get_full_checkpoint() { assert!(sequence_number.is_some()); assert!(digest.is_some()); - assert!(summary.is_some()); + assert!(summary.is_none()); assert!(summary_bcs.is_none()); - assert!(signature.is_some()); + assert!(signature.is_none()); assert!(contents.is_none()); assert!(contents_bcs.is_none()); @@ -230,14 +230,14 @@ async fn get_full_checkpoint() { } in transactions { assert!(digest.is_some()); - assert!(transaction.is_some()); + assert!(transaction.is_none()); assert!(transaction_bcs.is_none()); - assert!(effects.is_some()); + assert!(effects.is_none()); assert!(effects_bcs.is_none()); if digest == Some(transaction_digest.into()) { found_transaction = true; - assert!(events.is_some()); } + assert!(events.is_none()); assert!(events_bcs.is_none()); assert!(input_objects.is_none()); assert!(output_objects.is_none()); diff --git a/crates/sui-e2e-tests/tests/rpc/objects.rs b/crates/sui-e2e-tests/tests/rpc/objects.rs index e007e2f8575d0..c9d62e692df8a 100644 --- a/crates/sui-e2e-tests/tests/rpc/objects.rs +++ b/crates/sui-e2e-tests/tests/rpc/objects.rs @@ -47,7 +47,7 @@ async fn get_object() { assert_eq!(object_id, Some(id.into())); assert!(version.is_some()); assert!(digest.is_some()); - assert!(object.is_some()); + assert!(object.is_none()); assert!(object_bcs.is_none()); // By default object_bcs isn't returned let GetObjectResponse { diff --git a/crates/sui-e2e-tests/tests/rpc/transactions.rs b/crates/sui-e2e-tests/tests/rpc/transactions.rs index 0f78e97e698dd..0d97e8bb67712 100644 --- a/crates/sui-e2e-tests/tests/rpc/transactions.rs +++ b/crates/sui-e2e-tests/tests/rpc/transactions.rs @@ -46,13 +46,13 @@ async fn get_transaction() { .into_inner(); assert!(digest.is_some()); - assert!(transaction.is_some()); + assert!(transaction.is_none()); assert!(transaction_bcs.is_none()); - assert!(signatures.is_some()); + assert!(signatures.is_none()); assert!(signatures_bytes.is_none()); - assert!(effects.is_some()); + assert!(effects.is_none()); assert!(effects_bcs.is_none()); - assert!(events.is_some()); + assert!(events.is_none()); assert!(events_bcs.is_none()); assert!(checkpoint.is_some()); assert!(timestamp.is_some()); diff --git a/crates/sui-rpc-api/openapi/openapi.json b/crates/sui-rpc-api/openapi/openapi.json index fb4a7e316882a..69e0258d09681 100644 --- a/crates/sui-rpc-api/openapi/openapi.json +++ b/crates/sui-rpc-api/openapi/openapi.json @@ -117,9 +117,9 @@ { "in": "query", "name": "signature", - "description": "Request `ValidatorAggregatedSignature` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `ValidatorAggregatedSignature` be included in the response\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request `ValidatorAggregatedSignature` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `ValidatorAggregatedSignature` be included in the response\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -127,9 +127,9 @@ { "in": "query", "name": "summary", - "description": "Request `CheckpointSummary` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `CheckpointSummary` be included in the response\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request `CheckpointSummary` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `CheckpointSummary` be included in the response\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -249,9 +249,9 @@ { "in": "query", "name": "object", - "description": "Request that `Object` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request that `Object` be included in the response\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request that `Object` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request that `Object` be included in the response\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -315,9 +315,9 @@ { "in": "query", "name": "object", - "description": "Request that `Object` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request that `Object` be included in the response\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request that `Object` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request that `Object` be included in the response\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -480,9 +480,9 @@ { "in": "query", "name": "signature", - "description": "Request `ValidatorAggregatedSignature` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `ValidatorAggregatedSignature` be included in the response\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request `ValidatorAggregatedSignature` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `ValidatorAggregatedSignature` be included in the response\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -490,9 +490,9 @@ { "in": "query", "name": "summary", - "description": "Request `CheckpointSummary` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `CheckpointSummary` be included in the response\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request `CheckpointSummary` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `CheckpointSummary` be included in the response\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -559,9 +559,9 @@ { "in": "query", "name": "effects", - "description": "Request `TransactionEffects` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `TransactionEffects` be included in the response\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request `TransactionEffects` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `TransactionEffects` be included in the response\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -579,9 +579,9 @@ { "in": "query", "name": "events", - "description": "Request `TransactionEvents` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `TransactionEvents` be included in the response\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request `TransactionEvents` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `TransactionEvents` be included in the response\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -599,9 +599,9 @@ { "in": "query", "name": "signatures", - "description": "Request `Vec` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `Vec` be included in the response\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request `Vec` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `Vec` be included in the response\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -619,9 +619,9 @@ { "in": "query", "name": "transaction", - "description": "Request `Transaction` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `Transaction` be included in the response\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request `Transaction` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `Transaction` be included in the response\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -691,9 +691,9 @@ { "in": "query", "name": "effects", - "description": "Request `TransactionEffects` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `TransactionEffects` be included in the response\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request `TransactionEffects` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `TransactionEffects` be included in the response\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -711,9 +711,9 @@ { "in": "query", "name": "events", - "description": "Request `TransactionEvents` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `TransactionEvents` be included in the response\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request `TransactionEvents` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `TransactionEvents` be included in the response\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -731,9 +731,9 @@ { "in": "query", "name": "signatures", - "description": "Request `Vec` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `Vec` be included in the response\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request `Vec` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `Vec` be included in the response\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -751,9 +751,9 @@ { "in": "query", "name": "transaction", - "description": "Request `Transaction` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `Transaction` be included in the response\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request `Transaction` be included in the response\n\nDefaults to `true` if not provided.", + "description": "Request `Transaction` be included in the response\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -816,9 +816,9 @@ { "in": "query", "name": "effects", - "description": "Request `TransactionEffects` be included in the Response.\n\nDefaults to `true` if not provided.", + "description": "Request `TransactionEffects` be included in the Response.\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request `TransactionEffects` be included in the Response.\n\nDefaults to `true` if not provided.", + "description": "Request `TransactionEffects` be included in the Response.\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" @@ -836,9 +836,9 @@ { "in": "query", "name": "events", - "description": "Request `TransactionEvents` be included in the Response.\n\nDefaults to `true` if not provided.", + "description": "Request `TransactionEvents` be included in the Response.\n\nDefaults to `false` if not provided.", "schema": { - "description": "Request `TransactionEvents` be included in the Response.\n\nDefaults to `true` if not provided.", + "description": "Request `TransactionEvents` be included in the Response.\n\nDefaults to `false` if not provided.", "type": "boolean" }, "style": "form" diff --git a/crates/sui-rpc-api/proto/sui.node.v2.proto b/crates/sui-rpc-api/proto/sui.node.v2.proto index b4b681210319b..6e38f05bd2d65 100644 --- a/crates/sui-rpc-api/proto/sui.node.v2.proto +++ b/crates/sui-rpc-api/proto/sui.node.v2.proto @@ -64,35 +64,35 @@ message GetTransactionRequest { message GetTransactionOptions { // Include the sui.types.Transaction message in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool transaction = 1; // Include the Transaction formatted as BCS in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool transaction_bcs = 2; // Include the set of sui.types.UserSignature's in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool signatures = 3; // Include the set of UserSignature's encoded as bytes in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool signatures_bytes = 8; // Include the sui.types.TransactionEffects message in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool effects = 4; // Include the TransactionEffects formatted as BCS in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool effects_bcs = 5; // Include the sui.types.TransactionEvents message in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool events = 6; // Include the TransactionEvents formatted as BCS in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool events_bcs = 7; } @@ -129,11 +129,11 @@ message GetObjectRequest { message GetObjectOptions { // Include the sui.types.Object message in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool object = 1; // Include the Object formatted as BCS in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool object_bcs = 2; } @@ -157,23 +157,23 @@ message GetCheckpointRequest { message GetCheckpointOptions { // Include the sui.types.CheckpointSummary in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool summary = 3; // Include the CheckpointSummary formatted as BCS in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool summary_bcs = 4; // Include the sui.types.ValidatorAggregatedSignature in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool signature = 5; // Include the sui.types.CheckpointContents message in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool contents = 6; // Include the CheckpointContents formatted as BCS in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool contents_bcs = 7; } @@ -200,60 +200,67 @@ message GetFullCheckpointRequest { message GetFullCheckpointOptions { // Include the sui.types.CheckpointSummary in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool summary = 3; // Include the CheckpointSummary formatted as BCS in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool summary_bcs = 4; // Include the sui.types.ValidatorAggregatedSignature in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool signature = 5; // Include the sui.types.CheckpointContents message in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool contents = 6; // Include the CheckpointContents formatted as BCS in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool contents_bcs = 7; // Include the sui.types.Transaction message in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool transaction = 8; // Include the Transaction formatted as BCS in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool transaction_bcs = 9; // Include the sui.types.TransactionEffects message in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool effects = 10; // Include the TransactionEffects formatted as BCS in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool effects_bcs = 11; // Include the sui.types.TransactionEvents message in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool events = 12; // Include the TransactionEvents formatted as BCS in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool events_bcs = 13; + // Include the input objects for transactions in the response. + // + // Defaults to `false` if not included optional bool input_objects = 14; + + // Include the output objects for transactions in the response. + // + // Defaults to `false` if not included optional bool output_objects = 15; // Include the sui.types.Object message in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool object = 16; // Include the Object formatted as BCS in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool object_bcs = 17; } @@ -340,23 +347,23 @@ message ExecuteTransactionRequest { message ExecuteTransactionOptions { // Include the sui.types.TransactionEffects message in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool effects = 4; // Include the TransactionEffects formatted as BCS in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool effects_bcs = 5; // Include the sui.types.TransactionEvents message in the response. // - // Defaults to true if not included + // Defaults to `false` if not included optional bool events = 6; // Include the TransactionEvents formatted as BCS in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool events_bcs = 7; // Include the BalanceChanges in the response. // - // Defaults to false if not included + // Defaults to `false` if not included optional bool balance_changes = 8; } diff --git a/crates/sui-rpc-api/src/client/sdk.rs b/crates/sui-rpc-api/src/client/sdk.rs index 599e1c09b6fb7..add6e1049b20a 100644 --- a/crates/sui-rpc-api/src/client/sdk.rs +++ b/crates/sui-rpc-api/src/client/sdk.rs @@ -126,7 +126,10 @@ impl Client { pub async fn get_object(&self, object_id: ObjectId) -> Result> { let url = self.url().join(&format!("objects/{object_id}"))?; - let request = self.inner.get(url); + let request = self.inner.get(url).query(&crate::types::GetObjectOptions { + object: Some(true), + object_bcs: None, + }); self.json::(request) .await? @@ -142,7 +145,10 @@ impl Client { .url() .join(&format!("objects/{object_id}/version/{version}"))?; - let request = self.inner.get(url); + let request = self.inner.get(url).query(&crate::types::GetObjectOptions { + object: Some(true), + object_bcs: None, + }); self.json::(request) .await? diff --git a/crates/sui-rpc-api/src/proto/generated/sui.node.v2.rs b/crates/sui-rpc-api/src/proto/generated/sui.node.v2.rs index 0e2c96b1ef146..d309e3b700b6e 100644 --- a/crates/sui-rpc-api/src/proto/generated/sui.node.v2.rs +++ b/crates/sui-rpc-api/src/proto/generated/sui.node.v2.rs @@ -46,42 +46,42 @@ pub struct GetTransactionRequest { pub struct GetTransactionOptions { /// Include the sui.types.Transaction message in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "1")] pub transaction: ::core::option::Option, /// Include the Transaction formatted as BCS in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "2")] pub transaction_bcs: ::core::option::Option, /// Include the set of sui.types.UserSignature's in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "3")] pub signatures: ::core::option::Option, /// Include the set of UserSignature's encoded as bytes in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "8")] pub signatures_bytes: ::core::option::Option, /// Include the sui.types.TransactionEffects message in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "4")] pub effects: ::core::option::Option, /// Include the TransactionEffects formatted as BCS in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "5")] pub effects_bcs: ::core::option::Option, /// Include the sui.types.TransactionEvents message in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "6")] pub events: ::core::option::Option, /// Include the TransactionEvents formatted as BCS in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "7")] pub events_bcs: ::core::option::Option, } @@ -134,12 +134,12 @@ pub struct GetObjectRequest { pub struct GetObjectOptions { /// Include the sui.types.Object message in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "1")] pub object: ::core::option::Option, /// Include the Object formatted as BCS in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "2")] pub object_bcs: ::core::option::Option, } @@ -170,27 +170,27 @@ pub struct GetCheckpointRequest { pub struct GetCheckpointOptions { /// Include the sui.types.CheckpointSummary in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "3")] pub summary: ::core::option::Option, /// Include the CheckpointSummary formatted as BCS in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "4")] pub summary_bcs: ::core::option::Option, /// Include the sui.types.ValidatorAggregatedSignature in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "5")] pub signature: ::core::option::Option, /// Include the sui.types.CheckpointContents message in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "6")] pub contents: ::core::option::Option, /// Include the CheckpointContents formatted as BCS in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "7")] pub contents_bcs: ::core::option::Option, } @@ -228,71 +228,77 @@ pub struct GetFullCheckpointRequest { pub struct GetFullCheckpointOptions { /// Include the sui.types.CheckpointSummary in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "3")] pub summary: ::core::option::Option, /// Include the CheckpointSummary formatted as BCS in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "4")] pub summary_bcs: ::core::option::Option, /// Include the sui.types.ValidatorAggregatedSignature in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "5")] pub signature: ::core::option::Option, /// Include the sui.types.CheckpointContents message in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "6")] pub contents: ::core::option::Option, /// Include the CheckpointContents formatted as BCS in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "7")] pub contents_bcs: ::core::option::Option, /// Include the sui.types.Transaction message in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "8")] pub transaction: ::core::option::Option, /// Include the Transaction formatted as BCS in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "9")] pub transaction_bcs: ::core::option::Option, /// Include the sui.types.TransactionEffects message in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "10")] pub effects: ::core::option::Option, /// Include the TransactionEffects formatted as BCS in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "11")] pub effects_bcs: ::core::option::Option, /// Include the sui.types.TransactionEvents message in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "12")] pub events: ::core::option::Option, /// Include the TransactionEvents formatted as BCS in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "13")] pub events_bcs: ::core::option::Option, + /// Include the input objects for transactions in the response. + /// + /// Defaults to `false` if not included #[prost(bool, optional, tag = "14")] pub input_objects: ::core::option::Option, + /// Include the output objects for transactions in the response. + /// + /// Defaults to `false` if not included #[prost(bool, optional, tag = "15")] pub output_objects: ::core::option::Option, /// Include the sui.types.Object message in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "16")] pub object: ::core::option::Option, /// Include the Object formatted as BCS in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "17")] pub object_bcs: ::core::option::Option, } @@ -423,27 +429,27 @@ pub struct ExecuteTransactionRequest { pub struct ExecuteTransactionOptions { /// Include the sui.types.TransactionEffects message in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "4")] pub effects: ::core::option::Option, /// Include the TransactionEffects formatted as BCS in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "5")] pub effects_bcs: ::core::option::Option, /// Include the sui.types.TransactionEvents message in the response. /// - /// Defaults to true if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "6")] pub events: ::core::option::Option, /// Include the TransactionEvents formatted as BCS in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "7")] pub events_bcs: ::core::option::Option, /// Include the BalanceChanges in the response. /// - /// Defaults to false if not included + /// Defaults to `false` if not included #[prost(bool, optional, tag = "8")] pub balance_changes: ::core::option::Option, } diff --git a/crates/sui-rpc-api/src/types.rs b/crates/sui-rpc-api/src/types.rs index f0723602d3c66..188ff120f9bf7 100644 --- a/crates/sui-rpc-api/src/types.rs +++ b/crates/sui-rpc-api/src/types.rs @@ -96,7 +96,7 @@ pub struct ObjectResponse { pub struct GetObjectOptions { /// Request that `Object` be included in the response /// - /// Defaults to `true` if not provided. + /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub object: Option, /// Request that `Object` formated as BCS be included in the response @@ -108,7 +108,7 @@ pub struct GetObjectOptions { impl GetObjectOptions { pub fn include_object(&self) -> bool { - self.object.unwrap_or(true) + self.object.unwrap_or(false) } pub fn include_object_bcs(&self) -> bool { @@ -149,7 +149,7 @@ pub struct CheckpointResponse { pub struct GetCheckpointOptions { /// Request `CheckpointSummary` be included in the response /// - /// Defaults to `true` if not provided. + /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub summary: Option, @@ -161,7 +161,7 @@ pub struct GetCheckpointOptions { /// Request `ValidatorAggregatedSignature` be included in the response /// - /// Defaults to `true` if not provided. + /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub signature: Option, @@ -180,7 +180,7 @@ pub struct GetCheckpointOptions { impl GetCheckpointOptions { pub fn include_summary(&self) -> bool { - self.summary.unwrap_or(true) + self.summary.unwrap_or(false) } pub fn include_summary_bcs(&self) -> bool { @@ -188,7 +188,7 @@ impl GetCheckpointOptions { } pub fn include_signature(&self) -> bool { - self.signature.unwrap_or(true) + self.signature.unwrap_or(false) } pub fn include_contents(&self) -> bool { @@ -256,7 +256,7 @@ pub struct TransactionResponse { pub struct GetTransactionOptions { /// Request `Transaction` be included in the response /// - /// Defaults to `true` if not provided. + /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub transaction: Option, @@ -268,7 +268,7 @@ pub struct GetTransactionOptions { /// Request `Vec` be included in the response /// - /// Defaults to `true` if not provided. + /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub signatures: Option, @@ -280,7 +280,7 @@ pub struct GetTransactionOptions { /// Request `TransactionEffects` be included in the response /// - /// Defaults to `true` if not provided. + /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub effects: Option, @@ -292,7 +292,7 @@ pub struct GetTransactionOptions { /// Request `TransactionEvents` be included in the response /// - /// Defaults to `true` if not provided. + /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub events: Option, @@ -305,7 +305,7 @@ pub struct GetTransactionOptions { impl GetTransactionOptions { pub fn include_transaction(&self) -> bool { - self.transaction.unwrap_or(true) + self.transaction.unwrap_or(false) } pub fn include_transaction_bcs(&self) -> bool { @@ -313,7 +313,7 @@ impl GetTransactionOptions { } pub fn include_signatures(&self) -> bool { - self.signatures.unwrap_or(true) + self.signatures.unwrap_or(false) } pub fn include_signatures_bytes(&self) -> bool { @@ -321,7 +321,7 @@ impl GetTransactionOptions { } pub fn include_effects(&self) -> bool { - self.effects.unwrap_or(true) + self.effects.unwrap_or(false) } pub fn include_effects_bcs(&self) -> bool { @@ -329,7 +329,7 @@ impl GetTransactionOptions { } pub fn include_events(&self) -> bool { - self.events.unwrap_or(true) + self.events.unwrap_or(false) } pub fn include_events_bcs(&self) -> bool { @@ -342,7 +342,7 @@ impl GetTransactionOptions { pub struct ExecuteTransactionOptions { /// Request `TransactionEffects` be included in the Response. /// - /// Defaults to `true` if not provided. + /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub effects: Option, @@ -354,7 +354,7 @@ pub struct ExecuteTransactionOptions { /// Request `TransactionEvents` be included in the Response. /// - /// Defaults to `true` if not provided. + /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub events: Option, @@ -369,24 +369,11 @@ pub struct ExecuteTransactionOptions { /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub balance_changes: Option, - // TODO determine if we want to provide the same level of options for Objects here as we do in - // the get_object apis - // /// Request input `Object`s be included in the Response. - // /// - // /// Defaults to `false` if not provided. - // #[serde(skip_serializing_if = "Option::is_none")] - // pub input_objects: Option, - - // /// Request output `Object`s be included in the Response. - // /// - // /// Defaults to `false` if not provided. - // #[serde(skip_serializing_if = "Option::is_none")] - // pub output_objects: Option, } impl ExecuteTransactionOptions { pub fn include_effects(&self) -> bool { - self.effects.unwrap_or(true) + self.effects.unwrap_or(false) } pub fn include_effects_bcs(&self) -> bool { @@ -394,7 +381,7 @@ impl ExecuteTransactionOptions { } pub fn include_events(&self) -> bool { - self.events.unwrap_or(true) + self.events.unwrap_or(false) } pub fn include_events_bcs(&self) -> bool { @@ -462,7 +449,7 @@ pub enum EffectsFinality { pub struct GetFullCheckpointOptions { /// Request `CheckpointSummary` be included in the response /// - /// Defaults to `true` if not provided. + /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub summary: Option, @@ -474,7 +461,7 @@ pub struct GetFullCheckpointOptions { /// Request `ValidatorAggregatedSignature` be included in the response /// - /// Defaults to `true` if not provided. + /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub signature: Option, @@ -492,7 +479,7 @@ pub struct GetFullCheckpointOptions { /// Request `Transaction` be included in the response /// - /// Defaults to `true` if not provided. + /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub transaction: Option, @@ -504,7 +491,7 @@ pub struct GetFullCheckpointOptions { /// Request `TransactionEffects` be included in the response /// - /// Defaults to `true` if not provided. + /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub effects: Option, @@ -516,7 +503,7 @@ pub struct GetFullCheckpointOptions { /// Request `TransactionEvents` be included in the response /// - /// Defaults to `true` if not provided. + /// Defaults to `false` if not provided. #[serde(skip_serializing_if = "Option::is_none")] pub events: Option, @@ -553,7 +540,7 @@ pub struct GetFullCheckpointOptions { impl GetFullCheckpointOptions { pub fn include_summary(&self) -> bool { - self.summary.unwrap_or(true) + self.summary.unwrap_or(false) } pub fn include_summary_bcs(&self) -> bool { @@ -561,7 +548,7 @@ impl GetFullCheckpointOptions { } pub fn include_signature(&self) -> bool { - self.signature.unwrap_or(true) + self.signature.unwrap_or(false) } pub fn include_contents(&self) -> bool { @@ -573,7 +560,7 @@ impl GetFullCheckpointOptions { } pub fn include_transaction(&self) -> bool { - self.transaction.unwrap_or(true) + self.transaction.unwrap_or(false) } pub fn include_transaction_bcs(&self) -> bool { @@ -581,7 +568,7 @@ impl GetFullCheckpointOptions { } pub fn include_effects(&self) -> bool { - self.effects.unwrap_or(true) + self.effects.unwrap_or(false) } pub fn include_effects_bcs(&self) -> bool { @@ -589,7 +576,7 @@ impl GetFullCheckpointOptions { } pub fn include_events(&self) -> bool { - self.events.unwrap_or(true) + self.events.unwrap_or(false) } pub fn include_events_bcs(&self) -> bool {