|
1 | 1 | # LP Agent CLI |
2 | 2 |
|
3 | | -Command-line interface for the [LP Agent Open API](https://docs.lpagent.io). Manage Solana LP positions, discover pools, and generate add/remove liquidity transactions from the terminal. |
| 3 | +`lpagent` is the command-line interface for [LP Agent](https://lpagent.io). Manage Solana LP positions, discover pools, and generate liquidity transactions from your terminal or through AI agents. |
4 | 4 |
|
5 | | -Single binary, no runtime dependencies. Works standalone or as a Claude agent skill. |
| 5 | +- Works standalone or as a Claude agent skill |
| 6 | +- Single binary, no runtime dependencies |
| 7 | +- JSON output for piping and automation |
| 8 | +- Colored table output for humans |
6 | 9 |
|
7 | | -## Install |
8 | | - |
9 | | -### From release binaries |
10 | | - |
11 | | -Download the latest binary from [GitHub Releases](https://github.com/lpagent/cli/releases). |
| 10 | +## Quick Start |
12 | 11 |
|
13 | 12 | ```bash |
14 | | -# macOS (Apple Silicon) |
15 | | -curl -sL https://github.com/lpagent/cli/releases/latest/download/lp-agent-cli_darwin_arm64.tar.gz | tar xz |
16 | | -sudo mv lpagent /usr/local/bin/ |
| 13 | +curl -fsSL https://raw.githubusercontent.com/lpagent/cli/main/install.sh | bash |
| 14 | +``` |
17 | 15 |
|
18 | | -# macOS (Intel) |
19 | | -curl -sL https://github.com/lpagent/cli/releases/latest/download/lp-agent-cli_darwin_amd64.tar.gz | tar xz |
20 | | -sudo mv lpagent /usr/local/bin/ |
| 16 | +That's it. Now set up your API key and start querying: |
21 | 17 |
|
22 | | -# Linux (amd64) |
23 | | -curl -sL https://github.com/lpagent/cli/releases/latest/download/lp-agent-cli_linux_amd64.tar.gz | tar xz |
24 | | -sudo mv lpagent /usr/local/bin/ |
| 18 | +```bash |
| 19 | +lpagent auth set-key |
| 20 | +lpagent auth set-default-owner <wallet-address> |
| 21 | +lpagent positions open -o table --native |
25 | 22 | ``` |
26 | 23 |
|
27 | | -### From source |
| 24 | +<details> |
| 25 | +<summary>Other installation methods</summary> |
| 26 | + |
| 27 | +**Go install:** |
28 | 28 |
|
29 | 29 | ```bash |
30 | 30 | go install github.com/lpagent/cli/cmd/lpagent@latest |
31 | 31 | ``` |
32 | 32 |
|
33 | | -### Build locally |
| 33 | +**Build from source:** |
34 | 34 |
|
35 | 35 | ```bash |
36 | | -git clone https://github.com/lpagent/cli.git |
37 | | -cd lp-agent-cli |
| 36 | +git clone https://github.com/lpagent/cli.git && cd cli |
38 | 37 | make build |
39 | 38 | ./bin/lpagent --help |
40 | 39 | ``` |
41 | 40 |
|
42 | | -## Quick start |
43 | | - |
44 | | -```bash |
45 | | -# 1. Set your API key (get one at https://app.lpagent.io) |
46 | | -lpagent auth set-key |
47 | | - |
48 | | -# 2. Set a default wallet so you don't need --owner every time |
49 | | -lpagent auth set-default-owner <wallet-address> |
50 | | - |
51 | | -# 3. View open positions |
52 | | -lpagent positions open -o table |
53 | | - |
54 | | -# 4. View open positions in SOL |
55 | | -lpagent positions open -o table --native |
56 | | - |
57 | | -# 5. Check portfolio overview |
58 | | -lpagent positions overview -o table --native |
59 | | -``` |
| 41 | +</details> |
60 | 42 |
|
61 | 43 | ## Commands |
62 | 44 |
|
63 | | -### Auth |
64 | | - |
65 | | -```bash |
66 | | -lpagent auth set-key # Set API key (saved to ~/.lpagent/config.json) |
67 | | -lpagent auth status # Show current config |
68 | | -lpagent auth set-default-owner <addr> # Set default wallet |
69 | | -``` |
70 | | - |
71 | | -### Positions |
72 | | - |
73 | 45 | ```bash |
| 46 | +# Positions |
74 | 47 | lpagent positions open --owner <addr> # Open positions |
| 48 | +lpagent positions open -o table --native # Table view in SOL |
75 | 49 | lpagent positions historical --owner <addr> --from 2025-01-01 # Closed positions |
76 | | -lpagent positions overview --owner <addr> # Portfolio metrics |
| 50 | +lpagent positions overview -o table --native # Portfolio metrics |
77 | 51 | lpagent positions logs --position <id> # Transaction logs |
78 | 52 | lpagent positions get --position <id> # Position details |
79 | 53 | lpagent positions revenue <addr> # Revenue data |
80 | | -``` |
81 | | - |
82 | | -### Pools |
83 | 54 |
|
84 | | -```bash |
85 | | -lpagent pools discover --chain SOL --sort-by tvl # Discover pools |
86 | | -lpagent pools info <poolId> # Pool details |
87 | | -lpagent pools positions <poolId> --status Open # Positions in a pool |
88 | | -lpagent pools onchain-stats <poolId> # TVL, volume, fees |
89 | | -lpagent pools top-lpers <poolId> # Top liquidity providers |
90 | | -lpagent pools add-tx <poolId> --owner <addr> --strategy Spot --input-sol 1 # Zap-In tx |
91 | | -lpagent pools landing-add-tx --file signed-tx.json # Submit signed tx |
92 | | -``` |
93 | | - |
94 | | -### Token |
| 55 | +# Pools |
| 56 | +lpagent pools discover --chain SOL --sort-by tvl # Discover pools |
| 57 | +lpagent pools info <poolId> # Pool details |
| 58 | +lpagent pools positions <poolId> --status Open # Positions in a pool |
| 59 | +lpagent pools onchain-stats <poolId> # TVL, volume, fees |
| 60 | +lpagent pools top-lpers <poolId> # Top LPs |
95 | 61 |
|
96 | | -```bash |
97 | | -lpagent token balance --owner <addr> # All token balances |
98 | | -lpagent token balance --owner <addr> --ca <mint> # Specific tokens |
99 | | -``` |
| 62 | +# Zap-In (add liquidity) |
| 63 | +lpagent pools add-tx <poolId> --owner <addr> --strategy Spot --input-sol 1 |
| 64 | +lpagent pools landing-add-tx --file signed-tx.json |
100 | 65 |
|
101 | | -### Transactions (Zap-Out) |
102 | | - |
103 | | -```bash |
104 | | -lpagent tx decrease-quotes --id <id> --bps 10000 # Get withdrawal quotes |
| 66 | +# Zap-Out (remove liquidity) |
| 67 | +lpagent tx decrease-quotes --id <id> --bps 10000 |
105 | 68 | lpagent tx decrease-tx --position-id <id> --bps 10000 --owner <addr> --slippage-bps 500 |
106 | | -lpagent tx landing-decrease-tx --file signed-tx.json # Submit signed tx |
107 | | -``` |
| 69 | +lpagent tx landing-decrease-tx --file signed-tx.json |
108 | 70 |
|
109 | | -### Raw API |
| 71 | +# Token |
| 72 | +lpagent token balance --owner <addr> |
110 | 73 |
|
111 | | -```bash |
| 74 | +# Raw API access |
112 | 75 | lpagent api get /lp-positions/opening --query "owner=<addr>" |
113 | 76 | lpagent api post /position/decrease-quotes --data '{"id":"...","bps":5000}' |
114 | 77 | ``` |
115 | 78 |
|
116 | | -## Output formats |
117 | | - |
118 | | -All commands support `--output` / `-o`: |
| 79 | +## Output Formats |
119 | 80 |
|
120 | | -| Format | Description | |
121 | | -|---------|------------------------------------| |
122 | | -| `json` | Full JSON response (default) | |
123 | | -| `table` | Human-readable table with colors | |
124 | | -| `quiet` | IDs only, one per line | |
| 81 | +All commands support `--output` / `-o`: `json` (default), `table`, `quiet`. |
125 | 82 |
|
126 | 83 | Use `--native` on `positions open` and `positions overview` to show values in SOL instead of USD. |
127 | 84 |
|
128 | 85 | ## Configuration |
129 | 86 |
|
130 | | -Config stored at `~/.lpagent/config.json`: |
| 87 | +Config stored at `~/.lpagent/config.json`. Override with env vars or CLI flags: |
131 | 88 |
|
132 | | -```json |
133 | | -{ |
134 | | - "api_key": "your-api-key", |
135 | | - "api_base_url": "https://api.lpagent.io/open-api/v1", |
136 | | - "default_owner": "your-wallet-address", |
137 | | - "output_format": "json" |
138 | | -} |
139 | | -``` |
140 | | - |
141 | | -### Environment variables |
| 89 | +| Variable | Flag | Description | |
| 90 | +|------------------------|---------------|------------------------| |
| 91 | +| `LPAGENT_API_KEY` | `--api-key` | API key | |
| 92 | +| `LPAGENT_API_URL` | | Base URL | |
| 93 | +| `LPAGENT_DEFAULT_OWNER`| `--owner` | Default wallet address | |
142 | 94 |
|
143 | | -| Variable | Description | |
144 | | -|------------------------|--------------------------------| |
145 | | -| `LPAGENT_API_KEY` | API key (overrides config) | |
146 | | -| `LPAGENT_API_URL` | Base URL (overrides config) | |
147 | | -| `LPAGENT_DEFAULT_OWNER`| Default wallet (overrides config) | |
148 | | - |
149 | | -CLI flags take highest priority, then env vars, then config file. |
| 95 | +Priority: CLI flags > env vars > config file. |
150 | 96 |
|
151 | 97 | ## Development |
152 | 98 |
|
153 | 99 | ```bash |
154 | | -make build # Build binary to bin/lpagent |
| 100 | +make build # Build to bin/lpagent |
155 | 101 | make test # Run tests |
156 | | -make fmt # Format code |
157 | | -make vet # Run go vet |
158 | | -make lint # Run golangci-lint |
159 | | -make check # All of the above |
160 | | -make install # Install to $GOPATH/bin |
| 102 | +make check # fmt + vet + test |
161 | 103 | ``` |
162 | 104 |
|
163 | 105 | ## Release |
164 | 106 |
|
165 | | -Releases are automated via GitHub Actions + GoReleaser. To create a release: |
| 107 | +Automated via GitHub Actions + GoReleaser on version tags: |
166 | 108 |
|
167 | 109 | ```bash |
168 | | -git tag v0.1.0 |
169 | | -git push origin v0.1.0 |
| 110 | +git tag v0.1.0 && git push origin v0.1.0 |
170 | 111 | ``` |
171 | 112 |
|
172 | | -This triggers the release workflow which builds cross-platform binaries (darwin/linux/windows, amd64/arm64), creates a GitHub Release, and publishes checksums. |
173 | | - |
174 | 113 | ## License |
175 | 114 |
|
176 | 115 | MIT |
0 commit comments