Skip to content

Commit 073bb3e

Browse files
authored
Merge branch 'main' into feat/modular-token-transfer
Signed-off-by: Raja Rathour <193507075+Raja-89@users.noreply.github.com>
2 parents c06dc7f + b0a7c9d commit 073bb3e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+6527
-529
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: PythonBot - Verify PR Commits
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
concurrency:
12+
group: "verify-commits-${{ github.event.pull_request.number }}"
13+
cancel-in-progress: true
14+
15+
jobs:
16+
verify-commits:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Harden the runner (Audit all outbound calls)
21+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
22+
with:
23+
egress-policy: audit
24+
25+
- name: Checkout repository
26+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
27+
28+
- name: Check for unverified commits
29+
env:
30+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
run: |
32+
PR_NUMBER=${{ github.event.pull_request.number }}
33+
REPO="${{ github.repository }}"
34+
COMMITS_URL="https://github.com/$REPO/pull/${PR_NUMBER}/commits"
35+
36+
echo "Checking commits in PR #$PR_NUMBER for repository $REPO..."
37+
38+
COMMITS_JSON=$(gh api repos/$REPO/pulls/$PR_NUMBER/commits)
39+
UNVERIFIED_COUNT=$(echo "$COMMITS_JSON" | jq '[.[] | select(.commit.verification.verified == false)] | length')
40+
41+
echo "Unverified commits: $UNVERIFIED_COUNT"
42+
43+
if [ "$UNVERIFIED_COUNT" -gt 0 ]; then
44+
COMMENT=$(cat <<EOF
45+
Hi, this is VerificationBot.
46+
Your pull request cannot be merged as it has **unverified commits**.
47+
View your commit verification status: [Commits Tab]($COMMITS_URL).
48+
49+
To achieve verified status, please read:
50+
- [Signing guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/signing.md)
51+
- [README](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/README.md)
52+
- [Discord](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/discord.md)
53+
54+
Remember, you require a GPG key and each commit must be signed with:
55+
\`git commit -S -s -m "Your message here"\`
56+
57+
Thank you for contributing!
58+
59+
From the Hiero Python SDK Team
60+
EOF
61+
)
62+
63+
gh pr view $PR_NUMBER --repo $REPO --json comments --jq '.comments[].body' | grep -F "PythonBot" >/dev/null || \
64+
(gh pr comment $PR_NUMBER --repo $REPO --body "$COMMENT" && echo "Comment added to PR #$PR_NUMBER")
65+
else
66+
echo "All commits in PR #$PR_NUMBER are verified."
67+
fi
68+
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: PythonBot - Workflow Failure Notifier
2+
on:
3+
workflow_dispatch:
4+
workflow_run:
5+
workflows:
6+
- "PR Formatting"
7+
- "Hiero Solo Integration Tests"
8+
- "Run Examples"
9+
types:
10+
- completed
11+
permissions:
12+
contents: read
13+
pull-requests: write
14+
concurrency:
15+
group: "workflow-failure-${{ github.event.workflow_run.head_branch }}"
16+
cancel-in-progress: true
17+
jobs:
18+
notify-pr:
19+
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Harden the runner (Audit all outbound calls)
23+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
24+
with:
25+
egress-policy: audit
26+
27+
- name: Get associated PR number
28+
id: get-pr
29+
env:
30+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
run: |
32+
# Get branch from the workflow run
33+
HEAD_BRANCH=$(gh run view ${{ github.event.workflow_run.id }} \
34+
--repo ${{ github.repository }} \
35+
--json headBranch --jq '.headBranch')
36+
37+
# Find the PR number for this branch
38+
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --state all --head "$HEAD_BRANCH" --json number --jq '.[0].number')
39+
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
40+
41+
- name: Comment on PR
42+
if: env.PR_NUMBER != ''
43+
env:
44+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
run: |
46+
REPO="${{ github.repository }}"
47+
COMMENT=$(cat <<EOF
48+
Hi, this is WorkflowBot.
49+
Your pull request cannot be merged as it is not passing all our workflow checks.
50+
Please click on each check to review the logs and resolve issues so all checks pass.
51+
To help you:
52+
- [DCO signing guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/signing.md)
53+
- [Changelog guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/changelog_entry.md)
54+
- [Merge conflicts guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/merge_conflicts.md)
55+
- [Rebase guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/rebasing.md)
56+
- [Testing guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/testing.md)
57+
- [Discord](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/discord.md)
58+
- [Community Calls](https://zoom-lfx.platform.linuxfoundation.org/meetings/hiero?view=week)
59+
Thank you for contributing!
60+
From the Hiero Python SDK Team
61+
EOF
62+
)
63+
EXISTING_COMMENT=$(gh pr view "$PR_NUMBER" --repo "$REPO" --comments \
64+
--json comments --jq ".comments[] | select(.body == \"${COMMENT//\"/\\\"}\") | .id")
65+
66+
if [ -z "$EXISTING_COMMENT" ]; then
67+
gh pr comment "$PR_NUMBER" --repo "$REPO" --body "$COMMENT"
68+
else
69+
echo "Comment already exists, skipping."
70+
fi

.github/workflows/examples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
egress-policy: audit
2020

2121
- name: Checkout repository
22-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
22+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3
2323
with:
2424
fetch-depth: 0
2525

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
egress-policy: audit
2424

2525
- name: Checkout repository
26-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
26+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
2727

2828
- name: Set up Python
2929
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0

.github/workflows/test.yml

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: Hiero Solo Integration Tests
1+
name: Hiero Solo Integration & Unit Tests
22

33
on:
44
push:
55
branches:
66
- '**'
7-
workflow_dispatch:
8-
pull_request:
7+
pull_request: {}
8+
workflow_dispatch: {}
99

1010
permissions:
1111
contents: read
@@ -27,7 +27,7 @@ jobs:
2727
egress-policy: audit
2828

2929
- name: Checkout repository
30-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
30+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
3131

3232
- name: Set up Python ${{ matrix.python-version }}
3333
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
@@ -62,17 +62,52 @@ jobs:
6262
6363
- name: Install your package
6464
run: pip install -e .
65-
66-
- name: Run integration tests
65+
- name: Run all integration tests
66+
id: integration
67+
continue-on-error: true
68+
shell: bash
6769
env:
6870
OPERATOR_ID: ${{ steps.solo.outputs.accountId }}
6971
OPERATOR_KEY: ${{ steps.solo.outputs.privateKey }}
7072
ADMIN_KEY: ${{ steps.solo.outputs.privateKey }}
7173
PUBLIC_KEY: ${{ steps.solo.outputs.publicKey }}
7274
NETWORK: solo
7375
run: |
74-
uv run pytest -m integration
75-
76-
- name: Run unit tests
76+
set -o pipefail
77+
echo "🚀 Running integration tests..."
78+
uv run pytest tests/integration -v --disable-warnings --continue-on-collection-errors 2>&1 | tee result_integration.log
79+
pytest_exit=${PIPESTATUS[0]}
80+
echo "integration_failed=$pytest_exit" >> "$GITHUB_OUTPUT"
81+
cat result_integration.log
82+
if [ $pytest_exit -ne 0 ]; then
83+
echo "❌ Some integration tests failed"
84+
else
85+
echo "✅ All integration tests passed"
86+
fi
87+
88+
- name: Run all unit tests
89+
id: unit
90+
continue-on-error: true
91+
shell: bash
92+
run: |
93+
set -o pipefail
94+
echo "🚀 Running unit tests..."
95+
uv run pytest tests/unit -v --disable-warnings --continue-on-collection-errors 2>&1 | tee result_unit.log
96+
pytest_exit=${PIPESTATUS[0]}
97+
echo "unit_failed=$pytest_exit" >> "$GITHUB_OUTPUT"
98+
cat result_unit.log
99+
if [ $pytest_exit -ne 0 ]; then
100+
echo "❌ Some unit tests failed"
101+
else
102+
echo "✅ All unit tests passed"
103+
fi
104+
105+
- name: Fail workflow if any tests failed
106+
shell: bash
77107
run: |
78-
uv run pytest -m unit
108+
if [ "${{ steps.integration.outputs.integration_failed }}" != "0" ] || [ "${{ steps.unit.outputs.unit_failed }}" != "0" ]; then
109+
echo "❌ Some tests failed. Failing workflow."
110+
exit 1
111+
else
112+
echo "✅ All tests passed!"
113+
fi

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ src/hiero_sdk_python/hapi
3333

3434
# Lock files
3535
uv.lock
36-
pdm.lock
36+
pdm.lock
37+
pubkey.asc

CHANGELOG.md

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,56 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
66

77
## [Unreleased]
88

9-
109
### Added
1110

11+
- Add detail to `token_airdrop.py` and `token_airdrop_cancel.py`
12+
- Add workflow: github bot to respond to unverified PR commits (#750)
13+
- Add workflow: bot workflow which notifies developers of workflow failures in their pull requests.
14+
- Add `examples/token_create_transaction_max_automatic_token_associations_0.py` to demonstrate how `max_automatic_token_associations=0` behaves.
15+
- Add `examples/topic_id.py` to demonstrate `TopicId` opeartions
16+
- Add `examples/topic_message.py` to demonstrate `TopicMessage` and `TopicMessageChunk` with local mock data.
17+
- Added missing validation logic `fee_schedule_key` in integration `token_create_transaction_e2e_test.py` and ``token_update_transaction_e2e_test.py`.
18+
- Add `account_balance_query.py` example to demonstrate how to use the CryptoGetAccountBalanceQuery class.
19+
- Add `examples/token_create_transaction_admin_key.py` demonstrating admin key privileges for token management including token updates, key changes, and deletion (#798)
20+
- Add `examples/token_create_transaction_freeze_key.py` showcasing freeze key behavior, expected failures without the key, and the effect of freezing/unfreezing on transfers.
21+
- Add `examples/account_info.py` to demonstrate `AccountInfo` opeartions
22+
- Added `HbarUnit` class and Extend `Hbar` class to handle floating-point numbers
23+
- feat: Allow `PrivateKey` to be used for keys in `TopicCreateTransaction` for consistency.
24+
- EvmAddress class
25+
- `alias`, `staked_account_id`, `staked_node_id` and `decline_staking_reward` fields to AccountCreateTransaction
26+
- `staked_account_id`, `staked_node_id` and `decline_staking_reward` fields to AccountInfo
27+
- Added `examples/token_create_transaction_supply_key.py` to demonstrate token creation with and without a supply key.
28+
- Added BatchTransaction class
29+
- Add support for token metadata (bytes, max 100 bytes) in `TokenCreateTransaction`, including a new `set_metadata` setter, example, and tests. [#799]
30+
31+
- Added `examples/token_create_transaction_token_fee_schedule.py` to demonstrate creating tokens with custom fee schedules and the consequences of not having it.
1232

1333
### Changed
34+
- Upgraded step-security/harden-runner v2.13.2
35+
- bumped actions/checkout from 5.0.0 to 6.0.0
36+
- Limit workflow bot to one message per PR
1437
- Refactored token-related example scripts (`token_delete.py`, `token_dissociate.py`, etc.) for improved readability and modularity. [#370]
15-
- upgrade: step security action upgraded from harden-runner-2.13.1 to harden-runner-2.13.1
16-
38+
- upgrade: step security action upgraded from harden-runner-2.13.1 to harden-runner.
39+
- chore: Split `examples/account_allowance_nft.py` into separate `account_allowance_approve_transaction_nft.py` and `account_allowance_delete_transaction_nft.py` examples.
40+
- chore: bump protobuf from 6.33.0 to 6.33.1 (#796)
41+
- fix: Allow `max_automatic_token_associations` to be set to -1 (unlimited) in `AccountCreateTransaction` and add field to `AccountInfo`.
42+
- Allow `PrivateKey` to be used for keys in `TopicCreateTransaction` for consistency.
43+
- Update github actions checkout from 5.0.0 to 5.0.1 (#814)
44+
- changed to add concurrency to workflow bot
1745
### Fixed
18-
- chore: fixed integration test names without a test prefix or postfix
1946

47+
- chore: fix test.yml workflow to log import errors (#740)
48+
- chore: fixed integration test names without a test prefix or postfix
49+
- Staked node ID id issue in the account_create_transationt_e2e_test
50+
- workflow: verified commits syntax for verfication bot
2051

2152

2253
## [0.1.8] - 2025-11-07
2354

2455
### Added
56+
57+
- `is_unknown` property added to `src/hiero_sdk_python/response_code.py`
58+
- Example `response_code.py`
2559
- Add `TokenFeeScheduleUpdateTransaction` class to support updating custom fee schedules on tokens (#471).
2660
- Add `examples/token_update_fee_schedule_fungible.py` and `examples/token_update_fee_schedule_nft.py` demonstrating the use of `TokenFeeScheduleUpdateTransaction`.
2761
- Update `docs/sdk_users/running_examples.md` to include `TokenFeeScheduleUpdateTransaction`.
@@ -44,15 +78,16 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
4478
- docs: Add `docs/sdk_developers/project_structure.md` to explain repository layout and import paths.
4579

4680
### Changed
81+
4782
- chore: bumped solo action from 14.0 to 15.0 (#764)
4883
- chore: replaced hardcoded 'testnet' messages with environment network name
49-
- chore: validate that token airdrop transactions require an available token service on the channel (#632)
84+
- chore: validate that token airdrop transactions require an available token service on the channel (#632)
5085
- chore: update local environment configuration in env.example (#649)
5186
- chore: Update env.example NETWORK to encourage testnet or local usage (#659)
5287
- chore: updated pyproject.toml with python 3.10 to 3.13 (#510, #449)
5388
- chore: fix type hint for TokenCancelAirdropTransaction pending_airdrops parameter
5489
- chore: Moved documentation file `common_issues.md` from `examples/sdk_developers/` to `docs/sdk_developers/` for unified documentation management (#516).
55-
- chore: Refactored the script of examples/custom_fee.py into modular functions
90+
- chore: Refactored the script of examples/custom_fee.py into modular functions
5691
- fix: Replaced `collections.namedtuple` with `typing.NamedTuple` in `client.py` for improved type checking.
5792
- chore: Refactored examples/custom_fee.py into three separate example files.
5893
- Expanded `docs/sdk_developers/checklist.md` with a self-review guide for all pull request submission requirements (#645).
@@ -62,6 +97,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
6297
- Refactor `AbstractTokenTransferTransaction` to unify Token/NFT transfer logic.
6398

6499
### Fixed
100+
65101
- Added explicit read permissions to examples.yml (#623)
66102
- Removed deprecated Logger.warn() method and legacy parameter swap logic from get_logger() (#673).
67103
- Improved type hinting in `file_append_transaction.py` to resolve 'mypy --strict` errors. ([#495](https://github.com/hiero-ledger/hiero-sdk-python/issues/495))
@@ -71,12 +107,13 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
71107
- Fixed incorrect `TokenType` import (protobuf vs. SDK enum) in 18 example files.
72108
- Update `schedule_sign_transaction_e2e_test` to check for key presence instead of relying on index.
73109
- Add `localhost` and `local` as network names
74-
110+
75111
### Breaking Changes
112+
76113
- chore: changed the file names airdrop classes (#631)
77-
{pending_airdrop_id.py -> token_airdrop_pending_id.py}
78-
{pending_airdrop_record.py -> token_airdrop_pending_record.py}
79-
{token_cancel_airdrop_transaction.py -> token_airdrop_transaction_cancel.py}
114+
{pending_airdrop_id.py -> token_airdrop_pending_id.py}
115+
{pending_airdrop_record.py -> token_airdrop_pending_record.py}
116+
{token_cancel_airdrop_transaction.py -> token_airdrop_transaction_cancel.py}
80117

81118
- In `TokenAirdropTransaction` the parameters of the following methods have been renamed:
82119
- add_nft_transfer(sender → sender_id, receiver → receiver_id)
@@ -106,7 +143,6 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
106143
- chore: fix the examples workflow to log error messages and run on import failure (#738)
107144
- Added `docs/discord.md` explaining how to join and navigate the Hiero community Discord (#614).
108145

109-
110146
### Changed
111147

112148
- Added direct links to Python SDK channel in Linux Foundation Decentralized Trust Discord back in
@@ -139,6 +175,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
139175
- Type hinting for `Topic` related transactions.
140176

141177
### Removed
178+
142179
- Remove deprecated camelCase alias support and `_DeprecatedAliasesMixin`; SDK now only exposes snake_case attributes for `NftId`, `TokenInfo`, and `TransactionReceipt`. (Issue #428)
143180

144181
## [0.1.6] - 2025-10-21
@@ -179,8 +216,6 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
179216
- Improved `CONTRIBUTING.md` by explaining the /docs folder structure and fixing broken hyperlinks.(#431)
180217
- Converted class in `token_nft_info.py` to dataclass for simplicity.
181218

182-
183-
184219
### Fixed
185220

186221
- Incompatible Types assignment in token_transfer_list.py

0 commit comments

Comments
 (0)