cartha-cli 1.0.0__py3-none-any.whl → 1.0.2__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.
@@ -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
53
  from ...testnet.pool_ids import pool_id_to_name
40
- except ImportError:
41
- # Fallback if running from different context
42
- def pool_id_to_name(pool_id: str) -> str | None:
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
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,13 +7,27 @@ 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
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:
30
+ except (ImportError, ModuleNotFoundError):
17
31
  # Fallback if running from different context
18
32
  import sys
19
33
  from pathlib import Path
@@ -28,19 +42,16 @@ except ImportError:
28
42
  pool_id_to_chain_id,
29
43
  pool_id_to_vault_address,
30
44
  )
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
45
+ except (ImportError, ModuleNotFoundError):
46
+ # Use fallback functions
47
+ list_pools = _fallback_list_pools
48
+ pool_id_to_vault_address = _fallback_pool_id_to_vault_address
49
+ pool_id_to_chain_id = _fallback_pool_id_to_chain_id
50
+ else:
51
+ # Use fallback functions if testnet directory doesn't exist
52
+ list_pools = _fallback_list_pools
53
+ pool_id_to_vault_address = _fallback_pool_id_to_vault_address
54
+ pool_id_to_chain_id = _fallback_pool_id_to_chain_id
44
55
 
45
56
 
46
57
  def pools(
@@ -43,6 +43,48 @@ 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
89
  from ...testnet.pool_ids import (
48
90
  format_pool_id,
@@ -54,7 +96,7 @@ try:
54
96
  vault_address_to_chain_id,
55
97
  vault_address_to_pool_id,
56
98
  )
57
- except ImportError:
99
+ except (ImportError, ModuleNotFoundError):
58
100
  # Fallback if running from different context
59
101
  import sys
60
102
  from pathlib import Path
@@ -74,47 +116,26 @@ except ImportError:
74
116
  vault_address_to_chain_id,
75
117
  vault_address_to_pool_id,
76
118
  )
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
119
+ except (ImportError, ModuleNotFoundError):
120
+ # Use fallback functions
121
+ pool_name_to_id = _fallback_pool_name_to_id
122
+ pool_id_to_name = _fallback_pool_id_to_name
123
+ format_pool_id = _fallback_format_pool_id
124
+ list_pools = _fallback_list_pools
125
+ pool_id_to_vault_address = _fallback_pool_id_to_vault_address
126
+ vault_address_to_pool_id = _fallback_vault_address_to_pool_id
127
+ pool_id_to_chain_id = _fallback_pool_id_to_chain_id
128
+ vault_address_to_chain_id = _fallback_vault_address_to_chain_id
129
+ else:
130
+ # Use fallback functions if testnet directory doesn't exist
131
+ pool_name_to_id = _fallback_pool_name_to_id
132
+ pool_id_to_name = _fallback_pool_id_to_name
133
+ format_pool_id = _fallback_format_pool_id
134
+ list_pools = _fallback_list_pools
135
+ pool_id_to_vault_address = _fallback_pool_id_to_vault_address
136
+ vault_address_to_pool_id = _fallback_vault_address_to_pool_id
137
+ pool_id_to_chain_id = _fallback_pool_id_to_chain_id
138
+ vault_address_to_chain_id = _fallback_vault_address_to_chain_id
118
139
 
119
140
 
