@@ -33,17 +33,19 @@ impl Client {
3333 /// - `result.balance_changes()` - Get balance changes (if requested)
3434 /// - `result.object_changes()` - Get object changes (if requested)
3535 ///
36- /// The `read_mask` controls which fields the server returns; use
37- /// `TransactionReadMask::default()` for the default mask. Pass a
38- /// [`TransactionField `](iota_grpc_types::read_mask_fields::TransactionField)
39- /// or any slice/array/vec of fields — conversion is automatic .
36+ /// Uses the default field mask `TransactionReadMask::default()` which
37+ /// includes effects, events, and input/output objects. Use
38+ /// [`execute_transaction_masked `](Self::execute_transaction_masked) to
39+ /// specify a custom mask .
4040 ///
4141 /// # Checkpoint Inclusion
4242 ///
4343 /// If `checkpoint_inclusion_timeout_ms` is set, the server will wait up to
4444 /// the specified duration (in milliseconds) for the transaction to be
45- /// included in a checkpoint before returning. When set, include
46- /// `checkpoint` and `timestamp` in the `read_mask` to receive the data.
45+ /// included in a checkpoint before returning. When set, callers wanting
46+ /// the checkpoint metadata should use
47+ /// [`execute_transaction_masked`](Self::execute_transaction_masked) with a
48+ /// mask that includes `checkpoint` and `timestamp`.
4749 ///
4850 /// # Example
4951 ///
@@ -55,9 +57,7 @@ impl Client {
5557 /// let client = Client::new_localnet()?;
5658 ///
5759 /// let signed_tx: SignedTransaction = todo!();
58- /// let result = client
59- /// .execute_transaction(signed_tx, None, TransactionReadMask::default())
60- /// .await?;
60+ /// let result = client.execute_transaction(signed_tx, None).await?;
6161 ///
6262 /// let effects = result.body().effects()?.effects()?;
6363 /// println!("Status: {:?}", effects.as_v1().status);
@@ -73,12 +73,32 @@ impl Client {
7373 & self ,
7474 signed_transaction : SignedTransaction ,
7575 checkpoint_inclusion_timeout_ms : impl Into < Option < u64 > > ,
76+ ) -> Result < MetadataEnvelope < ExecutedTransaction > > {
77+ self . execute_transactions_internal (
78+ vec ! [ signed_transaction] ,
79+ checkpoint_inclusion_timeout_ms. into ( ) ,
80+ Default :: default ( ) ,
81+ )
82+ . await ?
83+ . try_map ( extract_single_execution_result)
84+ }
85+
86+ /// Execute a signed transaction, with a custom read mask.
87+ ///
88+ /// See [`execute_transaction`](Self::execute_transaction) for behavior.
89+ /// Pass a
90+ /// [`TransactionField`](iota_grpc_types::read_mask_fields::TransactionField)
91+ /// or any slice/array/vec of fields — conversion is automatic.
92+ pub async fn execute_transaction_masked (
93+ & self ,
94+ signed_transaction : SignedTransaction ,
95+ checkpoint_inclusion_timeout_ms : impl Into < Option < u64 > > ,
7696 read_mask : impl IntoReadMask < TransactionReadMask > ,
7797 ) -> Result < MetadataEnvelope < ExecutedTransaction > > {
78- self . execute_transactions (
98+ self . execute_transactions_internal (
7999 vec ! [ signed_transaction] ,
80- checkpoint_inclusion_timeout_ms,
81- read_mask,
100+ checkpoint_inclusion_timeout_ms. into ( ) ,
101+ read_mask. into_read_mask ( ) ,
82102 )
83103 . await ?
84104 . try_map ( extract_single_execution_result)
@@ -93,18 +113,18 @@ impl Client {
93113 /// input. Each element is either the successfully executed transaction or
94114 /// the per-item error returned by the server.
95115 ///
96- /// The `read_mask` controls which fields the server returns for each
97- /// `ExecutedTransaction`; use `TransactionReadMask::default()` for the
98- /// default mask. Pass a
99- /// [`TransactionField`](iota_grpc_types::read_mask_fields::TransactionField)
100- /// or any slice/array/vec of fields — conversion is automatic.
116+ /// Uses the default field mask `TransactionReadMask::default()`. Use
117+ /// [`execute_transactions_masked`](Self::execute_transactions_masked) to
118+ /// specify a custom mask.
101119 ///
102120 /// # Checkpoint Inclusion
103121 ///
104122 /// If `checkpoint_inclusion_timeout_ms` is set, the server will wait up to
105123 /// the specified duration (in milliseconds) for all executed transactions
106- /// to be included in a checkpoint before returning. When set, include
107- /// `checkpoint` and `timestamp` in the `read_mask` to receive the data.
124+ /// to be included in a checkpoint before returning. Callers wanting the
125+ /// checkpoint metadata should use
126+ /// [`execute_transactions_masked`](Self::execute_transactions_masked) with
127+ /// a mask that includes `checkpoint` and `timestamp`.
108128 ///
109129 /// # Errors
110130 ///
@@ -115,10 +135,41 @@ impl Client {
115135 & self ,
116136 transactions : Vec < SignedTransaction > ,
117137 checkpoint_inclusion_timeout_ms : impl Into < Option < u64 > > ,
138+ ) -> Result < MetadataEnvelope < Vec < Result < ExecutedTransaction > > > > {
139+ self . execute_transactions_internal (
140+ transactions,
141+ checkpoint_inclusion_timeout_ms. into ( ) ,
142+ Default :: default ( ) ,
143+ )
144+ . await
145+ }
146+
147+ /// Execute a batch of signed transactions, with a custom read mask.
148+ ///
149+ /// See [`execute_transactions`](Self::execute_transactions) for behavior.
150+ /// Pass a
151+ /// [`TransactionField`](iota_grpc_types::read_mask_fields::TransactionField)
152+ /// or any slice/array/vec of fields — conversion is automatic.
153+ pub async fn execute_transactions_masked (
154+ & self ,
155+ transactions : Vec < SignedTransaction > ,
156+ checkpoint_inclusion_timeout_ms : impl Into < Option < u64 > > ,
118157 read_mask : impl IntoReadMask < TransactionReadMask > ,
119158 ) -> Result < MetadataEnvelope < Vec < Result < ExecutedTransaction > > > > {
120- let read_mask = read_mask. into_read_mask ( ) ;
121- let checkpoint_inclusion_timeout_ms = checkpoint_inclusion_timeout_ms. into ( ) ;
159+ self . execute_transactions_internal (
160+ transactions,
161+ checkpoint_inclusion_timeout_ms. into ( ) ,
162+ read_mask. into_read_mask ( ) ,
163+ )
164+ . await
165+ }
166+
167+ async fn execute_transactions_internal (
168+ & self ,
169+ transactions : Vec < SignedTransaction > ,
170+ checkpoint_inclusion_timeout_ms : Option < u64 > ,
171+ read_mask : TransactionReadMask ,
172+ ) -> Result < MetadataEnvelope < Vec < Result < ExecutedTransaction > > > > {
122173 if transactions. is_empty ( ) {
123174 return Err ( Error :: EmptyRequest ) ;
124175 }
0 commit comments