Skip to content

Conversation

@adityashirsatrao007
Copy link
Contributor

Description

This PR refactors the \�ccount_create_transaction_create_with_alias.py\ example to improve readability and maintainability.

Changes

  • Split the monolithic \create_account_with_separate_ecdsa_alias()\ function into focused, modular functions:
    • \generate_main_and_alias_keys()\ - Generates both the main account key and the alias ECDSA key
    • \create_account_with_ecdsa_alias()\ - Creates the account with the alias configuration
    • \ etch_account_info()\ - Fetches account information from the network
    • \print_account_summary()\ - Displays the account details in a formatted way
  • Updated \main()\ to orchestrate calls to these modular functions
  • Added CHANGELOG entry

Related Issue

Closes #1016

Checklist

  • Code follows the project's coding standards
  • Example is functional and demonstrates the intended use case
  • CHANGELOG updated

Signed-off-by: Aditya Shirsatrao adityashirsatrao@gmail.com

…_alias (hiero-ledger#1016)

Split monolithic create_account_with_separate_ecdsa_alias() into separate functions:
- generate_main_and_alias_keys(): Generate main and ECDSA alias keys
- create_account_with_ecdsa_alias(): Create account with the alias
- fetch_account_info(): Query account information
- print_account_summary(): Display account details

These functions are now called from main() for better readability and maintainability.

Signed-off-by: Aditya Shirsatrao <adityashirsatrao007@gmail.com>
Signed-off-by: adityashirsatrao007 <adityashirsatrao007@gmail.com>
Copilot AI review requested due to automatic review settings December 10, 2025 17:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the account_create_transaction_create_with_alias.py example to improve code organization and maintainability by splitting a monolithic function into focused, single-responsibility functions.

Key Changes:

  • Decomposed the single create_account_with_separate_ecdsa_alias() function into four modular functions with clear responsibilities
  • Moved exception handling from individual functions to the main orchestrator function
  • Added comprehensive docstrings with type hints for better code documentation

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
examples/account/account_create_transaction_create_with_alias.py Refactored monolithic function into modular components: key generation, account creation, info fetching, and summary display
CHANGELOG.md Added entry documenting the refactoring changes

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

adityashirsatrao007 and others added 2 commits December 10, 2025 23:06
- Add AccountInfo import
- Add return type annotation to fetch_account_info
- Add type annotation to print_account_summary parameter
- Add newline to STEP 3 for consistent formatting

Signed-off-by: adityashirsatrao007 <adityashirsatrao007@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Aditya <adityashirsatrao007@gmail.com>
@exploreriii exploreriii marked this pull request as draft December 10, 2025 22:48
@adityashirsatrao007
Copy link
Contributor Author

I have refactored the example to modularize the code and added try-except blocks as requested. Renamed the key generation function to 'generate_main_and_alias_keys'.

@adityashirsatrao007 adityashirsatrao007 marked this pull request as ready for review December 11, 2025 04:08
@exploreriii
Copy link
Contributor

Hi @adityashirsatrao007 great going thank you!

@exploreriii exploreriii merged commit cfc86ba into hiero-ledger:main Dec 11, 2025
14 checks passed
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.

[Good First Issue]: Refactor examples/account/account_create_transaction_create_with_alias.py

3 participants