Skip to content

chore: Refactored AccountInfo class to use the staking_info#1595

Closed
mukundkumarjha wants to merge 4 commits intohiero-ledger:mainfrom
mukundkumarjha:accountinfo
Closed

chore: Refactored AccountInfo class to use the staking_info#1595
mukundkumarjha wants to merge 4 commits intohiero-ledger:mainfrom
mukundkumarjha:accountinfo

Conversation

@mukundkumarjha
Copy link
Contributor

Description:

Related issue(s):

Fixes #1366

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 26, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

AccountInfo was refactored to replace flattened staking fields with a single staking_info: Optional[StakingInfo], add max_automatic_token_associations, update the StakingInfo import and proto (de)serialization, adjust string/debug representations, and update unit tests and CHANGELOG. No public API signatures were removed.

Changes

Cohort / File(s) Summary
AccountInfo Refactor
src/hiero_sdk_python/account/account_info.py
Replaced staked_account_id, staked_node_id, decline_staking_reward with staking_info: Optional[StakingInfo]; added max_automatic_token_associations; updated StakingInfo import path; changed _from_proto/_to_proto to marshal staking_info; updated __str__/__repr__.
AccountInfo Tests
tests/unit/account_info_test.py
Updated fixtures and assertions to include max_automatic_token_associations and staking_info; added proto round-trip checks for staking_info presence/absence; import/use StakingInfo in tests.
Topic/Formatting Tests
tests/unit/topic_info_test.py
Adjusted expected string/repr formatting for expiration_time (now expecting date-only in str output).
Changelog
CHANGELOG.md
Added Unreleased entry noting AccountInfo refactor to use staking_info.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Changes to topic_info_test.py appear unrelated to the AccountInfo refactoring objective; this file modifies expiration_time formatting which is outside the scope of issue #1366. Verify whether topic_info_test.py changes are intentional or should be separated into a different pull request. If intentional, document the rationale.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately summarizes the main change: refactoring AccountInfo class to use the staking_info field instead of flattened fields.
Description check ✅ Passed The pull request description provides context by referencing issue #1366 and indicating the refactoring nature of the changes, though it lacks detailed explanation of the specific changes made.
Linked Issues check ✅ Passed All requirements from issue #1366 are met: flattened fields removed, staking_info field added, from_proto/to_proto updated to use StakingInfo.from_proto/to_proto, str/repr updated, and tests updated.
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
src/hiero_sdk_python/account/account_info.py (5)

12-12: Wrong import: Using protobuf type instead of SDK class.

The import pulls StakingInfo from the protobuf definitions, but based on the PR objectives and the SDK's StakingInfo class at src/hiero_sdk_python/staking_info.py, you should import the SDK wrapper class which has the _from_proto() and _to_proto() methods.

🔧 Proposed fix
-from hiero_sdk_python.hapi.services.basic_types_pb2 import StakingInfo
+from hiero_sdk_python.staking_info import StakingInfo

81-110: Critical bug: staking_info is parsed but never stored.

The staking_info variable on lines 104-108 is assigned but never used (confirmed by Ruff F841). The parsed staking info is lost because it's not stored in account_info. Additionally, the SDK's StakingInfo class uses _from_proto (with underscore) per conventions.

🐛 Proposed fix

Include staking_info in the constructor call or assign it after:

         account_info: "AccountInfo" = cls(
             account_id=AccountId._from_proto(proto.accountID) if proto.accountID else None,
             contract_account_id=proto.contractAccountID,
             is_deleted=proto.deleted,
             proxy_received=Hbar.from_tinybars(proto.proxyReceived),
             key=PublicKey._from_proto(proto.key) if proto.key else None,
             balance=Hbar.from_tinybars(proto.balance),
             receiver_signature_required=proto.receiverSigRequired,
             expiration_time=(
                 Timestamp._from_protobuf(proto.expirationTime) if proto.expirationTime else None
             ),
             auto_renew_period=(
                 Duration._from_proto(proto.autoRenewPeriod) if proto.autoRenewPeriod else None
             ),
             token_relationships=[
                 TokenRelationship._from_proto(relationship)
                 for relationship in proto.tokenRelationships
             ],
             account_memo=proto.memo,
             owned_nfts=proto.ownedNfts,
             max_automatic_token_associations=proto.max_automatic_token_associations,
+            staking_info=(
+                StakingInfo._from_proto(proto.staking_info)
+                if proto.HasField("staking_info")
+                else None
+            ),
         )
 
-        staking_info=(
-           StakingInfo.from_proto(proto.staking_info)
-           if proto.HasField("staking_info")
-           else None
-         )
-
         return account_info

