jaspervault_cli 1.0.13 → 1.0.15
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.
|
@@ -18,7 +18,7 @@ export function registerOrderCommand(program) {
|
|
|
18
18
|
.requiredOption('--side <long|short>', 'Position side')
|
|
19
19
|
.requiredOption('--symbol <symbol>', 'Asset symbol (e.g. JBTC, CBBTC)')
|
|
20
20
|
.option('--leverage <n>', 'Leverage (default: from chain config, typically 50)')
|
|
21
|
-
.requiredOption('--margin
|
|
21
|
+
.requiredOption('-m, --margin <usdc>', 'Margin (collateral) in USDC — the actual amount deposited as collateral')
|
|
22
22
|
.option('--margin-account <addr>', 'Margin vault address (default: from profile)')
|
|
23
23
|
.option('--position-account <addr>', 'Position vault address (default: from profile)')
|
|
24
24
|
.option('--limit-price <price>', 'Limit price in USDC (omit for market order)')
|
|
@@ -42,8 +42,9 @@ export function registerOrderCommand(program) {
|
|
|
42
42
|
const leverage = opts.leverage
|
|
43
43
|
? parseInt(opts.leverage, 10)
|
|
44
44
|
: (net.defaultLeverage ?? 50);
|
|
45
|
-
const
|
|
46
|
-
const
|
|
45
|
+
const marginInput = parseFloat(opts.margin);
|
|
46
|
+
const notionalAmount = marginInput * leverage;
|
|
47
|
+
const actualMargin = marginInput.toFixed(6);
|
|
47
48
|
const positionAccount = opts.positionAccount ?? getPositionAccountFromProfile(profile, side) ?? undefined;
|
|
48
49
|
const intent = {
|
|
49
50
|
side,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../../src/commands/order.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;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C;SAC9D,MAAM,CAAC,eAAe,EAAE,qBAAqB,CAAC;SAC9C,MAAM,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;SACvD,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;SAC9C,MAAM,CAAC,KAAK,EAAE,IAA4E,EAAE,EAAE;QAC7F,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,IAAI,CAA4B,CAAC;QACnE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,IAAI,CAC3B,SAAS,CAAC,mBAAmB,EAC7B,IAAI,CACL,CAAC;QACF,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -33,7 +33,24 @@ Interact with JasperVault's perpetual contract platform. You can create market/l
|
|
|
33
33
|
|
|
34
34
|
- \`jv\` CLI installed and available in PATH
|
|
35
35
|
- **First-time setup**: use \`jv vault init-wc\` to initialize via WalletConnect (scan QR on phone, sign delegation — no private key needed)
|
|
36
|
-
- API URL defaults to
|
|
36
|
+
- API URL defaults to \`https://trading-api-test.jaspervault.pro\`; set \`JV_API_URL\` only when debugging locally
|
|
37
|
+
|
|
38
|
+
## Activation Behavior
|
|
39
|
+
|
|
40
|
+
When this skill is activated (first message from the user, OR any trading intent such as open position, check portfolio, deposit, etc.):
|
|
41
|
+
|
|
42
|
+
1. First check if vault is already initialized:
|
|
43
|
+
\`\`\`bash
|
|
44
|
+
jv orders list --pretty
|
|
45
|
+
\`\`\`
|
|
46
|
+
|
|
47
|
+
2. If the command fails with "delegation key not found", "vault not initialized", "no profile", or similar error (exit code 1):
|
|
48
|
+
- Tell the user: "Your vault is not initialized yet. Let me start the setup via WalletConnect — no private key needed."
|
|
49
|
+
- Immediately run \`jv vault init-wc --network jaspervault --timeout 120\` and follow the QR code display instructions in the Setup Flow section below.
|
|
50
|
+
|
|
51
|
+
3. If the command succeeds → vault is ready. Proceed with the user's request.
|
|
52
|
+
|
|
53
|
+
IMPORTANT: Always use WalletConnect initialization (\`jv vault init-wc\`). Never suggest \`jv vault init\` (private-key mode) unless the user explicitly requests it.
|
|
37
54
|
|
|
38
55
|
## Setup Flow (First Time — WalletConnect)
|
|
39
56
|
|
|
@@ -45,50 +62,51 @@ jv vault init-wc --network jaspervault --timeout 120
|
|
|
45
62
|
CRITICAL EXECUTION NOTE: This command runs for up to 2 minutes. Do NOT interrupt or kill the process after the first JSON line. Wait for the process to exit naturally (second JSON output = success or failure).
|
|
46
63
|
|
|
47
64
|
The command outputs two JSON lines:
|
|
48
|
-
|
|
65
|
+
|
|
66
|
+
1. \`{"status":"awaiting_connection", "uri":"wc:...", "qrCodeUrl":"https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=wc%3A...", ...}\`
|
|
67
|
+
|
|
68
|
+
Extract the \`qrCodeUrl\` field from the JSON. It will be a URL starting with \`https://api.qrserver.com/v1/create-qr-code/\`. You MUST send it as a markdown image so it renders as a scannable QR code:
|
|
69
|
+
|
|
70
|
+
\`\`\`
|
|
71
|
+

|
|
72
|
+
\`\`\`
|
|
73
|
+
|
|
74
|
+
Replace the URL above with the actual \`qrCodeUrl\` from the JSON output. Also provide the \`uri\` as a fallback:
|
|
75
|
+
|
|
76
|
+
> Or open your wallet app → WalletConnect → paste this URI: \`wc:...\`
|
|
77
|
+
|
|
78
|
+
CRITICAL: MUST use markdown image syntax \`\`. NEVER post the URL as plain text. NEVER print \`qrCodeText\`. NEVER generate your own QR code. The image will not appear if you only post the raw URL without the \`![...]()\` wrapper.
|
|
79
|
+
|
|
49
80
|
2. \`{"success":true, "message":"Vault initialized successfully", ...}\` — Init complete. The delegation wallet is saved to \`~/.jaspervault/keys.json\` and vault addresses to \`~/.jaspervault/profile.json\`. Subsequent commands use these automatically — no wallet interaction needed.
|
|
50
81
|
|
|
51
82
|
Do NOT ask the user to set \`PRIVATE_KEY\`. Do NOT suggest \`jv vault init\` unless the user explicitly requests private-key mode.
|
|
52
83
|
|
|
53
84
|
## Key Concepts (MUST READ before any trading operation)
|
|
54
85
|
|
|
55
|
-
|
|
86
|
+
**How \`--margin\` works:**
|
|
56
87
|
|
|
57
|
-
|
|
58
|
-
--margin-amount = NOTIONAL VALUE (NOT actual margin/collateral!)
|
|
59
|
-
\`\`\`
|
|
60
|
-
|
|
61
|
-
**Formulas:**
|
|
88
|
+
\`--margin\` = the **actual collateral (margin) in USDC** you deposit. The CLI internally multiplies by leverage to compute the notional position size.
|
|
62
89
|
|
|
63
90
|
| Concept | Formula | Example |
|
|
64
91
|
|---------|---------|---------|
|
|
65
92
|
| Notional value | \`margin × leverage\` | 60 USDC × 50x = $3,000 |
|
|
66
|
-
| Actual margin (collateral) | \`notional / leverage\` | $3,000 / 50 = 60 USDC |
|
|
67
93
|
| Position size | \`notional / current_price\` | $3,000 / $70,000 = 0.0428 JBTC |
|
|
68
94
|
|
|
69
|
-
**
|
|
70
|
-
|
|
71
|
-
The \`--margin-amount\` parameter takes the **notional value** (total leveraged position value in USDC). The CLI internally divides by leverage to get the actual margin:
|
|
72
|
-
|
|
73
|
-
- User passes: \`--margin-amount 3000 --leverage 50\`
|
|
74
|
-
- CLI calculates: actual margin = 3000 / 50 = 60 USDC (collateral locked)
|
|
75
|
-
- Position created: $3,000 notional, 60 USDC collateral, ~0.0428 JBTC size
|
|
76
|
-
|
|
77
|
-
**Translating user intent to \`--margin-amount\` (three scenarios):**
|
|
95
|
+
**Translating user intent to \`--margin\` (three scenarios):**
|
|
78
96
|
|
|
79
97
|
| User says | Calculation | Pass to CLI |
|
|
80
98
|
|-----------|-------------|-------------|
|
|
81
|
-
| "long
|
|
82
|
-
| "
|
|
83
|
-
| "
|
|
99
|
+
| "long with $60 USDC margin at 50x" | already the margin | \`--margin 60\` |
|
|
100
|
+
| "open a $3,000 notional position at 50x" | margin = 3000 / 50 = 60 | \`--margin 60\` |
|
|
101
|
+
| "long 0.1 BTC at 50x" | margin = (0.1 × current_price) / 50 | \`--margin <result>\` |
|
|
84
102
|
|
|
85
|
-
CRITICAL: When the user specifies an asset amount (e.g. "0.1 BTC"), you MUST first estimate the current price,
|
|
103
|
+
CRITICAL: When the user specifies an asset amount (e.g. "0.1 BTC"), you MUST first estimate the current price, compute \`notional = size × price\`, then \`margin = notional / leverage\` before passing \`--margin\`.
|
|
86
104
|
|
|
87
105
|
**How to read \`jv orders list\` output:**
|
|
88
106
|
|
|
89
107
|
| Field | What it means |
|
|
90
108
|
|-------|---------------|
|
|
91
|
-
| \`margin\` | Actual collateral deposited (e.g. 60 USDC) —
|
|
109
|
+
| \`margin\` | Actual collateral deposited (e.g. 60 USDC) — matches what you passed to \`--margin\` |
|
|
92
110
|
| \`size\` | Position size in underlying asset (e.g. 0.0428 JBTC) |
|
|
93
111
|
| \`leverage\` | Leverage multiplier (e.g. 50) |
|
|
94
112
|
| \`entryPriceUsd\` | Entry price when position was opened |
|
|
@@ -102,14 +120,14 @@ To calculate notional from output: \`notional = margin × leverage\` (or \`size
|
|
|
102
120
|
When the user wants to **open a position**, **place a market order**, or **place a limit order**:
|
|
103
121
|
|
|
104
122
|
\`\`\`bash
|
|
105
|
-
# Market order: Long JBTC,
|
|
106
|
-
jv order create --side long --symbol JBTC --margin
|
|
123
|
+
# Market order: Long JBTC, 60 USDC margin at 50x (= $3,000 notional)
|
|
124
|
+
jv order create --side long --symbol JBTC --margin 60 --leverage 50 --network jaspervault
|
|
107
125
|
|
|
108
|
-
# Market order: Short JBTC,
|
|
109
|
-
jv order create --side short --symbol JBTC --margin
|
|
126
|
+
# Market order: Short JBTC, 100 USDC margin at 50x (= $5,000 notional)
|
|
127
|
+
jv order create --side short --symbol JBTC --margin 100 --leverage 50 --network jaspervault
|
|
110
128
|
|
|
111
129
|
# Limit order: add --limit-price
|
|
112
|
-
jv order create --side long --symbol JBTC --margin
|
|
130
|
+
jv order create --side long --symbol JBTC --margin 60 --leverage 50 --limit-price 65000 --network jaspervault
|
|
113
131
|
\`\`\`
|
|
114
132
|
|
|
115
133
|
The CLI signs the order internally using the delegation wallet. No pre-signed payload required.
|
|
@@ -123,28 +141,27 @@ To reduce a position, create an **opposite-side order** with the notional value
|
|
|
123
141
|
**Step-by-step for reducing a position:**
|
|
124
142
|
|
|
125
143
|
1. Query current position: \`jv orders list --pretty\`
|
|
126
|
-
2. Calculate
|
|
127
|
-
-
|
|
128
|
-
- To close half: \`
|
|
129
|
-
3. Create opposite-side order with that
|
|
144
|
+
2. Calculate margin to close:
|
|
145
|
+
- Read the \`margin\` field directly from output (e.g. 60 USDC)
|
|
146
|
+
- To close half: \`close_margin = margin / 2\` (e.g. 30 USDC)
|
|
147
|
+
3. Create opposite-side order with that margin value
|
|
130
148
|
|
|
131
149
|
**Example: Reduce a LONG position by half**
|
|
132
150
|
|
|
133
151
|
Current position from \`jv orders list\`:
|
|
134
152
|
- margin: 60 USDC, leverage: 50, size: 0.0428 JBTC
|
|
135
|
-
- notional = 60 × 50 = $3,000
|
|
136
153
|
|
|
137
|
-
To close half ($1,500 notional):
|
|
154
|
+
To close half (30 USDC margin → $1,500 notional):
|
|
138
155
|
\`\`\`bash
|
|
139
|
-
jv order create --side short --symbol JBTC --margin
|
|
156
|
+
jv order create --side short --symbol JBTC --margin 30 --leverage 50 --network jaspervault
|
|
140
157
|
\`\`\`
|
|
141
158
|
|
|
142
|
-
**Example: Close entire position ($3,000 notional):**
|
|
159
|
+
**Example: Close entire position (60 USDC margin → $3,000 notional):**
|
|
143
160
|
\`\`\`bash
|
|
144
|
-
jv order create --side short --symbol JBTC --margin
|
|
161
|
+
jv order create --side short --symbol JBTC --margin 60 --leverage 50 --network jaspervault
|
|
145
162
|
\`\`\`
|
|
146
163
|
|
|
147
|
-
IMPORTANT: The \`--margin
|
|
164
|
+
IMPORTANT: The \`--margin\` for reduction = the margin portion you want to close (read directly from \`jv orders list\` output \`margin\` field).
|
|
148
165
|
|
|
149
166
|
### Setting Take-Profit
|
|
150
167
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-body.js","sourceRoot":"","sources":["../../../src/templates/skill-body.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CACzC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,EAAE,OAAO,CAAC,CACzC,CAAC;AAEzB,sEAAsE;AACtE,MAAM,CAAC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;wBAcE,WAAW;;CAElC,CAAC,IAAI,EAAE,CAAC;AAET,2EAA2E;AAC3E,MAAM,kBAAkB,GAAG
|
|
1
|
+
{"version":3,"file":"skill-body.js","sourceRoot":"","sources":["../../../src/templates/skill-body.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CACzC,YAAY,CAAC,IAAI,CAA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