|
| 1 | +# LP Agent CLI |
| 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. |
| 4 | + |
| 5 | +Single binary, no runtime dependencies. Works standalone or as a Claude agent skill. |
| 6 | + |
| 7 | +## Install |
| 8 | + |
| 9 | +### From release binaries |
| 10 | + |
| 11 | +Download the latest binary from [GitHub Releases](https://github.com/lpagent/cli/releases). |
| 12 | + |
| 13 | +```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/ |
| 17 | + |
| 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/ |
| 21 | + |
| 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/ |
| 25 | +``` |
| 26 | + |
| 27 | +### From source |
| 28 | + |
| 29 | +```bash |
| 30 | +go install github.com/lpagent/cli/cmd/lpagent@latest |
| 31 | +``` |
| 32 | + |
| 33 | +### Build locally |
| 34 | + |
| 35 | +```bash |
| 36 | +git clone https://github.com/lpagent/cli.git |
| 37 | +cd lp-agent-cli |
| 38 | +make build |
| 39 | +./bin/lpagent --help |
| 40 | +``` |
| 41 | + |
| 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 | +``` |
| 60 | + |
| 61 | +## Commands |
| 62 | + |
| 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 | +```bash |
| 74 | +lpagent positions open --owner <addr> # Open positions |
| 75 | +lpagent positions historical --owner <addr> --from 2025-01-01 # Closed positions |
| 76 | +lpagent positions overview --owner <addr> # Portfolio metrics |
| 77 | +lpagent positions logs --position <id> # Transaction logs |
| 78 | +lpagent positions get --position <id> # Position details |
| 79 | +lpagent positions revenue <addr> # Revenue data |
| 80 | +``` |
| 81 | + |
| 82 | +### Pools |
| 83 | + |
| 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 |
| 95 | + |
| 96 | +```bash |
| 97 | +lpagent token balance --owner <addr> # All token balances |
| 98 | +lpagent token balance --owner <addr> --ca <mint> # Specific tokens |
| 99 | +``` |
| 100 | + |
| 101 | +### Transactions (Zap-Out) |
| 102 | + |
| 103 | +```bash |
| 104 | +lpagent tx decrease-quotes --id <id> --bps 10000 # Get withdrawal quotes |
| 105 | +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 | +``` |
| 108 | + |
| 109 | +### Raw API |
| 110 | + |
| 111 | +```bash |
| 112 | +lpagent api get /lp-positions/opening --query "owner=<addr>" |
| 113 | +lpagent api post /position/decrease-quotes --data '{"id":"...","bps":5000}' |
| 114 | +``` |
| 115 | + |
| 116 | +## Output formats |
| 117 | + |
| 118 | +All commands support `--output` / `-o`: |
| 119 | + |
| 120 | +| Format | Description | |
| 121 | +|---------|------------------------------------| |
| 122 | +| `json` | Full JSON response (default) | |
| 123 | +| `table` | Human-readable table with colors | |
| 124 | +| `quiet` | IDs only, one per line | |
| 125 | + |
| 126 | +Use `--native` on `positions open` and `positions overview` to show values in SOL instead of USD. |
| 127 | + |
| 128 | +## Configuration |
| 129 | + |
| 130 | +Config stored at `~/.lpagent/config.json`: |
| 131 | + |
| 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 |
| 142 | + |
| 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. |
| 150 | + |
| 151 | +## Development |
| 152 | + |
| 153 | +```bash |
| 154 | +make build # Build binary to bin/lpagent |
| 155 | +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 |
| 161 | +``` |
| 162 | + |
| 163 | +## Release |
| 164 | + |
| 165 | +Releases are automated via GitHub Actions + GoReleaser. To create a release: |
| 166 | + |
| 167 | +```bash |
| 168 | +git tag v0.1.0 |
| 169 | +git push origin v0.1.0 |
| 170 | +``` |
| 171 | + |
| 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 | +## License |
| 175 | + |
| 176 | +MIT |
0 commit comments