hiero-sdk-python 0.0.0.dev2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. hiero_sdk_python/__init__.py +93 -0
  2. hiero_sdk_python/account/__init__.py +0 -0
  3. hiero_sdk_python/account/account_balance.py +44 -0
  4. hiero_sdk_python/account/account_create_transaction.py +173 -0
  5. hiero_sdk_python/account/account_id.py +62 -0
  6. hiero_sdk_python/client/__init__.py +0 -0
  7. hiero_sdk_python/client/client.py +139 -0
  8. hiero_sdk_python/client/network.py +143 -0
  9. hiero_sdk_python/consensus/__init__.py +0 -0
  10. hiero_sdk_python/consensus/topic_create_transaction.py +83 -0
  11. hiero_sdk_python/consensus/topic_delete_transaction.py +67 -0
  12. hiero_sdk_python/consensus/topic_id.py +44 -0
  13. hiero_sdk_python/consensus/topic_info.py +91 -0
  14. hiero_sdk_python/consensus/topic_message.py +61 -0
  15. hiero_sdk_python/consensus/topic_message_submit_transaction.py +87 -0
  16. hiero_sdk_python/consensus/topic_update_transaction.py +173 -0
  17. hiero_sdk_python/crypto/__init__.py +0 -0
  18. hiero_sdk_python/crypto/private_key.py +196 -0
  19. hiero_sdk_python/crypto/public_key.py +162 -0
  20. hiero_sdk_python/hapi/mirror/__init__.py +0 -0
  21. hiero_sdk_python/hapi/mirror/consensus_service_pb2.py +44 -0
  22. hiero_sdk_python/hapi/mirror/consensus_service_pb2_grpc.py +106 -0
  23. hiero_sdk_python/hapi/mirror/mirror_network_service_pb2.py +41 -0
  24. hiero_sdk_python/hapi/mirror/mirror_network_service_pb2_grpc.py +108 -0
  25. hiero_sdk_python/hapi/services/__init__.py +0 -0
  26. hiero_sdk_python/hapi/services/address_book_service_pb2.py +41 -0
  27. hiero_sdk_python/hapi/services/address_book_service_pb2.pyi +8 -0
  28. hiero_sdk_python/hapi/services/address_book_service_pb2_grpc.py +444 -0
  29. hiero_sdk_python/hapi/services/auxiliary/tss/tss_encryption_key_pb2.py +37 -0
  30. hiero_sdk_python/hapi/services/auxiliary/tss/tss_encryption_key_pb2.pyi +11 -0
  31. hiero_sdk_python/hapi/services/auxiliary/tss/tss_encryption_key_pb2_grpc.py +24 -0
  32. hiero_sdk_python/hapi/services/auxiliary/tss/tss_message_pb2.py +37 -0
  33. hiero_sdk_python/hapi/services/auxiliary/tss/tss_message_pb2.pyi +17 -0
  34. hiero_sdk_python/hapi/services/auxiliary/tss/tss_message_pb2_grpc.py +24 -0
  35. hiero_sdk_python/hapi/services/auxiliary/tss/tss_share_signature_pb2.py +37 -0
  36. hiero_sdk_python/hapi/services/auxiliary/tss/tss_share_signature_pb2.pyi +17 -0
  37. hiero_sdk_python/hapi/services/auxiliary/tss/tss_share_signature_pb2_grpc.py +24 -0
  38. hiero_sdk_python/hapi/services/auxiliary/tss/tss_vote_pb2.py +37 -0
  39. hiero_sdk_python/hapi/services/auxiliary/tss/tss_vote_pb2.pyi +19 -0
  40. hiero_sdk_python/hapi/services/auxiliary/tss/tss_vote_pb2_grpc.py +24 -0
  41. hiero_sdk_python/hapi/services/basic_types_pb2.py +153 -0
  42. hiero_sdk_python/hapi/services/basic_types_pb2.pyi +694 -0
  43. hiero_sdk_python/hapi/services/basic_types_pb2_grpc.py +24 -0
  44. hiero_sdk_python/hapi/services/consensus_create_topic_pb2.py +39 -0
  45. hiero_sdk_python/hapi/services/consensus_create_topic_pb2.pyi +21 -0
  46. hiero_sdk_python/hapi/services/consensus_create_topic_pb2_grpc.py +24 -0
  47. hiero_sdk_python/hapi/services/consensus_delete_topic_pb2.py +38 -0
  48. hiero_sdk_python/hapi/services/consensus_delete_topic_pb2.pyi +12 -0
  49. hiero_sdk_python/hapi/services/consensus_delete_topic_pb2_grpc.py +24 -0
  50. hiero_sdk_python/hapi/services/consensus_get_topic_info_pb2.py +43 -0
  51. hiero_sdk_python/hapi/services/consensus_get_topic_info_pb2.pyi +27 -0
  52. hiero_sdk_python/hapi/services/consensus_get_topic_info_pb2_grpc.py +24 -0
  53. hiero_sdk_python/hapi/services/consensus_service_pb2.py +41 -0
  54. hiero_sdk_python/hapi/services/consensus_service_pb2.pyi +8 -0
  55. hiero_sdk_python/hapi/services/consensus_service_pb2_grpc.py +432 -0
  56. hiero_sdk_python/hapi/services/consensus_submit_message_pb2.py +40 -0
  57. hiero_sdk_python/hapi/services/consensus_submit_message_pb2.pyi +26 -0
  58. hiero_sdk_python/hapi/services/consensus_submit_message_pb2_grpc.py +24 -0
  59. hiero_sdk_python/hapi/services/consensus_topic_info_pb2.py +40 -0
  60. hiero_sdk_python/hapi/services/consensus_topic_info_pb2.pyi +30 -0
  61. hiero_sdk_python/hapi/services/consensus_topic_info_pb2_grpc.py +24 -0
  62. hiero_sdk_python/hapi/services/consensus_update_topic_pb2.py +41 -0
  63. hiero_sdk_python/hapi/services/consensus_update_topic_pb2.pyi +27 -0
  64. hiero_sdk_python/hapi/services/consensus_update_topic_pb2_grpc.py +24 -0
  65. hiero_sdk_python/hapi/services/contract_call_local_pb2.py +52 -0
  66. hiero_sdk_python/hapi/services/contract_call_local_pb2.pyi +79 -0
  67. hiero_sdk_python/hapi/services/contract_call_local_pb2_grpc.py +24 -0
  68. hiero_sdk_python/hapi/services/contract_call_pb2.py +38 -0
  69. hiero_sdk_python/hapi/services/contract_call_pb2.pyi +18 -0
  70. hiero_sdk_python/hapi/services/contract_call_pb2_grpc.py +24 -0
  71. hiero_sdk_python/hapi/services/contract_create_pb2.py +41 -0
  72. hiero_sdk_python/hapi/services/contract_create_pb2.pyi +45 -0
  73. hiero_sdk_python/hapi/services/contract_create_pb2_grpc.py +24 -0
  74. hiero_sdk_python/hapi/services/contract_delete_pb2.py +38 -0
  75. hiero_sdk_python/hapi/services/contract_delete_pb2.pyi +18 -0
  76. hiero_sdk_python/hapi/services/contract_delete_pb2_grpc.py +24 -0
  77. hiero_sdk_python/hapi/services/contract_get_bytecode_pb2.py +42 -0
  78. hiero_sdk_python/hapi/services/contract_get_bytecode_pb2.pyi +24 -0
  79. hiero_sdk_python/hapi/services/contract_get_bytecode_pb2_grpc.py +24 -0
  80. hiero_sdk_python/hapi/services/contract_get_info_pb2.py +48 -0
  81. hiero_sdk_python/hapi/services/contract_get_info_pb2.pyi +60 -0
  82. hiero_sdk_python/hapi/services/contract_get_info_pb2_grpc.py +24 -0
  83. hiero_sdk_python/hapi/services/contract_get_records_pb2.py +47 -0
  84. hiero_sdk_python/hapi/services/contract_get_records_pb2.pyi +28 -0
  85. hiero_sdk_python/hapi/services/contract_get_records_pb2_grpc.py +24 -0
  86. hiero_sdk_python/hapi/services/contract_types_pb2.py +39 -0
  87. hiero_sdk_python/hapi/services/contract_types_pb2.pyi +15 -0
  88. hiero_sdk_python/hapi/services/contract_types_pb2_grpc.py +24 -0
  89. hiero_sdk_python/hapi/services/contract_update_pb2.py +47 -0
  90. hiero_sdk_python/hapi/services/contract_update_pb2.pyi +39 -0
  91. hiero_sdk_python/hapi/services/contract_update_pb2_grpc.py +24 -0
  92. hiero_sdk_python/hapi/services/crypto_add_live_hash_pb2.py +41 -0
  93. hiero_sdk_python/hapi/services/crypto_add_live_hash_pb2.pyi +25 -0
  94. hiero_sdk_python/hapi/services/crypto_add_live_hash_pb2_grpc.py +24 -0
  95. hiero_sdk_python/hapi/services/crypto_approve_allowance_pb2.py +45 -0
  96. hiero_sdk_python/hapi/services/crypto_approve_allowance_pb2.pyi +56 -0
  97. hiero_sdk_python/hapi/services/crypto_approve_allowance_pb2_grpc.py +24 -0
  98. hiero_sdk_python/hapi/services/crypto_create_pb2.py +45 -0
  99. hiero_sdk_python/hapi/services/crypto_create_pb2.pyi +43 -0
  100. hiero_sdk_python/hapi/services/crypto_create_pb2_grpc.py +24 -0
  101. hiero_sdk_python/hapi/services/crypto_delete_allowance_pb2.py +40 -0
  102. hiero_sdk_python/hapi/services/crypto_delete_allowance_pb2.pyi +23 -0
  103. hiero_sdk_python/hapi/services/crypto_delete_allowance_pb2_grpc.py +24 -0
  104. hiero_sdk_python/hapi/services/crypto_delete_live_hash_pb2.py +38 -0
  105. hiero_sdk_python/hapi/services/crypto_delete_live_hash_pb2.pyi +14 -0
  106. hiero_sdk_python/hapi/services/crypto_delete_live_hash_pb2_grpc.py +24 -0
  107. hiero_sdk_python/hapi/services/crypto_delete_pb2.py +38 -0
  108. hiero_sdk_python/hapi/services/crypto_delete_pb2.pyi +14 -0
  109. hiero_sdk_python/hapi/services/crypto_delete_pb2_grpc.py +24 -0
  110. hiero_sdk_python/hapi/services/crypto_get_account_balance_pb2.py +44 -0
  111. hiero_sdk_python/hapi/services/crypto_get_account_balance_pb2.pyi +31 -0
  112. hiero_sdk_python/hapi/services/crypto_get_account_balance_pb2_grpc.py +24 -0
  113. hiero_sdk_python/hapi/services/crypto_get_account_records_pb2.py +43 -0
  114. hiero_sdk_python/hapi/services/crypto_get_account_records_pb2.pyi +28 -0
  115. hiero_sdk_python/hapi/services/crypto_get_account_records_pb2_grpc.py +24 -0
  116. hiero_sdk_python/hapi/services/crypto_get_info_pb2.py +55 -0
  117. hiero_sdk_python/hapi/services/crypto_get_info_pb2.pyi +73 -0
  118. hiero_sdk_python/hapi/services/crypto_get_info_pb2_grpc.py +24 -0
  119. hiero_sdk_python/hapi/services/crypto_get_live_hash_pb2.py +43 -0
  120. hiero_sdk_python/hapi/services/crypto_get_live_hash_pb2.pyi +27 -0
  121. hiero_sdk_python/hapi/services/crypto_get_live_hash_pb2_grpc.py +24 -0
  122. hiero_sdk_python/hapi/services/crypto_get_stakers_pb2.py +46 -0
  123. hiero_sdk_python/hapi/services/crypto_get_stakers_pb2.pyi +41 -0
  124. hiero_sdk_python/hapi/services/crypto_get_stakers_pb2_grpc.py +24 -0
  125. hiero_sdk_python/hapi/services/crypto_service_pb2.py +41 -0
  126. hiero_sdk_python/hapi/services/crypto_service_pb2.pyi +8 -0
  127. hiero_sdk_python/hapi/services/crypto_service_pb2_grpc.py +787 -0
  128. hiero_sdk_python/hapi/services/crypto_transfer_pb2.py +38 -0
  129. hiero_sdk_python/hapi/services/crypto_transfer_pb2.pyi +15 -0
  130. hiero_sdk_python/hapi/services/crypto_transfer_pb2_grpc.py +24 -0
  131. hiero_sdk_python/hapi/services/crypto_update_pb2.py +55 -0
  132. hiero_sdk_python/hapi/services/crypto_update_pb2.pyi +47 -0
  133. hiero_sdk_python/hapi/services/crypto_update_pb2_grpc.py +24 -0
  134. hiero_sdk_python/hapi/services/custom_fees_pb2.py +46 -0
  135. hiero_sdk_python/hapi/services/custom_fees_pb2.pyi +61 -0
  136. hiero_sdk_python/hapi/services/custom_fees_pb2_grpc.py +24 -0
  137. hiero_sdk_python/hapi/services/duration_pb2.py +37 -0
  138. hiero_sdk_python/hapi/services/duration_pb2.pyi +11 -0
  139. hiero_sdk_python/hapi/services/duration_pb2_grpc.py +24 -0
  140. hiero_sdk_python/hapi/services/ethereum_transaction_pb2.py +38 -0
  141. hiero_sdk_python/hapi/services/ethereum_transaction_pb2.pyi +16 -0
  142. hiero_sdk_python/hapi/services/ethereum_transaction_pb2_grpc.py +24 -0
  143. hiero_sdk_python/hapi/services/event/event_consensus_data_pb2.py +40 -0
  144. hiero_sdk_python/hapi/services/event/event_consensus_data_pb2.pyi +16 -0
  145. hiero_sdk_python/hapi/services/event/event_consensus_data_pb2_grpc.py +24 -0
  146. hiero_sdk_python/hapi/services/event/event_core_pb2.py +40 -0
  147. hiero_sdk_python/hapi/services/event/event_core_pb2.pyi +23 -0
  148. hiero_sdk_python/hapi/services/event/event_core_pb2_grpc.py +24 -0
  149. hiero_sdk_python/hapi/services/event/event_descriptor_pb2.py +37 -0
  150. hiero_sdk_python/hapi/services/event/event_descriptor_pb2.pyi +17 -0
  151. hiero_sdk_python/hapi/services/event/event_descriptor_pb2_grpc.py +24 -0
  152. hiero_sdk_python/hapi/services/event/event_transaction_pb2.py +38 -0
  153. hiero_sdk_python/hapi/services/event/event_transaction_pb2.pyi +14 -0
  154. hiero_sdk_python/hapi/services/event/event_transaction_pb2_grpc.py +24 -0
  155. hiero_sdk_python/hapi/services/event/gossip_event_pb2.py +41 -0
  156. hiero_sdk_python/hapi/services/event/gossip_event_pb2.pyi +20 -0
  157. hiero_sdk_python/hapi/services/event/gossip_event_pb2_grpc.py +24 -0
  158. hiero_sdk_python/hapi/services/event/state_signature_transaction_pb2.py +37 -0
  159. hiero_sdk_python/hapi/services/event/state_signature_transaction_pb2.pyi +15 -0
  160. hiero_sdk_python/hapi/services/event/state_signature_transaction_pb2_grpc.py +24 -0
  161. hiero_sdk_python/hapi/services/exchange_rate_pb2.py +40 -0
  162. hiero_sdk_python/hapi/services/exchange_rate_pb2.pyi +24 -0
  163. hiero_sdk_python/hapi/services/exchange_rate_pb2_grpc.py +24 -0
  164. hiero_sdk_python/hapi/services/file_append_pb2.py +38 -0
  165. hiero_sdk_python/hapi/services/file_append_pb2.pyi +14 -0
  166. hiero_sdk_python/hapi/services/file_append_pb2_grpc.py +24 -0
  167. hiero_sdk_python/hapi/services/file_create_pb2.py +39 -0
  168. hiero_sdk_python/hapi/services/file_create_pb2.pyi +25 -0
  169. hiero_sdk_python/hapi/services/file_create_pb2_grpc.py +24 -0
  170. hiero_sdk_python/hapi/services/file_delete_pb2.py +38 -0
  171. hiero_sdk_python/hapi/services/file_delete_pb2.pyi +12 -0
  172. hiero_sdk_python/hapi/services/file_delete_pb2_grpc.py +24 -0
  173. hiero_sdk_python/hapi/services/file_get_contents_pb2.py +44 -0
  174. hiero_sdk_python/hapi/services/file_get_contents_pb2.pyi +31 -0
  175. hiero_sdk_python/hapi/services/file_get_contents_pb2_grpc.py +24 -0
  176. hiero_sdk_python/hapi/services/file_get_info_pb2.py +45 -0
  177. hiero_sdk_python/hapi/services/file_get_info_pb2.pyi +42 -0
  178. hiero_sdk_python/hapi/services/file_get_info_pb2_grpc.py +24 -0
  179. hiero_sdk_python/hapi/services/file_service_pb2.py +41 -0
  180. hiero_sdk_python/hapi/services/file_service_pb2.pyi +8 -0
  181. hiero_sdk_python/hapi/services/file_service_pb2_grpc.py +423 -0
  182. hiero_sdk_python/hapi/services/file_update_pb2.py +40 -0
  183. hiero_sdk_python/hapi/services/file_update_pb2.pyi +22 -0
  184. hiero_sdk_python/hapi/services/file_update_pb2_grpc.py +24 -0
  185. hiero_sdk_python/hapi/services/freeze_pb2.py +48 -0
  186. hiero_sdk_python/hapi/services/freeze_pb2.pyi +28 -0
  187. hiero_sdk_python/hapi/services/freeze_pb2_grpc.py +24 -0
  188. hiero_sdk_python/hapi/services/freeze_service_pb2.py +39 -0
  189. hiero_sdk_python/hapi/services/freeze_service_pb2.pyi +6 -0
  190. hiero_sdk_python/hapi/services/freeze_service_pb2_grpc.py +107 -0
  191. hiero_sdk_python/hapi/services/freeze_type_pb2.py +37 -0
  192. hiero_sdk_python/hapi/services/freeze_type_pb2.pyi +20 -0
  193. hiero_sdk_python/hapi/services/freeze_type_pb2_grpc.py +24 -0
  194. hiero_sdk_python/hapi/services/get_account_details_pb2.py +56 -0
  195. hiero_sdk_python/hapi/services/get_account_details_pb2.pyi +96 -0
  196. hiero_sdk_python/hapi/services/get_account_details_pb2_grpc.py +24 -0
  197. hiero_sdk_python/hapi/services/get_by_key_pb2.py +45 -0
  198. hiero_sdk_python/hapi/services/get_by_key_pb2.pyi +38 -0
  199. hiero_sdk_python/hapi/services/get_by_key_pb2_grpc.py +24 -0
  200. hiero_sdk_python/hapi/services/get_by_solidity_id_pb2.py +42 -0
  201. hiero_sdk_python/hapi/services/get_by_solidity_id_pb2.pyi +28 -0
  202. hiero_sdk_python/hapi/services/get_by_solidity_id_pb2_grpc.py +24 -0
  203. hiero_sdk_python/hapi/services/network_get_execution_time_pb2.py +42 -0
  204. hiero_sdk_python/hapi/services/network_get_execution_time_pb2.pyi +25 -0
  205. hiero_sdk_python/hapi/services/network_get_execution_time_pb2_grpc.py +24 -0
  206. hiero_sdk_python/hapi/services/network_get_version_info_pb2.py +42 -0
  207. hiero_sdk_python/hapi/services/network_get_version_info_pb2.pyi +24 -0
  208. hiero_sdk_python/hapi/services/network_get_version_info_pb2_grpc.py +24 -0
  209. hiero_sdk_python/hapi/services/network_service_pb2.py +41 -0
  210. hiero_sdk_python/hapi/services/network_service_pb2.pyi +8 -0
  211. hiero_sdk_python/hapi/services/network_service_pb2_grpc.py +250 -0
  212. hiero_sdk_python/hapi/services/node_create_pb2.py +38 -0
  213. hiero_sdk_python/hapi/services/node_create_pb2.pyi +25 -0
  214. hiero_sdk_python/hapi/services/node_create_pb2_grpc.py +24 -0
  215. hiero_sdk_python/hapi/services/node_delete_pb2.py +37 -0
  216. hiero_sdk_python/hapi/services/node_delete_pb2.pyi +11 -0
  217. hiero_sdk_python/hapi/services/node_delete_pb2_grpc.py +24 -0
  218. hiero_sdk_python/hapi/services/node_stake_update_pb2.py +43 -0
  219. hiero_sdk_python/hapi/services/node_stake_update_pb2.pyi +58 -0
  220. hiero_sdk_python/hapi/services/node_stake_update_pb2_grpc.py +24 -0
  221. hiero_sdk_python/hapi/services/node_update_pb2.py +39 -0
  222. hiero_sdk_python/hapi/services/node_update_pb2.pyi +28 -0
  223. hiero_sdk_python/hapi/services/node_update_pb2_grpc.py +24 -0
  224. hiero_sdk_python/hapi/services/query_header_pb2.py +40 -0
  225. hiero_sdk_python/hapi/services/query_header_pb2.pyi +26 -0
  226. hiero_sdk_python/hapi/services/query_header_pb2_grpc.py +24 -0
  227. hiero_sdk_python/hapi/services/query_pb2.py +62 -0
  228. hiero_sdk_python/hapi/services/query_pb2.pyi +84 -0
  229. hiero_sdk_python/hapi/services/query_pb2_grpc.py +24 -0
  230. hiero_sdk_python/hapi/services/response_code_pb2.py +53 -0
  231. hiero_sdk_python/hapi/services/response_code_pb2.pyi +674 -0
  232. hiero_sdk_python/hapi/services/response_code_pb2_grpc.py +24 -0
  233. hiero_sdk_python/hapi/services/response_header_pb2.py +39 -0
  234. hiero_sdk_python/hapi/services/response_header_pb2.pyi +19 -0
  235. hiero_sdk_python/hapi/services/response_header_pb2_grpc.py +24 -0
  236. hiero_sdk_python/hapi/services/response_pb2.py +62 -0
  237. hiero_sdk_python/hapi/services/response_pb2.pyi +84 -0
  238. hiero_sdk_python/hapi/services/response_pb2_grpc.py +24 -0
  239. hiero_sdk_python/hapi/services/schedulable_transaction_body_pb2.py +83 -0
  240. hiero_sdk_python/hapi/services/schedulable_transaction_body_pb2.pyi +151 -0
  241. hiero_sdk_python/hapi/services/schedulable_transaction_body_pb2_grpc.py +24 -0
  242. hiero_sdk_python/hapi/services/schedule_create_pb2.py +40 -0
  243. hiero_sdk_python/hapi/services/schedule_create_pb2.pyi +24 -0
  244. hiero_sdk_python/hapi/services/schedule_create_pb2_grpc.py +24 -0
  245. hiero_sdk_python/hapi/services/schedule_delete_pb2.py +38 -0
  246. hiero_sdk_python/hapi/services/schedule_delete_pb2.pyi +12 -0
  247. hiero_sdk_python/hapi/services/schedule_delete_pb2_grpc.py +24 -0
  248. hiero_sdk_python/hapi/services/schedule_get_info_pb2.py +46 -0
  249. hiero_sdk_python/hapi/services/schedule_get_info_pb2.pyi +56 -0
  250. hiero_sdk_python/hapi/services/schedule_get_info_pb2_grpc.py +24 -0
  251. hiero_sdk_python/hapi/services/schedule_service_pb2.py +41 -0
  252. hiero_sdk_python/hapi/services/schedule_service_pb2.pyi +8 -0
  253. hiero_sdk_python/hapi/services/schedule_service_pb2_grpc.py +402 -0
  254. hiero_sdk_python/hapi/services/schedule_sign_pb2.py +38 -0
  255. hiero_sdk_python/hapi/services/schedule_sign_pb2.pyi +12 -0
  256. hiero_sdk_python/hapi/services/schedule_sign_pb2_grpc.py +24 -0
  257. hiero_sdk_python/hapi/services/smart_contract_service_pb2.py +43 -0
  258. hiero_sdk_python/hapi/services/smart_contract_service_pb2.pyi +8 -0
  259. hiero_sdk_python/hapi/services/smart_contract_service_pb2_grpc.py +604 -0
  260. hiero_sdk_python/hapi/services/system_delete_pb2.py +39 -0
  261. hiero_sdk_python/hapi/services/system_delete_pb2.pyi +17 -0
  262. hiero_sdk_python/hapi/services/system_delete_pb2_grpc.py +24 -0
  263. hiero_sdk_python/hapi/services/system_undelete_pb2.py +38 -0
  264. hiero_sdk_python/hapi/services/system_undelete_pb2.pyi +14 -0
  265. hiero_sdk_python/hapi/services/system_undelete_pb2_grpc.py +24 -0
  266. hiero_sdk_python/hapi/services/throttle_definitions_pb2.py +42 -0
  267. hiero_sdk_python/hapi/services/throttle_definitions_pb2.pyi +31 -0
  268. hiero_sdk_python/hapi/services/throttle_definitions_pb2_grpc.py +24 -0
  269. hiero_sdk_python/hapi/services/timestamp_pb2.py +39 -0
  270. hiero_sdk_python/hapi/services/timestamp_pb2.pyi +19 -0
  271. hiero_sdk_python/hapi/services/timestamp_pb2_grpc.py +24 -0
  272. hiero_sdk_python/hapi/services/token_airdrop_pb2.py +38 -0
  273. hiero_sdk_python/hapi/services/token_airdrop_pb2.pyi +13 -0
  274. hiero_sdk_python/hapi/services/token_airdrop_pb2_grpc.py +24 -0
  275. hiero_sdk_python/hapi/services/token_associate_pb2.py +38 -0
  276. hiero_sdk_python/hapi/services/token_associate_pb2.pyi +15 -0
  277. hiero_sdk_python/hapi/services/token_associate_pb2_grpc.py +24 -0
  278. hiero_sdk_python/hapi/services/token_burn_pb2.py +38 -0
  279. hiero_sdk_python/hapi/services/token_burn_pb2.pyi +17 -0
  280. hiero_sdk_python/hapi/services/token_burn_pb2_grpc.py +24 -0
  281. hiero_sdk_python/hapi/services/token_cancel_airdrop_pb2.py +38 -0
  282. hiero_sdk_python/hapi/services/token_cancel_airdrop_pb2.pyi +13 -0
  283. hiero_sdk_python/hapi/services/token_cancel_airdrop_pb2_grpc.py +24 -0
  284. hiero_sdk_python/hapi/services/token_claim_airdrop_pb2.py +38 -0
  285. hiero_sdk_python/hapi/services/token_claim_airdrop_pb2.pyi +13 -0
  286. hiero_sdk_python/hapi/services/token_claim_airdrop_pb2_grpc.py +24 -0
  287. hiero_sdk_python/hapi/services/token_create_pb2.py +41 -0
  288. hiero_sdk_python/hapi/services/token_create_pb2.pyi +60 -0
  289. hiero_sdk_python/hapi/services/token_create_pb2_grpc.py +24 -0
  290. hiero_sdk_python/hapi/services/token_delete_pb2.py +38 -0
  291. hiero_sdk_python/hapi/services/token_delete_pb2.pyi +12 -0
  292. hiero_sdk_python/hapi/services/token_delete_pb2_grpc.py +24 -0
  293. hiero_sdk_python/hapi/services/token_dissociate_pb2.py +38 -0
  294. hiero_sdk_python/hapi/services/token_dissociate_pb2.pyi +15 -0
  295. hiero_sdk_python/hapi/services/token_dissociate_pb2_grpc.py +24 -0
  296. hiero_sdk_python/hapi/services/token_fee_schedule_update_pb2.py +39 -0
  297. hiero_sdk_python/hapi/services/token_fee_schedule_update_pb2.pyi +16 -0
  298. hiero_sdk_python/hapi/services/token_fee_schedule_update_pb2_grpc.py +24 -0
  299. hiero_sdk_python/hapi/services/token_freeze_account_pb2.py +38 -0
  300. hiero_sdk_python/hapi/services/token_freeze_account_pb2.pyi +14 -0
  301. hiero_sdk_python/hapi/services/token_freeze_account_pb2_grpc.py +24 -0
  302. hiero_sdk_python/hapi/services/token_get_account_nft_infos_pb2.py +43 -0
  303. hiero_sdk_python/hapi/services/token_get_account_nft_infos_pb2.pyi +30 -0
  304. hiero_sdk_python/hapi/services/token_get_account_nft_infos_pb2_grpc.py +24 -0
  305. hiero_sdk_python/hapi/services/token_get_info_pb2.py +47 -0
  306. hiero_sdk_python/hapi/services/token_get_info_pb2.pyi +88 -0
  307. hiero_sdk_python/hapi/services/token_get_info_pb2_grpc.py +24 -0
  308. hiero_sdk_python/hapi/services/token_get_nft_info_pb2.py +45 -0
  309. hiero_sdk_python/hapi/services/token_get_nft_info_pb2.pyi +41 -0
  310. hiero_sdk_python/hapi/services/token_get_nft_info_pb2_grpc.py +24 -0
  311. hiero_sdk_python/hapi/services/token_get_nft_infos_pb2.py +43 -0
  312. hiero_sdk_python/hapi/services/token_get_nft_infos_pb2.pyi +32 -0
  313. hiero_sdk_python/hapi/services/token_get_nft_infos_pb2_grpc.py +24 -0
  314. hiero_sdk_python/hapi/services/token_grant_kyc_pb2.py +38 -0
  315. hiero_sdk_python/hapi/services/token_grant_kyc_pb2.pyi +14 -0
  316. hiero_sdk_python/hapi/services/token_grant_kyc_pb2_grpc.py +24 -0
  317. hiero_sdk_python/hapi/services/token_mint_pb2.py +38 -0
  318. hiero_sdk_python/hapi/services/token_mint_pb2.pyi +17 -0
  319. hiero_sdk_python/hapi/services/token_mint_pb2_grpc.py +24 -0
  320. hiero_sdk_python/hapi/services/token_pause_pb2.py +38 -0
  321. hiero_sdk_python/hapi/services/token_pause_pb2.pyi +12 -0
  322. hiero_sdk_python/hapi/services/token_pause_pb2_grpc.py +24 -0
  323. hiero_sdk_python/hapi/services/token_reject_pb2.py +40 -0
  324. hiero_sdk_python/hapi/services/token_reject_pb2.pyi +23 -0
  325. hiero_sdk_python/hapi/services/token_reject_pb2_grpc.py +24 -0
  326. hiero_sdk_python/hapi/services/token_revoke_kyc_pb2.py +38 -0
  327. hiero_sdk_python/hapi/services/token_revoke_kyc_pb2.pyi +14 -0
  328. hiero_sdk_python/hapi/services/token_revoke_kyc_pb2_grpc.py +24 -0
  329. hiero_sdk_python/hapi/services/token_service_pb2.py +45 -0
  330. hiero_sdk_python/hapi/services/token_service_pb2.pyi +8 -0
  331. hiero_sdk_python/hapi/services/token_service_pb2_grpc.py +1179 -0
  332. hiero_sdk_python/hapi/services/token_unfreeze_account_pb2.py +38 -0
  333. hiero_sdk_python/hapi/services/token_unfreeze_account_pb2.pyi +14 -0
  334. hiero_sdk_python/hapi/services/token_unfreeze_account_pb2_grpc.py +24 -0
  335. hiero_sdk_python/hapi/services/token_unpause_pb2.py +38 -0
  336. hiero_sdk_python/hapi/services/token_unpause_pb2.pyi +12 -0
  337. hiero_sdk_python/hapi/services/token_unpause_pb2_grpc.py +24 -0
  338. hiero_sdk_python/hapi/services/token_update_nfts_pb2.py +39 -0
  339. hiero_sdk_python/hapi/services/token_update_nfts_pb2.pyi +18 -0
  340. hiero_sdk_python/hapi/services/token_update_nfts_pb2_grpc.py +24 -0
  341. hiero_sdk_python/hapi/services/token_update_pb2.py +41 -0
  342. hiero_sdk_python/hapi/services/token_update_pb2.pyi +49 -0
  343. hiero_sdk_python/hapi/services/token_update_pb2_grpc.py +24 -0
  344. hiero_sdk_python/hapi/services/token_wipe_account_pb2.py +38 -0
  345. hiero_sdk_python/hapi/services/token_wipe_account_pb2.pyi +19 -0
  346. hiero_sdk_python/hapi/services/token_wipe_account_pb2_grpc.py +24 -0
  347. hiero_sdk_python/hapi/services/transaction_body_pb2.py +99 -0
  348. hiero_sdk_python/hapi/services/transaction_body_pb2.pyi +197 -0
  349. hiero_sdk_python/hapi/services/transaction_body_pb2_grpc.py +24 -0
  350. hiero_sdk_python/hapi/services/transaction_contents_pb2.py +38 -0
  351. hiero_sdk_python/hapi/services/transaction_contents_pb2.pyi +14 -0
  352. hiero_sdk_python/hapi/services/transaction_contents_pb2_grpc.py +24 -0
  353. hiero_sdk_python/hapi/services/transaction_get_fast_record_pb2.py +43 -0
  354. hiero_sdk_python/hapi/services/transaction_get_fast_record_pb2.pyi +25 -0
  355. hiero_sdk_python/hapi/services/transaction_get_fast_record_pb2_grpc.py +24 -0
  356. hiero_sdk_python/hapi/services/transaction_get_receipt_pb2.py +43 -0
  357. hiero_sdk_python/hapi/services/transaction_get_receipt_pb2.pyi +34 -0
  358. hiero_sdk_python/hapi/services/transaction_get_receipt_pb2_grpc.py +24 -0
  359. hiero_sdk_python/hapi/services/transaction_get_record_pb2.py +43 -0
  360. hiero_sdk_python/hapi/services/transaction_get_record_pb2.pyi +34 -0
  361. hiero_sdk_python/hapi/services/transaction_get_record_pb2_grpc.py +24 -0
  362. hiero_sdk_python/hapi/services/transaction_pb2.py +47 -0
  363. hiero_sdk_python/hapi/services/transaction_pb2.pyi +21 -0
  364. hiero_sdk_python/hapi/services/transaction_pb2_grpc.py +24 -0
  365. hiero_sdk_python/hapi/services/transaction_receipt_pb2.py +40 -0
  366. hiero_sdk_python/hapi/services/transaction_receipt_pb2.pyi +43 -0
  367. hiero_sdk_python/hapi/services/transaction_receipt_pb2_grpc.py +24 -0
  368. hiero_sdk_python/hapi/services/transaction_record_pb2.py +45 -0
  369. hiero_sdk_python/hapi/services/transaction_record_pb2.pyi +66 -0
  370. hiero_sdk_python/hapi/services/transaction_record_pb2_grpc.py +24 -0
  371. hiero_sdk_python/hapi/services/transaction_response_pb2.py +38 -0
  372. hiero_sdk_python/hapi/services/transaction_response_pb2.pyi +14 -0
  373. hiero_sdk_python/hapi/services/transaction_response_pb2_grpc.py +24 -0
  374. hiero_sdk_python/hapi/services/unchecked_submit_pb2.py +37 -0
  375. hiero_sdk_python/hapi/services/unchecked_submit_pb2.pyi +11 -0
  376. hiero_sdk_python/hapi/services/unchecked_submit_pb2_grpc.py +24 -0
  377. hiero_sdk_python/hapi/services/util_prng_pb2.py +37 -0
  378. hiero_sdk_python/hapi/services/util_prng_pb2.pyi +11 -0
  379. hiero_sdk_python/hapi/services/util_prng_pb2_grpc.py +24 -0
  380. hiero_sdk_python/hapi/services/util_service_pb2.py +39 -0
  381. hiero_sdk_python/hapi/services/util_service_pb2.pyi +6 -0
  382. hiero_sdk_python/hapi/services/util_service_pb2_grpc.py +106 -0
  383. hiero_sdk_python/hbar.py +33 -0
  384. hiero_sdk_python/query/__init__.py +0 -0
  385. hiero_sdk_python/query/account_balance_query.py +100 -0
  386. hiero_sdk_python/query/query.py +138 -0
  387. hiero_sdk_python/query/topic_info_query.py +105 -0
  388. hiero_sdk_python/query/topic_message_query.py +105 -0
  389. hiero_sdk_python/query/transaction_get_receipt_query.py +128 -0
  390. hiero_sdk_python/response_code.py +587 -0
  391. hiero_sdk_python/timestamp.py +166 -0
  392. hiero_sdk_python/tokens/__init__.py +0 -0
  393. hiero_sdk_python/tokens/token_associate_transaction.py +85 -0
  394. hiero_sdk_python/tokens/token_create_transaction.py +144 -0
  395. hiero_sdk_python/tokens/token_delete_transaction.py +84 -0
  396. hiero_sdk_python/tokens/token_dissociate_transaction.py +81 -0
  397. hiero_sdk_python/tokens/token_id.py +44 -0
  398. hiero_sdk_python/tokens/token_mint_transaction.py +143 -0
  399. hiero_sdk_python/transaction/__init__.py +0 -0
  400. hiero_sdk_python/transaction/query_payment.py +32 -0
  401. hiero_sdk_python/transaction/transaction.py +267 -0
  402. hiero_sdk_python/transaction/transaction_id.py +140 -0
  403. hiero_sdk_python/transaction/transaction_receipt.py +78 -0
  404. hiero_sdk_python/transaction/transfer_transaction.py +119 -0
  405. hiero_sdk_python/utils/key_format.py +22 -0
  406. hiero_sdk_python-0.0.0.dev2.dist-info/METADATA +822 -0
  407. hiero_sdk_python-0.0.0.dev2.dist-info/RECORD +410 -0
  408. hiero_sdk_python-0.0.0.dev2.dist-info/WHEEL +4 -0
  409. hiero_sdk_python-0.0.0.dev2.dist-info/entry_points.txt +4 -0
  410. hiero_sdk_python-0.0.0.dev2.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,93 @@
1
+ # Client and Network
2
+ from .client.client import Client
3
+ from .client.network import Network
4
+
5
+ # Account
6
+ from .account.account_id import AccountId
7
+ from .account.account_create_transaction import AccountCreateTransaction
8
+
9
+ # Crypto
10
+ from .crypto.private_key import PrivateKey
11
+ from .crypto.public_key import PublicKey
12
+
13
+ # Tokens
14
+ from .tokens.token_create_transaction import TokenCreateTransaction
15
+ from .tokens.token_associate_transaction import TokenAssociateTransaction
16
+ from .tokens.token_dissociate_transaction import TokenDissociateTransaction
17
+ from .tokens.token_delete_transaction import TokenDeleteTransaction
18
+ from .tokens.token_mint_transaction import TokenMintTransaction
19
+ from .tokens.token_id import TokenId
20
+
21
+ # Transaction
22
+ from .transaction.transfer_transaction import TransferTransaction
23
+ from .transaction.transaction_id import TransactionId
24
+ from .transaction.transaction_receipt import TransactionReceipt
25
+
26
+ # Response / Codes
27
+ from .response_code import ResponseCode
28
+
29
+ # HBAR
30
+ from .hbar import Hbar
31
+
32
+ # Timestamp
33
+ from .timestamp import Timestamp
34
+
35
+ # Consensus
36
+ from .consensus.topic_create_transaction import TopicCreateTransaction
37
+ from .consensus.topic_message_submit_transaction import TopicMessageSubmitTransaction
38
+ from .consensus.topic_update_transaction import TopicUpdateTransaction
39
+ from .consensus.topic_delete_transaction import TopicDeleteTransaction
40
+ from .consensus.topic_id import TopicId
41
+
42
+ # Queries
43
+ from .query.topic_info_query import TopicInfoQuery
44
+ from .query.topic_message_query import TopicMessageQuery
45
+ from .query.transaction_get_receipt_query import TransactionGetReceiptQuery
46
+ from .query.account_balance_query import CryptoGetAccountBalanceQuery
47
+
48
+ __all__ = [
49
+ # Client
50
+ "Client",
51
+ "Network",
52
+
53
+ # Account
54
+ "AccountId",
55
+ "AccountCreateTransaction",
56
+
57
+ # Crypto
58
+ "PrivateKey",
59
+ "PublicKey",
60
+
61
+ # Tokens
62
+ "TokenCreateTransaction",
63
+ "TokenAssociateTransaction",
64
+ "TokenDissociateTransaction",
65
+ "TokenDeleteTransaction",
66
+ "TokenMintTransaction",
67
+ "TokenId",
68
+
69
+ # Transaction
70
+ "TransferTransaction",
71
+ "TransactionId",
72
+ "TransactionReceipt",
73
+
74
+ # Response
75
+ "ResponseCode",
76
+
77
+ # Consensus
78
+ "TopicCreateTransaction",
79
+ "TopicMessageSubmitTransaction",
80
+ "TopicUpdateTransaction",
81
+ "TopicDeleteTransaction",
82
+ "TopicId",
83
+
84
+ # Queries
85
+ "TopicInfoQuery",
86
+ "TopicMessageQuery",
87
+ "TransactionGetReceiptQuery",
88
+ "CryptoGetAccountBalanceQuery",
89
+
90
+ "Hbar",
91
+ "ResponseCode",
92
+ "Timestamp"
93
+ ]
File without changes
@@ -0,0 +1,44 @@
1
+ from hiero_sdk_python.tokens.token_id import TokenId
2
+ from hiero_sdk_python.hbar import Hbar
3
+
4
+ class AccountBalance:
5
+ """
6
+ Represents the balance of an account, including hbars and tokens.
7
+
8
+ Attributes:
9
+ hbars (Hbar): The balance in hbars.
10
+ token_balances (dict): A dictionary mapping TokenId to token balances.
11
+ """
12
+
13
+ def __init__(self, hbars, token_balances=None):
14
+ """
15
+ Initializes the AccountBalance with the given hbar balance and token balances.
16
+
17
+ Args:
18
+ hbars (Hbar): The balance in hbars.
19
+ token_balances (dict, optional): A dictionary mapping TokenId to token balances.
20
+ """
21
+ self.hbars = hbars
22
+ self.token_balances = token_balances or {}
23
+
24
+ @classmethod
25
+ def from_proto(cls, proto):
26
+ """
27
+ Creates an AccountBalance instance from a protobuf response.
28
+
29
+ Args:
30
+ proto: The protobuf CryptoGetAccountBalanceResponse.
31
+
32
+ Returns:
33
+ AccountBalance: The account balance instance.
34
+ """
35
+ hbars = Hbar.from_tinybars(proto.balance)
36
+
37
+ token_balances = {}
38
+ if proto.tokenBalances:
39
+ for token_balance in proto.tokenBalances:
40
+ token_id = TokenId.from_proto(token_balance.tokenId)
41
+ balance = token_balance.balance
42
+ token_balances[token_id] = balance
43
+
44
+ return cls(hbars=hbars, token_balances=token_balances)
@@ -0,0 +1,173 @@
1
+ from typing import Union
2
+
3
+ from hiero_sdk_python.transaction.transaction import Transaction
4
+ from hiero_sdk_python.hapi.services import crypto_create_pb2, duration_pb2
5
+ from hiero_sdk_python.response_code import ResponseCode
6
+ from hiero_sdk_python.crypto.public_key import PublicKey
7
+ from hiero_sdk_python.hbar import Hbar
8
+
9
+
10
+ class AccountCreateTransaction(Transaction):
11
+ """
12
+ Represents an account creation transaction on the Hedera network.
13
+ """
14
+
15
+ def __init__(
16
+ self,
17
+ key: PublicKey = None,
18
+ initial_balance: Union[Hbar, int] = 0,
19
+ receiver_signature_required: bool = False,
20
+ auto_renew_period: int = 7890000, # 90 days in seconds
21
+ memo: str = ""
22
+ ):
23
+ """
24
+ Initializes a new AccountCreateTransaction instance with default values or specified keyword arguments.
25
+
26
+ Args:
27
+ key (PublicKey, optional): The public key for the new account.
28
+ initial_balance (Hbar or int, optional): Initial balance in Hbar or tinybars.
29
+ receiver_signature_required (bool, optional): Whether receiver signature is required.
30
+ auto_renew_period (int, optional): Auto-renew period in seconds (default is ~90 days).
31
+ memo (str, optional): Memo for the account.
32
+ """
33
+ super().__init__()
34
+ self.key = key
35
+ self.initial_balance = initial_balance
36
+ self.receiver_signature_required = receiver_signature_required
37
+ self.auto_renew_period = auto_renew_period
38
+ self.account_memo = memo
39
+ self._default_transaction_fee = 300_000_000
40
+
41
+ def set_key(self, key: PublicKey):
42
+ """
43
+ Sets the public key for the new account.
44
+
45
+ Args:
46
+ key (PublicKey): The public key to assign to the account.
47
+
48
+ Returns:
49
+ AccountCreateTransaction: The current transaction instance for method chaining.
50
+ """
51
+ self._require_not_frozen()
52
+ self.key = key
53
+ return self
54
+
55
+ def set_initial_balance(self, balance: Union[Hbar, int]):
56
+ """
57
+ Sets the initial balance for the new account.
58
+
59
+ Args:
60
+ balance (Hbar or int): The initial balance in Hbar or tinybars.
61
+
62
+ Returns:
63
+ AccountCreateTransaction: The current transaction instance for method chaining.
64
+ """
65
+ self._require_not_frozen()
66
+ if not isinstance(balance, (Hbar, int)):
67
+ raise TypeError(
68
+ "initial_balance must be either an instance of Hbar or an integer (tinybars)."
69
+ )
70
+ self.initial_balance = balance
71
+ return self
72
+
73
+ def set_receiver_signature_required(self, required: bool):
74
+ """
75
+ Sets whether a receiver signature is required.
76
+
77
+ Args:
78
+ required (bool): True if required, False otherwise.
79
+
80
+ Returns:
81
+ AccountCreateTransaction: The current transaction instance for method chaining.
82
+ """
83
+ self._require_not_frozen()
84
+ self.receiver_signature_required = required
85
+ return self
86
+
87
+ def set_auto_renew_period(self, seconds: int):
88
+ """
89
+ Sets the auto-renew period in seconds.
90
+
91
+ Args:
92
+ seconds (int): The auto-renew period.
93
+
94
+ Returns:
95
+ AccountCreateTransaction: The current transaction instance for method chaining.
96
+ """
97
+ self._require_not_frozen()
98
+ self.auto_renew_period = seconds
99
+ return self
100
+
101
+ def set_account_memo(self, memo: str):
102
+ """
103
+ Sets the memo for the new account.
104
+
105
+ Args:
106
+ memo (str): The memo to associate with the account.
107
+
108
+ Returns:
109
+ AccountCreateTransaction: The current transaction instance for method chaining.
110
+ """
111
+ self._require_not_frozen()
112
+ self.account_memo = memo
113
+ return self
114
+
115
+ def build_transaction_body(self):
116
+ """
117
+ Builds and returns the protobuf transaction body for account creation.
118
+
119
+ Returns:
120
+ TransactionBody: The protobuf transaction body containing the account creation details.
121
+
122
+ Raises:
123
+ ValueError: If required fields are missing.
124
+ TypeError: If initial_balance is an invalid type.
125
+ """
126
+ if not self.key:
127
+ raise ValueError("Key must be set before building the transaction.")
128
+
129
+ if isinstance(self.initial_balance, Hbar):
130
+ initial_balance_tinybars = self.initial_balance.to_tinybars()
131
+ elif isinstance(self.initial_balance, int):
132
+ initial_balance_tinybars = self.initial_balance
133
+ else:
134
+ raise TypeError("initial_balance must be Hbar or int (tinybars).")
135
+
136
+ crypto_create_body = crypto_create_pb2.CryptoCreateTransactionBody(
137
+ key=self.key.to_proto(),
138
+ initialBalance=initial_balance_tinybars,
139
+ receiverSigRequired=self.receiver_signature_required,
140
+ autoRenewPeriod=duration_pb2.Duration(seconds=self.auto_renew_period),
141
+ memo=self.account_memo
142
+ )
143
+
144
+ transaction_body = self.build_base_transaction_body()
145
+ transaction_body.cryptoCreateAccount.CopyFrom(crypto_create_body)
146
+
147
+ return transaction_body
148
+
149
+ def _execute_transaction(self, client, transaction_proto):
150
+ """
151
+ Executes the account creation transaction using the provided client.
152
+
153
+ Args:
154
+ client (Client): The client instance to use for execution.
155
+ transaction_proto (Transaction): The protobuf Transaction message.
156
+
157
+ Returns:
158
+ TransactionReceipt: The receipt from the network after transaction execution.
159
+
160
+ Raises:
161
+ Exception: If the transaction submission fails or receives an error response.
162
+ """
163
+ response = client.crypto_stub.createAccount(transaction_proto)
164
+
165
+ if response.nodeTransactionPrecheckCode != ResponseCode.OK:
166
+ error_code = response.nodeTransactionPrecheckCode
167
+ error_message = ResponseCode.get_name(error_code)
168
+ raise Exception(
169
+ f"Error during transaction submission: {error_code} ({error_message})"
170
+ )
171
+
172
+ receipt = self.get_receipt(client)
173
+ return receipt
@@ -0,0 +1,62 @@
1
+ from hiero_sdk_python.hapi.services import basic_types_pb2
2
+
3
+ class AccountId:
4
+ def __init__(self, shard=0, realm=0, num=0):
5
+ self.shard = shard
6
+ self.realm = realm
7
+ self.num = num
8
+
9
+ @classmethod
10
+ def from_string(cls, account_id_str):
11
+ """
12
+ Creates an AccountId instance from a string in the format 'shard.realm.num'.
13
+ """
14
+ parts = account_id_str.strip().split('.')
15
+ if len(parts) != 3:
16
+ raise ValueError("Invalid account ID string format. Expected 'shard.realm.num'")
17
+ shard, realm, num = map(int, parts)
18
+ return cls(shard, realm, num)
19
+
20
+ @classmethod
21
+ def from_proto(cls, account_id_proto):
22
+ """
23
+ Creates an AccountId instance from a protobuf AccountID object.
24
+
25
+ Args:
26
+ account_id_proto (AccountID): The protobuf AccountID object.
27
+
28
+ Returns:
29
+ AccountId: An instance of AccountId.
30
+ """
31
+ return cls(
32
+ shard=account_id_proto.shardNum,
33
+ realm=account_id_proto.realmNum,
34
+ num=account_id_proto.accountNum
35
+ )
36
+
37
+ def to_proto(self):
38
+ """
39
+ Converts the AccountId instance to a protobuf AccountID object.
40
+
41
+ Returns:
42
+ AccountID: The protobuf AccountID object.
43
+ """
44
+ return basic_types_pb2.AccountID(
45
+ shardNum=self.shard,
46
+ realmNum=self.realm,
47
+ accountNum=self.num
48
+ )
49
+
50
+ def __str__(self):
51
+ """
52
+ Returns the string representation of the AccountId in 'shard.realm.num' format.
53
+ """
54
+ return f"{self.shard}.{self.realm}.{self.num}"
55
+
56
+ def __eq__(self, other):
57
+ if not isinstance(other, AccountId):
58
+ return False
59
+ return (self.shard, self.realm, self.num) == (other.shard, other.realm, other.num)
60
+
61
+ def __hash__(self):
62
+ return hash((self.shard, self.realm, self.num))
File without changes
@@ -0,0 +1,139 @@
1
+ import grpc
2
+ import time
3
+ from collections import namedtuple
4
+
5
+ from hiero_sdk_python.hapi.services import (
6
+ consensus_service_pb2_grpc,
7
+ token_service_pb2_grpc,
8
+ crypto_service_pb2_grpc
9
+ )
10
+
11
+ from hiero_sdk_python.hapi.mirror import (
12
+ consensus_service_pb2_grpc as mirror_consensus_grpc,
13
+ mirror_network_service_pb2_grpc as mirror_network_grpc
14
+ )
15
+
16
+ from .network import Network
17
+ from hiero_sdk_python.response_code import ResponseCode
18
+ from hiero_sdk_python.query.transaction_get_receipt_query import TransactionGetReceiptQuery
19
+ from hiero_sdk_python.transaction.transaction_id import TransactionId
20
+
21
+ Operator = namedtuple('Operator', ['account_id', 'private_key'])
22
+
23
+ class Client:
24
+ """
25
+ Represents a client to interact with the Hedera network.
26
+ """
27
+
28
+ def __init__(self, network=None):
29
+ self.operator_account_id = None
30
+ self.operator_private_key = None
31
+
32
+ if network is None:
33
+ network = Network()
34
+ self.network = network
35
+
36
+ self.channel = None
37
+ self.token_stub = None
38
+ self.crypto_stub = None
39
+ self.topic_stub = None
40
+ self.mirror_channel = None
41
+ self.mirror_stub = None
42
+
43
+ self.max_attempts = 10
44
+
45
+ node_account_ids = self.get_node_account_ids()
46
+ if not node_account_ids:
47
+ raise ValueError("No nodes available in the network configuration.")
48
+
49
+ initial_node_id = node_account_ids[0]
50
+ self._switch_node(initial_node_id)
51
+
52
+ self._init_mirror_stub()
53
+
54
+ def _init_mirror_stub(self):
55
+ """
56
+ Connect to a mirror node for topic message subscriptions.
57
+ We now use self.network.get_mirror_address() for a configurable mirror address.
58
+ """
59
+ mirror_address = self.network.get_mirror_address()
60
+ self.mirror_channel = grpc.insecure_channel(mirror_address)
61
+ self.mirror_stub = mirror_consensus_grpc.ConsensusServiceStub(self.mirror_channel)
62
+
63
+ def set_operator(self, account_id, private_key):
64
+ self.operator_account_id = account_id
65
+ self.operator_private_key = private_key
66
+
67
+ @property
68
+ def operator(self):
69
+ if self.operator_account_id and self.operator_private_key:
70
+ return Operator(account_id=self.operator_account_id, private_key=self.operator_private_key)
71
+ return None
72
+
73
+ def generate_transaction_id(self):
74
+ if self.operator_account_id is None:
75
+ raise ValueError("Operator account ID must be set to generate transaction ID.")
76
+ return TransactionId.generate(self.operator_account_id)
77
+
78
+ def get_node_account_ids(self):
79
+ """
80
+ Returns a list of node AccountIds that the client can use to send queries and transactions.
81
+ """
82
+ if self.network and self.network.nodes:
83
+ return [account_id for (address, account_id) in self.network.nodes]
84
+ else:
85
+ raise ValueError("No nodes available in the network configuration.")
86
+
87
+ def get_transaction_receipt(self, transaction_id, max_attempts=10, sleep_seconds=2):
88
+ for attempt in range(max_attempts):
89
+ receipt_query = TransactionGetReceiptQuery()
90
+ receipt_query.set_transaction_id(transaction_id)
91
+ receipt = receipt_query.execute(self)
92
+ status = receipt.status
93
+
94
+ if status == ResponseCode.SUCCESS:
95
+ return receipt
96
+ elif status in (ResponseCode.UNKNOWN, ResponseCode.BUSY, ResponseCode.RECEIPT_NOT_FOUND, ResponseCode.RECORD_NOT_FOUND, ResponseCode.PLATFORM_NOT_ACTIVE):
97
+ time.sleep(sleep_seconds)
98
+ continue
99
+ else:
100
+ status_message = ResponseCode.get_name(status)
101
+ raise Exception(f"Error retrieving transaction receipt: {status_message}")
102
+ raise Exception("Exceeded maximum attempts to fetch transaction receipt.")
103
+
104
+ def send_query(self, query, node_account_id, timeout=60):
105
+ """
106
+ Sends a query to the specified node and returns the response.
107
+ """
108
+ self._switch_node(node_account_id)
109
+
110
+ try:
111
+ request = query._make_request()
112
+
113
+ if hasattr(request, 'cryptogetAccountBalance'):
114
+ response = self.crypto_stub.cryptoGetBalance(request, timeout=timeout)
115
+ elif hasattr(request, 'transactionGetReceipt'):
116
+ response = self.crypto_stub.getTransactionReceipts(request, timeout=timeout)
117
+ elif hasattr(request, 'consensusGetTopicInfo'):
118
+ response = self.topic_stub.getTopicInfo(request, timeout=timeout)
119
+ else:
120
+ raise Exception("Unsupported query type.")
121
+ return response
122
+
123
+ except grpc.RpcError as e:
124
+ print(f"gRPC error during query execution: {e}")
125
+ return None
126
+
127
+ def _switch_node(self, node_account_id):
128
+ """
129
+ Switches to the specified node in the network and updates the gRPC stubs.
130
+ """
131
+ node_address = self.network.get_node_address(node_account_id)
132
+ if node_address is None:
133
+ raise ValueError(f"No node address found for account ID {node_account_id}")
134
+
135
+ self.channel = grpc.insecure_channel(node_address)
136
+ self.token_stub = token_service_pb2_grpc.TokenServiceStub(self.channel)
137
+ self.crypto_stub = crypto_service_pb2_grpc.CryptoServiceStub(self.channel)
138
+ self.topic_stub = consensus_service_pb2_grpc.ConsensusServiceStub(self.channel)
139
+ self.node_account_id = node_account_id
@@ -0,0 +1,143 @@
1
+ import random
2
+ import requests
3
+ from hiero_sdk_python.account.account_id import AccountId
4
+
5
+ class Network:
6
+ """
7
+ Manages the network configuration for connecting to the Hedera network.
8
+ """
9
+
10
+ MIRROR_ADDRESS_DEFAULT = {
11
+ 'mainnet': 'hcs.mainnet.mirrornode.hedera.com:5600',
12
+ 'testnet': 'hcs.testnet.mirrornode.hedera.com:5600',
13
+ 'previewnet': 'hcs.previewnet.mirrornode.hedera.com:5600',
14
+ 'solo': 'localhost:5600'
15
+ }
16
+
17
+ MIRROR_NODE_URLS = {
18
+ 'mainnet': 'https://mainnet-public.mirrornode.hedera.com',
19
+ 'testnet': 'https://testnet.mirrornode.hedera.com',
20
+ 'previewnet': 'https://previewnet.mirrornode.hedera.com',
21
+ 'solo': 'http://localhost:8080'
22
+ }
23
+
24
+ DEFAULT_NODES = {
25
+ 'mainnet': [
26
+ ("35.237.200.180:50211", AccountId(0, 0, 3)),
27
+ ("35.186.191.247:50211", AccountId(0, 0, 4)),
28
+ ("35.192.2.25:50211", AccountId(0, 0, 5)),
29
+ ("35.199.161.108:50211", AccountId(0, 0, 6)),
30
+ ("35.203.82.240:50211", AccountId(0, 0, 7)),
31
+ ("35.236.5.219:50211", AccountId(0, 0, 8)),
32
+ ("35.197.192.225:50211", AccountId(0, 0, 9)),
33
+ ("35.242.233.154:50211", AccountId(0, 0, 10)),
34
+ ("35.240.118.96:50211", AccountId(0, 0, 11)),
35
+ ("35.204.86.32:50211", AccountId(0, 0, 12)),
36
+ ("35.234.132.107:50211", AccountId(0, 0, 13)),
37
+ ("35.236.2.27:50211", AccountId(0, 0, 14)),
38
+ ],
39
+ 'testnet': [
40
+ ("0.testnet.hedera.com:50211", AccountId(0, 0, 3)),
41
+ ("1.testnet.hedera.com:50211", AccountId(0, 0, 4)),
42
+ ("2.testnet.hedera.com:50211", AccountId(0, 0, 5)),
43
+ ("3.testnet.hedera.com:50211", AccountId(0, 0, 6)),
44
+ ],
45
+ 'previewnet': [
46
+ ("0.previewnet.hedera.com:50211", AccountId(0, 0, 3)),
47
+ ("1.previewnet.hedera.com:50211", AccountId(0, 0, 4)),
48
+ ("2.previewnet.hedera.com:50211", AccountId(0, 0, 5)),
49
+ ("3.previewnet.hedera.com:50211", AccountId(0, 0, 6)),
50
+ ],
51
+ 'solo': [
52
+ ("localhost:50211", AccountId(0, 0, 3))
53
+ ],
54
+ }
55
+
56
+ def __init__(
57
+ self,
58
+ network: str = 'testnet',
59
+ nodes: list = None,
60
+ mirror_address: str = None,
61
+ ):
62
+ """
63
+ Initializes the Network with the specified network name or custom config.
64
+
65
+ Args:
66
+ network (str): One of 'mainnet', 'testnet', 'previewnet', 'solo', or a custom name if you prefer.
67
+ nodes (list, optional): A list of (node_address, AccountId) pairs. If provided, we skip fetching from the mirror.
68
+ mirror_address (str, optional): A mirror node address (host:port) for topic queries.
69
+ If not provided, we'll use a default from MIRROR_ADDRESS_DEFAULT[network].
70
+ """
71
+ self.network = network
72
+ self.mirror_address = mirror_address or self.MIRROR_ADDRESS_DEFAULT.get(network, 'localhost:5600')
73
+
74
+ if nodes is not None:
75
+ self.nodes = nodes
76
+ else:
77
+ self.nodes = self._fetch_nodes_from_mirror_node()
78
+ if not self.nodes:
79
+ if self.network in self.DEFAULT_NODES:
80
+ self.nodes = self.DEFAULT_NODES[self.network]
81
+ else:
82
+ raise ValueError(f"No default nodes for network='{self.network}'")
83
+
84
+ self._select_node()
85
+
86
+ def _fetch_nodes_from_mirror_node(self):
87
+ """
88
+ Fetches the list of nodes from the Hedera Mirror Node REST API.
89
+ Returns:
90
+ list: A list of tuples [(node_address, AccountId), ...].
91
+ """
92
+ base_url = self.MIRROR_NODE_URLS.get(self.network)
93
+ if not base_url:
94
+ print(f"No known mirror node URL for network='{self.network}'. Skipping fetch.")
95
+ return []
96
+
97
+ url = f"{base_url}/api/v1/network/nodes?limit=100&order=desc"
98
+
99
+ try:
100
+ response = requests.get(url)
101
+ response.raise_for_status()
102
+ data = response.json()
103
+
104
+ nodes = []
105
+ for node in data.get('nodes', []):
106
+ service_endpoints = node.get('service_endpoints', [])
107
+ for endpoint in service_endpoints:
108
+ if endpoint.get('port') == 50211 and endpoint.get('protocol') == 'PROTOBUF':
109
+ ip_address = endpoint.get('ip_address_v4')
110
+ if ip_address:
111
+ address = f"{ip_address}:{endpoint['port']}"
112
+ account_id_str = node['node_account_id']
113
+ account_id = AccountId.from_string(account_id_str)
114
+ nodes.append((address, account_id))
115
+ return nodes
116
+ except requests.RequestException as e:
117
+ print(f"Error fetching nodes from mirror node API: {e}")
118
+ return []
119
+
120
+ def _select_node(self):
121
+ """
122
+ Select a random node from self.nodes and store it if you want to track a 'current' node.
123
+ This is optional. The client can still pick or switch nodes as needed.
124
+ """
125
+ if not self.nodes:
126
+ raise ValueError("No nodes available to select.")
127
+ self.node_address, self.node_account_id = random.choice(self.nodes)
128
+ # print(f"Selected node: {self.node_address} (Account ID: {self.node_account_id})")
129
+
130
+ def get_node_address(self, node_account_id):
131
+ """
132
+ Return the gRPC address (host:port) for the given node_account_id, or None if not found.
133
+ """
134
+ for address, acct_id in self.nodes:
135
+ if acct_id == node_account_id:
136
+ return address
137
+ return None
138
+
139
+ def get_mirror_address(self) -> str:
140
+ """
141
+ Return the configured mirror node address used for mirror queries.
142
+ """
143
+ return self.mirror_address
File without changes