Skip to main content
@outcome.xyz/hip4 — a modular stack of HIP-4 & its financial primitives.
HIP-4 SDK stack: outcome.xyz consumes the SDK, which composes six sub-adapters atop a single HIP-4 client

Key features

Market discovery

Fetch prediction markets and filter them by type (defaultBinary, labelledBinary, multiOutcome, priceBucket). Sort, paginate, or group results 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.

Architecture

The SDK is organized around a single HIP4Client that handles HTTP routing, retries info requests once on 5xx and network errors, and manages the WebSocket connection. Six sub-adapters wrap that client and expose domain-specific methods: The adapter also exposes hip4.client for raw Hyperliquid API calls and an experimental hip4.deployer for registering and settling markets. You create the adapter with createHIP4Adapter() and call initialize() once. It loads the side names that prices and positions use. All sub-adapters are 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 mainnet and testnet are supported. The SDK targets the Hyperliquid testnet by default (testnet: true). Pass { testnet: false } to target mainnet. The SDK routes REST and WebSocket connections to the matching endpoints.