tonutils 0.5.5__tar.gz → 0.5.6__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.
Files changed (137) hide show
  1. {tonutils-0.5.5/tonutils.egg-info → tonutils-0.5.6}/PKG-INFO +1 -1
  2. {tonutils-0.5.5 → tonutils-0.5.6}/pyproject.toml +1 -1
  3. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/client/_base.py +23 -5
  4. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/client/quicknode.py +13 -1
  5. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/client/tatum.py +8 -0
  6. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/client/tonapi.py +7 -0
  7. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/client/toncenter.py +13 -0
  8. {tonutils-0.5.5 → tonutils-0.5.6/tonutils.egg-info}/PKG-INFO +1 -1
  9. {tonutils-0.5.5 → tonutils-0.5.6}/LICENSE +0 -0
  10. {tonutils-0.5.5 → tonutils-0.5.6}/README.md +0 -0
  11. {tonutils-0.5.5 → tonutils-0.5.6}/setup.cfg +0 -0
  12. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/__init__.py +0 -0
  13. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/account.py +0 -0
  14. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/cache.py +0 -0
  15. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/client/__init__.py +0 -0
  16. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/client/lite.py +0 -0
  17. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/client/utils.py +0 -0
  18. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/contract.py +0 -0
  19. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/dns/__init__.py +0 -0
  20. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/dns/categories.py +0 -0
  21. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/dns/contract.py +0 -0
  22. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/dns/op_codes.py +0 -0
  23. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/dns/subdomain_collection/__init__.py +0 -0
  24. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/dns/subdomain_collection/content.py +0 -0
  25. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/dns/subdomain_collection/contract.py +0 -0
  26. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/dns/subdomain_collection/data.py +0 -0
  27. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/dns/subdomain_collection/op_codes.py +0 -0
  28. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/dns/subdomain_manager/__init__.py +0 -0
  29. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/dns/subdomain_manager/contract.py +0 -0
  30. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/dns/subdomain_manager/data.py +0 -0
  31. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/dns/subdomain_manager/op_codes.py +0 -0
  32. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/dns/utils.py +0 -0
  33. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/exceptions.py +0 -0
  34. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/__init__.py +0 -0
  35. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/content.py +0 -0
  36. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/contract/__init__.py +0 -0
  37. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/contract/base/__init__.py +0 -0
  38. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/contract/base/master.py +0 -0
  39. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/contract/stablecoin/__init__.py +0 -0
  40. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/contract/stablecoin/master.py +0 -0
  41. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/contract/stablecoin/op_codes.py +0 -0
  42. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/contract/stablecoin/wallet.py +0 -0
  43. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/contract/standard/__init__.py +0 -0
  44. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/contract/standard/master.py +0 -0
  45. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/contract/standard/op_codes.py +0 -0
  46. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/contract/standard/wallet.py +0 -0
  47. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/data.py +0 -0
  48. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/__init__.py +0 -0
  49. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/dedust/__init__.py +0 -0
  50. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/dedust/constants.py +0 -0
  51. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/dedust/factory.py +0 -0
  52. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/__init__.py +0 -0
  53. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/utils.py +0 -0
  54. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/v1/__init__.py +0 -0
  55. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/v1/pton/__init__.py +0 -0
  56. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/v1/pton/constants.py +0 -0
  57. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/v1/pton/pton.py +0 -0
  58. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/v1/router/__init__.py +0 -0
  59. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/v1/router/constants.py +0 -0
  60. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/v1/router/router.py +0 -0
  61. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/v2/__init__.py +0 -0
  62. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/v2/pton/__init__.py +0 -0
  63. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/v2/pton/constants.py +0 -0
  64. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/v2/pton/pton.py +0 -0
  65. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/v2/router/__init__.py +0 -0
  66. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/v2/router/constants.py +0 -0
  67. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/jetton/dex/stonfi/v2/router/router.py +0 -0
  68. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/__init__.py +0 -0
  69. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/content.py +0 -0
  70. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/contract/__init__.py +0 -0
  71. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/contract/base/__init__.py +0 -0
  72. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/contract/base/collection.py +0 -0
  73. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/contract/base/nft.py +0 -0
  74. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/contract/editable/__init__.py +0 -0
  75. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/contract/editable/collection.py +0 -0
  76. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/contract/editable/nft.py +0 -0
  77. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/contract/soulbound/__init__.py +0 -0
  78. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/contract/soulbound/collection.py +0 -0
  79. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/contract/soulbound/nft.py +0 -0
  80. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/contract/standard/__init__.py +0 -0
  81. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/contract/standard/collection.py +0 -0
  82. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/contract/standard/nft.py +0 -0
  83. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/data.py +0 -0
  84. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/marketplace/__init__.py +0 -0
  85. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/marketplace/getgems/__init__.py +0 -0
  86. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/marketplace/getgems/addresses.py +0 -0
  87. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/marketplace/getgems/contract/__init__.py +0 -0
  88. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/marketplace/getgems/contract/salev3r3.py +0 -0
  89. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/marketplace/getgems/data.py +0 -0
  90. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/marketplace/getgems/op_codes.py +0 -0
  91. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/op_codes.py +0 -0
  92. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/nft/royalty_params.py +0 -0
  93. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/py.typed +0 -0
  94. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/__init__.py +0 -0
  95. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/connector.py +0 -0
  96. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/models/__init__.py +0 -0
  97. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/models/account.py +0 -0
  98. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/models/chain.py +0 -0
  99. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/models/device.py +0 -0
  100. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/models/event.py +0 -0
  101. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/models/proof.py +0 -0
  102. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/models/request.py +0 -0
  103. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/models/wallet.py +0 -0
  104. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/provider/__init__.py +0 -0
  105. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/provider/bridge.py +0 -0
  106. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/provider/session.py +0 -0
  107. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/storage/__init__.py +0 -0
  108. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/storage/base.py +0 -0
  109. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/storage/default.py +0 -0
  110. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/tonconnect.py +0 -0
  111. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/utils/__init__.py +0 -0
  112. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/utils/exceptions.py +0 -0
  113. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/utils/logger.py +0 -0
  114. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/utils/verifiers.py +0 -0
  115. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/utils/wallet_manager.py +0 -0
  116. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/tonconnect/utils/wallets_data.py +0 -0
  117. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/utils.py +0 -0
  118. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/vanity/__init__.py +0 -0
  119. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/vanity/contract.py +0 -0
  120. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/vanity/data.py +0 -0
  121. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/wallet/__init__.py +0 -0
  122. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/wallet/contract/__init__.py +0 -0
  123. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/wallet/contract/_base.py +0 -0
  124. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/wallet/contract/highload.py +0 -0
  125. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/wallet/contract/preprocessed.py +0 -0
  126. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/wallet/contract/v2.py +0 -0
  127. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/wallet/contract/v3.py +0 -0
  128. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/wallet/contract/v4.py +0 -0
  129. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/wallet/contract/v5.py +0 -0
  130. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/wallet/data.py +0 -0
  131. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/wallet/messages.py +0 -0
  132. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/wallet/op_codes.py +0 -0
  133. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils/wallet/utils.py +0 -0
  134. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils.egg-info/SOURCES.txt +0 -0
  135. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils.egg-info/dependency_links.txt +0 -0
  136. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils.egg-info/requires.txt +0 -0
  137. {tonutils-0.5.5 → tonutils-0.5.6}/tonutils.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tonutils
