jaspervault_cli 1.0.33 → 1.1.1

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.
Files changed (42) hide show
  1. package/README.md +71 -64
  2. package/dist/bin/jv.js +4 -2
  3. package/dist/bin/jv.js.map +1 -1
  4. package/dist/src/commands/deposit.js +1 -1
  5. package/dist/src/commands/deposit.js.map +1 -1
  6. package/dist/src/commands/install.js +1 -1
  7. package/dist/src/commands/install.js.map +1 -1
  8. package/dist/src/commands/order.js +5 -5
  9. package/dist/src/commands/order.js.map +1 -1
  10. package/dist/src/commands/orders.js +2 -2
  11. package/dist/src/commands/orders.js.map +1 -1
  12. package/dist/src/commands/sl.js +3 -3
  13. package/dist/src/commands/sl.js.map +1 -1
  14. package/dist/src/commands/tp.js +3 -3
  15. package/dist/src/commands/tp.js.map +1 -1
  16. package/dist/src/commands/vault.d.ts +1 -6
  17. package/dist/src/commands/vault.js +15 -70
  18. package/dist/src/commands/vault.js.map +1 -1
  19. package/dist/src/commands/wallet.d.ts +2 -0
  20. package/dist/src/commands/wallet.js +126 -0
  21. package/dist/src/commands/wallet.js.map +1 -0
  22. package/dist/src/commands/withdraw.js +2 -2
  23. package/dist/src/commands/withdraw.js.map +1 -1
  24. package/dist/src/mcp/index.js +3 -7
  25. package/dist/src/mcp/index.js.map +1 -1
  26. package/dist/src/mcp/tools.js +1 -1
  27. package/dist/src/mcp/tools.js.map +1 -1
  28. package/dist/src/services/key-manager.js +4 -12
  29. package/dist/src/services/key-manager.js.map +1 -1
  30. package/dist/src/services/order-signer.js +2 -2
  31. package/dist/src/services/order-signer.js.map +1 -1
  32. package/dist/src/services/profile-manager.d.ts +49 -0
  33. package/dist/src/services/profile-manager.js +179 -0
  34. package/dist/src/services/profile-manager.js.map +1 -0
  35. package/dist/src/services/vault-profile.js +4 -12
  36. package/dist/src/services/vault-profile.js.map +1 -1
  37. package/dist/src/templates/skill-content/SKILL.core.md +10 -1
  38. package/dist/src/templates/skill-content/references/onboarding.md +1 -1
  39. package/dist/src/templates/skill-content/references/queries.md +20 -0
  40. package/docs/OPENCLAW_GUIDE.md +136 -0
  41. package/docs/USER_GUIDE.md +262 -0
  42. package/package.json +3 -2
