Skip to content

Conversation

@Raja-89
Copy link
Contributor

@Raja-89 Raja-89 commented Nov 1, 2025

Description

This PR addresses issue #584 by introducing a new integration test file, tests/integration/test_custom_fee.py, to verify the network-level functionality of the abstract base class CustomFee.

Since CustomFee is abstract, these tests primarily ensure that its underlying logic (collector ID management, serialization, and validation) works correctly when instantiated via its concrete subclasses and executed against the Hedera network.

Key Changes & Verification Points

  • Integration Test Coverage: Added the file test_custom_fee.py to cover the following critical areas:
    • Network Execution: Verifies successful creation of a token with a fixed fee, ensuring the base class's fee_collector_account_id and all_collectors_are_exempt fields are correctly transmitted and retrieved via TokenInfoQuery.
    • Protobuf Dispatch (_from_proto): Confirms that the base class correctly handles deserialization by successfully reconstructing Fixed, Fractional, and Royalty fee objects (and the nested fallback fee) from the network response.
    • Collector Validation: Implements a test to confirm the network correctly rejects a TokenCreateTransaction that uses a non-existent fee_collector_account_id, verifying the SDK's internal validation mechanism (related to _validate_checksums).
  • Test Utility Enhancement: Modified tests/integration/utils_for_test.py (create_fungible_token and create_nft_token) to accept an optional custom_fees list, simplifying future token creation tests that involve fee structures.

Related Issue

Closes #584

@Raja-89
Copy link
Contributor Author

Raja-89 commented Nov 1, 2025

Hey @exploreriii ! Some tests are failing , can you please help me out?

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First thing to solve is your imports!
Your imports pull in files to use in your test, but if you are importing from non existent or wrong places, it will fail straight away

ImportError: cannot import name 'TransactionReceipt' from 'hiero_sdk_python.exceptions' (/home/runner/work/hiero-sdk-python/hiero-sdk-python/src/hiero_sdk_python/exceptions.py). Did you mean: 'TransactionRecord'?

Notice - error in the imports.
My recommendation is to use the search bar in VS code for other test files that are looking for TransactionReceipt and see where they imported it from.

Additionally yout test:
test_custom_fee.py
is not in the naming scheme we are using for other integration tests
Have you looked at the other integration test examples?

@Raja-89
Copy link
Contributor Author

Raja-89 commented Nov 1, 2025

Hi @exploreriii , I’ve fixed the imports and renamed the test to match the integration naming convention, but I’m still getting:
ImportError: cannot import name 'TransactionReceipt' from 'hiero_sdk_python.exceptions'

Seems like TransactionReceipt might’ve been removed or replaced (maybe with TransactionRecord?). Could you please confirm which one to use?

Thanks!

@exploreriii
Copy link
Contributor

When you call a transaction type e.g. CustomFractionalFee, please check inside CustomFractionalFee and see what it actually is designed to be.

For example, CustomFractionalFee class wants min_amount and max_amount but you are using minimum_amount and maximum_amount which do not exist in CustomFractionalFee class therefore will fail

My recommendation is to set up Pylance which will outline in red methods you are calling which do not exist in the sdk and have been hallucinated. Also, please review examples and other integration tests that call these methods to see what is actualyl valid - you can also know what is valid by studying the underlying classes
Screenshot 2025-11-01 at 21 16 25
Screenshot 2025-11-01 at 21 18 04

@exploreriii
Copy link
Contributor

TransactionReceipt is not there its here
from hiero_sdk_python.transaction.transaction_receipt import TransactionReceipt

you can find it by searching for class TransactionReceipt
or by searching import TransactionReceipt

but i can't find where you are using it to say more

…eipt, resolving collection errors

Signed-off-by: Raja Rathour <[email protected]>
@Raja-89
Copy link
Contributor Author

Raja-89 commented Nov 2, 2025

Hi @exploreriii , I think it is ready for review, please check it.

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set up pylance please, your script won't run, you are using methods that don't exist

Image Image Image Image Image Image

@@ -1,11 +0,0 @@
OPERATOR_ID=<YOUR_OPERATOR_ID> #your account id, can be retrived from https://portal.hedera.com/dashboard
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't delete env.example please

@exploreriii
Copy link
Contributor

issues persist, thanks

@nadineloepfe
Copy link
Contributor

hi @Raja-89 , are you still working on this issue?

@Raja-89
Copy link
Contributor Author

Raja-89 commented Nov 6, 2025

hi @Raja-89 , are you still working on this issue?

No, not now you can surely take upon this issue.

@exploreriii
Copy link
Contributor

Thank you for trying @Raja-89 and passing this issue on
Do please join our office hours and community calls, we are happy to help

@exploreriii exploreriii closed this Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create integration tests for src/hiero_sdk_python/tokens/custom_fee.py

3 participants