Skip to content

Commit f633b2d

Browse files
Refactored AccountInfo class to use the staking_info
Signed-off-by: mukundkumarjha <[email protected]>
1 parent 353824a commit f633b2d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/hiero_sdk_python/account/account_info.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,14 @@ def _from_proto(cls, proto: CryptoGetInfoResponse.AccountInfo) -> "AccountInfo":
9999
account_memo=proto.memo,
100100
owned_nfts=proto.ownedNfts,
101101
max_automatic_token_associations=proto.max_automatic_token_associations,
102+
staking_info=(
103+
StakingInfo.from_proto(proto.staking_info)
104+
if proto.HasField("staking_info")
105+
else None
106+
)
102107
)
103108

104-
staking_info=(
105-
StakingInfo.from_proto(proto.staking_info)
106-
if proto.HasField("staking_info")
107-
else None
108-
)
109+
109110

110111
return account_info
111112

@@ -140,9 +141,9 @@ def _to_proto(self) -> CryptoGetInfoResponse.AccountInfo:
140141
ownedNfts=self.owned_nfts,
141142
max_automatic_token_associations=self.max_automatic_token_associations,
142143
staking_info=(
143-
self.staking_info.to_proto()
144-
if self.staking_info is not None
145-
else None
144+
self.staking_info.to_proto()
145+
if self.staking_info is not None
146+
else None
146147
),
147148
)
148149

@@ -158,8 +159,7 @@ def __str__(self) -> str:
158159
(self.account_memo, "Memo"),
159160
(self.owned_nfts, "Owned NFTs"),
160161
(self.max_automatic_token_associations, "Max Automatic Token Associations"),
161-
(self.staking_info, "Staked Account ID"),
162-
(self.staking_info, "Staked Node ID"),
162+
(self.staking_info, "Staked Info"),
163163
(self.proxy_received, "Proxy Received"),
164164
(self.expiration_time, "Expiration Time"),
165165
(self.auto_renew_period, "Auto Renew Period"),
@@ -194,7 +194,7 @@ def __repr__(self) -> str:
194194
f"receiver_signature_required={self.receiver_signature_required!r}, "
195195
f"owned_nfts={self.owned_nfts!r}, "
196196
f"account_memo={self.account_memo!r}, "
197-
f"staked_node_id={self.staking_info!r}, "
197+
f"staked_info={self.staking_info!r}, "
198198
f"staked_account_id={self.staking_info!r}"
199199
f")"
200200
)

0 commit comments

Comments
 (0)