Skip to content

Commit 06aa368

Browse files
committed
fix: hbar errors
1 parent fd9cfe6 commit 06aa368

File tree

5 files changed

+80
-17
lines changed

5 files changed

+80
-17
lines changed

4.0.0

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
2+
Collecting grpcio-tools==1.76.0
3+
Downloading grpcio_tools-1.76.0-cp312-cp312-win_amd64.whl.metadata (5.5 kB)
4+
Collecting protobuf==6.33.2
5+
Downloading protobuf-6.33.2-cp310-abi3-win_amd64.whl.metadata (593 bytes)
6+
Collecting grpcio==1.76.0
7+
Downloading grpcio-1.76.0-cp312-cp312-win_amd64.whl.metadata (3.8 kB)
8+
Collecting cryptography==44.0.0
9+
Downloading cryptography-44.0.0-cp39-abi3-win_amd64.whl.metadata (5.7 kB)
10+
Collecting python-dotenv==1.2.1
11+
Downloading python_dotenv-1.2.1-py3-none-any.whl.metadata (25 kB)
12+
Requirement already satisfied: requests==2.32.3 in c:\python312\lib\site-packages (2.32.3)
13+
Requirement already satisfied: pycryptodome==3.23.0 in c:\python312\lib\site-packages (3.23.0)
14+
Collecting eth-abi==5.2.0
15+
Downloading eth_abi-5.2.0-py3-none-any.whl.metadata (3.8 kB)
16+
Collecting rlp
17+
Downloading rlp-4.1.0-py3-none-any.whl.metadata (3.2 kB)
18+
Collecting eth-keys==0.7.0
19+
Downloading eth_keys-0.7.0-py3-none-any.whl.metadata (13 kB)
20+
Requirement already satisfied: setuptools in c:\python312\lib\site-packages (from grpcio-tools==1.76.0) (80.9.0)
21+
Requirement already satisfied: typing-extensions~=4.12 in c:\python312\lib\site-packages (from grpcio==1.76.0) (4.15.0)
22+
Requirement already satisfied: cffi>=1.12 in c:\users\prajeeta\appdata\roaming\python\python312\site-packages (from cryptography==44.0.0) (1.17.1)
23+
Requirement already satisfied: charset-normalizer<4,>=2 in c:\python312\lib\site-packages (from requests==2.32.3) (3.4.1)
24+
Requirement already satisfied: idna<4,>=2.5 in c:\python312\lib\site-packages (from requests==2.32.3) (3.10)
25+
Requirement already satisfied: urllib3<3,>=1.21.1 in c:\python312\lib\site-packages (from requests==2.32.3) (2.3.0)
26+
Requirement already satisfied: certifi>=2017.4.17 in c:\python312\lib\site-packages (from requests==2.32.3) (2025.1.31)
27+
Collecting eth-utils>=2.0.0 (from eth-abi==5.2.0)
28+
Downloading eth_utils-5.3.1-py3-none-any.whl.metadata (5.7 kB)
29+
Collecting eth-typing>=3.0.0 (from eth-abi==5.2.0)
30+
Downloading eth_typing-5.2.1-py3-none-any.whl.metadata (3.2 kB)
31+
Collecting parsimonious<0.11.0,>=0.10.0 (from eth-abi==5.2.0)
32+
Downloading parsimonious-0.10.0-py3-none-any.whl.metadata (25 kB)
33+
Requirement already satisfied: pycparser in c:\users\prajeeta\appdata\roaming\python\python312\site-packages (from cffi>=1.12->cryptography==44.0.0) (2.22)
34+
Collecting eth-hash>=0.3.1 (from eth-utils>=2.0.0->eth-abi==5.2.0)
35+
Downloading eth_hash-0.7.1-py3-none-any.whl.metadata (4.2 kB)
36+
Collecting cytoolz>=0.10.1 (from eth-utils>=2.0.0->eth-abi==5.2.0)
37+
Downloading cytoolz-1.1.0-cp312-cp312-win_amd64.whl.metadata (5.3 kB)
38+
Requirement already satisfied: pydantic<3,>=2.0.0 in c:\python312\lib\site-packages (from eth-utils>=2.0.0->eth-abi==5.2.0) (2.11.7)
39+
Requirement already satisfied: regex>=2022.3.15 in c:\python312\lib\site-packages (from parsimonious<0.11.0,>=0.10.0->eth-abi==5.2.0) (2025.9.1)
40+
Requirement already satisfied: toolz>=0.8.0 in c:\python312\lib\site-packages (from cytoolz>=0.10.1->eth-utils>=2.0.0->eth-abi==5.2.0) (1.1.0)
41+
Requirement already satisfied: annotated-types>=0.6.0 in c:\python312\lib\site-packages (from pydantic<3,>=2.0.0->eth-utils>=2.0.0->eth-abi==5.2.0) (0.7.0)
42+
Requirement already satisfied: pydantic-core==2.33.2 in c:\python312\lib\site-packages (from pydantic<3,>=2.0.0->eth-utils>=2.0.0->eth-abi==5.2.0) (2.33.2)
43+
Requirement already satisfied: typing-inspection>=0.4.0 in c:\python312\lib\site-packages (from pydantic<3,>=2.0.0->eth-utils>=2.0.0->eth-abi==5.2.0) (0.4.1)
44+
Downloading grpcio_tools-1.76.0-cp312-cp312-win_amd64.whl (1.2 MB)
45+
---------------------------------------- 1.2/1.2 MB 289.3 kB/s eta 0:00:00
46+
Downloading protobuf-6.33.2-cp310-abi3-win_amd64.whl (436 kB)
47+
-------------------------------------- 436.9/436.9 kB 909.8 kB/s eta 0:00:00
48+
Downloading grpcio-1.76.0-cp312-cp312-win_amd64.whl (4.7 MB)
49+
---------------------------------------- 4.7/4.7 MB 1.6 MB/s eta 0:00:00
50+
Downloading cryptography-44.0.0-cp39-abi3-win_amd64.whl (3.2 MB)
51+
---------------------------------------- 3.2/3.2 MB 862.0 kB/s eta 0:00:00
52+
Downloading python_dotenv-1.2.1-py3-none-any.whl (21 kB)
53+
Downloading eth_abi-5.2.0-py3-none-any.whl (28 kB)
54+
Downloading eth_keys-0.7.0-py3-none-any.whl (20 kB)
55+
Downloading rlp-4.1.0-py3-none-any.whl (19 kB)
56+
Downloading eth_typing-5.2.1-py3-none-any.whl (19 kB)
57+
Downloading eth_utils-5.3.1-py3-none-any.whl (102 kB)
58+
-------------------------------------- 102.5/102.5 kB 493.5 kB/s eta 0:00:00
59+
Downloading parsimonious-0.10.0-py3-none-any.whl (48 kB)
60+
---------------------------------------- 48.4/48.4 kB 244.8 kB/s eta 0:00:00
61+
Downloading cytoolz-1.1.0-cp312-cp312-win_amd64.whl (947 kB)
62+
-------------------------------------- 948.0/948.0 kB 517.2 kB/s eta 0:00:00
63+
Downloading eth_hash-0.7.1-py3-none-any.whl (8.0 kB)
64+
Installing collected packages: python-dotenv, protobuf, parsimonious, grpcio, eth-typing, eth-hash, cytoolz, grpcio-tools, cryptography, eth-utils, rlp, eth-keys, eth-abi
65+
Attempting uninstall: python-dotenv
66+
Found existing installation: python-dotenv 1.0.1
67+
Uninstalling python-dotenv-1.0.1:
68+
Successfully uninstalled python-dotenv-1.0.1
69+
Rolling back uninstall of python-dotenv
70+
Moving to c:\python312\lib\site-packages\dotenv\
71+
from C:\Python312\Lib\site-packages\~otenv
72+
Moving to c:\python312\lib\site-packages\python_dotenv-1.0.1.dist-info\
73+
from C:\Python312\Lib\site-packages\~ython_dotenv-1.0.1.dist-info

