adapter.events) is your entry point for discovering what is tradeable on HIP-4. It maps raw Hyperliquid outcome metadata into structured PredictionEvent objects, with live midpoint prices on each outcome, and into typed HIP4Market objects. Results are cached for 30 seconds, so repeated calls within that window return immediately without hitting the API.
fetchEvents(params?)
Returns a paginated, optionally filtered list of prediction events. Internally, the adapter fetches outcomeMeta and allMids in parallel, builds events from the metadata, and enriches outcome prices from the mids response.
Parameters
string
Filter events by category slug. Pass
"custom" or "recurring". Passing
"all" is treated as no filter.boolean
When
true, only events with status === "active" are returned.number
default:"50"
Maximum number of events to return.
number
default:"0"
Pagination offset. Applied after category, active, and query filters.
string
Case-insensitive search string matched against event
title and
description.Return type
Promise<PredictionEvent[]>
string
required
Event identifier. Prefix
q for question-based events (e.g. "q5"); prefix
o for standalone outcome events (e.g. "o1338").string
required
Event title, as Hyperliquid sends it (e.g.
"template:priceTouch" for a template event). Recurring events get a label such as "BTC > $69070 (1d)".string
Readable event title. Template events are rendered from Hyperliquid’s template registry, as in
fetchMarkets; other events repeat title. Available from 1.3.0.string
required
Event description text.
string
required
Category slug:
"custom" or "recurring".PredictionMarket[]
required
Markets belonging to this event. Each market corresponds to one HIP-4 outcome. A market’s
question and its outcomes[].name are the names Hyperliquid sends. parsedQuestion and outcomes[].parsedName carry the readable ones, available from 1.3.0.string
required
"active" | "pending_resolution" | "resolved" | "cancelled". The HIP-4
adapter currently sets only "active" and "resolved": a question event is
"resolved" once all its named outcomes have settled, and standalone outcome
events are always "active".string
required
Expiry date string. Populated for recurring markets; empty string otherwise.
string
required
Cumulative volume across all markets. Always
"0" in the current
implementation.Example
fetchEvent(eventId)
Fetches a single event by its ID. Loads the full event list via the cache and finds the match. Throws if the event is not found.
Parameters
string
required
The event ID to look up. Use
q{n} for question-based events or o{n} for
standalone outcome events.Return type
Promise<PredictionEvent> - same shape as each element returned by fetchEvents.
Throws "HIP-4 event not found: {eventId}" if the ID does not match any event.
Example
fetchCategories()
Returns the list of available event categories. This call is synchronous under the hood - no API request is made.
Return type
Promise<PredictionCategory[]>
The response always contains exactly two entries:
Example
fetchMarkets(params?)
Returns typed HIP4Market objects for all HIP-4 outcomes. Each market is classified into one of four types based on the outcome’s metadata, and carries pre-computed side coin identifiers ready for order placement.
name, sides[].name, and questionName are the names Hyperliquid sends, so a template market reads "template:priceTouch". The readable names, rendered from Hyperliquid’s template registry (outcomeTemplates), are in parsedName, sides[].parsedName, and parsedQuestionName: "BTC touches 90000 by Nov 1, 00:00 UTC". A template question’s fallback outcome has the parsedName "Other", and markets that aren’t templates repeat their names. If the registry can’t be fetched, the parsed fields keep the wire names, except that the template: prefix is removed from plain names such as "template:Yes". The parsed fields are available from 1.3.0.
Refreshing the market or event cache, and initialize(), make one outcomeTemplates request, cached for 30 seconds.
The return type changes depending on whether you pass groupBy:
groupBy, TypeScript types the result as a union. Cast it to the shape you asked for, as in the examples below.
Parameters
string
Filter to a single market type. One of
"defaultBinary", "labelledBinary",
"multiOutcome", "priceBucket".string
Sort order.
"newest" puts the highest outcome ID first. "expiry" puts the
soonest event time first, with markets that have none last. "volume" puts
the highest 24h volume first and costs one extra request. When omitted, results
stay in catalog order (the order of Hyperliquid’s outcomeMeta). Takes effect
from 1.3.0-beta.0; earlier versions ignore it.string
Group the results.
"type" returns a MarketsByType object keyed by market
type. "question" returns a MarketsByQuestion object keyed by question ID
for multiOutcome markets. Every other market, including priceBucket
markets, goes under the "standalone" key.number
Maximum number of markets to return (applied after filtering and sorting). When omitted,
every matching market is returned. Ignored when
groupBy is set.number
default:"0"
Pagination offset. Ignored when
groupBy is set.Market types
All four types extend a sharedBaseMarket with these fields:
Each
MarketSide exposes:
multiOutcome and priceBucket markets also carry questionName, the parent question’s name as Hyperliquid sends it, and parsedQuestionName, its readable name (available from 1.3.0).
Examples
When you use
groupBy, limit and offset are ignored: the grouped object
contains every market that matches type. Pagination applies only to the flat
list.