161-179: Incorrect __str__ implementation: Displaying full object instead of specific fields.

Lines 161-162 both display the entire staking_info object with different labels, and line 179 does the same for decline reward. The implementation should access specific fields from the StakingInfo object.

🔧 Proposed fix
         simple_fields = [
             (self.account_id, "Account ID"),
             (self.contract_account_id, "Contract Account ID"),
             (self.balance, "Balance"),
             (self.key, "Key"),
             (self.account_memo, "Memo"),
             (self.owned_nfts, "Owned NFTs"),
             (self.max_automatic_token_associations, "Max Automatic Token Associations"),
-            (self.staking_info, "Staked Account ID"),
-            (self.staking_info, "Staked Node ID"),
+            (self.staking_info.staked_account_id if self.staking_info else None, "Staked Account ID"),
+            (self.staking_info.staked_node_id if self.staking_info else None, "Staked Node ID"),
             (self.proxy_received, "Proxy Received"),
             (self.expiration_time, "Expiration Time"),
             (self.auto_renew_period, "Auto Renew Period"),
         ]
         ...
         if self.staking_info is not None:
-            lines.append(f"Decline Staking Reward: {self.staking_info}")
+            lines.append(f"Decline Staking Reward: {self.staking_info.decline_reward}")

186-199: Incorrect __repr__ implementation: Displaying full object instead of specific fields.

The __repr__ method labels fields as staked_node_id and staked_account_id but displays the entire staking_info object for both. It should either display the full staking_info object once, or access specific fields.

🔧 Proposed fix (Option 1: Display staking_info as single field)
     def __repr__(self) -> str:
         """Returns a string representation of the AccountInfo object for debugging."""
         return (
             f"AccountInfo("
             f"account_id={self.account_id!r}, "
             f"contract_account_id={self.contract_account_id!r}, "
             f"is_deleted={self.is_deleted!r}, "
             f"balance={self.balance!r}, "
             f"receiver_signature_required={self.receiver_signature_required!r}, "
             f"owned_nfts={self.owned_nfts!r}, "
             f"account_memo={self.account_memo!r}, "
-            f"staked_node_id={self.staking_info!r}, "
-            f"staked_account_id={self.staking_info!r}"
+            f"staking_info={self.staking_info!r}"
             f")"
         )

41-44: Docstring references removed fields.

The docstring still documents staked_account_id, staked_node_id, and decline_staking_reward as separate attributes, but these were replaced by the unified staking_info field.

📝 Proposed fix
-        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. 
+        staking_info (Optional[StakingInfo]): Staking information for this account, including
+            the staked account/node ID, decline reward preference, and staking rewards.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 (2)
src/hiero_sdk_python/account/account_info.py (2)

12-12: Wrong import: imports protobuf type instead of SDK class.

This imports StakingInfo from the protobuf module, but the code expects the SDK's StakingInfo class which has _from_proto() and _to_proto() methods. The protobuf type doesn't have these methods and will cause AttributeError at runtime.

🔧 Proposed fix
-from hiero_sdk_python.hapi.services.basic_types_pb2 import StakingInfo
+from hiero_sdk_python.staking_info import StakingInfo

41-44: Docstring references removed fields.

The docstring still documents staked_account_id, staked_node_id, and decline_staking_reward as attributes, but these have been replaced by staking_info. Update the docstring to match the actual fields.

📝 Proposed fix for docstring
-        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. 
+        staking_info (Optional[StakingInfo]): Staking-related information for this account.

Also applies to: 59-60

♻️ Duplicate comments (1)
src/hiero_sdk_python/account/account_info.py (1)

142-146: Method name still incorrect and indentation inconsistent.

The past review flagged that to_proto() should be _to_proto() per SDK conventions. This appears to still be present despite being marked as addressed. The closing parenthesis indentation is also inconsistent.

🔧 Proposed fix
             max_automatic_token_associations=self.max_automatic_token_associations,
-            staking_info=(
-                self.staking_info.to_proto()
-                if self.staking_info is not None
-                else None
-          ),
+            staking_info=(
+                self.staking_info._to_proto()
+                if self.staking_info is not None
+                else None
+            ),
         )

