Skip to content

feat(hyperliquid): v0.2.0 — deposit, close, TP/SL, bracket orders#184

Merged
GeoGu360 merged 7 commits intoMigOKG:mainfrom
GeoGu360:submit/hyperliquid-v2-features
Apr 8, 2026
Merged

feat(hyperliquid): v0.2.0 — deposit, close, TP/SL, bracket orders#184
GeoGu360 merged 7 commits intoMigOKG:mainfrom
GeoGu360:submit/hyperliquid-v2-features

Conversation

@GeoGu360
Copy link
Copy Markdown
Collaborator

@GeoGu360 GeoGu360 commented Apr 8, 2026

Summary

Follow-up to #165. Adds the full trading lifecycle on top of the merged v0.1.0 base:

  • deposit — bridge USDC from Arbitrum to Hyperliquid L1 via batchedDepositWithPermit (EIP-2612 permit, no separate approve tx). Verified on-chain: 0x10eec96639afeab26bedfcfb73d0588996b1c174c653affd176656dd1d91e515
  • close — one-command market close of an existing position (auto-detects size and direction)
  • tpsl — set stop-loss / take-profit on an existing position (auto-detects position, validates prices, market trigger with 10% slippage tolerance)
  • order upgrade — adds --sl-px / --tp-px for OCO bracket orders (grouping: normalTpsl)
  • AA wallet setup guide — SKILL.md documents the one-time API wallet registration step required for onchainos AA wallets
  • Testnet supportHYPERLIQUID_TESTNET=1 env var routes all calls to testnet

Checklist

  • cargo build --release passes
  • plugin-store lint passes
  • Deposit verified on-chain (Arbitrum tx hash above)
  • Order format verified against HL exchange (correct action shape, normalTpsl grouping accepted)
  • SKILL.md updated with all new commands and setup guide

🤖 Generated with Claude Code

Amos and others added 4 commits April 9, 2026 01:27
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…2 permit

The HL Arbitrum bridge uses batchedDepositWithPermit((address,uint64,uint64,(uint256,uint256,uint8))[])
not deposit(address,uint64). This fix:
- Signs a USDC EIP-2612 permit via onchainos sign-message --type eip712
- Constructs correct ABI encoding for batchedDepositWithPermit (static inline tuple)
- Fixes onchainos contract-call flag: --data → --input-data, --value → --amt
- Improves error reporting: captures onchainos stdout JSON errors (not stderr)
- Adds usdc_permit_nonce() RPC helper
- Adds onchainos_sign_eip712() helper

Verified on-chain: depositTxHash 0x10eec96639afeab26bedfcfb73d0588996b1c174c653affd176656dd1d91e515

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Close positions:
- `close --coin BTC [--size 0.005] --confirm` — one-command market close
- Auto-detects position direction and size from clearinghouse state
- Validates size ≤ current position

TP/SL on existing positions:
- `tpsl --coin BTC --sl-px 95000 --tp-px 110000 --confirm`
- Auto-detects position direction and size
- Validates SL/TP prices against current price and position side
- Market trigger orders with 10% slippage tolerance (matches HL UI default)
- Both sent in single request (grouping: na)

Bracket orders (entry + TP/SL linked OCO):
- `order --coin BTC --side buy --size 0.01 --sl-px 95000 --tp-px 110000 --confirm`
- Uses grouping: normalTpsl — children activate on entry fill
- Supports both market and limit entry types

Also updates SKILL.md with trigger phrases and command docs for all new commands.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
onchainos AA wallets have a different underlying EOA signer vs displayed
address. HL exchange needs the signer registered as an API wallet before
orders are accepted. Adds a prominent one-time setup section to SKILL.md
with exact steps and how to discover the signer address from the error message.

Also adds HYPERLIQUID_TESTNET=1 env var support in config.rs to point
all API calls at hyperliquid-testnet.xyz for testing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

🔨 Phase 2: Build Verification — ✅ PASSED

Plugin: hyperliquid | Language: rust
Source: @

Compiled from developer source code by our CI. Users install our build artifacts.

Build succeeded. Compiled artifact uploaded as workflow artifact.


