-
Notifications
You must be signed in to change notification settings - Fork 106
refactor(examples): modularize account_create_transaction_create_with_alias #1030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(examples): modularize account_create_transaction_create_with_alias #1030
Conversation
…_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>
There was a problem hiding this 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.
examples/account/account_create_transaction_create_with_alias.py
Outdated
Show resolved
Hide resolved
examples/account/account_create_transaction_create_with_alias.py
Outdated
Show resolved
Hide resolved
examples/account/account_create_transaction_create_with_alias.py
Outdated
Show resolved
Hide resolved
- 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>
|
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'. |
|
Hi @adityashirsatrao007 great going thank you! |
Description
This PR refactors the \�ccount_create_transaction_create_with_alias.py\ example to improve readability and maintainability.
Changes
Related Issue
Closes #1016
Checklist
Signed-off-by: Aditya Shirsatrao adityashirsatrao@gmail.com