@@ -47,7 +47,7 @@ def __init__(
4747 self ._initial_transaction_id : Optional [TransactionId ] = None
4848 self ._transaction_ids : List [TransactionId ] = []
4949 self ._signing_keys : List ["PrivateKey" ] = []
50-
50+
5151 def get_required_chunks (self ) -> int :
5252 """
5353 Returns the number of chunks required for the current message.
@@ -91,7 +91,7 @@ def set_message(self, message: str) -> "TopicMessageSubmitTransaction":
9191 self .message = message
9292 self ._total_chunks = self .get_required_chunks ()
9393 return self
94-
94+
9595 def set_chunk_size (self , chunk_size : int ) -> "TopicMessageSubmitTransaction" :
9696 """
9797 Set maximum chunk size in bytes.
@@ -105,11 +105,11 @@ def set_chunk_size(self, chunk_size: int) -> "TopicMessageSubmitTransaction":
105105 self ._require_not_frozen ()
106106 if chunk_size <= 0 :
107107 raise ValueError ("chunk_size must be positive" )
108-
108+
109109 self .chunk_size = chunk_size
110110 self ._total_chunks = self .get_required_chunks ()
111111 return self
112-
112+
113113 def set_max_chunks (self , max_chunks : int ) -> "TopicMessageSubmitTransaction" :
114114 """
115115 Set maximum allowed chunks.
@@ -123,7 +123,7 @@ def set_max_chunks(self, max_chunks: int) -> "TopicMessageSubmitTransaction":
123123 self ._require_not_frozen ()
124124 if max_chunks <= 0 :
125125 raise ValueError ("max_chunks must be positive" )
126-
126+
127127 self .max_chunks = max_chunks
128128 return self
129129
@@ -158,7 +158,7 @@ def add_custom_fee_limit(
158158 self ._require_not_frozen ()
159159 self .custom_fee_limits .append (custom_fee_limit )
160160 return self
161-
161+
162162 def _validate_chunking (self ) -> None :
163163 """
164164 Validates that chunk count does not exceed max_chunks.
@@ -188,7 +188,7 @@ def _build_proto_body(self) -> consensus_submit_message_pb2.ConsensusSubmitMessa
188188 raise ValueError ("Missing required fields: topic_id." )
189189 if self .message is None :
190190 raise ValueError ("Missing required fields: message." )
191-
191+
192192 content = self .message .encode ("utf-8" )
193193
194194 start_index = self ._current_index * self .chunk_size
@@ -216,7 +216,8 @@ def build_transaction_body(self) -> transaction_pb2.TransactionBody:
216216 Builds and returns the protobuf transaction body for message submission.
217217
218218 Returns:
219- TransactionBody: The protobuf transaction body containing the message submission details.
219+ TransactionBody: The protobuf transaction body containing
220+ the message submission details.
220221 """
221222 consensus_submit_message_body = self ._build_proto_body ()
222223 transaction_body = self .build_base_transaction_body ()
@@ -249,14 +250,14 @@ def _get_method(self, channel: _Channel) -> _Method:
249250 transaction_func = channel .topic .submitMessage ,
250251 query_func = None
251252 )
252-
253+
253254 def freeze_with (self , client : "Client" ) -> "TopicMessageSubmitTransaction" :
254255 if self ._transaction_body_bytes :
255256 return self
256257
257258 if self .transaction_id is None :
258259 self .transaction_id = client .generate_transaction_id ()
259-
260+
260261 if not self ._transaction_ids :
261262 base_timestamp = self .transaction_id .valid_start
262263
@@ -275,12 +276,12 @@ def freeze_with(self, client: "Client") -> "TopicMessageSubmitTransaction":
275276 account_id = self .transaction_id .account_id ,
276277 valid_start = chunk_valid_start
277278 )
278-
279+
279280 self ._transaction_ids .append (chunk_transaction_id )
280-
281+
281282 return super ().freeze_with (client )
282283
283-
284+
284285 def execute (self , client : "Client" ):
285286 self ._validate_chunking ()
286287
@@ -298,7 +299,7 @@ def execute(self, client: "Client"):
298299
299300 self ._transaction_body_bytes .clear ()
300301 self ._signature_map .clear ()
301-
302+
302303 self .freeze_with (client )
303304
304305 for signing_key in self ._signing_keys :
@@ -324,4 +325,4 @@ def sign(self, private_key: "PrivateKey"):
324325 self ._signing_keys .append (private_key )
325326
326327 super ().sign (private_key )
327- return self
328+ return self
0 commit comments