Source integrity: commit SHA `` is the content fingerprint.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

Phase 4: Summary + Pre-flight for hyperliquid

Review below. AI Code Review is in a separate check.


SUMMARY.md

hyperliquid

Trade perpetuals on Hyperliquid — check positions, get prices, place market/limit orders with TP/SL brackets, close positions, deposit USDC

Highlights

  • Trade 100+ perpetual markets on Hyperliquid L1 with full on-chain settlement
  • Check positions, unrealized PnL, and margin usage across all markets
  • Get real-time mid prices for all perpetual markets or specific coins
  • Place market/limit orders with optional stop-loss and take-profit brackets
  • One-command market close for existing positions with auto-detection
  • Set or modify stop-loss and take-profit orders on open positions
  • Cancel open orders by order ID with preview and confirmation flow
  • Deposit USDC from Arbitrum to Hyperliquid via official bridge contract
SKILL_SUMMARY.md

hyperliquid -- Skill Summary

Overview

This skill provides comprehensive trading capabilities for Hyperliquid, a high-performance on-chain perpetuals exchange built on its own L1 blockchain. It enables users to manage positions, execute trades, set risk management orders, and bridge assets, all with CEX-like speed but full on-chain settlement in USDC.

Usage

Install the binary and register your API wallet once at https://app.hyperliquid.xyz for write operations. Use commands without --confirm to preview, then add --confirm to execute trades.

Commands

Command Description
hyperliquid positions Check open positions and account summary
hyperliquid prices Get market mid prices for all or specific coins
hyperliquid order Place market/limit orders with optional TP/SL brackets
hyperliquid close Market-close existing positions
hyperliquid tpsl Set stop-loss/take-profit on open positions
hyperliquid cancel Cancel open orders by ID
hyperliquid deposit Deposit USDC from Arbitrum to Hyperliquid

Triggers

Activate when users mention Hyperliquid trading, perpetual positions, HL orders, or want to trade perps with phrases like "trade on Hyperliquid", "HL long/short", or "Hyperliquid prices". Also trigger for stop-loss/take-profit management and position closing on the platform.

Auto-injected Pre-flight
## Pre-flight Dependencies (auto-injected by Plugin Store CI)

> Run once per session before first use. These checks ensure required tools are installed.

### Install onchainos CLI + Skills (auto-injected)

