openbroker 1.0.40 → 1.0.41

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.
package/SKILL.md CHANGED
@@ -39,10 +39,33 @@ openbroker setup # One-command setup (wallet + config + builder app
39
39
  openbroker approve-builder --check # Check builder fee status (for troubleshooting)
40
40
  ```
41
41
 
42
- The `setup` command handles everything:
43
- 1. Generate new wallet or use existing private key
44
- 2. Save config to `~/.openbroker/.env`
45
- 3. Automatically approve builder fee (required for trading)
42
+ The `setup` command offers three modes:
43
+ 1. **Import existing key** use a private key you already have (master wallet)
44
+ 2. **Generate new wallet** — create a fresh master wallet
45
+ 3. **Generate API wallet** (recommended for agents) — creates a restricted wallet that can trade but cannot withdraw
46
+
47
+ For options 1 and 2, setup saves config and approves the builder fee automatically.
48
+ For option 3 (API wallet), see the API Wallet Setup section below.
49
+
50
+ ### API Wallet Setup (Recommended for Agents)
51
+
52
+ API wallets can place trades on behalf of a master account but **cannot withdraw funds**. This is the safest option for automated agents.
53
+
54
+ **Flow:**
55
+ 1. Run `openbroker setup` and choose option 3 ("Generate API wallet")
56
+ 2. The CLI generates a keypair and prints an approval URL (e.g. `https://openbroker.dev/approve?agent=0xABC...`)
57
+ 3. The agent owner opens the URL in a browser and connects their master wallet (MetaMask etc.)
58
+ 4. The master wallet signs two transactions: `ApproveAgent` (authorizes the API wallet) and `ApproveBuilderFee` (approves the 1 bps fee)
59
+ 5. The CLI detects the approval automatically and saves the config
60
+
61
+ **After setup, the config will contain:**
62
+ ```
63
+ HYPERLIQUID_PRIVATE_KEY=0x... # API wallet private key
64
+ HYPERLIQUID_ACCOUNT_ADDRESS=0x... # Master account address
65
+ HYPERLIQUID_NETWORK=mainnet
66
+ ```
67
+
68
+ **Important for agents:** When using an API wallet, pass the approval URL to the agent owner (the human who controls the master wallet). The owner must approve in a browser before the agent can trade. The CLI waits up to 10 minutes for the approval. If it times out, re-run `openbroker setup`.
46
69
 
47
70
  ### Account Info
48
71
  ```bash
@@ -294,7 +317,9 @@ Run `openbroker setup` to create the global config interactively.
294
317
  |----------|----------|-------------|
295
318
  | `HYPERLIQUID_PRIVATE_KEY` | Yes | Wallet private key (0x...) |
296
319
  | `HYPERLIQUID_NETWORK` | No | `mainnet` (default) or `testnet` |
297
- | `HYPERLIQUID_ACCOUNT_ADDRESS` | No | For API wallets |
320
+ | `HYPERLIQUID_ACCOUNT_ADDRESS` | No | Master account address (required for API wallets) |
321
+
322
+ The builder fee (1 bps / 0.01%) is hardcoded and not configurable.
298
323
 
299
324
  ## Risk Warning
300
325
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openbroker",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
4
4
  "description": "Hyperliquid trading CLI - execute orders, manage positions, and run trading strategies",
5
5
  "type": "module",
6
6
  "bin": {
@@ -109,9 +109,9 @@ export function loadConfig(): OpenBrokerConfig {
109
109
  const network = process.env.HYPERLIQUID_NETWORK || 'mainnet';
110
110
  const baseUrl = network === 'testnet' ? TESTNET_URL : MAINNET_URL;
111
111
 
112
- // Use open-broker address by default, but allow override for custom builders
113
- const builderAddress = (process.env.BUILDER_ADDRESS || OPEN_BROKER_BUILDER_ADDRESS).toLowerCase();
114
- const builderFee = parseInt(process.env.BUILDER_FEE || '10', 10); // default 1 bps
112
+ // Builder fee is hardcoded — set by OpenBroker, not configurable by users
113
+ const builderAddress = OPEN_BROKER_BUILDER_ADDRESS.toLowerCase();
114
+ const builderFee = 10; // 10 tenths-of-bps = 1 bps = 0.01%
115
115
  const slippageBps = parseInt(process.env.SLIPPAGE_BPS || '50', 10); // default 0.5%
116
116
 
117
117
  // Derive the wallet address from private key
@@ -116,11 +116,6 @@ HYPERLIQUID_ACCOUNT_ADDRESS=${masterAddress}
116
116
 
117
117
  # Network: mainnet or testnet
118
118
  HYPERLIQUID_NETWORK=mainnet
119
-
120
- # Builder fee (supports openbroker development)
121
- # Default: 1 bps (0.01%) on trades
122
- BUILDER_ADDRESS=${OPEN_BROKER_BUILDER_ADDRESS}
123
- BUILDER_FEE=10
124
119
  `;
125
120
  }
126
121
 
@@ -171,8 +166,6 @@ HYPERLIQUID_PRIVATE_KEY=${privateKey}
171
166
  # HYPERLIQUID_ACCOUNT_ADDRESS=0x...
172
167
 
173
168
  HYPERLIQUID_NETWORK=mainnet
174
- BUILDER_ADDRESS=${OPEN_BROKER_BUILDER_ADDRESS}
175
- BUILDER_FEE=10
176
169
  `;
177
170
  fs.writeFileSync(CONFIG_PATH, partialEnv, { mode: 0o600 });
178
171
  console.log(` Partial config saved to: ${CONFIG_PATH}`);
@@ -343,11 +336,6 @@ HYPERLIQUID_PRIVATE_KEY=${privateKey}
343
336
 
344
337
  # Network: mainnet or testnet
345
338
  HYPERLIQUID_NETWORK=mainnet
346
-
347
- # Builder fee (supports openbroker development)
348
- # Default: 1 bps (0.01%) on trades
349
- BUILDER_ADDRESS=${OPEN_BROKER_BUILDER_ADDRESS}
350
- BUILDER_FEE=10
351
339
  `;
352
340
 
353
341
  fs.writeFileSync(CONFIG_PATH, envContent, { mode: 0o600 });