mm-apt 0.3.3__py3-none-any.whl → 0.3.5__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_apt/account.py ADDED
@@ -0,0 +1,36 @@
1
+ import re
2
+
3
+ # Maximum allowable Aptos account address value (256 bits)
4
+ MAX_APTOS_ADDRESS = 2**256
5
+
6
+
7
+ def is_valid_address(address: str) -> bool:
8
+ """
9
+ Check if the address is a valid Aptos account address.
10
+
11
+ Requirements:
12
+ - Must be a 32-byte (64 hex characters) string.
13
+ - Must be an entire 64-character hex string, padded with leading zeros as needed.
14
+ - Optional '0x' or '0X' prefix is allowed.
15
+ - Numeric value must be < 2**256.
16
+ """
17
+ # Ensure input is a string
18
+ if not isinstance(address, str):
19
+ return False
20
+
21
+ # Remove optional prefix
22
+ hex_part = address[2:] if address.startswith(("0x", "0X")) else address
23
+
24
+ # Must be exactly 64 hex characters
25
+ if len(hex_part) != 64:
26
+ return False
27
+ if not re.fullmatch(r"[0-9a-fA-F]{64}", hex_part):
28
+ return False
29
+
30
+ # Convert to integer and check range
31
+ try:
32
+ value = int(hex_part, 16)
33
+ except ValueError:
34
+ return False
35
+
36
+ return 0 <= value < MAX_APTOS_ADDRESS
mm_apt/retry.py ADDED
@@ -0,0 +1,12 @@
1
+ from mm_crypto_utils import Nodes, Proxies, retry_with_node_and_proxy
2
+ from mm_std import Result
3
+
4
+ from mm_apt import balance
5
+
6
+
7
+ async def get_balance(
8
+ retries: int, nodes: Nodes, proxies: Proxies, *, account: str, coin_type: str, timeout: float = 5
9
+ ) -> Result[int]:
10
+ return await retry_with_node_and_proxy(
11
+ retries, nodes, proxies, lambda node, proxy: balance.get_balance(node, account, coin_type, timeout, proxy)
12
+ )
@@ -1,5 +1,5 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mm-apt
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Requires-Python: >=3.12
5
- Requires-Dist: mm-crypto-utils>=0.3.5
5
+ Requires-Dist: mm-crypto-utils>=0.3.7
@@ -1,8 +1,10 @@
1
1
  mm_apt/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ mm_apt/account.py,sha256=0_YyNjR3LL5EI_rCuQA5q3wTx52RyIeSIPG99CeuYNs,993
2
3
  mm_apt/ans.py,sha256=LP9lgOW6nIC2cIWhl6iQKKMKi6I7ni2FarJ1QISyNmo,1104
3
4
  mm_apt/balance.py,sha256=5GHPwxFy550FjHSTGxL3N3GcQu68nGg6RkNdl5mLimY,583
4
5
  mm_apt/coin.py,sha256=NuVFVxDcL3acXdZBLr79dbzT44bWHZP2gtLILWxTzdE,71
5
6
  mm_apt/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- mm_apt-0.3.3.dist-info/METADATA,sha256=BzVa5pn2N-2NBOLnDw-hxZAkfrHXcoESz0BBBVzcE20,112
7
- mm_apt-0.3.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
- mm_apt-0.3.3.dist-info/RECORD,,
7
+ mm_apt/retry.py,sha256=ONVBcoiJRfhgTtgt5vB7-e6DOv0RBJkkKEeN-mVhqm0,434
8
+ mm_apt-0.3.5.dist-info/METADATA,sha256=9dYNRckmx3_fbwECDlNHwtzaHwQB6nyA-lyrXvhzMnk,112
9
+ mm_apt-0.3.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
+ mm_apt-0.3.5.dist-info/RECORD,,
File without changes