hyperliquid-trade
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesehyperliquid-trade
hyperliquid-trade
Trade spot and perpetual futures on Hyperliquid L1 using IOC market orders.
使用IOC市价单在Hyperliquid L1上进行现货与永续合约交易。
When to Use
使用场景
- Spot: buy or sell any token listed on Hyperliquid spot markets
- Perps: open long/short or close perpetual futures positions
- Balance: check spot token balances or perp positions and margin
- Deposit: bridge USDC from Arbitrum One to Hyperliquid L1
- 现货:买卖Hyperliquid现货市场上线的任意代币
- 永续合约:开多/空仓或平仓永续合约头寸
- 余额查询:查看现货代币余额或永续合约持仓与保证金
- 存款:将USDC从Arbitrum One跨链桥接到Hyperliquid L1
External Communications
外部通信
This skill connects to the Hyperliquid API ( in , default ). Inform the user before the first external call in each session. On first setup, installs dependencies via .
api_urlhyperliquid.yamlhttps://api.hyperliquid.xyznpm install本技能会连接到Hyperliquid API(中的,默认值为)。在每个会话的首次外部调用前需告知用户。首次设置时,会通过安装依赖。
hyperliquid.yamlapi_urlhttps://api.hyperliquid.xyznpm installEnvironment & Security Declaration
环境与安全声明
Required config files
必需的配置文件
| File | Purpose |
|---|---|
| WDK encrypted vault (created by xaut-trade setup) |
| Vault password (mode 0600, created by xaut-trade setup) |
| Network, API URL, risk thresholds |
| 文件 | 用途 |
|---|---|
| WDK加密密钥库(由xaut-trade初始化创建) |
| 密钥库密码(权限0600,由xaut-trade初始化创建) |
| 网络、API地址、风险阈值 |
Optional environment variables (in ~/.aurehub/.env
)
~/.aurehub/.env可选环境变量(位于~/.aurehub/.env
)
~/.aurehub/.env| Variable | Purpose | Default |
|---|---|---|
| HD derivation index (0-based) for wallet address | |
| Arbitrum One JSON-RPC endpoint — required for | (none; public: |
| 变量 | 用途 | 默认值 |
|---|---|---|
| 钱包地址的HD派生索引(从0开始) | |
| Arbitrum One的JSON-RPC端点 —— | 无;公共节点: |
Security safeguards
安全防护措施
- Private key is decrypted from vault in memory only, never stored
- Decrypted key material zeroed from memory after use
- All external API responses treated as untrusted numeric data
- Every trade requires explicit user confirmation per thresholds in
hyperliquid.yaml
- 私钥仅在内存中从密钥库解密,绝不会存储
- 使用后立即将解密的密钥材料从内存清零
- 所有外部API响应均视为不可信的数值数据
- 每笔交易都需要根据中的阈值获得用户明确确认
hyperliquid.yaml
Environment Readiness Check (run first on every session)
环境就绪检查(每次会话首次运行)
<skill-dir><scripts-dir><skill-dir>/scriptsRun these checks before handling any intent (except knowledge queries):
| Step | Check | Type | Action |
|---|---|---|---|
| 1 | | HARD STOP | Load references/onboarding.md and guide the user through setup. |
| 2 | | HARD STOP | Load references/onboarding.md and guide the user through setup. |
| 3 | | AUTO-FIX | |
| 4 | `node -e "const [maj,min]=process.version.slice(1).split('.').map(Number);if(maj<20 | (maj===20&&min<19))process.exit(1)"` passes | |
| 5 | | AUTO-FIX | |
| 6 | | HARD STOP | Report error JSON; load references/onboarding.md |
If all pass: source , run Account Selection (below), then Wallet-Ready Registration, then proceed to intent detection.
~/.aurehub/.env<skill-dir><scripts-dir><skill-dir>/scripts处理任何意图(知识查询除外)前需运行以下检查:
| 步骤 | 检查内容 | 类型 | 操作 |
|---|---|---|---|
| 1 | | 强制终止 | 加载references/onboarding.md并引导用户完成初始化。 |
| 2 | | 强制终止 | 加载references/onboarding.md并引导用户完成初始化。 |
| 3 | | 自动修复 | |
| 4 | `node -e "const [maj,min]=process.version.slice(1).split('.').map(Number);if(maj<20 | (maj===20&&min<19))process.exit(1)"`执行通过 | |
| 5 | | 自动修复 | |
| 6 | | 强制终止 | 上报错误JSON;加载references/onboarding.md |
如果全部通过:读取,执行账户选择(如下),然后执行钱包就绪注册,再进行意图检测。
~/.aurehub/.envAccount Selection
账户选择
If the user specifies a wallet index (e.g. "use wallet 2", "account 1", "wallet 3"), remember that index for the entire session. Append to every , , and command in this session.
--account Nnode balance.jsnode trade.jsnode limit-order.jsIf the user does not specify an account, do not append — the default from in (or ) is used automatically.
--accountWDK_ACCOUNT_INDEX.env0如果用户指定了钱包索引(例如“使用钱包2”、“账户1”、“钱包3”),则在整个会话中记住该索引。在本会话的所有、和命令后追加。
node balance.jsnode trade.jsnode limit-order.js--account N如果用户未指定账户,则不追加 —— 自动使用中的默认值(或)。
--account.envWDK_ACCOUNT_INDEX0Wallet-Ready Registration
钱包就绪注册
Run immediately after environment checks pass. Derive WALLET_ADDRESS from check 6's output (if an account was selected above, include ):
--account Nbash
source ~/.aurehub/.env
WALLET_ADDRESS=$(node <scripts-dir>/balance.js address | node -p "JSON.parse(require('fs').readFileSync(0,'utf8')).address")If this fails, skip registration silently and continue.
REGISTERED=$(cat ~/.aurehub/.registered 2>/dev/null)- If starts with
"$REGISTERED"→ already registered, silent skip; return immediately"$WALLET_ADDRESS:" - If !=
RANKINGS_OPT_IN:"true"- Check marker:
PROMPTED=$(cat ~/.aurehub/.rankings_prompted 2>/dev/null) - If marker starts with → skip; return immediately
"$WALLET_ADDRESS:" - Otherwise ask once: "Join XAUT activity rankings now? (yes/no)"
- If user says :
no; returnecho "$WALLET_ADDRESS:declined" > ~/.aurehub/.rankings_prompted - If user says :
yes- If is empty: ask user for nickname
NICKNAME - Persist opt-in in (
~/.aurehub/.env,RANKINGS_OPT_IN=true)NICKNAME=<value> - Re-source env:
source ~/.aurehub/.env - Continue to step 4
- If
- If user says
- Check marker:
- If ==
RANKINGS_OPT_IN:"true"- If is empty: ask "You're opted in to XAUT activity rankings — what nickname would you like to appear as?", then persist to
NICKNAMEand re-source~/.aurehub/.env - Register:
bashNICKNAME_ESC=$(printf '%s' "$NICKNAME" | sed 's/\\/\\\\/g; s/"/\\"/g') REGISTER_RESP=$(curl -s -o /dev/null -w "%{http_code}" -X POST \ https://xaue.com/api/rankings/participants \ -H 'Content-Type: application/json' \ -d "{\"wallet_address\":\"$WALLET_ADDRESS\",\"nickname\":\"$NICKNAME_ESC\",\"source\":\"agent\"}")- HTTP 200 or 201: ; inform: "Registered with nickname: $NICKNAME"
echo "$WALLET_ADDRESS:$NICKNAME" > ~/.aurehub/.registered - Any other status: silent continue, do not write marker file
- If
Only prompt once per wallet. The and markers ensure idempotency across sessions.
.rankings_prompted.registered环境检查通过后立即执行。从检查6的输出中导出WALLET_ADDRESS(如果已选择账户,需包含):
--account Nbash
source ~/.aurehub/.env
WALLET_ADDRESS=$(node <scripts-dir>/balance.js address | node -p "JSON.parse(require('fs').readFileSync(0,'utf8')).address")如果失败,静默跳过注册并继续。
REGISTERED=$(cat ~/.aurehub/.registered 2>/dev/null)- 如果以
"$REGISTERED"开头 → 已注册,静默跳过;立即返回"$WALLET_ADDRESS:" - 如果!=
RANKINGS_OPT_IN:"true"- 检查标记:
PROMPTED=$(cat ~/.aurehub/.rankings_prompted 2>/dev/null) - 如果标记以开头 → 跳过;立即返回
"$WALLET_ADDRESS:" - 否则询问一次:"是否现在加入XAUT活动排行榜?(是/否)"
- 如果用户回答:
否;返回echo "$WALLET_ADDRESS:declined" > ~/.aurehub/.rankings_prompted - 如果用户回答:
是- 如果为空:询问用户昵称
NICKNAME - 将选择加入的信息持久化到(
~/.aurehub/.env,RANKINGS_OPT_IN=true)NICKNAME=<value> - 重新读取环境变量:
source ~/.aurehub/.env - 继续步骤4
- 如果
- 如果用户回答
- 检查标记:
- 如果==
RANKINGS_OPT_IN:"true"- 如果为空:询问"您已选择加入XAUT活动排行榜——您希望显示什么昵称?",然后将昵称持久化到
NICKNAME并重新读取~/.aurehub/.env - 注册:
bashNICKNAME_ESC=$(printf '%s' "$NICKNAME" | sed 's/\\/\\\\/g; s/"/\\"/g') REGISTER_RESP=$(curl -s -o /dev/null -w "%{http_code}" -X POST \ https://xaue.com/api/rankings/participants \ -H 'Content-Type: application/json' \ -d "{\"wallet_address\":\"$WALLET_ADDRESS\",\"nickname\":\"$NICKNAME_ESC\",\"source\":\"agent\"}")- HTTP状态码200或201:;告知用户:"已注册,昵称:$NICKNAME"
echo "$WALLET_ADDRESS:$NICKNAME" > ~/.aurehub/.registered - 其他状态码:静默继续,不写入标记文件
- 如果
每个钱包仅提示一次。和标记确保跨会话的幂等性。
.rankings_prompted.registeredIntent Detection
意图检测
| User says | Action |
|---|---|
| buy ETH / purchase BTC / spot buy | |
| sell SOL / spot sell ETH | |
| long ETH / open long BTC 10x / go long | |
| short BTC / open short ETH / go short | |
| close position / close ETH / flat / exit | |
| balance / holdings / positions / how much / 查看余额 / 查看持仓 / 持仓 | Always run both: |
| setup / onboarding / first time | Load references/onboarding.md |
| Insufficient info (no coin or amount) | Ask for the missing details before proceeding |
| limit buy ETH at 3000 / limit order / limit sell | Load references/limit-order.md; run |
| open orders / my orders / list orders | Load references/limit-order.md; run |
| cancel order / cancel limit | Load references/limit-order.md; run |
| change order price / update order / modify order | Load references/limit-order.md; run |
| deposit USDC / fund wallet / bridge USDC / 充值 / 存款 / 往 HL 存钱 | Run |
| withdraw USDC / withdraw to Arbitrum / 提现 / 取款 / 把钱取出来 | Run |
| 用户指令 | 操作 |
|---|---|
| buy ETH / purchase BTC / spot buy | |
| sell SOL / spot sell ETH | |
| long ETH / open long BTC 10x / go long | |
| short BTC / open short ETH / go short | |
| close position / close ETH / flat / exit | |
| balance / holdings / positions / how much / 查看余额 / 查看持仓 / 持仓 | 始终同时运行: |
| setup / onboarding / first time | 加载references/onboarding.md |
| 信息不足(无代币或金额) | 先询问缺失的信息再继续 |
| limit buy ETH at 3000 / limit order / limit sell | 加载references/limit-order.md;运行 |
| open orders / my orders / list orders | 加载references/limit-order.md;运行 |
| cancel order / cancel limit | 加载references/limit-order.md;运行 |
| change order price / update order / modify order | 加载references/limit-order.md;运行 |
| deposit USDC / fund wallet / bridge USDC / 充值 / 存款 / 往 HL 存钱 | 执行 |
| withdraw USDC / withdraw to Arbitrum / 提现 / 取款 / 把钱取出来 | 执行 |
Resolving HL_SCRIPTS_DIR
解析HL_SCRIPTS_DIR
Use as the scripts directory. To find at runtime:
<skill-dir>/scripts<skill-dir>bash
undefined使用作为脚本目录。运行时查找的方法:
<skill-dir>/scripts<skill-dir>bash
undefined1. Git repo fallback
1. Git仓库回退方案
GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
[ -n "$GIT_ROOT" ] && [ -d "$GIT_ROOT/skills/hyperliquid-trade/scripts" ] && HL_SCRIPTS_DIR="$GIT_ROOT/skills/hyperliquid-trade/scripts"
GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
[ -n "$GIT_ROOT" ] && [ -d "$GIT_ROOT/skills/hyperliquid-trade/scripts" ] && HL_SCRIPTS_DIR="$GIT_ROOT/skills/hyperliquid-trade/scripts"
2. Bounded home search
2. 受限本地搜索
[ -z "$HL_SCRIPTS_DIR" ] && HL_SCRIPTS_DIR=$(dirname "$(find -L "$HOME" -maxdepth 6 -type f -path "*/hyperliquid-trade/scripts/balance.js" 2>/dev/null | head -1)")
echo "$HL_SCRIPTS_DIR"
undefined[ -z "$HL_SCRIPTS_DIR" ] && HL_SCRIPTS_DIR=$(dirname "$(find -L "$HOME" -maxdepth 6 -type f -path "*/hyperliquid-trade/scripts/balance.js" 2>/dev/null | head -1)")
echo "$HL_SCRIPTS_DIR"
undefinedBalance Flow
余额查询流程
Load references/balance.md for the full flow.
bash
node "$HL_SCRIPTS_DIR/balance.js" spot
node "$HL_SCRIPTS_DIR/balance.js" perpParse the JSON output and present balances in a human-readable table.
加载references/balance.md查看完整流程。
bash
node "$HL_SCRIPTS_DIR/balance.js" spot
node "$HL_SCRIPTS_DIR/balance.js" perp解析JSON输出并以易读表格形式展示余额。
Spot Trade Flow
现货交易流程
Load references/spot-trade.md for the full flow.
- Confirm intent: coin, direction (buy/sell), size
- Run balance check to verify sufficient USDC/token
- Run:
node "$HL_SCRIPTS_DIR/trade.js" spot <buy|sell> <COIN> <SIZE> - Read preview JSON; apply confirmation logic per /
requiresConfirmflags (same as limit orders)requiresDoubleConfirm - After user confirms, re-run:
node "$HL_SCRIPTS_DIR/trade.js" spot <buy|sell> <COIN> <SIZE> --confirmed - Use the last JSON line as the result; report fill price and outcome
- After a spot buy: in the result reflects the ordered quantity, not the net-of-fees received amount (Hyperliquid deducts taker fees ~0.035% from the received tokens). If the user immediately wants to sell, run
filledSzfirst to get the actual available balance and use that as the sell size.balance.js spot
加载references/spot-trade.md查看完整流程。
- 确认意图:代币、方向(买/卖)、数量
- 运行余额检查以验证USDC/代币是否充足
- 运行:
node "$HL_SCRIPTS_DIR/trade.js" spot <buy|sell> <COIN> <SIZE> - 读取预览JSON;根据/
requiresConfirm标志应用确认逻辑(与限价单相同)requiresDoubleConfirm - 用户确认后,重新运行:
node "$HL_SCRIPTS_DIR/trade.js" spot <buy|sell> <COIN> <SIZE> --confirmed - 使用最后一行JSON作为结果;报告成交价格与结果
- 现货买入后:结果中的反映的是下单数量,而非扣除手续费后收到的净数量(Hyperliquid会从收到的代币中扣除约0.035%的 taker手续费)。如果用户立即想要卖出,需先运行
filledSz获取实际可用余额,并以此作为卖出数量。balance.js spot
Perp Trade Flow
永续合约交易流程
Load references/perp-trade.md for the full flow.
Open position:
- Confirm intent: coin, direction (long/short), size, leverage, margin mode
- Run:
node "$HL_SCRIPTS_DIR/trade.js" perp open <COIN> <long|short> <SIZE> [--leverage <N>] [--cross|--isolated] - Read preview JSON; apply confirmation logic per /
requiresConfirmflagsrequiresDoubleConfirm - After user confirms, re-run with ; use the last JSON line as the result
--confirmed
Close position:
- Show current position from ; confirm size to close
balance.js perp - Run:
node "$HL_SCRIPTS_DIR/trade.js" perp close <COIN> <SIZE> - Read preview JSON; apply confirmation logic
- After user confirms, re-run with ; use the last JSON line as the result
--confirmed
加载references/perp-trade.md查看完整流程。
开仓:
- 确认意图:代币、方向(多/空)、数量、杠杆、保证金模式
- 运行:
node "$HL_SCRIPTS_DIR/trade.js" perp open <COIN> <long|short> <SIZE> [--leverage <N>] [--cross|--isolated] - 读取预览JSON;根据/
requiresConfirm标志应用确认逻辑requiresDoubleConfirm - 用户确认后,添加重新运行;使用最后一行JSON作为结果
--confirmed
平仓:
- 显示中的当前持仓;确认平仓数量
balance.js perp - 运行:
node "$HL_SCRIPTS_DIR/trade.js" perp close <COIN> <SIZE> - 读取预览JSON;应用确认逻辑
- 用户确认后,添加重新运行;使用最后一行JSON作为结果
--confirmed
Confirmation Thresholds
确认阈值
Thresholds are read from . Defaults: , , .
~/.aurehub/hyperliquid.yamlconfirm_trade_usd=100large_trade_usd=1000leverage_warn=20For spot: threshold applies to trade value (size × est. price).
For perps: threshold applies to margin deposited (size × est. price ÷ leverage).
< confirm_trade_usd → show preview, execute without prompting
≥ confirm_trade_usd → show preview, single confirmation
≥ large_trade_usd → show preview, double confirmation required
leverage ≥ leverage_warn → extra warning line before confirmationTrade preview format (present to user before prompting):
Action: <Open Long ETH (Perpetual) | Buy ETH (Spot)>
Size: <0.1 ETH>
Leverage: <10x Cross> ← perp only
Est. price: ~$<3,200> (IOC, <slippage_pct>% slippage budget — default 5%, configurable in hyperliquid.yaml)
Margin used: ~$<320> USDC ← perp only
Trade value: ~$<320> USDC ← spot only
Confirm? [y/N]trade.jspreviewrequiresConfirmrequiresDoubleConfirmleverageWarning: trueleverageChangeWarning: true阈值从读取。默认值:、、。
~/.aurehub/hyperliquid.yamlconfirm_trade_usd=100large_trade_usd=1000leverage_warn=20对于现货:阈值适用于交易价值(数量 × 预估价格)。
对于永续合约:阈值适用于存入的保证金(数量 × 预估价格 ÷ 杠杆)。
< confirm_trade_usd → 显示预览,无需提示直接执行
≥ confirm_trade_usd → 显示预览,单次确认
≥ large_trade_usd → 显示预览,需双重确认
leverage ≥ leverage_warn → 确认前添加额外警告行交易预览格式(提示用户前展示):
操作: <开ETH永续多仓 | 买入ETH现货>
数量: <0.1 ETH>
杠杆: <10x 交叉保证金> ← 仅永续合约
预估价格: ~$<3,200> (IOC,<slippage_pct>%滑点预算 —— 默认5%,可在hyperliquid.yaml中配置)
占用保证金: ~$<320> USDC ← 仅永续合约
交易价值: ~$<320> USDC ← 仅现货
确认?[Y/N]trade.jspreviewrequiresConfirmrequiresDoubleConfirmleverageWarning: trueleverageChangeWarning: trueHard Stops
强制终止条件
| Condition | Message |
|---|---|
| Insufficient balance | "Insufficient balance: have $X, need $Y. Deposit at app.hyperliquid.xyz to top up." |
| Asset not found | "Asset X not found on Hyperliquid. Check the symbol and try again." |
| Leverage exceeds asset max | "Max leverage for ETH is Nx. Requested: Mx." |
| No open position (close) | "No open position found for ETH." |
| IOC order not filled | Relay the script's error verbatim — it includes the configured slippage % (e.g. "Order not filled — price moved beyond the 5% IOC limit. Check current price and retry.") |
| Node.js < 20.19 | "Node.js >= 20.19.0 required. Please upgrade: https://nodejs.org" |
| API unreachable | "Hyperliquid API unreachable. Check network or |
| 条件 | 提示信息 |
|---|---|
| 余额不足 | "余额不足:现有$X,需要$Y。请前往app.hyperliquid.xyz充值。" |
| 资产未找到 | "资产X未在Hyperliquid上线。请检查代币符号后重试。" |
| 杠杆超过资产上限 | "ETH的最大杠杆为N倍。请求的杠杆为M倍。" |
| 无持仓(平仓时) | "未找到ETH的持仓。" |
| IOC订单未成交 | 直接转发脚本的错误信息 —— 包含配置的滑点百分比(例如"订单未成交——价格超出5%的IOC限制。请查看当前价格后重试。") |
| Node.js < 20.19 | "需要Node.js >= 20.19.0,请升级:https://nodejs.org" |
| API无法访问 | "Hyperliquid API无法访问。请检查网络或 |
Deposit Flow
存款流程
Bridges USDC from Arbitrum One to Hyperliquid L1 using the HL bridge contract.
The same wallet address receives USDC on HL within ~1 minute.
Prerequisites:
- must be set in
ARBITRUM_RPC_URL(e.g.~/.aurehub/.env)https://arb1.arbitrum.io/rpc - Wallet must have USDC on Arbitrum One (native USDC, not USDC.e)
- Wallet must have a small amount of ETH on Arbitrum One for gas
Steps:
- Confirm intent: amount in USDC (minimum 5 USDC — amounts below minimum are permanently lost)
- Check is set; if missing, instruct user to add it to
ARBITRUM_RPC_URLand stop~/.aurehub/.env - Run preview:
node "$HL_SCRIPTS_DIR/deposit.js" <amount> - Parse preview JSON; apply confirmation logic per /
requiresConfirmflagsrequiresDoubleConfirm - After user confirms, re-run with
--confirmed - Report the and credit note from the result
txHash
Preview format (render before prompting):
Action: Deposit USDC → Hyperliquid L1
Amount: <100> USDC
From/To: <0x...> (same address on HL)
USDC balance: <150.00> USDC (Arbitrum)
ETH balance: <0.005> ETH (Arbitrum, for gas)
Credit time: ~1 minute
Confirm? [y/N]Hard stops:
| Condition | Message |
|---|---|
| "Add ARBITRUM_RPC_URL to ~/.aurehub/.env first. Public RPC: https://arb1.arbitrum.io/rpc" |
| Amount < 5 USDC | "Minimum deposit is 5 USDC. Smaller amounts are permanently lost by the bridge." |
| Insufficient USDC | "Insufficient USDC on Arbitrum. Have $X, need $Y." |
| No ETH for gas | "No ETH on Arbitrum One for gas. Bridge a small amount of ETH to Arbitrum first." |
| Wrong network | "ARBITRUM_RPC_URL points to wrong network. Must be Arbitrum One (chainId 42161)." |
使用HL桥接合约将USDC从Arbitrum One跨链桥接到Hyperliquid L1。同一钱包地址会在约1分钟内收到Hyperliquid上的USDC。
前提条件:
- 必须在
ARBITRUM_RPC_URL中设置(例如~/.aurehub/.env)https://arb1.arbitrum.io/rpc - 钱包在Arbitrum One上必须有USDC(原生USDC,而非USDC.e)
- 钱包在Arbitrum One上必须有少量ETH用于支付Gas费
步骤:
- 确认意图:USDC金额(最低5 USDC —— 低于最低金额的部分会被桥接永久扣除)
- 检查是否已设置;如果未设置,指导用户添加到
ARBITRUM_RPC_URL并终止流程~/.aurehub/.env - 运行预览:
node "$HL_SCRIPTS_DIR/deposit.js" <amount> - 解析预览JSON;根据/
requiresConfirm标志应用确认逻辑requiresDoubleConfirm - 用户确认后,添加重新运行
--confirmed - 报告结果中的和充值说明
txHash
预览格式(提示前渲染):
操作: 存入USDC → Hyperliquid L1
金额: <100> USDC
转出/转入地址: <0x...>(HL上的同一地址)
USDC余额: <150.00> USDC(Arbitrum)
ETH余额: <0.005> ETH(Arbitrum,用于Gas费)
到账时间: ~1分钟
确认?[Y/N]强制终止条件:
| 条件 | 提示信息 |
|---|---|
| "请先在~/.aurehub/.env中添加ARBITRUM_RPC_URL。公共节点:https://arb1.arbitrum.io/rpc" |
| 金额 < 5 USDC | "最低存款金额为5 USDC。低于该金额的部分会被桥接永久扣除。" |
| USDC不足 | "Arbitrum上的USDC不足。现有$X,需要$Y。" |
| 无ETH支付Gas费 | "Arbitrum One上无ETH用于支付Gas费。请先将少量ETH桥接到Arbitrum。" |
| 网络错误 | "ARBITRUM_RPC_URL指向错误网络。必须为Arbitrum One(chainId 42161)。" |
Withdraw Flow
提现流程
Withdraws USDC from Hyperliquid L1 to Arbitrum One. Funds arrive at the same wallet address within ~5 minutes. A 1 USDC fee is deducted by the bridge; no ETH is required.
Steps:
- Confirm intent: amount in USDC (minimum 2 USDC — 1 USDC fee is deducted, so at least 1 USDC arrives)
- Run preview:
node "$HL_SCRIPTS_DIR/withdraw.js" <amount> - Parse preview JSON; apply confirmation logic per /
requiresConfirmflagsrequiresDoubleConfirm - After user confirms, re-run with
--confirmed - Report the net received amount and credit note
Preview format (render before prompting):
Action: Withdraw USDC → Arbitrum One
Amount: <10> USDC
Fee: 1 USDC (bridge fee)
Net received: <9> USDC
USDC balance: <13.63> USDC (Hyperliquid L1)
Withdrawable: <13.63> USDC
Credit time: ~5 minutes
Confirm? [y/N]Hard stops:
| Condition | Message |
|---|---|
| Amount < 2 USDC | "Minimum withdrawal is 2 USDC (1 USDC fee is deducted)." |
| Insufficient withdrawable | "Insufficient withdrawable balance. Have $X, need $Y." |
| Margin locked | Append: "X USDC is locked as perp margin. Close positions to free up more." |
将USDC从Hyperliquid L1提取到Arbitrum One。资金会在约5分钟内到达同一钱包地址。桥接会扣除1 USDC手续费;无需ETH。
步骤:
- 确认意图:USDC金额(最低2 USDC —— 扣除1 USDC手续费后,至少到账1 USDC)
- 运行预览:
node "$HL_SCRIPTS_DIR/withdraw.js" <amount> - 解析预览JSON;根据/
requiresConfirm标志应用确认逻辑requiresDoubleConfirm - 用户确认后,添加重新运行
--confirmed - 报告到账净额和提现说明
预览格式(提示前渲染):
操作: 提取USDC → Arbitrum One
金额: <10> USDC
手续费: 1 USDC(桥接手续费)
到账净额: <9> USDC
USDC余额: <13.63> USDC(Hyperliquid L1)
可提现金额: <13.63> USDC
到账时间: ~5分钟
确认?[Y/N]强制终止条件:
| 条件 | 提示信息 |
|---|---|
| 金额 < 2 USDC | "最低提现金额为2 USDC(将扣除1 USDC手续费)。" |
| 可提现余额不足 | "可提现余额不足。现有$X,需要$Y。" |
| 保证金被锁定 | 追加提示:"X USDC被锁定为永续合约保证金。请平仓以释放更多资金。" |
Limit Order Flow
限价单流程
Load references/limit-order.md for the full flow.
Place a limit order:
- Confirm intent: coin, direction, price, size (ask for any missing details)
- Run:
node "$HL_SCRIPTS_DIR/limit-order.js" place <spot|perp> <buy|sell|long|short> <COIN> <PRICE> <SIZE> [--leverage N] [--cross|--isolated] - Read the JSON; apply confirmation logic per
previewreferences/limit-order.md - After user confirms, re-run with flag
--confirmed - Report fill outcome and order ID
List / cancel / modify:
- Run the appropriate subcommand
limit-order.js - For modify: always show a preview and ask for user confirmation before executing
- When re-running modify with , the script emits the preview JSON line first, then the result — use the last JSON line as the result
--confirmed - After a successful modify, the order ID changes (in the result is the new ID); update any stored order ID accordingly
oid - Parse JSON and present result in a human-readable format
加载references/limit-order.md查看完整流程。
下单:
- 确认意图:代币、方向、价格、数量(询问任何缺失的信息)
- 运行:
node "$HL_SCRIPTS_DIR/limit-order.js" place <spot|perp> <buy|sell|long|short> <COIN> <PRICE> <SIZE> [--leverage N] [--cross|--isolated] - 读取JSON;根据
preview应用确认逻辑references/limit-order.md - 用户确认后,添加标志重新运行
--confirmed - 报告成交结果和订单ID
查看/取消/修改:
- 运行对应的子命令
limit-order.js - 修改订单:执行前始终显示预览并请求用户确认
- 添加重新运行修改命令时,脚本会先输出预览JSON行,再输出结果 —— 使用最后一行JSON作为结果
--confirmed - 修改成功后,订单ID会变更(结果中的为新ID);相应更新任何存储的订单ID
oid - 解析JSON并以易读格式展示结果