mm-strk 0.3.2__py3-none-any.whl → 0.3.4__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 ADDED
@@ -0,0 +1,43 @@
1
+ import re
2
+
3
+ # Maximum allowable value for a StarkNet address (251 bits)
4
+ MAX_STARKNET_ADDRESS = 2**251
5
+
6
+
7
+ def is_address(address: str) -> bool:
8
+ """
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).
17
+ """
18
+ # Type and prefix
19
+ if not isinstance(address, str) or not address.startswith("0x"):
20
+ return False
21
+
22
+ hex_part = address[2:]
23
+ # Length and hex
24
+ if len(hex_part) < 1 or len(hex_part) > 64:
25
+ return False
26
+ if not re.fullmatch(r"[0-9a-fA-F]+", hex_part):
27
+ return False
28
+
29
+ # Convert to integer and range check
30
+ try:
31
+ value = int(hex_part, 16)
32
+ except ValueError:
33
+ return False
34
+ if value >= MAX_STARKNET_ADDRESS:
35
+ return False
36
+
37
+ # Full padded 64-char form
38
+ if len(hex_part) == 64:
39
+ return True
40
+
41
+ # Minimal form (no leading zeros)
42
+ canonical = hex(value)[2:]
43
+ return hex_part.lower() == canonical
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mm-strk
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Requires-Python: >=3.12
5
- Requires-Dist: mm-crypto-utils>=0.3.5
5
+ Requires-Dist: mm-crypto-utils~=0.3.7
6
6
  Requires-Dist: starknet-py~=0.26.2
7
- Requires-Dist: typer>=0.15.2
7
+ Requires-Dist: typer>=0.15.3
@@ -1,4 +1,5 @@
1
1
  mm_strk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ mm_strk/account.py,sha256=kalmNZgM-X2aEGWIk4s4XJUpS3TM2LL188Vjd-hMVds,1099
2
3
  mm_strk/balance.py,sha256=pcZutM1ZHcLpmdYuCNfWhB7_NGjiSw3H5YG1qDCAIis,1676
3
4
  mm_strk/domain.py,sha256=s_u3kRkZDmOEt5eX2O7v3bOw9H56Eyfj1m9tHzi4gOQ,692
4
5
  mm_strk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -7,7 +8,7 @@ mm_strk/cli/cli.py,sha256=SvIfjDq83HcFsiK_4S7Oez3Z_7OpYDIJreKALzWVUVQ,796
7
8
  mm_strk/cli/cli_utils.py,sha256=4_QLJ_rEotHK90PRQqsvCuFydDOXPrXrnMndBffMPIg,103
8
9
  mm_strk/cli/cmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
10
  mm_strk/cli/cmd/node_cmd.py,sha256=ApBpGXmkQ1cGp2NPqTdqlAYS1SGNBzy81da-quVEHNo,1282
10
- mm_strk-0.3.2.dist-info/METADATA,sha256=w0OVDqOwKFgNsk-GMki5qOwsTWFD1xdia5hNL_KQOJ4,177
11
- mm_strk-0.3.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
12
- mm_strk-0.3.2.dist-info/entry_points.txt,sha256=X6zWJaYaUkTgJrY4LAVpcov8O43PmUU4cQ1ue8prYqQ,48
13
- mm_strk-0.3.2.dist-info/RECORD,,
11
+ mm_strk-0.3.4.dist-info/METADATA,sha256=JJk9jqXwZUQRUZc_V4offP3N6jwDKfItJrXgc3HDOVk,177
12
+ mm_strk-0.3.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
+ mm_strk-0.3.4.dist-info/entry_points.txt,sha256=X6zWJaYaUkTgJrY4LAVpcov8O43PmUU4cQ1ue8prYqQ,48
14
+ mm_strk-0.3.4.dist-info/RECORD,,