Skip to content

feat: Add CancelAirdrop to TCK - #2555

Merged
aceppaluni merged 4 commits into
hiero-ledger:mainfrom
aceppaluni:cancelAirdrop
Aug 25, 2026
Merged

feat: Add CancelAirdrop to TCK#2555
aceppaluni merged 4 commits into
hiero-ledger:mainfrom
aceppaluni:cancelAirdrop

Conversation

@aceppaluni

Copy link
Copy Markdown
Contributor

Description:

Adds the cancelAirdrop JSON-RPC TCK method by mirroring the existing claimToken handler pattern.

The implementation is contained entirely within the token TCK modules. No changes are required to the generic dispatch, registration, protocol, or server machinery.

Changes

  • Added CancelAirdropParams in tck/param/token.py

    • Extends BaseTransactionParams
    • Supports senderAccountId, receiverAccountId, tokenId, and optional serialNumbers
    • Validates serialNumbers as a list of strings
    • Reuses the existing session/common transaction parameter parsing helpers
  • Added CancelAirdropResponse in tck/response/token.py

    • Trivial StatusOnlyResponse subclass matching ClaimTokenResponse
  • Added cancelAirdrop support in tck/handlers/token.py

    • Builds TokenCancelAirdropTransaction
    • Supports both fungible and NFT pending airdrops
    • Creates one PendingAirdropId per NFT serial when serialNumbers is provided
    • Uses the cancel-specific add_pending_airdrop(...) API
    • Applies the same gRPC deadline and transaction execution/receipt handling as claimToken
    • Returns the receipt status as a CancelAirdropResponse
  • Optionally adds unit coverage for fungible and NFT pending airdrop construction and verifies the cancelAirdrop RPC method registration.

Scope

No changes are made to:

  • tck/handlers/__init__.py
  • tck/handlers/registry.py
  • tck/protocol.py
  • tck/server.py

Related issue(s):

Fixes #2423

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: aceppaluni <aceppaluni@gmail.com>
@aceppaluni
aceppaluni requested a review from a team as a code owner August 17, 2026 18:51
@aceppaluni
aceppaluni requested a review from danielmarv August 17, 2026 18:51
@github-actions github-actions Bot added approved Issue has been approved by team member skill: beginner Achievable by a fairly new comer that has already completed a couple of good first issues labels Aug 17, 2026
@aceppaluni aceppaluni added reviewer: maintainer PR needs a review from the maintainer team reviewer: committer request review help from a committer and removed approved Issue has been approved by team member labels Aug 17, 2026
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The TCK adds the cancelAirdrop JSON-RPC operation. It parses request parameters, builds fungible or NFT pending airdrop identifiers, executes TokenCancelAirdropTransaction, validates the receipt, and returns the status. The SDK now accepts any pending-airdrop count during serialization.

Changes

Cancel airdrop

Layer / File(s) Summary
Cancel airdrop request and response contracts
tck/param/token.py, tck/response/token.py
CancelAirdropParams parses pending airdrops, session, and transaction parameters. PendingAirdropParams validates serial numbers. CancelAirdropResponse provides the status-only response model.
Cancel airdrop transaction handler
tck/handlers/token.py
The handler converts identifiers, builds NFT or fungible pending airdrop identifiers, applies common transaction parameters, executes the transaction, validates the receipt status, and returns CancelAirdropResponse.
Pending airdrop serialization validation
src/hiero_sdk_python/tokens/token_airdrop_transaction_cancel.py, tests/unit/token_airdrop_transaction_cancel_test.py
The transaction no longer enforces a 1–10 pending-airdrop count. Unit tests verify serialization with zero and eleven pending airdrops.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🟡 Moderate · up to 04ae9

The PR adds cancelAirdrop support, but malformed pendingAirdrops values can bypass controlled validation and raise AttributeError instead of producing a controlled parameter error. The current head should not merge until this bounded request-handling risk is corrected or explicitly accepted; the test naming and assertion-message follow-ups are minor.

Sequence Diagram(s)