3
- Version: 0.5.5
3
+ Version: 0.5.6
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
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tonutils"
7
- version = "0.5.5"
7
+ version = "0.5.6"
8
8
  authors = [
9
9
  { name = "nessshon" },
10
10
  ]
@@ -3,7 +3,8 @@ from __future__ import annotations
3
3
  import asyncio
4
4
  import json
5
5
  import random
6
- from typing import Any, Optional, List, Dict, Union
6
+ from typing import Any, Optional, List, Dict, Union, AsyncGenerator
7
+ from contextlib import asynccontextmanager
7
8
 
8
9
  import aiohttp
9
10
  from aiolimiter import AsyncLimiter
@@ -27,6 +28,7 @@ class Client:
27
28
  self.rps = kwargs.get("rps", 1)
28
29
  self.max_retries = kwargs.get("max_retries", 0)
29
30
 
31
+ self._session: aiohttp.ClientSession = kwargs.get("session", None)
30
32
  self._limiter = AsyncLimiter(
31
33
  max_rate=self.rps,
32
34
  time_period=1,
@@ -86,6 +88,24 @@ class Client:
86
88
  seconds = retry_after + random.uniform(0.2, 0.5)
87
89
  await asyncio.sleep(seconds)
88
90
 
91
+ @asynccontextmanager
92
+ async def _get_session(self) -> AsyncGenerator[aiohttp.ClientSession, None]:
93
+ if self._session:
94
+ yield self._session
95
+ else:
96
+ async with aiohttp.ClientSession(
97
+ timeout=aiohttp.ClientTimeout(total=self.timeout)
98
+ ) as session:
99
+ yield session
100
+
101
+ async def close_session(self) -> None:
102
+ """
103
+ Close the aiohttp session if it was created by the client.
104
+ """
105
+ if self._session:
106
+ await self._session.close()
107
+ self._session = None
108
+
89
109
  async def _request(
90
110
  self,
91
111
  method: str,
@@ -114,14 +134,12 @@ class Client:
114
134
  await self._limiter.acquire()
115
135
 
116
136
  try:
117
- async with aiohttp.ClientSession(
118
- headers=self.headers,
119
- timeout=aiohttp.ClientTimeout(total=self.timeout)
120
- ) as session:
137
+ async with self._get_session() as session:
121
138
  async with session.request(
122
139
  method=method,
123
140
  url=url,
124
141
  params=params,
142
+ headers=self.headers,
125
143
  json=body,
126
144
  ) as response:
127
145
  content = await self._parse_response(response)
@@ -1,5 +1,7 @@
1
1
  from typing import Optional
2
2
 
3
+ from aiohttp import ClientSession
4
+
3
5
  from .toncenter import ToncenterV2Client
4
6
 
5
7
 
@@ -17,6 +19,8 @@ class QuicknodeClient(ToncenterV2Client):
17
19
  http_provider_url: str,
18
20
  rps: Optional[int] = None,
19
21
  max_retries: int = 1,
22
+ timeout: Optional[int] = 10,
23
+ session: Optional[ClientSession] = None,
20
24
  ) -> None:
21
25
  """
22
26
  Initialize the QuicknodeClient.
@@ -25,9 +29,17 @@ class QuicknodeClient(ToncenterV2Client):
25
29
  You can obtain one at: https://quicknode.com
26
30
  :param rps: Optional requests per second (RPS) limit.
27
31
  :param max_retries: Number of retries for rate-limited requests. Defaults to 1.
32
+ :param timeout: Response timeout in seconds. Not used if session is specified. Defaults to 10.
33
+ :param session: Aiohttp session to avoid creating new ones every time. By default, a new one is created for each request. If specified, remember to call session_close when finished.
28
34
  """
29
35
  if not http_provider_url:
30
36
  raise ValueError("`http_provider_url` is required to initialize QuicknodeClient")
31
37
 
32
38
  base_url = http_provider_url.rstrip("/") + self.API_VERSION_PATH
33
- super().__init__(base_url=base_url, rps=rps, max_retries=max_retries)
39
+ super().__init__(
40
+ base_url=base_url,
41
+ rps=rps,
42
+ max_retries=max_retries,
43
+ timeout=timeout,
44
+ session=session,
45
+ )
@@ -1,5 +1,7 @@
1
1
  from typing import Optional
2
2
 
3
+ from aiohttp import ClientSession
4
+
3
5
  from .toncenter import ToncenterV2Client
4
6
 
5
7
 
@@ -20,6 +22,8 @@ class TatumClient(ToncenterV2Client):
20
22
  base_url: Optional[str] = None,
21
23
  rps: Optional[int] = None,
22
24
  max_retries: int = 1,
25
+ timeout: Optional[int] = 10,
26
+ session: Optional[ClientSession] = None,
23
27
  ) -> None:
