@@ -260,7 +260,7 @@ def freeze(self):
260260 """
261261 return self .freeze_with (None )
262262
263- def freeze_with (self , client ):
263+ def freeze_with (self , client : "Client" ):
264264 """
265265 Freezes the transaction by building the transaction body and setting necessary IDs.
266266
@@ -277,19 +277,26 @@ def freeze_with(self, client):
277277 return self
278278
279279 # Check transaction_id and node id to be set when using freeze()
280- if client is None :
281- if self .transaction_id is None :
280+ if self .transaction_id is None :
281+ if client is not None :
282+ operator_account_id = client .operator_account_id
283+ if operator_account_id is not None :
284+ self .transaction_id = client .generate_transaction_id ()
285+ else :
286+ raise ValueError (
287+ "Client must have an operator_account or transactionId must be set."
288+ )
289+ else :
282290 raise ValueError (
283291 "Transaction ID must be set before freezing. Use freeze_with(client) or set_transaction_id()."
284292 )
285-
286- if self .node_account_id is None and len (self .node_account_ids ) == 0 :
293+
294+
295+ if self .node_account_id is None and len (self .node_account_ids ) == 0 :
296+ if client is None :
287297 raise ValueError (
288298 "Node account ID must be set before freezing. Use freeze_with(client) or manually set node_account_ids."
289299 )
290-
291- if self .transaction_id is None :
292- self .transaction_id = client .generate_transaction_id ()
293300
294301 # We iterate through every node in the client's network
295302 # For each node, set the node_account_id and build the transaction body
0 commit comments