tonutils 2.0.1b4__py3-none-any.whl → 2.0.1b6__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.
Files changed (47) hide show
  1. tonutils/__meta__.py +1 -1
  2. tonutils/clients/__init__.py +10 -10
  3. tonutils/clients/adnl/balancer.py +21 -24
  4. tonutils/clients/adnl/client.py +21 -24
  5. tonutils/clients/adnl/provider/config.py +22 -7
  6. tonutils/clients/base.py +22 -12
  7. tonutils/clients/http/__init__.py +11 -11
  8. tonutils/clients/http/balancer.py +11 -11
  9. tonutils/clients/http/clients/__init__.py +10 -10
  10. tonutils/clients/http/clients/chainstack.py +3 -3
  11. tonutils/clients/http/clients/quicknode.py +2 -3
  12. tonutils/clients/http/clients/tatum.py +3 -3
  13. tonutils/clients/http/clients/tonapi.py +9 -10
  14. tonutils/clients/http/clients/toncenter.py +50 -23
  15. tonutils/clients/http/{providers → provider}/__init__.py +4 -1
  16. tonutils/clients/http/{providers → provider}/base.py +71 -7
  17. tonutils/clients/http/{providers/toncenter → provider}/models.py +43 -1
  18. tonutils/clients/http/{providers/tonapi/provider.py → provider/tonapi.py} +8 -8
  19. tonutils/clients/http/{providers/toncenter/provider.py → provider/toncenter.py} +22 -14
  20. tonutils/clients/limiter.py +61 -59
  21. tonutils/clients/protocol.py +2 -2
  22. tonutils/contracts/wallet/base.py +2 -3
  23. tonutils/contracts/wallet/messages.py +4 -8
  24. tonutils/tonconnect/bridge/__init__.py +0 -0
  25. tonutils/tonconnect/events.py +0 -0
  26. tonutils/tonconnect/models/__init__.py +0 -0
  27. tonutils/tonconnect/storage.py +0 -0
  28. tonutils/tonconnect/tonconnect.py +0 -0
  29. tonutils/tools/block_scanner/__init__.py +2 -19
  30. tonutils/tools/block_scanner/events.py +48 -7
  31. tonutils/tools/block_scanner/scanner.py +315 -223
  32. tonutils/tools/block_scanner/storage.py +11 -0
  33. tonutils/utils.py +0 -48
  34. {tonutils-2.0.1b4.dist-info → tonutils-2.0.1b6.dist-info}/METADATA +1 -1
  35. {tonutils-2.0.1b4.dist-info → tonutils-2.0.1b6.dist-info}/RECORD +39 -41
  36. {tonutils-2.0.1b4.dist-info → tonutils-2.0.1b6.dist-info}/WHEEL +1 -1
  37. tonutils/clients/http/providers/response.py +0 -85
  38. tonutils/clients/http/providers/tonapi/__init__.py +0 -3
  39. tonutils/clients/http/providers/tonapi/models.py +0 -47
  40. tonutils/clients/http/providers/toncenter/__init__.py +0 -3
  41. tonutils/tools/block_scanner/annotations.py +0 -23
  42. tonutils/tools/block_scanner/dispatcher.py +0 -141
  43. tonutils/tools/block_scanner/traversal.py +0 -96
  44. tonutils/tools/block_scanner/where.py +0 -151
  45. {tonutils-2.0.1b4.dist-info → tonutils-2.0.1b6.dist-info}/entry_points.txt +0 -0
  46. {tonutils-2.0.1b4.dist-info → tonutils-2.0.1b6.dist-info}/licenses/LICENSE +0 -0
  47. {tonutils-2.0.1b4.dist-info → tonutils-2.0.1b6.dist-info}/top_level.txt +0 -0
@@ -1,151 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import typing as t
4
-
5
- from pytoniq_core import Address
6
-
7
- from tonutils.tools.block_scanner import TransactionEvent
8
- from tonutils.tools.block_scanner.annotations import TEvent
9
- from tonutils.types import AddressLike
10
-
11
-
12
- class Where(t.Generic[TEvent]):
13
- __slots__ = ()
14
-
15
- def __call__(self, event: TEvent) -> bool:
16
- raise NotImplementedError
17
-
18
- def __and__(self, other: Where[TEvent]) -> _And[TEvent]:
19
- return _And(self, other)
20
-
21
- def __or__(self, other: Where[TEvent]) -> _Or[TEvent]:
22
- return _Or(self, other)
23
-
24
- def __invert__(self) -> _Not[TEvent]:
25
- return _Not(self)
26
-
27
-
28
- class _And(Where[TEvent]):
29
- __slots__ = ("_a", "_b")
30
-
31
- def __init__(self, a: Where[TEvent], b: Where[TEvent]) -> None:
32
- self._a = a
33
- self._b = b
34
-
35
- def __call__(self, event: TEvent) -> bool:
36
- return self._a(event) and self._b(event)
37
-
38
-
39
- class _Or(Where[TEvent]):
40
- __slots__ = ("_a", "_b")
41
-
42
- def __init__(self, a: Where[TEvent], b: Where[TEvent]) -> None:
43
- self._a = a
44
- self._b = b
45
-
46
- def __call__(self, event: TEvent) -> bool:
47
- return self._a(event) or self._b(event)
48
-
49
-
50
- class _Not(Where[TEvent]):
51
- __slots__ = ("_f",)
52
-
53
- def __init__(self, f: Where[TEvent]) -> None:
54
- self._f = f
55
-
56
- def __call__(self, event: TEvent) -> bool:
57
- return not self._f(event)
58
-
59
-
60
- class _Opcode(Where[TransactionEvent]):
61
- __slots__ = ("_ops",)
62
-
63
- def __init__(self, *ops: int) -> None:
64
- self._ops = frozenset(ops)
65
-
66
- def __call__(self, event: TransactionEvent) -> bool:
67
- msg = event.transaction.in_msg
68
- if msg is None or msg.body is None:
69
- return False
70
-
71
- if len(msg.body.bits) < 32:
72
- return False
73
-
74
- op = msg.body.begin_parse().load_uint(32)
75
- return op in self._ops
76
-
77
-
78
- class _Comment(Where[TransactionEvent]):
79
- __slots__ = ("_texts", "_any")
80
-
81
- def __init__(self, *texts: str) -> None:
82
- self._texts = frozenset(texts)
83
- self._any = len(texts) == 0
84
-
85
- def __call__(self, event: TransactionEvent) -> bool:
86
- msg = event.transaction.in_msg
87
- if msg is None or msg.body is None:
88
- return False
89
-
90
- body = msg.body.begin_parse()
91
- if len(body.bits) < 32:
92
- return False
93
-
94
- op = body.load_uint(32)
95
- if op != 0:
96
- return False
97
-
98
- if self._any:
99
- return True
100
- try:
101
- text = body.load_snake_string()
102
- except (Exception,):
103
- return False
104
-
105
- return text in self._texts
106
-
107
-
108
- class _Sender(Where[TransactionEvent]):
109
- __slots__ = ("_addrs",)
110
-
111
- def __init__(self, *addrs: AddressLike) -> None:
112
- self._addrs = frozenset(Address(a) if isinstance(a, str) else a for a in addrs)
113
-
114
- def __call__(self, event: TransactionEvent) -> bool:
115
- msg = event.transaction.in_msg
116
- if msg is None:
117
- return False
118
-
119
- src = msg.info.src
120
- return src is not None and src in self._addrs
121
-
122
-
123
- class _Destination(Where[TransactionEvent]):
124
- __slots__ = ("_addrs",)
125
-
126
- def __init__(self, *addrs: AddressLike) -> None:
127
- self._addrs = frozenset(Address(a) if isinstance(a, str) else a for a in addrs)
128
-
129
- def __call__(self, event: TransactionEvent) -> bool:
130
- msg = event.transaction.in_msg
131
- if msg is None:
132
- return False
133
-
134
- dest = msg.info.dest
135
- return dest is not None and dest in self._addrs
136
-
137
-
138
- def opcode(*ops: int) -> Where[TransactionEvent]:
139
- return _Opcode(*ops)
140
-
141
-
142
- def comment(*texts: str) -> Where[TransactionEvent]:
143
- return _Comment(*texts)
144
-
145
-
146
- def sender(*addresses: AddressLike) -> Where[TransactionEvent]:
147
- return _Sender(*addresses)
148
-
149
-
150
- def destination(*addresses: AddressLike) -> Where[TransactionEvent]:
151
- return _Destination(*addresses)