pytonapi 0.3.7__tar.gz → 0.3.8__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 (115) hide show
  1. {pytonapi-0.3.7 → pytonapi-0.3.8}/PKG-INFO +1 -1
  2. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/__init__.py +4 -0
  3. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/__init__.py +3 -1
  4. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/accounts.py +39 -1
  5. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/blockchain.py +15 -0
  6. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/events.py +25 -2
  7. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/jettons.py +14 -1
  8. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/liteserver.py +12 -0
  9. pytonapi-0.3.8/pytonapi/async_tonapi/methods/multisig.py +17 -0
  10. pytonapi-0.3.8/pytonapi/async_tonapi/methods/traces.py +42 -0
  11. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/wallet.py +24 -0
  12. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/blockchain.py +15 -0
  13. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/jettons.py +11 -1
  14. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/liteserver.py +10 -0
  15. pytonapi-0.3.8/pytonapi/schema/multisig.py +39 -0
  16. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/nft.py +27 -1
  17. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/__init__.py +4 -0
  18. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/__init__.py +2 -0
  19. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/accounts.py +39 -1
  20. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/blockchain.py +15 -0
  21. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/events.py +25 -0
  22. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/jettons.py +17 -4
  23. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/liteserver.py +13 -1
  24. pytonapi-0.3.8/pytonapi/tonapi/methods/multisig.py +17 -0
  25. pytonapi-0.3.8/pytonapi/tonapi/methods/traces.py +42 -0
  26. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/wallet.py +25 -1
  27. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi.egg-info/PKG-INFO +1 -1
  28. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi.egg-info/SOURCES.txt +3 -0
  29. {pytonapi-0.3.7 → pytonapi-0.3.8}/setup.py +1 -1
  30. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/__init__.py +1 -1
  31. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_jettons_methods.py +1 -1
  32. pytonapi-0.3.7/pytonapi/async_tonapi/methods/traces.py +0 -23
  33. pytonapi-0.3.7/pytonapi/tonapi/methods/traces.py +0 -23
  34. {pytonapi-0.3.7 → pytonapi-0.3.8}/LICENSE +0 -0
  35. {pytonapi-0.3.7 → pytonapi-0.3.8}/README.md +0 -0
  36. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/__init__.py +0 -0
  37. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/client.py +0 -0
  38. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/dns.py +0 -0
  39. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/emulate.py +0 -0
  40. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/gasless.py +0 -0
  41. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/inscriptions.py +0 -0
  42. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/nft.py +0 -0
  43. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/rates.py +0 -0
  44. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/sse.py +0 -0
  45. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/staking.py +0 -0
  46. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/storage.py +0 -0
  47. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/tonconnect.py +0 -0
  48. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/utilites.py +0 -0
  49. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/async_tonapi/methods/websocket.py +0 -0
  50. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/exceptions.py +0 -0
  51. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/logger_config.py +0 -0
  52. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/py.typed +0 -0
  53. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/__init__.py +0 -0
  54. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/_address.py +0 -0
  55. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/_balance.py +0 -0
  56. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/accounts.py +0 -0
  57. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/dns.py +0 -0
  58. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/domains.py +0 -0
  59. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/events.py +0 -0
  60. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/gasless.py +0 -0
  61. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/inscriptions.py +0 -0
  62. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/rates.py +0 -0
  63. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/staking.py +0 -0
  64. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/storage.py +0 -0
  65. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/tonconnect.py +0 -0
  66. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/traces.py +0 -0
  67. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/schema/utilites.py +0 -0
  68. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/client.py +0 -0
  69. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/dns.py +0 -0
  70. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/emulate.py +0 -0
  71. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/gasless.py +0 -0
  72. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/inscriptions.py +0 -0
  73. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/nft.py +0 -0
  74. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/rates.py +0 -0
  75. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/sse.py +0 -0
  76. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/staking.py +0 -0
  77. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/storage.py +0 -0
  78. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/tonconnect.py +0 -0
  79. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/tonapi/methods/utilites.py +0 -0
  80. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi/utils.py +0 -0
  81. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi.egg-info/dependency_links.txt +0 -0
  82. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi.egg-info/requires.txt +0 -0
  83. {pytonapi-0.3.7 → pytonapi-0.3.8}/pytonapi.egg-info/top_level.txt +0 -0
  84. {pytonapi-0.3.7 → pytonapi-0.3.8}/setup.cfg +0 -0
  85. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_accounts_methods.py +0 -0
  86. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_blockchain_methods.py +0 -0
  87. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_dns_methods.py +0 -0
  88. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_events_methods.py +0 -0
  89. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_inscriptions_methods.py +0 -0
  90. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_liteserver_methods.py +0 -0
  91. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_nft_methods.py +0 -0
  92. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_rates_methods.py +0 -0
  93. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_sse_methods.py +0 -0
  94. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_staking_methods.py +0 -0
  95. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_storage_methods.py +0 -0
  96. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_tonconnect_methods.py +0 -0
  97. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_traces_methods.py +0 -0
  98. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_utilities_methods.py +0 -0
  99. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/async_tonapi/test_websocket_methods.py +0 -0
  100. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/__init__.py +0 -0
  101. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_accounts_methods.py +0 -0
  102. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_blockchain_methods.py +0 -0
  103. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_dns_methods.py +0 -0
  104. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_events_methods.py +0 -0
  105. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_inscriptions_methods.py +0 -0
  106. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_jettons_methods.py +0 -0
  107. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_liteserver_methods.py +0 -0
  108. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_nft_methods.py +0 -0
  109. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_rates_methods.py +0 -0
  110. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_sse_methods.py +0 -0
  111. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_staking_methods.py +0 -0
  112. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_storage_methods.py +0 -0
  113. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_tonconnect_methods.py +0 -0
  114. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_traces_methods.py +0 -0
  115. {pytonapi-0.3.7 → pytonapi-0.3.8}/tests/tonapi/test_utilities_methods.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pytonapi
