File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
src/hiero_sdk_python/consensus Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
2626
2727### Changed
2828
29+ - Refactored TopicId class to use @dataclass decorator for reducing boilerplate code
2930- Renamed ` examples/nft_allowance.py ` to ` examples/account_allowance_nft.py ` for consistency with account class naming scheme
3031- Added changelog conflict resolution examples to ` docs/common_issues.md `
3132- Refactored ` examples/topic_create.py ` to be more modular by splitting functions and renaming ` create_topic() ` to ` main() ` .
Original file line number Diff line number Diff line change 77formats within the Hiero SDK.
88"""
99
10+ from dataclasses import dataclass
11+
1012from hiero_sdk_python .hapi .services import basic_types_pb2
1113
14+ @dataclass
1215class TopicId :
13-
1416 """
1517 Represents the unique identifier of a topic in the Hedera Consensus Service (HCS).
1618
1719 A `TopicId` consists of three components: shard, realm, and num.
1820 This class provides convenient methods for converting between Python objects,
1921 protobuf `TopicID` instances, and string formats.
22+
23+ Args:
24+ shard (int): The shard number of the topic. Defaults to 0.
25+ realm (int): The realm number of the topic. Defaults to 0.
26+ num (int): The topic number. Defaults to 0.
2027 """
21- def __init__ (self , shard : int = 0 , realm : int = 0 , num : int = 0 ) -> None :
22- """
23- Initializes a new instance of the TopicId class.
24- Args:
25- shard (int): The shard number of the topic.
26- realm (int): The realm number of the topic.
27- num (int): The topic number.
28- """
29- self .shard : int = shard
30- self .realm : int = realm
31- self .num : int = num
28+ shard : int = 0
29+ realm : int = 0
30+ num : int = 0
3231
3332 @classmethod
3433 def _from_proto (cls , topic_id_proto : basic_types_pb2 .TopicID ) -> "TopicId" :
You can’t perform that action at this time.
0 commit comments