Skip to content

Commit 7fd7283

Browse files
committed
feat: implement createTopic functionality and related parameters in TCK handlers
Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
1 parent 03db9a2 commit 7fd7283

4 files changed

Lines changed: 8 additions & 2 deletions

File tree

tck/handlers/topic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def _get_auto_renew_account_state(client, auto_renew_account_id: str | None) ->
8686
return "deleted"
8787
return "unknown"
8888

89+
8990
@rpc_method("createTopic")
9091
def create_topic(params: CreateTopicParams) -> CreateTopicResponse:
9192
client = get_client(params.sessionId)

tck/param/topic.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
@dataclass
1717
class CreateTopicFixedFeeParams:
1818
"""Parameters for a fixed fee custom fee in topic creation."""
19+
1920
amount: int | None = None
2021
denominatingTokenId: str | None = None
2122

@@ -30,6 +31,7 @@ def parse_json_params(cls, params: dict) -> CreateTopicFixedFeeParams:
3031
@dataclass
3132
class CreateTopicCustomFeeParams:
3233
"""Parameters for a custom fee in topic creation."""
34+
3335
feeCollectorAccountId: str | None = None
3436
feeCollectorsExempt: bool | None = None
3537
fixedFee: CreateTopicFixedFeeParams | None = None
@@ -52,6 +54,7 @@ def parse_json_params(cls, params: dict) -> CreateTopicCustomFeeParams:
5254
@dataclass
5355
class CreateTopicParams(BaseTransactionParams):
5456
"""Parameters for creating a topic. Extends BaseTransactionParams to include common transaction parameters."""
57+
5558
memo: str | None = None
5659
adminKey: str | None = None
5760
submitKey: str | None = None

tck/util/param_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def non_empty_string_or_none(value: str | None) -> str | None:
3838
return cleaned if cleaned else None
3939

4040

41-
4241
def non_empty_string_list(values) -> list[str] | None:
4342
"""Trim list entries and remove empty-string items."""
4443
if values is None:

tests/tck/topic_handlers_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Focused createTopic tests for TCK handlers."""
2+
23
from __future__ import annotations
34

45
from unittest.mock import MagicMock, patch
@@ -78,7 +79,9 @@ def test_build_custom_fee_and_reject_empty_collector():
7879
assert fee.denominating_token_id == TokenId(0, 0, 500)
7980
assert fee.all_collectors_are_exempt is True
8081
with pytest.raises(ValueError, match="feeCollectorAccountId cannot be empty"):
81-
_build_custom_fee(CreateTopicCustomFeeParams(feeCollectorAccountId="", fixedFee=CreateTopicFixedFeeParams(amount=1)))
82+
_build_custom_fee(
83+
CreateTopicCustomFeeParams(feeCollectorAccountId="", fixedFee=CreateTopicFixedFeeParams(amount=1))
84+
)
8285

8386

8487
def test_build_transaction_core_fields():

0 commit comments

Comments
 (0)