jaspervault_cli 1.0.28 → 1.0.30

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.
@@ -1,29 +1,24 @@
1
1
  # Queries Reference
2
2
 
3
- ## 1. List Positions (`jv orders list`)
3
+ > All tools below are MCP tools. Call them directly — never run `jv` shell commands.
4
+ > These tools require no setup beyond `wallet_setup`. No private keys, no environment variables.
4
5
 
5
- Query active or historical positions from the Subgraph.
6
+ ## 1. List Positions `list_orders`
6
7
 
7
- ### Syntax
8
+ Query active or historical positions.
8
9
 
9
- ```
10
- jv orders list [options]
11
- ```
10
+ ### Parameters
12
11
 
13
- ### Options
12
+ | Parameter | Required | Default | Description |
13
+ |-----------|----------|---------|-------------|
14
+ | `position_side` | No | — | Filter: `LONG` or `SHORT` |
15
+ | `all` | No | `false` | `true` to include closed/liquidated positions |
16
+ | `since` | No | — | Filter orders after this time (e.g., `7d`, `2025-01-01`) |
17
+ | `until` | No | — | Filter orders before this time |
18
+ | `page` | No | `1` | Page number |
19
+ | `limit` | No | `20` | Results per page |
14
20
 
15
- | Option | Required | Default | Description |
16
- |--------|----------|---------|-------------|
17
- | `--position-side <long\|short>` | No | — | Filter by position side |
18
- | `--all` | No | — | Include closed/liquidated positions (default: active only) |
19
- | `--since <time>` | No | — | Filter orders created after this time |
20
- | `--until <time>` | No | — | Filter orders created before this time |
21
- | `--page <n>` | No | `1` | Page number |
22
- | `--limit <n>` | No | `20` | Results per page |
23
- | `--network <name>` | No | `jaspervault` | Network name |
24
- | `--pretty` | No | — | Pretty-print JSON output |
25
-
26
- ### Time Format (`--since` / `--until`)
21
+ ### Time Formats for `since` / `until`
27
22
 
28
23
  | Format | Example | Description |
29
24
  |--------|---------|-------------|
@@ -33,21 +28,14 @@ jv orders list [options]
33
28
  | ISO date | `2025-01-01` | Specific date |
34
29
  | Unix timestamp | `1704067200` | Seconds since epoch |
35
30
 
36
- ### Output
31
+ ### Response
37
32
 
38
33
  ```json
39
34
  {
40
35
  "orders": [
41
36
  {
42
37
  "id": "123",
43
- "holder": "0x...",
44
- "writer": "0x...",
45
- "recipient": "0x...",
46
38
  "orderType": 0,
47
- "productType": "50000000000000",
48
- "marginDeposited": "60000000",
49
- "quantity": "43860000000000000",
50
- "entryPrice": "68476000000000000000000",
51
39
  "margin": "60.000000",
52
40
  "size": "0.043860000000000000",
53
41
  "entryPriceUsd": "68476.000000000000000000",
@@ -62,114 +50,53 @@ jv orders list [options]
62
50
  }
63
51
  ```
64
52
 
65
- ### Key Output Fields
53
+ ### Key Fields
66
54
 
67
55
  | Field | Description |
68
56
  |-------|-------------|
69
- | `id` | Order ID (use for TP/SL/protect commands) |
57
+ | `id` | Order ID (use for TP/SL/protect tools) |
70
58
  | `orderType` | `0` = Long, `1` = Short |
71
59
  | `margin` | Human-readable margin in USDC |
72
60
  | `size` | Human-readable position size in asset units |
73
61
  | `entryPriceUsd` | Human-readable entry price in USD |
74
- | `leverage` | Leverage multiplier (extracted from `productType`) |
75
- | `createdTime` | ISO timestamp of order creation |
76
- | `marginDeposited` | Raw margin in wei (6 decimals for USDC) |
77
- | `quantity` | Raw position size in wei (18 decimals) |
78
- | `entryPrice` | Raw entry price in wei (18 decimals) |
62
+ | `leverage` | Leverage multiplier |
63
+ | `createdTime` | ISO timestamp |
79
64
 
80
- **Always use the human-readable fields** (`margin`, `size`, `entryPriceUsd`, `leverage`) when reporting to the user. The raw wei fields are for reference only.
65
+ Always use the human-readable fields (`margin`, `size`, `entryPriceUsd`) when reporting to the user. Raw wei fields are for reference only.
81
66
 
82
67
  ### Examples
83
68
 
