ton-http-api 2.0.52__tar.gz → 2.0.53__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/PKG-INFO +1 -1
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/pyTON/main.py +18 -12
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/pyTON/manager.py +15 -7
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/ton_http_api.egg-info/PKG-INFO +1 -1
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/README.md +0 -0
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/pyTON/__init__.py +0 -0
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/pyTON/__main__.py +0 -0
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/pyTON/cache.py +0 -0
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/pyTON/models.py +0 -0
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/pyTON/settings.py +0 -0
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/pyTON/worker.py +0 -0
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/setup.cfg +0 -0
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/setup.py +0 -0
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/ton_http_api.egg-info/SOURCES.txt +0 -0
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/ton_http_api.egg-info/dependency_links.txt +0 -0
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/ton_http_api.egg-info/entry_points.txt +0 -0
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/ton_http_api.egg-info/requires.txt +0 -0
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/ton_http_api.egg-info/top_level.txt +0 -0
- {ton_http_api-2.0.52 → ton_http_api-2.0.53}/ton_http_api.egg-info/zip-safe +0 -0
@@ -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 @@ if settings.webserver.get_methods:
|
|
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:
|
@@ -314,22 +314,30 @@ class TonlibManager:
|
|
314
314
|
else:
|
315
315
|
return await self.dispatch_request(method, account_address, from_transaction_lt, from_transaction_hash, to_transaction_lt, limit, decode_messages)
|
316
316
|
|
317
|
-
async def raw_get_account_state(self, address: str):
|
317
|
+
async def raw_get_account_state(self, address: str, seqno: int = None):
|
318
318
|
method = 'raw_get_account_state'
|
319
319
|
try:
|
320
|
-
addr = await self.dispatch_request(method, address)
|
320
|
+
addr = await self.dispatch_request(method, address, seqno)
|
321
321
|
except TonlibError:
|
322
|
-
addr = await self.dispatch_archival_request(method, address)
|
322
|
+
addr = await self.dispatch_archival_request(method, address, seqno)
|
323
323
|
return addr
|
324
324
|
|
325
|
-
async def generic_get_account_state(self, address: str):
|
326
|
-
|
325
|
+
async def generic_get_account_state(self, address: str, seqno: int = None):
|
326
|
+
method = 'generic_get_account_state'
|
327
|
+
try:
|
328
|
+
addr = await self.dispatch_request(method, address, seqno)
|
329
|
+
except TonlibError:
|
330
|
+
addr = await self.dispatch_archival_request(method, address, seqno)
|
331
|
+
return addr
|
327
332
|
|
328
333
|
async def get_token_data(self, address: str):
|
329
334
|
return await self.dispatch_request('get_token_data', address)
|
330
335
|
|
331
|
-
async def raw_run_method(self, address, method, stack_data,
|
332
|
-
|
336
|
+
async def raw_run_method(self, address, method, stack_data, seqno):
|
337
|
+
try:
|
338
|
+
return await self.dispatch_request('raw_run_method', address, method, stack_data, seqno)
|
339
|
+
except TonlibError:
|
340
|
+
return await self.dispatch_archival_request('raw_run_method', address, method, stack_data, seqno)
|
333
341
|
|
334
342
|
async def _send_message(self, serialized_boc, method):
|
335
343
|
ls_index_list = self.select_worker(count=4)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|