pytonapi 0.3.4__tar.gz → 0.3.5__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.
- {pytonapi-0.3.4 → pytonapi-0.3.5}/PKG-INFO +1 -1
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/sse.py +23 -2
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/events.py +8 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi.egg-info/PKG-INFO +1 -1
- {pytonapi-0.3.4 → pytonapi-0.3.5}/setup.py +1 -1
- {pytonapi-0.3.4 → pytonapi-0.3.5}/LICENSE +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/README.md +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/__init__.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/__init__.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/client.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/__init__.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/accounts.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/blockchain.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/dns.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/emulate.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/events.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/inscriptions.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/jettons.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/liteserver.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/nft.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/rates.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/staking.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/storage.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/tonconnect.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/traces.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/wallet.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/async_tonapi/methods/websocket.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/exceptions.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/py.typed +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/__init__.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/_address.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/_balance.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/accounts.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/blockchain.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/dns.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/domains.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/inscriptions.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/jettons.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/liteserver.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/nft.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/rates.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/staking.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/storage.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/tonconnect.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/schema/traces.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/__init__.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/client.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/__init__.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/accounts.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/blockchain.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/dns.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/emulate.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/events.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/inscriptions.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/jettons.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/liteserver.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/nft.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/rates.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/sse.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/staking.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/storage.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/tonconnect.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/traces.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/tonapi/methods/wallet.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi/utils.py +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi.egg-info/SOURCES.txt +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi.egg-info/dependency_links.txt +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi.egg-info/requires.txt +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/pytonapi.egg-info/top_level.txt +0 -0
- {pytonapi-0.3.4 → pytonapi-0.3.5}/setup.cfg +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import json
|
|
2
|
-
from typing import List, Callable, Any, Awaitable, Tuple, Optional
|
|
2
|
+
from typing import List, Callable, Any, Awaitable, Tuple, Optional, Union
|
|
3
3
|
|
|
4
4
|
from pytonapi.async_tonapi.client import AsyncTonapiClient
|
|
5
|
-
from pytonapi.schema.events import TransactionEventData, TraceEventData, MempoolEventData
|
|
5
|
+
from pytonapi.schema.events import TransactionEventData, TraceEventData, MempoolEventData, BlockEventData
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class SSEMethod(AsyncTonapiClient):
|
|
@@ -81,3 +81,24 @@ class SSEMethod(AsyncTonapiClient):
|
|
|
81
81
|
result = await handler(event, *args)
|
|
82
82
|
if result is not None:
|
|
83
83
|
return result
|
|
84
|
+
|
|
85
|
+
async def subscribe_to_blocks(
|
|
86
|
+
self,
|
|
87
|
+
workchain: Optional[Union[int, None]],
|
|
88
|
+
handler: Callable[[BlockEventData, Any], Awaitable[Any]],
|
|
89
|
+
args: Tuple = (),
|
|
90
|
+
) -> Any:
|
|
91
|
+
"""
|
|
92
|
+
Subscribes to blocks SSE events for the specified workchains.
|
|
93
|
+
|
|
94
|
+
:handler: A callable function to handle the SSEEvent
|
|
95
|
+
:workchain: The ID of the workchain to subscribe to. If None, subscribes to all workchains.
|
|
96
|
+
"""
|
|
97
|
+
method = "v2/sse/blocks"
|
|
98
|
+
params = {} if workchain is None else {'workchain': workchain}
|
|
99
|
+
print(params)
|
|
100
|
+
async for data in self._subscribe(method=method, params=params):
|
|
101
|
+
event = BlockEventData(**json.loads(data))
|
|
102
|
+
result = await handler(event, *args)
|
|
103
|
+
if result is not None:
|
|
104
|
+
return result
|
|
@@ -261,6 +261,14 @@ class TransactionEventData(BaseModel):
|
|
|
261
261
|
tx_hash: str
|
|
262
262
|
|
|
263
263
|
|
|
264
|
+
class BlockEventData(BaseModel):
|
|
265
|
+
workchain: int
|
|
266
|
+
shard: str
|
|
267
|
+
seqno: int
|
|
268
|
+
root_hash: str
|
|
269
|
+
file_hash: str
|
|
270
|
+
|
|
271
|
+
|
|
264
272
|
class Risk(BaseModel):
|
|
265
273
|
description: Optional[str] = None
|
|
266
274
|
transfer_all_remaining_balance: bool
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|