Documentation Index
Fetch the complete documentation index at: https://docs.outcome.xyz/llms.txt
Use this file to discover all available pages before exploring further.
@outcome.xyz/hip4 — a modular stack of HIP-4 & its financial primitives.
Key features
Market discovery
Fetch and filter prediction markets by type (
defaultBinding, labelledBinding, priceBucket), category, or status. Paginate results and group by type or parent question.Real-time data
Subscribe to live order books, mid prices, and trade streams via WebSocket. The SDK handles connection management and auto-reconnect with exponential backoff.
Order trading
Place limit and market orders with tick-aligned pricing, min-notional validation, and optional builder fee configuration. Cancel resting orders by ID.
Fund management
Deposit USDC to your prediction account, buy USDH, and withdraw funds back to your wallet. Uses EIP-712 signing for transfers and L1 agent signing for spot trades.
Architecture
The SDK is organized around a singleHIP4Client that handles HTTP routing, 5xx retry logic, and WebSocket connection management. Six sub-adapters wrap that client and expose domain-specific methods:
| Adapter | Property | Responsibility |
|---|---|---|
HIP4EventAdapter | hip4.events | Market discovery and event listing |
HIP4MarketDataAdapter | hip4.marketData | Order books, prices, trades, candles |
HIP4AccountAdapter | hip4.account | Positions, balances, open orders |
HIP4TradingAdapter | hip4.trading | Place and cancel orders |
HIP4Auth | hip4.auth | Agent key approval and auth state |
HIP4WalletAdapter | hip4.wallet | USDH deposits, withdrawals, transfers |
createHIP4Adapter() and call initialize() once to warm up the event cache. After that, all sub-adapters are accessible as properties on the returned object.
The SDK has zero runtime dependencies. All signing - including L1 agent signing (MessagePack + keccak-256 + EIP-712) and user-signed EIP-712 operations - is implemented from scratch in TypeScript with no third-party libraries.
Both testnet and mainnet are supported. Pass
{ testnet: true } (the default) to target the Hyperliquid testnet, or { testnet: false } for mainnet. The SDK automatically routes REST and WebSocket connections to the correct endpoints.