Conversation
Signed-off-by: mukundkumarjha <mukundiiitg@gmail.com>
Signed-off-by: mukundkumarjha <mukundiiitg@gmail.com>
Signed-off-by: mukundkumarjha <mukundiiitg@gmail.com>
Signed-off-by: mukundkumarjha <mukundiiitg@gmail.com>
Signed-off-by: Mukund Jha <mukundiiitg@gmail.com>
Signed-off-by: mukundkumarjha <mukundiiitg@gmail.com>
Signed-off-by: mukundkumarjha <mukundiiitg@gmail.com>
Signed-off-by: Mukund Jha <mukundiiitg@gmail.com>
Signed-off-by: Mukund Jha <mukundiiitg@gmail.com>
WalkthroughThis PR refactors the AccountInfo class to consolidate three separate staking-related fields (staked_account_id, staked_node_id, decline_staking_reward) into a single composite StakingInfo field. Proto conversion, serialization, and string representations are updated to reflect this structural change. Tests are updated accordingly. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 4❌ Failed checks (4 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/hiero_sdk_python/account/account_info.py (1)
41-43:⚠️ Potential issue | 🟡 MinorDocstring is outdated - references removed fields.
The docstring still documents
staked_account_id,staked_node_id, anddecline_staking_rewardas direct attributes ofAccountInfo, but these have been replaced by the compositestaking_infofield.Proposed fix
account_memo (Optional[str]): The memo associated with this account. owned_nfts (Optional[int]): The number of NFTs owned by this account. - staked_account_id (Optional[AccountId]): The account to which this account is staked. - staked_node_id (Optional[int]): The node to which this account is staked. - decline_staking_reward (bool): Whether this account declines receiving staking rewards. + max_automatic_token_associations (Optional[int]): Maximum automatic token associations. + staking_info (Optional[StakingInfo]): Staking-related information for this account. """
| - Replaced the docstring in `entity_id_helper.py` with one that is correct. (#1623) | ||
|
|
||
| ### Changed | ||
| - Refactored AccountInfo class to use the staking_info(#1366) |
There was a problem hiding this comment.
Minor formatting inconsistency: missing space before issue reference.
Other entries in this file follow the pattern description (#issue) with a space before the parenthesis. This entry has staking_info(hiero-ledger#1366) without a space.
Suggested fix
-- Refactored AccountInfo class to use the staking_info(`#1366`)
+- Refactored AccountInfo class to use the staking_info (`#1366`)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - Refactored AccountInfo class to use the staking_info(#1366) | |
| - Refactored AccountInfo class to use the staking_info (`#1366`) |
| f"account_memo={self.account_memo!r}, " | ||
| f"staked_node_id={self.staked_node_id!r}, " | ||
| f"staked_account_id={self.staked_account_id!r}" | ||
| f"staked_info={self.staking_info!r}, " |
There was a problem hiding this comment.
Inconsistent field name in __repr__: uses staked_info instead of staking_info.
The field is named staking_info but the __repr__ output uses staked_info=. This inconsistency could cause confusion during debugging.
Proposed fix
- f"staked_info={self.staking_info!r}, "
+ f"staking_info={self.staking_info!r}, "📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| f"staked_info={self.staking_info!r}, " | |
| f"staking_info={self.staking_info!r}, " |
| assert account_info.account_memo == "Test account memo" | ||
| assert account_info.owned_nfts == 5 | ||
| assert account_info.max_automatic_token_associations == 10 | ||
| assert account_info.staking_info == None |
There was a problem hiding this comment.
Use is None instead of == None for None comparisons.
Per PEP 8 and the static analysis hint, comparisons to None should use is None.
Proposed fix
- assert account_info.staking_info == None
+ assert account_info.staking_info is None📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| assert account_info.staking_info == None | |
| assert account_info.staking_info is None |
🧰 Tools
🪛 Ruff (0.14.14)
[error] 153-153: Comparison to None should be cond is None
Replace with cond is None
(E711)
|
[commit-verification-bot]
View your commit verification status: Commits Tab. To achieve verified status, please read: Remember, you require a GPG key and each commit must be signed with: Thank you for contributing! From the Hiero Python SDK Team |
Description:
Related issue(s):
Fixes #1
Notes for reviewer:
Checklist