@@ -245,13 +245,14 @@ async def get_worker_state():
245245@json_rpc ('getAddressInformation' )
246246@wrap_result
247247async def get_address_information (
248- address : str = Query (..., description = "Identifier of target TON account in any form." )
248+ address : str = Query (..., description = "Identifier of target TON account in any form." ),
249+ seqno : Optional [int ] = Query (None , description = "Seqno of masterchain block at which moment the address information should be loaded" )
249250 ):
250251 """
251252 Get basic information about the address: balance, code, data, last_transaction_id.
252253 """
253254 address = prepare_address (address )
254- result = await tonlib .raw_get_account_state (address )
255+ result = await tonlib .raw_get_account_state (address , seqno )
255256 result ["state" ] = address_state (result )
256257 if "balance" in result and int (result ["balance" ]) < 0 :
257258 result ["balance" ] = 0
@@ -261,26 +262,28 @@ async def get_address_information(
261262@json_rpc ('getExtendedAddressInformation' )
262263@wrap_result
263264async def get_extended_address_information (
264- address : str = Query (..., description = "Identifier of target TON account in any form." )
265+ address : str = Query (..., description = "Identifier of target TON account in any form." ),
266+ seqno : Optional [int ] = Query (None , description = "Seqno of masterchain block at which moment the address information should be loaded" )
265267 ):
266268 """
267269 Similar to previous one but tries to parse additional information for known contract types. This method is based on tonlib's function *getAccountState*. For detecting wallets we recommend to use *getWalletInformation*.
268270 """
269271 address = prepare_address (address )
270- result = await tonlib .generic_get_account_state (address )
272+ result = await tonlib .generic_get_account_state (address , seqno )
271273 return result
272274
273275@app .get ('/getWalletInformation' , response_model = TonResponse , response_model_exclude_none = True , tags = ['accounts' ])
274276@json_rpc ('getWalletInformation' )
275277@wrap_result
276278async def get_wallet_information (
277- address : str = Query (..., description = "Identifier of target TON account in any form." )
279+ address : str = Query (..., description = "Identifier of target TON account in any form." ),
280+ seqno : Optional [int ] = Query (None , description = "Seqno of masterchain block at which moment the address information should be loaded" )
278281 ):
279282 """
280283 Retrieve wallet information. This method parses contract state and currently supports more wallet types than getExtendedAddressInformation: simple wallet, standart wallet, v3 wallet, v4 wallet.
281284 """
282285 address = prepare_address (address )
283- result = await tonlib .raw_get_account_state (address )
286+ result = await tonlib .raw_get_account_state (address , seqno )
284287 res = {'wallet' : False , 'balance' : 0 , 'extra_currencies' : [], 'account_state' : None , 'wallet_type' : None , 'seqno' : None }
285288 res ["account_state" ] = address_state (result )
286289 res ["balance" ] = result ["balance" ] if (result ["balance" ] and int (result ["balance" ]) > 0 ) else 0
@@ -316,13 +319,14 @@ async def get_transactions(
316319@json_rpc ('getAddressBalance' )
317320@wrap_result
318321async def get_address_balance (
319- address : str = Query (..., description = "Identifier of target TON account in any form." )
322+ address : str = Query (..., description = "Identifier of target TON account in any form." ),
323+ seqno : Optional [int ] = Query (None , description = "Seqno of masterchain block at which moment the address information should be loaded" )
320324 ):
321325 """
322326 Get balance (in nanotons) of a given address.
323327 """
324328 address = prepare_address (address )
325- result = await tonlib .raw_get_account_state (address )
329+ result = await tonlib .raw_get_account_state (address , seqno )
326330 if "balance" in result and int (result ["balance" ]) < 0 :
327331 result ["balance" ] = 0
328332 return result ["balance" ]
@@ -331,13 +335,14 @@ async def get_address_balance(
331335@json_rpc ('getAddressState' )
332336@wrap_result
333337async def get_address (
334- address : str = Query (..., description = "Identifier of target TON account in any form." )
338+ address : str = Query (..., description = "Identifier of target TON account in any form." ),
339+ seqno : Optional [int ] = Query (None , description = "Seqno of masterchain block at which moment the address information should be loaded" )
335340 ):
336341 """
337342 Get state of a given address. State can be either *unitialized*, *active* or *frozen*.
338343 """
339344 address = prepare_address (address )
340- result = await tonlib .raw_get_account_state (address )
345+ result = await tonlib .raw_get_account_state (address , seqno )
341346 return address_state (result )
342347
343348@app .get ('/packAddress' , response_model = TonResponse , response_model_exclude_none = True , tags = ['accounts' ])
@@ -715,13 +720,14 @@ async def estimate_fee_cell(
715720 async def run_get_method (
716721 address : str = Body (..., description = 'Contract address' ),
717722 method : Union [str , int ] = Body (..., description = 'Method name or method id' ),
718- stack : List [List [Any ]] = Body (..., description = "Array of stack elements: `[['num',3], ['cell', cell_object], ['slice', slice_object]]`" )
723+ stack : List [List [Any ]] = Body (..., description = "Array of stack elements: `[['num',3], ['cell', cell_object], ['slice', slice_object]]`" ),
724+ seqno : Optional [int ] = Body (None , description = "Seqno of masterchain block at which moment the Get Method is to be executed" )
719725 ):
720726 """
721727 Run get method on smart contract.
722728 """
723729 address = prepare_address (address )
724- return await tonlib .raw_run_method (address , method , stack )
730+ return await tonlib .raw_run_method (address , method , stack , seqno )
725731
726732
727733if settings .webserver .json_rpc :
0 commit comments