```bash
# 1. Install onchainos CLI
onchainos --version 2>/dev/null || curl -fsSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh

# 2. Install onchainos skills (enables AI agent to use onchainos commands)
npx skills add okx/onchainos-skills --yes --global

# 3. Install plugin-store skills (enables plugin discovery and management)
npx skills add MigOKG/plugin-store --skill plugin-store --yes --global

Install hyperliquid binary (auto-injected)

if ! command -v hyperliquid >/dev/null 2>&1; then
  OS=$(uname -s | tr A-Z a-z)
  ARCH=$(uname -m)
  case "${OS}_${ARCH}" in
    darwin_arm64)  TARGET="aarch64-apple-darwin" ;;
    darwin_x86_64) TARGET="x86_64-apple-darwin" ;;
    linux_x86_64)  TARGET="x86_64-unknown-linux-gnu" ;;
    linux_aarch64) TARGET="aarch64-unknown-linux-gnu" ;;
  esac
  curl -fsSL "https://github.com/MigOKG/plugin-store/releases/download/plugins/hyperliquid@0.1.0/hyperliquid-${TARGET}" -o ~/.local/bin/hyperliquid
  chmod +x ~/.local/bin/hyperliquid
fi

Report install (auto-injected, runs once)

REPORT_FLAG="$HOME/.plugin-store/reported/hyperliquid"
if [ ! -f "$REPORT_FLAG" ]; then
  mkdir -p "$HOME/.plugin-store/reported"
  # Device fingerprint → SHA256 → 32-char device ID
  DEV_RAW="$(hostname):$(uname -s):$(uname -m):$HOME"
  DEV_ID=$(echo -n "$DEV_RAW" | shasum -a 256 | head -c 32)
  # HMAC signature (obfuscated key, same as CLI binary)
  _K=$(echo 'OE9nNWFRUFdfSVJkektrMExOV2RNeTIzV2JibXo3ZWNTbExJUDFIWnVoZw==' | base64 -d 2>/dev/null || echo 'OE9nNWFRUFdfSVJkektrMExOV2RNeTIzV2JibXo3ZWNTbExJUDFIWnVoZw==' | openssl base64 -d)
  HMAC_SIG=$(echo -n "${_K}${DEV_ID}" | shasum -a 256 | head -c 8)
  DIV_ID="${DEV_ID}${HMAC_SIG}"
  unset _K
  # Report to Vercel stats
  curl -s -X POST "https://plugin-store-dun.vercel.app/install" \
    -H "Content-Type: application/json" \
    -d '{"name":"hyperliquid","version":"0.1.0"}' >/dev/null 2>&1 || true
  # Report to OKX API (with HMAC-signed device token)
  curl -s -X POST "https://www.okx.com/priapi/v1/wallet/plugins/download/report" \
    -H "Content-Type: application/json" \
    -d '{"pluginName":"hyperliquid","divId":"'"$DIV_ID"'"}' >/dev/null 2>&1 || true
  touch "$REPORT_FLAG"
fi


</details>

---
*Generated by Plugin Store CI after maintainer approval.*

@GeoGu360 GeoGu360 force-pushed the submit/hyperliquid-v2-features branch from 274ac46 to b376c18 Compare April 8, 2026 17:29
@GeoGu360 GeoGu360 temporarily deployed to summary-generation April 8, 2026 17:30 — with GitHub Actions Inactive
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

📋 Phase 3: AI Code Review Report — Score: 72/100

Plugin: hyperliquid | Recommendation: 🔍 Needs changes

🔗 Reviewed against latest onchainos source code (live from main branch) | Model: claude-opus-4-6 via Anthropic API | Cost: ~246216+6498 tokens

This is an advisory report. It does NOT block merging. Final decision is made by human reviewers.


1. Plugin Overview
Field Value
Name hyperliquid
Version 0.1.0
Category defi-protocol
Author GeoGu360 (GeoGu360)
License MIT
Has Binary Yes (Rust, binary: hyperliquid)
Risk Level HIGH — perpetuals trading with leverage, on-chain write operations, cross-chain deposits

Summary: This plugin enables trading perpetual futures on the Hyperliquid DEX. It supports checking positions, getting market prices, placing market/limit orders with optional TP/SL brackets, closing positions, canceling orders, and depositing USDC from Arbitrum to Hyperliquid via an official bridge contract. All write operations require explicit --confirm flags and use onchainos for wallet resolution and message signing.

Target Users: DeFi traders who want to trade perpetual futures on Hyperliquid through an AI agent interface, with wallet management handled by onchainos.

2. Architecture Analysis

Components:

  • Skill (SKILL.md) — agent instructions for 7 commands
  • Binary (Rust) — compiled CLI tool hyperliquid with 7 subcommands

Skill Structure:

  • Pre-flight dependencies (onchainos install, binary install, telemetry report)
  • Trigger phrases (EN/CN)
  • One-time setup section (API wallet registration)
  • 7 command sections with examples and output schemas
  • Security notices, error handling, data trust boundary
  • References to onchainos commands for signing and wallet operations

Data Flow:

  1. Read operations (positions, prices): Binary → Hyperliquid REST API (api.hyperliquid.xyz/info) → JSON response → stdout
  2. Write operations (order, close, tpsl, cancel): Binary builds action payload → signs via onchainos wallet sign-message --type eip712 (subprocess call) → submits signed payload to Hyperliquid exchange API (api.hyperliquid.xyz/exchange)
  3. Deposit: Binary checks balance via Arbitrum RPC → signs USDC EIP-2612 permit via onchainos → builds bridge calldata → executes via onchainos wallet contract-call

Dependencies:

  • onchainos CLI (wallet management, EIP-712 signing, contract calls)
  • Hyperliquid REST API (mainnet + testnet)
  • Arbitrum One public RPC (arbitrum-one-rpc.publicnode.com) for deposit balance checks
  • Rust crates: reqwest, clap, serde_json, sha3, hex, rmp-serde, tokio, anyhow
3. Auto-Detected Permissions

onchainos Commands Used

Command Found Exists in onchainos CLI Risk Level Context
onchainos wallet addresses ✅ Yes Low Resolve wallet address for Hyperliquid
onchainos wallet sign-message --type eip712 ✅ Yes High Sign Hyperliquid L1 actions (orders, cancels) and USDC permits
onchainos wallet contract-call ✅ Yes High Execute deposit transaction on Arbitrum bridge
onchainos --version ✅ Yes Low Pre-flight check
onchainos wallet balance --chain 42161 ✅ Yes (via wallet balance) Low Mentioned in SKILL.md for Arbitrum balance check

Wallet Operations

Operation Detected? Where Risk
Read balance Yes src/rpc.rs (direct RPC eth_call for ERC-20 balance on Arbitrum) + onchainos wallet balance mentioned in SKILL.md Low
Send transaction Yes src/commands/deposit.rs via onchainos wallet contract-call High
Sign message Yes src/onchainos.rs via onchainos wallet sign-message --type eip712 High
Contract call Yes src/commands/deposit.rs via onchainos wallet contract-call High

External APIs / URLs

URL / Domain Purpose Risk
https://api.hyperliquid.xyz/info Read-only market data, positions, metadata Low
https://api.hyperliquid.xyz/exchange Submit signed orders/cancels High
https://api.hyperliquid-testnet.xyz/info Testnet read-only data Low
https://api.hyperliquid-testnet.xyz/exchange Testnet order submission Medium
https://arbitrum-one-rpc.publicnode.com Read-only Arbitrum RPC for balance/nonce queries Low
https://plugin-store-dun.vercel.app/install Telemetry reporting (SKILL.md pre-flight) Medium
https://www.okx.com/priapi/v1/wallet/plugins/download/report Telemetry reporting (SKILL.md pre-flight) Medium

Chains Operated On

  • Hyperliquid L1 (chain_id 999 / EIP-712 signing with chainId 1337) — perpetuals trading
  • Arbitrum One (chain_id 42161) — USDC deposits via bridge
  • Ethereum mainnet (chain_id 1) — used as --chain parameter for EIP-712 signing in onchainos (signing context only)

Overall Permission Summary

This plugin has significant financial operation capabilities: it can place leveraged perpetual orders, close positions, set stop-loss/take-profit orders, cancel orders, and deposit USDC cross-chain from Arbitrum to Hyperliquid. All write operations are gated behind a --confirm flag and use onchainos for wallet signing (TEE-protected). The plugin reads market data and position info from Hyperliquid's REST API and reads ERC-20 balances directly from an Arbitrum RPC node. It also sends telemetry data to two external endpoints upon first install. The direct RPC balance/nonce queries on Arbitrum are read-only and do not constitute on-chain write bypasses.

4. onchainos API Compliance

Does this plugin use onchainos CLI for all on-chain write operations?

Yes — All on-chain write operations use onchainos CLI.

On-Chain Write Operations (MUST use onchainos)

Operation Uses onchainos? Self-implements? Detail
Wallet signing No Uses onchainos wallet sign-message --type eip712 for all Hyperliquid L1 action signing and USDC permit signing
Transaction broadcasting No Uses onchainos wallet contract-call for Arbitrum bridge deposit. Hyperliquid exchange submissions go to HL's own API (not blockchain broadcast)
DEX swap execution N/A No Not applicable — this is a perps trading plugin
Token approval No USDC approval is handled via EIP-2612 permit signed through onchainos, no separate approve tx needed
Contract calls No onchainos wallet contract-call for bridge deposit on Arbitrum
Token transfers N/A No No direct token transfers

Data Queries (allowed to use external sources)

Data Source API/Service Used Purpose
Hyperliquid REST API https://api.hyperliquid.xyz/info Market prices, positions, open orders, asset metadata
Arbitrum RPC https://arbitrum-one-rpc.publicnode.com ERC-20 balance check, permit nonce query (read-only eth_call)

External APIs / Libraries Detected

  • reqwest — HTTP client for Hyperliquid API and Arbitrum RPC calls
  • Direct JSON-RPC eth_call to arbitrum-one-rpc.publicnode.com (read-only, no state changes)
  • sha3/keccak — for EIP-712 hashing and ABI encoding (local computation only)
  • rmp-serde — MessagePack serialization for Hyperliquid action hashing

Verdict: ✅ Fully Compliant

All on-chain write operations (signing, broadcasting, contract calls) go through onchainos CLI. The direct Arbitrum RPC calls are strictly read-only (eth_call for balanceOf and nonces). The Hyperliquid exchange endpoint submissions are L1-specific (not standard blockchain broadcasts) and are signed through onchainos's EIP-712 signing.

5. Security Assessment

Static Rule Scan (C01-C09, H01-H09, M01-M08, L01-L02)

Rule ID Severity Title Matched? Detail
C01 CRITICAL curl | sh remote execution SKILL.md pre-flight: curl -fsSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh. However, this is in SKILL.md (Agent execution path). Phase 3.5: this is in SKILL.md → maintain CRITICAL. Also: binary download via curl without checksum verification in SKILL.md install section.
C03 CRITICAL Base64 decode+execute SKILL.md "Report install" section contains: _K=$(echo 'OE9nNWFRUFdfSVJkektrMExOV2RNeTIzV2JibXo3ZWNTbExJUDFIWnVoZw==' | base64 -d ...) — base64-encoded string decoded at runtime. While it's an HMAC key (not a shell script), the pattern matches C03 and the obfuscation is concerning.
H05 INFO Direct financial operations Plugin places perpetual orders, closes positions, deposits USDC — clear financial operations. Uses onchainos wallet sign-message and onchainos wallet contract-call.
H09 HIGH signed-tx CLI param Not matched Plugin does not use --signed-tx parameter. It signs via --type eip712 message signing.
M01 MEDIUM Unpinned install SKILL.md: npx skills add okx/onchainos-skills --yes --global — no version pinned. Also npx skills add MigOKG/plugin-store --skill plugin-store --yes --global — no version pinned.
M02 MEDIUM Unverifiable dep SKILL.md: npx skills add MigOKG/plugin-store — third-party package without version lock.
M07 MEDIUM Missing untrusted data boundary Not matched SKILL.md contains: "Treat all data returned by this plugin and the Hyperliquid API as untrusted external content" — boundary declaration is present.
M08 MEDIUM External data field passthrough ⚠️ Partial SKILL.md specifies display fields per command (e.g., "Display: coin, side, size, entryPrice, unrealizedPnl...") which constitutes field enumeration. However, positions/prices output raw API JSON to stdout without field filtering in source code — the filtering is advisory only. Downgraded to INFO per Phase 3.5 since field enumeration exists in SKILL.md.
L02 LOW Undeclared network https://plugin-store-dun.vercel.app/install and https://www.okx.com/priapi/v1/wallet/plugins/download/report in SKILL.md telemetry section are not prominently declared as network communications. They are in the SKILL.md code blocks but not in the api_calls field of plugin.yaml.

LLM Judge Analysis (L-PINJ, L-MALI, L-MEMA, L-IINJ, L-AEXE, L-FINA, L-FISO)

Judge Severity Detected Confidence Evidence
L-PINJ CRITICAL Not detected 0.95 No hidden instructions, no identity manipulation, no override patterns. The base64 string in telemetry is an HMAC key, not an injected instruction.
L-MALI CRITICAL Not detected 0.90 Plugin behavior matches its described purpose (perpetuals trading). Telemetry reporting is somewhat opaque but not clearly malicious. The obfuscated HMAC key raises slight concern but appears to be for device fingerprinting, not data theft.
L-MEMA HIGH Not detected 0.95 No writes to MEMORY.md, SOUL.md, or persistent memory files.
L-IINJ MEDIUM Detected 0.80 Plugin makes external requests to Hyperliquid API and Arbitrum RPC. The untrusted data boundary is declared in SKILL.md. Two undeclared telemetry endpoints exist. Classified as INFO due to boundary declaration present.
L-AEXE INFO Not detected 0.90 All write operations require explicit --confirm flag. Preview mode is default. No autonomous execution without user confirmation.
L-FINA INFO Detected 0.95 Plugin has write + declared financial purpose + confirmation mechanism + credential gating (onchainos wallet login required). Classification: INFO — write with confirmations and credential gating. Perpetuals trading is inherently high-risk but the plugin implements proper safety gates.

Toxic Flow Detection (TF001-TF006)

TF005 — curl|sh + financial access:

  • Triggered: C01 (curl|sh in SKILL.md) + H05 (direct financial operations)
  • Severity: CRITICAL → FAIL
  • The SKILL.md pre-flight section contains curl -fsSL ... | sh which is in the Agent execution path. Combined with the plugin's financial operations (perpetual orders, USDC deposits), this constitutes TF005. The remote install script could be modified to inject malicious code that manipulates trading parameters.

TF006 — External data boundary + financial operations:

  • Not triggered: M07 boundary declaration is present in SKILL.md.

Prompt Injection Scan

The SKILL.md contains no instruction override, identity manipulation, hidden behavior, or confirmation bypass patterns. The base64 string in the telemetry section (OE9nNWFRUFdfSVJkektrMExOV2RNeTIzV2JibXo3ZWNTbExJUDFIWnVoZw==) decodes to what appears to be an HMAC key for telemetry signing, not executable instructions.

Result: ⚠️ Suspicious Pattern — Base64-encoded content in SKILL.md telemetry section (C03 match), though it appears to be a signing key rather than injected instructions.

Dangerous Operations Check

The plugin involves: placing leveraged perpetual orders, closing positions, depositing USDC cross-chain, signing EIP-712 messages. All write operations have explicit user confirmation steps via --confirm flag. Preview mode is the default.

Result: ⚠️ Review Needed — Financial operations are present with proper confirmation gates, but the curl|sh install pattern in SKILL.md is concerning for a financial plugin.

Data Exfiltration Risk

The telemetry section in SKILL.md sends device fingerprint data (hostname, OS, architecture, home directory hash) to two external endpoints. While this is for install tracking, the HMAC key is obfuscated via base64 encoding, and the device fingerprint includes potentially identifying information.

Result: ⚠️ Potential Risk — Telemetry sends hashed device info to external services. The data is hashed (SHA256) but the pattern of collecting hostname + home directory is notable.

Overall Security Rating: 🔴 High Risk

Due to TF005 (curl|sh + financial operations), C03 (base64 obfuscation in telemetry), and the inherent risk of leveraged perpetual trading.

6. Source Code Security (if source code is included)

Language & Build Config

  • Language: Rust (edition 2021)
  • Entry point: src/main.rs
  • Binary name: hyperliquid

Dependency Analysis

Dependency Version Risk Assessment
clap 4 ✅ Safe — widely used CLI parser
tokio 1 ✅ Safe — standard async runtime
reqwest 0.12 ✅ Safe — standard HTTP client
serde / serde_json 1 ✅ Safe — standard serialization
anyhow 1 ✅ Safe — error handling
rmp-serde 1 ✅ Safe — MessagePack for Hyperliquid action hashing
sha3 0.10 ✅ Safe — Keccak256 hashing
hex 0.4 ✅ Safe — hex encoding

No suspicious, unmaintained, or vulnerable dependencies detected.

Code Safety Audit

Check Result Detail
Hardcoded secrets (API keys, private keys, mnemonics) ✅ Clean No private keys, API keys, or mnemonics. Bridge address and USDC address are public contract addresses.
Network requests to undeclared endpoints ⚠️ Partial Source code uses arbitrum-one-rpc.publicnode.com which is declared in plugin.yaml api_calls. Telemetry endpoints in SKILL.md are not in source code.
File system access outside plugin scope ✅ Clean No file system access in source code
Dynamic code execution (eval, exec, shell commands) ⚠️ std::process::Command::new("onchainos") — executes onchainos CLI as subprocess. This is the intended design pattern for plugin-to-onchainos communication.
Environment variable access beyond declared env ✅ Clean Only reads HYPERLIQUID_TESTNET for testnet toggle
Build scripts with side effects (build.rs, postinstall) ✅ Clean No build.rs or post-install scripts
Unsafe code blocks (Rust) ✅ Clean No unsafe blocks

Does SKILL.md accurately describe what the source code does?

Yes — The SKILL.md accurately describes the 7 commands, their parameters, the two-step confirm flow, the signing mechanism via onchainos, and the deposit flow. The source code implementation matches the documented behavior. One minor note: SKILL.md mentions --dry-run for the order command but the deposit's dry-run behavior is also correctly documented.

Verdict: ⚠️ Needs Review

Source code is clean and well-structured. The subprocess calls to onchainos are the intended integration pattern. The main concerns are in SKILL.md (curl|sh, base64 telemetry), not in the compiled binary.

7. Code Review

Quality Score: 72/100

Dimension Score Notes
Completeness (pre-flight, commands, error handling) 20/25 Good command coverage with 7 commands. Error handling is thorough with descriptive messages. Pre-flight checks are present but use unsafe patterns (curl|sh).
Clarity (descriptions, no ambiguity) 20/25 SKILL.md is well-structured with clear command documentation, output examples, and trigger phrases. Parameter descriptions are comprehensive.
Security Awareness (confirmations, slippage, limits) 15/25 Good: --confirm gate on all writes, preview mode default, TP/SL validation, slippage tolerance (10%), risk warnings for perpetuals. Bad: curl|sh install, base64 obfuscated telemetry key, binary download without checksum verification.
Skill Routing (defers correctly, no overreach) 12/15 Properly defers to okx-dex-swap for spot swaps, okx-defi-portfolio for portfolio. Does not overreach into other domains.
Formatting (markdown, tables, code blocks) 5/10 Good use of tables and code blocks. Some sections are verbose. The pre-flight section mixes auto-injected boilerplate with plugin-specific content.

Strengths

  • Excellent confirmation flow: All write operations require --confirm, with preview as default — strong protection against accidental execution
  • Proper onchainos integration: All signing and broadcasting goes through onchainos CLI, maintaining the security model
  • Comprehensive validation: TP/SL price validation relative to position direction, size validation, balance checks before deposits

Issues Found

  • 🔴 Critical: TF005 — curl|sh in SKILL.md with financial operations. The pre-flight section includes curl -fsSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh which is in the Agent execution path. For a plugin with financial operations (leveraged trading), this is a critical supply chain risk. The remote script could be modified to inject malicious code.
  • 🔴 Critical: Binary download without checksum verification. The SKILL.md binary install section downloads the hyperliquid binary via curl without any SHA256 checksum verification: curl -fsSL "https://github.com/MigOKG/plugin-store/releases/download/plugins/hyperliquid@0.1.0/hyperliquid-${TARGET}" -o ~/.local/bin/hyperliquid. A MITM attack or repository compromise could serve a malicious binary.
  • 🟡 Important: Base64-obfuscated telemetry key (C03). The SKILL.md telemetry section contains a base64-encoded HMAC key that is decoded at runtime. While not directly executable, this obfuscation pattern makes auditing harder and matches C03.
  • 🟡 Important: Undeclared telemetry endpoints. plugin-store-dun.vercel.app/install and www.okx.com/priapi/v1/wallet/plugins/download/report are not listed in plugin.yaml api_calls. Device fingerprint (hostname hash) is sent to these endpoints.
  • 🟡 Important: Unpinned npm package installs (M01/M02). npx skills add okx/onchainos-skills --yes --global and npx skills add MigOKG/plugin-store --skill plugin-store --yes --global lack version pinning.
  • 🔵 Minor: EIP-712 signing chain mismatch. The onchainos_hl_sign function uses --chain 1 (Ethereum mainnet) for the EIP-712 signing call, while the EIP-712 domain specifies chainId: 1337. This works because onchainos only needs the chain parameter for address resolution, but it's confusing and could break if onchainos adds chain-specific signing validation.
  • 🔵 Minor: Arbitrum RPC hardcoded. ARBITRUM_RPC is hardcoded to https://arbitrum-one-rpc.publicnode.com with no fallback or configurability.
8. Recommendations
  1. [CRITICAL] Replace curl|sh install with checksummed download: Download the install script to a file, verify its SHA256 against a published checksum, then execute. Alternatively, use a package manager with version pinning.

  2. [CRITICAL] Add binary checksum verification: The binary download in SKILL.md must include SHA256 verification against a published checksums file, similar to how the official onchainos skills handle it.

  3. [HIGH] Remove or make telemetry transparent: Either remove the telemetry section entirely, or (a) declare the endpoints in plugin.yaml api_calls, (b) remove the base64-obfuscated HMAC key and use a plaintext approach, (c) clearly document what data is collected and why.

  4. [HIGH] Pin dependency versions: Change npx skills add okx/onchainos-skills --yes --global to npx skills add okx/onchainos-skills@<version> --yes --global for both skills installs.

  5. [MEDIUM] Declare all network endpoints in plugin.yaml: Add plugin-store-dun.vercel.app and www.okx.com/priapi/v1/wallet/plugins/download/report to the api_calls list.

  6. [LOW] Make Arbitrum RPC configurable: Allow users to set a custom RPC via environment variable (e.g., ARBITRUM_RPC_URL).

  7. [LOW] Document the EIP-712 chain parameter choice: Add a code comment explaining why --chain 1 is used for Hyperliquid L1 signing (address resolution only, domain chainId 1337 is in the typed data).

9. Reviewer Summary

One-line verdict: Well-engineered Hyperliquid perpetuals plugin with proper onchainos integration and confirmation gates, but blocked by critical supply chain risks (curl|sh install + unverified binary download) in a high-stakes financial context.

Merge recommendation: 🔍 Needs changes before merge

Items that must be addressed:

  1. Replace curl | sh install pattern with checksum-verified download (TF005 / C01)
  2. Add SHA256 checksum verification for binary download
  3. Remove or de-obfuscate the base64-encoded telemetry HMAC key (C03)
  4. Pin all npx skills add commands to specific versions (M01)
  5. Declare telemetry endpoints in plugin.yaml api_calls (L02)

Generated by Claude AI via Anthropic API — review the full report before approving.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

❌ Phase 1: Structure Validation — FAILED

Linting skills/hyperliquid...

  ⚠️  [W100] suspicious pattern: 'base64' — contains base64 reference — may embed hidden content
  ⚠️  [W100] suspicious pattern: 'curl ' — contains curl command — external network request
  ❌ [E141] SKILL.md instructs AI to send/post data to external URL 'https://plugin-store-dun.vercel.app/install'. This may exfiltrate user data (wallet addresses, balances, etc.).
  ⚠️  [W140] SKILL.md references 3 external URL(s) not listed in api_calls: 'https://plugin-store-dun.vercel.app/install', 'https://www.okx.com/priapi/v1/wallet/plugins/download/report', 'https://app.hyperliquid.xyz**'. Add them to api_calls in plugin.yaml so reviewers can verify them.

✗ Plugin 'hyperliquid': 1 error(s), 3 warning(s)

Fix all errors before submitting. See CONTRIBUTING.md for guidance.

→ Please fix the errors above and push again.

@GeoGu360 GeoGu360 force-pushed the submit/hyperliquid-v2-features branch from 803b7e9 to 0a2ee47 Compare April 8, 2026 17:32
@GeoGu360 GeoGu360 temporarily deployed to summary-generation April 8, 2026 17:32 — with GitHub Actions Inactive
…, add testnet api_calls

- Remove --force from wallet_contract_call: let onchainos handle its own
  confirmation flow; plugin --confirm flag already gates the call
- Fix SKILL.md command numbering: deposit was #8, should be #7
- Add testnet endpoint to plugin.yaml api_calls
- Update plugin.yaml description to reflect v0.2.0 capabilities

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@GeoGu360 GeoGu360 force-pushed the submit/hyperliquid-v2-features branch from 637c31c to c3a7cc2 Compare April 8, 2026 17:36
@GeoGu360 GeoGu360 temporarily deployed to summary-generation April 8, 2026 17:36 — with GitHub Actions Inactive
@GeoGu360 GeoGu360 merged commit 714e6e5 into MigOKG:main Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant