@@ -245,13 +245,14 @@ async def get_worker_state():
245
245
@json_rpc ('getAddressInformation' )
246
246
@wrap_result
247
247
async 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" )
249
250
):
250
251
"""
251
252
Get basic information about the address: balance, code, data, last_transaction_id.
252
253
"""
253
254
address = prepare_address (address )
254
- result = await tonlib .raw_get_account_state (address )
255
+ result = await tonlib .raw_get_account_state (address , seqno )
255
256
result ["state" ] = address_state (result )
256
257
if "balance" in result and int (result ["balance" ]) < 0 :
257
258
result ["balance" ] = 0
@@ -261,26 +262,28 @@ async def get_address_information(
261
262
@json_rpc ('getExtendedAddressInformation' )
262
263
@wrap_result
263
264
async 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" )
265
267
):
266
268
"""
267
269
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*.
268
270
"""
269
271
address = prepare_address (address )
270
- result = await tonlib .generic_get_account_state (address )
272
+ result = await tonlib .generic_get_account_state (address , seqno )
271
273
return result
272
274
273
275
@app .get ('/getWalletInformation' , response_model = TonResponse , response_model_exclude_none = True , tags = ['accounts' ])
274
276
@json_rpc ('getWalletInformation' )
275
277
@wrap_result
276
278
async 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" )
278
281
):
279
282
"""
280
283
Retrieve wallet information. This method parses contract state and currently supports more wallet types than getExtendedAddressInformation: simple wallet, standart wallet, v3 wallet, v4 wallet.
281
284
"""
282
285
address = prepare_address (address )
283
- result = await tonlib .raw_get_account_state (address )
286
+ result = await tonlib .raw_get_account_state (address , seqno )
284
287
res = {'wallet' : False , 'balance' : 0 , 'extra_currencies' : [], 'account_state' : None , 'wallet_type' : None , 'seqno' : None }
285
288
res ["account_state" ] = address_state (result )
286
289
res ["balance" ] = result ["balance" ] if (result ["balance" ] and int (result ["balance" ]) > 0 ) else 0
@@ -316,13 +319,14 @@ async def get_transactions(
316
319
@json_rpc ('getAddressBalance' )
317
320
@wrap_result
318
321
async 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" )
320
324
):
321
325
"""
322
326
Get balance (in nanotons) of a given address.
323
327
"""
324
328
address = prepare_address (address )
325
- result = await tonlib .raw_get_account_state (address )
329
+ result = await tonlib .raw_get_account_state (address , seqno )
326
330
if "balance" in result and int (result ["balance" ]) < 0 :
327
331
result ["balance" ] = 0
328
332
return result ["balance" ]
@@ -331,13 +335,14 @@ async def get_address_balance(
331
335
@json_rpc ('getAddressState' )
332
336
@wrap_result
333
337
async 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" )
335
340
):
336
341
"""
337
342
Get state of a given address. State can be either *unitialized*, *active* or *frozen*.
338
343
"""
339
344
address = prepare_address (address )
340
- result = await tonlib .raw_get_account_state (address )
345
+ result = await tonlib .raw_get_account_state (address , seqno )
341
346
return address_state (result )
342
347
343
348
@app .get ('/packAddress' , response_model = TonResponse , response_model_exclude_none = True , tags = ['accounts' ])
@@ -715,13 +720,14 @@ async def estimate_fee_cell(
715
720
async def run_get_method (
716
721
address : str = Body (..., description = 'Contract address' ),
717
722
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" )
719
725
):
720
726
"""
721
727
Run get method on smart contract.
722
728
"""
723
729
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 )
725
731
726
732
727
733
if settings .webserver .json_rpc :
0 commit comments