cartha-cli 1.0.4__py3-none-any.whl → 1.0.7__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.
cartha_cli/bt.py CHANGED
@@ -51,92 +51,100 @@ def register_hotkey(
51
51
  """Register a hotkey on the target subnet and return the resulting UID."""
52
52
 
53
53
  subtensor = get_subtensor(network)
54
- wallet = get_wallet(wallet_name, hotkey_name)
55
- hotkey_ss58 = wallet.hotkey.ss58_address
56
-
57
- if subtensor.is_hotkey_registered(hotkey_ss58, netuid=netuid):
58
- neuron = subtensor.get_neuron_for_pubkey_and_subnet(hotkey_ss58, netuid)
59
- uid = None if getattr(neuron, "is_null", False) else getattr(neuron, "uid", None)
60
- return RegistrationResult(status="already", success=True, uid=uid, hotkey=hotkey_ss58)
54
+ try:
55
+ wallet = get_wallet(wallet_name, hotkey_name)
56
+ hotkey_ss58 = wallet.hotkey.ss58_address
61
57
 
62
- # Get balance before registration
63
- balance_before = None
64
- balance_after = None
65
- extrinsic = None
58
+ if subtensor.is_hotkey_registered(hotkey_ss58, netuid=netuid):
59
+ neuron = subtensor.get_neuron_for_pubkey_and_subnet(hotkey_ss58, netuid)
60
+ uid = None if getattr(neuron, "is_null", False) else getattr(neuron, "uid", None)
61
+ return RegistrationResult(status="already", success=True, uid=uid, hotkey=hotkey_ss58)
66
62
 
67
- try:
68
- balance_obj = subtensor.get_balance(wallet.coldkeypub.ss58_address)
69
- # Convert Balance object to float using .tao property
70
- balance_before = balance_obj.tao if hasattr(balance_obj, "tao") else float(balance_obj)
71
- except Exception:
72
- pass # Balance may not be available, continue anyway
73
-
74
- if burned:
75
- # burned_register returns (success, block_info) or just success
76
- registration_result = subtensor.burned_register(
77
- wallet=wallet,
78
- netuid=netuid,
79
- wait_for_finalization=wait_for_finalization,
80
- )
63
+ # Get balance before registration
64
+ balance_before = None
65
+ balance_after = None
66
+ extrinsic = None
81
67
 
82
- # Handle both return types: bool or (bool, message)
83
- if isinstance(registration_result, tuple):
84
- ok, message = registration_result
85
- if isinstance(message, str) and message:
86
- extrinsic = message
68
+ try:
69
+ balance_obj = subtensor.get_balance(wallet.coldkeypub.ss58_address)
70
+ # Convert Balance object to float using .tao property
71
+ balance_before = balance_obj.tao if hasattr(balance_obj, "tao") else float(balance_obj)
72
+ except Exception:
73
+ pass # Balance may not be available, continue anyway
74
+
75
+ if burned:
76
+ # burned_register returns (success, block_info) or just success
77
+ registration_result = subtensor.burned_register(
78
+ wallet=wallet,
79
+ netuid=netuid,
80
+ wait_for_finalization=wait_for_finalization,
81
+ )
82
+
83
+ # Handle both return types: bool or (bool, message)
84
+ if isinstance(registration_result, tuple):
85
+ ok, message = registration_result
86
+ if isinstance(message, str) and message:
87
+ extrinsic = message
88
+ else:
89
+ ok = registration_result
90
+
91
+ status = "burned"
87
92
  else:
88
- ok = registration_result
89
-
90
- status = "burned"
91
- else:
92
- ok = subtensor.register(
93
- wallet=wallet,
94
- netuid=netuid,
95
- wait_for_finalization=wait_for_finalization,
96
- wait_for_inclusion=wait_for_inclusion,
97
- cuda=cuda,
98
- dev_id=dev_id,
99
- tpb=tpb,
100
- num_processes=num_processes,
101
- log_verbose=False,
102
- )
103
- status = "pow"
104
- if isinstance(ok, tuple) and len(ok) == 2:
105
- ok, message = ok
106
- if isinstance(message, str):
107
- extrinsic = message
93
+ ok = subtensor.register(
94
+ wallet=wallet,
95
+ netuid=netuid,
96
+ wait_for_finalization=wait_for_finalization,
97
+ wait_for_inclusion=wait_for_inclusion,
98
+ cuda=cuda,
99
+ dev_id=dev_id,
100
+ tpb=tpb,
101
+ num_processes=num_processes,
102
+ log_verbose=False,
103
+ )
104
+ status = "pow"
105
+ if isinstance(ok, tuple) and len(ok) == 2:
106
+ ok, message = ok
107
+ if isinstance(message, str):
108
+ extrinsic = message
109
+
110
+ if not ok:
111
+ return RegistrationResult(
112
+ status=status,
113
+ success=False,
114
+ uid=None,
115
+ hotkey=hotkey_ss58,
116
+ balance_before=balance_before,
117
+ balance_after=balance_after,
118
+ extrinsic=extrinsic,
119
+ )
120
+
121
+ # Get balance after registration
122
+ try:
123
+ balance_obj = subtensor.get_balance(wallet.coldkeypub.ss58_address)
124
+ # Convert Balance object to float using .tao property
125
+ balance_after = balance_obj.tao if hasattr(balance_obj, "tao") else float(balance_obj)
126
+ except Exception:
127
+ pass
128
+
129
+ neuron = subtensor.get_neuron_for_pubkey_and_subnet(hotkey_ss58, netuid)
130
+ uid = None if getattr(neuron, "is_null", False) else getattr(neuron, "uid", None)
108
131
 
109
- if not ok:
110
132
  return RegistrationResult(
111
133
  status=status,
112
- success=False,
113
- uid=None,
134
+ success=True,
135
+ uid=uid,
114
136
  hotkey=hotkey_ss58,
115
137
  balance_before=balance_before,
116
138
  balance_after=balance_after,
117
139
  extrinsic=extrinsic,
118
140
  )
119
-
120
- # Get balance after registration
121
- try:
122
- balance_obj = subtensor.get_balance(wallet.coldkeypub.ss58_address)
123
- # Convert Balance object to float using .tao property
124
- balance_after = balance_obj.tao if hasattr(balance_obj, "tao") else float(balance_obj)
125
- except Exception:
126
- pass
127
-
128
- neuron = subtensor.get_neuron_for_pubkey_and_subnet(hotkey_ss58, netuid)
129
- uid = None if getattr(neuron, "is_null", False) else getattr(neuron, "uid", None)
130
-
131
- return RegistrationResult(
132
- status=status,
133
- success=True,
134
- uid=uid,
135
- hotkey=hotkey_ss58,
136
- balance_before=balance_before,
137
- balance_after=balance_after,
138
- extrinsic=extrinsic,
139
- )
141
+ finally:
142
+ # Clean up subtensor connection
143
+ try:
144
+ if hasattr(subtensor, "close"):
145
+ subtensor.close()
146
+ except Exception:
147
+ pass # Silently ignore cleanup errors
140
148
 
141
149
 
142
150
  def get_burn_cost(network: str, netuid: int) -> float | None:
@@ -381,26 +381,31 @@ def prove_lock(
381
381
  if chain is None:
382
382
  # Try to get chain ID from pool ID first
383
383
  auto_chain_id = None
384
+ # Ensure pool_id is properly formatted (lowercase, with 0x prefix)
385
+ pool_id_normalized = pool_id.lower().strip()
386
+ if not pool_id_normalized.startswith("0x"):
387
+ pool_id_normalized = "0x" + pool_id_normalized
388
+
384
389
  try:
385
- auto_chain_id = pool_id_to_chain_id(pool_id)
386
- except (NameError, AttributeError):
390
+ auto_chain_id = pool_id_to_chain_id(pool_id_normalized)
391
+ except (NameError, AttributeError, TypeError):
387
392
  # Function not available - this shouldn't happen if imports worked
388
393
  # But handle gracefully by trying to import it
389
394
  try:
390
395
  from ..testnet.pool_ids import pool_id_to_chain_id
391
- auto_chain_id = pool_id_to_chain_id(pool_id)
392
- except (ImportError, ModuleNotFoundError):
396
+ auto_chain_id = pool_id_to_chain_id(pool_id_normalized)
397
+ except (ImportError, ModuleNotFoundError, TypeError):
393
398
  pass
394
399
 
395
400
  if not auto_chain_id:
396
401
  # Fallback: try to get from vault address
397
402
  try:
398
403
  auto_chain_id = vault_address_to_chain_id(vault)
399
- except (NameError, AttributeError):
404
+ except (NameError, AttributeError, TypeError):
400
405
  try:
401
406
  from ..testnet.pool_ids import vault_address_to_chain_id
402
407
  auto_chain_id = vault_address_to_chain_id(vault)
403
- except (ImportError, ModuleNotFoundError):
408
+ except (ImportError, ModuleNotFoundError, TypeError):
404
409
  pass
405
410
 
406
411
  if auto_chain_id:
@@ -410,22 +415,29 @@ def prove_lock(
410
415
  f"[bold green]✓ Auto-matched chain ID[/] - {chain_name} (chain ID: {chain})"
411
416
  )
412
417
  else:
413
- # Fallback: prompt for chain ID if no mapping found
414
- console.print(
415
- "[yellow]⚠ No chain ID mapping found. Please provide chain ID.[/]"
416
- )
417
- while True:
418
- try:
419
- chain_input = typer.prompt("Chain ID", show_default=False)
420
- chain = int(chain_input)
421
- if chain <= 0:
422
- console.print(
423
- "[bold red]Error:[/] Chain ID must be a positive integer"
424
- )
425
- continue
426
- break
427
- except ValueError:
428
- console.print("[bold red]Error:[/] Chain ID must be a valid integer")
418
+ # Fallback: if on testnet and we have a vault, default to Base Sepolia (84532)
419
+ if network == "test" and vault:
420
+ chain = 84532
421
+ console.print(
422
+ f"[bold green]✓ Auto-matched chain ID[/] - Base Sepolia (chain ID: 84532) [dim](testnet default)[/]"
423
+ )
424
+ else:
425
+ # Prompt for chain ID if no mapping found
426
+ console.print(
427
+ "[yellow]⚠ No chain ID mapping found. Please provide chain ID.[/]"
428
+ )
429
+ while True:
430
+ try:
431
+ chain_input = typer.prompt("Chain ID", show_default=False)
432
+ chain = int(chain_input)
433
+ if chain <= 0:
434
+ console.print(
435
+ "[bold red]Error:[/] Chain ID must be a positive integer"
436
+ )
437
+ continue
438
+ break
439
+ except ValueError:
440
+ console.print("[bold red]Error:[/] Chain ID must be a valid integer")
429
441
  else:
430
442
  # Chain ID was provided, verify it matches vault if possible
431
443
  expected_chain_id = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cartha-cli
3
- Version: 1.0.4
3
+ Version: 1.0.7
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
@@ -43,7 +43,7 @@ Cartha CLI makes mining on the Cartha subnet effortless. As the Liquidity Provid
43
43
  - **📊 Instant Status Updates** - See all your pools, balances, and expiration dates at a glance
44
44
  - **⏰ Smart Expiration Warnings** - Never miss a renewal with color-coded countdowns
45
45
  - **💼 Multi-Pool Management** - Track multiple trading pairs in one place
46
- - **🔑 Secure by Default** - Your password stays hidden until you actually need it
46
+ - **🔒 Secure Authentication** - Session-based authentication with your Bittensor hotkey
47
47
 
48
48
  ## Installation
49
49
 
@@ -64,17 +64,19 @@ cartha miner register --help
64
64
  cartha miner status --help
65
65
 
66
66
  # Check CLI health and connectivity
67
- cartha health
67
+ cartha utils health
68
68
 
69
69
  # Or use short aliases
70
70
  cartha m status
71
71
  cartha v lock
72
+ cartha u health
72
73
  ```
73
74
 
74
75
  ## Requirements
75
76
 
76
77
  - Python 3.11
77
- - Bittensor wallet
78
+ - Bittensor wallet within btcli
79
+ - learn how to create/import one here https://docs.learnbittensor.org/keys/working-with-keys
78
80
 
79
81
  ## What You Can Do
80
82
 
@@ -90,14 +92,12 @@ cartha miner register --wallet-name your-wallet --wallet-hotkey your-hotkey
90
92
  cartha miner status --wallet-name your-wallet --wallet-hotkey your-hotkey
91
93
  # Or use the short alias: cartha m status
92
94
  ```
93
-
94
- ### Track Your Pools
95
-
96
- See all your active trading pairs, balances, and when they expire—all in one command. The CLI shows you:
97
- - Which pools are active and earning rewards
98
- - How much you have locked in each pool
99
- - Days remaining before expiration (with helpful warnings)
100
- - Which pools are included in the next reward epoch
95
+ > **Track Your Miner Status**
96
+ > See all your active trading pairs, balances, and when they expire—all in one command. The CLI shows you:
97
+ > - Which pools are active and earning rewards
98
+ > - How much you have locked in each pool
99
+ > - Days remaining before expiration (with helpful warnings)
100
+ > - Which pools are included in the next reward epoch
101
101
 
102
102
  ### View Available Pools
103
103
 
@@ -110,14 +110,14 @@ cartha vault pools
110
110
 
111
111
  This shows you which pools are available, their full pool IDs, vault contract addresses, and chain IDs.
112
112
 
113
- ### Lock Your Funds
113
+ ### Lock Your Funds to start Mining
114
114
 
115
115
  Create a new lock position with the streamlined lock flow:
116
116
  ```bash
117
117
  cartha vault lock \
118
118
  --coldkey your-wallet \
119
119
  --hotkey your-hotkey \
120
- --pool-id "BTCUSD" \
120
+ --pool-id BTCUSD \
121
121
  --amount 1000.0 \
122
122
  --lock-days 30 \
123
123
  --owner-evm 0xYourEVMAddress \
@@ -136,36 +136,31 @@ The CLI will:
136
136
  1. Check your registration on the specified network (subnet 35 for finney, subnet 78 for test)
137
137
  2. Authenticate with your Bittensor hotkey
138
138
  3. Request a signed LockRequest from the verifier
139
- 4. Automatically open the Cartha Lock UI in your browser with all parameters pre-filled
139
+ 4. Automatically open the Cartha Lock UI in your browser with all parameters pre-filled (you can also paste the url into your browser manually)
140
140
  5. Guide you through Phase 1 (Approve USDC) and Phase 2 (Lock Position) via the web interface
141
141
  6. Automatically detect when approval completes and proceed to Phase 2
142
142
  7. The verifier automatically detects your lock and adds you to the upcoming epoch
143
143
 
144
144
  **Managing Positions**: Visit https://cartha.finance/manage to view all your positions, extend locks, or top up existing positions.
145
145
 
146
- ### View Your Password
147
-
148
- When you need your password (like for signing transactions):
149
- ```bash
150
- cartha miner password --wallet-name your-wallet --wallet-hotkey your-hotkey
151
- ```
152
-
153
- **Tip:** Use `miner status` for daily checks—it's faster and doesn't require signing. Only use `miner password` when you actually need it.
154
-
155
146
  ### Check Your Setup
156
147
 
157
148
  Verify your CLI is configured correctly and can reach all services:
158
149
 
159
150
  ```bash
160
- cartha health
151
+ cartha utils health
152
+ # Or use the short alias
153
+ cartha u health
161
154
  ```
162
155
 
163
156
  This checks:
164
157
  - Verifier connectivity and latency
165
158
  - Bittensor network connectivity
166
159
  - Configuration validation
160
+ - Subnet metadata
161
+ - Environment variables
167
162
 
168
- Use `cartha health --verbose` for detailed troubleshooting information.
163
+ Use `cartha utils health --verbose` (or `cartha u health --verbose`) for detailed troubleshooting information.
169
164
 
170
165
  ## Need Help?
171
166
 
@@ -179,4 +174,4 @@ We welcome contributions! Please see our [Feedback & Support](docs/FEEDBACK.md)
179
174
 
180
175
  ---
181
176
 
182
- **Made with ❤ by GTV**
177
+ **Made with ❤ by General Tensor**
@@ -1,5 +1,5 @@
1
1
  cartha_cli/__init__.py,sha256=cSKsPAfHW8_hqJkGMXUh4mFNz9HXsq-UcgRl8G_2KhM,720
2
- cartha_cli/bt.py,sha256=GGW8QvOgFPFNrIghu7JNygRmTgBeMt2vhEh26ZiPe4Q,6933
2
+ cartha_cli/bt.py,sha256=UC5n0LpLD2YNOL-xsawrzohXpuHaoClraQh3fu4qI90,7467
3
3
  cartha_cli/config.py,sha256=MSHNiRow1tzHUJeMOvQRQsTslntV6DecLTQ-Y_CmB4A,2294
4
4
  cartha_cli/display.py,sha256=Krim69DLgiCHSYDuWNjnOep25IAHUebRAceePHfsiRA,2040
5
5
  cartha_cli/eth712.py,sha256=5NU0MnvOk89mxWnkDHzoOaSHN8TJGRAHVLGXmCq8jhM,241
@@ -17,15 +17,15 @@ cartha_cli/commands/miner_password.py,sha256=7cbcyrJ9KzCyJ68_174U_CXjBUt9BaYhgKA
17
17
  cartha_cli/commands/miner_status.py,sha256=tWlCWcuwm9NEd4USuCLp_6qObikX2odc2e7m6Y_vNrU,21873
18
18
  cartha_cli/commands/pair_status.py,sha256=LoU-fA1MXuWZGHNmeKPMjwvNw30Yn094ZD1EC0-WXVc,19978
19
19
  cartha_cli/commands/pools.py,sha256=P02SEp23a7OdrgNj6AaiJTnQ9K_QrI300DzucA6HH8A,3884
20
- cartha_cli/commands/prove_lock.py,sha256=Pv41zrQYlHvRt_k1oD4oogPpNSF5ZYpwwpzDtGPBRmQ,60397
20
+ cartha_cli/commands/prove_lock.py,sha256=FkurHtL2i2891ACEV1TejTAgkutIV1grykatx0W-JCI,61168
21
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
24
  cartha_cli/testnet/README.md,sha256=kWKaLtq6t_46W-mvXkSaLi2fjXDELLk5ntVGkogiUY0,14511
25
25
  cartha_cli/testnet/__init__.py,sha256=xreJMXs-ZKTkPtUQBR5xdY7ImOyUiF7WKG6bv9J9aBM,41
26
26
  cartha_cli/testnet/pool_ids.py,sha256=0jvQ6tvc6sL0aGKkl31KXM6ngVpUboYiABY5SDMaRCQ,6747
27
- cartha_cli-1.0.4.dist-info/METADATA,sha256=hi8-tPSksk3s58HIx3RAwd2M6uFVFtOUlR02DkGExkQ,5794
28
- cartha_cli-1.0.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
29
- cartha_cli-1.0.4.dist-info/entry_points.txt,sha256=sTYVMgb9l0fuJibUtWpGnIoDmgHinne97G4Y_cCwC-U,43
30
- cartha_cli-1.0.4.dist-info/licenses/LICENSE,sha256=B4UCiDn13m4xYwIl4TMKfbuKw7kh9pg4c81rJecxHSo,1076
31
- cartha_cli-1.0.4.dist-info/RECORD,,
27
+ cartha_cli-1.0.7.dist-info/METADATA,sha256=E878CuRf8Mc_zua_l8H7wLQoFB_oZNDpIp7fYF8iYN4,5842
28
+ cartha_cli-1.0.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
29
+ cartha_cli-1.0.7.dist-info/entry_points.txt,sha256=sTYVMgb9l0fuJibUtWpGnIoDmgHinne97G4Y_cCwC-U,43
30
+ cartha_cli-1.0.7.dist-info/licenses/LICENSE,sha256=B4UCiDn13m4xYwIl4TMKfbuKw7kh9pg4c81rJecxHSo,1076
31
+ cartha_cli-1.0.7.dist-info/RECORD,,