-
Notifications
You must be signed in to change notification settings - Fork 167
Open
Labels
Blockchain / DLTIssues engineering distributed ledger functionalityIssues engineering distributed ledger functionalityenhancementNew feature or requestNew feature or requestintermediaterequires some knowledge of the codebase with some defined steps to implement or examplesrequires some knowledge of the codebase with some defined steps to implement or examplespythonUses Python programming languageUses Python programming language
Description
Problem
The current AccountInfo implementation in the SDK partially represents staking data by flattening selected fields from the protobuf StakingInfo message directly into the AccountInfo:
staked_account_idstaked_node_iddecline_staking_reward
However, the protobuf StakingInfo message contains additional fields (e.g. pending_reward, staked_to_me, stake_period_start) that are not represented.
This results in:
- Loss of staking-related data
- Inconsistency with other SDKs
Proposed Solution
- Remove the following fields from AccountInfo:
staked_account_idstaked_node_iddecline_staking_reward
- Add a single unified field:
staking_info: Optional[StakingInfo] = None
- In
from_protoReplace manual field extraction with:def _from_proto(cls, proto: CryptoGetInfoResponse.AccountInfo) -> "AccountInfo": ... account_info: "AccountInfo" = cls( ..., staking_info=( StakingInfo.from_proto(proto.staking_info) if proto.HasField("staking_info") else None ) )
- Updated the
to_prototo do same:def _to_proto(self) -> CryptoGetInfoResponse.AccountInfo: ... return CryptoGetInfoResponse.AccountInfo( ..., staking_info=( self.staking_info.to_proto() if self.staking_info is not None else None ) )
- Update str/repr to print staking data via the StakingInfo object instead of individual fields
- Update unit/integration test to verify the changes
Metadata
Metadata
Assignees
Labels
Blockchain / DLTIssues engineering distributed ledger functionalityIssues engineering distributed ledger functionalityenhancementNew feature or requestNew feature or requestintermediaterequires some knowledge of the codebase with some defined steps to implement or examplesrequires some knowledge of the codebase with some defined steps to implement or examplespythonUses Python programming languageUses Python programming language