24
28
  """
25
29
  Initialize the TatumClient.
@@ -30,6 +34,8 @@ class TatumClient(ToncenterV2Client):
30
34
  :param base_url: Optional custom base URL. Defaults to Tatum's public gateway.
31
35
  :param rps: Optional requests per second (RPS) limit.
32
36
  :param max_retries: Number of retries for rate-limited requests. Defaults to 1.
37
+ :param timeout: Response timeout in seconds. Not used if session is specified. Defaults to 10.
38
+ :param session: Aiohttp session to avoid creating new ones every time. By default, a new one is created for each request. If specified, remember to call session_close when finished.
33
39
  """
34
40
  if not api_key:
35
41
  raise ValueError("`api_key` is required to initialize TatumClient.")
@@ -47,4 +53,6 @@ class TatumClient(ToncenterV2Client):
47
53
  is_testnet=is_testnet,
48
54
  rps=rps,
49
55
  max_retries=max_retries,
56
+ timeout=timeout,
57
+ session=session,
50
58
  )
@@ -1,6 +1,7 @@
1
1
  from typing import Any, Dict, List, Optional, Union
2
2
 
3
3
  from pytoniq_core import Address, Builder, Cell, HashMap, Transaction, Slice
4
+ from aiohttp import ClientSession
4
5
 
5
6
  from ._base import Client
6
7
  from .utils import RunGetMethodStack, RunGetMethodResult, unpack_config
@@ -24,6 +25,8 @@ class TonapiClient(Client):
24
25
  base_url: Optional[str] = None,