if staking_info.HasField('staked_node_id') else None
)
account_info.decline_staking_reward = staking_info.decline_reward
staking_info=(
Copy link
Contributor

Choose a reason for hiding this comment

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

@mukundkumarjha, this should be added inside the AccountInfo object itself, currenlty is is not included in the object, possibly move it after line 101

(self.max_automatic_token_associations, "Max Automatic Token Associations"),
(self.staked_account_id, "Staked Account ID"),
(self.staked_node_id, "Staked Node ID"),
(self.staking_info, "Staked Account ID"),
Copy link
Contributor

@manishdait manishdait Jan 26, 2026

Choose a reason for hiding this comment

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

better to display this as staking info only

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_node_id={self.staking_info!r}, "
Copy link
Contributor

Choose a reason for hiding this comment

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

same with these, better to include stating_info itself

Copy link
Contributor

@manishdait manishdait left a comment

Choose a reason for hiding this comment

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

@mukundkumarjha Thanks for the PR. I’ve added a few required changes.

@mukundkumarjha
Copy link
Contributor Author

@manishdait thanks for the review I have updated the same

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/hiero_sdk_python/account/account_info.py (2)

12-12: Critical: Wrong import - imports protobuf StakingInfo instead of SDK class.

Line 12 imports from hiero_sdk_python.hapi.services.basic_types_pb2, which is the protobuf-generated class. The SDK's StakingInfo class (with _from_proto() and _to_proto() methods) is located in hiero_sdk_python.staking_info. This causes runtime failures since protobuf classes don't have from_proto()/to_proto() methods.

🔧 Proposed fix
-from hiero_sdk_python.hapi.services.basic_types_pb2 import StakingInfo
+from hiero_sdk_python.staking_info import StakingInfo

41-44: Update docstring to reflect the refactored field.

The docstring still documents the removed flattened fields (staked_account_id, staked_node_id, decline_staking_reward). Update it to document the new staking_info field instead.

🔧 Proposed fix
-        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. 
+        staking_info (Optional[StakingInfo]): Staking-related information for this account.
♻️ Duplicate comments (5)
src/hiero_sdk_python/account/account_info.py (5)

143-147: Method name should follow SDK conventions with underscore prefix.

The SDK's StakingInfo class uses _to_proto() (with underscore prefix) per the codebase conventions. The previous review comment flagged this issue but it appears to still be present. Also fix the inconsistent indentation.

🔧 Proposed fix
             staking_info=(
-                self.staking_info.to_proto()
+                self.staking_info._to_proto()
                 if self.staking_info is not None
                 else None
-          ),
+            ),

178-179: Incorrect value for "Decline Staking Reward".

The label expects a boolean but the value is the entire StakingInfo object. This was flagged in a previous review. Access the specific field instead.

🔧 Proposed fix
         if self.staking_info is not None:
-            lines.append(f"Decline Staking Reward: {self.staking_info}")
+            lines.append(f"Decline Staking Reward: {self.staking_info.decline_reward}")

197-199: Incorrect field names in __repr__.

The labels staked_info= (typo) and staked_account_id= reference removed/incorrect fields, and both incorrectly display the same staking_info value. This was flagged in a previous review. Replace with a single staking_info= entry.

🔧 Proposed fix
             f"account_memo={self.account_memo!r}, "
-            f"staked_info={self.staking_info!r}, "
-            f"staked_account_id={self.staking_info!r}"
+            f"staking_info={self.staking_info!r}"
             f")"

162-162: Minor: Label inconsistency.

The label "Staked Info" should be "Staking Info" for consistency with the field name staking_info.

🔧 Proposed fix
-            (self.staking_info, "Staked Info"),
+            (self.staking_info, "Staking Info"),

102-106: Method name should follow SDK conventions with underscore prefix.

The SDK's StakingInfo class uses _from_proto() (with underscore prefix) per the codebase conventions shown in the relevant code snippets. Also fix the inconsistent indentation.

🔧 Proposed fix
             staking_info=(
-                StakingInfo.from_proto(proto.staking_info)
+                StakingInfo._from_proto(proto.staking_info)
                 if proto.HasField("staking_info")
                 else None
-         )
+            )

decline_reward=self.decline_staking_reward
),
staking_info=(
self.staking_info.to_proto()
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be self.staking_info._to_proto()

if self.decline_staking_reward is not None:
lines.append(f"Decline Staking Reward: {self.decline_staking_reward}")
if self.staking_info is not None:
lines.append(f"Decline Staking Reward: {self.staking_info}")
Copy link
Contributor

Choose a reason for hiding this comment

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

we can remove this

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}, "
f"staked_account_id={self.staking_info!r}"
Copy link
Contributor

Choose a reason for hiding this comment

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

same with this, we can remove it

Copy link
Contributor

@aceppaluni aceppaluni left a comment

Choose a reason for hiding this comment

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

@mukundkumarjha Thank you for your contribution!

