Skip to content

Commit f59c2c3

Browse files
authored
Merge branch 'main' into hbar-s-clean
Signed-off-by: prajeeta <96904203+prajeeta15@users.noreply.github.com>
2 parents eacffc6 + 43ece01 commit f59c2c3

33 files changed

+1877
-239
lines changed
Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
name: Good First Issue Template
2+
description: Create a Good First Issue for new contributors
3+
title: "[Good First Issue]: "
4+
labels: ["Good First Issue"]
5+
assignees: []
6+
body:
7+
- type: textarea
8+
id: intro
9+
attributes:
10+
label: 🆕🐥 First Timers Only
11+
description: Who is this issue for?
12+
value: |
13+
This issue is reserved for people who have never contributed or have made minimal contributions to [Hiero Python SDK](https://hiero.org).
14+
We know that creating a pull request (PR) is a major barrier for new contributors.
15+
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.
16+
validations:
17+
required: false
18+
19+
- type: textarea
20+
id: issue
21+
attributes:
22+
label: 👾 Description of the issue
23+
description: |
24+
DESCRIBE THE ISSUE IN A WAY THAT IS UNDERSTANDABLE TO NEW CONTRIBUTORS.
25+
YOU MUST NOT ASSUME THAT SUCH CONTRIBUTORS HAVE ANY KNOWLEDGE ABOUT THE CODEBASE OR HIERO.
26+
IT IS HELPFUL TO ADD LINKS TO THE RELEVANT DOCUMENTATION AND/OR CODE SECTIONS.
27+
BELOW IS AN EXAMPLE.
28+
value: |
29+
Edit here. Example provided below.
30+
31+
validations:
32+
required: true
33+
34+
- type: markdown
35+
attributes:
36+
value: |
37+
<!-- Example for problem (hidden in submission) -->
38+
## 👾 Description of the issue - Example
39+
40+
The example for Token Associate Transaction located at examples/tokens/token_associate_transaction.py can be improved. It correctly illustrates how to associate a token, however, it does so all from one function main()
41+
42+
As everything is grouped together in main(), it is difficult for a user to understand all the individual steps required to associate a token.
43+
44+
For example:
45+
```python
46+
47+
def run_demo():
48+
"""Monolithic token association demo."""
49+
print(f"🚀 Connecting to Hedera {network_name} network!")
50+
client = Client(Network(network_name))
51+
operator_id = AccountId.from_string(os.getenv("OPERATOR_ID", ""))
52+
operator_key = PrivateKey.from_string(os.getenv("OPERATOR_KEY", ""))
53+
client.set_operator(operator_id, operator_key)
54+
print(f"✅ Client ready (operator {operator_id})")
55+
56+
test_key = PrivateKey.generate_ed25519()
57+
receipt = (
58+
AccountCreateTransaction()
59+
.set_key(test_key.public_key())
60+
.set_initial_balance(Hbar(1))
61+
.set_account_memo("Test account for token association demo")
62+
.freeze_with(client)
63+
.sign(operator_key)
64+
.execute(client)
65+
)
66+
if receipt.status != ResponseCode.SUCCESS:
67+
raise Exception(receipt.status)
68+
account_id = receipt.account_id
69+
print(f"✅ Created test account {account_id}")
70+
71+
# Create tokens
72+
tokens = []
73+
for i in range(3):
74+
try:
75+
receipt = (
76+
TokenCreateTransaction()
77+
.set_token_name(f"DemoToken{i}")
78+
.set_token_symbol(f"DTK{i}")
79+
.set_decimals(2)
80+
.set_initial_supply(100_000)
81+
.set_treasury_account_id(operator_id)
82+
.freeze_with(client)
83+
.sign(operator_key)
84+
.execute(client)
85+
)
86+
if receipt.status != ResponseCode.SUCCESS:
87+
raise Exception(receipt.status)
88+
token_id = receipt.token_id
89+
tokens.append(token_id)
90+
print(f"✅ Created token {token_id}")
91+
except Exception as e:
92+
print(f"❌ Token creation failed: {e}")
93+
sys.exit(1)
94+
95+
# Associate first token
96+
try:
97+
TokenAssociateTransaction().set_account_id(account_id).add_token_id(tokens[0]).freeze_with(client).sign(test_key).execute(client)
98+
print(f"✅ Token {tokens[0]} associated with account {account_id}")
99+
except Exception as e:
100+
print(f"❌ Token association failed: {e}")
101+
sys.exit(1)
102+
```
103+
104+
- type: textarea
105+
id: solution
106+
attributes:
107+
label: 💡 Proposed Solution
108+
description: |
109+
AT THIS SECTION YOU NEED TO DESCRIBE THE STEPS NEEDED TO SOLVE THE ISSUE.
110+
PLEASE BREAK DOWN THE STEPS AS MUCH AS POSSIBLE AND MAKE SURE THAT THEY
111+
ARE EASY TO FOLLOW. IF POSSIBLE, ADD LINKS TO THE RELEVANT
112+
DOCUMENTATION AND/OR CODE SECTIONS.
113+
value: |
114+
Edit here. Example provided below.
115+
116+
validations:
117+
required: true
118+
119+
- type: markdown
120+
attributes:
121+
value: |
122+
<!-- Example for the solution (hidden in submission) -->
123+
## 💡 Solution - Example
124+
125+
For the TokenAssociateTransaction example, the solution is to split the monolithic main() function for illustrating TokenAssociateTransaction into separate smaller functions which are called from main().
126+
Such as:
127+
- Setting up the client
128+
- Creating an account
129+
- Creating a token
130+
- Associating the account to the token
131+
132+
- type: textarea
133+
id: implementation
134+
attributes:
135+
label: 👩‍💻 Implementation Steps
136+
description: |
137+
AT THIS SECTION YOU NEED TO DESCRIBE THE TECHNICAL STEPS NEEDED TO SOLVE THE ISSUE.
138+
PLEASE BREAK DOWN THE STEPS AS MUCH AS POSSIBLE AND MAKE SURE THAT THEY ARE EASY TO FOLLOW.
139+
IF POSSIBLE, ADD LINKS TO THE RELEVANT DOCUMENTATION AND/OR CODE.
140+
value: |
141+
Edit here. Example provided below.
142+
143+
validations:
144+
required: true
145+
146+
- type: markdown
147+
attributes:
148+
value: |
149+
<!-- Example implementation (hidden in submission) -->
150+
### 👩‍💻 Implementation - Example
151+
152+
To break down the monolithic main function, you need to:
153+
- [ ] Extract the Key Steps (set up a client, create a test account, create a token, associate the token)
154+
- [ ] Copy and paste the functionality for each key step into its own function
155+
- [ ] Pass to each function the variables you need to run it
156+
- [ ] Call each function in main()
157+
- [ ] Ensure you return the values you'll need to pass on to the next step in main
158+
- [ ] Ensure the example still runs and has the same output!
159+
160+
For example:
161+
```python
162+
163+
def setup_client():
164+
"""Initialize and set up the client with operator account."""
165+
166+
def create_test_account(client, operator_key):
167+
"""Create a new test account for demonstration."""
168+
169+
def create_fungible_token(client, operator_id, operator_key):
170+
"""Create a fungible token for association with test account."""
171+
172+
def associate_token_with_account(client, token_id, account_id, account_key):
173+
"""Associate the token with the test account."""
174+
175+
def main():
176+
client, operator_id, operator_key = setup_client()
177+
account_id, account_private_key = create_test_account(client, operator_key)
178+
token_id = create_fungible_token(client, operator_id, operator_key)
179+
associate_token_with_account(client, token_id, account_id, account_private_key)
180+
```
181+
182+
- type: textarea
183+
id: acceptance-criteria
184+
attributes:
185+
label: ✅ Acceptance Criteria
186+
description: |
187+
EDIT OR EXPAND THE CHECKLIST ON WHAT IS REQUIRED TO BE ABLE TO MERGE A PULL REQUEST FOR THIS ISSUE
188+
value: |
189+
To be able to merge a pull request for this issue, we need:
190+
- [ ] **Changelog Entry:** Correct changelog entry (please link to the documentation - [see guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/changelog_entry.md))
191+
- [ ] **Signed commits:** commits must be DCO and GPG key signed ([see guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/signing.md))
192+
- [ ] **All Tests Pass:** our workflow checks like unit and integration tests must pass
193+
- [ ] **Issue is Solved:** The implementation fully addresses the issue requirements as described above
194+
- [ ] **No Further Changes are Made:** Code review feedback has been addressed and no further changes are requested
195+
validations:
196+
required: true
197+
198+
- type: textarea
199+
id: contribution_steps
200+
attributes:
201+
label: 📋 Step-by-Step Contribution Guide
202+
description: Provide a contribution workflow suitable for new contributors
203+
value: |
204+
If you have never contributed to an open source project at GitHub, the following step-by-step guide will introduce you to the workflow.
205+
206+
- [ ] **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.
207+
- [ ] **Wait for assignment:** A community member with the given rights will add you as an assignee of the issue
208+
- [ ] **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).
209+
- [ ] **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)
210+
- [ ] **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.
211+
- [ ] **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).
212+
- [ ] **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 ❤️
213+
214+
***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.
215+
validations:
216+
required: true
217+
218+
- type: textarea
219+
id: information
220+
attributes:
221+
label: 🤔 Additional Information
222+
description: Provide any extra resources or context for contributors to solve this good first issue
223+
value: |
224+
For more help, we have extensive documentation attributes:
225+
- [SDK Developer Docs](https://github.com/hiero-ledger/hiero-sdk-python/tree/main/docs/sdk_developers)
226+
- [SDK Developer Training](https://github.com/hiero-ledger/hiero-sdk-python/tree/main/docs/sdk_developers/training)
227+
228+
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.
229+
230+
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.
231+
232+
You can also ask for help in a comment below!

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
blank_issues_enabled: true
2+
3+
# Only show specific issue templates
4+
# issue_templates:
5+
# - name: Good First Issue
6+
# filename: 01-good_first_issue.yml
7+
8+
# Test contact links
9+
contact_links:
10+
- name: Hiero Discord
11+
url: https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/discord.md
12+
about: Please ask and answer questions here.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
if [ -z "$ASSIGNEE" ] || [ -z "$ISSUE_NUMBER" ] || [ -z "$REPO" ]; then
4+
echo "Error: Missing required environment variables (ASSIGNEE, ISSUE_NUMBER, REPO)."
5+
exit 1
6+
fi
7+
8+
echo "Checking assignment rules for user $ASSIGNEE on issue #$ISSUE_NUMBER"
9+
10+
PERM_JSON=$(gh api repos/$REPO/collaborators/$ASSIGNEE/permission)
11+
PERMISSION=$(echo "$PERM_JSON" | jq -r '.permission')
12+
13+
echo "User permission level: $PERMISSION"
14+
15+
if [[ "$PERMISSION" == "admin" ]] || [[ "$PERMISSION" == "write" ]]; then
16+
echo "User is a maintainer or committer. Limit does not apply."
17+
exit 0
18+
fi
19+
20+
ASSIGNMENTS_JSON=$(gh issue list --repo $REPO --assignee "$ASSIGNEE" --state open --json number)
21+
COUNT=$(echo "$ASSIGNMENTS_JSON" | jq '. | length')
22+
23+
echo "Current open assignments count: $COUNT"
24+
25+
if (( COUNT > 2 )); then
26+
echo "Limit exceeded (Max 2 allowed). Revoking assignment."
27+
28+
gh issue edit $ISSUE_NUMBER --repo $REPO --remove-assignee "$ASSIGNEE"
29+
30+
MSG="Hi @$ASSIGNEE, this is the Assignment Bot."
31+
MSG="$MSG\n\nAssigning you to this issue would exceed the limit of 2 open assignments."
32+
MSG="$MSG\n\nPlease resolve and merge your existing assigned issues before requesting new ones."
33+
34+
gh issue comment $ISSUE_NUMBER --repo $REPO --body "$(printf "$MSG")"
35+
36+
exit 1
37+
else
38+
echo "Assignment valid. User has $COUNT assignments."
39+
fi
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: PythonBot - Assignment Limit
2+
3+
on:
4+
issues:
5+
types: [assigned]
6+
7+
permissions:
8+
issues: write
9+
10+
jobs:
11+
check-assignment-limit:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Harden the runner
15+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
16+
with:
17+
egress-policy: audit
18+
19+
- name: Checkout repository
20+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
21+
22+
- name: Check Assignment Count
23+
env:
24+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
ASSIGNEE: ${{ github.event.assignee.login }}
26+
ISSUE_NUMBER: ${{ github.event.issue.number }}
27+
REPO: ${{ github.repository }}
28+
run: |
29+
# Make script executable (just in case permissions were lost during checkout)
30+
chmod +x .github/scripts/check_assignment_limit.sh
31+
32+
# Run the script
33+
./.github/scripts/check_assignment_limit.sh

.github/workflows/bot-inactivity-unassign-phase1.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: bot-inactivity-unassign-phase1
22

33
on:
44
schedule:
5-
- cron: "0 10 * * *"
5+
- cron: "0 12 * * *"
66
workflow_dispatch:
77

88
permissions:
@@ -15,6 +15,8 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
1820
- name: Harden the runner
1921
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2
2022
with:

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Changelog
1+
# Changelog
22

33
All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](https://semver.org).
@@ -20,6 +20,28 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
2020
### Fixed
2121

2222
-
23+
- Added **str**() to CustomFixedFee and updated examples and tests accordingly.
24+
- Added a github template for good first issues
25+
- Added `.github/workflows/bot-assignment-check.yml` to limit non-maintainers to 2 concurrent issue assignments.
26+
- Added all missing fields to **str**() method and updated `test_tokem_info.py`
27+
- Add examples/tokens/token_create_transaction_pause_key.py example demonstrating token pause/unpause behavior and pause key usage (#833)
28+
- Added `docs/sdk_developers/training/transaction_lifecycle.md` to explain the typical lifecycle of executing a transaction using the Hedera Python SDK.
29+
- Add inactivity bot workflow to unassign stale issue assignees (#952)
30+
- Made custom fraction fee end to end
31+
- feat: AccountCreateTransaction now supports both PrivateKey and PublicKey [#939](https://github.com/hiero-ledger/hiero-sdk-python/issues/939)
32+
- Added Acceptance Criteria section to Good First Issue template for better contributor guidance (#997)
33+
- Added __str__() to CustomRoyaltyFee and updated examples and tests accordingly (#986)
34+
35+
### Changed
36+
37+
- Allow `PublicKey` for `TokenUpdateKeys` in `TokenUpdateTransaction`, enabling non-custodial workflows where operators can build transactions using only public keys (#934).
38+
- Bump protobuf toml to protobuf==6.33.2
39+
40+
### Fixed
41+
42+
- Fixed inactivity bot workflow not checking out repository before running (#964)
43+
- Fixed the topic_message_query integarion test
44+
- good first issue template yaml rendering
2345

2446
### Breaking Change
2547

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,4 @@ This project is licensed under the [Apache License 2.0](LICENSE).
134134

135135
---
136136

137-
**Latest release:** Check [PyPI](https://pypi.org/project/hiero-sdk-python/) or [GitHub Releases](https://github.com/hiero-ledger/hiero-sdk-python/releases)
137+
**Latest release:** Check [PyPI](https://pypi.org/project/hiero-sdk-python/) or [GitHub Releases](https://github.com/hiero-ledger/hiero-sdk-python/releases)

0 commit comments

Comments
 (0)