tonutils 2.0.1b5__py3-none-any.whl → 2.0.1b7__py3-none-any.whl
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.
- tonutils/__meta__.py +1 -1
- tonutils/clients/__init__.py +10 -10
- tonutils/clients/adnl/balancer.py +135 -361
- tonutils/clients/adnl/client.py +35 -208
- tonutils/clients/adnl/mixin.py +268 -0
- tonutils/clients/adnl/provider/config.py +22 -7
- tonutils/clients/adnl/provider/provider.py +61 -16
- tonutils/clients/adnl/provider/transport.py +13 -4
- tonutils/clients/adnl/provider/workers/pinger.py +1 -1
- tonutils/clients/adnl/utils.py +5 -5
- tonutils/clients/base.py +61 -95
- tonutils/clients/http/__init__.py +11 -11
- tonutils/clients/http/balancer.py +103 -100
- tonutils/clients/http/clients/__init__.py +10 -10
- tonutils/clients/http/clients/chainstack.py +3 -3
- tonutils/clients/http/clients/quicknode.py +2 -3
- tonutils/clients/http/clients/tatum.py +4 -3
- tonutils/clients/http/clients/tonapi.py +20 -33
- tonutils/clients/http/clients/toncenter.py +64 -55
- tonutils/clients/http/{providers → provider}/__init__.py +4 -1
- tonutils/clients/http/{providers → provider}/base.py +140 -61
- tonutils/clients/http/{providers/toncenter → provider}/models.py +44 -2
- tonutils/clients/http/{providers/tonapi/provider.py → provider/tonapi.py} +8 -13
- tonutils/clients/http/{providers/toncenter/provider.py → provider/toncenter.py} +25 -21
- tonutils/clients/limiter.py +61 -59
- tonutils/clients/protocol.py +8 -8
- tonutils/contracts/base.py +32 -32
- tonutils/contracts/protocol.py +9 -9
- tonutils/contracts/wallet/base.py +7 -8
- tonutils/contracts/wallet/messages.py +4 -8
- tonutils/contracts/wallet/versions/v5.py +2 -2
- tonutils/exceptions.py +29 -13
- tonutils/tonconnect/bridge/__init__.py +0 -0
- tonutils/tonconnect/events.py +0 -0
- tonutils/tonconnect/models/__init__.py +0 -0
- tonutils/tonconnect/storage.py +0 -0
- tonutils/tonconnect/tonconnect.py +0 -0
- tonutils/tools/block_scanner/__init__.py +2 -5
- tonutils/tools/block_scanner/events.py +48 -7
- tonutils/tools/block_scanner/scanner.py +316 -222
- tonutils/tools/block_scanner/storage.py +11 -0
- tonutils/tools/status_monitor/monitor.py +6 -6
- tonutils/types.py +2 -2
- tonutils/utils.py +0 -48
- {tonutils-2.0.1b5.dist-info → tonutils-2.0.1b7.dist-info}/METADATA +3 -18
- {tonutils-2.0.1b5.dist-info → tonutils-2.0.1b7.dist-info}/RECORD +50 -51
- {tonutils-2.0.1b5.dist-info → tonutils-2.0.1b7.dist-info}/WHEEL +1 -1
- tonutils/clients/http/providers/response.py +0 -85
- tonutils/clients/http/providers/tonapi/__init__.py +0 -3
- tonutils/clients/http/providers/tonapi/models.py +0 -47
- tonutils/clients/http/providers/toncenter/__init__.py +0 -3
- tonutils/tools/block_scanner/annotations.py +0 -23
- tonutils/tools/block_scanner/dispatcher.py +0 -141
- tonutils/tools/block_scanner/traversal.py +0 -97
- tonutils/tools/block_scanner/where.py +0 -53
- {tonutils-2.0.1b5.dist-info → tonutils-2.0.1b7.dist-info}/entry_points.txt +0 -0
- {tonutils-2.0.1b5.dist-info → tonutils-2.0.1b7.dist-info}/licenses/LICENSE +0 -0
- {tonutils-2.0.1b5.dist-info → tonutils-2.0.1b7.dist-info}/top_level.txt +0 -0
|
@@ -114,7 +114,7 @@ class LiteServerMonitor:
|
|
|
114
114
|
self._tasks.append(asyncio.create_task(slow))
|
|
115
115
|
|
|
116
116
|
async def _ensure_connected(self, index: int, client: LiteClient) -> bool:
|
|
117
|
-
if client.provider.
|
|
117
|
+
if client.provider.connected:
|
|
118
118
|
return True
|
|
119
119
|
|
|
120
120
|
now = time.monotonic()
|
|
@@ -124,7 +124,7 @@ class LiteServerMonitor:
|
|
|
124
124
|
|
|
125
125
|
self._last_connect[index] = now
|
|
126
126
|
await self._connect(index, client)
|
|
127
|
-
return client.provider.
|
|
127
|
+
return client.provider.connected
|
|
128
128
|
|
|
129
129
|
async def _fast_update_loop(self, index: int, client: LiteClient) -> None:
|
|
130
130
|
while not self._stop.is_set():
|
|
@@ -141,7 +141,7 @@ class LiteServerMonitor:
|
|
|
141
141
|
|
|
142
142
|
async def _medium_update_loop(self, index: int, client: LiteClient) -> None:
|
|
143
143
|
while not self._stop.is_set():
|
|
144
|
-
if not client.
|
|
144
|
+
if not client.connected:
|
|
145
145
|
await self._sleep(1.0)
|
|
146
146
|
continue
|
|
147
147
|
|
|
@@ -154,7 +154,7 @@ class LiteServerMonitor:
|
|
|
154
154
|
|
|
155
155
|
async def _slow_update_loop(self, index: int, client: LiteClient) -> None:
|
|
156
156
|
while not self._stop.is_set():
|
|
157
|
-
if not client.
|
|
157
|
+
if not client.connected:
|
|
158
158
|
await self._sleep(1.0)
|
|
159
159
|
continue
|
|
160
160
|
|
|
@@ -223,14 +223,14 @@ class LiteServerMonitor:
|
|
|
223
223
|
return
|
|
224
224
|
|
|
225
225
|
mc_txs, shards = await asyncio.gather(
|
|
226
|
-
client.
|
|
226
|
+
client.get_block_transactions(mc_block),
|
|
227
227
|
client.get_all_shards_info(mc_block),
|
|
228
228
|
)
|
|
229
229
|
last_mc_block = BlockInfo(seqno=mc_block.seqno, txs_count=len(mc_txs))
|
|
230
230
|
|
|
231
231
|
if shards:
|
|
232
232
|
bc_block = max(shards, key=lambda b: b.seqno)
|
|
233
|
-
bc_txs = await client.
|
|
233
|
+
bc_txs = await client.get_block_transactions(bc_block)
|
|
234
234
|
last_bc_block = BlockInfo(seqno=bc_block.seqno, txs_count=len(bc_txs))
|
|
235
235
|
await self._set_status(
|
|
236
236
|
index,
|
tonutils/types.py
CHANGED
|
@@ -16,7 +16,7 @@ __all__ = [
|
|
|
16
16
|
"BinaryLike",
|
|
17
17
|
"ClientType",
|
|
18
18
|
"ContractState",
|
|
19
|
-
"
|
|
19
|
+
"ContractInfo",
|
|
20
20
|
"DNSCategory",
|
|
21
21
|
"DNSPrefix",
|
|
22
22
|
"MetadataPrefix",
|
|
@@ -189,7 +189,7 @@ class ContractState(str, Enum):
|
|
|
189
189
|
NONEXIST = "nonexist"
|
|
190
190
|
|
|
191
191
|
|
|
192
|
-
class
|
|
192
|
+
class ContractInfo:
|
|
193
193
|
"""
|
|
194
194
|
TON smart contract state information.
|
|
195
195
|
|
tonutils/utils.py
CHANGED
|
@@ -30,13 +30,8 @@ from tonutils.types import (
|
|
|
30
30
|
AddressLike,
|
|
31
31
|
PrivateKey,
|
|
32
32
|
PublicKey,
|
|
33
|
-
DNSCategory,
|
|
34
33
|
)
|
|
35
34
|
|
|
36
|
-
if t.TYPE_CHECKING:
|
|
37
|
-
from tonutils.clients.protocol import ClientProtocol
|
|
38
|
-
|
|
39
|
-
|
|
40
35
|
__all__ = [
|
|
41
36
|
"TextCipher",
|
|
42
37
|
"calc_valid_until",
|
|
@@ -50,7 +45,6 @@ __all__ = [
|
|
|
50
45
|
"norm_stack_num",
|
|
51
46
|
"normalize_hash",
|
|
52
47
|
"parse_stack_config",
|
|
53
|
-
"resolve_wallet_address",
|
|
54
48
|
"slice_hash",
|
|
55
49
|
"string_hash",
|
|
56
50
|
"to_amount",
|
|
@@ -310,48 +304,6 @@ def calc_valid_until(seqno: int, ttl: int = 60) -> int:
|
|
|
310
304
|
return 0xFFFFFFFF if seqno == 0 else now + ttl
|
|
311
305
|
|
|
312
306
|
|
|
313
|
-
async def resolve_wallet_address(
|
|
314
|
-
client: ClientProtocol,
|
|
315
|
-
domain: AddressLike,
|
|
316
|
-
) -> Address:
|
|
317
|
-
"""
|
|
318
|
-
Resolve a TON address from domain name or address string.
|
|
319
|
-
|
|
320
|
-
Supports:
|
|
321
|
-
- Direct Address objects (returned as-is)
|
|
322
|
-
- Address strings in any format (EQ..., UQ..., 0:...)
|
|
323
|
-
- TON DNS domains (.ton, .t.me) - queries wallet record
|
|
324
|
-
|
|
325
|
-
:param client: TON client for DNS resolution
|
|
326
|
-
:param domain: Address object, address string, or DNS domain
|
|
327
|
-
"""
|
|
328
|
-
from tonutils.contracts.dns.tlb import ALLOWED_DNS_ZONES
|
|
329
|
-
|
|
330
|
-
if isinstance(domain, Address):
|
|
331
|
-
return domain
|
|
332
|
-
|
|
333
|
-
if isinstance(domain, str):
|
|
334
|
-
try:
|
|
335
|
-
return Address(domain)
|
|
336
|
-
except (Exception,):
|
|
337
|
-
if not domain.endswith(ALLOWED_DNS_ZONES):
|
|
338
|
-
allowed = ", ".join(ALLOWED_DNS_ZONES)
|
|
339
|
-
raise ValueError(
|
|
340
|
-
f"Invalid DNS domain: {domain}. Supported zones: {allowed}."
|
|
341
|
-
)
|
|
342
|
-
|
|
343
|
-
record = await client.dnsresolve(
|
|
344
|
-
domain=domain,
|
|
345
|
-
category=DNSCategory.WALLET,
|
|
346
|
-
)
|
|
347
|
-
if record is None:
|
|
348
|
-
raise ValueError(f"DNS record not found for: {domain}.")
|
|
349
|
-
|
|
350
|
-
return record.value
|
|
351
|
-
|
|
352
|
-
raise TypeError(f"Invalid domain type: {type(domain)!r}. Expected Address or str.")
|
|
353
|
-
|
|
354
|
-
|
|
355
307
|
class TextCipher:
|
|
356
308
|
"""
|
|
357
309
|
End-to-end encryption for TON wallet text comments.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tonutils
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.1b7
|
|
4
4
|
Summary: Tonutils is a high-level, object-oriented Python library designed to facilitate seamless interactions with the TON blockchain.
|
|
5
5
|
Author: nessshon
|
|
6
6
|
Maintainer: nessshon
|
|
@@ -69,27 +69,13 @@ pip install --pre tonutils
|
|
|
69
69
|
|
|
70
70
|
## Usage
|
|
71
71
|
|
|
72
|
-
Practical feature examples can be found in the **[examples](examples)** directory
|
|
73
|
-
Each script demonstrates real-world usage and can be used as a reference when integrating `tonutils` into your project.
|
|
74
|
-
|
|
75
|
-
## Contribution
|
|
76
|
-
|
|
77
|
-
We welcome your contributions! If you have ideas for improvement or have identified a bug, please create an issue or
|
|
78
|
-
submit a pull request.
|
|
72
|
+
Practical feature examples can be found in the **[examples](examples)** directory.
|
|
79
73
|
|
|
80
74
|
## Donations
|
|
81
75
|
|
|
82
76
|
Your contributions help me continue developing and improving this project!
|
|
83
77
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
- **BTC**: `1JXHbB5kE1DfkHdv5dsNygRkNC3unJdU8M`
|
|
87
|
-
|
|
88
|
-
- **USDT** (TRC-20): `TU4fCFdWufKb4rd25ihksiNDZZdyEYqro6`
|
|
89
|
-
|
|
90
|
-
- **Crypto Bot**: [Donate through Crypto Bot](https://t.me/send?start=IVW1cyG3DYqG)
|
|
91
|
-
|
|
92
|
-
- **xRocket Bot**: [Donate through xRocket](https://t.me/xrocket?start=inv_R4llrClZtPjovVe)
|
|
78
|
+
**TON**: `UQCZq3_Vd21-4y4m7Wc-ej9NFOhh_qvdfAkAYAOHoQ__Ness`
|
|
93
79
|
|
|
94
80
|
## Support
|
|
95
81
|
|
|
@@ -99,4 +85,3 @@ With special thanks to [Igroman787](https://github.com/Igroman787) for the suppo
|
|
|
99
85
|
## License
|
|
100
86
|
|
|
101
87
|
This repository is distributed under the [MIT License](LICENSE).
|
|
102
|
-
Feel free to use, modify, and distribute the code in accordance with the terms of the license.
|
|
@@ -1,51 +1,48 @@
|
|
|
1
1
|
tonutils/__init__.py,sha256=ueJrDkU1JBlZiX0q8roQfzYOZY62Of_CiHZlxIIQFO0,228
|
|
2
|
-
tonutils/__meta__.py,sha256=
|
|
2
|
+
tonutils/__meta__.py,sha256=pnBUMwEiE3Otdl5pbcYM2yy-aa5fTg4NFSVHb1eXhG4,24
|
|
3
3
|
tonutils/cli.py,sha256=WGir-ihgPuKTgKGmhjPZeKk9wgsm64jiJciOnVlsdco,2645
|
|
4
|
-
tonutils/exceptions.py,sha256=
|
|
4
|
+
tonutils/exceptions.py,sha256=64TSU9LCTSEH70o1-qHTNIL-HXpxXv1xcsRklizJEGU,6929
|
|
5
5
|
tonutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
tonutils/types.py,sha256=
|
|
7
|
-
tonutils/utils.py,sha256=
|
|
8
|
-
tonutils/clients/__init__.py,sha256=
|
|
9
|
-
tonutils/clients/base.py,sha256=
|
|
10
|
-
tonutils/clients/limiter.py,sha256=
|
|
11
|
-
tonutils/clients/protocol.py,sha256=
|
|
6
|
+
tonutils/types.py,sha256=amHTnp1Mp7Z8G_mWscu10hufeIVjYbkaxKEYixXoKH4,14532
|
|
7
|
+
tonutils/utils.py,sha256=10R2eGjzNMEN9glngcJhZ36O76ec55NodH-c8IgN6yw,15062
|
|
8
|
+
tonutils/clients/__init__.py,sha256=F0aPLPOI8-HcqcweeCSG_fr2VArxiZxfsWHuzHDwE4k,521
|
|
9
|
+
tonutils/clients/base.py,sha256=FHKDJCUDNoLUuE4W0J3SGEtgJudW_6zFIAaP6zTKr_4,8207
|
|
10
|
+
tonutils/clients/limiter.py,sha256=lSUo6AhEuWUlo0y2sUc-P4YltRI2zjbicelYKkMTrls,3896
|
|
11
|
+
tonutils/clients/protocol.py,sha256=JCd0lBZwrosogmc4rQ5mmL_oBy3XYQoX_d2wyson0lU,2534
|
|
12
12
|
tonutils/clients/adnl/__init__.py,sha256=shkczPIYlTrOHjpnOBIoRwEYRQ4rVGfLnOZvnQY0a5U,174
|
|
13
|
-
tonutils/clients/adnl/balancer.py,sha256=
|
|
14
|
-
tonutils/clients/adnl/client.py,sha256=
|
|
15
|
-
tonutils/clients/adnl/
|
|
13
|
+
tonutils/clients/adnl/balancer.py,sha256=DoMiFtLA4rrCYeyhiFuhlxVBZbffttq9ewrFPSDEnKo,19917
|
|
14
|
+
tonutils/clients/adnl/client.py,sha256=2tUr6YxxoNXdc0c0iRkyT1xpZkIKIM-DwgNTKJn-qMo,8994
|
|
15
|
+
tonutils/clients/adnl/mixin.py,sha256=GVakCui_0yso0VCOsycZsvq55Ng6JyIdotrQ_0bIohM,8260
|
|
16
|
+
tonutils/clients/adnl/utils.py,sha256=pyrU0vLuR9qnOFlHtheOfch8u1FP4Q_5Ah2UuX_m7Jk,5129
|
|
16
17
|
tonutils/clients/adnl/provider/__init__.py,sha256=lLwFEEgCifMlYozwSzQbvq97R6Du7TzgGFnTgUnk4gw,63
|
|
17
|
-
tonutils/clients/adnl/provider/config.py,sha256=
|
|
18
|
+
tonutils/clients/adnl/provider/config.py,sha256=jMeCdg14KjS6Zh7sgcjop4LdLtrHA91PbWm1zD1mnt0,1655
|
|
18
19
|
tonutils/clients/adnl/provider/models.py,sha256=3dn4oZv7PIgiwlP2lGs0O6VckC19ejxCFlSPhzU0wX8,4537
|
|
19
|
-
tonutils/clients/adnl/provider/provider.py,sha256=
|
|
20
|
-
tonutils/clients/adnl/provider/transport.py,sha256=
|
|
20
|
+
tonutils/clients/adnl/provider/provider.py,sha256=J7wIGtv_ZeS5j6AdYafAQ0m3q4z8Sd5V_LcpfeSi7JM,25633
|
|
21
|
+
tonutils/clients/adnl/provider/transport.py,sha256=bT_a7h0nCBGKCfPNOg79CW04UIdyZCfQ_7-nFvpfWK0,11241
|
|
21
22
|
tonutils/clients/adnl/provider/workers/__init__.py,sha256=M65q7mVfinHImIZNCEaHBJ-SO4DdVBsSkeZFrJs9OoE,177
|
|
22
23
|
tonutils/clients/adnl/provider/workers/base.py,sha256=8RenR2MU_B-b8mevzCytLJmPgjLCJ8bVI-4q-wx78Q8,2031
|
|
23
|
-
tonutils/clients/adnl/provider/workers/pinger.py,sha256=
|
|
24
|
+
tonutils/clients/adnl/provider/workers/pinger.py,sha256=ndA2ToCiukTav0s1mVrUwfFEjxdK9Wucq5ONxB1wpAw,2440
|
|
24
25
|
tonutils/clients/adnl/provider/workers/reader.py,sha256=qvkaBBrRNu_nLTQOd0w6lDdN_wPOnzPbfAa3UToJWd8,1944
|
|
25
26
|
tonutils/clients/adnl/provider/workers/updater.py,sha256=r7NrZXDg3nY4jAF-sYkX1ZvxTE8sN99qSFctbAmHTME,1978
|
|
26
|
-
tonutils/clients/http/__init__.py,sha256=
|
|
27
|
-
tonutils/clients/http/balancer.py,sha256=
|
|
27
|
+
tonutils/clients/http/__init__.py,sha256=M05D4r8sLZk1dY_LZa6-LhPZdzCzyCJ3MJnCxwE9xk8,435
|
|
28
|
+
tonutils/clients/http/balancer.py,sha256=AdK9hHAreQJginHxpjIG9fhQiMOQq-wCsgby1jMsqII,12539
|
|
28
29
|
tonutils/clients/http/utils.py,sha256=mv9kCwLu8qjayy03E524WZ3q7Zf96t5VCE6H9j5kHRE,4994
|
|
29
|
-
tonutils/clients/http/clients/__init__.py,sha256=
|
|
30
|
-
tonutils/clients/http/clients/chainstack.py,sha256=
|
|
31
|
-
tonutils/clients/http/clients/quicknode.py,sha256=
|
|
32
|
-
tonutils/clients/http/clients/tatum.py,sha256=
|
|
33
|
-
tonutils/clients/http/clients/tonapi.py,sha256=
|
|
34
|
-
tonutils/clients/http/clients/toncenter.py,sha256=
|
|
35
|
-
tonutils/clients/http/
|
|
36
|
-
tonutils/clients/http/
|
|
37
|
-
tonutils/clients/http/
|
|
38
|
-
tonutils/clients/http/
|
|
39
|
-
tonutils/clients/http/
|
|
40
|
-
tonutils/clients/http/providers/tonapi/provider.py,sha256=iPquCsJglbgxtnHbUrkGYbiJG1rf5zmyh4XKMsncj-4,3727
|
|
41
|
-
tonutils/clients/http/providers/toncenter/__init__.py,sha256=PSzpwMrwcs_LY2Aw5omErjaLSVzy_9LB5EpRjtITyTs,81
|
|
42
|
-
tonutils/clients/http/providers/toncenter/models.py,sha256=ZPx6EhjhrNWFMWF_055EIolMwaLfQAGio0fqTUmljy8,2397
|
|
43
|
-
tonutils/clients/http/providers/toncenter/provider.py,sha256=QoNrobRgytG0Gc9Lo-QXrdMCtyJk1rOS-B2nPzGwaV0,3391
|
|
30
|
+
tonutils/clients/http/clients/__init__.py,sha256=RpoIk4KaVC3pBlxkatSozMN6cMY_UW1cR8PxA1d0Xyo,307
|
|
31
|
+
tonutils/clients/http/clients/chainstack.py,sha256=U_UaEDM8_KB8SHRA6l22utDfGqZ4dLvKJ-VLgbg86s0,1737
|
|
32
|
+
tonutils/clients/http/clients/quicknode.py,sha256=TZOwVZTLjTHHd1OiOZkdAzkM91vyX6_1vEV-bUqCjmE,1655
|
|
33
|
+
tonutils/clients/http/clients/tatum.py,sha256=2REsdMDwedvM_Fq8fBICPGJfxHxEkEnJ21QeOj2OYQ8,2014
|
|
34
|
+
tonutils/clients/http/clients/tonapi.py,sha256=3uWV9hQef5Yo57VYX2Lg_JM8XJcfzCdpXHJQaWU-_lg,5388
|
|
35
|
+
tonutils/clients/http/clients/toncenter.py,sha256=MhVyUVd_4NFcqJ1dVuZAy_DJZ2J58_mWcSLJXFY-sL4,7780
|
|
36
|
+
tonutils/clients/http/provider/__init__.py,sha256=V4JOQuTqLU7taZojxvXo0yVAXESbbyQR9O5iDPyp5x8,154
|
|
37
|
+
tonutils/clients/http/provider/base.py,sha256=JqhtFwLLGyTbTVXO6V8_TJf-nZtYjFrSXR4OZPhQXNY,8867
|
|
38
|
+
tonutils/clients/http/provider/models.py,sha256=HFB3xL9B7DHdahw9-qCdMv0pVCvOsVaklTM0Yz0pU-M,3510
|
|
39
|
+
tonutils/clients/http/provider/tonapi.py,sha256=IgEiz8VwZ3rKLAVB8Aq3RxUDcC2HMD2NIX4m_j1tk6U,3495
|
|
40
|
+
tonutils/clients/http/provider/toncenter.py,sha256=m_wLe778ibe0LMFBV2iIuULbrSxSoPOd-OmTNSXm5lE,3461
|
|
44
41
|
tonutils/contracts/__init__.py,sha256=KZm3_rQwoY0kO6zFGpPcjrN9XBTjDDvpB2dfaHjwjjw,9561
|
|
45
|
-
tonutils/contracts/base.py,sha256=
|
|
42
|
+
tonutils/contracts/base.py,sha256=CvTKWVJEvm07HThCenJ0T-QDYne_CgRD02Nyo29Exfg,10332
|
|
46
43
|
tonutils/contracts/codes.py,sha256=1Sbbs_izHZHd-i1cjWHRP8VN3Xc2BDPr4pnjojj6mZc,37741
|
|
47
44
|
tonutils/contracts/opcodes.py,sha256=niPd-pDmtXiEpYX8xvorFmd7O4vkY0i8nX71e3iaJ1s,1001
|
|
48
|
-
tonutils/contracts/protocol.py,sha256=
|
|
45
|
+
tonutils/contracts/protocol.py,sha256=Z4EdZn4J_TixBRpXfakt73FSM4B4Gnqh1UQ49ybT6wQ,6193
|
|
49
46
|
tonutils/contracts/versions.py,sha256=V1rJECQSQuAVYwDmXl4lZzLzDeqZ9OChOgipzAlTPQE,1705
|
|
50
47
|
tonutils/contracts/dns/__init__.py,sha256=H57OtOeohbQlcNTHZS5YI7wtZjlqlpKg4wVso2kPRrU,987
|
|
51
48
|
tonutils/contracts/dns/collection.py,sha256=wSpKGOyCnmXBq1IITjjq5oOt2OZO3u5ckibDcacbJ9I,3089
|
|
@@ -72,9 +69,9 @@ tonutils/contracts/vanity/models.py,sha256=B6W1TN4CyrMs4SfBDAjuQ8QP-wn5QFhNpcSzO
|
|
|
72
69
|
tonutils/contracts/vanity/tlb.py,sha256=gcNYEGPWMUHYbg_Je9QbBUlmVXF5RmobL-FoCMCF1HA,1078
|
|
73
70
|
tonutils/contracts/vanity/vanity.py,sha256=uYH1zybcOTQQBPciUFxAS6wksBwawKx06YES2tLuguI,1242
|
|
74
71
|
tonutils/contracts/wallet/__init__.py,sha256=Ho3-3C09JNk53ySnQaUnNscchfCtbUdyA2kpWAFzOf4,3295
|
|
75
|
-
tonutils/contracts/wallet/base.py,sha256=
|
|
72
|
+
tonutils/contracts/wallet/base.py,sha256=Ue0WMTtjQ55s3o1_67KHdqGIsjjFrgdoLjCiMwA1y1Q,15806
|
|
76
73
|
tonutils/contracts/wallet/configs.py,sha256=yQfuCEGL_fBuc5qGJ93rPIUATTR8V1wpYscgrWb7cEQ,4082
|
|
77
|
-
tonutils/contracts/wallet/messages.py,sha256=
|
|
74
|
+
tonutils/contracts/wallet/messages.py,sha256=MDzM3HdRYIc_vhmsjeHZcF9z1zpcfSdSh3_s4ecSx7o,13610
|
|
78
75
|
tonutils/contracts/wallet/methods.py,sha256=x7aPt71v3PUFNYHStWQrjLK7_SWPC2MiTG0c15X5TRI,10732
|
|
79
76
|
tonutils/contracts/wallet/params.py,sha256=hqinZJmhWiZUywDcmolvRxB0HYJgMAPDWYJiTmgjZ7w,4569
|
|
80
77
|
tonutils/contracts/wallet/protocol.py,sha256=DCu3CNbcZJ_wwROEK3GlpnwxNY2ZLdE0D2Z23WiyVDY,6200
|
|
@@ -86,23 +83,25 @@ tonutils/contracts/wallet/versions/v1.py,sha256=BYRWXdM0OlSeCfayHAUBj_wM4bb3WTVY
|
|
|
86
83
|
tonutils/contracts/wallet/versions/v2.py,sha256=pwrlan-utZo_WmnzDwSbnzV8ibkPEWx2WU1uOjkdrrA,2452
|
|
87
84
|
tonutils/contracts/wallet/versions/v3.py,sha256=d7cM8wjmW-1H7jGuY3AuUd7eTY3wq9ZYpJ4f5OeYX08,2470
|
|
88
85
|
tonutils/contracts/wallet/versions/v4.py,sha256=2sAsjJ8_3oYAj5JwWH3PiMyoGbgl6-f7-p6T5X7MGTI,2713
|
|
89
|
-
tonutils/contracts/wallet/versions/v5.py,sha256=
|
|
86
|
+
tonutils/contracts/wallet/versions/v5.py,sha256=fvOEdKLVbHGj1jyxd05xLuerZgZD1s3sMa0FnZ1Ds2U,8872
|
|
90
87
|
tonutils/tonconnect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
88
|
+
tonutils/tonconnect/events.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
89
|
+
tonutils/tonconnect/storage.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
90
|
+
tonutils/tonconnect/tonconnect.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
91
|
+
tonutils/tonconnect/bridge/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
92
|
+
tonutils/tonconnect/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
91
93
|
tonutils/tools/__init__.py,sha256=QYOVuGY50FFkWlgIvHc2RPU3xiEWSbwnwZ6wuZPQnCA,102
|
|
92
|
-
tonutils/tools/block_scanner/__init__.py,sha256=
|
|
93
|
-
tonutils/tools/block_scanner/
|
|
94
|
-
tonutils/tools/block_scanner/
|
|
95
|
-
tonutils/tools/block_scanner/
|
|
96
|
-
tonutils/tools/block_scanner/scanner.py,sha256=2arPhNPu-6Klcj-PnSnP3DBVWekhlYjn2iqvN-1wigU,9929
|
|
97
|
-
tonutils/tools/block_scanner/traversal.py,sha256=Zp0Uon0OTvLTsZi-zviMyvJHBsZRUx9XExxLU6LMkVA,3101
|
|
98
|
-
tonutils/tools/block_scanner/where.py,sha256=sZUuabQ5joATkJqUh5R3N5r4P9WblmRrVYEVdZeJvZw,1239
|
|
94
|
+
tonutils/tools/block_scanner/__init__.py,sha256=yYARZYo4LlePo7DWrrYlejGE4NLInfNeU9Ipln8oFFA,209
|
|
95
|
+
tonutils/tools/block_scanner/events.py,sha256=02K85PR3Jfe6qK-Ve1Mbukk4AWkxCJv1d-C-0tGdH_s,1881
|
|
96
|
+
tonutils/tools/block_scanner/scanner.py,sha256=abGhDbLUsdfzp9ipMpGpsdovIakP_ISfABTML4cPpck,14166
|
|
97
|
+
tonutils/tools/block_scanner/storage.py,sha256=7Kw6rdyLkPpBF5Y1mp2qkVZLnexyPumv2hMl9gNk_EI,357
|
|
99
98
|
tonutils/tools/status_monitor/__init__.py,sha256=QnMlA0IDLtCGgXsEgB9q3EJTBo2s5js6lSJk0oZkQZQ,72
|
|
100
99
|
tonutils/tools/status_monitor/console.py,sha256=UX3BzjjzeS_nKFGg4NkZJpu9fR_IAJZdQUMz0HcJCdg,5036
|
|
101
100
|
tonutils/tools/status_monitor/models.py,sha256=yHuiEuij4h2kVoOK3sbhNq6SwiGDW_evZmzUwMy1GQs,608
|
|
102
|
-
tonutils/tools/status_monitor/monitor.py,sha256=
|
|
103
|
-
tonutils-2.0.
|
|
104
|
-
tonutils-2.0.
|
|
105
|
-
tonutils-2.0.
|
|
106
|
-
tonutils-2.0.
|
|
107
|
-
tonutils-2.0.
|
|
108
|
-
tonutils-2.0.
|
|
101
|
+
tonutils/tools/status_monitor/monitor.py,sha256=OXs-J5RCUp4VbnBZuGd-4LythGUGakxwGSYM1Ipw-4s,10065
|
|
102
|
+
tonutils-2.0.1b7.dist-info/licenses/LICENSE,sha256=fG-yM-8DSkOTaJ558P7uF5PNXBmineVO9-HC12YbIxs,1060
|
|
103
|
+
tonutils-2.0.1b7.dist-info/METADATA,sha256=l-mwZF3Co184WoWPM8cnuk3Nj9-Doj3i3wy3P87oEPY,3519
|
|
104
|
+
tonutils-2.0.1b7.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
105
|
+
tonutils-2.0.1b7.dist-info/entry_points.txt,sha256=qijo1cqvbbzLVbXp-PCYh19Pgmd7duH6yljmnUPd55I,47
|
|
106
|
+
tonutils-2.0.1b7.dist-info/top_level.txt,sha256=-7H_mGl8S9HKQrkUiTLmEbtMM-knzRzd_a0cZZnuZIU,9
|
|
107
|
+
tonutils-2.0.1b7.dist-info/RECORD,,
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import json
|
|
4
|
-
import typing as t
|
|
5
|
-
|
|
6
|
-
import aiohttp
|
|
7
|
-
|
|
8
|
-
from tonutils.exceptions import ProviderResponseError, CDN_CHALLENGE_MARKERS
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class HttpResponse:
|
|
12
|
-
|
|
13
|
-
@classmethod
|
|
14
|
-
async def read(cls, resp: aiohttp.ClientResponse) -> t.Any:
|
|
15
|
-
body = await resp.read()
|
|
16
|
-
if not body:
|
|
17
|
-
return ""
|
|
18
|
-
|
|
19
|
-
data = body.decode("utf-8", errors="replace").strip()
|
|
20
|
-
if not data:
|
|
21
|
-
return ""
|
|
22
|
-
|
|
23
|
-
try:
|
|
24
|
-
return json.loads(data)
|
|
25
|
-
except (Exception,):
|
|
26
|
-
return data
|
|
27
|
-
|
|
28
|
-
@classmethod
|
|
29
|
-
def raise_error(
|
|
30
|
-
cls,
|
|
31
|
-
*,
|
|
32
|
-
status: int,
|
|
33
|
-
url: str,
|
|
34
|
-
data: t.Any,
|
|
35
|
-
) -> None:
|
|
36
|
-
exc = cls._detect_proxy_error(data, status=status, url=url)
|
|
37
|
-
if exc is not None:
|
|
38
|
-
raise exc
|
|
39
|
-
|
|
40
|
-
message = cls._extract_error_message(data)
|
|
41
|
-
raise ProviderResponseError(
|
|
42
|
-
code=status,
|
|
43
|
-
message=message,
|
|
44
|
-
endpoint=url,
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
@classmethod
|
|
48
|
-
def _detect_proxy_error(
|
|
49
|
-
cls,
|
|
50
|
-
data: t.Any,
|
|
51
|
-
*,
|
|
52
|
-
status: int,
|
|
53
|
-
url: str,
|
|
54
|
-
) -> t.Optional[ProviderResponseError]:
|
|
55
|
-
body = (
|
|
56
|
-
" ".join(str(v) for v in data.values())
|
|
57
|
-
if isinstance(data, dict)
|
|
58
|
-
else str(data)
|
|
59
|
-
).lower()
|
|
60
|
-
|
|
61
|
-
for marker, message in CDN_CHALLENGE_MARKERS.items():
|
|
62
|
-
if marker in body:
|
|
63
|
-
return ProviderResponseError(
|
|
64
|
-
code=status,
|
|
65
|
-
message=message,
|
|
66
|
-
endpoint=url,
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
return None
|
|
70
|
-
|
|
71
|
-
@staticmethod
|
|
72
|
-
def _extract_error_message(data: t.Any) -> str:
|
|
73
|
-
if isinstance(data, dict):
|
|
74
|
-
lowered = {k.lower(): v for k, v in data.items()}
|
|
75
|
-
for key in ("error", "message", "detail", "description"):
|
|
76
|
-
if key in lowered and isinstance(lowered[key], str):
|
|
77
|
-
return lowered[key]
|
|
78
|
-
string_values = [str(v) for v in data.values() if isinstance(v, str)]
|
|
79
|
-
return "; ".join(string_values) if string_values else str(data)
|
|
80
|
-
|
|
81
|
-
if isinstance(data, list):
|
|
82
|
-
return "; ".join(map(str, data))
|
|
83
|
-
if isinstance(data, str):
|
|
84
|
-
return data
|
|
85
|
-
return repr(data)
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import typing as t
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel
|
|
4
|
-
|
|
5
|
-
from tonutils.types import ContractState
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class BlockchainMessagePayload(BaseModel):
|
|
9
|
-
"""Payload for /blockchain/message endpoint."""
|
|
10
|
-
|
|
11
|
-
boc: str
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class BlockchainConfigResult(BaseModel):
|
|
15
|
-
"""Result model for /blockchain/config."""
|
|
16
|
-
|
|
17
|
-
raw: t.Optional[str] = None
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class BlockchainAccountResult(BaseModel):
|
|
21
|
-
"""Result model for /blockchain/accounts/{address}."""
|
|
22
|
-
|
|
23
|
-
balance: int = 0
|
|
24
|
-
status: str = ContractState.NONEXIST.value
|
|
25
|
-
code: t.Optional[str] = None
|
|
26
|
-
data: t.Optional[str] = None
|
|
27
|
-
last_transaction_lt: t.Optional[int] = None
|
|
28
|
-
last_transaction_hash: t.Optional[str] = None
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class _BlockchainAccountTransaction(BaseModel):
|
|
32
|
-
"""Single account transaction with raw BoC payload."""
|
|
33
|
-
|
|
34
|
-
raw: t.Optional[str] = None
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class BlockchainAccountTransactionsResult(BaseModel):
|
|
38
|
-
"""Result model for /blockchain/accounts/{address}/transactions."""
|
|
39
|
-
|
|
40
|
-
transactions: t.Optional[t.List[_BlockchainAccountTransaction]] = None
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
class BlockchainAccountMethodResult(BaseModel):
|
|
44
|
-
"""Result model for /blockchain/accounts/{address}/methods/{method_name}."""
|
|
45
|
-
|
|
46
|
-
stack: t.Optional[t.List[t.Any]] = None
|
|
47
|
-
exit_code: int
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import typing as t
|
|
2
|
-
|
|
3
|
-
from tonutils.tools.block_scanner.events import (
|
|
4
|
-
BlockEvent,
|
|
5
|
-
EventBase,
|
|
6
|
-
TransactionEvent,
|
|
7
|
-
TransactionsEvent,
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
TEvent = t.TypeVar("TEvent", bound=EventBase)
|
|
11
|
-
|
|
12
|
-
Handler = t.Callable[[TEvent], t.Awaitable[None]]
|
|
13
|
-
Where = t.Callable[[TEvent], t.Union[bool, t.Awaitable[bool]]]
|
|
14
|
-
|
|
15
|
-
BlockWhere = t.Callable[[BlockEvent], t.Union[bool, t.Awaitable[bool]]]
|
|
16
|
-
TransactionWhere = t.Callable[[TransactionEvent], t.Union[bool, t.Awaitable[bool]]]
|
|
17
|
-
TransactionsWhere = t.Callable[[TransactionsEvent], t.Union[bool, t.Awaitable[bool]]]
|
|
18
|
-
|
|
19
|
-
AnyHandler = t.Callable[[EventBase], t.Awaitable[None]]
|
|
20
|
-
AnyWhere = t.Callable[[EventBase], t.Union[bool, t.Awaitable[bool]]]
|
|
21
|
-
|
|
22
|
-
HandlerEntry = t.Tuple[AnyHandler, t.Optional[AnyWhere]]
|
|
23
|
-
Decorator = t.Callable[[Handler[TEvent]], Handler[TEvent]]
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
import inspect
|
|
3
|
-
import traceback
|
|
4
|
-
import typing as t
|
|
5
|
-
|
|
6
|
-
from tonutils.tools.block_scanner.annotations import (
|
|
7
|
-
AnyHandler,
|
|
8
|
-
AnyWhere,
|
|
9
|
-
Decorator,
|
|
10
|
-
Handler,
|
|
11
|
-
HandlerEntry,
|
|
12
|
-
TEvent,
|
|
13
|
-
Where,
|
|
14
|
-
)
|
|
15
|
-
from tonutils.tools.block_scanner.events import EventBase
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class EventDispatcher:
|
|
19
|
-
"""Dispatches events to registered handlers asynchronously."""
|
|
20
|
-
|
|
21
|
-
def __init__(self, max_concurrency: int = 1000) -> None:
|
|
22
|
-
"""
|
|
23
|
-
Initialize EventDispatcher.
|
|
24
|
-
|
|
25
|
-
:param max_concurrency: maximum number of concurrent handler tasks.
|
|
26
|
-
"""
|
|
27
|
-
self._handlers: t.Dict[t.Type[EventBase], t.List[HandlerEntry]] = {}
|
|
28
|
-
self._sem = asyncio.Semaphore(max(1, max_concurrency))
|
|
29
|
-
self._tasks: t.Set[asyncio.Task[None]] = set()
|
|
30
|
-
self._closed = False
|
|
31
|
-
|
|
32
|
-
def register(
|
|
33
|
-
self,
|
|
34
|
-
event_type: t.Type[TEvent],
|
|
35
|
-
handler: Handler[TEvent],
|
|
36
|
-
*,
|
|
37
|
-
where: t.Optional[Where[TEvent]] = None,
|
|
38
|
-
) -> None:
|
|
39
|
-
"""
|
|
40
|
-
Register a handler for a specific event type.
|
|
41
|
-
|
|
42
|
-
:param event_type: subclass of EventBase to handle.
|
|
43
|
-
:param handler: callable receiving the event.
|
|
44
|
-
:param where: optional filter predicate. Handler is invoked only if predicate returns True.
|
|
45
|
-
"""
|
|
46
|
-
if not callable(handler):
|
|
47
|
-
raise TypeError("handler must be callable")
|
|
48
|
-
|
|
49
|
-
entry: HandlerEntry = (
|
|
50
|
-
t.cast(AnyHandler, handler),
|
|
51
|
-
t.cast(t.Optional[AnyWhere], where),
|
|
52
|
-
)
|
|
53
|
-
self._handlers.setdefault(event_type, []).append(entry)
|
|
54
|
-
|
|
55
|
-
def on(
|
|
56
|
-
self,
|
|
57
|
-
event_type: t.Type[TEvent],
|
|
58
|
-
*,
|
|
59
|
-
where: t.Optional[Where[TEvent]] = None,
|
|
60
|
-
) -> Decorator[TEvent]:
|
|
61
|
-
"""
|
|
62
|
-
Decorator to register a handler for an event type.
|
|
63
|
-
|
|
64
|
-
:param event_type: event class to handle.
|
|
65
|
-
:param where: optional filter predicate.
|
|
66
|
-
:return: Decorator that registers the handler.
|
|
67
|
-
"""
|
|
68
|
-
|
|
69
|
-
def decorator(fn: Handler[TEvent]) -> Handler[TEvent]:
|
|
70
|
-
self.register(event_type=event_type, handler=fn, where=where)
|
|
71
|
-
return fn
|
|
72
|
-
|
|
73
|
-
return decorator
|
|
74
|
-
|
|
75
|
-
def _iter_handlers(self, event: EventBase) -> t.Sequence[HandlerEntry]:
|
|
76
|
-
"""Return all handlers matching the type of `event`."""
|
|
77
|
-
out: t.List[HandlerEntry] = []
|
|
78
|
-
for tp in type(event).mro():
|
|
79
|
-
if tp is EventBase:
|
|
80
|
-
break
|
|
81
|
-
entries = self._handlers.get(t.cast(t.Type[EventBase], tp))
|
|
82
|
-
if entries:
|
|
83
|
-
out.extend(entries)
|
|
84
|
-
return out
|
|
85
|
-
|
|
86
|
-
def _on_task_done(self, task: asyncio.Task[None]) -> None:
|
|
87
|
-
"""Callback to handle task completion and print exceptions."""
|
|
88
|
-
self._tasks.discard(task)
|
|
89
|
-
try:
|
|
90
|
-
exc = task.exception()
|
|
91
|
-
except asyncio.CancelledError:
|
|
92
|
-
return
|
|
93
|
-
if exc is not None:
|
|
94
|
-
traceback.print_exception(type(exc), exc, exc.__traceback__)
|
|
95
|
-
|
|
96
|
-
async def _run_task(
|
|
97
|
-
self,
|
|
98
|
-
handler: AnyHandler,
|
|
99
|
-
event: EventBase,
|
|
100
|
-
where: t.Optional[AnyWhere] = None,
|
|
101
|
-
) -> None:
|
|
102
|
-
"""
|
|
103
|
-
Run a single handler task with optional 'where' filtering.
|
|
104
|
-
|
|
105
|
-
:param handler: async callable to execute.
|
|
106
|
-
:param event: event instance to pass.
|
|
107
|
-
:param where: optional predicate, skip handler if False.
|
|
108
|
-
"""
|
|
109
|
-
async with self._sem:
|
|
110
|
-
if where is not None:
|
|
111
|
-
result = where(event)
|
|
112
|
-
if inspect.isawaitable(result):
|
|
113
|
-
result = await result
|
|
114
|
-
if not result:
|
|
115
|
-
return
|
|
116
|
-
await handler(event)
|
|
117
|
-
|
|
118
|
-
def emit(self, event: EventBase) -> None:
|
|
119
|
-
"""
|
|
120
|
-
Emit an event to all matching handlers.
|
|
121
|
-
|
|
122
|
-
Handlers are executed asynchronously.
|
|
123
|
-
"""
|
|
124
|
-
if self._closed:
|
|
125
|
-
return
|
|
126
|
-
|
|
127
|
-
for handler, where in self._iter_handlers(event):
|
|
128
|
-
task = asyncio.create_task(self._run_task(handler, event, where))
|
|
129
|
-
self._tasks.add(task)
|
|
130
|
-
task.add_done_callback(self._on_task_done)
|
|
131
|
-
|
|
132
|
-
async def aclose(self) -> None:
|
|
133
|
-
"""
|
|
134
|
-
Close the dispatcher and wait for all running handler tasks.
|
|
135
|
-
|
|
136
|
-
After calling, no new events will be dispatched.
|
|
137
|
-
"""
|
|
138
|
-
self._closed = True
|
|
139
|
-
if self._tasks:
|
|
140
|
-
await asyncio.gather(*self._tasks, return_exceptions=True)
|
|
141
|
-
self._tasks.clear()
|