I concur with @manishdait on the changes.
Additionally, please review your changelog entry.

If you have questions or need assistance, please reach out.

@github-actions
Copy link

Hi, this is MergeConflictBot.
Your pull request cannot be merged because it contains merge conflicts.

Please resolve these conflicts locally and push the changes.

To assist you, please read:

Thank you for contributing!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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)
tests/unit/account_info_test.py (1)

180-210: Add a non-None staking_info round‑trip test to protect the new behavior.

PR objectives require preserving full staking data, but tests only assert None. Add a test that sets a real StakingInfo (with one of staked_account_id/staked_node_id and decline_reward), runs _to_proto()/_from_proto(), and asserts those fields survive the round trip.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/unit/account_info_test.py (1)

58-73: Add hasattr assertions for new public attributes to protect against breaking changes.

Per coding guidelines (PRIORITY 1), tests should assert that public attributes exist. This helps catch accidental renames or removals early.

 def test_account_info_initialization(account_info):
     """Test the initialization of the AccountInfo class"""
+    # Verify new public attributes exist (guards against breaking changes)
+    assert hasattr(account_info, 'max_automatic_token_associations')
+    assert hasattr(account_info, 'staking_info')
+    
     assert account_info.account_id == AccountId(0, 0, 100)
     # ... existing assertions ...

Copy link
Contributor

@manishdait manishdait Jan 27, 2026

Choose a reason for hiding this comment

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

this should be from hiero_sdk_python.staking_info import StakingInfo since we are now using the StakingInfo class

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
Copy link
Contributor

Choose a reason for hiding this comment

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

same for this, test for staking_info not equals None

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/hiero_sdk_python/account/account_info.py (1)

41-44: Docstring references removed fields and omits new ones.

The docstring still documents staked_account_id, staked_node_id, and decline_staking_reward which were removed by this refactor. It also omits the new staking_info and max_automatic_token_associations fields.

📝 Suggested 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 number of tokens that can be
+            automatically associated with this account.
+        staking_info (Optional[StakingInfo]): Staking information for this account, including
+            staked account/node, pending rewards, and decline reward preference.
tests/unit/account_info_test.py (1)

252-267: Add assertions for staking_info in string representation tests.

Per coding guidelines, tests should verify that new public attributes appear correctly in string outputs. The test_str_and_repr test should verify staking_info is rendered correctly, especially since the PR modifies these methods.

📝 Suggested addition
def test_str_and_repr_with_staking_info():
    """Test __str__ and __repr__ methods include staking_info when populated"""
    account_info = AccountInfo(
        account_id=AccountId(0, 0, 100),
        staking_info=StakingInfo(
            decline_reward=True,
            staked_node_id=5,
        )
    )
    
    info_str = str(account_info)
    info_repr = repr(account_info)
    
    # Verify staking_info appears in string output
    assert "Staking Info" in info_str  # or "Staked Info" per current impl
    assert "staking_info=" in info_repr  # or "staked_info=" per current impl

@github-actions
Copy link

Hello, this is the OfficeHourBot.

This is a reminder that the Hiero Python SDK Office Hours are scheduled in approximately 4 hours (14:00 UTC).

This session provides an opportunity to ask questions regarding this Pull Request.

Details:

Disclaimer: This is an automated reminder. Please verify the schedule here for any changes.

From,
The Python SDK Team

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

@exploreriii exploreriii requested a review from a team January 28, 2026 12:27
Copy link
Contributor

@prajeeta15 prajeeta15 left a comment

Choose a reason for hiding this comment

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

@mukundkumarjha please address the coderabbitai issues and merge conflicts.
and let us know if you need any assistance :)

CHANGELOG.md Outdated
- Added dry-run support and refactored `.github/workflows/bot-workflows.yml` to use dedicated script `.github/scripts/bot-workflows.js` for improved maintainability and testability. (`#1288`)

### Changed
- Refactored AccountInfo class to use the staking_info
Copy link
Contributor

@prajeeta15 prajeeta15 Jan 28, 2026

Choose a reason for hiding this comment

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

please write a more descriptive CHANGELOG.md entry with the issue number that is being addressed through this PR.

@aceppaluni
Copy link
Contributor

@mukundkumarjha Thank you for your contribution!

I concur with @prajeeta15 on the suggestions. Do not hesitate to reach out if you need assistance.

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

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

Are there any breaking changes in this and what is the migration plan?

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

