@phantom/phantom-openclaw-plugin 0.2.1 → 0.2.2

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 (2) hide show
  1. package/README.md +137 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -69,6 +69,7 @@ See [Prerequisites](#prerequisites) below for detailed setup instructions.
69
69
  - **Automatic Authentication**: Handles OAuth flow and session management automatically
70
70
  - **Type-Safe**: Full TypeScript support with proper type definitions
71
71
  - **Simple Setup**: Minimal configuration - just enable the plugin and use
72
+ - **Perpetuals Trading**: Full Hyperliquid perps support — swap and deposit funds, manage positions, and trade perpetuals
72
73
 
73
74
  ## Prerequisites
74
75
 
@@ -354,6 +355,142 @@ Fetch a swap quote from Phantom's routing engine. Supports same-chain Solana, sa
354
355
 
355
356
  **⚠️ Warning:** When `execute: true`, this tool submits transactions immediately and irreversibly.
356
357
 
358
+ ---
359
+
360
+ ### Perpetuals Tools (Hyperliquid)
361
+
362
+ The plugin exposes 12 tools for perpetuals trading on Hyperliquid via Phantom's backend. All signing uses the wallet's EVM key (Arbitrum EIP-712).
363
+
364
+ #### Read-only
365
+
366
+ ##### `get_perp_account`
367
+
368
+ Returns perp account balance: `accountValue`, `availableBalance`, `availableToTrade`.
369
+
370
+ **Parameters:** `walletId` (optional), `derivationIndex` (optional, default 0)
371
+
372
+ ##### `get_perp_markets`
373
+
374
+ Returns all available perpetual markets with current price, funding rate, open interest, 24h volume, and max leverage.
375
+
376
+ **Parameters:** `walletId` (optional)
377
+
378
+ ##### `get_perp_positions`
379
+
380
+ Returns all open positions with direction, size, entry price, leverage, unrealized PnL, and liquidation price.
381
+
382
+ **Parameters:** `walletId` (optional), `derivationIndex` (optional, default 0)
383
+
384
+ ##### `get_perp_orders`
385
+
386
+ Returns all open orders (limit, take-profit, stop-loss) with order ID, type, price, size, and reduce-only flag.
387
+
388
+ **Parameters:** `walletId` (optional), `derivationIndex` (optional, default 0)
389
+
390
+ ##### `get_perp_trade_history`
391
+
392
+ Returns historical trades with price, size, trade value, fee, and closed PnL.
393
+
394
+ **Parameters:** `walletId` (optional), `derivationIndex` (optional, default 0)
395
+
396
+ #### Write
397
+
398
+ ##### `deposit_to_hyperliquid`
399
+
400
+ Swaps tokens to USDC via Phantom's routing engine and transfers the USDC into the Hyperliquid perp account.
401
+
402
+ **Parameters:**
403
+
404
+ - `sourceChainId` (string, required): Source chain — `"solana:mainnet"`, `"eip155:42161"`, `"eip155:8453"`, `"eip155:1"`, or `"eip155:137"`
405
+ - `amount` (string, required): Amount to deposit in human-readable units
406
+ - `tokenAddress` (string, optional): ERC-20/SPL token address — omit for native SOL or default USDC per chain
407
+ - `walletId` (string, optional), `derivationIndex` (number, optional, default 0)
408
+
409
+ **⚠️ Warning:** Submits transactions immediately and irreversibly.
410
+
411
+ ##### `open_perp_position`
412
+
413
+ Opens a perpetual position. Market orders use 10% slippage (IOC). Limit orders rest on the book (GTC).
414
+
415
+ **Parameters:**
416
+
417
+ - `market` (string, required): Market symbol (e.g. `"BTC"`, `"ETH"`, `"SOL"`)
418
+ - `direction` (string, required): `"long"` or `"short"`
419
+ - `sizeUsd` (string, required): Notional position size in USD (e.g. `"500"`)
420
+ - `leverage` (number, required): Leverage multiplier (e.g. `10` for 10x)
421
+ - `orderType` (string, required): `"market"` or `"limit"`
422
+ - `limitPrice` (string, optional): Required for limit orders
423
+ - `reduceOnly` (boolean, optional): Default false
424
+ - `walletId` (string, optional), `derivationIndex` (number, optional, default 0)
425
+
426
+ **⚠️ Warning:** Submits transactions immediately and irreversibly.
427
+
428
+ ##### `close_perp_position`
429
+
430
+ Closes an open position using a market IOC order. Defaults to 100% close.
431
+
432
+ **Parameters:**
433
+
434
+ - `market` (string, required): Market symbol (e.g. `"BTC"`)
435
+ - `sizePercent` (number, optional): Percentage to close (1–100, default 100)
436
+ - `walletId` (string, optional), `derivationIndex` (number, optional, default 0)
437
+
438
+ **⚠️ Warning:** Submits transactions immediately and irreversibly.
439
+
440
+ ##### `cancel_perp_order`
441
+
442
+ Cancels an open order by ID. Use `get_perp_orders` to retrieve order IDs.
443
+
444
+ **Parameters:**
445
+
446
+ - `market` (string, required): Market symbol
447
+ - `orderId` (number, required): Order ID from `get_perp_orders`
448
+ - `walletId` (string, optional), `derivationIndex` (number, optional, default 0)
449
+
450
+ ##### `update_perp_leverage`
451
+
452
+ Updates leverage and margin type for a market. Takes effect on new orders.
453
+
454
+ **Parameters:**
455
+
456
+ - `market` (string, required): Market symbol
457
+ - `leverage` (number, required): New leverage multiplier
458
+ - `marginType` (string, required): `"isolated"` or `"cross"`
459
+ - `walletId` (string, optional), `derivationIndex` (number, optional, default 0)
460
+
461
+ ##### `transfer_spot_to_perps`
462
+
463
+ Moves USDC **within Hypercore** from the spot account to the perp account. Use when USDC is already on Hyperliquid. Does not bridge from external chains.
464
+
465
+ **Parameters:**
466
+
467
+ - `amountUsdc` (string, required): Amount of USDC to transfer
468
+ - `walletId` (string, optional), `derivationIndex` (number, optional, default 0)
469
+
470
+ ##### `withdraw_from_perps`
471
+
472
+ Moves USDC from the perp account back to the Hyperliquid spot account.
473
+
474
+ **Parameters:**
475
+
476
+ - `amountUsdc` (string, required): Amount of USDC to withdraw
477
+ - `walletId` (string, optional), `derivationIndex` (number, optional, default 0)
478
+
479
+ #### Typical Agent Workflow
480
+
481
+ ```text
482
+ 1. get_perp_markets → find market, check price
483
+ 2. get_token_balances → verify USDC balance on source chain
484
+ 3. deposit_to_hyperliquid → swap to USDC and deposit to perp account
485
+ 4. get_perp_account → confirm balance in perp account
486
+ 5. open_perp_position → open long at 10x leverage
487
+ 6. get_perp_positions → monitor position
488
+ 7. close_perp_position → close when done
489
+ 8. withdraw_from_perps → move USDC back to spot
490
+ ```
491
+
492
+ ---
493
+
357
494
  ## Network IDs Reference
358
495
 
359
496
  Network identifiers follow the CAIP-2/CAIP-10 format. Here are the supported networks:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phantom/phantom-openclaw-plugin",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "OpenClaw plugin that bridges tool calls to Phantom's MCP server for wallet operations.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,7 +43,7 @@
43
43
  "typescript": "^5.0.4"
44
44
  },
45
45
  "dependencies": {
46
- "@phantom/mcp-server": "^0.2.1",
46
+ "@phantom/mcp-server": "^0.2.2",
47
47
  "@sinclair/typebox": "^0.32.0"
48
48
  },
49
49
  "files": [