Trade and deploy on HyperCore with “hypercore”
ctx.hypercore lets a task read from and act on HyperCore, the native Hyperliquid exchange:
place and cancel orders, move funds, stake, manage subaccounts and vaults, operate HIP-3 perp
markets, and deploy and settle HIP-4 outcome markets.
HyperCore is not an EVM chain. Actions are signed payloads posted to Hyperliquid’s exchange
endpoint, not transactions. HyperEVM, the EVM chain that runs alongside it, is served by
ctx.evm like any other chain — use ctx.hypercore for the
exchange itself and ctx.evm for contracts on HyperEVM.
Wallets come from ctx.evm.wallet: Hyperliquid accounts are
ordinary Ethereum keypairs, so the same wallet object signs both.
Every call names its network
The first argument of every method is"mainnet" or "testnet". There is no default and no
app-level setting, for the same reason ctx.evm makes you pass a
chain: a forgotten argument must be a type error, never a silent mainnet action.
Field order is handled for you
A HyperCore action is hashed with its fields in a canonical order. Get that order wrong and the signature recovers a different address, so the exchange rejects the action with a confusingUser or API Wallet 0x... does not exist error.
Compose canonicalizes every known action against Hyperliquid’s own schemas before signing, so this
class of failure cannot reach the wire — including actions you build by hand and pass to
exchange. An action type Compose does not recognize (a brand new one, for example) is sent
through unchanged with a warning in your logs, and then field order is yours to get right.
Namespaces
params matches Hyperliquid’s action fields for that action. Method names follow Hyperliquid’s
own names, except where those names are opaque: stake.deposit is cDeposit, stake.withdraw
is cWithdraw, stake.delegate is tokenDelegate, and transfer.withdraw is withdraw3. Each
method’s doc comment records the raw action name so you can cross-reference the Hyperliquid docs.
Options
vaultAddress is only valid for order-book style actions. Fund actions
(transfer, stake, agent) use Hyperliquid’s user-signed scheme, which has no vault field, and
passing one throws.
Reads
info is a plain read against Hyperliquid’s info endpoint. The common queries have typed helpers,
and the generic form covers everything else:
How actions are signed
Hyperliquid has two signing schemes and Compose picks the right one per action:- L1 actions (orders, cancels, deployer actions) are msgpack-hashed and signed inside an EIP-712 envelope.
- User-signed actions (transfers, staking, agent approval) are signed as per-action EIP-712 typed data.
Retries and duplicate actions
Exchange actions are mutations: by default they are attempted once, and a task retry replays the recorded result rather than sending a second action. HyperCore nonces are single-use, which Compose leans on for the ambiguous case where an action was submitted but the result never came back. A replay re-submits the identical signed action, the exchange rejects the reused nonce, and Compose reports that as success:info if you need the original response.
Nonces are timestamps and must fall within roughly two days of now. A run resumed after that
window fails with a stale-nonce error rather than silently re-executing an action that may
already have landed.
Rate limits
Hyperliquid limits actions per address, roughly one action per 1 USDC of cumulative traded volume, after an initial allowance. Reads are limited per IP. An app that submits actions far faster than it trades will eventually be throttled by the exchange; see Hyperliquid’s rate limit documentation.HIP-3: builder-deployed perp markets
perpDeploy operates a perp DEX you have deployed. The deployer supplies the oracle, and
Hyperliquid expects a price roughly every three seconds:
HIP-4: outcome markets
outcome deploys and settles HIP-4 outcome markets. Markets are instantiated from templates that
validators have approved, so you fill in a template’s keywords rather than defining an arbitrary
market:
outcomeMeta reports it, so store
it when you deploy:
Outcome token side index
0 is the Yes side: it maps to sideSpecs[0]. Deploying and
settling outcomes requires an activated outcome deployer, which has a staking requirement, and
testnet caps how many outcomes a deployer can have open and deploy per day.Raw actions
Anything without a helper goes throughexchange, which signs, canonicalizes, and submits any
action: