tonutils 2.0.1b2__py3-none-any.whl → 2.0.1b4__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/cli.py +111 -0
- tonutils/clients/__init__.py +7 -11
- tonutils/clients/adnl/__init__.py +7 -3
- tonutils/clients/adnl/balancer.py +362 -168
- tonutils/clients/adnl/client.py +203 -67
- tonutils/clients/adnl/provider/config.py +24 -25
- tonutils/clients/adnl/provider/models.py +4 -0
- tonutils/clients/adnl/provider/provider.py +203 -160
- tonutils/clients/adnl/provider/transport.py +44 -33
- 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 +4 -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/vanity.py +1 -1
- 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 +146 -228
- tonutils/tonconnect/__init__.py +0 -0
- tonutils/tools/__init__.py +6 -0
- tonutils/tools/block_scanner/__init__.py +26 -0
- tonutils/tools/block_scanner/annotations.py +23 -0
- tonutils/tools/block_scanner/dispatcher.py +141 -0
- tonutils/tools/block_scanner/events.py +31 -0
- tonutils/tools/block_scanner/scanner.py +315 -0
- tonutils/tools/block_scanner/traversal.py +96 -0
- tonutils/tools/block_scanner/where.py +151 -0
- tonutils/tools/status_monitor/__init__.py +3 -0
- tonutils/tools/status_monitor/console.py +157 -0
- tonutils/tools/status_monitor/models.py +27 -0
- tonutils/tools/status_monitor/monitor.py +295 -0
- tonutils/types.py +125 -2
- tonutils/utils.py +3 -3
- {tonutils-2.0.1b2.dist-info → tonutils-2.0.1b4.dist-info}/METADATA +2 -5
- tonutils-2.0.1b4.dist-info/RECORD +108 -0
- tonutils-2.0.1b4.dist-info/entry_points.txt +2 -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.1b2.dist-info/RECORD +0 -98
- /tonutils/{protocols/client.py → clients/protocol.py} +0 -0
- {tonutils-2.0.1b2.dist-info → tonutils-2.0.1b4.dist-info}/WHEEL +0 -0
- {tonutils-2.0.1b2.dist-info → tonutils-2.0.1b4.dist-info}/licenses/LICENSE +0 -0
- {tonutils-2.0.1b2.dist-info → tonutils-2.0.1b4.dist-info}/top_level.txt +0 -0
tonutils/__init__.py
CHANGED
tonutils/__meta__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2.0.
|
|
1
|
+
__version__ = "2.0.1b4"
|
tonutils/cli.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import asyncio
|
|
3
|
+
import typing as t
|
|
4
|
+
|
|
5
|
+
from tonutils.__meta__ import __version__
|
|
6
|
+
from tonutils.clients.adnl.provider.config import (
|
|
7
|
+
get_mainnet_global_config,
|
|
8
|
+
get_testnet_global_config,
|
|
9
|
+
load_global_config,
|
|
10
|
+
)
|
|
11
|
+
from tonutils.tools.status_monitor import LiteServerMonitor
|
|
12
|
+
from tonutils.types import NetworkGlobalID
|
|
13
|
+
|
|
14
|
+
NETWORK_MAP: t.Dict[str, NetworkGlobalID] = {
|
|
15
|
+
"mainnet": NetworkGlobalID.MAINNET,
|
|
16
|
+
"testnet": NetworkGlobalID.TESTNET,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def parse_network(value: str) -> NetworkGlobalID:
|
|
21
|
+
value = value.lower().strip()
|
|
22
|
+
if value not in NETWORK_MAP:
|
|
23
|
+
raise argparse.ArgumentTypeError(f"Unknown network: {value}")
|
|
24
|
+
return NETWORK_MAP[value]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def cmd_status(args: argparse.Namespace) -> None:
|
|
28
|
+
if args.config:
|
|
29
|
+
config = load_global_config(args.config)
|
|
30
|
+
else:
|
|
31
|
+
config_getter = {
|
|
32
|
+
NetworkGlobalID.MAINNET: get_mainnet_global_config,
|
|
33
|
+
NetworkGlobalID.TESTNET: get_testnet_global_config,
|
|
34
|
+
}
|
|
35
|
+
config = config_getter[args.network]()
|
|
36
|
+
|
|
37
|
+
async def _run() -> None:
|
|
38
|
+
monitor = LiteServerMonitor.from_config(
|
|
39
|
+
config=config,
|
|
40
|
+
network=args.network,
|
|
41
|
+
rps_limit=args.rps,
|
|
42
|
+
)
|
|
43
|
+
try:
|
|
44
|
+
await monitor.run()
|
|
45
|
+
finally:
|
|
46
|
+
await monitor.stop()
|
|
47
|
+
|
|
48
|
+
try:
|
|
49
|
+
asyncio.run(_run())
|
|
50
|
+
except KeyboardInterrupt:
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _create_parser() -> argparse.ArgumentParser:
|
|
55
|
+
parser = argparse.ArgumentParser(
|
|
56
|
+
prog="tonutils",
|
|
57
|
+
description="Tonutils CLI.",
|
|
58
|
+
)
|
|
59
|
+
parser.add_argument(
|
|
60
|
+
"-v",
|
|
61
|
+
"--version",
|
|
62
|
+
action="version",
|
|
63
|
+
version=f"tonutils {__version__}",
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
subs = parser.add_subparsers(dest="command", metavar="command")
|
|
67
|
+
|
|
68
|
+
status = subs.add_parser(
|
|
69
|
+
"status",
|
|
70
|
+
help="Monitor lite-servers status.",
|
|
71
|
+
)
|
|
72
|
+
status.add_argument(
|
|
73
|
+
"-n",
|
|
74
|
+
"--network",
|
|
75
|
+
type=parse_network,
|
|
76
|
+
metavar="NET",
|
|
77
|
+
default=NetworkGlobalID.MAINNET,
|
|
78
|
+
help="mainnet (default) or testnet",
|
|
79
|
+
)
|
|
80
|
+
status.add_argument(
|
|
81
|
+
"-c",
|
|
82
|
+
"--config",
|
|
83
|
+
type=str,
|
|
84
|
+
metavar="PATH",
|
|
85
|
+
help="Config file path or URL",
|
|
86
|
+
)
|
|
87
|
+
status.add_argument(
|
|
88
|
+
"-r",
|
|
89
|
+
"--rps",
|
|
90
|
+
type=int,
|
|
91
|
+
metavar="N",
|
|
92
|
+
default=100,
|
|
93
|
+
help="Requests per second (default: 100)",
|
|
94
|
+
)
|
|
95
|
+
status.set_defaults(func=cmd_status)
|
|
96
|
+
|
|
97
|
+
return parser
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def main() -> None:
|
|
101
|
+
parser = _create_parser()
|
|
102
|
+
args = parser.parse_args()
|
|
103
|
+
|
|
104
|
+
if hasattr(args, "func"):
|
|
105
|
+
args.func(args)
|
|
106
|
+
else:
|
|
107
|
+
parser.print_help()
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
if __name__ == "__main__":
|
|
111
|
+
main()
|
tonutils/clients/__init__.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
from .adnl import
|
|
2
|
-
|
|
1
|
+
from .adnl import (
|
|
2
|
+
LiteBalancer,
|
|
3
|
+
LiteClient,
|
|
4
|
+
AdnlProvider,
|
|
5
|
+
)
|
|
3
6
|
from .http import (
|
|
4
7
|
HttpBalancer,
|
|
5
8
|
ChainstackHttpClient,
|
|
6
|
-
ChainstackHttpProvider,
|
|
7
9
|
QuicknodeHttpClient,
|
|
8
|
-
QuicknodeHttpProvider,
|
|
9
10
|
TatumHttpClient,
|
|
10
|
-
TatumHttpProvider,
|
|
11
11
|
TonapiHttpClient,
|
|
12
12
|
TonapiHttpProvider,
|
|
13
13
|
ToncenterHttpClient,
|
|
@@ -15,17 +15,13 @@ from .http import (
|
|
|
15
15
|
)
|
|
16
16
|
|
|
17
17
|
__all__ = [
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"AdnlClient",
|
|
18
|
+
"LiteBalancer",
|
|
19
|
+
"LiteClient",
|
|
21
20
|
"AdnlProvider",
|
|
22
21
|
"HttpBalancer",
|
|
23
22
|
"ChainstackHttpClient",
|
|
24
|
-
"ChainstackHttpProvider",
|
|
25
23
|
"QuicknodeHttpClient",
|
|
26
|
-
"QuicknodeHttpProvider",
|
|
27
24
|
"TatumHttpClient",
|
|
28
|
-
"TatumHttpProvider",
|
|
29
25
|
"TonapiHttpClient",
|
|
30
26
|
"TonapiHttpProvider",
|
|
31
27
|
"ToncenterHttpClient",
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
from .balancer import
|
|
2
|
-
from .client import
|
|
1
|
+
from .balancer import LiteBalancer
|
|
2
|
+
from .client import LiteClient
|
|
3
3
|
from .provider import AdnlProvider
|
|
4
4
|
|
|
5
|
-
__all__ = [
|
|
5
|
+
__all__ = [
|
|
6
|
+
"LiteBalancer",
|
|
7
|
+
"LiteClient",
|
|
8
|
+
"AdnlProvider",
|
|
9
|
+
]
|