2727"""
2828
2929from hiero_sdk_python .account .account_id import AccountId
30+ from hiero_sdk_python .consensus .topic_id import TopicId
3031from hiero_sdk_python .consensus .topic_info import TopicInfo
3132from hiero_sdk_python .crypto .private_key import PrivateKey
3233from hiero_sdk_python .Duration import Duration
33- from hiero_sdk_python .hapi .services import consensus_topic_info_pb2
34+ from hiero_sdk_python .hapi .services import consensus_get_topic_info_pb2 , consensus_topic_info_pb2
3435from hiero_sdk_python .hapi .services .basic_types_pb2 import AccountID , Key
3536from hiero_sdk_python .hapi .services .timestamp_pb2 import Timestamp
3637from hiero_sdk_python .tokens .custom_fixed_fee import CustomFixedFee
@@ -92,6 +93,7 @@ def mock_ledger_id() -> bytes:
9293def build_mock_topic_info () -> TopicInfo :
9394 """Manually construct a TopicInfo instance with mock data."""
9495 return TopicInfo (
96+ topic_id = TopicId .from_string ("0.0.101" ),
9597 memo = "Example topic memo" ,
9698 running_hash = mock_running_hash (),
9799 sequence_number = 42 ,
@@ -109,24 +111,30 @@ def build_mock_topic_info() -> TopicInfo:
109111
110112def build_topic_info_from_proto () -> TopicInfo :
111113 """Build a TopicInfo from a mocked protobuf message using _from_proto()."""
112- proto = consensus_topic_info_pb2 .ConsensusTopicInfo ()
113- proto .memo = "Topic from protobuf"
114- proto .runningHash = mock_running_hash ()
115- proto .sequenceNumber = 100
116- proto .expirationTime .CopyFrom (mock_expiration_time ())
117- proto .adminKey .CopyFrom (mock_admin_key ())
118- proto .submitKey .CopyFrom (mock_submit_key ())
119- proto .autoRenewPeriod .seconds = 7776000
120- proto .autoRenewAccount .CopyFrom (mock_auto_renew_account ())
121- proto .ledger_id = mock_ledger_id ()
122- proto .custom_fees .append (mock_custom_fee ()._to_topic_fee_proto ())
114+ proto = consensus_get_topic_info_pb2 .ConsensusGetTopicInfoResponse ()
115+ proto .topicID .CopyFrom (TopicId (0 , 0 , 1 )._to_proto ())
116+
117+ topic_info_proto = consensus_topic_info_pb2 .ConsensusTopicInfo ()
118+ topic_info_proto .memo = "Topic from protobuf"
119+ topic_info_proto .runningHash = mock_running_hash ()
120+ topic_info_proto .sequenceNumber = 100
121+ topic_info_proto .expirationTime .CopyFrom (mock_expiration_time ())
122+ topic_info_proto .adminKey .CopyFrom (mock_admin_key ())
123+ topic_info_proto .submitKey .CopyFrom (mock_submit_key ())
124+ topic_info_proto .autoRenewPeriod .seconds = 7776000
125+ topic_info_proto .autoRenewAccount .CopyFrom (mock_auto_renew_account ())
126+ topic_info_proto .ledger_id = mock_ledger_id ()
127+ topic_info_proto .custom_fees .append (mock_custom_fee ()._to_topic_fee_proto ())
128+
129+ proto .topicInfo .CopyFrom (topic_info_proto )
123130
124131 return TopicInfo ._from_proto (proto )
125132
126133
127134def print_topic_info (topic : TopicInfo ) -> None :
128135 """Display the key attributes of a TopicInfo instance."""
129136 print ("\n TopicInfo Details:" )
137+ print (f" TopicId: { topic .topic_id } " )
130138 print (f" Memo: { topic .memo } " )
131139 print (f" Sequence Number: { topic .sequence_number } " )
132140 print (f" Running Hash: { topic .running_hash .hex ()} " )
0 commit comments