120
141
  def prove_lock(
@@ -639,8 +660,8 @@ def prove_lock(
639
660
  "• Liquidation events may result in partial loss of capital\n"
640
661
  "• Lost funds are NOT reimbursed - this is the LP risk model\n"
641
662
  "• You earn subnet rewards + liquidation fees in return\n"
642
- "• Minimum collateral: 100k USDC to maintain full emission scoring\n"
643
- "• If your withdrawable balance falls below 100k USDC, your emission scoring will be reduced\n\n"
663
+ "• Minimum collateral: 100k USDC total across all your positions to maintain full emission scoring\n"
664
+ "• If your total withdrawable balance across all positions falls below 100k USDC, your emission scoring will be reduced\n\n"
644
665
  "[bold red]Only commit funds you can afford to lose.[/]\n\n"
645
666
  "[dim]This disclosure is required for all liquidity providers.[/]\n"
646
667
  "[dim]more information: https://docs.0xmarkets.io/legal-and-risk[/]",
@@ -68,8 +68,11 @@ def register(
68
68
  session tokens instead of passwords.
69
69
  """
70
70
 
71
- assert wallet_name is not None # nosec - enforced by Typer prompt
72
- assert wallet_hotkey is not None # nosec - enforced by Typer prompt
71
+ # Prompt for wallet name and hotkey if not provided
72
+ if wallet_name is None:
73
+ wallet_name = typer.prompt("Coldkey wallet name", default="default")
74
+ if wallet_hotkey is None:
75
+ wallet_hotkey = typer.prompt("Hotkey name", default="default")
73
76
 
74
77
  # Auto-map netuid and verifier URL based on network
75
78
  if network == "test":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cartha-cli
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: CLI utilities for Cartha subnet miners.
5
5
  Project-URL: Homepage, https://cartha.finance
6
6
  Project-URL: Repository, https://github.com/General-Tao-Ventures/cartha-cli
@@ -45,34 +45,36 @@ Cartha CLI makes mining on the Cartha subnet effortless. As the Liquidity Provid
45
45
  - **💼 Multi-Pool Management** - Track multiple trading pairs in one place
46
46
  - **🔑 Secure by Default** - Your password stays hidden until you actually need it
47
47
 
48
- ## Quick Start
48
+ ## Installation
49
49
 
50
50
  ```bash
51
- # Install dependencies
52
- uv sync
51
+ pip install cartha-cli
52
+ ```
53
+
54
+ ## Quick Start
53
55
 
56
+ ```bash
54
57
  # Show available commands
55
- uv run cartha
58
+ cartha --help
56
59
 
57
60
  # Get started with registration
58
- uv run cartha miner register --help
61
+ cartha miner register --help
59
62
 
60
63
  # Check your miner status (no authentication needed)
61
- uv run cartha miner status --help
64
+ cartha miner status --help
62
65
 
63
66
  # Check CLI health and connectivity
64
- uv run cartha health
67
+ cartha health
65
68
 
66
69
  # Or use short aliases
67
- uv run cartha m status
68
- uv run cartha v lock
70
+ cartha m status
71
+ cartha v lock
69
72
  ```
70
73
 
71
74
  ## Requirements
72
75
 
73
76
  - Python 3.11
74
77
  - Bittensor wallet
75
- - [`uv`](https://github.com/astral-sh/uv) package manager (or pip)
76
78
 
77
79
  ## What You Can Do
78
80
 
@@ -15,14 +15,14 @@ cartha_cli/commands/health.py,sha256=NRwmIultxUzAe7udOOBIdkcdGG5KsE_kuCs43LZObGk
15
15
  cartha_cli/commands/help.py,sha256=6ubfWtmjXfCtp6L_PYvn7rR7m5C_pp-iEjtRc6BS0GA,1721
16
16
  cartha_cli/commands/miner_password.py,sha256=7cbcyrJ9KzCyJ68_174U_CXjBUt9BaYhgKAycRpv7AE,11078
17
17
  cartha_cli/commands/miner_status.py,sha256=tWlCWcuwm9NEd4USuCLp_6qObikX2odc2e7m6Y_vNrU,21873
18
- cartha_cli/commands/pair_status.py,sha256=Sk6-bIAcgAH3KxGg0Hw3PofLW_4eyonLUmJOkJ8gem0,19821
19
- cartha_cli/commands/pools.py,sha256=LkFJlur1T5lxV2qz7DeYYj9GbyRiy0wjb1mUNsV1zQg,4104
20
- cartha_cli/commands/prove_lock.py,sha256=rNxuKupTGyJ-SzKA5Yil6t6fPmLuzbX4jG4D4ZzVo4c,60562
21
- cartha_cli/commands/register.py,sha256=m7BLTTmiEbeXRrStUSNQbwI79IN4KOBEjU-nN6cSU4k,10109
18
+ cartha_cli/commands/pair_status.py,sha256=Q_CTi-7vrvpe0XYiuf_RFdFNXiBcs84xLcTYguxb4ho,19979
19
+ cartha_cli/commands/pools.py,sha256=hXtqRmBLfcMe_FJiW_rcVcttyt7jMX37n0mZAXSnmOU,4661
20
+ cartha_cli/commands/prove_lock.py,sha256=A5AZkfqCLbDio4idud4XV-ktYRhYVOA22WhqPojyFc8,61480
21
+ cartha_cli/commands/register.py,sha256=sxbYO0V4NucOKLZpaFoVnhFDHLSLDHREoMtN9DjyLsM,10227
22
22
  cartha_cli/commands/shared_options.py,sha256=itHzJSgxuKQxUVOh1_jVTcMQXjI3PPzexQyhqIbabxc,5874
23
23
  cartha_cli/commands/version.py,sha256=u5oeccQzK0LLcCbgZm0U8-Vslk5vB_lVvW3xT5HPeTg,456
24
- cartha_cli-1.0.0.dist-info/METADATA,sha256=W_n3aBURJG5xcgP-r9HF9grG5stONJLHYRsrUgaOZcg,5875
25
- cartha_cli-1.0.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
26
- cartha_cli-1.0.0.dist-info/entry_points.txt,sha256=sTYVMgb9l0fuJibUtWpGnIoDmgHinne97G4Y_cCwC-U,43
27
- cartha_cli-1.0.0.dist-info/licenses/LICENSE,sha256=B4UCiDn13m4xYwIl4TMKfbuKw7kh9pg4c81rJecxHSo,1076
28
- cartha_cli-1.0.0.dist-info/RECORD,,
24
+ cartha_cli-1.0.2.dist-info/METADATA,sha256=oCfBEiLZfg8QSFW-Ml9smIh0WNPG-vQ2QKbC4oKZG6c,5794
25
+ cartha_cli-1.0.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
26
+ cartha_cli-1.0.2.dist-info/entry_points.txt,sha256=sTYVMgb9l0fuJibUtWpGnIoDmgHinne97G4Y_cCwC-U,43
27
+ cartha_cli-1.0.2.dist-info/licenses/LICENSE,sha256=B4UCiDn13m4xYwIl4TMKfbuKw7kh9pg4c81rJecxHSo,1076
28
+ cartha_cli-1.0.2.dist-info/RECORD,,