mm-strk 0.3.3__py3-none-any.whl → 0.4.0__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.
- mm_strk/account.py +17 -19
- mm_strk/balance.py +1 -1
- mm_strk/cli/cli.py +4 -5
- mm_strk/cli/commands/__init__.py +3 -0
- mm_strk/cli/{cmd/node_cmd.py → commands/node.py} +2 -2
- mm_strk/domain.py +7 -5
- mm_strk-0.4.0.dist-info/METADATA +8 -0
- mm_strk-0.4.0.dist-info/RECORD +14 -0
- mm_strk/cli/cmd/__init__.py +0 -0
- mm_strk-0.3.3.dist-info/METADATA +0 -7
- mm_strk-0.3.3.dist-info/RECORD +0 -14
- {mm_strk-0.3.3.dist-info → mm_strk-0.4.0.dist-info}/WHEEL +0 -0
- {mm_strk-0.3.3.dist-info → mm_strk-0.4.0.dist-info}/entry_points.txt +0 -0
mm_strk/account.py
CHANGED
|
@@ -1,45 +1,43 @@
|
|
|
1
1
|
import re
|
|
2
2
|
|
|
3
|
-
from starknet_py.hash.address import is_checksum_address
|
|
4
|
-
|
|
5
3
|
# Maximum allowable value for a StarkNet address (251 bits)
|
|
6
4
|
MAX_STARKNET_ADDRESS = 2**251
|
|
7
5
|
|
|
8
6
|
|
|
9
|
-
def
|
|
7
|
+
def is_address(address: str) -> bool:
|
|
10
8
|
"""
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
|
|
9
|
+
Validates a StarkNet address.
|
|
10
|
+
|
|
11
|
+
- Must be a string starting with '0x'.
|
|
12
|
+
- Hex part 1-64 chars.
|
|
13
|
+
- Integer value < 2**251.
|
|
14
|
+
- Accepts either:
|
|
15
|
+
• Full 64-hex-character padded form.
|
|
16
|
+
• Minimal form without leading zeros (canonical).
|
|
18
17
|
"""
|
|
19
|
-
#
|
|
18
|
+
# Type and prefix
|
|
20
19
|
if not isinstance(address, str) or not address.startswith("0x"):
|
|
21
20
|
return False
|
|
22
21
|
|
|
23
22
|
hex_part = address[2:]
|
|
23
|
+
# Length and hex
|
|
24
24
|
if len(hex_part) < 1 or len(hex_part) > 64:
|
|
25
25
|
return False
|
|
26
26
|
if not re.fullmatch(r"[0-9a-fA-F]+", hex_part):
|
|
27
27
|
return False
|
|
28
28
|
|
|
29
|
-
# Convert to integer
|
|
29
|
+
# Convert to integer and range check
|
|
30
30
|
try:
|
|
31
31
|
value = int(hex_part, 16)
|
|
32
32
|
except ValueError:
|
|
33
33
|
return False
|
|
34
|
-
|
|
35
|
-
# Range check
|
|
36
34
|
if value >= MAX_STARKNET_ADDRESS:
|
|
37
35
|
return False
|
|
38
36
|
|
|
39
|
-
#
|
|
40
|
-
|
|
41
|
-
if hex_part.lower() == minimal:
|
|
37
|
+
# Full padded 64-char form
|
|
38
|
+
if len(hex_part) == 64:
|
|
42
39
|
return True
|
|
43
40
|
|
|
44
|
-
#
|
|
45
|
-
|
|
41
|
+
# Minimal form (no leading zeros)
|
|
42
|
+
canonical = hex(value)[2:]
|
|
43
|
+
return hex_part.lower() == canonical
|
mm_strk/balance.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import aiohttp
|
|
2
2
|
from aiohttp_socks import ProxyConnector
|
|
3
|
-
from
|
|
3
|
+
from mm_result import Result
|
|
4
4
|
from starknet_py.net.account.account import Account
|
|
5
5
|
from starknet_py.net.full_node_client import FullNodeClient
|
|
6
6
|
from starknet_py.net.models.chains import StarknetChainId
|
mm_strk/cli/cli.py
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
from typing import Annotated
|
|
2
2
|
|
|
3
|
+
import mm_print
|
|
3
4
|
import typer
|
|
4
|
-
from mm_std import print_plain
|
|
5
5
|
|
|
6
|
-
from mm_strk.cli import cli_utils
|
|
7
|
-
from mm_strk.cli.cmd import node_cmd
|
|
6
|
+
from mm_strk.cli import cli_utils, commands
|
|
8
7
|
|
|
9
8
|
app = typer.Typer(no_args_is_help=True, pretty_exceptions_enable=False, add_completion=False)
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
def version_callback(value: bool) -> None:
|
|
13
12
|
if value:
|
|
14
|
-
print_plain(f"mm-strk: {cli_utils.get_version()}")
|
|
13
|
+
mm_print.print_plain(f"mm-strk: {cli_utils.get_version()}")
|
|
15
14
|
raise typer.Exit
|
|
16
15
|
|
|
17
16
|
|
|
@@ -25,4 +24,4 @@ def node_command(
|
|
|
25
24
|
urls: Annotated[list[str], typer.Argument()],
|
|
26
25
|
proxy: Annotated[str | None, typer.Option("--proxy", "-p", help="Proxy")] = None,
|
|
27
26
|
) -> None:
|
|
28
|
-
|
|
27
|
+
commands.node.run(urls, proxy)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
|
|
3
|
+
import mm_print
|
|
3
4
|
import typer
|
|
4
|
-
from mm_std import print_json
|
|
5
5
|
from pydantic import BaseModel
|
|
6
6
|
from starknet_py.net.client_models import SyncStatus
|
|
7
7
|
from starknet_py.net.full_node_client import FullNodeClient
|
|
@@ -25,7 +25,7 @@ async def _run(urls: list[str]) -> None:
|
|
|
25
25
|
for url in urls:
|
|
26
26
|
result[url] = (await _node_status(url)).model_dump()
|
|
27
27
|
|
|
28
|
-
print_json(result)
|
|
28
|
+
mm_print.print_json(result)
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
async def _node_status(url: str) -> NodeStatus:
|
mm_strk/domain.py
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
from
|
|
1
|
+
from mm_http import http_request
|
|
2
|
+
from mm_result import Result
|
|
3
|
+
from mm_std import str_contains_any
|
|
2
4
|
|
|
3
5
|
|
|
4
6
|
async def address_to_domain(address: str, timeout: float = 5.0, proxy: str | None = None) -> Result[str | None]:
|
|
@@ -9,10 +11,10 @@ async def address_to_domain(address: str, timeout: float = 5.0, proxy: str | Non
|
|
|
9
11
|
and res.body is not None
|
|
10
12
|
and str_contains_any(res.body.lower(), ["no data found", "no domain found"])
|
|
11
13
|
):
|
|
12
|
-
return res.
|
|
14
|
+
return res.to_result_ok(None)
|
|
13
15
|
if res.is_err():
|
|
14
|
-
return res.
|
|
16
|
+
return res.to_result_err()
|
|
15
17
|
domain = res.parse_json_body("domain")
|
|
16
18
|
if domain:
|
|
17
|
-
return res.
|
|
18
|
-
return res.
|
|
19
|
+
return res.to_result_ok(domain)
|
|
20
|
+
return res.to_result_err("unknown_response")
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
mm_strk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
mm_strk/account.py,sha256=kalmNZgM-X2aEGWIk4s4XJUpS3TM2LL188Vjd-hMVds,1099
|
|
3
|
+
mm_strk/balance.py,sha256=jOCV1rm4lqXwwGU8CO49znOaUJWQxPukAbJiMkmti7k,1679
|
|
4
|
+
mm_strk/domain.py,sha256=cE_f7RZaifjuJaUa7G5bJRvQ8-jr1nszMtLZPI4oQYw,760
|
|
5
|
+
mm_strk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
mm_strk/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
mm_strk/cli/cli.py,sha256=ogLFNbTwUkc6fYjlerJ6AMUUV_p3XVdJlXN73Ft81NU,768
|
|
8
|
+
mm_strk/cli/cli_utils.py,sha256=4_QLJ_rEotHK90PRQqsvCuFydDOXPrXrnMndBffMPIg,103
|
|
9
|
+
mm_strk/cli/commands/__init__.py,sha256=ipr1wm0YQIJoEZLupmrGaom6uJUENhxFuSCOVvCJuW8,39
|
|
10
|
+
mm_strk/cli/commands/node.py,sha256=KWAbem9FMlBkfqkDFl4rpOrDOp2e5cSxvOg2wATgILM,1277
|
|
11
|
+
mm_strk-0.4.0.dist-info/METADATA,sha256=BhaNxC4eEsaQXFzkqh5921zAyBwterV5yVzMjWb-ApA,211
|
|
12
|
+
mm_strk-0.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
13
|
+
mm_strk-0.4.0.dist-info/entry_points.txt,sha256=X6zWJaYaUkTgJrY4LAVpcov8O43PmUU4cQ1ue8prYqQ,48
|
|
14
|
+
mm_strk-0.4.0.dist-info/RECORD,,
|
mm_strk/cli/cmd/__init__.py
DELETED
|
File without changes
|
mm_strk-0.3.3.dist-info/METADATA
DELETED
mm_strk-0.3.3.dist-info/RECORD
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
mm_strk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
mm_strk/account.py,sha256=43aMZp_DQ-ZWLm5HubbYwN4nyYbVcMWY2SJcbfILXfI,1257
|
|
3
|
-
mm_strk/balance.py,sha256=pcZutM1ZHcLpmdYuCNfWhB7_NGjiSw3H5YG1qDCAIis,1676
|
|
4
|
-
mm_strk/domain.py,sha256=s_u3kRkZDmOEt5eX2O7v3bOw9H56Eyfj1m9tHzi4gOQ,692
|
|
5
|
-
mm_strk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
mm_strk/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
mm_strk/cli/cli.py,sha256=SvIfjDq83HcFsiK_4S7Oez3Z_7OpYDIJreKALzWVUVQ,796
|
|
8
|
-
mm_strk/cli/cli_utils.py,sha256=4_QLJ_rEotHK90PRQqsvCuFydDOXPrXrnMndBffMPIg,103
|
|
9
|
-
mm_strk/cli/cmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
mm_strk/cli/cmd/node_cmd.py,sha256=ApBpGXmkQ1cGp2NPqTdqlAYS1SGNBzy81da-quVEHNo,1282
|
|
11
|
-
mm_strk-0.3.3.dist-info/METADATA,sha256=56nc5fysobe3uStoZcOfp7DL3om1wGRb9uvowSFoW5o,177
|
|
12
|
-
mm_strk-0.3.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
13
|
-
mm_strk-0.3.3.dist-info/entry_points.txt,sha256=X6zWJaYaUkTgJrY4LAVpcov8O43PmUU4cQ1ue8prYqQ,48
|
|
14
|
-
mm_strk-0.3.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|