cartha-cli 1.0.0__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.0/.github/workflows/README.md +43 -0
- cartha_cli-1.0.0/.github/workflows/ci.yml +61 -0
- cartha_cli-1.0.0/.gitignore +22 -0
- cartha_cli-1.0.0/.ruff.toml +9 -0
- cartha_cli-1.0.0/CONTRIBUTING.md +281 -0
- cartha_cli-1.0.0/LICENSE +21 -0
- cartha_cli-1.0.0/Makefile +9 -0
- cartha_cli-1.0.0/PKG-INFO +180 -0
- cartha_cli-1.0.0/README.md +147 -0
- cartha_cli-1.0.0/cartha_cli/__init__.py +34 -0
- cartha_cli-1.0.0/cartha_cli/bt.py +206 -0
- cartha_cli-1.0.0/cartha_cli/commands/__init__.py +25 -0
- cartha_cli-1.0.0/cartha_cli/commands/common.py +76 -0
- cartha_cli-1.0.0/cartha_cli/commands/config.py +294 -0
- cartha_cli-1.0.0/cartha_cli/commands/health.py +463 -0
- cartha_cli-1.0.0/cartha_cli/commands/help.py +49 -0
- cartha_cli-1.0.0/cartha_cli/commands/miner_password.py +283 -0
- cartha_cli-1.0.0/cartha_cli/commands/miner_status.py +524 -0
- cartha_cli-1.0.0/cartha_cli/commands/pair_status.py +484 -0
- cartha_cli-1.0.0/cartha_cli/commands/pools.py +121 -0
- cartha_cli-1.0.0/cartha_cli/commands/prove_lock.py +1260 -0
- cartha_cli-1.0.0/cartha_cli/commands/register.py +274 -0
- cartha_cli-1.0.0/cartha_cli/commands/shared_options.py +235 -0
- cartha_cli-1.0.0/cartha_cli/commands/version.py +15 -0
- cartha_cli-1.0.0/cartha_cli/config.py +75 -0
- cartha_cli-1.0.0/cartha_cli/display.py +62 -0
- cartha_cli-1.0.0/cartha_cli/eth712.py +7 -0
- cartha_cli-1.0.0/cartha_cli/main.py +237 -0
- cartha_cli-1.0.0/cartha_cli/pair.py +201 -0
- cartha_cli-1.0.0/cartha_cli/utils.py +274 -0
- cartha_cli-1.0.0/cartha_cli/verifier.py +342 -0
- cartha_cli-1.0.0/cartha_cli/wallet.py +59 -0
- cartha_cli-1.0.0/docs/COMMANDS.md +910 -0
- cartha_cli-1.0.0/docs/FEEDBACK.md +222 -0
- cartha_cli-1.0.0/pyproject.toml +52 -0
- cartha_cli-1.0.0/testnet/README.md +481 -0
- cartha_cli-1.0.0/testnet/pool_ids.py +208 -0
- cartha_cli-1.0.0/tests/conftest.py +3 -0
- cartha_cli-1.0.0/tests/test_cli.py +1986 -0
- cartha_cli-1.0.0/uv.lock +1655 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# GitHub Actions Workflows
|
|
2
|
+
|
|
3
|
+
This directory contains GitHub Actions workflows for the Cartha CLI.
|
|
4
|
+
|
|
5
|
+
## Workflows
|
|
6
|
+
|
|
7
|
+
### `ci.yml`
|
|
8
|
+
|
|
9
|
+
Runs on every push and pull request to `main` and `demo-verifier` branches.
|
|
10
|
+
|
|
11
|
+
**Jobs:**
|
|
12
|
+
- **test**: Runs the test suite using `pytest`
|
|
13
|
+
- **lint**: Runs `ruff check` and `ruff format --check` to ensure code quality
|
|
14
|
+
- **type-check**: Runs `mypy` for type checking (non-blocking)
|
|
15
|
+
|
|
16
|
+
**Status Checks:**
|
|
17
|
+
- For pull requests, the test job sets a commit status that appears in the PR checks
|
|
18
|
+
|
|
19
|
+
## Local Development
|
|
20
|
+
|
|
21
|
+
You can run the same checks locally:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Run tests
|
|
25
|
+
uv run pytest
|
|
26
|
+
|
|
27
|
+
# Run linting
|
|
28
|
+
uv run ruff check cartha_cli tests
|
|
29
|
+
uv run ruff format --check cartha_cli tests
|
|
30
|
+
|
|
31
|
+
# Run type checking
|
|
32
|
+
uv run mypy cartha_cli
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or use the Makefile:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
make test # Runs lint, typecheck, and tests
|
|
39
|
+
make lint # Runs ruff check
|
|
40
|
+
make format # Formats code with ruff
|
|
41
|
+
make typecheck # Runs mypy
|
|
42
|
+
```
|
|
43
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
workflow_dispatch: # Allow manual triggers
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
name: Run Tests
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
statuses: write
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout code
|
|
22
|
+
uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Install uv
|
|
25
|
+
uses: astral-sh/setup-uv@v4
|
|
26
|
+
with:
|
|
27
|
+
version: "latest"
|
|
28
|
+
|
|
29
|
+
- name: Set up Python
|
|
30
|
+
uses: actions/setup-python@v5
|
|
31
|
+
with:
|
|
32
|
+
python-version: "3.11"
|
|
33
|
+
|
|
34
|
+
- name: Install dependencies
|
|
35
|
+
run: uv sync
|
|
36
|
+
|
|
37
|
+
- name: Run tests
|
|
38
|
+
id: test
|
|
39
|
+
run: uv run pytest
|
|
40
|
+
env:
|
|
41
|
+
# Set test environment variables if needed
|
|
42
|
+
CARTHA_VERIFIER_URL: "https://cartha-verifier-826542474079.us-central1.run.app"
|
|
43
|
+
|
|
44
|
+
- name: Set Test Status
|
|
45
|
+
if: always() && github.event_name == 'pull_request'
|
|
46
|
+
uses: actions/github-script@v7
|
|
47
|
+
with:
|
|
48
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
49
|
+
script: |
|
|
50
|
+
const testStatus = '${{ steps.test.outcome }}';
|
|
51
|
+
const prSha = context.payload.pull_request.head.sha;
|
|
52
|
+
|
|
53
|
+
github.rest.repos.createCommitStatus({
|
|
54
|
+
owner: context.repo.owner,
|
|
55
|
+
repo: context.repo.repo,
|
|
56
|
+
sha: prSha,
|
|
57
|
+
state: testStatus === 'success' ? 'success' : 'failure',
|
|
58
|
+
target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
|
|
59
|
+
description: testStatus === 'success' ? 'All tests passed' : 'Tests failed',
|
|
60
|
+
context: 'ci/tests'
|
|
61
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
.mypy_cache/
|
|
4
|
+
.ruff_cache/
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
.venv/
|
|
7
|
+
.env
|
|
8
|
+
.DS_Store
|
|
9
|
+
|
|
10
|
+
# Build artifacts
|
|
11
|
+
dist/
|
|
12
|
+
build/
|
|
13
|
+
*.egg-info/
|
|
14
|
+
|
|
15
|
+
# Ignore testnet output files (contains sensitive payloads, signatures, and keys)
|
|
16
|
+
testnet/outputs/
|
|
17
|
+
**/lock_proof_payload.json
|
|
18
|
+
**/evm_key.json
|
|
19
|
+
**/demo_outputs/
|
|
20
|
+
**/outputs/
|
|
21
|
+
test-payload.json
|
|
22
|
+
cartha_eip712_outputs/
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# Contributing to Cartha CLI
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to the Cartha CLI! This guide will help you get started.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- Python 3.11
|
|
10
|
+
- [`uv`](https://github.com/astral-sh/uv) package manager or `pip`
|
|
11
|
+
- Git
|
|
12
|
+
- Basic understanding of Bittensor and EIP-712 signatures
|
|
13
|
+
|
|
14
|
+
### Development Setup
|
|
15
|
+
|
|
16
|
+
1. **Fork and clone the repository**
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
git clone https://github.com/your-username/cartha-cli.git
|
|
20
|
+
cd cartha-cli
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
2. **Install dependencies**
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
uv sync
|
|
27
|
+
# or
|
|
28
|
+
pip install -e .
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
3. **Run tests**
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
uv run pytest
|
|
35
|
+
# or
|
|
36
|
+
make test
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Development Workflow
|
|
40
|
+
|
|
41
|
+
### 1. Find Something to Work On
|
|
42
|
+
|
|
43
|
+
- Check [open issues](https://github.com/your-org/cartha-cli/issues)
|
|
44
|
+
- Look for `good first issue` labels
|
|
45
|
+
- Discuss major changes before starting (open an issue first)
|
|
46
|
+
|
|
47
|
+
### 2. Create a Branch
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git checkout -b feature/your-feature-name
|
|
51
|
+
# or
|
|
52
|
+
git checkout -b fix/your-bug-fix
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 3. Make Your Changes
|
|
56
|
+
|
|
57
|
+
- Write clean, readable code
|
|
58
|
+
- Follow existing code style
|
|
59
|
+
- Add tests for new functionality
|
|
60
|
+
- Update documentation as needed
|
|
61
|
+
|
|
62
|
+
### 4. Test Your Changes
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Run tests
|
|
66
|
+
uv run pytest
|
|
67
|
+
|
|
68
|
+
# Test CLI commands locally
|
|
69
|
+
uv run cartha --help
|
|
70
|
+
uv run cartha pair status --help
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 5. Commit Your Changes
|
|
74
|
+
|
|
75
|
+
- Write clear, descriptive commit messages
|
|
76
|
+
- Keep commits focused and atomic
|
|
77
|
+
- Reference issue numbers when applicable
|
|
78
|
+
|
|
79
|
+
Example:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
git commit -m "feat: add --dry-run flag to prove-lock command
|
|
83
|
+
|
|
84
|
+
- Allow users to test lock proof without submitting
|
|
85
|
+
- Add validation for dry-run mode
|
|
86
|
+
- Fixes #123"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 6. Push and Create Pull Request
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git push origin feature/your-feature-name
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Then create a pull request on GitHub.
|
|
96
|
+
|
|
97
|
+
## Code Style
|
|
98
|
+
|
|
99
|
+
### Python Style
|
|
100
|
+
|
|
101
|
+
- Follow PEP 8
|
|
102
|
+
- Use type hints
|
|
103
|
+
- Run linters before committing
|
|
104
|
+
- Use `typer` for CLI commands
|
|
105
|
+
|
|
106
|
+
### Code Organization
|
|
107
|
+
|
|
108
|
+
- Keep commands focused and small
|
|
109
|
+
- Add docstrings for public functions
|
|
110
|
+
- Use meaningful variable names
|
|
111
|
+
- Comment complex logic
|
|
112
|
+
|
|
113
|
+
### Testing
|
|
114
|
+
|
|
115
|
+
- Write tests for new commands
|
|
116
|
+
- Test both success and failure cases
|
|
117
|
+
- Use fixtures for common test data
|
|
118
|
+
- Test with both testnet and mainnet configs
|
|
119
|
+
|
|
120
|
+
## Pull Request Guidelines
|
|
121
|
+
|
|
122
|
+
### Before Submitting
|
|
123
|
+
|
|
124
|
+
- [ ] Code follows the project's style guidelines
|
|
125
|
+
- [ ] Tests pass locally
|
|
126
|
+
- [ ] Documentation is updated
|
|
127
|
+
- [ ] Commit messages are clear
|
|
128
|
+
- [ ] PR description explains the changes
|
|
129
|
+
- [ ] CLI commands work as expected
|
|
130
|
+
|
|
131
|
+
### PR Description Template
|
|
132
|
+
|
|
133
|
+
```markdown
|
|
134
|
+
## Description
|
|
135
|
+
Brief description of changes
|
|
136
|
+
|
|
137
|
+
## Type of Change
|
|
138
|
+
- [ ] Bug fix
|
|
139
|
+
- [ ] New feature
|
|
140
|
+
- [ ] Documentation update
|
|
141
|
+
- [ ] Performance improvement
|
|
142
|
+
- [ ] Refactoring
|
|
143
|
+
|
|
144
|
+
## Testing
|
|
145
|
+
How was this tested?
|
|
146
|
+
|
|
147
|
+
## CLI Changes
|
|
148
|
+
- [ ] New command added
|
|
149
|
+
- [ ] Existing command modified
|
|
150
|
+
- [ ] Breaking change (document migration path)
|
|
151
|
+
|
|
152
|
+
## Related Issues
|
|
153
|
+
Closes #123
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Review Process
|
|
157
|
+
|
|
158
|
+
- Maintainers will review your PR
|
|
159
|
+
- Address feedback promptly
|
|
160
|
+
- Be open to suggestions
|
|
161
|
+
- Keep discussions constructive
|
|
162
|
+
|
|
163
|
+
## Project Structure
|
|
164
|
+
|
|
165
|
+
```text
|
|
166
|
+
cartha-cli/
|
|
167
|
+
├── cartha_cli/ # Main CLI code
|
|
168
|
+
│ ├── main.py # CLI entry point (Typer app)
|
|
169
|
+
│ ├── bt.py # Bittensor helpers
|
|
170
|
+
│ ├── eth712.py # EIP-712 signature helpers
|
|
171
|
+
│ ├── verifier.py # Verifier API client
|
|
172
|
+
│ └── config.py # Configuration
|
|
173
|
+
├── testnet/ # Testnet-specific helpers
|
|
174
|
+
│ └── pool_ids.py # Pool ID conversion helpers
|
|
175
|
+
├── tests/ # Test suite
|
|
176
|
+
└── pyproject.toml # Project config
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Areas for Contribution
|
|
180
|
+
|
|
181
|
+
### Code Contributions
|
|
182
|
+
|
|
183
|
+
- Bug fixes
|
|
184
|
+
- New CLI commands
|
|
185
|
+
- Performance improvements
|
|
186
|
+
- Code refactoring
|
|
187
|
+
- Test coverage improvements
|
|
188
|
+
|
|
189
|
+
### Documentation
|
|
190
|
+
|
|
191
|
+
- Improve existing docs
|
|
192
|
+
- Add command examples
|
|
193
|
+
- Fix typos
|
|
194
|
+
- Add tutorials
|
|
195
|
+
- Improve error messages
|
|
196
|
+
|
|
197
|
+
### Test
|
|
198
|
+
|
|
199
|
+
- Add test cases
|
|
200
|
+
- Improve test coverage
|
|
201
|
+
- Add integration tests
|
|
202
|
+
- Test edge cases
|
|
203
|
+
|
|
204
|
+
## CLI-Specific Guidelines
|
|
205
|
+
|
|
206
|
+
### Command Design
|
|
207
|
+
|
|
208
|
+
- Use clear, intuitive command names
|
|
209
|
+
- Provide helpful error messages
|
|
210
|
+
- Include examples in help text
|
|
211
|
+
- Support both testnet and mainnet
|
|
212
|
+
|
|
213
|
+
### User Experience
|
|
214
|
+
|
|
215
|
+
- Make commands easy to use
|
|
216
|
+
- Provide sensible defaults
|
|
217
|
+
- Validate inputs early
|
|
218
|
+
- Give clear feedback
|
|
219
|
+
|
|
220
|
+
### Security
|
|
221
|
+
|
|
222
|
+
- Never log private keys or mnemonics
|
|
223
|
+
- Never commit secrets
|
|
224
|
+
- Validate all inputs
|
|
225
|
+
- Use secure defaults
|
|
226
|
+
|
|
227
|
+
### Error Handling
|
|
228
|
+
|
|
229
|
+
- Provide helpful error messages
|
|
230
|
+
- Suggest solutions when possible
|
|
231
|
+
- Log errors appropriately
|
|
232
|
+
- Handle edge cases gracefully
|
|
233
|
+
|
|
234
|
+
## Adding New Commands
|
|
235
|
+
|
|
236
|
+
When adding a new command:
|
|
237
|
+
|
|
238
|
+
1. Add the command function to `cartha_cli/main.py`
|
|
239
|
+
2. Use `@app.command()` decorator
|
|
240
|
+
3. Add type hints
|
|
241
|
+
4. Add docstring
|
|
242
|
+
5. Add tests
|
|
243
|
+
6. Update documentation
|
|
244
|
+
|
|
245
|
+
Example:
|
|
246
|
+
|
|
247
|
+
```python
|
|
248
|
+
@app.command()
|
|
249
|
+
def new_command(
|
|
250
|
+
arg: str = typer.Option(..., help="Description"),
|
|
251
|
+
) -> None:
|
|
252
|
+
"""Brief description of the command."""
|
|
253
|
+
# Implementation
|
|
254
|
+
pass
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Questions?
|
|
258
|
+
|
|
259
|
+
- Check the [README](README.md) for general information
|
|
260
|
+
- Review the [testnet guide](testnet/README.md) for testnet-specific info
|
|
261
|
+
- Open an issue for questions
|
|
262
|
+
- Ask in discussions
|
|
263
|
+
|
|
264
|
+
## Code of Conduct
|
|
265
|
+
|
|
266
|
+
All contributors are expected to:
|
|
267
|
+
|
|
268
|
+
- Be respectful and inclusive
|
|
269
|
+
- Provide constructive feedback
|
|
270
|
+
- Help others learn
|
|
271
|
+
- Follow project guidelines
|
|
272
|
+
|
|
273
|
+
## Recognition
|
|
274
|
+
|
|
275
|
+
Contributors are recognized in:
|
|
276
|
+
|
|
277
|
+
- Release notes
|
|
278
|
+
- Project documentation
|
|
279
|
+
- GitHub contributors list
|
|
280
|
+
|
|
281
|
+
Thank you for contributing to Cartha CLI! 🎉
|
cartha_cli-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Cartha Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cartha-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: CLI utilities for Cartha subnet miners.
|
|
5
|
+
Project-URL: Homepage, https://cartha.finance
|
|
6
|
+
Project-URL: Repository, https://github.com/General-Tao-Ventures/cartha-cli
|
|
7
|
+
Project-URL: Documentation, https://github.com/General-Tao-Ventures/cartha-cli#readme
|
|
8
|
+
Author: Cartha Contributors
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: 0xmarkets,bittensor,cartha,cli,mining,subnet
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: <3.12,>=3.11
|
|
21
|
+
Requires-Dist: bittensor<10,>=9.12.2
|
|
22
|
+
Requires-Dist: eth-account<0.11,>=0.10
|
|
23
|
+
Requires-Dist: pydantic-settings<3,>=2.6
|
|
24
|
+
Requires-Dist: pydantic<3,>=2.6
|
|
25
|
+
Requires-Dist: python-dotenv>=1.0
|
|
26
|
+
Requires-Dist: requests>=2.32
|
|
27
|
+
Requires-Dist: torch<3,>=2.2
|
|
28
|
+
Requires-Dist: typer[all]>=0.12
|
|
29
|
+
Requires-Dist: web3<7,>=6.11
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=8.2; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# Cartha CLI
|
|
35
|
+
|
|
36
|
+
**The official command-line tool for Cartha subnet miners.** Cartha is the Liquidity Provider for 0xMarkets DEX. A simple, powerful way to manage your mining operations—from registration to tracking your locked funds.
|
|
37
|
+
|
|
38
|
+
## Why Cartha CLI?
|
|
39
|
+
|
|
40
|
+
Cartha CLI makes mining on the Cartha subnet effortless. As the Liquidity Provider for 0xMarkets DEX, Cartha enables miners to provide liquidity and earn rewards:
|
|
41
|
+
|
|
42
|
+
- **🔐 One-Click Registration** - Get started mining in minutes
|
|
43
|
+
- **📊 Instant Status Updates** - See all your pools, balances, and expiration dates at a glance
|
|
44
|
+
- **⏰ Smart Expiration Warnings** - Never miss a renewal with color-coded countdowns
|
|
45
|
+
- **💼 Multi-Pool Management** - Track multiple trading pairs in one place
|
|
46
|
+
- **🔑 Secure by Default** - Your password stays hidden until you actually need it
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Install dependencies
|
|
52
|
+
uv sync
|
|
53
|
+
|
|
54
|
+
# Show available commands
|
|
55
|
+
uv run cartha
|
|
56
|
+
|
|
57
|
+
# Get started with registration
|
|
58
|
+
uv run cartha miner register --help
|
|
59
|
+
|
|
60
|
+
# Check your miner status (no authentication needed)
|
|
61
|
+
uv run cartha miner status --help
|
|
62
|
+
|
|
63
|
+
# Check CLI health and connectivity
|
|
64
|
+
uv run cartha health
|
|
65
|
+
|
|
66
|
+
# Or use short aliases
|
|
67
|
+
uv run cartha m status
|
|
68
|
+
uv run cartha v lock
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Requirements
|
|
72
|
+
|
|
73
|
+
- Python 3.11
|
|
74
|
+
- Bittensor wallet
|
|
75
|
+
- [`uv`](https://github.com/astral-sh/uv) package manager (or pip)
|
|
76
|
+
|
|
77
|
+
## What You Can Do
|
|
78
|
+
|
|
79
|
+
### Get Started
|
|
80
|
+
|
|
81
|
+
**Register your miner:**
|
|
82
|
+
```bash
|
|
83
|
+
cartha miner register --wallet-name your-wallet --wallet-hotkey your-hotkey
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Check your status anytime:**
|
|
87
|
+
```bash
|
|
88
|
+
cartha miner status --wallet-name your-wallet --wallet-hotkey your-hotkey
|
|
89
|
+
# Or use the short alias: cartha m status
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Track Your Pools
|
|
93
|
+
|
|
94
|
+
See all your active trading pairs, balances, and when they expire—all in one command. The CLI shows you:
|
|
95
|
+
- Which pools are active and earning rewards
|
|
96
|
+
- How much you have locked in each pool
|
|
97
|
+
- Days remaining before expiration (with helpful warnings)
|
|
98
|
+
- Which pools are included in the next reward epoch
|
|
99
|
+
|
|
100
|
+
### View Available Pools
|
|
101
|
+
|
|
102
|
+
See all available pools with their pool IDs and vault addresses:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
cartha vault pools
|
|
106
|
+
# Or use: cartha v pools
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
This shows you which pools are available, their full pool IDs, vault contract addresses, and chain IDs.
|
|
110
|
+
|
|
111
|
+
### Lock Your Funds
|
|
112
|
+
|
|
113
|
+
Create a new lock position with the streamlined lock flow:
|
|
114
|
+
```bash
|
|
115
|
+
cartha vault lock \
|
|
116
|
+
--coldkey your-wallet \
|
|
117
|
+
--hotkey your-hotkey \
|
|
118
|
+
--pool-id "BTCUSD" \
|
|
119
|
+
--amount 1000.0 \
|
|
120
|
+
--lock-days 30 \
|
|
121
|
+
--owner-evm 0xYourEVMAddress \
|
|
122
|
+
--chain 8453 \
|
|
123
|
+
--vault-address 0xVaultAddress
|
|
124
|
+
# Or use: cartha v lock
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Parameter Notes:**
|
|
128
|
+
- `--owner` and `--owner-evm` are interchangeable (EVM address that will own the lock)
|
|
129
|
+
- `--vault` and `--vault-address` are interchangeable (vault contract address)
|
|
130
|
+
- `--network` accepts `test` (netuid 78) or `finney` (netuid 35, default)
|
|
131
|
+
- `--chain` or `--chain-id` are interchangeable (EVM chain ID: 84532 for Base Sepolia testnet)
|
|
132
|
+
|
|
133
|
+
The CLI will:
|
|
134
|
+
1. Check your registration on the specified network (subnet 35 for finney, subnet 78 for test)
|
|
135
|
+
2. Authenticate with your Bittensor hotkey
|
|
136
|
+
3. Request a signed LockRequest from the verifier
|
|
137
|
+
4. Automatically open the Cartha Lock UI in your browser with all parameters pre-filled
|
|
138
|
+
5. Guide you through Phase 1 (Approve USDC) and Phase 2 (Lock Position) via the web interface
|
|
139
|
+
6. Automatically detect when approval completes and proceed to Phase 2
|
|
140
|
+
7. The verifier automatically detects your lock and adds you to the upcoming epoch
|
|
141
|
+
|
|
142
|
+
**Managing Positions**: Visit https://cartha.finance/manage to view all your positions, extend locks, or top up existing positions.
|
|
143
|
+
|
|
144
|
+
### View Your Password
|
|
145
|
+
|
|
146
|
+
When you need your password (like for signing transactions):
|
|
147
|
+
```bash
|
|
148
|
+
cartha miner password --wallet-name your-wallet --wallet-hotkey your-hotkey
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Tip:** Use `miner status` for daily checks—it's faster and doesn't require signing. Only use `miner password` when you actually need it.
|
|
152
|
+
|
|
153
|
+
### Check Your Setup
|
|
154
|
+
|
|
155
|
+
Verify your CLI is configured correctly and can reach all services:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
cartha health
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
This checks:
|
|
162
|
+
- Verifier connectivity and latency
|
|
163
|
+
- Bittensor network connectivity
|
|
164
|
+
- Configuration validation
|
|
165
|
+
|
|
166
|
+
Use `cartha health --verbose` for detailed troubleshooting information.
|
|
167
|
+
|
|
168
|
+
## Need Help?
|
|
169
|
+
|
|
170
|
+
- **[Full Command Reference](docs/COMMANDS.md)** - Complete guide to all commands
|
|
171
|
+
- **[Testnet Guide](testnet/README.md)** - Getting started on testnet
|
|
172
|
+
- **[Feedback & Support](docs/FEEDBACK.md)** - Questions or suggestions?
|
|
173
|
+
|
|
174
|
+
## Contributing
|
|
175
|
+
|
|
176
|
+
We welcome contributions! Please see our [Feedback & Support](docs/FEEDBACK.md) page for ways to get involved.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
**Made with ❤ by GTV**
|