sequenceDiagram
  participant TCKClient
  participant cancelAirdrop
  participant TokenCancelAirdropTransaction
  participant HederaNetwork
  TCKClient->>cancelAirdrop: CancelAirdropParams
  cancelAirdrop->>TokenCancelAirdropTransaction: Add pending airdrop IDs
  cancelAirdrop->>HederaNetwork: Execute transaction
  HederaNetwork-->>cancelAirdrop: Return receipt status
  cancelAirdrop-->>TCKClient: CancelAirdropResponse
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: adding CancelAirdrop support to the TCK.
Description check ✅ Passed The description directly explains the cancelAirdrop implementation, supported transaction types, tests, and scope.
Linked Issues check ✅ Passed The changes implement the missing cancelAirdrop method and construct PendingAirdropId values as required by issue [#2423].
Out of Scope Changes check ✅ Passed The changes remain focused on cancelAirdrop TCK support, related transaction construction, and unit test coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 342c74c4-058b-4e34-ac43-d548be0f2a00

📥 Commits

Reviewing files that changed from the base of the PR and between e3a66d1 and 297ad13.

📒 Files selected for processing (3)
  • tck/handlers/token.py
  • tck/param/token.py
  • tck/response/token.py

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.

Comment thread tck/handlers/token.py
@github-actions

Copy link
Copy Markdown
Requesting triage review from: @hiero-ledger/hiero-sdk-python-triage

@github-actions github-actions Bot added open to community review PR is open for community review and feedback queue:junior-committer PR awaiting initial quality review labels Aug 17, 2026
Comment thread tck/param/token.py
@danielmarv danielmarv added the status: update branch developer needs to click update branch label Aug 18, 2026
Signed-off-by: aceppaluni <aceppaluni@gmail.com>
@github-actions github-actions Bot added the approved Issue has been approved by team member label Aug 19, 2026
@aceppaluni
aceppaluni requested a review from manishdait August 19, 2026 17:50

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 02abfdb8-319b-4ff6-9618-d279b877eea7

📥 Commits

Reviewing files that changed from the base of the PR and between 297ad13 and 28e6c1f.

📒 Files selected for processing (2)
  • tck/handlers/token.py
  • tck/param/token.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread tck/param/token.py
Comment thread tck/handlers/token.py Outdated
Comment thread tck/handlers/token.py Outdated
Comment thread tck/handlers/token.py
Signed-off-by: aceppaluni <aceppaluni@gmail.com>
@aceppaluni
aceppaluni requested a review from a team as a code owner August 20, 2026 18:32
@aceppaluni
aceppaluni requested a review from Mounil2005 August 20, 2026 18:32
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2555      +/-   ##
==========================================
- Coverage   95.44%   95.44%   -0.01%     
==========================================
  Files         165      165              
  Lines       10565    10563       -2     
==========================================
- Hits        10084    10082       -2     
  Misses        481      481              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3d4e1774-2c58-42bd-a634-9e81681fc5a5

📥 Commits

Reviewing files that changed from the base of the PR and between 28e6c1f and 04ae9b6.

📒 Files selected for processing (3)
  • src/hiero_sdk_python/tokens/token_airdrop_transaction_cancel.py
  • tck/handlers/token.py
  • tests/unit/token_airdrop_transaction_cancel_test.py
💤 Files with no reviewable changes (2)
  • src/hiero_sdk_python/tokens/token_airdrop_transaction_cancel.py
  • tck/handlers/token.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread tests/unit/token_airdrop_transaction_cancel_test.py
Comment thread tests/unit/token_airdrop_transaction_cancel_test.py
@aceppaluni aceppaluni removed the approved Issue has been approved by team member label Aug 20, 2026

@manishdait manishdait left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@github-actions github-actions Bot added queue:committers PR awaiting committer technical review and removed queue:junior-committer PR awaiting initial quality review labels Aug 21, 2026
Comment thread src/hiero_sdk_python/tokens/token_airdrop_transaction_cancel.py
@github-actions github-actions Bot added status: ready-to-merge PR has 1+ maintainer and 2+ total approvals, ready to merge and removed queue:committers PR awaiting committer technical review labels Aug 25, 2026
@manishdait

Copy link
Copy Markdown
Contributor

@aceppaluni please update the branch

@github-actions github-actions Bot added the approved Issue has been approved by team member label Aug 25, 2026
@aceppaluni
aceppaluni merged commit 4c3df39 into hiero-ledger:main Aug 25, 2026
29 checks passed
@github-actions

Copy link
Copy Markdown

👋 Hi @aceppaluni! Great work completing a Beginner issue! 🎉

Thanks for your contribution! 🚀

Here are some issues you might want to explore next:

🌟 Stay connected:

Happy coding! 🚀
— Hiero Python SDK Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Issue has been approved by team member open to community review PR is open for community review and feedback reviewer: committer request review help from a committer reviewer: maintainer PR needs a review from the maintainer team skill: beginner Achievable by a fairly new comer that has already completed a couple of good first issues status: ready-to-merge PR has 1+ maintainer and 2+ total approvals, ready to merge status: update branch developer needs to click update branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(tck): implement cancelAirdrop JSON-RPC method

5 participants