Skip to content

feat: Add UpdateToken #2474

Merged
aceppaluni merged 6 commits into
hiero-ledger:mainfrom
aceppaluni:updatetoken
Jul 23, 2026
Merged

feat: Add UpdateToken #2474
aceppaluni merged 6 commits into
hiero-ledger:mainfrom
aceppaluni:updatetoken

Conversation

@aceppaluni

Copy link
Copy Markdown
Contributor

Description:

Implements the updateToken JSON-RPC endpoint in the TCK module by adding the required parameter, response, and handler layers following the existing token transaction conventions.

The new endpoint integrates through the existing @rpc_method registration flow and does not require any server, protocol, or handler registration changes.

Changes

Parameter layer

  • Added UpdateTokenParams in tck/param/token.py.

  • Added support for all TokenUpdateTransaction fields exposed by the TCK surface:

    • tokenId
    • token metadata fields (name, symbol, memo, metadata)
    • account fields (treasuryAccountId, autoRenewAccountId)
    • key fields (adminKey, kycKey, freezeKey, wipeKey, supplyKey, feeScheduleKey, pauseKey, metadataKey)
    • lifecycle fields (expirationTime, autoRenewPeriod)
  • Kept key, expiration, and auto-renew values as raw strings in params, matching existing createToken conventions and deferring conversion to the handler layer.

  • Intentionally omitted keyVerificationMode to align with the resolved TCK parameter surface.

Response layer

  • Added UpdateTokenResponse as a StatusOnlyResponse.
  • Matches existing status-only token transaction responses such as DeleteTokenResponse, FreezeTokenResponse, and PauseTokenResponse.

Handler layer

  • Added TokenUpdateTransaction support.

  • Added _build_update_token_transaction() to construct update transactions with:

    • default gRPC timeout configuration
    • conditional setter application only for provided fields
    • existing TCK conversion conventions for IDs, keys, timestamps, and durations
  • Added the updateToken RPC handler:

    • retrieves the client from the session
    • applies common transaction parameters
    • executes without waiting for receipt
    • validates the receipt status
    • returns the mapped ResponseCode

Related issue(s):

Fixes #2397

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 July 22, 2026 19:01
@aceppaluni
aceppaluni requested a review from MonaaEid July 22, 2026 19:01
@github-actions github-actions Bot added approved Issue has been approved by team member scope: TCK involves engineering for the implementation of TCK method and module skill: advanced requires knowledge of multiple areas in the codebase without defined steps to implement or examples labels Jul 22, 2026
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds the updateToken RPC endpoint to the TCK module, including request parsing, token update transaction construction, transaction execution, receipt validation, and status response modeling. It also adjusts token transaction proto handling and key validation.

Changes

Token Update RPC

Layer / File(s) Summary
Update token request and response contracts
tck/param/token.py, tck/response/token.py
Adds UpdateTokenParams with token fields and JSON-RPC parsing, plus the UpdateTokenResponse status payload.
Update token transaction execution
tck/handlers/token.py
Builds and executes TokenUpdateTransaction, applies common transaction parameters, validates the receipt, and returns the response status.
Transaction and key validation updates
src/hiero_sdk_python/tokens/token_update_transaction.py, tests/unit/token_update_transaction_test.py, tck/handlers/key.py
Allows proto construction without a token ID, updates the related unit test, and changes threshold/list key validation for None values.

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

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant update_token
  participant TokenUpdateTransaction
  participant HederaNetwork
  Client->>update_token: UpdateTokenParams
  update_token->>TokenUpdateTransaction: Build update fields
  update_token->>TokenUpdateTransaction: Execute transaction
  TokenUpdateTransaction->>HederaNetwork: Submit token update
  HederaNetwork-->>update_token: Receipt status
  update_token-->>Client: UpdateTokenResponse
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly refers to the new UpdateToken feature and matches the main change.
Description check ✅ Passed The description accurately summarizes the new updateToken endpoint and supporting changes.
Linked Issues check ✅ Passed The PR adds the updateToken handler plus the required params and response types requested by #2397.
Out of Scope Changes check ✅ Passed The modified files all support the updateToken work or its tests, with no clearly unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
📋 Issue Planner

Built with CodeRabbit's Coding Plans for faster development and fewer bugs.

View plan used: #2397

✨ 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

Run ID: 71fedbdb-d60d-489d-b015-8e667cf0ac3e

📥 Commits

Reviewing files that changed from the base of the PR and between 3b976da and 42d17d4.

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

Comment thread tck/handlers/token.py Outdated
@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 Jul 22, 2026
@aceppaluni
aceppaluni requested a review from manishdait July 22, 2026 19:08
@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 Jul 22, 2026
Signed-off-by: aceppaluni <aceppaluni@gmail.com>
@github-actions github-actions Bot added the approved Issue has been approved by team member label Jul 22, 2026
exploreriii
exploreriii previously approved these changes Jul 22, 2026
@github-actions github-actions Bot added queue:committers PR awaiting committer technical review and removed queue:junior-committer PR awaiting initial quality review labels Jul 22, 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.

@aceppaluni, small change request, rest looks good

Comment thread tck/handlers/token.py
Comment thread tck/handlers/token.py
Signed-off-by: aceppaluni <aceppaluni@gmail.com>
@github-actions

Copy link
Copy Markdown

Hi, this is WorkflowBot.
Your pull request cannot be merged as it is not passing all our workflow checks.
Please click on each check to review the logs and resolve issues so all checks pass.
To help you:

Signed-off-by: aceppaluni <aceppaluni@gmail.com>
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2474      +/-   ##
==========================================
- Coverage   95.27%   95.27%   -0.01%     
==========================================
  Files         164      164              
  Lines       10485    10483       -2     
==========================================
- Hits         9990     9988       -2     
  Misses        495      495              
🚀 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: 783b78c3-a3b8-4917-8b0e-df896113678f

📥 Commits

Reviewing files that changed from the base of the PR and between 847235b and e6f2f88.

📒 Files selected for processing (3)
  • src/hiero_sdk_python/tokens/token_update_transaction.py
  • tck/handlers/key.py
  • tests/unit/token_update_transaction_test.py

Comment thread src/hiero_sdk_python/tokens/token_update_transaction.py
Comment thread tck/handlers/key.py
@github-actions github-actions Bot added queue:junior-committer PR awaiting initial quality review and removed queue:committers PR awaiting committer technical review labels Jul 23, 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

@exploreriii

Copy link
Copy Markdown
Contributor

update plz @aceppaluni

@github-actions github-actions Bot added status: ready-to-merge PR has 1+ maintainer and 2+ total approvals, ready to merge and removed queue:junior-committer PR awaiting initial quality review labels Jul 23, 2026
@aceppaluni
aceppaluni merged commit 2679cb5 into hiero-ledger:main Jul 23, 2026
28 checks passed
@github-actions

Copy link
Copy Markdown

👋 Hi @aceppaluni! Great work completing a Advanced 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 scope: TCK involves engineering for the implementation of TCK method and module skill: advanced requires knowledge of multiple areas in the codebase without defined steps to implement or examples status: ready-to-merge PR has 1+ maintainer and 2+ total approvals, ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add updateToken endpoint to tck module

4 participants