84
- ```bash
85
- # List active positions
86
- jv orders list --pretty
87
-
88
- # List only long positions
89
- jv orders list --position-side long --pretty
90
-
91
- # List all positions including closed (last 7 days)
92
- jv orders list --all --since 7d --pretty
93
-
94
- # Paginate results
95
- jv orders list --page 2 --limit 10 --pretty
96
69
  ```
97
-
98
- ---
99
-
100
- ## 2. Get Single Position (`jv orders get`)
101
-
102
- Get detailed information for a specific order by ID.
103
-
104
- ### Syntax
105
-
106
- ```
107
- jv orders get <orderId> [options]
108
- ```
109
-
110
- ### Options
111
-
112
- | Option | Required | Default | Description |
113
- |--------|----------|---------|-------------|
114
- | `--network <name>` | No | `jaspervault` | Network name |
115
- | `--pretty` | No | — | Pretty-print JSON output |
116
-
117
- ### Output
118
-
119
- Same fields as `jv orders list` but for a single order.
120
-
121
- ### Example
122
-
123
- ```bash
124
- jv orders get 123 --pretty
70
+ list_orders → all active positions
71
+ list_orders { position_side: "LONG" } → only longs
72
+ list_orders { all: true, since: "7d" } → all positions last 7 days
125
73
  ```
126
74
 
127
75
  ---
128
76
 
129
- ## 3. Portfolio Statistics (`jv orders stats`)
130
-
131
- Get aggregate statistics for all positions in your vault.
77
+ ## 2. Get Single Position `get_order`
132
78
 
133
- ### Syntax
79
+ | Parameter | Required | Description |
80
+ |-----------|----------|-------------|
81
+ | `order_id` | Yes | Order ID |
134
82
 
135
- ```
136
- jv orders stats [options]
137
- ```
138
-
139
- ### Options
140
-
141
- | Option | Required | Default | Description |
142
- |--------|----------|---------|-------------|
143
- | `--network <name>` | No | `jaspervault` | Network name |
144
- | `--pretty` | No | — | Pretty-print JSON output |
145
-
146
- ### Example
147
-
148
- ```bash
149
- jv orders stats --pretty
150
- ```
83
+ Returns same fields as `list_orders` for a single order.
151
84
 
152
85
  ---
153
86
 
154
- ## 4. Get Market Price (`jv price`)
155
-
156
- Fetch the current market price from the Quote Center oracle.
87
+ ## 3. Portfolio Statistics `get_order_stats`
157
88
 
158
- ### Syntax
89
+ No parameters required. Returns aggregate statistics for all positions in your vault.
159
90
 
160
- ```
161
- jv price --symbol <symbol> [options]
162
- ```
91
+ ---
163
92
 
164
- ### Options
93
+ ## 4. Get Market Price — `get_price`
165
94
 
166
- | Option | Required | Default | Description |
167
- |--------|----------|---------|-------------|
168
- | `--symbol <symbol>` | Yes | — | Asset symbol (e.g., `JBTC`, `CBBTC`) |
169
- | `--network <name>` | No | `jaspervault` | Network name |
170
- | `--pretty` | No | — | Pretty-print JSON output |
95
+ | Parameter | Required | Description |
96
+ |-----------|----------|-------------|
97
+ | `symbol` | Yes | Asset symbol (e.g., `JBTC`, `CBBTC`) |
171
98
 
172
- ### Output
99
+ ### Response
173
100
 
174
101
  ```json
175
102
  {
@@ -181,35 +108,19 @@ jv price --symbol <symbol> [options]
181
108
  }
182
109
  ```
183
110
 
184
- **Always use the `price` field** (human-readable) when reporting to the user.
185
-
186
- ### Example
187
-
188
- ```bash
189
- jv price --symbol JBTC --pretty
190
- ```
111
+ Use the `price` field (human-readable) when reporting to the user.
191
112
 
192
113
  ---
193
114
 
194
- ## 5. Job Status (`jv job status`)
195
-
196
- Check the execution status of an async job (market order, option creation, etc.).
115
+ ## 5. Job Status `get_job_status`
197
116
 
198
- ### Syntax
117
+ Check execution status of an async job (market order, option creation, etc.).
199
118
 
200
- ```
201
- jv job status <jobId> [options]
202
- ```
119
+ | Parameter | Required | Description |
120
+ |-----------|----------|-------------|
121
+ | `job_id` | Yes | Job ID from market order creation |
203
122
 
204
- ### Options
205
-
206
- | Option | Required | Default | Description |
207
- |--------|----------|---------|-------------|
208
- | `--pretty` | No | — | Pretty-print JSON output |
209
-
210
- ### Output
211
-
212
- The command connects via SSE and waits up to 60s for the job result:
123
+ ### Response
213
124
 
