@@ -115,33 +115,41 @@ def return_infos_by_block_version(_prev_method: str) -> Tuple[str, Any, bool]:
115115
116116 return result
117117
118- def get_total_supply (self , full_response : bool = False ) -> Union [dict , int ]:
118+ def get_total_supply (self , height : int = None , full_response : bool = False ) -> Union [dict , int ]:
119119 """
120120 Returns total ICX coin supply that has been issued
121121 Delegates to icx_getTotalSupply RPC method
122122
123+ :param height: Block height
123124 :param full_response: Boolean to check whether get naive dict or refined data from server
124125 :return: Total number of ICX coins issued
125126 """
126127
127- result = self .__provider .make_request ('icx_getTotalSupply' , full_response = full_response )
128+ params = {}
129+ if height is not None :
130+ params ["height" ] = hex (height )
131+
132+ result = self .__provider .make_request ('icx_getTotalSupply' , params , full_response = full_response )
128133
129134 if full_response :
130135 return result
131136 else :
132137 return int (remove_0x_prefix (result ), 16 )
133138
134- def get_balance (self , address : str , full_response : bool = False ) -> Union [dict , int ]:
139+ def get_balance (self , address : str , height : int = None , full_response : bool = False ) -> Union [dict , int ]:
135140 """
136141 Returns the ICX balance of the given EOA or SCORE.
137142 Delegates to icx_getBalance RPC method.
138143
139144 :param address: An address of EOA or SCORE. type(str)
145+ :param height: Block height. type(int)
140146 :param full_response: Boolean to check whether get naive dict or refined data from server
141147 :return: Number of ICX coins
142148 """
143149 if is_score_address (address ) or is_wallet_address (address ):
144150 params = {'address' : address }
151+ if height is not None :
152+ params ["height" ] = hex (height )
145153
146154 result = self .__provider .make_request ('icx_getBalance' , params , full_response )
147155
@@ -152,19 +160,22 @@ def get_balance(self, address: str, full_response: bool = False) -> Union[dict,
152160 else :
153161 raise AddressException ("Address is wrong." )
154162
155- def get_score_api (self , address : str , full_response : bool = False ) -> Union [dict , list ]:
163+ def get_score_api (self , address : str , height : int = None , full_response : bool = False ) -> Union [dict , list ]:
156164 """
157165 Returns SCORE's external API list.
158166 Delegates to icx_getScoreApi RPC method.
159167
160168 :param address: A SCORE address to be examined
169+ :param height: Block height
161170 :param full_response: Boolean to check whether get naive dict or refined data from server
162171 :return: A list of API methods of the SCORE and its information
163172 """
164173 if not is_score_address (address ):
165174 raise AddressException ("SCORE Address is wrong." )
166175
167176 params = {'address' : address }
177+ if height is not None :
178+ params ['height' ] = hex (height )
168179 return self .__provider .make_request ('icx_getScoreApi' , params , full_response )
169180
170181 def get_transaction_result (self , tx_hash : str , full_response : bool = False ) -> dict :
@@ -255,6 +266,9 @@ def call(self, call: object, full_response: bool = False) -> Union[dict, str]:
255266 if isinstance (call .params , dict ):
256267 params ["data" ]["params" ] = call .params
257268
269+ if call .height is not None :
270+ params ["height" ] = call .height
271+
258272 return self .__provider .make_request ('icx_call' , params , full_response )
259273
260274 def send_transaction (self , signed_transaction : SignedTransaction , full_response : bool = False ) -> Union [dict , str ]:
0 commit comments