[commit-verification-bot]
Hi, this is VerificationBot.
Your pull request cannot be merged as it has 8 unverified commit(s):

  • 1252c5b Refactored AccountInfo class to use the staking_i
  • eb58e64 Refactored AccountInfo class to use the staking_i
  • 350ba49 added test cases
  • 1a40ceb fixed test cases
  • 98577e7 test case
  • 9ae1efa test file modified
  • 402bf54 test file modified
  • bec96f0 test: add AccountInfo staking info round-trip test

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:
git commit -S -s -m "Your message here"

Thank you for contributing!

From the Hiero Python SDK Team

@mukundkumarjha mukundkumarjha force-pushed the accountinfo branch 4 times, most recently from a381ba6 to c1cf669 Compare February 9, 2026 08:40
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

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 | 🟡 Minor

Docstring references removed fields.

The class docstring still documents staked_account_id, staked_node_id, and decline_staking_reward, which were replaced by staking_info. Update to reflect the current API.

Proposed fix
-        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 number of token associations.
+        staking_info (Optional[StakingInfo]): Staking-related information for this account.

@mukundkumarjha mukundkumarjha force-pushed the accountinfo branch 2 times, most recently from cd83eee to 7497dde Compare February 9, 2026 09:00
Signed-off-by: mukundkumarjha <mukundiiitg@gmail.com>
Signed-off-by: mukundkumarjha <mukundiiitg@gmail.com>
Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

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

You have changed how the original API works, so you have introduced breaking changes
Users who use the old methods, will be unable to run their code, without updating it

import warnings

enable backwards compatibility by deprecating the old fields and emitting a warning

test the old code, and check it still works

@manishdait what do you think?

@exploreriii exploreriii marked this pull request as draft February 9, 2026 11:34
@manishdait
Copy link
Contributor

manishdait commented Feb 9, 2026

You have changed how the original API works, so you have introduced breaking changes Users who use the old methods, will be unable to run their code, without updating it

import warnings

enable backwards compatibility by deprecating the old fields and emitting a warning

test the old code, and check it still works

@manishdait what do you think?

Agree with this.

Some previously exposed fields staked_account_id staked_node_id and decline_staking_reward were removed in the recent update. This introduces a breaking change, as existing user code relying on these fields would fail after upgrading.

To maintain backward compatibility, a possible solution is to reintroduce the removed fields as deprecated properties

# Example
@property
def decline_staking_reward(self) -> bool:
    warnings.warn(
        "Use `staking_info.decline_reward` instead.",
        FutureWarning,
    )
    return self.staking_info.decline_reward

Signed-off-by: mukundkumarjha <mukundiiitg@gmail.com>
@mukundkumarjha
Copy link
Contributor Author

You have changed how the original API works, so you have introduced breaking changes Users who use the old methods, will be unable to run their code, without updating it

import warnings

enable backwards compatibility by deprecating the old fields and emitting a warning

test the old code, and check it still works

@manishdait what do you think?

Hi @exploreriii @manishdait i have updated the accountinfo class for backward compatibility.

@mukundkumarjha mukundkumarjha marked this pull request as ready for review February 10, 2026 07:33
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 6 lines in your changes missing coverage. Please review.

❌ Your patch status has failed because the patch coverage (66.66%) is below the target coverage (92.00%). You can increase the patch coverage or adjust the target coverage.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1595      +/-   ##
==========================================
- Coverage   93.28%   93.23%   -0.05%     
==========================================
  Files         141      141              
  Lines        9100     9107       +7     
==========================================
+ Hits         8489     8491       +2     
- Misses        611      616       +5     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aceppaluni
Copy link
Contributor

@mukundkumarjha This is looking great so far.

After running the workflows, codecov seems to be fialing.
Take a look at your CodeCov report.

This shows you what was missed.
If you have any questions please let us know, thank you!!

@exploreriii exploreriii marked this pull request as draft February 10, 2026 19:38
@exploreriii exploreriii added the status: pending activity confirmation Developer needs to confirm they are interested in progressing with the PR label Feb 15, 2026
@exploreriii exploreriii removed the status: needs developer revision PR has requested changes that the developer needs to implement label Feb 21, 2026
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

Hi @mukundkumarjha, this is InactivityBot 👋

This pull request has had no new commits for 21 days, so I'm closing it and unassigning you from the linked issue to keep the backlog healthy.

If you're no longer interested, no action is needed.

Tip: You can comment /unassign on any issue to proactively step away before this bot kicks in.

If you'd like to continue working on this later, feel free to comment /assign on the issue to get re-assigned, and open a new PR when you're ready. 🚀

@github-actions github-actions bot closed this Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: pending activity confirmation Developer needs to confirm they are interested in progressing with the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor AccountInfo class to use the staking_info

6 participants