CtrlK
BlogDocsLog inGet started
Tessl Logo

1k-perps-module

OneKey Perps/Hyperliquid development for views/Perp, orders, orderbook, charts, Relay deposits, positions, funding, margin, and liquidation. Excludes generic Swap/Market work.

72

Quality

91%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Medium

Suggest reviewing before use

SKILL.md
Quality
Evals
Security

Perps / Hyperliquid Domain Guide

Use this as a Perps/Hyperliquid domain router for order semantics, realtime subscriptions, and UI/background state races. Choose the owner and proof path; verify anchors with rg before editing.

60-Second Triage

  1. Gate: use only when OneKey Perps/Hyperliquid is explicit in the prompt or file path.
  2. Infer scope: asset type (perp/spot), account/dex, order mode, and platform. Ask only if missing scope blocks correctness or creates trading risk.
  3. Pick owner from the matrix; avoid downstream display shims for trading/realtime contracts.
  4. Load minimum refs: one matching reference first; add code-map.md / validation-recipes.md only for owner/proof/implementation.

Trigger Boundary

Prompt/file signalUse this skill?First move
views/Perp, ServiceHyperLiquid, Hyperliquid, Perps/永续/合约 tradingYesPick owner below, then one reference
Generic Market K-line, generic TradingView bridge, generic token selectorNoUse adjacent Market/TradingView/token-selector skill or repo search
Generic Swap Relay quote/status/pending/requestIdNoUse $1k-trade-swap-market unless Perps deposit is explicit
Perps deposit, usePerpDeposit, fetchPerpDeposit*, perpsDepositOrderAtom, perp-deposit endpointYesOpen deposit-relay.md

If Perps/Hyperliquid is only a guess, do not load all references; verify the file/surface with rg or use the adjacent skill.

Owner Matrix

SurfacePrimary ownerUsual proof
Order submit/cancel/TWAP/scale/TIFServiceHyperliquidExchange.ts, Hyperliquid actions.ts, shared Perps utils/typesSDK type/source check + targeted order utility/action tests
L2/BBO/orderbook subscriptionsServiceHyperliquidSubscription.ts, Hyperliquid context actions, freshness utilsrapid switch/reconnect + L2/BBO freshness proof
Deposit quote/statuspackages/kit-bg/src/services/ServiceSwap.ts, perpsDepositOrderAtomactive fromTxId; requestId only when backend/Relay exposes it
Positions/account state/funding/margin/liquidationServiceHyperliquid.ts, Hyperliquid context atoms/actions, account-scoped Perps hooks/utilsaccount/dex/asset scoped proof; no stale positions/account summary
Perps TradingView/K-line/chart linespackages/kit/src/components/TradingView/TradingViewPerpsV2/TradingViewPerpsV2.tsxreadiness/message/reconnect scenarios
UI-only displayPerps component/list/row filesdisplay proof only; do not mutate trading contracts here

Quick Reference

TopicGuideStart With
Code mapcode-map.mdviews/Perp, Hyperliquid context, BG service, shared types/utils
Order contractsorder-contracts.mdTWAP, scale, TIF, trigger, reduce-only, precision
State and subscriptionsstate-subscriptions.mdaccount/dex/asset scoping, L2/BBO, active target, cleanup
Perps TradingView bridgetradingview-bridge.mdTradingViewPerpsV2, Perps K-line readiness, chart lines
Relay depositdeposit-relay.mdPerps deposit address flow, requestId tracking, pending cards
Positions/account statepositions-account-state.mdpositions, balances, PnL/PNL/P&L, funding, margin, liquidation
Failure patternsfailure-patterns.mdrecurring bugs and hard-to-see regressions
Validation recipesvalidation-recipes.mdtargeted tests and runtime paths
Review checklistreview-checklist.mdPR/source checks and release risk gates
Source indexsource-index.mdvolatile SDK/API/docs/vault lookup points

Agent Routing Examples

User asks aboutLoad firstThen verify
"TWAP cancel/list/history is wrong"order contracts + code mapTWAP state/cancel/history recipes
"Scale order children/precision/TIF"order contractsscale utility tests + partial-failure runtime path
"Orderbook flashes old BTC after ETH switch"state/subscriptions + code maprapid asset/account switch; L2/BBO freshness
"Perps K-line blank after offline/reconnect"TradingView bridgeready-state/reconnect scenarios, native if touched
"Perps deposit pending/completed wrong"Relay depositactive tx/request scope and stale quote cases
"Perps positions/PnL/funding/margin/liquidation/account summary stale"positions/account stateaccount/dex/asset scope; no stale position/account display
"Review a Perps PR"changed-surface reference first; review checklist seconduse failure patterns to challenge findings and validation gaps

Output Defaults

  • Implementation: report surface, state owner, order/subscription contract touched, files changed, targeted validation, and runtime proof gaps.
  • Review: lead with findings; separate correctness blockers, release blockers, and follow-up improvements.
  • Research: distinguish stable module rules from volatile backend/API/business facts that must be rechecked.

Hard Stops

  • Do not log private keys, signatures, mnemonics, raw sensitive payloads, or user secrets while debugging Perps.
  • Do not bypass enable-trading, account bind, signing, or risk validation just to make a UI submit succeed.
  • Do not use production live order placement/cancel/withdraw/deposit as validation unless the user explicitly authorizes that exact action and account.
  • Do not change the owner of truth through a downstream display shim; edit the owner itself.
  • Do not use ticker/mid recovery as proof that orderbook, token selector, or TradingView recovered — verify each surface's own freshness/readiness.
  • Do not leave old L2/BBO/orderbook/chart-line data visible after an asset/account/dex switch.
  • Do not couple K-line WebView recovery to global WS recovery.
  • Do not trust Relay deposit status by deposit address alone when a request/requestId scope exists.

Verify Against the Source

Order semantics, TIF, TWAP, scale, trigger, and reduce-only are volatile, SDK-versioned contract facts — confirm them against the source, do not trust memory:

  • SDK types (type-enforced, in repo): the action method files under node_modules/@nktkas/hyperliquid/src/api/exchange/_methods/.
  • Official docs: https://hyperliquid.gitbook.io/hyperliquid-docs (API → Exchange endpoint).
  • Recheck on every @nktkas/hyperliquid bump; new fields/TIF values (e.g. FrontendMarket) appear over time.

Related Skills

  • $1k-tradingview-communication - TradingView message contracts and iframe bridge.
  • $1k-state-management - Jotai atom/context conventions.
  • $1k-performance - Render, subscription, and hot-path performance.
  • $1k-trade-swap-market - Adjacent trade/review/history patterns; do not copy swap provider semantics blindly.
  • $1k-cross-platform - Platform-specific RN/Web/Desktop behavior.
  • $1k-analytics - Perps analytics/logging changes.
Repository
OneKeyHQ/app-monorepo
Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.