|
| 1 | +name: Good First Issue Template |
| 2 | +description: A Python SDK-specific template to quickly create excellent good first issues |
| 3 | +title: "Good First Issue: Add Your Title Here" |
| 4 | +labels: "good first issue" |
| 5 | +assignees: '' |
| 6 | +--- |
| 7 | + |
| 8 | +## 🆕🐥 First Timers Only |
| 9 | + |
| 10 | +This issue is reserved for people who have never contributed or have made minimal contributions to [Hiero Python SDK](https://hiero.org). |
| 11 | +We know that creating a pull request (PR) is a major barrier for new contributors. |
| 12 | +The goal of this issue and all other issues in [**find a good first issue**](https://github.com/issues?q=is%3Aopen+is%3Aissue+org%3Ahiero-ledger+archived%3Afalse+label%3A%22good+first+issue%22+) is to help you make your first contribution to the Hiero Python SDK. |
| 13 | + |
| 14 | +## 👾 Description of the issue |
| 15 | + |
| 16 | +EDIT THIS SECTION |
| 17 | + |
| 18 | +AT THIS SECTION YOU NEED TO DESCRIBE THE ISSUE IN A WAY THAT IS UNDERSTANDABLE TO NEW CONTRIBUTORS. |
| 19 | +YOU MUST NOT ASSUME THAT SUCH CONTRIBUTORS HAVE ANY KNOWLEDGE ABOUT THE CODEBASE OR HIERO. |
| 20 | +IT IS HELPFUL TO ADD LINKS TO THE RELEVANT DOCUMENTATION AND/OR CODE SECTIONS. |
| 21 | + |
| 22 | +<!-- Example (commented out so you cannot see this on publish) |
| 23 | +The example for Token Associate Transaction located at examples/tokens/token_associate_transaction.py correctly illustrates how to associate a token, however, it does so all from one function main() |
| 24 | +
|
| 25 | +As everything is grouped together in main(), it is difficult for a user to understand all the individual steps required to associate a token. |
| 26 | +
|
| 27 | +For example: |
| 28 | +```python |
| 29 | +
|
| 30 | +def run_demo(): |
| 31 | + """Monolithic token association demo.""" |
| 32 | + print(f"🚀 Connecting to Hedera {network_name} network!") |
| 33 | + client = Client(Network(network_name)) |
| 34 | + operator_id = AccountId.from_string(os.getenv("OPERATOR_ID", "")) |
| 35 | + operator_key = PrivateKey.from_string(os.getenv("OPERATOR_KEY", "")) |
| 36 | + client.set_operator(operator_id, operator_key) |
| 37 | + print(f"✅ Client ready (operator {operator_id})") |
| 38 | +
|
| 39 | + test_key = PrivateKey.generate_ed25519() |
| 40 | + receipt = ( |
| 41 | + AccountCreateTransaction() |
| 42 | + .set_key(test_key.public_key()) |
| 43 | + .set_initial_balance(Hbar(1)) |
| 44 | + .set_account_memo("Test account for token association demo") |
| 45 | + .freeze_with(client) |
| 46 | + .sign(operator_key) |
| 47 | + .execute(client) |
| 48 | + ) |
| 49 | + if receipt.status != ResponseCode.SUCCESS: |
| 50 | + raise Exception(receipt.status) |
| 51 | + account_id = receipt.account_id |
| 52 | + print(f"✅ Created test account {account_id}") |
| 53 | +
|
| 54 | + # Create tokens |
| 55 | + tokens = [] |
| 56 | + for i in range(3): |
| 57 | + try: |
| 58 | + receipt = ( |
| 59 | + TokenCreateTransaction() |
| 60 | + .set_token_name(f"DemoToken{i}") |
| 61 | + .set_token_symbol(f"DTK{i}") |
| 62 | + .set_decimals(2) |
| 63 | + .set_initial_supply(100_000) |
| 64 | + .set_treasury_account_id(operator_id) |
| 65 | + .freeze_with(client) |
| 66 | + .sign(operator_key) |
| 67 | + .execute(client) |
| 68 | + ) |
| 69 | + if receipt.status != ResponseCode.SUCCESS: |
| 70 | + raise Exception(receipt.status) |
| 71 | + token_id = receipt.token_id |
| 72 | + tokens.append(token_id) |
| 73 | + print(f"✅ Created token {token_id}") |
| 74 | + except Exception as e: |
| 75 | + print(f"❌ Token creation failed: {e}") |
| 76 | + sys.exit(1) |
| 77 | +
|
| 78 | + # Associate first token |
| 79 | + try: |
| 80 | + TokenAssociateTransaction().set_account_id(account_id).add_token_id(tokens[0]).freeze_with(client).sign(test_key).execute(client) |
| 81 | + print(f"✅ Token {tokens[0]} associated with account {account_id}") |
| 82 | + except Exception as e: |
| 83 | + print(f"❌ Token association failed: {e}") |
| 84 | + sys.exit(1) |
| 85 | +
|
| 86 | +if __name__ == "__main__": |
| 87 | + run_demo() |
| 88 | +``` |
| 89 | + --> |
| 90 | + |
| 91 | +## 💡 Solution |
| 92 | + |
| 93 | +EDIT THIS SECTION |
| 94 | + |
| 95 | +AT THIS SECTION YOU NEED TO DESCRIBE THE STEPS NEEDED TO SOLVE THE ISSUE. |
| 96 | +PLEASE BREAK DOWN THE STEPS AS MUCH AS POSSIBLE AND MAKE SURE THAT THEY ARE EASY TO FOLLOW. |
| 97 | +IF POSSIBLE, ADD LINKS TO THE RELEVANT DOCUMENTATION AND/OR CODE SECTIONS. |
| 98 | + |
| 99 | +<!-- Example (commented out so you cannot see this on publish) |
| 100 | +The solution is to split the monolithic main() function for illustrating TokenAssociateTransaction into separate smaller functions which are called from main(). |
| 101 | +
|
| 102 | + --> |
| 103 | + |
| 104 | +### 👩💻 Implementation |
| 105 | + |
| 106 | +EDIT THIS SECTION |
| 107 | + |
| 108 | +AT THIS SECTION YOU NEED TO DESCRIBE THE TECHNICAL STEPS NEEDED TO SOLVE THE ISSUE. |
| 109 | +PLEASE BREAK DOWN THE STEPS AS MUCH AS POSSIBLE AND MAKE SURE THAT THEY ARE EASY TO FOLLOW. |
| 110 | +IF POSSIBLE, ADD LINKS TO THE RELEVANT DOCUMENTATION AND/OR CODE. |
| 111 | + |
| 112 | +<!-- Example (commented out so you cannot see this on publish) |
| 113 | +
|
| 114 | +To break down the monolithic main function, you need to: |
| 115 | +- [ ] Extract the Key Steps (set up a client, create a test account, create a token, associate the token) |
| 116 | +- [ ] Copy and paste the functionality for each key step into its own function |
| 117 | +- [ ] Pass to each function the variables you need to run it |
| 118 | +- [ ] Call each function in main() |
| 119 | +- [ ] Ensure you return the values you'll need to pass on to the next step in main |
| 120 | +- [ ] Ensure the example still runs and has the same output! |
| 121 | +
|
| 122 | +For example: |
| 123 | +```python |
| 124 | +
|
| 125 | +def setup_client(): |
| 126 | + """ |
| 127 | + Initialize and set up the client with operator account. |
| 128 | + """ |
| 129 | +
|
| 130 | +def create_test_account(client, operator_key): |
| 131 | + """ |
| 132 | + Create a new test account for demonstration. |
| 133 | + """ |
| 134 | +
|
| 135 | +
|
| 136 | +def create_fungible_token(client, operator_id, operator_key): |
| 137 | + """ |
| 138 | + Create a fungible token for association with test account. |
| 139 | + """ |
| 140 | +
|
| 141 | +def associate_token_with_account(client, token_id, account_id, account_key): |
| 142 | + """ |
| 143 | + Associate the token with the test account. |
| 144 | + """ |
| 145 | +
|
| 146 | +
|
| 147 | +def main(): |
| 148 | + client, operator_id, operator_key = setup_client() |
| 149 | + account_id, account_private_key = create_test_account(client, operator_key) |
| 150 | + token_id = create_fungible_token(client, operator_id, operator_key) |
| 151 | + associate_token_with_account(client, token_id, account_id, account_private_key) |
| 152 | +
|
| 153 | +if __name__ == "__main__": |
| 154 | + main() |
| 155 | + --> |
| 156 | + |
| 157 | +## 📋 Step by step guide to do a contribution |
| 158 | + |
| 159 | +If you have never contributed to an open source project at GitHub, the following step-by-step guide will introduce you to the workflow. |
| 160 | + |
| 161 | +- [ ] **Claim this issue:** Comment below that you are interested in working on the issue. Without assignment, your pull requests might be closed and the issue given to another developer. |
| 162 | +- [ ] **Wait for assignment:** A community member with the given rights will add you as an assignee of the issue |
| 163 | +- [ ] **Fork, Branch and Work on the issue:** Create a copy of the repository, create a branch for the issue and solve the problem. For instructions, please read our [Contributing guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/CONTRIBUTING.md) file. Further help can be found at [Set-up Training](https://github.com/hiero-ledger/hiero-sdk-python/tree/main/docs/sdk_developers/training/setup) and [Workflow Training](https://github.com/hiero-ledger/hiero-sdk-python/tree/main/docs/sdk_developers/training/workflow). |
| 164 | +- [ ] **DCO and GPG key sign each commit :** each commit must be -s and -S signed. An explanation on how to do this is at [Signing Guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/signing.md) |
| 165 | +- [ ] **Add a Changelog Entry :** your pull request will require a changelog. Read [Changelog Entry Guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/changelog_entry.md) to learn how. |
| 166 | +- [ ] **Push and Create a Pull Request :** Once your issue is resolved, and your commits are signed, and you have a changelog entry, push your changes and create a pull request. Detailed instructions can be found at [Submit PR Training](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/training/workflow/11_submit_pull_request.md), part of [Workflow Training](https://github.com/hiero-ledger/hiero-sdk-python/tree/main/docs/sdk_developers/training/workflow). |
| 167 | +- [ ] **You did it 🎉:** A maintainer or committer will review your pull request and provide feedback. If approved, we will merge the fix in the main branch. Thanks for being part of the Hiero community as an open-source contributor ❤️ |
| 168 | + |
| 169 | +***IMPORTANT*** Your pull request CANNOT BE MERGED until you add a changelog entry AND sign your commits each with `git commit -S -s -m "chore: your commit message"` with a GPG key setup. |
| 170 | + |
| 171 | +## 🤔 Additional Information |
| 172 | + |
| 173 | +For more help, we have extensive documentation at [SDK Developer Docs](https://github.com/hiero-ledger/hiero-sdk-python/tree/main/docs/sdk_developers) and at [SDK Developer Training](https://github.com/hiero-ledger/hiero-sdk-python/tree/main/docs/sdk_developers/training) |
| 174 | + |
| 175 | +Additionally, we invite you to join our community on our [Discord](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/discord.md) server. |
| 176 | + |
| 177 | +We also invite you to attend each Wednesday, 2pm UTC our [Python SDK Office Hour and Community Calls](https://zoom-lfx.platform.linuxfoundation.org/meetings/hiero?view=week). The Python SDK Office hour is for hands-on-help and the Community Call for general community discussion. |
| 178 | + |
| 179 | +You can also ask for help in a comment below! |
0 commit comments