Skip to content

chore: update imports to include Key from crypto module#2196

Merged
manishdait merged 4 commits into
hiero-ledger:mainfrom
MonaaEid:chore/crypto-key-import-update
Apr 26, 2026
Merged

chore: update imports to include Key from crypto module#2196
manishdait merged 4 commits into
hiero-ledger:mainfrom
MonaaEid:chore/crypto-key-import-update

Conversation

@MonaaEid

Copy link
Copy Markdown
Contributor

Description:
This PR refactors imports across several modules to improve code organization and clarity. The main change is moving the import of the Key class from hiero_sdk_python.utils.key_utils to its own dedicated module, hiero_sdk_python.crypto.key, while keeping the key_to_proto import unchanged. This helps separate cryptographic functionality from utility functions and makes the codebase more maintainable.

Related issue(s):
Fixes #2195

Checklist

  • Documented
  • Tested

Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
@github-actions github-actions Bot added skill: beginner Achievable by a fairly new comer that has already completed a couple of good first issues lang: python Uses Python programming language labels Apr 25, 2026
@codacy-production

codacy-production Bot commented Apr 25, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Apr 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2196   +/-   ##
=======================================
  Coverage   93.70%   93.70%           
=======================================
  Files         145      145           
  Lines        9470     9474    +4     
=======================================
+ Hits         8874     8878    +4     
  Misses        596      596           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@manishdait

manishdait commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

@MonaaEid, This seems fine to me. can you double check if there is any other file using the Key type-alias

@MonaaEid

Copy link
Copy Markdown
Contributor Author

@MonaaEid, This seems fine to me. can you double check if there is any other file using the Key type-alias

I’ve checked, and no other file is using the Key type-alias

@MonaaEid
MonaaEid marked this pull request as ready for review April 25, 2026 14:53
@MonaaEid
MonaaEid requested review from a team as code owners April 25, 2026 14:53

Copilot AI 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.

Pull request overview

Standardizes internal SDK imports to reference the canonical Key base class from hiero_sdk_python.crypto.key (instead of importing it via hiero_sdk_python.utils.key_utils), aligning with the crypto module’s intended structure and resolving #2195.

Changes:

  • Update Transaction to import Key from hiero_sdk_python.crypto.key while continuing to use key_to_proto from utils.key_utils.
  • Update TokenCreateTransaction and TokenUpdateTransaction to import Key from the crypto module.
  • Update TopicCreateTransaction to import Key from the crypto module.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/hiero_sdk_python/transaction/transaction.py Switches Key import to hiero_sdk_python.crypto.key while keeping key_to_proto usage unchanged.
src/hiero_sdk_python/tokens/token_update_transaction.py Switches Key import to the crypto module for key-typed fields and parameters.
src/hiero_sdk_python/tokens/token_create_transaction.py Switches Key import to the crypto module for key-typed fields and parameters.
src/hiero_sdk_python/consensus/topic_create_transaction.py Switches Key import to the crypto module for key-typed fields and parameters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai

coderabbitai Bot commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ea9e36c5-a0f5-4afa-8f6b-1996193bb9af

📥 Commits

Reviewing files that changed from the base of the PR and between c5baa77 and 230e54a.

📒 Files selected for processing (4)
  • src/hiero_sdk_python/consensus/topic_create_transaction.py
  • src/hiero_sdk_python/tokens/token_create_transaction.py
  • src/hiero_sdk_python/tokens/token_update_transaction.py
  • src/hiero_sdk_python/transaction/transaction.py

Walkthrough

This change updates the import source for the Key type across four transaction-related modules. Key is now imported from hiero_sdk_python.crypto.key instead of hiero_sdk_python.utils.key_utils, while key_to_proto remains imported from its original location. No functional logic is altered.

Changes

Cohort / File(s) Summary
Key import standardization
src/hiero_sdk_python/consensus/topic_create_transaction.py, src/hiero_sdk_python/tokens/token_create_transaction.py, src/hiero_sdk_python/tokens/token_update_transaction.py, src/hiero_sdk_python/transaction/transaction.py
Updated Key type import source from hiero_sdk_python.utils.key_utils to hiero_sdk_python.crypto.key. The key_to_proto function import remains unchanged. No modifications to transaction-building logic or method signatures.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating imports to bring Key from the crypto module rather than the utility module.
Description check ✅ Passed The description clearly explains the refactoring of imports, the migration of Key from key_utils to crypto.key, and relates to the linked issue #2195.
Linked Issues check ✅ Passed All four affected files (topic_create_transaction.py, token_create_transaction.py, token_update_transaction.py, transaction.py) have been updated to import Key from hiero_sdk_python.crypto.key instead of hiero_sdk_python.utils.key_utils, meeting the core requirement of issue #2195.
Out of Scope Changes check ✅ Passed All changes are narrowly focused on updating Key imports across the four specified files. No unrelated modifications or extra files have been changed beyond the issue scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📋 Issue Planner

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

View plan used: #2195

✨ 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 and usage tips.

@MonaaEid
MonaaEid requested a review from manishdait April 25, 2026 14:59
@MonaaEid MonaaEid added step: 1st 1st stage of the review approval process and removed step: 1st 1st stage of the review approval process labels Apr 25, 2026
@exploreriii exploreriii added step: 1st 1st stage of the review approval process reviewer: write requires a review with write permissions labels Apr 25, 2026
@MonaaEid MonaaEid added reviewer: maintainer PR needs a review from the maintainer team step: 2nd second stage of the review approval process and removed step: 1st 1st stage of the review approval process reviewer: write requires a review with write permissions labels Apr 26, 2026
@manishdait
manishdait merged commit ee8a320 into hiero-ledger:main Apr 26, 2026
30 of 33 checks passed
@MonaaEid MonaaEid added this to the v0.2.6 milestone Apr 29, 2026
@MonaaEid
MonaaEid deleted the chore/crypto-key-import-update branch April 29, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lang: python Uses Python programming language 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 step: 2nd second stage of the review approval process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update imports to include Key from crypto module

5 participants