tonutils 2.0.1b1__py3-none-any.whl → 2.0.1b3__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/__init__.py +0 -2
- tonutils/__meta__.py +1 -1
- tonutils/clients/__init__.py +5 -9
- tonutils/clients/adnl/__init__.py +5 -1
- tonutils/clients/adnl/balancer.py +319 -125
- tonutils/clients/adnl/client.py +187 -51
- tonutils/clients/adnl/provider/config.py +19 -25
- tonutils/clients/adnl/provider/models.py +4 -0
- tonutils/clients/adnl/provider/provider.py +191 -145
- tonutils/clients/adnl/provider/transport.py +38 -32
- tonutils/clients/adnl/provider/workers/base.py +0 -2
- tonutils/clients/adnl/provider/workers/pinger.py +1 -1
- tonutils/clients/adnl/provider/workers/reader.py +3 -2
- tonutils/clients/adnl/{provider/builder.py → utils.py} +62 -2
- tonutils/clients/http/__init__.py +11 -8
- tonutils/clients/http/balancer.py +75 -63
- tonutils/clients/http/clients/__init__.py +13 -0
- tonutils/clients/http/clients/chainstack.py +48 -0
- tonutils/clients/http/clients/quicknode.py +47 -0
- tonutils/clients/http/clients/tatum.py +56 -0
- tonutils/clients/http/{tonapi/client.py → clients/tonapi.py} +31 -31
- tonutils/clients/http/{toncenter/client.py → clients/toncenter.py} +59 -48
- tonutils/clients/http/providers/__init__.py +4 -0
- tonutils/clients/http/providers/base.py +201 -0
- tonutils/clients/http/providers/response.py +85 -0
- tonutils/clients/http/providers/tonapi/__init__.py +3 -0
- tonutils/clients/http/{tonapi → providers/tonapi}/models.py +1 -0
- tonutils/clients/http/providers/tonapi/provider.py +125 -0
- tonutils/clients/http/providers/toncenter/__init__.py +3 -0
- tonutils/clients/http/{toncenter → providers/toncenter}/models.py +1 -0
- tonutils/clients/http/providers/toncenter/provider.py +119 -0
- tonutils/clients/http/utils.py +140 -0
- tonutils/clients/limiter.py +115 -0
- tonutils/contracts/__init__.py +18 -0
- tonutils/contracts/base.py +33 -20
- tonutils/contracts/dns/methods.py +2 -2
- tonutils/contracts/jetton/methods.py +2 -2
- tonutils/contracts/nft/methods.py +2 -2
- tonutils/contracts/nft/tlb.py +1 -1
- tonutils/{protocols/contract.py → contracts/protocol.py} +29 -29
- tonutils/contracts/telegram/methods.py +2 -2
- tonutils/contracts/vanity/__init__.py +17 -0
- tonutils/contracts/vanity/models.py +39 -0
- tonutils/contracts/vanity/tlb.py +40 -0
- tonutils/contracts/vanity/vanity.py +40 -0
- tonutils/contracts/wallet/__init__.py +2 -0
- tonutils/contracts/wallet/base.py +3 -3
- tonutils/contracts/wallet/messages.py +1 -1
- tonutils/contracts/wallet/methods.py +2 -2
- tonutils/{protocols/wallet.py → contracts/wallet/protocol.py} +35 -35
- tonutils/contracts/wallet/versions/v5.py +3 -3
- tonutils/exceptions.py +134 -226
- tonutils/types.py +115 -0
- tonutils/utils.py +3 -3
- {tonutils-2.0.1b1.dist-info → tonutils-2.0.1b3.dist-info}/METADATA +4 -4
- tonutils-2.0.1b3.dist-info/RECORD +93 -0
- tonutils/clients/adnl/provider/limiter.py +0 -56
- tonutils/clients/adnl/stack.py +0 -64
- tonutils/clients/http/chainstack/__init__.py +0 -4
- tonutils/clients/http/chainstack/client.py +0 -63
- tonutils/clients/http/chainstack/provider.py +0 -44
- tonutils/clients/http/quicknode/__init__.py +0 -4
- tonutils/clients/http/quicknode/client.py +0 -60
- tonutils/clients/http/quicknode/provider.py +0 -42
- tonutils/clients/http/tatum/__init__.py +0 -4
- tonutils/clients/http/tatum/client.py +0 -66
- tonutils/clients/http/tatum/provider.py +0 -53
- tonutils/clients/http/tonapi/__init__.py +0 -4
- tonutils/clients/http/tonapi/provider.py +0 -150
- tonutils/clients/http/tonapi/stack.py +0 -71
- tonutils/clients/http/toncenter/__init__.py +0 -4
- tonutils/clients/http/toncenter/provider.py +0 -145
- tonutils/clients/http/toncenter/stack.py +0 -73
- tonutils/protocols/__init__.py +0 -9
- tonutils-2.0.1b1.dist-info/RECORD +0 -94
- /tonutils/{protocols/client.py → clients/protocol.py} +0 -0
- {tonutils-2.0.1b1.dist-info → tonutils-2.0.1b3.dist-info}/WHEEL +0 -0
- {tonutils-2.0.1b1.dist-info → tonutils-2.0.1b3.dist-info}/licenses/LICENSE +0 -0
- {tonutils-2.0.1b1.dist-info → tonutils-2.0.1b3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
tonutils/__init__.py,sha256=ueJrDkU1JBlZiX0q8roQfzYOZY62Of_CiHZlxIIQFO0,228
|
|
2
|
+
tonutils/__meta__.py,sha256=mRBQ57iGzpByxckbLnojX_P1AgfSuWhjlMZaHQ9G32Y,24
|
|
3
|
+
tonutils/exceptions.py,sha256=fxw2TJTKp4siBgP5RD_AsvFsHh7xqmSuomHZ-3OYD6s,6268
|
|
4
|
+
tonutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
tonutils/types.py,sha256=JIX3JYbpAOeRaGDHXg_ABNUzZfCjloUh6KHeskC8b9k,14283
|
|
6
|
+
tonutils/utils.py,sha256=w2sXvVMA2Erz_JSSN2WuYSi7RAPDAOOwWYiThu8Q0Ps,16499
|
|
7
|
+
tonutils/clients/__init__.py,sha256=df1v30j2PR1Pg75s8oTx-gtD6t7TKkYJ9VAumeqWS7M,561
|
|
8
|
+
tonutils/clients/base.py,sha256=K2Z0FTF1c1V420mJn8Az9PGgzfbHmK6fnyFPXtrEWGM,9594
|
|
9
|
+
tonutils/clients/limiter.py,sha256=d2WO7Dx-ksg3gvl05WuDMu1KycuQj0XrmiG67Q7wnFo,3592
|
|
10
|
+
tonutils/clients/protocol.py,sha256=4QerYoqBKAAfNZVpyQW2sp5KZZlq8xHCn9yWbbJERPQ,2557
|
|
11
|
+
tonutils/clients/adnl/__init__.py,sha256=YiRYJ-Q8CNmbEEkoonmMWvaOEBYHn1eIa7YAXhuAMHo,174
|
|
12
|
+
tonutils/clients/adnl/balancer.py,sha256=1oyCwW8tOLs0GcBRBHCYb27ElhPZqn2RlH2FKt4biPI,26772
|
|
13
|
+
tonutils/clients/adnl/client.py,sha256=lgUBfovfzn_z7kCZsvZc2l3M_lnHBPruBn-655j3Fag,14060
|
|
14
|
+
tonutils/clients/adnl/utils.py,sha256=rKLbTiGbZQ0ozvh5jYjjaFEKsmqEschjuUiHOX9e6ps,5154
|
|
15
|
+
tonutils/clients/adnl/provider/__init__.py,sha256=lLwFEEgCifMlYozwSzQbvq97R6Du7TzgGFnTgUnk4gw,63
|
|
16
|
+
tonutils/clients/adnl/provider/config.py,sha256=8GDrfAf6B5IKrbK_Wq28XUQZHoYQ0YG_ngqXM2jo-0Y,690
|
|
17
|
+
tonutils/clients/adnl/provider/models.py,sha256=3dn4oZv7PIgiwlP2lGs0O6VckC19ejxCFlSPhzU0wX8,4537
|
|
18
|
+
tonutils/clients/adnl/provider/provider.py,sha256=2EoI7PJ3-JOfcNqEzb02saa_T6tcwlks32I8UXhsYfs,24416
|
|
19
|
+
tonutils/clients/adnl/provider/transport.py,sha256=bDM_qBbd3jH7uPiyq8Jctlxi-CIzryGXHqa5TuX7zWk,10961
|
|
20
|
+
tonutils/clients/adnl/provider/workers/__init__.py,sha256=M65q7mVfinHImIZNCEaHBJ-SO4DdVBsSkeZFrJs9OoE,177
|
|
21
|
+
tonutils/clients/adnl/provider/workers/base.py,sha256=8RenR2MU_B-b8mevzCytLJmPgjLCJ8bVI-4q-wx78Q8,2031
|
|
22
|
+
tonutils/clients/adnl/provider/workers/pinger.py,sha256=lBpy4TU8L-I_6sxEft-Bn9XmntJhMg5Rm2o2tN2Mp0A,2443
|
|
23
|
+
tonutils/clients/adnl/provider/workers/reader.py,sha256=qvkaBBrRNu_nLTQOd0w6lDdN_wPOnzPbfAa3UToJWd8,1944
|
|
24
|
+
tonutils/clients/adnl/provider/workers/updater.py,sha256=r7NrZXDg3nY4jAF-sYkX1ZvxTE8sN99qSFctbAmHTME,1978
|
|
25
|
+
tonutils/clients/http/__init__.py,sha256=UIhIb0jLFmM73FabLHHZV-kxM3pq02P4WfCviBPHDPY,476
|
|
26
|
+
tonutils/clients/http/balancer.py,sha256=tDQBRvwnwoUdceYyVVuJpJnTI__x02J-4oP1_-rFgTs,12376
|
|
27
|
+
tonutils/clients/http/utils.py,sha256=mv9kCwLu8qjayy03E524WZ3q7Zf96t5VCE6H9j5kHRE,4994
|
|
28
|
+
tonutils/clients/http/clients/__init__.py,sha256=DBUfGpJIDqHDzTLMLtJatT7pKusnMSLGYiTek7Hf6i4,347
|
|
29
|
+
tonutils/clients/http/clients/chainstack.py,sha256=jH0alNZMAkRSBb4U6MoiFa_FiQ9ZTvjqDbwjFvidsiI,1749
|
|
30
|
+
tonutils/clients/http/clients/quicknode.py,sha256=4bh8QebatFGHpIINiQFNIuYnHW8FW3aTzZIf-rAL0PI,1668
|
|
31
|
+
tonutils/clients/http/clients/tatum.py,sha256=pRIUJvzmKJBJUPocedGo6fsQ-CZUDm-7DIQwOJQWXCk,2025
|
|
32
|
+
tonutils/clients/http/clients/tonapi.py,sha256=hhcYjs6foDfsoBgBGAptQq58WSQ18x_kupA8nlAORU8,5769
|
|
33
|
+
tonutils/clients/http/clients/toncenter.py,sha256=2cni37OIZ9IRMxF54YwMV3sMacksJbumYseAhHE4-Sg,7319
|
|
34
|
+
tonutils/clients/http/providers/__init__.py,sha256=psOTidJ5Zc1qhNYmHgZaiDbht4BvEWZ5r_xgrcrmipQ,143
|
|
35
|
+
tonutils/clients/http/providers/base.py,sha256=D4RkgmG713JIc2LPbUamr1-RIN3kuwdToPumdx7o0Sg,6447
|
|
36
|
+
tonutils/clients/http/providers/response.py,sha256=G0kAInKJ4nOIkqMB5dac2Ugnsj3YDxS06awK7RrQPNk,2265
|
|
37
|
+
tonutils/clients/http/providers/tonapi/__init__.py,sha256=A4-axY0GZZ-NtB0F9h9Mh3PFoosmHpt0nS2HU8GOLcE,75
|
|
38
|
+
tonutils/clients/http/providers/tonapi/models.py,sha256=0ldcEaw_ReT4Zns0HSCBwe3RFUhcUsjdKhrBorN9_qY,1204
|
|
39
|
+
tonutils/clients/http/providers/tonapi/provider.py,sha256=iPquCsJglbgxtnHbUrkGYbiJG1rf5zmyh4XKMsncj-4,3727
|
|
40
|
+
tonutils/clients/http/providers/toncenter/__init__.py,sha256=PSzpwMrwcs_LY2Aw5omErjaLSVzy_9LB5EpRjtITyTs,81
|
|
41
|
+
tonutils/clients/http/providers/toncenter/models.py,sha256=ZPx6EhjhrNWFMWF_055EIolMwaLfQAGio0fqTUmljy8,2397
|
|
42
|
+
tonutils/clients/http/providers/toncenter/provider.py,sha256=QoNrobRgytG0Gc9Lo-QXrdMCtyJk1rOS-B2nPzGwaV0,3391
|
|
43
|
+
tonutils/contracts/__init__.py,sha256=KZm3_rQwoY0kO6zFGpPcjrN9XBTjDDvpB2dfaHjwjjw,9561
|
|
44
|
+
tonutils/contracts/base.py,sha256=7AVjsBmcM30Y1fKIIKMVXGr58ZmMfpublunecsSn2W4,10521
|
|
45
|
+
tonutils/contracts/codes.py,sha256=1Sbbs_izHZHd-i1cjWHRP8VN3Xc2BDPr4pnjojj6mZc,37741
|
|
46
|
+
tonutils/contracts/opcodes.py,sha256=niPd-pDmtXiEpYX8xvorFmd7O4vkY0i8nX71e3iaJ1s,1001
|
|
47
|
+
tonutils/contracts/protocol.py,sha256=WLqDUmcgHGRYlKQWQGDWm-2pI2L9iTYg4tAxsehPNLE,6210
|
|
48
|
+
tonutils/contracts/versions.py,sha256=V1rJECQSQuAVYwDmXl4lZzLzDeqZ9OChOgipzAlTPQE,1705
|
|
49
|
+
tonutils/contracts/dns/__init__.py,sha256=H57OtOeohbQlcNTHZS5YI7wtZjlqlpKg4wVso2kPRrU,987
|
|
50
|
+
tonutils/contracts/dns/collection.py,sha256=wSpKGOyCnmXBq1IITjjq5oOt2OZO3u5ckibDcacbJ9I,3089
|
|
51
|
+
tonutils/contracts/dns/item.py,sha256=H0kyZ8h4Aq8ybRLhqJdMj4YzGY6I1F_bDQrfn8BUt8Y,2998
|
|
52
|
+
tonutils/contracts/dns/methods.py,sha256=92AsZBOVqCjgRRRqZHbC_jWT3mJReQjijLnPx0aWRPY,4823
|
|
53
|
+
tonutils/contracts/dns/tlb.py,sha256=e0kQQ-yoXH3ptg4-42mWQqLVspjUHBsGQiV7bpARyxc,18352
|
|
54
|
+
tonutils/contracts/jetton/__init__.py,sha256=q4veZ0vA5OgonorVxcrZ2pZm4c6uoITfUcuRcBhnHR4,1895
|
|
55
|
+
tonutils/contracts/jetton/master.py,sha256=iYlEmhyLp1Dquwam4Hh6AIPIW5PV3tCUVN4zSjjHDTg,9917
|
|
56
|
+
tonutils/contracts/jetton/methods.py,sha256=gLIdMSDUhoprHDRV1EZ87BnMVqUhKUM9XaUZ_Z1Jwms,5479
|
|
57
|
+
tonutils/contracts/jetton/tlb.py,sha256=Bv0-8cmqxnGVyik60hu-zpQ8KJoSnL4Y5WK7eflfKhI,29341
|
|
58
|
+
tonutils/contracts/jetton/wallet.py,sha256=mhTcGucqEIgjHNaL4ee8vcv944zNFvMsA6AhaWZMUGk,2464
|
|
59
|
+
tonutils/contracts/nft/__init__.py,sha256=Oyhr6dVKcJuFxUV2hH62ehtaPlXXAsaNKbskdecEvec,2183
|
|
60
|
+
tonutils/contracts/nft/collection.py,sha256=EIAPs5gF_HW7tev1rNRCELRyVcxcNvgPVetF7Exa5O0,3086
|
|
61
|
+
tonutils/contracts/nft/item.py,sha256=zNCbHgykIPL0mn8eIcFbdFA2ZiGEXjaE2MgiS4flnuI,3746
|
|
62
|
+
tonutils/contracts/nft/methods.py,sha256=tpwGcUnhqDUZk3UOwvkrIwh2gqmLQvNv-fRLvyQ9_DM,9913
|
|
63
|
+
tonutils/contracts/nft/tlb.py,sha256=cUM5NVQg3RzzEnvNGsEK_dHjPxd7vFN39xPUi-OcJYM,36671
|
|
64
|
+
tonutils/contracts/telegram/__init__.py,sha256=nr0O0rzr2UJu1KrtrqbBqLOuUfMSLSWo4Iam5N76uak,1051
|
|
65
|
+
tonutils/contracts/telegram/collection.py,sha256=CM3T_8eWmrO_Ovq-crZgesfJ4h6JV4DhyggjV6nBY-U,3925
|
|
66
|
+
tonutils/contracts/telegram/item.py,sha256=DhNs5WFjhI1vqMfUg-cm311JTIvSaznc3aTqtLOCr9w,3887
|
|
67
|
+
tonutils/contracts/telegram/methods.py,sha256=rcZsEYTDwbT92NFhBhs-8TYruQWmxYgF6KElvaRnJPg,4403
|
|
68
|
+
tonutils/contracts/telegram/tlb.py,sha256=QRYijGDT0YGjRRjYiHjbgyeSxMP9RiSmRvmdhh6itS4,17848
|
|
69
|
+
tonutils/contracts/vanity/__init__.py,sha256=6LvJQxpmtrE3-ju44IsrkYQTx4HSq8nRb3fLyJFwrgE,288
|
|
70
|
+
tonutils/contracts/vanity/models.py,sha256=B6W1TN4CyrMs4SfBDAjuQ8QP-wn5QFhNpcSzO99DCbY,815
|
|
71
|
+
tonutils/contracts/vanity/tlb.py,sha256=gcNYEGPWMUHYbg_Je9QbBUlmVXF5RmobL-FoCMCF1HA,1078
|
|
72
|
+
tonutils/contracts/vanity/vanity.py,sha256=uYH1zybcOTQQBPciUFxAS6wksBwawKx06YES2tLuguI,1242
|
|
73
|
+
tonutils/contracts/wallet/__init__.py,sha256=Ho3-3C09JNk53ySnQaUnNscchfCtbUdyA2kpWAFzOf4,3295
|
|
74
|
+
tonutils/contracts/wallet/base.py,sha256=hKkvbeL4uG165k4_iWR4CjIUQsAtaUgQh9hwt1ZcUY8,15960
|
|
75
|
+
tonutils/contracts/wallet/configs.py,sha256=yQfuCEGL_fBuc5qGJ93rPIUATTR8V1wpYscgrWb7cEQ,4082
|
|
76
|
+
tonutils/contracts/wallet/messages.py,sha256=jUHQyejAS1x9uMzDW6BArifCmniODebxwrTSxceDgT4,13904
|
|
77
|
+
tonutils/contracts/wallet/methods.py,sha256=x7aPt71v3PUFNYHStWQrjLK7_SWPC2MiTG0c15X5TRI,10732
|
|
78
|
+
tonutils/contracts/wallet/params.py,sha256=hqinZJmhWiZUywDcmolvRxB0HYJgMAPDWYJiTmgjZ7w,4569
|
|
79
|
+
tonutils/contracts/wallet/protocol.py,sha256=DCu3CNbcZJ_wwROEK3GlpnwxNY2ZLdE0D2Z23WiyVDY,6200
|
|
80
|
+
tonutils/contracts/wallet/tlb.py,sha256=rS1oZJ6jvi7zGOuPPN6S7RajQaLaUsMm-VqO09dys8I,21871
|
|
81
|
+
tonutils/contracts/wallet/versions/__init__.py,sha256=DOHAEpx1mOlHdyTg2K0Mj8ZkcjabSdpLvIQY9_Pk6gw,592
|
|
82
|
+
tonutils/contracts/wallet/versions/hw.py,sha256=9kc_mlCegBo1O4_MvRQGLE3ZqLHsvqGN2F1IgnJeBOE,8348
|
|
83
|
+
tonutils/contracts/wallet/versions/pp.py,sha256=QfTqd4TAJHFMuatIwe0lg80uixno2JqSZFmQboxhca0,3793
|
|
84
|
+
tonutils/contracts/wallet/versions/v1.py,sha256=BYRWXdM0OlSeCfayHAUBj_wM4bb3WTVYoI-pPWDJD64,2881
|
|
85
|
+
tonutils/contracts/wallet/versions/v2.py,sha256=pwrlan-utZo_WmnzDwSbnzV8ibkPEWx2WU1uOjkdrrA,2452
|
|
86
|
+
tonutils/contracts/wallet/versions/v3.py,sha256=d7cM8wjmW-1H7jGuY3AuUd7eTY3wq9ZYpJ4f5OeYX08,2470
|
|
87
|
+
tonutils/contracts/wallet/versions/v4.py,sha256=2sAsjJ8_3oYAj5JwWH3PiMyoGbgl6-f7-p6T5X7MGTI,2713
|
|
88
|
+
tonutils/contracts/wallet/versions/v5.py,sha256=1J6KXPOc7Q5S5EdFM9WXQzNGRZrw5EgxDZ9dmyHwsXE,8890
|
|
89
|
+
tonutils-2.0.1b3.dist-info/licenses/LICENSE,sha256=fG-yM-8DSkOTaJ558P7uF5PNXBmineVO9-HC12YbIxs,1060
|
|
90
|
+
tonutils-2.0.1b3.dist-info/METADATA,sha256=pG9mZCq1liFBJPKDuPuqP_HPlADYa8AZ6ndFibrNuEM,4279
|
|
91
|
+
tonutils-2.0.1b3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
92
|
+
tonutils-2.0.1b3.dist-info/top_level.txt,sha256=-7H_mGl8S9HKQrkUiTLmEbtMM-knzRzd_a0cZZnuZIU,9
|
|
93
|
+
tonutils-2.0.1b3.dist-info/RECORD,,
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import asyncio
|
|
4
|
-
|
|
5
|
-
from pyapiq.limiter import AsyncLimiter
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class PriorityLimiter(AsyncLimiter):
|
|
9
|
-
"""
|
|
10
|
-
Token-bucket limiter with priority scheduling.
|
|
11
|
-
|
|
12
|
-
Extends AsyncLimiter by allowing priority acquisitions that bypass
|
|
13
|
-
normal waiters while still respecting rate limits.
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
def __init__(self, max_rate: int, time_period: float) -> None:
|
|
17
|
-
"""
|
|
18
|
-
Initialize priority-aware limiter.
|
|
19
|
-
|
|
20
|
-
:param max_rate: Maximum number of operations allowed in the window
|
|
21
|
-
:param time_period: Time window length in seconds
|
|
22
|
-
"""
|
|
23
|
-
super().__init__(max_rate, time_period)
|
|
24
|
-
self._prio_waiters = 0
|
|
25
|
-
|
|
26
|
-
async def acquire(self, priority: bool = False) -> None:
|
|
27
|
-
"""
|
|
28
|
-
Acquire a limiter token.
|
|
29
|
-
|
|
30
|
-
Priority requests are allowed to skip regular waiters when
|
|
31
|
-
tokens become available.
|
|
32
|
-
|
|
33
|
-
:param priority: Whether this acquisition request has priority
|
|
34
|
-
"""
|
|
35
|
-
if priority:
|
|
36
|
-
async with self._lock:
|
|
37
|
-
self._prio_waiters += 1
|
|
38
|
-
|
|
39
|
-
try:
|
|
40
|
-
while True:
|
|
41
|
-
# noinspection PyUnresolvedReferences
|
|
42
|
-
async with self._lock:
|
|
43
|
-
self._refill()
|
|
44
|
-
if self._tokens >= 1:
|
|
45
|
-
if not priority and self._prio_waiters > 0:
|
|
46
|
-
delay = self._time_period / self._max_rate
|
|
47
|
-
else:
|
|
48
|
-
self._tokens -= 1
|
|
49
|
-
return
|
|
50
|
-
else:
|
|
51
|
-
delay = self._time_period / self._max_rate
|
|
52
|
-
await asyncio.sleep(delay)
|
|
53
|
-
finally:
|
|
54
|
-
if priority:
|
|
55
|
-
async with self._lock:
|
|
56
|
-
self._prio_waiters -= 1
|
tonutils/clients/adnl/stack.py
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import typing as t
|
|
2
|
-
|
|
3
|
-
from pytoniq_core import Address, Cell, Slice, VmTuple
|
|
4
|
-
|
|
5
|
-
from tonutils.types import StackItem, StackItems
|
|
6
|
-
from tonutils.utils import norm_stack_num, norm_stack_cell
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def decode_stack(items: t.List[t.Any]) -> StackItems:
|
|
10
|
-
"""
|
|
11
|
-
Decode VM stack items into internal Python structures.
|
|
12
|
-
|
|
13
|
-
Supports:
|
|
14
|
-
- int → int
|
|
15
|
-
- Cell/Slice → normalized cell
|
|
16
|
-
- Address → address cell
|
|
17
|
-
- VmTuple/list → recursive decode
|
|
18
|
-
- None → None
|
|
19
|
-
|
|
20
|
-
:param items: Raw VM stack items
|
|
21
|
-
:return: Normalized Python stack values
|
|
22
|
-
"""
|
|
23
|
-
|
|
24
|
-
out: StackItems = []
|
|
25
|
-
for item in items:
|
|
26
|
-
if item is None:
|
|
27
|
-
out.append(None)
|
|
28
|
-
elif isinstance(item, int):
|
|
29
|
-
out.append(norm_stack_num(item))
|
|
30
|
-
elif isinstance(item, Address):
|
|
31
|
-
out.append(item.to_cell())
|
|
32
|
-
elif isinstance(item, (Cell, Slice)):
|
|
33
|
-
out.append(norm_stack_cell(item))
|
|
34
|
-
elif isinstance(item, VmTuple):
|
|
35
|
-
out.append(decode_stack(item.list))
|
|
36
|
-
elif isinstance(item, list):
|
|
37
|
-
out.append(decode_stack(item))
|
|
38
|
-
return out
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def encode_stack(items: t.List[StackItem]) -> t.List[t.Any]:
|
|
42
|
-
"""
|
|
43
|
-
Encode Python stack values into VM-compatible format.
|
|
44
|
-
|
|
45
|
-
Supports:
|
|
46
|
-
- int → int
|
|
47
|
-
- Cell/Slice → cell/slice
|
|
48
|
-
- Address → cell slice
|
|
49
|
-
- list/tuple → recursive encode
|
|
50
|
-
|
|
51
|
-
:param items: Normalized Python stack items
|
|
52
|
-
:return: VM-encoded stack values
|
|
53
|
-
"""
|
|
54
|
-
out: t.List[t.Any] = []
|
|
55
|
-
for item in items:
|
|
56
|
-
if isinstance(item, int):
|
|
57
|
-
out.append(item)
|
|
58
|
-
elif isinstance(item, Address):
|
|
59
|
-
out.append(item.to_cell().to_slice())
|
|
60
|
-
elif isinstance(item, (Cell, Slice)):
|
|
61
|
-
out.append(item)
|
|
62
|
-
elif isinstance(item, (list, tuple)):
|
|
63
|
-
out.append(encode_stack(list(item)))
|
|
64
|
-
return out
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import typing as t
|
|
4
|
-
|
|
5
|
-
from aiohttp import ClientSession
|
|
6
|
-
|
|
7
|
-
from tonutils.clients.http.chainstack.provider import ChainstackHttpProvider
|
|
8
|
-
from tonutils.clients.http.toncenter.client import ToncenterHttpClient
|
|
9
|
-
from tonutils.exceptions import ClientNotConnectedError
|
|
10
|
-
from tonutils.types import NetworkGlobalID
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class ChainstackHttpClient(ToncenterHttpClient):
|
|
14
|
-
"""TON blockchain client using Chainstack HTTP API as transport."""
|
|
15
|
-
|
|
16
|
-
def __init__(
|
|
17
|
-
self,
|
|
18
|
-
*,
|
|
19
|
-
network: NetworkGlobalID = NetworkGlobalID.MAINNET,
|
|
20
|
-
http_provider_url: str,
|
|
21
|
-
timeout: int = 10,
|
|
22
|
-
session: t.Optional[ClientSession] = None,
|
|
23
|
-
rps_limit: t.Optional[int] = None,
|
|
24
|
-
rps_period: float = 1.0,
|
|
25
|
-
rps_retries: int = 2,
|
|
26
|
-
) -> None:
|
|
27
|
-
"""
|
|
28
|
-
Initialize Chainstack HTTP client.
|
|
29
|
-
|
|
30
|
-
:param network: Target TON network (mainnet or testnet)
|
|
31
|
-
:param http_provider_url: Chainstack TON HTTP endpoint URL
|
|
32
|
-
You can obtain a personal endpoint on the Chainstack website: https://chainstack.com/
|
|
33
|
-
:param timeout: HTTP request timeout in seconds
|
|
34
|
-
:param session: Optional externally managed aiohttp.ClientSession
|
|
35
|
-
:param rps_limit: Optional requests-per-second limit
|
|
36
|
-
:param rps_period: Time window in seconds for rate limiting
|
|
37
|
-
:param rps_retries: Number of retries on rate limiting
|
|
38
|
-
"""
|
|
39
|
-
super().__init__(network=network)
|
|
40
|
-
self._provider: ChainstackHttpProvider = ChainstackHttpProvider(
|
|
41
|
-
network=network,
|
|
42
|
-
http_provider_url=http_provider_url,
|
|
43
|
-
timeout=timeout,
|
|
44
|
-
session=session,
|
|
45
|
-
rps_limit=rps_limit,
|
|
46
|
-
rps_period=rps_period,
|
|
47
|
-
rps_retries=rps_retries,
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
@property
|
|
51
|
-
def provider(self) -> ChainstackHttpProvider:
|
|
52
|
-
"""
|
|
53
|
-
Underlying Chainstack HTTP provider.
|
|
54
|
-
|
|
55
|
-
:return: ChainstackHttpProvider instance used for HTTP requests
|
|
56
|
-
"""
|
|
57
|
-
if not self.is_connected:
|
|
58
|
-
raise ClientNotConnectedError(self)
|
|
59
|
-
return self._provider
|
|
60
|
-
|
|
61
|
-
async def __aenter__(self) -> ChainstackHttpClient:
|
|
62
|
-
await self._provider.__aenter__()
|
|
63
|
-
return self
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import typing as t
|
|
2
|
-
|
|
3
|
-
from aiohttp import ClientSession
|
|
4
|
-
|
|
5
|
-
from tonutils.clients.http.toncenter.provider import ToncenterHttpProvider
|
|
6
|
-
from tonutils.types import NetworkGlobalID
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class ChainstackHttpProvider(ToncenterHttpProvider):
|
|
10
|
-
"""Low-level HTTP provider for Chainstack API."""
|
|
11
|
-
|
|
12
|
-
version = ""
|
|
13
|
-
|
|
14
|
-
def __init__(
|
|
15
|
-
self,
|
|
16
|
-
network: NetworkGlobalID,
|
|
17
|
-
http_provider_url: str,
|
|
18
|
-
timeout: int = 10,
|
|
19
|
-
session: t.Optional[ClientSession] = None,
|
|
20
|
-
rps_limit: t.Optional[int] = None,
|
|
21
|
-
rps_period: t.Optional[float] = None,
|
|
22
|
-
rps_retries: t.Optional[int] = None,
|
|
23
|
-
) -> None:
|
|
24
|
-
"""
|
|
25
|
-
Initialize Chainstack HTTP provider.
|
|
26
|
-
|
|
27
|
-
:param network: TON network selector (mainnet/testnet)
|
|
28
|
-
:param http_provider_url: Chainstack TON HTTP endpoint URL
|
|
29
|
-
You can obtain a personal endpoint on the Chainstack website: https://chainstack.com/
|
|
30
|
-
:param timeout: HTTP request timeout in seconds
|
|
31
|
-
:param session: Optional aiohttp.ClientSession, external or auto-created
|
|
32
|
-
:param rps_limit: Requests-per-second rate limit
|
|
33
|
-
:param rps_period: Time period window for rate limiting
|
|
34
|
-
:param rps_retries: Number of retries on rate-limit errors
|
|
35
|
-
"""
|
|
36
|
-
super().__init__(
|
|
37
|
-
network=network,
|
|
38
|
-
base_url=http_provider_url,
|
|
39
|
-
timeout=timeout,
|
|
40
|
-
session=session,
|
|
41
|
-
rps_limit=rps_limit,
|
|
42
|
-
rps_period=rps_period,
|
|
43
|
-
rps_retries=rps_retries,
|
|
44
|
-
)
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import typing as t
|
|
4
|
-
|
|
5
|
-
from aiohttp import ClientSession
|
|
6
|
-
|
|
7
|
-
from tonutils.clients.http.quicknode.provider import QuicknodeHttpProvider
|
|
8
|
-
from tonutils.clients.http.toncenter.client import ToncenterHttpClient
|
|
9
|
-
from tonutils.exceptions import ClientNotConnectedError
|
|
10
|
-
from tonutils.types import NetworkGlobalID
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class QuicknodeHttpClient(ToncenterHttpClient):
|
|
14
|
-
"""TON blockchain client using Quicknode HTTP API as transport."""
|
|
15
|
-
|
|
16
|
-
def __init__(
|
|
17
|
-
self,
|
|
18
|
-
*,
|
|
19
|
-
http_provider_url: str,
|
|
20
|
-
timeout: int = 10,
|
|
21
|
-
session: t.Optional[ClientSession] = None,
|
|
22
|
-
rps_limit: t.Optional[int] = None,
|
|
23
|
-
rps_period: float = 1.0,
|
|
24
|
-
rps_retries: int = 2,
|
|
25
|
-
) -> None:
|
|
26
|
-
"""
|
|
27
|
-
Initialize QuickNode HTTP client.
|
|
28
|
-
|
|
29
|
-
:param http_provider_url: QuickNode TON HTTP endpoint URL.
|
|
30
|
-
You can obtain a personal endpoint on the QuickNode website: https://www.quicknode.com/
|
|
31
|
-
:param timeout: HTTP request timeout in seconds
|
|
32
|
-
:param session: Optional externally managed aiohttp.ClientSession
|
|
33
|
-
:param rps_limit: Optional requests-per-second limit
|
|
34
|
-
:param rps_period: Time window in seconds for rate limiting
|
|
35
|
-
:param rps_retries: Number of retries on rate limiting
|
|
36
|
-
"""
|
|
37
|
-
super().__init__(network=NetworkGlobalID.MAINNET)
|
|
38
|
-
self._provider: QuicknodeHttpProvider = QuicknodeHttpProvider(
|
|
39
|
-
http_provider_url=http_provider_url,
|
|
40
|
-
timeout=timeout,
|
|
41
|
-
session=session,
|
|
42
|
-
rps_limit=rps_limit,
|
|
43
|
-
rps_period=rps_period,
|
|
44
|
-
rps_retries=rps_retries,
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
@property
|
|
48
|
-
def provider(self) -> QuicknodeHttpProvider:
|
|
49
|
-
"""
|
|
50
|
-
Underlying QuickNode HTTP provider.
|
|
51
|
-
|
|
52
|
-
:return: QuicknodeHttpProvider instance used for HTTP requests
|
|
53
|
-
"""
|
|
54
|
-
if not self.is_connected:
|
|
55
|
-
raise ClientNotConnectedError(self)
|
|
56
|
-
return self._provider
|
|
57
|
-
|
|
58
|
-
async def __aenter__(self) -> QuicknodeHttpClient:
|
|
59
|
-
await self._provider.__aenter__()
|
|
60
|
-
return self
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import typing as t
|
|
2
|
-
|
|
3
|
-
from aiohttp import ClientSession
|
|
4
|
-
|
|
5
|
-
from tonutils.clients.http.toncenter.provider import ToncenterHttpProvider
|
|
6
|
-
from tonutils.types import NetworkGlobalID
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class QuicknodeHttpProvider(ToncenterHttpProvider):
|
|
10
|
-
"""Low-level HTTP provider for Quicknode API."""
|
|
11
|
-
|
|
12
|
-
version = ""
|
|
13
|
-
|
|
14
|
-
def __init__(
|
|
15
|
-
self,
|
|
16
|
-
http_provider_url: str,
|
|
17
|
-
timeout: int = 10,
|
|
18
|
-
session: t.Optional[ClientSession] = None,
|
|
19
|
-
rps_limit: t.Optional[int] = None,
|
|
20
|
-
rps_period: t.Optional[float] = None,
|
|
21
|
-
rps_retries: t.Optional[int] = None,
|
|
22
|
-
) -> None:
|
|
23
|
-
"""
|
|
24
|
-
Initialize QuickNode HTTP provider.
|
|
25
|
-
|
|
26
|
-
:param http_provider_url: QuickNode TON HTTP endpoint URL.
|
|
27
|
-
You can obtain a personal endpoint on the QuickNode website: https://www.quicknode.com/
|
|
28
|
-
:param timeout: HTTP request timeout in seconds
|
|
29
|
-
:param session: Optional aiohttp.ClientSession, external or auto-created
|
|
30
|
-
:param rps_limit: Requests-per-second rate limit
|
|
31
|
-
:param rps_period: Time period window for rate limiting
|
|
32
|
-
:param rps_retries: Number of retries on rate-limit errors
|
|
33
|
-
"""
|
|
34
|
-
super().__init__(
|
|
35
|
-
network=NetworkGlobalID.MAINNET,
|
|
36
|
-
base_url=http_provider_url,
|
|
37
|
-
timeout=timeout,
|
|
38
|
-
session=session,
|
|
39
|
-
rps_limit=rps_limit,
|
|
40
|
-
rps_period=rps_period,
|
|
41
|
-
rps_retries=rps_retries,
|
|
42
|
-
)
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import typing as t
|
|
4
|
-
|
|
5
|
-
from aiohttp import ClientSession
|
|
6
|
-
|
|
7
|
-
from tonutils.clients.http.tatum.provider import TatumHttpProvider
|
|
8
|
-
from tonutils.clients.http.toncenter.client import ToncenterHttpClient
|
|
9
|
-
from tonutils.exceptions import ClientNotConnectedError
|
|
10
|
-
from tonutils.types import NetworkGlobalID
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class TatumHttpClient(ToncenterHttpClient):
|
|
14
|
-
"""TON blockchain client using Tatum HTTP API as transport."""
|
|
15
|
-
|
|
16
|
-
def __init__(
|
|
17
|
-
self,
|
|
18
|
-
*,
|
|
19
|
-
network: NetworkGlobalID = NetworkGlobalID.MAINNET,
|
|
20
|
-
api_key: str,
|
|
21
|
-
base_url: t.Optional[str] = None,
|
|
22
|
-
timeout: int = 10,
|
|
23
|
-
session: t.Optional[ClientSession] = None,
|
|
24
|
-
rps_limit: t.Optional[int] = None,
|
|
25
|
-
rps_period: float = 1.0,
|
|
26
|
-
rps_retries: int = 2,
|
|
27
|
-
) -> None:
|
|
28
|
-
"""
|
|
29
|
-
Initialize Tatum HTTP client.
|
|
30
|
-
|
|
31
|
-
:param network: Target TON network (mainnet or testnet)
|
|
32
|
-
:param api_key: Tatum API key
|
|
33
|
-
You can get an API key on the Tatum website: https://tatum.io/
|
|
34
|
-
:param base_url: Optional custom Tatum base URL
|
|
35
|
-
:param timeout: HTTP request timeout in seconds
|
|
36
|
-
:param session: Optional externally managed aiohttp.ClientSession
|
|
37
|
-
:param rps_limit: Optional requests-per-second limit
|
|
38
|
-
:param rps_period: Time window in seconds for rate limiting
|
|
39
|
-
:param rps_retries: Number of retries on rate limiting
|
|
40
|
-
"""
|
|
41
|
-
super().__init__(network=network)
|
|
42
|
-
self._provider: TatumHttpProvider = TatumHttpProvider(
|
|
43
|
-
api_key=api_key,
|
|
44
|
-
network=network,
|
|
45
|
-
base_url=base_url,
|
|
46
|
-
timeout=timeout,
|
|
47
|
-
session=session,
|
|
48
|
-
rps_limit=rps_limit,
|
|
49
|
-
rps_period=rps_period,
|
|
50
|
-
rps_retries=rps_retries,
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
@property
|
|
54
|
-
def provider(self) -> TatumHttpProvider:
|
|
55
|
-
"""
|
|
56
|
-
Underlying Tatum HTTP provider.
|
|
57
|
-
|
|
58
|
-
:return: TatumHttpProvider instance used for HTTP requests
|
|
59
|
-
"""
|
|
60
|
-
if not self.is_connected:
|
|
61
|
-
raise ClientNotConnectedError(self)
|
|
62
|
-
return self._provider
|
|
63
|
-
|
|
64
|
-
async def __aenter__(self) -> TatumHttpClient:
|
|
65
|
-
await self._provider.__aenter__()
|
|
66
|
-
return self
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import typing as t
|
|
2
|
-
|
|
3
|
-
from aiohttp import ClientSession
|
|
4
|
-
|
|
5
|
-
from tonutils.clients.http.toncenter.provider import ToncenterHttpProvider
|
|
6
|
-
from tonutils.types import NetworkGlobalID
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class TatumHttpProvider(ToncenterHttpProvider):
|
|
10
|
-
"""Low-level HTTP provider for Tatum API."""
|
|
11
|
-
|
|
12
|
-
version = ""
|
|
13
|
-
|
|
14
|
-
def __init__(
|
|
15
|
-
self,
|
|
16
|
-
network: NetworkGlobalID,
|
|
17
|
-
api_key: str,
|
|
18
|
-
base_url: t.Optional[str] = None,
|
|
19
|
-
timeout: int = 10,
|
|
20
|
-
session: t.Optional[ClientSession] = None,
|
|
21
|
-
rps_limit: t.Optional[int] = None,
|
|
22
|
-
rps_period: t.Optional[float] = None,
|
|
23
|
-
rps_retries: t.Optional[int] = None,
|
|
24
|
-
) -> None:
|
|
25
|
-
"""
|
|
26
|
-
Initialize Tatum HTTP provider.
|
|
27
|
-
|
|
28
|
-
:param network: TON network selector (mainnet/testnet)
|
|
29
|
-
:param api_key: Tatum API key
|
|
30
|
-
You can get an API key on the Tatum website: https://tatum.io/
|
|
31
|
-
:param base_url: Custom Tatum base URL, overrides default if provided
|
|
32
|
-
:param timeout: HTTP request timeout in seconds
|
|
33
|
-
:param session: Optional aiohttp.ClientSession, external or auto-created
|
|
34
|
-
:param rps_limit: Requests-per-second rate limit
|
|
35
|
-
:param rps_period: Time period window for rate limiting
|
|
36
|
-
:param rps_retries: Number of retries on rate-limit errors
|
|
37
|
-
"""
|
|
38
|
-
urls = {
|
|
39
|
-
NetworkGlobalID.MAINNET: "https://ton-mainnet.gateway.tatum.io",
|
|
40
|
-
NetworkGlobalID.TESTNET: "https://ton-testnet.gateway.tatum.io",
|
|
41
|
-
}
|
|
42
|
-
base_url = base_url or urls.get(network)
|
|
43
|
-
|
|
44
|
-
super().__init__(
|
|
45
|
-
api_key=api_key,
|
|
46
|
-
network=network,
|
|
47
|
-
base_url=base_url,
|
|
48
|
-
timeout=timeout,
|
|
49
|
-
session=session,
|
|
50
|
-
rps_limit=rps_limit,
|
|
51
|
-
rps_period=rps_period,
|
|
52
|
-
rps_retries=rps_retries,
|
|
53
|
-
)
|