hiero-sdk-python 0.0.2.dev3__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 (47) hide show
  1. hedera_sdk_python/__init__.py +93 -0
  2. hedera_sdk_python/account/__init__.py +0 -0
  3. hedera_sdk_python/account/account_balance.py +44 -0
  4. hedera_sdk_python/account/account_create_transaction.py +173 -0
  5. hedera_sdk_python/account/account_id.py +62 -0
  6. hedera_sdk_python/client/__init__.py +0 -0
  7. hedera_sdk_python/client/client.py +139 -0
  8. hedera_sdk_python/client/network.py +143 -0
  9. hedera_sdk_python/consensus/__init__.py +0 -0
  10. hedera_sdk_python/consensus/topic_create_transaction.py +83 -0
  11. hedera_sdk_python/consensus/topic_delete_transaction.py +67 -0
  12. hedera_sdk_python/consensus/topic_id.py +44 -0
  13. hedera_sdk_python/consensus/topic_info.py +91 -0
  14. hedera_sdk_python/consensus/topic_message.py +61 -0
  15. hedera_sdk_python/consensus/topic_message_submit_transaction.py +87 -0
  16. hedera_sdk_python/consensus/topic_update_transaction.py +173 -0
  17. hedera_sdk_python/crypto/__init__.py +0 -0
  18. hedera_sdk_python/crypto/private_key.py +196 -0
  19. hedera_sdk_python/crypto/public_key.py +162 -0
  20. hedera_sdk_python/hbar.py +33 -0
  21. hedera_sdk_python/query/__init__.py +0 -0
  22. hedera_sdk_python/query/account_balance_query.py +100 -0
  23. hedera_sdk_python/query/query.py +138 -0
  24. hedera_sdk_python/query/topic_info_query.py +105 -0
  25. hedera_sdk_python/query/topic_message_query.py +105 -0
  26. hedera_sdk_python/query/transaction_get_receipt_query.py +128 -0
  27. hedera_sdk_python/response_code.py +587 -0
  28. hedera_sdk_python/timestamp.py +166 -0
  29. hedera_sdk_python/tokens/__init__.py +0 -0
  30. hedera_sdk_python/tokens/token_associate_transaction.py +85 -0
  31. hedera_sdk_python/tokens/token_create_transaction.py +144 -0
  32. hedera_sdk_python/tokens/token_delete_transaction.py +84 -0
  33. hedera_sdk_python/tokens/token_dissociate_transaction.py +81 -0
  34. hedera_sdk_python/tokens/token_id.py +44 -0
  35. hedera_sdk_python/tokens/token_mint_transaction.py +143 -0
  36. hedera_sdk_python/transaction/__init__.py +0 -0
  37. hedera_sdk_python/transaction/query_payment.py +32 -0
  38. hedera_sdk_python/transaction/transaction.py +267 -0
  39. hedera_sdk_python/transaction/transaction_id.py +140 -0
  40. hedera_sdk_python/transaction/transaction_receipt.py +78 -0
  41. hedera_sdk_python/transaction/transfer_transaction.py +119 -0
  42. hedera_sdk_python/utils/key_format.py +22 -0
  43. hiero_sdk_python-0.0.2.dev3.dist-info/METADATA +822 -0
  44. hiero_sdk_python-0.0.2.dev3.dist-info/RECORD +47 -0
  45. hiero_sdk_python-0.0.2.dev3.dist-info/WHEEL +4 -0
  46. hiero_sdk_python-0.0.2.dev3.dist-info/entry_points.txt +4 -0
  47. hiero_sdk_python-0.0.2.dev3.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,822 @@
