|
2 | 2 |
|
3 | 3 | from hiero_sdk_python.account.account_id import AccountId |
4 | 4 | from hiero_sdk_python.consensus.topic_create_transaction import TopicCreateTransaction |
| 5 | +from hiero_sdk_python.consensus.topic_delete_transaction import TopicDeleteTransaction |
5 | 6 | from hiero_sdk_python.consensus.topic_id import TopicId |
6 | 7 | from hiero_sdk_python.consensus.topic_info import TopicInfo |
7 | 8 | from hiero_sdk_python.consensus.topic_message_submit_transaction import TopicMessageSubmitTransaction |
|
14 | 15 | from hiero_sdk_python.transaction.transaction_receipt import TransactionReceipt |
15 | 16 | from tck.handlers.registry import rpc_method |
16 | 17 | from tck.param.custom_fee import CustomFeeLimitParams, CustomFeeParams |
17 | | -from tck.param.topic import CreateTopicParams, TopicMessageInfoParams, TopicMessageSubmitParams |
| 18 | +from tck.param.topic import CreateTopicParams, DeleteTopicParams, TopicMessageInfoParams, TopicMessageSubmitParams |
18 | 19 | from tck.response.topic import ( |
19 | 20 | CreateTopicResponse, |
20 | 21 | CustomFeeResponse, |
| 22 | + DeleteTopicResponse, |
21 | 23 | FixedFeeResponse, |
22 | 24 | TopicInfoResponse, |
23 | 25 | TopicMessageSubmitResponse, |
@@ -95,6 +97,25 @@ def create_topic(params: CreateTopicParams) -> CreateTopicResponse: |
95 | 97 | return CreateTopicResponse(topic_id, ResponseCode(receipt.status).name) |
96 | 98 |
|
97 | 99 |
|
| 100 | +@rpc_method("deleteTopic") |
| 101 | +def delete_topic(params: DeleteTopicParams) -> DeleteTopicResponse: |
| 102 | + """Delete topic.""" |
| 103 | + client = get_client(params.sessionId) |
| 104 | + |
| 105 | + transaction = TopicDeleteTransaction().set_grpc_deadline(DEFAULT_GRPC_TIMEOUT) |
| 106 | + |
| 107 | + if params.topicId is not None: |
| 108 | + transaction.set_topic_id(TopicId.from_string(params.topicId)) |
| 109 | + |
| 110 | + if params.commonTransactionParams is not None: |
| 111 | + params.commonTransactionParams.apply_common_params(transaction, client) |
| 112 | + |
| 113 | + response = transaction.execute(client, wait_for_receipt=False) |
| 114 | + receipt: TransactionReceipt = response.get_receipt(client, validate_status=True) |
| 115 | + |
| 116 | + return DeleteTopicResponse(ResponseCode(receipt.status).name) |
| 117 | + |
| 118 | + |
98 | 119 | def _build_custom_fee_limit(params: CustomFeeLimitParams) -> CustomFeeLimit: |
99 | 120 | """Build custom fee limit from params.""" |
100 | 121 | custom_fee_limit = CustomFeeLimit() |
|
0 commit comments