3
- Version: 0.3.7
3
+ Version: 0.3.8
4
4
  Summary: Provide access to indexed TON blockchain.
5
5
  Home-page: https://github.com/tonkeeper/pytonapi/
6
6
  Author: nessshon
@@ -63,6 +63,10 @@ class AsyncTonapi(AsyncTonapiClientBase):
63
63
  def liteserver(self) -> methods.LiteserverMethod:
64
64
  return methods.LiteserverMethod(**self.__dict__)
65
65
 
66
+ @property
67
+ def multisig(self) -> methods.MultisigMethod:
68
+ return methods.MultisigMethod(**self.__dict__)
69
+
66
70
  @property
67
71
  def dns(self) -> methods.DnsMethod:
68
72
  return methods.DnsMethod(**self.__dict__)
@@ -7,6 +7,7 @@ from .gasless import GaslessMethod
7
7
  from .inscriptions import InscriptionsMethod
8
8
  from .jettons import JettonsMethod
9
9
  from .liteserver import LiteserverMethod
10
+ from .multisig import MultisigMethod
10
11
  from .nft import NftMethod
11
12
  from .rates import RatesMethod
12
13
  from .sse import SSEMethod
@@ -22,12 +23,13 @@ __all__ = [
22
23
  "AccountsMethod",
23
24
  "BlockchainMethod",
24
25
  "DnsMethod",
25
- "EmulateMethod",
26
26
  "EventsMethod",
27
27
  "GaslessMethod",
28
+ "MultisigMethod",
28
29
  "InscriptionsMethod",
29
30
  "JettonsMethod",
30
31
  "LiteserverMethod",
32
+ "EmulateMethod",
31
33
  "NftMethod",
32
34
  "RatesMethod",
33
35
  "SSEMethod",
@@ -1,4 +1,4 @@
1
- from typing import List, Optional
1
+ from typing import Any, Dict, List, Optional
2
2
 
3
3
  from pytonapi.async_tonapi.client import AsyncTonapiClientBase
4
4
  from pytonapi.schema.accounts import (
@@ -13,6 +13,7 @@ from pytonapi.schema.accounts import (
13
13
  from pytonapi.schema.domains import DomainNames
14
14
  from pytonapi.schema.events import AccountEvents, AccountEvent
15
15
  from pytonapi.schema.jettons import JettonBalance, JettonsBalances
16
+ from pytonapi.schema.multisig import Multisigs
16
17
  from pytonapi.schema.nft import NftItems, NftItem
17
18
  from pytonapi.schema.traces import TraceIds
18
19
 
@@ -395,6 +396,18 @@ class AccountsMethod(AsyncTonapiClientBase):
395
396
 
396
397
  return PublicKey(**response)
397
398
 
399
+ async def get_account_multisigs(self, account_id: str) -> Multisigs:
400
+ """
401
+ Get account's multisigs.
402
+
403
+ :param account_id: account ID
404
+ :return: :class:`PublicKey`
405
+ """
406
+ method = f"v2/accounts/{account_id}/multisigs"
407
+ response = await self._get(method=method)
408
+
409
+ return Multisigs(**response)
410
+
398
411
  async def get_balance_change(
399
412
  self,
400
413
  account_id: str,
@@ -414,3 +427,28 @@ class AccountsMethod(AsyncTonapiClientBase):
414
427
  response = await self._get(method=method, params=params)
415
428
 
416
429
  return BalanceChange(**response)
430
+
431
+ async def emulate_event(
432
+ self,
433
+ account_id: str,
434
+ body: Dict[str, Any],
435
+ accept_language: str = "en",
436
+ ignore_signature_check: Optional[bool] = None,
437
+ ) -> AccountEvent:
438
+ """
439
+ Emulate sending message to blockchain.
440
+
441
+ :param account_id: account ID
442
+ :param body: Request body with `boc`: both a single boc and a batch of boc serialized in base64 are accepted.
443
+ {
444
+ "boc": "base64 string"
445
+ }
446
+ :param accept_language: Default value: en
447
+ :param ignore_signature_check: Default value: None
448
+ """
449
+ method = f"v2/accounts/{account_id}/events/emulate"
450
+ params = {"ignore_signature_check": ignore_signature_check} if ignore_signature_check is not None else {}
451
+ headers = {"Accept-Language": accept_language}
452
+ response = await self._post(method=method, params=params, body=body, headers=headers)
453
+
454
+ return AccountEvent(**response)
@@ -13,11 +13,26 @@ from pytonapi.schema.blockchain import (
13
13
  BlockchainRawAccount,
14
14
  MethodExecutionResult,
15
15
  RawBlockchainConfig,
16
+ ReducedBlocks,
16
17
  )
17
18
 
18
19
 
19
20
  class BlockchainMethod(AsyncTonapiClientBase):
20
21
 
22
+ async def get_reduced_blocks(self, from_: int, to_: int) -> ReducedBlocks:
23
+ """
24
+ Get reduced blockchain blocks data.
25
+
26
+ :param from_: from
27
+ :param to_: to
28
+ :return: :class:`ReducedBlocks`
29
+ """
30
+ method = f"v2/blockchain/reduced/blocks"
31
+ params = {"from": from_, "to": to_}
32
+ response = await self._get(method=method, params=params)
33
+
34
+ return ReducedBlocks(**response)
35
+
21
36
  async def get_block_data(self, block_id: str) -> BlockchainBlock:
22
37
  """
23
38
  Get block data.
@@ -1,5 +1,6 @@
1
1
  import base64
2
2
  import binascii
3
+ from typing import Any, Dict, Optional
3
4
 
4
5
  from pytonapi.async_tonapi.client import AsyncTonapiClientBase
5
6
  from pytonapi.schema.events import Event
@@ -21,13 +22,35 @@ class EventsMethod(AsyncTonapiClientBase):
21
22
  :param accept_language: Default value : en
22
23
  :return: :class:`Event`
23
24
  """
24
-
25
25
  if len(event_id) == 44:
26
26
  decoded = base64.urlsafe_b64decode(event_id + "=" * (-len(event_id) % 4))
27
27
  event_id = binascii.hexlify(decoded).decode("utf-8")
28
-
29
28
  method = f"v2/events/{event_id}"
30
29
  headers = {"Accept-Language": accept_language}
31
30
  response = await self._get(method=method, headers=headers)
32
31
 
33
32
  return Event(**response)
33
+
34
+ async def emulate(
35
+ self, body: Dict[str, Any],
36
+ accept_language: str = "en",
37
+ ignore_signature_check: Optional[bool] = None,
38
+ ) -> Event:
39
+ """
40
+ Emulate sending message to blockchain.
41
+
42
+ :param body: bag-of-cells serialized to base64
43
+ example value:
44
+ {
45
+ "boc": "te6ccgECBQEAARUAAkWIAWTtae+KgtbrX26Bep8JSq8lFLfGOoyGR/xwdjfvpvEaHg"
46
+ }
47
+ :param accept_language: Default value : en
48
+ :param ignore_signature_check: Default value : None
49
+ :return: :class: `Event`
50
+ """
51
+ method = "v2/events/emulate"
52
+ params = {"ignore_signature_check": ignore_signature_check} if ignore_signature_check else {}
53
+ headers = {"Accept-Language": accept_language}
54
+ response = await self._post(method=method, params=params, body=body, headers=headers)
55
+
56
+ return Event(**response)
@@ -2,7 +2,7 @@ from typing import List
2
2
 
3
3
  from pytonapi.async_tonapi.client import AsyncTonapiClientBase
4
4
  from pytonapi.schema.events import Event
5
- from pytonapi.schema.jettons import JettonInfo, JettonHolders, Jettons, JettonHolder
5
+ from pytonapi.schema.jettons import JettonInfo, JettonHolders, Jettons, JettonHolder, JettonTransferPayload
6
6
 
7
7
 
8
8
  class JettonsMethod(AsyncTonapiClientBase):
@@ -81,3 +81,16 @@ class JettonsMethod(AsyncTonapiClientBase):
81
81
  response = await self._get(method=method)
82
82
 
83
83
  return Event(**response)
84
+
85
+ async def get_jetton_transfer_payload(self, jetton_id: str, account_id: str) -> JettonTransferPayload:
86
+ """
87
+ Get jetton's custom payload and state init required for transfer.
88
+
89
+ :param jetton_id: jetton ID
90
+ :param account_id: account ID
91
+ :return: :class:`Event`
92
+ """
93
+ method = f"v2/jettons/{jetton_id}/transfer/{account_id}/payload"
94
+ response = await self._get(method=method)
95
+
96
+ return JettonTransferPayload(**response)
@@ -15,6 +15,7 @@ from pytonapi.schema.liteserver import (
15
15
  RawBlockProof,
16
16
  RawConfig,
17
17
  RawShardProof,
18
+ OutMsgQueueSize,
18
19
  )
19
20
 
20
21
 
@@ -259,3 +260,14 @@ class LiteserverMethod(AsyncTonapiClientBase):
259
260
  response = await self._get(method=method)
260
261
 
261
262
  return RawShardProof(**response)
263
+
264
+ async def get_out_msg_queue_size(self) -> OutMsgQueueSize:
265
+ """
266
+ Get out message queue sizeGet out msg queue sizes.
267
+
268
+ :return: :class:`OutMsgQueueSize` size
269
+ """
270
+ method = "v2/liteserver/get_out_msg_queue_size"
271
+ response = await self._get(method=method)
272
+
273
+ return OutMsgQueueSize(**response)
@@ -0,0 +1,17 @@
1
+ from pytonapi.async_tonapi.client import AsyncTonapiClientBase
2
+ from pytonapi.schema.multisig import Multisig
3
+
4
+
5
+ class MultisigMethod(AsyncTonapiClientBase):
6
+
7
+ async def get_account_info(self, account_id: str) -> Multisig:
8
+ """
9
+ Get multisig account info.
10
+
11
+ :param account_id: account ID
12
+ :return: :class:`AddressForm`
13
+ """
14
+ method = f"v2/multisig/{account_id}"
15
+ response = await self._get(method=method)
16
+
17
+ return Multisig(**response)
@@ -0,0 +1,42 @@
1
+ import base64
2
+ import binascii
3
+ from typing import Any, Dict, Optional
4
+
5
+ from pytonapi.async_tonapi.client import AsyncTonapiClientBase
6
+ from pytonapi.schema.traces import Trace
7
+
8
+
9
+ class TracesMethod(AsyncTonapiClientBase):
10
+
11
+ async def get_trace(self, trace_id: str) -> Trace:
12
+ """
13
+ Get the trace by trace ID or hash of any transaction in trace.
14
+
15
+ :param trace_id: trace ID or transaction hash in hex (without 0x) or base64url format
16
+ :return: :class:`Trace`
17
+ """
18
+ if len(trace_id) == 44:
19
+ decoded = base64.urlsafe_b64decode(trace_id + "=" * (-len(trace_id) % 4))
20
+ trace_id = binascii.hexlify(decoded).decode("utf-8")
21
+ method = f"v2/traces/{trace_id}"
22
+ response = await self._get(method=method)
23
+
24
+ return Trace(**response)
25
+
26
+ async def emulate(self, body: Dict[str, Any], ignore_signature_check: Optional[bool] = None) -> Trace:
27
+ """
28
+ Emulate sending message to blockchain.
29
+
30
+ :param body: bag-of-cells serialized to base64
31
+ example value:
32
+ {
33
+ "boc": "te6ccgECBQEAARUAAkWIAWTtae+KgtbrX26Bep8JSq8lFLfGOoyGR/xwdjfvpvEaHg"
34
+ }
35
+ :param ignore_signature_check: Default value : None
36
+ :return: :class: `Trace`
37
+ """
38
+ method = "v2/traces/emulate"
39
+ params = {"ignore_signature_check": ignore_signature_check} if ignore_signature_check else {}
40
+ response = await self._post(method=method, params=params, body=body)
41
+
42
+ return Trace(**response)
@@ -2,6 +2,7 @@ from typing import Dict, Any, Union
2
2
 
3
3
  from pytonapi.async_tonapi.client import AsyncTonapiClientBase
4
4
  from pytonapi.schema.accounts import Accounts
5
+ from pytonapi.schema.events import MessageConsequences
5
6
 
6
7
 
7
8
  class WalletMethod(AsyncTonapiClientBase):
@@ -80,3 +81,26 @@ class WalletMethod(AsyncTonapiClientBase):
80
81
  response = await self._get(method=method)
81
82
 
82
83
  return response.get("seqno", None)
84
+
85
+ async def emulate(self, body: Dict[str, Any], accept_language: str = "en") -> MessageConsequences:
86
+ """
87
+ Emulate sending message to blockchain.
88
+
89
+ :param body: Data that is expected. example value:
90
+ {
91
+ "boc": "string",
92
+ "params": [
93
+ {
94
+ "address": "0:97146a46acc2654y27947f14c4a4b14273e954f78bc017790b41208b0043200b",
95
+ "balance": 10000000000
96
+ }
97
+ ]
98
+ }
99
+ :param accept_language: Default value: en
100
+ :return: :class:`Dict[str, Any]`
101
+ """
102
+ method = "v2/wallet/emulate"
103
+ headers = {"Accept-Language": accept_language}
104
+ response = await self._post(method=method, body=body, headers=headers)
105
+
106
+ return MessageConsequences(**response)
@@ -241,3 +241,18 @@ class DecodedMessage(BaseModel):
241
241
  destination: AccountAddress
242
242
  destination_wallet_version: str
243
243
  ext_in_msg_decoded: Optional[Dict[str, Any]] = None
244
+
245
+
246
+ class ReducedBlock(BaseModel):
247
+ workchain_id: int
248
+ shard: str
249
+ seqno: int
250
+ master_ref: Optional[str] = None
251
+ tx_quantity: int
252
+ utime: int
253
+ shards_blocks: List[str]
254
+ parent: List[str]
255
+
256
+
257
+ class ReducedBlocks(BaseModel):
258
+ blocks: List[ReducedBlock]
@@ -1,5 +1,5 @@
1
1
  from enum import Enum
2
- from typing import List, Optional
2
+ from typing import Any, List, Optional
3
3
 
4
4
  from pydantic import BaseModel
5
5
 
@@ -10,9 +10,14 @@ from pytonapi.schema.rates import TokenRates
10
10
 
11
11
  class JettonVerificationType(str, Enum):
12
12
  whitelist = "whitelist"
13
+ graylist = "graylist"
13
14
  blacklist = "blacklist"
14
15
  none = "none"
15
16
 
17
+ @classmethod
18
+ def _missing_(cls, value: Any) -> str:
19
+ return cls.none
20
+
16
21
 
17
22
  class JettonMetadata(BaseModel):
18
23
  address: Address
@@ -74,3 +79,8 @@ class JettonQuantity(BaseModel):
74
79
  quantity: str
75
80
  wallet_address: AccountAddress
76
81
  jetton: JettonPreview
82
+
83
+
84
+ class JettonTransferPayload(BaseModel):
85
+ custom_payload: Optional[str] = None
86
+ state_init: Optional[str] = None
@@ -110,3 +110,13 @@ class RawConfig(BaseModel):
110
110
  class RawShardProof(BaseModel):
111
111
  masterchain_id: BlockRaw
112
112
  links: List
113
+
114
+
115
+ class OutMsgQueueShard(BaseModel):
116
+ id: BlockRaw
117
+ size: int
118
+
119
+
120
+ class OutMsgQueueSize(BaseModel):
121
+ ext_msg_queue_size_limit: int
122
+ shards: List[OutMsgQueueShard]
@@ -0,0 +1,39 @@
1
+ from typing import List, Optional
2
+
3
+ from pydantic import BaseModel
4
+
5
+ from pytonapi.schema._address import Address
6
+ from pytonapi.schema.jettons import JettonQuantity
7
+ from pytonapi.schema.nft import NftItem
8
+
9
+
10
+ class Risk(BaseModel):
11
+ description: Optional[str] = None
12
+ transfer_all_remaining_balance: bool
13
+ ton: int
14
+ jettons: List[JettonQuantity]
15
+ nfts: List[NftItem]
16
+
17
+
18
+ class MultisigOrder(BaseModel):
19
+ address: Address
20
+ order_seqno: int
21
+ threshold: int
22
+ sent_for_execution: bool
23
+ signers: List[Address]
24
+ approvals_num: int
25
+ expiration_data: int
26
+ risk: Risk
27
+
28
+
29
+ class Multisig(BaseModel):
30
+ address: Address
31
+ seqno: int
32
+ threshold: int
33
+ signers: List[Address]
34
+ proposers: List[Address]
35
+ orders: MultisigOrder
36
+
37
+
38
+ class Multisigs(BaseModel):
39
+ multisigs: List[Multisig]
@@ -1,4 +1,5 @@
1
- from typing import List, Optional
1
+ from enum import Enum
2
+ from typing import Any, List, Optional
2
3
 
3
4
  from pydantic import BaseModel
4
5
 
@@ -29,6 +30,17 @@ class Collection(BaseModel):
29
30
  description: Optional[str] = None
30
31
 
31
32
 
33
+ class NftApprovedBy(str, Enum):
34
+ getgems = "getgems"
35
+ tonkeeper = "tonkeeper"
36
+ ton_diamonds = "ton.diamonds"
37
+ none = "none"
38
+
39
+ @classmethod
40
+ def _missing_(cls, value: Any) -> str:
41
+ return cls.none
42
+
43
+
32
44
  class NftCollection(BaseModel):
33
45
  address: Address
34
46
  next_item_index: int
@@ -36,6 +48,18 @@ class NftCollection(BaseModel):
36
48
  raw_collection_content: str
37
49
  metadata: Optional[dict] = None
38
50
  previews: Optional[List[ImagePreview]] = None
51
+ approved_by: NftApprovedBy
52
+
53
+
54
+ class TrustType(str, Enum):
55
+ whitelist = "whitelist"
56
+ graylist = "graylist"
57
+ blacklist = "blacklist"
58
+ none = "none"
59
+
60
+ @classmethod
61
+ def _missing_(cls, value: Any) -> str:
62
+ return cls.none
39
63
 
40
64
 
41
65
  class NftItem(BaseModel):
@@ -49,6 +73,8 @@ class NftItem(BaseModel):
49
73
  previews: Optional[List[ImagePreview]] = None
50
74
  dns: Optional[str] = None
51
75
  approved_by: List[str]
76
+ include_cnft: Optional[bool] = None
77
+ trust: TrustType
52
78
 
53
79
 
54
80
  class NftItems(BaseModel):
@@ -65,6 +65,10 @@ class Tonapi(TonapiClientBase):
65
65
  def liteserver(self) -> methods.LiteserverMethod:
66
66
  return methods.LiteserverMethod(**self.__getattributes)
67
67
 
68
+ @property
69
+ def multisig(self) -> methods.MultisigMethod:
70
+ return methods.MultisigMethod(**self.__getattributes)
71
+
68
72
  @property
69
73
  def dns(self) -> methods.DnsMethod:
70
74
  return methods.DnsMethod(**self.__getattributes)
@@ -7,6 +7,7 @@ from .gasless import GaslessMethod
7
7
  from .inscriptions import InscriptionsMethod
8
8
  from .jettons import JettonsMethod
9
9
  from .liteserver import LiteserverMethod
10
+ from .multisig import MultisigMethod
10
11
  from .nft import NftMethod
11
12
  from .rates import RatesMethod
12
13
  from .sse import SSEMethod
@@ -27,6 +28,7 @@ __all__ = [
27
28
  "InscriptionsMethod",
28
29
  "JettonsMethod",
29
30
  "LiteserverMethod",
31
+ "MultisigMethod",
30
32
  "NftMethod",
31
33
  "RatesMethod",
32
34
  "SSEMethod",
@@ -1,4 +1,4 @@
1
- from typing import List, Optional
1
+ from typing import Any, Dict, List, Optional
2
2
 
3
3
  from pytonapi.schema.accounts import (
4
4
  Account,
@@ -12,6 +12,7 @@ from pytonapi.schema.accounts import (
12
12
  from pytonapi.schema.domains import DomainNames
13
13
  from pytonapi.schema.events import AccountEvents, AccountEvent
14
14
  from pytonapi.schema.jettons import JettonBalance, JettonsBalances
15
+ from pytonapi.schema.multisig import Multisigs
15
16
  from pytonapi.schema.nft import NftItems, NftItem
16
17
  from pytonapi.schema.traces import TraceIds
17
18
  from pytonapi.tonapi.client import TonapiClientBase
@@ -395,6 +396,18 @@ class AccountsMethod(TonapiClientBase):
395
396
 
396
397
  return PublicKey(**response)
397
398
 
399
+ def get_account_multisigs(self, account_id: str) -> Multisigs:
400
+ """
401
+ Get account's multisigs.
402
+
403
+ :param account_id: account ID
404
+ :return: :class:`PublicKey`
405
+ """
406
+ method = f"v2/accounts/{account_id}/multisigs"
407
+ response = self._get(method=method)
408
+
409
+ return Multisigs(**response)
410
+
398
411
  def get_balance_change(
399
412
  self,
400
413
  account_id: str,
@@ -414,3 +427,28 @@ class AccountsMethod(TonapiClientBase):
414
427
  response = self._get(method=method, params=params)
415
428
 
416
429
  return BalanceChange(**response)
430
+
431
+ def emulate_event(
432
+ self,
433
+ account_id: str,
434
+ body: Dict[str, Any],
435
+ accept_language: str = "en",
436
+ ignore_signature_check: Optional[bool] = None,
437
+ ) -> AccountEvent:
438
+ """
439
+ Emulate sending message to blockchain.
440
+
441
+ :param account_id: account ID
442
+ :param body: Request body with `boc`: both a single boc and a batch of boc serialized in base64 are accepted.
443
+ {
444
+ "boc": "base64 string"
445
+ }
446
+ :param accept_language: Default value: en
447
+ :param ignore_signature_check: Default value: None
448
+ """
449
+ method = f"v2/accounts/{account_id}/events/emulate"
450
+ params = {"ignore_signature_check": ignore_signature_check} if ignore_signature_check is not None else {}
451
+ headers = {"Accept-Language": accept_language}
452
+ response = self._post(method=method, params=params, body=body, headers=headers)
453
+
454
+ return AccountEvent(**response)
@@ -12,12 +12,27 @@ from pytonapi.schema.blockchain import (
12
12
  BlockchainRawAccount,
13
13
  MethodExecutionResult,
14
14
  RawBlockchainConfig,
15
+ ReducedBlocks,
15
16
  )
16
17
  from pytonapi.tonapi.client import TonapiClientBase
17
18
 
18
19
 
19
20
  class BlockchainMethod(TonapiClientBase):
20
21
 
22
+ def get_reduced_blocks(self, from_: int, to_: int) -> ReducedBlocks:
23
+ """
24
+ Get reduced blockchain blocks data.
25
+
26
+ :param from_: from
27
+ :param to_: to
28
+ :return: :class:`ReducedBlocks`
29
+ """
30
+ method = f"v2/blockchain/reduced/blocks"
31
+ params = {"from": from_, "to": to_}
32
+ response = self._get(method=method, params=params)
33
+
34
+ return ReducedBlocks(**response)
35
+
21
36
  def get_block_data(self, block_id: str) -> BlockchainBlock:
22
37
  """
23
38
  Get block data.
@@ -1,5 +1,6 @@
1
1
  import base64
2
2
  import binascii
3
+ from typing import Any, Dict, Optional
3
4
 
4
5
  from pytonapi.schema.events import Event
5
6
  from pytonapi.tonapi.client import TonapiClientBase
@@ -29,3 +30,27 @@ class EventsMethod(TonapiClientBase):
29
30
  response = self._get(method=method, headers=headers)
30
31
 
31
32
  return Event(**response)
33
+
34
+ def emulate(
35
+ self, body: Dict[str, Any],
36
+ accept_language: str = "en",
37
+ ignore_signature_check: Optional[bool] = None,
38
+ ) -> Event:
39
+ """
40
+ Emulate sending message to blockchain.
41
+
42
+ :param body: bag-of-cells serialized to base64
43
+ example value:
44
+ {
45
+ "boc": "te6ccgECBQEAARUAAkWIAWTtae+KgtbrX26Bep8JSq8lFLfGOoyGR/xwdjfvpvEaHg"
46
+ }
47
+ :param accept_language: Default value : en
48
+ :param ignore_signature_check: Default value : None
49
+ :return: :class: `Event`
50
+ """
51
+ method = "v2/events/emulate"
52
+ params = {"ignore_signature_check": ignore_signature_check} if ignore_signature_check else {}
53
+ headers = {"Accept-Language": accept_language}
54
+ response = self._post(method=method, params=params, body=body, headers=headers)
55
+
56
+ return Event(**response)
@@ -1,7 +1,7 @@
1
1
  from typing import List
2
2
 
3
3
  from pytonapi.schema.events import Event
4
- from pytonapi.schema.jettons import JettonInfo, JettonHolders, Jettons, JettonHolder
4
+ from pytonapi.schema.jettons import JettonInfo, JettonHolders, Jettons, JettonHolder, JettonTransferPayload
5
5
  from pytonapi.tonapi.client import TonapiClientBase
6
6
 
7
7
 
@@ -11,8 +11,8 @@ class JettonsMethod(TonapiClientBase):
11
11
  """
12
12
  Get jetton metadata by jetton master address.
13
13
 
14
- :param account_id: account ID
15
- :return: :class:`JettonInfo`
14
+ :param account_id: Account ID
15
+ :return: JettonInfo
16
16
  """
17
17
  method = f"v2/jettons/{account_id}"
18
18
  response = self._get(method=method)
@@ -64,7 +64,7 @@ class JettonsMethod(TonapiClientBase):
64
64
  :param offset: Default value - 0
65
65
  :return: :class:`Jettons`
66
66
  """
67
- method = f"v2/jettons"
67
+ method = "v2/jettons"
68
68
  params = {"limit": limit, "offset": offset}
69
69
  response = self._get(method=method, params=params)
70
70
 
@@ -81,3 +81,16 @@ class JettonsMethod(TonapiClientBase):
81
81
  response = self._get(method=method)
82
82
 
83
83
  return Event(**response)
84
+
85
+ def get_jetton_transfer_payload(self, jetton_id: str, account_id: str) -> JettonTransferPayload:
86
+ """
87
+ Get jetton's custom payload and state init required for transfer.
88
+
89
+ :param jetton_id: jetton ID
90
+ :param account_id: account ID
91
+ :return: :class:`Event`
92
+ """
93
+ method = f"v2/jettons/{jetton_id}/transfer/{account_id}/payload"
94
+ response = self._get(method=method)
95
+
96
+ return JettonTransferPayload(**response)