1
+ Metadata-Version: 2.1
2
+ Name: hiero-sdk-python
3
+ Version: 0.0.2.dev3
4
+ Summary: A Hiero SDK in pure Python
5
+ Author-Email: Nadine Loepfe <nadine.loepfe@hashgraph.com>, Richard Bair <rbair23@users.noreply.github.com>
6
+ Maintainer-Email: Nadine Loepfe <nadine.loepfe@hashgraph.com>
7
+ License: Apache License
8
+ Version 2.0, January 2004
9
+ http://www.apache.org/licenses/
10
+
11
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
12
+
13
+ 1. Definitions.
14
+
15
+ "License" shall mean the terms and conditions for use, reproduction,
16
+ and distribution as defined by Sections 1 through 9 of this document.
17
+
18
+ "Licensor" shall mean the copyright owner or entity authorized by
19
+ the copyright owner that is granting the License.
20
+
21
+ "Legal Entity" shall mean the union of the acting entity and all
22
+ other entities that control, are controlled by, or are under common
23
+ control with that entity. For the purposes of this definition,
24
+ "control" means (i) the power, direct or indirect, to cause the
25
+ direction or management of such entity, whether by contract or
26
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
27
+ outstanding shares, or (iii) beneficial ownership of such entity.
28
+
29
+ "You" (or "Your") shall mean an individual or Legal Entity
30
+ exercising permissions granted by this License.
31
+
32
+ "Source" form shall mean the preferred form for making modifications,
33
+ including but not limited to software source code, documentation
34
+ source, and configuration files.
35
+
36
+ "Object" form shall mean any form resulting from mechanical
37
+ transformation or translation of a Source form, including but
38
+ not limited to compiled object code, generated documentation,
39
+ and conversions to other media types.
40
+
41
+ "Work" shall mean the work of authorship, whether in Source or
42
+ Object form, made available under the License, as indicated by a
43
+ copyright notice that is included in or attached to the work
44
+ (an example is provided in the Appendix below).
45
+
46
+ "Derivative Works" shall mean any work, whether in Source or Object
47
+ form, that is based on (or derived from) the Work and for which the
48
+ editorial revisions, annotations, elaborations, or other modifications
49
+ represent, as a whole, an original work of authorship. For the purposes
50
+ of this License, Derivative Works shall not include works that remain
51
+ separable from, or merely link (or bind by name) to the interfaces of,
52
+ the Work and Derivative Works thereof.
53
+
54
+ "Contribution" shall mean any work of authorship, including
55
+ the original version of the Work and any modifications or additions
56
+ to that Work or Derivative Works thereof, that is intentionally
57
+ submitted to Licensor for inclusion in the Work by the copyright owner
58
+ or by an individual or Legal Entity authorized to submit on behalf of
59
+ the copyright owner. For the purposes of this definition, "submitted"
60
+ means any form of electronic, verbal, or written communication sent
61
+ to the Licensor or its representatives, including but not limited to
62
+ communication on electronic mailing lists, source code control systems,
63
+ and issue tracking systems that are managed by, or on behalf of, the
64
+ Licensor for the purpose of discussing and improving the Work, but
65
+ excluding communication that is conspicuously marked or otherwise
66
+ designated in writing by the copyright owner as "Not a Contribution."
67
+
68
+ "Contributor" shall mean Licensor and any individual or Legal Entity
69
+ on behalf of whom a Contribution has been received by Licensor and
70
+ subsequently incorporated within the Work.
71
+
72
+ 2. Grant of Copyright License. Subject to the terms and conditions of
73
+ this License, each Contributor hereby grants to You a perpetual,
74
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
+ copyright license to reproduce, prepare Derivative Works of,
76
+ publicly display, publicly perform, sublicense, and distribute the
77
+ Work and such Derivative Works in Source or Object form.
78
+
79
+ 3. Grant of Patent License. Subject to the terms and conditions of
80
+ this License, each Contributor hereby grants to You a perpetual,
81
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
82
+ (except as stated in this section) patent license to make, have made,
83
+ use, offer to sell, sell, import, and otherwise transfer the Work,
84
+ where such license applies only to those patent claims licensable
85
+ by such Contributor that are necessarily infringed by their
86
+ Contribution(s) alone or by combination of their Contribution(s)
87
+ with the Work to which such Contribution(s) was submitted. If You
88
+ institute patent litigation against any entity (including a
89
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
90
+ or a Contribution incorporated within the Work constitutes direct
91
+ or contributory patent infringement, then any patent licenses
92
+ granted to You under this License for that Work shall terminate
93
+ as of the date such litigation is filed.
94
+
95
+ 4. Redistribution. You may reproduce and distribute copies of the
96
+ Work or Derivative Works thereof in any medium, with or without
97
+ modifications, and in Source or Object form, provided that You
98
+ meet the following conditions:
99
+
100
+ (a) You must give any other recipients of the Work or
101
+ Derivative Works a copy of this License; and
102
+
103
+ (b) You must cause any modified files to carry prominent notices
104
+ stating that You changed the files; and
105
+
106
+ (c) You must retain, in the Source form of any Derivative Works
107
+ that You distribute, all copyright, patent, trademark, and
108
+ attribution notices from the Source form of the Work,
109
+ excluding those notices that do not pertain to any part of
110
+ the Derivative Works; and
111
+
112
+ (d) If the Work includes a "NOTICE" text file as part of its
113
+ distribution, then any Derivative Works that You distribute must
114
+ include a readable copy of the attribution notices contained
115
+ within such NOTICE file, excluding those notices that do not
116
+ pertain to any part of the Derivative Works, in at least one
117
+ of the following places: within a NOTICE text file distributed
118
+ as part of the Derivative Works; within the Source form or
119
+ documentation, if provided along with the Derivative Works; or,
120
+ within a display generated by the Derivative Works, if and
121
+ wherever such third-party notices normally appear. The contents
122
+ of the NOTICE file are for informational purposes only and
123
+ do not modify the License. You may add Your own attribution
124
+ notices within Derivative Works that You distribute, alongside
125
+ or as an addendum to the NOTICE text from the Work, provided
126
+ that such additional attribution notices cannot be construed
127
+ as modifying the License.
128
+
129
+ You may add Your own copyright statement to Your modifications and
130
+ may provide additional or different license terms and conditions
131
+ for use, reproduction, or distribution of Your modifications, or
132
+ for any such Derivative Works as a whole, provided Your use,
133
+ reproduction, and distribution of the Work otherwise complies with
134
+ the conditions stated in this License.
135
+
136
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
137
+ any Contribution intentionally submitted for inclusion in the Work
138
+ by You to the Licensor shall be under the terms and conditions of
139
+ this License, without any additional terms or conditions.
140
+ Notwithstanding the above, nothing herein shall supersede or modify
141
+ the terms of any separate license agreement you may have executed
142
+ with Licensor regarding such Contributions.
143
+
144
+ 6. Trademarks. This License does not grant permission to use the trade
145
+ names, trademarks, service marks, or product names of the Licensor,
146
+ except as required for reasonable and customary use in describing the
147
+ origin of the Work and reproducing the content of the NOTICE file.
148
+
149
+ 7. Disclaimer of Warranty. Unless required by applicable law or
150
+ agreed to in writing, Licensor provides the Work (and each
151
+ Contributor provides its Contributions) on an "AS IS" BASIS,
152
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
153
+ implied, including, without limitation, any warranties or conditions
154
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
155
+ PARTICULAR PURPOSE. You are solely responsible for determining the
156
+ appropriateness of using or redistributing the Work and assume any
157
+ risks associated with Your exercise of permissions under this License.
158
+
159
+ 8. Limitation of Liability. In no event and under no legal theory,
160
+ whether in tort (including negligence), contract, or otherwise,
161
+ unless required by applicable law (such as deliberate and grossly
162
+ negligent acts) or agreed to in writing, shall any Contributor be
163
+ liable to You for damages, including any direct, indirect, special,
164
+ incidental, or consequential damages of any character arising as a
165
+ result of this License or out of the use or inability to use the
166
+ Work (including but not limited to damages for loss of goodwill,
167
+ work stoppage, computer failure or malfunction, or any and all
168
+ other commercial damages or losses), even if such Contributor
169
+ has been advised of the possibility of such damages.
170
+
171
+ 9. Accepting Warranty or Additional Liability. While redistributing
172
+ the Work or Derivative Works thereof, You may choose to offer,
173
+ and charge a fee for, acceptance of support, warranty, indemnity,
174
+ or other liability obligations and/or rights consistent with this
175
+ License. However, in accepting such obligations, You may act only
176
+ on Your own behalf and on Your sole responsibility, not on behalf
177
+ of any other Contributor, and only if You agree to indemnify,
178
+ defend, and hold each Contributor harmless for any liability
179
+ incurred by, or claims asserted against, such Contributor by reason
180
+ of your accepting any such warranty or additional liability.
181
+
182
+ END OF TERMS AND CONDITIONS
183
+
184
+ APPENDIX: How to apply the Apache License to your work.
185
+
186
+ To apply the Apache License to your work, attach the following
187
+ boilerplate notice, with the fields enclosed by brackets "[]"
188
+ replaced with your own identifying information. (Don't include
189
+ the brackets!) The text should be enclosed in the appropriate
190
+ comment syntax for the file format. We also recommend that a
191
+ file or class name and description of purpose be included on the
192
+ same "printed page" as the copyright notice for easier
193
+ identification within third-party archives.
194
+
195
+ Copyright [yyyy] [name of copyright owner]
196
+
197
+ Licensed under the Apache License, Version 2.0 (the "License");
198
+ you may not use this file except in compliance with the License.
199
+ You may obtain a copy of the License at
200
+
201
+ http://www.apache.org/licenses/LICENSE-2.0
202
+
203
+ Unless required by applicable law or agreed to in writing, software
204
+ distributed under the License is distributed on an "AS IS" BASIS,
205
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
206
+ See the License for the specific language governing permissions and
207
+ limitations under the License.
208
+
209
+ Classifier: Development Status :: 2 - Pre-Alpha
210
+ Classifier: License :: OSI Approved :: Apache Software License
211
+ Classifier: Programming Language :: Python :: 3.9
212
+ Classifier: Operating System :: OS Independent
213
+ Classifier: Intended Audience :: Developers
214
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
215
+ Requires-Python: >=3.9.2
216
+ Requires-Dist: protobuf==5.28.1
217
+ Requires-Dist: grpcio-tools==1.68.1
218
+ Requires-Dist: grpcio==1.68.1
219
+ Requires-Dist: cryptography==44.0.0
220
+ Requires-Dist: python-dotenv==1.0.1
221
+ Requires-Dist: requests==2.32.3
222
+ Description-Content-Type: text/markdown
223
+
224
+ # Hiero SDK in Python
225
+
226
+ This is a Python SDK for interacting with the Hedera Hashgraph platform. It allows developers to:
227
+
228
+ - Manage Token Transactions like Create, Mint Fungible, Mint Non-Fungible, Associate, Dissociate, Transfer & Delete
229
+ - Manage Consensus Transactions like Topic Create, Update, Delete
230
+ - Submit Topic Messages
231
+ - Query Account Balance, Transaction Receipts, Topic Infos and Messages
232
+
233
+ ## Table of Contents
234
+
235
+ - [Installation](#installation)
236
+ - [Installing from PyPI](#installing-from-pypi)
237
+ - [Installing from Source](#installing-from-source)
238
+ - [Local Editable Installation](#local-editable-installation)
239
+ - [Environment Setup](#environment-setup)
240
+ - [Running Tests](#running-tests)
241
+ - [Usage](#usage)
242
+ - [Creating an Account](#creating-an-account)
243
+ - [Querying Account Balance](#querying-account-balance)
244
+ - [Creating a Token](#creating-a-token)
245
+ - [Minting a Fungible Token](#minting-a-fungible-token)
246
+ - [Minting a Non-Fungible Token](#minting-a-non-fungible-token)
247
+ - [Associating a Token](#associating-a-token)
248
+ - [Dissociating a Token](#dissociating-a-token)
249
+ - [Transferring Tokens](#transferring-tokens)
250
+ - [Deleting a Token](#deleting-a-token)
251
+ - [Transferring HBAR](#transferring-hbar)
252
+ - [Creating a Topic](#creating-a-topic)
253
+ - [Submitting a Topic Message](#submitting-a-topic-message)
254
+ - [Updating a Topic](#updating-a-topic)
255
+ - [Deleting a Topic](#deleting-a-topic)
256
+ - [Querying Topic](#querying-topic)
257
+ - [Querying Topic Message](#querying-topic-message)
258
+ - [Contributing](#contributing)
259
+
260
+ ## Installation
261
+
262
+ ### Installing from PyPI
263
+
264
+ The latest release of this SDK is published to PyPI. You can install it with:
265
+
266
+ ```
267
+ pip install --upgrade pip
268
+ pip install hedera-sdk-python
269
+ ```
270
+
271
+ This will pull down a stable release along with the required dependencies.
272
+
273
+
274
+ ### Installing from Source
275
+
276
+ You can also clone the repo and install dependencies using uv:
277
+
278
+ 1. Install `uv`:
279
+
280
+ `uv` is an ultra-fast Python package and project manager. It replaces `pip`, `pip-tools`, `pipx`, `poetry`, `pyenv`,
281
+ `virtualenv`, and more.
282
+
283
+ ```bash
284
+ curl -LsSf https://astral.sh/uv/install.sh | sh
285
+ ```
286
+
287
+ If on macOS, you can also install `uv` using Homebrew:
288
+
289
+ ```bash
290
+ brew install uv
291
+ ```
292
+
293
+ Other installation methods can be found [here](https://docs.astral.sh/uv/getting-started/installation/).
294
+
295
+ 2. Clone this repository:
296
+
297
+ ```bash
298
+ git clone https://github.com/hiero-ledger/hiero-sdk-python.git
299
+ cd hiero-sdk-python
300
+ ```
301
+
302
+ 3. Install dependencies:
303
+
304
+ One of the really nice features of `uv` is that it will download and manage the correct version of python and build
305
+ with the correct version of python based on the `.python-version` file in the project. This means you don't have to
306
+ worry about managing multiple versions of python on your machine!
307
+
308
+ ```bash
309
+ uv sync
310
+ uv run generate_proto.py
311
+ ```
312
+
313
+ To update to a newer version of the protobuf libraries, edit the `generate_proto.py` file and change the version number
314
+ and then rerun it.
315
+
316
+
317
+ ### Local Editable Installation
318
+
319
+ For active development, you can install the repo in editable mode. That way, changes in your local code are immediately reflected when you import:
320
+
321
+ ```
322
+ git clone https://github.com/hiero-ledger/hiero-sdk-python.git
323
+ cd hiero-sdk-python
324
+ pip install --upgrade pip
325
+ pip install -e .
326
+ ```
327
+
328
+ Now you can run example scripts like python `examples/account_create.py`, and it will import from your local hiero-sdk-python code.
329
+
330
+
331
+ ## Environment Setup
332
+
333
+ Before using the SDK, you need to configure your environment variables for the operator account and other credentials.
334
+ Create a .env file in the root of your project with the following (replace with your environment variables):
335
+
336
+ ```
337
+ OPERATOR_ID=0.0.1234xx
338
+ OPERATOR_KEY=302e020100300506032b657004220420...
339
+ ADMIN_KEY=302a300506032b65700321009308ecfdf...
340
+ SUPPLY_KEY =302a300506032b6570032100c5e4af5..."
341
+ RECIPIENT_ID=0.0.789xx
342
+ TOKEN_ID=0.0.100xx
343
+ TOPIC_ID=0.0.200xx
344
+ NETWORK=testnet
345
+ ```
346
+
347
+ A [sample .env](.env.example) file is provided in the root of this project. If you do not have an account on
348
+ the Hedera testnet, you can easily get one from the [Hedera Portal](https://portal.hedera.com/). Learn more about
349
+ testnet [here](https://docs.hedera.com/guides/testnet).
350
+
351
+ ## Running Tests
352
+
353
+ To run the test suite for the SDK, use the following command:
354
+ ```
355
+ uv run pytest
356
+ ```
357
+
358
+ The test file in the root of this project will be automatically run when pushing onto a branch.
359
+ This is done by running 'Hedera Solo'. Read more about it here:
360
+
361
+ - [Github Marketplace](https://github.com/marketplace/actions/hedera-solo)
362
+ - [Blog Post by Hendrik Ebbers](https://dev.to/hendrikebbers/ci-for-hedera-based-projects-2nja)
363
+
364
+ #### Output:
365
+ ```
366
+ Account creation successful. New Account ID: 0.0.5025xxx
367
+ New Account Private Key: 228a06c363b0eb328434d51xxx...
368
+ New Account Public Key: 8f444e36e8926def492adxxx...
369
+ Token creation successful. Token ID: 0.0.5025xxx
370
+ Token association successful.
371
+ Token dissociation successful.
372
+ Token minting successful.
373
+ Token transfer successful.
374
+ Token deletion successful.
375
+ Topic creation successful.
376
+ Topic Message submitted.
377
+ Topic update successful.
378
+ Topic deletion successful.
379
+ ```
380
+
381
+ ## Syntax Flexibility
382
+
383
+ The Hedera SDK in Python supports two distinct syntax styles for creating and executing transactions:
384
+
385
+ - Pythonic Syntax: Ideal for developers who prefer explicit constructor-style initialization.
386
+ - Method Chaining: Provides a fluent API style for chaining methods, commonly used in many SDKs.
387
+
388
+ You can choose either syntax or even mix both styles in your projects.
389
+
390
+
391
+ ## Usage
392
+
393
+ Below are examples of how to use the SDK for various operations. Each section provides both Pythonic syntax and method chaining examples.
394
+
395
+ ### Creating an Account
396
+
397
+ #### Pythonic Syntax:
398
+ ```
399
+ transaction = AccountCreateTransaction(
400
+ key=new_account_public_key,
401
+ initial_balance=initial_balance,
402
+ memo="Test Account"
403
+ ).freeze_with(client)
404
+
405
+ transaction.sign(operator_key)
406
+ transaction.execute(client)
407
+
408
+ ```
409
+ #### Method Chaining:
410
+ ```
411
+ transaction = (
412
+ AccountCreateTransaction()
413
+ .set_key(new_account_public_key)
414
+ .set_initial_balance(initial_balance)
415
+ .set_account_memo("Test")
416
+ .freeze_with(client)
417
+ )
418
+ transaction.sign(client.operator_private_key)
419
+ transaction.execute(client)
420
+ ```
421
+
422
+ ### Querying Account Balance
423
+
424
+ #### Pythonic Syntax:
425
+ ```
426
+ balance = CryptoGetAccountBalanceQuery(account_id=some_account_id).execute(client) print(f"Account balance: {balance.hbars} hbars")
427
+ ```
428
+
429
+ #### Method Chaining:
430
+ ```
431
+ balance = ( CryptoGetAccountBalanceQuery() .set_account_id(some_account_id) .execute(client) ) print(f"Account balance: {balance.hbars} hbars")
432
+ ```
433
+
434
+ ### Creating a Token
435
+
436
+ #### Pythonic Syntax:
437
+ ```
438
+ transaction = TokenCreateTransaction(
439
+ token_name="ExampleToken",
440
+ token_symbol="EXT",
441
+ decimals=2,
442
+ initial_supply=1000,
443
+ treasury_account_id=operator_id,
444
+ admin_key=admin_key
445
+ supply_key=supply_key
446
+ ).freeze_with(client)
447
+
448
+ transaction.sign(admin_key)
449
+ transaction.sign(operator_key)
450
+ transaction.execute(client)
451
+
452
+ ```
453
+ #### Method Chaining:
454
+ ```
455
+ transaction = (
456
+ TokenCreateTransaction()
457
+ .set_token_name("ExampleToken")
458
+ .set_token_symbol("EXT")
459
+ .set_decimals(2)
460
+ .set_initial_supply(1000)
461
+ .set_treasury_account_id(operator_id)
462
+ .set_admin_key(admin_key) # Optional to create a token. Necessary for Token Delete or Update.
463
+ .set_supply_key(supply_key) # Optional to change token supply. Necessary for Token Mint or Burn.
464
+ .freeze_with(client)
465
+ )
466
+
467
+ transaction.sign(admin_key) # If admin key exists.
468
+ transaction.sign(operator_key)
469
+ transaction.execute(client)
470
+ ```
471
+
472
+
473
+ ### Minting a Fungible Token
474
+
475
+ #### Pythonic Syntax:
476
+ ```
477
+ transaction = TokenMintTransaction(
478
+ token_id=token_id,
479
+ amount=amount, # lowest denomination, must be positive and not zero
480
+ ).freeze_with(client)
481
+
482
+ transaction.sign(operator_key)
483
+ transaction.sign(supply_key)
484
+ transaction.execute(client)
485
+ ```
486
+ #### Method Chaining:
487
+ ```
488
+ transaction = (
489
+ TokenMintTransaction()
490
+ .set_token_id(token_id)
491
+ .set_amount(amount) # lowest denomination, must be positive and not zero
492
+ .freeze_with(client)
493
+ )
494
+ transaction.sign(operator_key)
495
+ transaction.sign(admin_key)
496
+ transaction.execute(client)
497
+ ```
498
+
499
+ ### Minting a Non-Fungible Token
500
+
501
+ #### Pythonic Syntax:
502
+ ```
503
+ transaction = TokenMintTransaction(
504
+ token_id=token_id,
505
+ metadata=metadata # Bytes for non-fungible tokens (NFTs)
506
+ ).freeze_with(client)
507
+
508
+ transaction.sign(operator_key)
509
+ transaction.sign(supply_key)
510
+ transaction.execute(client)
511
+ ```
512
+ #### Method Chaining:
513
+ ```
514
+ transaction = (
515
+ TokenMintTransaction()
516
+ .set_token_id(token_id)
517
+ .set_metadata(metadata) # Bytes for non-fungible tokens (NFTs)
518
+ .freeze_with(client)
519
+ )
520
+ transaction.sign(operator_key)
521
+ transaction.sign(admin_key)
522
+ transaction.execute(client)
523
+ ```
524
+
525
+ ### Associating a Token
526
+
527
+ #### Pythonic Syntax:
528
+ ```
529
+ transaction = TokenAssociateTransaction(
530
+ account_id=recipient_id,
531
+ token_ids=[token_id]
532
+ ).freeze_with(client)
533
+
534
+ transaction.sign(recipient_key)
535
+ transaction.execute(client)
536
+ ```
537
+ #### Method Chaining:
538
+ ```
539
+ transaction = (
540
+ TokenAssociateTransaction()
541
+ .set_account_id(recipient_id)
542
+ .add_token_id(token_id)
543
+ .freeze_with(client)
544
+ .sign(recipient_key)
545
+ )
546
+
547
+ transaction.execute(client)
548
+ ```
549
+
550
+ ### Dissociating a Token
551
+
552
+ #### Pythonic Syntax:
553
+ ```
554
+ transaction = TokenDissociateTransaction(
555
+ account_id=recipient_id,
556
+ token_ids=[token_id]
557
+ ).freeze_with(client)
558
+
559
+ transaction.sign(recipient_key)
560
+ transaction.execute(client)
561
+ ```
562
+ #### Method Chaining:
563
+ ```
564
+ transaction = (
565
+ TokenDissociateTransaction()
566
+ .set_account_id(recipient_id)
567
+ .add_token_id(token_id)
568
+ .freeze_with(client)
569
+ .sign(recipient_key)
570
+ )
571
+
572
+ transaction.execute(client)
573
+ ```
574
+
575
+ ### Transferring Tokens
576
+
577
+ #### Pythonic Syntax:
578
+ ```
579
+ transaction = TransferTransaction(
580
+ token_transfers={
581
+ token_id: {
582
+ operator_id: -amount,
583
+ recipient_id: amount
584
+ }
585
+ }
586
+ ).freeze_with(client)
587
+
588
+ transaction.sign(operator_key)
589
+ transaction.execute(client)
590
+
591
+ ```
592
+ #### Method Chaining:
593
+ ```
594
+ transaction = (
595
+ TransferTransaction()
596
+ .add_token_transfer(token_id, operator_id, -amount)
597
+ .add_token_transfer(token_id, recipient_id, amount)
598
+ .freeze_with(client)
599
+ .sign(operator_key)
600
+ )
601
+
602
+ transaction.execute(client)
603
+ ```
604
+
605
+ ### Deleting a Token
606
+
607
+ #### Pythonic Syntax:
608
+ ```
609
+ transaction = TokenDeleteTransaction(
610
+ token_id=token_id
611
+ ).freeze_with(client)
612
+
613
+ transaction.sign(admin_key) # Admin key must have been set during token creation.
614
+ transaction.sign(operator_key)
615
+ transaction.execute(client)
616
+ ```
617
+ #### Method Chaining:
618
+ ```
619
+ transaction = (
620
+ TokenDeleteTransaction()
621
+ .set_token_id(token_id)
622
+ .freeze_with(client)
623
+ )
624
+
625
+ transaction.sign(admin_key) # Admin key must also have been set in Token Create
626
+ transaction.sign(operator_key)
627
+ transaction.execute(client)
628
+ ```
629
+
630
+ ### Transferring HBAR
631
+
632
+ #### Pythonic Syntax:
633
+ ```
634
+ transaction = TransferTransaction(
635
+ hbar_transfers={
636
+ operator_id: -100000000, # send 1 HBAR (in tinybars)
637
+ recipient_id: 100000000
638
+ }
639
+ ).freeze_with(client)
640
+
641
+ transaction.sign(operator_key)
642
+ transaction.execute(client)
643
+ ```
644
+ #### Method Chaining:
645
+ ```
646
+ transaction = (
647
+ TransferTransaction()
648
+ .add_hbar_transfer(operator_id, -100000000) # send 1 HBAR (in tinybars)
649
+ .add_hbar_transfer(recipient_id, 100000000)
650
+ .freeze_with(client)
651
+ )
652
+
653
+ transaction.sign(operator_key)
654
+ transaction.execute(client)
655
+ ```
656
+
657
+ ### Creating a Topic
658
+
659
+ #### Pythonic Syntax:
660
+ ```
661
+ transaction = (
662
+ TopicCreateTransaction(
663
+ memo="My Super Topic Memo",
664
+ admin_key=topic_admin_key)
665
+ .freeze_with(client)
666
+ .sign(operator_key)
667
+ )
668
+
669
+ transaction.execute(client)
670
+ ```
671
+ #### Method Chaining:
672
+ ```
673
+ transaction = (
674
+ TopicCreateTransaction()
675
+ .set_memo("My Super Topic Memo")
676
+ .set_admin_key(topic_admin_key)
677
+ .freeze_with(client)
678
+ )
679
+
680
+ transaction.sign(operator_key)
681
+ transaction.execute(client)
682
+ ```
683
+
684
+ ### Submitting a Topic Message
685
+
686
+ #### Pythonic Syntax:
687
+ ```
688
+ transaction = (
689
+ TopicMessageSubmitTransaction(topic_id=topic_id, message="Hello, from Python SDK!")
690
+ .freeze_with(client)
691
+ .sign(operator_key)
692
+ )
693
+
694
+ transaction.execute(client)
695
+
696
+ ```
697
+ #### Method Chaining:
698
+ ```
699
+ transaction = (
700
+ TopicMessageSubmitTransaction()
701
+ .set_topic_id(topic_id)
702
+ .set_message("Hello, from Python SDK!")
703
+ .freeze_with(client)
704
+ )
705
+
706
+ transaction.sign(operator_key)
707
+ transaction.execute(client)
708
+
709
+ ```
710
+
711
+ ### Updating a Topic
712
+
713
+ #### Pythonic Syntax:
714
+ ```
715
+ transaction = (
716
+ TopicUpdateTransaction(topic_id=topic_id, memo="Python SDK updated topic")
717
+ .freeze_with(client)
718
+ .sign(operator_key)
719
+ )
720
+
721
+ transaction.execute(client)
722
+ ```
723
+ #### Method Chaining:
724
+ ```
725
+ transaction = (
726
+ TopicUpdateTransaction()
727
+ .set_topic_id(topic_id)
728
+ .set_memo("Python SDK updated topic")
729
+ .freeze_with(client)
730
+ )
731
+
732
+ transaction.sign(operator_key)
733
+ transaction.execute(client)
734
+
735
+ ```
736
+
737
+ ### Deleting a Topic
738
+
739
+ #### Pythonic Syntax:
740
+ ```
741
+ transaction = (
742
+ TopicDeleteTransaction(topic_id=topic_id)
743
+ .freeze_with(client)
744
+ .sign(operator_key)
745
+ )
746
+ transaction.execute(client)
747
+ ```
748
+ #### Method Chaining:
749
+ ```
750
+ transaction = (
751
+ TopicDeleteTransaction()
752
+ .set_topic_id(topic_id)
753
+ .freeze_with(client)
754
+ )
755
+
756
+ transaction.sign(operator_key)
757
+ transaction.execute(client)
758
+
759
+ ```
760
+
761
+ ### Querying Topic Info
762
+
763
+ #### Pythonic Syntax:
764
+ ```
765
+ topic_info_query = TopicInfoQuery(topic_id=topic_id)
766
+ topic_info = topic_info_query.execute(client)
767
+ print(topic_info)
768
+
769
+ ```
770
+ #### Method Chaining:
771
+ ```
772
+ topic_info_query = (
773
+ TopicInfoQuery()
774
+ .set_topic_id(topic_id)
775
+ )
776
+
777
+ topic_info = topic_info_query.execute(client)
778
+ print(topic_info)
779
+
780
+ ```
781
+
782
+ ### Querying Topic Message
783
+
784
+ #### Pythonic Syntax:
785
+ ```
786
+ query = TopicMessageQuery(
787
+ topic_id=topic_id,
788
+ start_time=datetime.utcnow(),
789
+ chunking_enabled=True,
790
+ limit=0
791
+ )
792
+
793
+ query.subscribe(client)
794
+
795
+ ```
796
+ #### Method Chaining:
797
+ ```
798
+ query = (
799
+ TopicMessageQuery()
800
+ .set_topic_id(topic_id)
801
+ .set_start_time(datetime.utcnow())
802
+ .set_chunking_enabled(True)
803
+ .set_limit(0)
804
+ )
805
+
806
+ query.subscribe(client)
807
+ ```
808
+
809
+ ## Contributing
810
+
811
+ Contributions are welcome! Please follow these steps:
812
+
813
+ 1. Fork this repository.
814
+ 2. Create a new branch with your feature or fix.
815
+ 3. Make your changes and ensure the tests pass.
816
+ 3. Submit a pull request.
817
+
818
+ Please ensure all new code is covered by unit tests.
819
+
820
+ ## License
821
+
822
+ This project is licensed under the MIT License.