cartha-cli 1.0.1__tar.gz → 1.0.3__tar.gz
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.
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/PKG-INFO +1 -1
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/commands/pair_status.py +18 -14
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/commands/pools.py +20 -29
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/commands/prove_lock.py +54 -62
- cartha_cli-1.0.3/cartha_cli/testnet/__init__.py +2 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/pyproject.toml +2 -1
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/.github/workflows/README.md +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/.github/workflows/ci.yml +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/.gitignore +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/.ruff.toml +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/CONTRIBUTING.md +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/LICENSE +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/Makefile +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/README.md +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/__init__.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/bt.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/commands/__init__.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/commands/common.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/commands/config.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/commands/health.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/commands/help.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/commands/miner_password.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/commands/miner_status.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/commands/register.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/commands/shared_options.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/commands/version.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/config.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/display.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/eth712.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/main.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/pair.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3/cartha_cli}/testnet/README.md +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3/cartha_cli}/testnet/pool_ids.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/utils.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/verifier.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/cartha_cli/wallet.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/docs/COMMANDS.md +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/docs/FEEDBACK.md +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/tests/conftest.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/tests/test_cli.py +0 -0
- {cartha_cli-1.0.1 → cartha_cli-1.0.3}/uv.lock +0 -0
|
@@ -35,21 +35,25 @@ from .shared_options import (
|
|
|
35
35
|
)
|
|
36
36
|
|
|
37
37
|
# Import pool name helper
|
|
38
|
+
# Initialize fallback function first to ensure it's always defined
|
|
39
|
+
def _fallback_pool_id_to_name(pool_id: str) -> str | None:
|
|
40
|
+
"""Simple fallback to decode pool ID."""
|
|
41
|
+
try:
|
|
42
|
+
hex_str = pool_id.lower().removeprefix("0x")
|
|
43
|
+
pool_bytes = bytes.fromhex(hex_str)
|
|
44
|
+
name = pool_bytes.rstrip(b"\x00").decode("utf-8", errors="ignore")
|
|
45
|
+
if name and name.isprintable():
|
|
46
|
+
return name
|
|
47
|
+
except Exception:
|
|
48
|
+
pass
|
|
49
|
+
return None
|
|
50
|
+
|
|
51
|
+
# Try to import from testnet module, fallback to default if not available
|
|
38
52
|
try:
|
|
39
|
-
from
|
|
40
|
-
except ImportError:
|
|
41
|
-
#
|
|
42
|
-
|
|
43
|
-
"""Simple fallback to decode pool ID."""
|
|
44
|
-
try:
|
|
45
|
-
hex_str = pool_id.lower().removeprefix("0x")
|
|
46
|
-
pool_bytes = bytes.fromhex(hex_str)
|
|
47
|
-
name = pool_bytes.rstrip(b"\x00").decode("utf-8", errors="ignore")
|
|
48
|
-
if name and name.isprintable():
|
|
49
|
-
return name
|
|
50
|
-
except Exception:
|
|
51
|
-
pass
|
|
52
|
-
return None
|
|
53
|
+
from ..testnet.pool_ids import pool_id_to_name
|
|
54
|
+
except (ImportError, ModuleNotFoundError):
|
|
55
|
+
# Use fallback function
|
|
56
|
+
pool_id_to_name = _fallback_pool_id_to_name
|
|
53
57
|
|
|
54
58
|
|
|
55
59
|
def pair_status(
|
|
@@ -7,40 +7,31 @@ import typer
|
|
|
7
7
|
from .common import console
|
|
8
8
|
|
|
9
9
|
# Import pool helpers for pool_id conversion
|
|
10
|
+
# Initialize fallback functions first to ensure they're always defined
|
|
11
|
+
def _fallback_list_pools() -> dict[str, str]:
|
|
12
|
+
"""Fallback: return empty dict."""
|
|
13
|
+
return {}
|
|
14
|
+
|
|
15
|
+
def _fallback_pool_id_to_vault_address(pool_id: str) -> str | None:
|
|
16
|
+
"""Fallback: return None."""
|
|
17
|
+
return None
|
|
18
|
+
|
|
19
|
+
def _fallback_pool_id_to_chain_id(pool_id: str) -> int | None:
|
|
20
|
+
"""Fallback: return None."""
|
|
21
|
+
return None
|
|
22
|
+
|
|
23
|
+
# Try to import from testnet module, fallback to defaults if not available
|
|
10
24
|
try:
|
|
11
|
-
from
|
|
25
|
+
from ..testnet.pool_ids import (
|
|
12
26
|
list_pools,
|
|
13
27
|
pool_id_to_chain_id,
|
|
14
28
|
pool_id_to_vault_address,
|
|
15
29
|
)
|
|
16
|
-
except ImportError:
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
# Try adding parent directory to path
|
|
22
|
-
testnet_dir = Path(__file__).parent.parent.parent / "testnet"
|
|
23
|
-
if testnet_dir.exists():
|
|
24
|
-
sys.path.insert(0, str(testnet_dir.parent))
|
|
25
|
-
try:
|
|
26
|
-
from testnet.pool_ids import (
|
|
27
|
-
list_pools,
|
|
28
|
-
pool_id_to_chain_id,
|
|
29
|
-
pool_id_to_vault_address,
|
|
30
|
-
)
|
|
31
|
-
except ImportError:
|
|
32
|
-
# Final fallback
|
|
33
|
-
def list_pools() -> dict[str, str]:
|
|
34
|
-
"""Fallback: return empty dict."""
|
|
35
|
-
return {}
|
|
36
|
-
|
|
37
|
-
def pool_id_to_vault_address(pool_id: str) -> str | None:
|
|
38
|
-
"""Fallback: return None."""
|
|
39
|
-
return None
|
|
40
|
-
|
|
41
|
-
def pool_id_to_chain_id(pool_id: str) -> int | None:
|
|
42
|
-
"""Fallback: return None."""
|
|
43
|
-
return None
|
|
30
|
+
except (ImportError, ModuleNotFoundError):
|
|
31
|
+
# Use fallback functions if import failed
|
|
32
|
+
list_pools = _fallback_list_pools
|
|
33
|
+
pool_id_to_vault_address = _fallback_pool_id_to_vault_address
|
|
34
|
+
pool_id_to_chain_id = _fallback_pool_id_to_chain_id
|
|
44
35
|
|
|
45
36
|
|
|
46
37
|
def pools(
|
|
@@ -43,8 +43,51 @@ from .shared_options import (
|
|
|
43
43
|
)
|
|
44
44
|
|
|
45
45
|
# Import pool helpers for pool_id conversion
|
|
46
|
+
# Initialize fallback functions first to ensure they're always defined
|
|
47
|
+
def _fallback_pool_name_to_id(pool_name: str) -> str:
|
|
48
|
+
"""Fallback: encode pool name as hex."""
|
|
49
|
+
name_bytes = pool_name.encode("utf-8")
|
|
50
|
+
padded = name_bytes.ljust(32, b"\x00")
|
|
51
|
+
return "0x" + padded.hex()
|
|
52
|
+
|
|
53
|
+
def _fallback_pool_id_to_name(pool_id: str) -> str | None:
|
|
54
|
+
"""Fallback: try to decode."""
|
|
55
|
+
try:
|
|
56
|
+
hex_str = pool_id.lower().removeprefix("0x")
|
|
57
|
+
pool_bytes = bytes.fromhex(hex_str)
|
|
58
|
+
name = pool_bytes.rstrip(b"\x00").decode("utf-8", errors="ignore")
|
|
59
|
+
return name if name and name.isprintable() else None
|
|
60
|
+
except Exception:
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
def _fallback_format_pool_id(pool_id: str) -> str:
|
|
64
|
+
"""Fallback: return pool_id as-is."""
|
|
65
|
+
return pool_id
|
|
66
|
+
|
|
67
|
+
def _fallback_list_pools() -> dict[str, str]:
|
|
68
|
+
"""Fallback: return empty dict."""
|
|
69
|
+
return {}
|
|
70
|
+
|
|
71
|
+
def _fallback_pool_id_to_vault_address(pool_id: str) -> str | None:
|
|
72
|
+
"""Fallback: return None."""
|
|
73
|
+
return None
|
|
74
|
+
|
|
75
|
+
def _fallback_vault_address_to_pool_id(vault_address: str) -> str | None:
|
|
76
|
+
"""Fallback: return None."""
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
def _fallback_pool_id_to_chain_id(pool_id: str) -> int | None:
|
|
80
|
+
"""Fallback: return None."""
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
def _fallback_vault_address_to_chain_id(vault_address: str) -> int | None:
|
|
84
|
+
"""Fallback: return None."""
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
# Try to import from testnet module, fallback to defaults if not available
|
|
46
88
|
try:
|
|
47
|
-
from
|
|
89
|
+
# Import from cartha_cli.testnet (works both in development and when installed)
|
|
90
|
+
from ..testnet.pool_ids import (
|
|
48
91
|
format_pool_id,
|
|
49
92
|
list_pools,
|
|
50
93
|
pool_id_to_chain_id,
|
|
@@ -54,67 +97,16 @@ try:
|
|
|
54
97
|
vault_address_to_chain_id,
|
|
55
98
|
vault_address_to_pool_id,
|
|
56
99
|
)
|
|
57
|
-
except ImportError:
|
|
58
|
-
#
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
from testnet.pool_ids import (
|
|
68
|
-
format_pool_id,
|
|
69
|
-
list_pools,
|
|
70
|
-
pool_id_to_chain_id,
|
|
71
|
-
pool_id_to_name,
|
|
72
|
-
pool_id_to_vault_address,
|
|
73
|
-
pool_name_to_id,
|
|
74
|
-
vault_address_to_chain_id,
|
|
75
|
-
vault_address_to_pool_id,
|
|
76
|
-
)
|
|
77
|
-
except ImportError:
|
|
78
|
-
# Final fallback
|
|
79
|
-
def pool_name_to_id(pool_name: str) -> str:
|
|
80
|
-
"""Fallback: encode pool name as hex."""
|
|
81
|
-
name_bytes = pool_name.encode("utf-8")
|
|
82
|
-
padded = name_bytes.ljust(32, b"\x00")
|
|
83
|
-
return "0x" + padded.hex()
|
|
84
|
-
|
|
85
|
-
def pool_id_to_name(pool_id: str) -> str | None:
|
|
86
|
-
"""Fallback: try to decode."""
|
|
87
|
-
try:
|
|
88
|
-
hex_str = pool_id.lower().removeprefix("0x")
|
|
89
|
-
pool_bytes = bytes.fromhex(hex_str)
|
|
90
|
-
name = pool_bytes.rstrip(b"\x00").decode("utf-8", errors="ignore")
|
|
91
|
-
return name if name and name.isprintable() else None
|
|
92
|
-
except Exception:
|
|
93
|
-
return None
|
|
94
|
-
|
|
95
|
-
def format_pool_id(pool_id: str) -> str:
|
|
96
|
-
"""Fallback: return pool_id as-is."""
|
|
97
|
-
return pool_id
|
|
98
|
-
|
|
99
|
-
def list_pools() -> dict[str, str]:
|
|
100
|
-
"""Fallback: return empty dict."""
|
|
101
|
-
return {}
|
|
102
|
-
|
|
103
|
-
def pool_id_to_vault_address(pool_id: str) -> str | None:
|
|
104
|
-
"""Fallback: return None."""
|
|
105
|
-
return None
|
|
106
|
-
|
|
107
|
-
def vault_address_to_pool_id(vault_address: str) -> str | None:
|
|
108
|
-
"""Fallback: return None."""
|
|
109
|
-
return None
|
|
110
|
-
|
|
111
|
-
def pool_id_to_chain_id(pool_id: str) -> int | None:
|
|
112
|
-
"""Fallback: return None."""
|
|
113
|
-
return None
|
|
114
|
-
|
|
115
|
-
def vault_address_to_chain_id(vault_address: str) -> int | None:
|
|
116
|
-
"""Fallback: return None."""
|
|
117
|
-
return None
|
|
100
|
+
except (ImportError, ModuleNotFoundError):
|
|
101
|
+
# Use fallback functions if import failed
|
|
102
|
+
pool_name_to_id = _fallback_pool_name_to_id
|
|
103
|
+
pool_id_to_name = _fallback_pool_id_to_name
|
|
104
|
+
format_pool_id = _fallback_format_pool_id
|
|
105
|
+
list_pools = _fallback_list_pools
|
|
106
|
+
pool_id_to_vault_address = _fallback_pool_id_to_vault_address
|
|
107
|
+
vault_address_to_pool_id = _fallback_vault_address_to_pool_id
|
|
108
|
+
pool_id_to_chain_id = _fallback_pool_id_to_chain_id
|
|
109
|
+
vault_address_to_chain_id = _fallback_vault_address_to_chain_id
|
|
118
110
|
|
|
119
111
|
|
|
120
112
|
def prove_lock(
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cartha-cli"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.3"
|
|
8
8
|
description = "CLI utilities for Cartha subnet miners."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11,<3.12"
|
|
@@ -50,3 +50,4 @@ cartha = "cartha_cli:main"
|
|
|
50
50
|
[tool.pytest.ini_options]
|
|
51
51
|
addopts = "-ra"
|
|
52
52
|
testpaths = ["tests"]
|
|
53
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|