25
26
  rps: Optional[int] = None,
26
27
  max_retries: int = 1,
28
+ timeout: Optional[int] = 10,
29
+ session: Optional[ClientSession] = None,
27
30
  ) -> None:
28
31
  """
29
32
  Initialize the TonapiClient.
@@ -33,6 +36,8 @@ class TonapiClient(Client):
33
36
  :param base_url: Optional custom base URL. If not provided, uses the official endpoint.
34
37
  :param rps: Optional requests per second (RPS) limit.
35
38
  :param max_retries: Number of retries for rate-limited requests. Defaults to 1.
39
+ :param timeout: Response timeout in seconds. Not used if session is specified. Defaults to 10.
40
+ :param session: Aiohttp session to avoid creating new ones every time. By default, a new one is created for each request. If specified, remember to call session_close when finished.
36
41
  """
37
42
  if not api_key:
38
43
  raise ValueError("`api_key` is required to initialize TonapiClient.")
@@ -47,6 +52,8 @@ class TonapiClient(Client):
47
52
  is_testnet=is_testnet,
48
53
  rps=rps,
49
54
  max_retries=max_retries,
55
+ timeout=timeout,
56
+ session=session,
50
57
  )
51
58
 
52
59
  async def run_get_method(
@@ -2,6 +2,7 @@ import base64
2
2
  from typing import Any, Dict, List, Optional, Union
3
3
 
4
4
  from pytoniq_core import Address, Builder, Cell, HashMap, Transaction, Slice
5
+ from aiohttp import ClientSession
5
6
 
6
7
  from ._base import Client
7
8
  from .utils import RunGetMethodStack, RunGetMethodResult, unpack_config
@@ -26,6 +27,8 @@ class ToncenterV2Client(Client):
26
27
  base_url: Optional[str] = None,
27
28
  rps: Optional[int] = None,
28
29
  max_retries: int = 1,
30
+ timeout: Optional[int] = 10,
31
+ session: Optional[ClientSession] = None,
29
32
  ) -> None:
30
33
  """
31
34
  Initialize the ToncenterV2Client.
@@ -37,6 +40,8 @@ class ToncenterV2Client(Client):
37
40
  If not set, defaults to the official Toncenter URLs.
38
41
  :param rps: Optional requests per second (RPS) limit.
39
42
  :param max_retries: Number of retries for rate-limited requests. Defaults to 1.
43
+ :param timeout: Response timeout in seconds. Not used if session is specified. Defaults to 10.
44
+ :param session: Aiohttp session to avoid creating new ones every time. By default, a new one is created for each request. If specified, remember to call session_close when finished.
40
45
  """
41
46
  default_url = "https://testnet.toncenter.com" if is_testnet else "https://toncenter.com"
42
47
  base_url = (base_url or default_url).rstrip("/") + self.API_VERSION_PATH
@@ -48,6 +53,8 @@ class ToncenterV2Client(Client):
48
53
  is_testnet=is_testnet,
49
54
  rps=rps,
50
55
  max_retries=max_retries,
56
+ timeout=timeout,
57
+ session=session,
51
58
  )
52
59
 
53
60
  async def run_get_method(
@@ -178,6 +185,8 @@ class ToncenterV3Client(Client):
178
185
  base_url: Optional[str] = None,
179
186
  rps: Optional[int] = None,
180
187
  max_retries: int = 1,
188
+ timeout: Optional[int] = 10,
189
+ session: Optional[ClientSession] = None,
181
190
  ) -> None:
182
191
  """
183
192
  Initialize the ToncenterV3Client.
@@ -189,6 +198,8 @@ class ToncenterV3Client(Client):
189
198
  Defaults to official Toncenter endpoints.
190
199
  :param rps: Optional requests per second (RPS) limit.
191
200
  :param max_retries: Number of retries for rate-limited requests. Defaults to 1.
201
+ :param timeout: Response timeout in seconds. Not used if session is specified. Defaults to 10.
202
+ :param session: Aiohttp session to avoid creating new ones every time. By default, a new one is created for each request. If specified, remember to call session_close when finished.
192
203
  """
193
204
  default_url = (
194
205
  "https://testnet.toncenter.com"
@@ -204,6 +215,8 @@ class ToncenterV3Client(Client):
204
215
  is_testnet=is_testnet,
205
216
  rps=rps,
206
217
  max_retries=max_retries,
218
+ timeout=timeout,
219
+ session=session,
207
220
  )
208
221
 
209
222
  async def run_get_method(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tonutils
3
- Version: 0.5.5
3
+ Version: 0.5.6
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
  License: MIT
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