@@ -0,0 +1,262 @@
1
+ # User Guide
2
+
3
+ Complete reference for the JasperVault CLI (`jv`). This guide covers installation, wallet setup, trading operations, and advanced configuration.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g jaspervault_cli
9
+ ```
10
+
11
+ Verify:
12
+
13
+ ```bash
14
+ jv --version
15
+ ```
16
+
17
+ **Requirements:** Node.js 18+
18
+
19
+ ## Wallet Setup
20
+
21
+ Before trading, you need to initialize your vault. This creates an AA (Account Abstraction) wallet and a local delegation key.
22
+
23
+ ```bash
24
+ jv enable --pretty
25
+ ```
26
+
27
+ This opens a hosted web page where you connect your wallet (MetaMask, Rabby, etc.) and sign a delegation authorization. Your private key never leaves the browser.
28
+
29
+ After setup completes, your delegation key and vault profile are saved to `~/.jaspervault/`. All subsequent commands use these automatically.
30
+
31
+ ## Deposits & Withdrawals
32
+
33
+ Bridge assets between Base and JasperVault via Hyperlane.
34
+
35
+ **Deposit:**
36
+
37
+ ```bash
38
+ jv deposit --token usdc --amount 100 --pretty
39
+ ```
40
+
41
+ **Withdraw:**
42
+
43
+ ```bash
44
+ jv withdraw --token usdc --amount 100 --pretty
45
+ ```
46
+
47
+ Both commands open a hosted web page for you to approve the transaction in your browser wallet.
48
+
49
+ ## Trading
50
+
51
+ ### Market Orders
52
+
53
+ Execute immediately at current market price.
54
+
55
+ ```bash
56
+ # Long BTC, 100 USDC margin, 50x leverage
57
+ jv order create --side long --symbol JBTC --margin 100 --leverage 50
58
+
59
+ # Short BTC, 50 USDC margin, 100x leverage
60
+ jv order create --side short --symbol JBTC --margin 50 --leverage 100
61
+ ```
62
+
63
+ Market orders return a `jobId`. The order typically confirms on-chain within seconds.
64
+
65
+ ### Limit Orders
66
+
67
+ Execute when price reaches the target.
68
+
69
+ ```bash
70
+ # Short BTC at $95,000
71
+ jv order create --side short --symbol JBTC --margin 50 --leverage 100 --limit-price 95000
72
+ ```
73
+
74
+ Limit orders return a `limitOrderId` and remain active until triggered, expired, or cancelled.
75
+
76
+ ### Close a Position
77
+
78
+ To close, create an order with the **opposite side** and the **same margin** as your existing position.
79
+
80
+ ```bash
81
+ # Full close: if your position is LONG with 100 USDC margin
82
+ jv order create --side short --symbol JBTC --margin 100
83
+
84
+ # Partial close: reduce by half
85
+ jv order create --side short --symbol JBTC --margin 50
86
+ ```
87
+
88
+ Always check your current position first with `jv orders list --pretty` to confirm the exact side and margin.
89
+
90
+ ### Take-Profit & Stop-Loss
91
+
92
+ ```bash
93
+ jv tp set --order-id 99 --price 105000 --symbol JBTC
94
+ jv sl set --order-id 99 --price 88000 --symbol JBTC
95
+ ```
96
+
97
+ ## PPO Hedge Protection
98
+
99
+ PPO (Perpetual Protection Option) is JasperVault's on-chain hedge option that protects leveraged positions against sudden price wicks and liquidation cascades.
100
+
101
+ ### Why PPO
102
+
103
+ In leveraged perpetual trading, flash crashes and price wicks ("pin bars") can liquidate positions in seconds — even when the market quickly recovers. Traditional stop-loss orders execute *at* the wick price, locking in maximum loss. PPO solves this by attaching a real option contract to your position:
104
+
105
+ - **Survives the wick** — the option payoff offsets unrealized loss, keeping your position alive through the spike
106
+ - **No slippage** — peer-to-peer fully collateralized settlement on-chain, independent of orderbook depth or liquidity
107
+ - **Auto hedge type** — LONG positions get PUT options, SHORT positions get CALL options (selected automatically)
108
+
109
+ ### Using PPO
110
+
111
+ **Open a position with PPO:**
112
+
113
+ ```bash
114
+ jv order create --side long --symbol JBTC --margin 100 --leverage 50 --ppo
115
+ ```
116
+
117
+ **Add PPO to an existing position:**
118
+
119
+ ```bash
120
+ jv order protect --order-id 42 --symbol JBTC
121
+ ```
122
+
123
+ **Customize PPO parameters:**
124
+
125
+ ```bash
126
+ jv order create --side long --symbol JBTC --margin 100 --leverage 50 \
127
+ --ppo --ppo-expire 8h --ppo-category OTM --ppo-tier 3
128
+ ```
129
+
130
+ ### PPO Parameters
131
+
132
+ | Parameter | Options | Default | Description |
133
+ |-----------|---------|---------|-------------|
134
+ | `--ppo` | flag | off | Enable PPO protection |
135
+ | `--ppo-category` | `ATM`, `OTM` | `ATM` | ATM = strike at current price; OTM = offset from current price |
136
+ | `--ppo-tier` | `1`–`5` | — | OTM strike offset (0.1%–0.5%). Required when category is OTM |
137
+ | `--ppo-expire` | `30m`, `8h` | `30m` | Option expiry duration |
138
+
139
+ ### OTM Tiers
140
+
141
+ | Tier | Strike Offset | Use Case |
142
+ |------|---------------|----------|
143
+ | 1 | 0.1% | Tight protection, higher premium |
144
+ | 2 | 0.2% | Balanced |
145
+ | 3 | 0.3% | Moderate offset |
146
+ | 4 | 0.4% | Wider offset, lower premium |
147
+ | 5 | 0.5% | Maximum offset, lowest premium |
148
+
149
+ ### PPO Lifecycle
150
+
151
+ - **Combine with any operation** — PPO can be added when opening, adding size, or setting TP/SL
152
+ - **Auto-cancellation** — Executing any position operation *without* `--ppo` automatically cancels the existing PPO on that position
153
+ - **Keep PPO on reduce** — Add `--ppo` when partially closing to maintain protection on the remaining position
154
+ - **No separate cancel** — There is no "cancel PPO" command. To remove PPO, execute any position operation without the `--ppo` flag
155
+
156
+ ## Querying Data
157
+
158
+ ```bash
159
+ # List active positions
160
+ jv orders list --pretty
161
+
162
+ # Get specific order details
163
+ jv orders get <orderId> --pretty
164
+
165
+ # Portfolio statistics
166
+ jv orders stats --pretty
167
+
168
+ # Real-time price
169
+ jv price --symbol JBTC --pretty
170
+
171
+ # Check market order execution status
172
+ jv job status <jobId> --pretty
173
+ ```
174
+
175
+ ### Limit Order Management
176
+
177
+ ```bash
178
+ # List limit orders
179
+ jv limit-order list --wallet 0x... --status PENDING --pretty
180
+
181
+ # Check status
182
+ jv limit-order status <limitOrderId>
183
+
184
+ # Cancel
185
+ jv limit-order cancel <limitOrderId>
186
+ ```
187
+
188
+ ## AI Platform Integration
189
+
190
+ Install JasperVault trading capabilities into your AI agent:
191
+
192
+ ```bash
193
+ jv install --ai claude # Claude Code (project-level)
194
+ jv install --ai claude --global # Claude Code (user-level)
195
+ jv install --ai cursor # Cursor (project-level)
196
+ jv install --ai cursor --global # Cursor (user-level)
197
+ jv install --ai openclaw # OpenClaw
198
+ jv install # All platforms (global)
199
+ ```
200
+
201
+ After installation, your AI can execute trades via MCP tools or skills. See the [OpenClaw Guide](OPENCLAW_GUIDE.md) for platform-specific setup details.
202
+
203
+ ## Configuration
204
+
205
+ All environment variables are optional. The CLI works out of the box with sensible defaults.
206
+
207
+ | Variable | Description | Default |
208
+ |----------|-------------|---------|
209
+ | `JV_API_URL` | Trading API endpoint | Production endpoint |
210
+ | `JV_API_KEY` | Bearer token for API auth | — |
211
+ | `JV_TIMEOUT` | Request timeout (ms) | 30000 |
212
+ | `JV_DELEGATION_KEY` | Delegation wallet key | Auto-generated |
213
+ | `JV_BASE_RPC_URL` | Base chain RPC | Built-in |
214
+ | `JV_JASPERVAULT_RPC_URL` | JasperVault chain RPC | Built-in |
215
+ | `JV_SUBGRAPH_URL` | Subgraph endpoint | Built-in |
216
+
217
+ ### Local Override Example
218
+
219
+ ```bash
220
+ export JV_API_URL=http://localhost:3000
221
+ ```
222
+
223
+ ### Configuration Files
224
+
225
+ | Path | Purpose |
226
+ |------|---------|
227
+ | `~/.jaspervault/keys.json` | Delegation wallet key (auto-generated) |
228
+ | `~/.jaspervault/profile.json` | Vault addresses and type mappings |
229
+
230
+ ## Output Formats
231
+
232
+ - **JSON** (default) — Machine-readable, suitable for scripting and piping
233
+ - **Pretty** — Human-readable tables. Append `--pretty` to any command
234
+
235
+ ## Exit Codes
236
+
237
+ | Code | Meaning |
238
+ |------|---------|
239
+ | 0 | Success |
240
+ | 1 | Configuration error (missing params, invalid input) |
241
+ | 2 | Network / HTTP error |
242
+ | 3 | Business error (API-level rejection) |
243
+
244
+ ## Updates
245
+
246
+ ```bash
247
+ jv update # Check and install latest version
248
+ ```
249
+
250
+ ## FAQ
251
+
252
+ **Q: Do I need to export my private key?**
253
+ No. Browser signing keeps your keys in your wallet. Your private key never leaves the browser.
254
+
255
+ **Q: How do I switch networks?**
256
+ Set `JV_API_URL` to your target environment's API endpoint.
257
+
258
+ **Q: Is my delegation key safe?**
259
+ The delegation key is generated locally and stored in `~/.jaspervault/keys.json`. It can only execute trades within the scope authorized by your delegation signature. It cannot transfer or withdraw funds without additional browser signing.
260
+
261
+ **Q: What trading pairs are available?**
262
+ Currently BTC perpetuals (symbol: `JBTC`). Additional pairs will be added — check `jv price --symbol <symbol>` for availability.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jaspervault_cli",
3
- "version": "1.0.33",
3
+ "version": "1.1.1",
4
4
  "description": "JasperVault CLI for interacting with the JasperVault Manager API",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,7 +19,8 @@
19
19
  },
20
20
  "files": [
21
21
  "dist",
22
- "config"
22
+ "config",
23
+ "docs"
23
24
  ],
24
25
  "keywords": [
25
26
  "jaspervault",