214
125
  ```json
215
126
  {
@@ -224,71 +135,43 @@ The command connects via SSE and waits up to 60s for the job result:
224
135
  |--------|---------|
225
136
  | `completed` | Job finished successfully |
226
137
  | `failed` | Job failed (check `error` field) |
227
- | `timeout` | SSE connection timed out — job may still be processing |
228
-
229
- ### Example
230
-
231
- ```bash
232
- jv job status MARKET_ORDER_xxx --pretty
233
- ```
138
+ | `timeout` | SSE timed out — job may still be processing |
234
139
 
235
140
  ---
236
141
 
237
- ## 6. Limit Order Management (`jv limit-order`)
142
+ ## 6. Limit Order Management
238
143
 
239
- ### List Limit Orders
144
+ ### List Limit Orders — `list_limit_orders`
240
145
 
241
- ```
242
- jv limit-order list --wallet <address> [--status <status>] [--pretty]
243
- ```
244
-
245
- | Option | Required | Default | Description |
246
- |--------|----------|---------|-------------|
247
- | `--wallet <address>` | Yes | — | Wallet address to query |
248
- | `--status <status>` | No | — | Filter: `PENDING`, `TRIGGERED`, `EXECUTING`, `COMPLETED`, `FAILED`, `EXPIRED`, `CANCELLED` |
249
- | `--pretty` | No | — | Pretty-print JSON output |
250
-
251
- ### Get Limit Order Status
252
-
253
- ```
254
- jv limit-order status <id> [--pretty]
255
- ```
256
-
257
- Query a specific limit order by its ID.
146
+ | Parameter | Required | Description |
147
+ |-----------|----------|-------------|
148
+ | `wallet` | Yes | Wallet address |
149
+ | `status` | No | Filter: `PENDING`, `TRIGGERED`, `EXECUTING`, `COMPLETED`, `FAILED`, `EXPIRED`, `CANCELLED` |
258
150
 
259
- ### Cancel Limit Order
151
+ ### Get Limit Order Status — `get_limit_order_status`
260
152
 
261
- ```
262
- jv limit-order cancel <id> [--pretty]
263
- ```
153
+ | Parameter | Required | Description |
154
+ |-----------|----------|-------------|
155
+ | `limit_order_id` | Yes | Limit order ID |
264
156
 
265
- Cancel a pending limit order by its ID.
266
-
267
- ### Examples
157
+ ### Cancel Limit Order `cancel_limit_order`
268
158
 
269
- ```bash
270
- # List all pending limit orders
271
- jv limit-order list --wallet 0x1234... --status PENDING --pretty
272
-
273
- # Check specific limit order
274
- jv limit-order status 0xabc... --pretty
275
-
276
- # Cancel a limit order
277
- jv limit-order cancel 0xabc... --pretty
278
- ```
159
+ | Parameter | Required | Description |
160
+ |-----------|----------|-------------|
161
+ | `limit_order_id` | Yes | Limit order ID to cancel |
279
162
 
280
163
  ---
281
164
 
282
- ## Error Codes
165
+ ## Error Handling
283
166
 
284
- All CLI commands use consistent exit codes:
167
+ When a tool fails, check the error message:
285
168
 
286
- | Code | Name | Meaning |
287
- |------|------|---------|
288
- | `0` | SUCCESS | Command completed successfully |
289
- | `1` | CONFIG_ERROR | Missing config, delegation key, or vault profile |
290
- | `2` | NETWORK_ERROR | RPC or API connection failure |
291
- | `3` | BUSINESS_ERROR | Order not found, insufficient balance, contract revert |
292
- | `4` | HTTP_ERROR | HTTP request failure |
169
+ | Error Pattern | Meaning | Action |
170
+ |--------------|---------|--------|
171
+ | "delegation key not found" | Vault not initialized | Call `wallet_setup` |
172
+ | "vault not initialized" | Vault not initialized | Call `wallet_setup` |
173
+ | "no profile" / "profile not found" | Vault not initialized | Call `wallet_setup` |
174
+ | "delegation expired" | Key expired (1 week limit) | Call `wallet_setup` again |
175
+ | Network/timeout errors | Transient issue | Retry the tool call |
293
176
 
294
- When a command fails with exit code 1 and mentions "delegation key not found" or "vault not initialized", guide the user to run `jv vault setup`.
177
+ **NEVER respond to these errors by asking for private keys or suggesting environment variables.** The answer is always `wallet_setup`.