@@ -35,17 +35,19 @@ impl Client {
3535 /// - `result.balance_changes()` - Get balance changes (if requested)
3636 /// - `result.object_changes()` - Get object changes (if requested)
3737 ///
38- /// The `read_mask` controls which fields the server returns; use
39- /// `TransactionReadMask::default()` for the default mask. Pass a
40- /// [`TransactionField `](iota_grpc_types::read_mask_fields::TransactionField)
41- /// or any slice/array/vec of fields — conversion is automatic .
38+ /// Uses the default field mask `TransactionReadMask::default()` which
39+ /// includes effects, events, and input/output objects. Use
40+ /// [`execute_transaction_masked `](Self::execute_transaction_masked) to
41+ /// specify a custom mask .
4242 ///
4343 /// # Checkpoint Inclusion
4444 ///
4545 /// If `checkpoint_inclusion_timeout_ms` is set, the server will wait up to
4646 /// the specified duration (in milliseconds) for the transaction to be
47- /// included in a checkpoint before returning. When set, include
48- /// `checkpoint` and `timestamp` in the `read_mask` to receive the data.
47+ /// included in a checkpoint before returning. When set, callers wanting
48+ /// the checkpoint metadata should use
49+ /// [`execute_transaction_masked`](Self::execute_transaction_masked) with a
50+ /// mask that includes `checkpoint` and `timestamp`.
4951 ///
5052 /// # Example
5153 ///
@@ -57,9 +59,7 @@ impl Client {
5759 /// let client = Client::new_localnet()?;
5860 ///
5961 /// let signed_tx: SignedTransaction = todo!();
60- /// let result = client
61- /// .execute_transaction(signed_tx, None, TransactionReadMask::default())
62- /// .await?;
62+ /// let result = client.execute_transaction(signed_tx, None).await?;
6363 ///
6464 /// let effects = result.body().effects()?.effects()?;
6565 /// println!("Status: {:?}", effects.as_v1().status);
@@ -75,12 +75,32 @@ impl Client {
7575 & self ,
7676 signed_transaction : SignedTransaction ,
7777 checkpoint_inclusion_timeout_ms : impl Into < Option < u64 > > ,
78+ ) -> Result < MetadataEnvelope < ExecutedTransaction > > {
79+ self . execute_transactions_internal (
80+ vec ! [ signed_transaction] ,
81+ checkpoint_inclusion_timeout_ms. into ( ) ,
82+ Default :: default ( ) ,
83+ )
84+ . await ?
85+ . try_map ( extract_single_execution_result)
86+ }
87+
88+ /// Execute a signed transaction, with a custom read mask.
89+ ///
90+ /// See [`execute_transaction`](Self::execute_transaction) for behavior.
91+ /// Pass a
92+ /// [`TransactionField`](iota_grpc_types::read_mask_fields::TransactionField)
93+ /// or any slice/array/vec of fields — conversion is automatic.
94+ pub async fn execute_transaction_masked (
95+ & self ,
96+ signed_transaction : SignedTransaction ,
97+ checkpoint_inclusion_timeout_ms : impl Into < Option < u64 > > ,
7898 read_mask : impl IntoReadMask < TransactionReadMask > ,
7999 ) -> Result < MetadataEnvelope < ExecutedTransaction > > {
80- self . execute_transactions (
100+ self . execute_transactions_internal (
81101 vec ! [ signed_transaction] ,
82- checkpoint_inclusion_timeout_ms,
83- read_mask,
102+ checkpoint_inclusion_timeout_ms. into ( ) ,
103+ read_mask. into_read_mask ( ) ,
84104 )
85105 . await ?
86106 . try_map ( extract_single_execution_result)
@@ -95,18 +115,18 @@ impl Client {
95115 /// input. Each element is either the successfully executed transaction or
96116 /// the per-item error returned by the server.
97117 ///
98- /// The `read_mask` controls which fields the server returns for each
99- /// `ExecutedTransaction`; use `TransactionReadMask::default()` for the
100- /// default mask. Pass a
101- /// [`TransactionField`](iota_grpc_types::read_mask_fields::TransactionField)
102- /// or any slice/array/vec of fields — conversion is automatic.
118+ /// Uses the default field mask `TransactionReadMask::default()`. Use
119+ /// [`execute_transactions_masked`](Self::execute_transactions_masked) to
120+ /// specify a custom mask.
103121 ///
104122 /// # Checkpoint Inclusion
105123 ///
106124 /// If `checkpoint_inclusion_timeout_ms` is set, the server will wait up to
107125 /// the specified duration (in milliseconds) for all executed transactions
108- /// to be included in a checkpoint before returning. When set, include
109- /// `checkpoint` and `timestamp` in the `read_mask` to receive the data.
126+ /// to be included in a checkpoint before returning. Callers wanting the
127+ /// checkpoint metadata should use
128+ /// [`execute_transactions_masked`](Self::execute_transactions_masked) with
129+ /// a mask that includes `checkpoint` and `timestamp`.
110130 ///
111131 /// # Errors
112132 ///
@@ -117,10 +137,41 @@ impl Client {
117137 & self ,
118138 transactions : Vec < SignedTransaction > ,
119139 checkpoint_inclusion_timeout_ms : impl Into < Option < u64 > > ,
140+ ) -> Result < MetadataEnvelope < Vec < Result < ExecutedTransaction > > > > {
141+ self . execute_transactions_internal (
142+ transactions,
143+ checkpoint_inclusion_timeout_ms. into ( ) ,
144+ Default :: default ( ) ,
145+ )
146+ . await
147+ }
148+
149+ /// Execute a batch of signed transactions, with a custom read mask.
150+ ///
151+ /// See [`execute_transactions`](Self::execute_transactions) for behavior.
152+ /// Pass a
153+ /// [`TransactionField`](iota_grpc_types::read_mask_fields::TransactionField)
154+ /// or any slice/array/vec of fields — conversion is automatic.
155+ pub async fn execute_transactions_masked (
156+ & self ,
157+ transactions : Vec < SignedTransaction > ,
158+ checkpoint_inclusion_timeout_ms : impl Into < Option < u64 > > ,
120159 read_mask : impl IntoReadMask < TransactionReadMask > ,
121160 ) -> Result < MetadataEnvelope < Vec < Result < ExecutedTransaction > > > > {
122- let read_mask = read_mask. into_read_mask ( ) ;
123- let checkpoint_inclusion_timeout_ms = checkpoint_inclusion_timeout_ms. into ( ) ;
161+ self . execute_transactions_internal (
162+ transactions,
163+ checkpoint_inclusion_timeout_ms. into ( ) ,
164+ read_mask. into_read_mask ( ) ,
165+ )
166+ . await
167+ }
168+
169+ async fn execute_transactions_internal (
170+ & self ,
171+ transactions : Vec < SignedTransaction > ,
172+ checkpoint_inclusion_timeout_ms : Option < u64 > ,
173+ read_mask : TransactionReadMask ,
174+ ) -> Result < MetadataEnvelope < Vec < Result < ExecutedTransaction > > > > {
124175 if transactions. is_empty ( ) {
125176 return Err ( Error :: EmptyRequest ) ;
126177 }
0 commit comments