CHANGELOG.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
5959
- Pylint cleanup for token_airdrop_transaction_cancel.py (#1081) [@tiya-15](https://github.com/tiya-15)
6060
- Move `account_allowance_delete_transaction_hbar.py` from `examples/` to `examples/account/` for better organization (#1003)
6161
- Added `add_hbar_transfer`, `add_approved_hbar_transfer`, and internal `_add_hbar_transfer` to accept `Hbar` objects in addition to raw tinybar integers, with internal normalization to tinybars. Added tests validating the new behavior.
62-
63-
### Changed
64-
6562
- Improved consistency of transaction examples (#1120)
6663
- Refactored `account_create_transaction_with_fallback_alias.py` by splitting the monolithic `create_account_with_fallback_alias` function into modular functions: `generate_fallback_key`, `fetch_account_info`, and `print_account_summary`. The existing `setup_client()` function was reused for improved readability and structure (#1018)
6764
- Allow `PublicKey` for batch_key in `Transaction`, enabling both `PrivateKey` and `PublicKey` for batched transactions
@@ -80,22 +77,17 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
8077
- Update team notification script and workflow for P0 issues 'p0_issues_notify_team.js'
8178
- Rename test files across the repository to ensure they consistently end with \_test.py (#1055)
8279
- Cleaned up `token_airdrop_claim_signature_required` example for pylint compliance (no functional changes). (#1080)
83-
<<<<<<< HEAD
8480
- Rename the file 'test_token_fee_schedule_update_transaction_e2e.py' to make it ends with \_test.py as all other test files.(#1117)
8581
- Format token examples with Black for consistent code style and improved readability (#1119)
8682
- Transformed `examples/tokens/custom_fee_fixed.py` to be an end-to-end example, that interacts with the Hedera network, rather than a static object demo.
87-
- Format token examples with Black for consistent code style and improved readability (#1119)
8883
- Replaced `ResponseCode.get_name(receipt.status)` with the `ResponseCode(receipt.status).name` across examples and integration tests for consistency. (#1136)
8984
- Moved helpful references to Additional Context section and added clickable links.
9085
- Transformed `examples\tokens\custom_royalty_fee.py` to be an end-to-end example, that interacts with the Hedera network, rather than a static object demo.
9186

92-
=======
93-
94-
- Rename the file 'test_token_fee_schedule_update_transaction_e2e.py' to make it ends with \_test.py as all other test files.(#1117)
95-
> > > > > > > 70d7eae (feat: hbar support)
96-
9787
### Fixed
9888

89+
- Reverted validation logic in `AbstractTokenTransferTransaction` to correctly handle zero amounts with `ValueError` and message "Amount must be a non-zero integer".
90+
9991
- Fix token association verification in `token_airdrop_transaction.py` to correctly check if tokens are associated by using `token_id in token_balances` instead of incorrectly displaying zero balances which was misleading (#[815])
10092
- Fixed inactivity bot workflow not checking out repository before running (#964)
10193
- Fixed the topic_message_query integarion test

src/hiero_sdk_python/tokens/abstract_token_transfer_transaction.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,8 @@ def _add_token_transfer(
148148
raise TypeError("token_id must be a TokenId instance.")
149149
if not isinstance(account_id, AccountId):
150150
raise TypeError("account_id must be an AccountId instance.")
151-
if not isinstance(amount, int):
152-
raise TypeError("Amount must be an integer.")
153-
if amount == 0:
154-
raise ValueError("Amount must be a non-zero value.")
151+
if not isinstance(amount, int) or amount == 0:
152+
raise ValueError("Amount must be a non-zero integer")
155153
if expected_decimals is not None and not isinstance(expected_decimals, int):
156154
raise TypeError("expected_decimals must be an integer.")
157155
if not isinstance(is_approved, bool):

src/hiero_sdk_python/transaction/transfer_transaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def _add_hbar_transfer(
8888
raise TypeError("amount must be an integer or Hbar object.")
8989

9090
if amount == 0:
91-
raise ValueError("Amount must be a non-zero value.")
91+
raise ValueError("Amount must be a non-zero integer")
9292

9393
if not isinstance(is_approved, bool):
9494
raise TypeError("is_approved must be a boolean.")

tests/unit/transfer_transaction_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,11 @@ def test_zero_amount_validation(mock_account_ids):
284284
transfer_tx = TransferTransaction()
285285

286286
# Test zero HBAR amount should raise ValueError
287-
with pytest.raises(ValueError, match="Amount must be a non-zero value"):
287+
with pytest.raises(ValueError, match="Amount must be a non-zero integer"):
288288
transfer_tx.add_hbar_transfer(account_id_1, 0)
289289

290290
# Test zero token amount should raise ValueError
291-
with pytest.raises(ValueError, match="Amount must be a non-zero value"):
291+
with pytest.raises(ValueError, match="Amount must be a non-zero integer"):
292292
transfer_tx.add_token_transfer(token_id_1, account_id_1, 0)
293293

294294

0 commit comments

Comments
 (0)