@@ -54,6 +54,20 @@ class AccountInfo:
5454
5555 @classmethod
5656 def _from_proto (cls , proto : CryptoGetInfoResponse .AccountInfo ) -> "AccountInfo" :
57+ """Creates an AccountInfo instance from its protobuf representation.
58+ Deserializes a `CryptoGetInfoResponse.AccountInfo` message into this
59+ SDK's `AccountInfo` object. This method handles the conversion of
60+ protobuf types to their corresponding SDK types (e.g., tinybars to
61+ `Hbar`, proto `Timestamp` to SDK `Timestamp`).
62+ Args:
63+ proto (CryptoGetInfoResponse.AccountInfo): The source protobuf
64+ message containing account information.
65+ Returns:
66+ AccountInfo: A new `AccountInfo` instance populated with data
67+ from the protobuf message.
68+ Raises:
69+ ValueError: If the input `proto` is None.
70+ """
5771 if proto is None :
5872 raise ValueError ("Account info proto is None" )
5973
@@ -80,6 +94,19 @@ def _from_proto(cls, proto: CryptoGetInfoResponse.AccountInfo) -> "AccountInfo":
8094 )
8195
8296 def _to_proto (self ) -> CryptoGetInfoResponse .AccountInfo :
97+ """Converts this AccountInfo object to its protobuf representation.
98+ Serializes this `AccountInfo` instance into a
99+ `CryptoGetInfoResponse.AccountInfo` message. This method handles
100+ the conversion of SDK types back to their protobuf equivalents
101+ (e.g., `Hbar` to tinybars, SDK `Timestamp` to proto `Timestamp`).
102+ Note:
103+ SDK fields that are `None` will be serialized as their
104+ default protobuf values (e.g., 0 for integers, False for booleans,
105+ empty strings/bytes).
106+ Returns:
107+ CryptoGetInfoResponse.AccountInfo: The protobuf message
108+ representation of this `AccountInfo` object.
109+ """
83110 return CryptoGetInfoResponse .AccountInfo (
84111 accountID = self .account_id ._to_proto () if self .account_id else None ,
85112 contractAccountID = self .contract_account_id ,
0 commit comments