99from hiero_sdk_python .hapi .services .schedulable_transaction_body_pb2 import (
1010 SchedulableTransactionBody ,
1111)
12+ from hiero_sdk_python .hapi .services .transaction_pb2 import TransactionBody
1213from hiero_sdk_python .hbar import Hbar
1314from hiero_sdk_python .transaction .transaction import Transaction
1415
1920class FileDeleteTransaction (Transaction ):
2021 """
2122 Represents a file deletion transaction on the network.
22-
2323 This transaction deletes a specified file, rendering it inactive.
24-
2524 Inherits from the base Transaction class and implements the required methods
2625 to build and execute a file deletion transaction.
2726 """
2827
2928 def __init__ (self , file_id : FileId | None = None ):
3029 """
3130 Initializes a new FileDeleteTransaction instance with optional file_id.
32-
3331 Args:
3432 file_id (FileId, optional): The ID of the file to be deleted.
3533 """
@@ -40,36 +38,27 @@ def __init__(self, file_id: FileId | None = None):
4038 def set_file_id (self , file_id : FileId ) -> FileDeleteTransaction :
4139 """
4240 Sets the ID of the file to be deleted.
43-
4441 Args:
4542 file_id (FileId): The ID of the file to be deleted.
46-
4743 Returns:
4844 FileDeleteTransaction: Returns self for method chaining.
4945 """
5046 self ._require_not_frozen ()
5147 self .file_id = file_id
5248 return self
5349
54- def _build_proto_body (self ):
50+ def _build_proto_body (self ) -> FileDeleteTransactionBody :
5551 """
5652 Returns the protobuf body for the file delete transaction.
5753
5854 Returns:
5955 FileDeleteTransactionBody: The protobuf body for this transaction.
60-
61- Raises:
62- ValueError: If file_id is not set.
6356 """
64- if self .file_id is None :
65- raise ValueError ("Missing required FileID" )
57+ return FileDeleteTransactionBody (fileID = self .file_id ._to_proto () if self .file_id is not None else None )
6658
67- return FileDeleteTransactionBody (fileID = self .file_id ._to_proto ())
68-
69- def build_transaction_body (self ):
59+ def build_transaction_body (self ) -> TransactionBody :
7060 """
7161 Builds and returns the protobuf transaction body for file deletion.
72-
7362 Returns:
7463 TransactionBody: The protobuf transaction body containing the file deletion details.
7564 """
@@ -81,7 +70,6 @@ def build_transaction_body(self):
8170 def build_scheduled_body (self ) -> SchedulableTransactionBody :
8271 """
8372 Builds the scheduled transaction body for this file delete transaction.
84-
8573 Returns:
8674 SchedulableTransactionBody: The built scheduled transaction body.
8775 """
@@ -93,13 +81,10 @@ def build_scheduled_body(self) -> SchedulableTransactionBody:
9381 def _get_method (self , channel : _Channel ) -> _Method :
9482 """
9583 Gets the method to execute the file delete transaction.
96-
9784 This internal method returns a _Method object containing the appropriate gRPC
9885 function to call when executing this transaction on the network.
99-
10086 Args:
10187 channel (_Channel): The channel containing service stubs
102-
10388 Returns:
10489 _Method: An object containing the transaction function to delete a file.
10590 """
0 commit comments