# HIP-4 Outcome Markets

HIP-4 adds outcome markets to HyperCore. Dwellir's Hyperliquid Index exposes outcome metadata, lifecycle events, and outcome-side fills through the same REST-style `/info` and JSON-RPC surfaces used by indexed fills and candles.

Use these methods when you need to discover active outcomes, backfill registration and settlement history, or retrieve fills for outcome instruments such as `#30` and `#31`.

## Endpoints

REST-style Info API:

```text
POST https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/info
```

JSON-RPC:

```text
POST https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/jsonrpc
```

For `/info`, set `type` to the method name. For JSON-RPC, set `method` to the same value and pass request fields under `params`.

## Outcome Asset IDs

HIP-4 outcome sides are encoded as `#<encoding>` coins:

| Value       | Meaning                                            |
| ----------- | -------------------------------------------------- |
| `outcomeId` | Numeric outcome ID assigned in registration order. |
| `side`      | `yes`, `no`, `0`, or `1`.                          |
| `Yes` coin  | `#(10 * outcomeId)`.                               |
| `No` coin   | `#(10 * outcomeId + 1)`.                           |

For outcome ID `3`, the Yes side is `#30` and the No side is `#31`.

## Methods

| Method                                                                                                        | Use case                                                       |
| ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| [`outcomeMeta`](https://www.dwellir.com/docs/hyperliquid/hyperliquid-index/outcome-markets/outcome-meta)                             | Current active outcome metadata and `sideSpecs`.               |
| [`outcomeFills`](https://www.dwellir.com/docs/hyperliquid/hyperliquid-index/outcome-markets/outcome-fills)                           | Recent fills for all outcome coins or one outcome side.        |
| [`outcomeFillsByTime`](https://www.dwellir.com/docs/hyperliquid/hyperliquid-index/outcome-markets/outcome-fills-by-time)             | Outcome fills inside a bounded time window.                    |
| [`registeredOutcomes`](https://www.dwellir.com/docs/hyperliquid/hyperliquid-index/outcome-markets/registered-outcomes)               | Recent registered outcomes that have not settled yet.          |
| [`registeredOutcomesByTime`](https://www.dwellir.com/docs/hyperliquid/hyperliquid-index/outcome-markets/registered-outcomes-by-time) | Registered outcomes inside a bounded registration-time window. |
| [`registeredOutcomesById`](https://www.dwellir.com/docs/hyperliquid/hyperliquid-index/outcome-markets/registered-outcomes-by-id)     | Registered outcomes by `outcome_ids` or `asset_ids`.           |
| [`settledOutcomes`](https://www.dwellir.com/docs/hyperliquid/hyperliquid-index/outcome-markets/settled-outcomes)                     | Recent settled outcomes.                                       |
| [`settledOutcomesByTime`](https://www.dwellir.com/docs/hyperliquid/hyperliquid-index/outcome-markets/settled-outcomes-by-time)       | Settled outcomes inside a bounded settlement-time window.      |
| [`settledOutcomesById`](https://www.dwellir.com/docs/hyperliquid/hyperliquid-index/outcome-markets/settled-outcomes-by-id)           | Settled outcomes by `outcome_ids` or `asset_ids`.              |

## Billing

Outcome fill and outcome lifecycle list responses are billed by returned objects through `X-Iris-Billing-Weight`.

| Method family                             | Billing weight                                                        |
| ----------------------------------------- | --------------------------------------------------------------------- |
| `outcomeFills`, `outcomeFillsByTime`      | Number of returned fill objects.                                      |
| `registeredOutcomes*`, `settledOutcomes*` | Number of returned outcome objects.                                   |
| `outcomeMeta`                             | Regular single metadata response; no bundled-response billing header. |

Empty arrays return billing weight `0`. Error responses are not charged.

## Pagination

By-time methods page oldest to newest:

| Method family              | Cursor format    | Sort key                                  |
| -------------------------- | ---------------- | ----------------------------------------- |
| `outcomeFillsByTime`       | `time_txIndex`   | Fill timestamp, then fill `txIndex`.      |
| `registeredOutcomesByTime` | `time_outcomeId` | Registration event time, then outcome ID. |
| `settledOutcomesByTime`    | `time_outcomeId` | Settlement event time, then outcome ID.   |

When `cursor` is supplied, the service resumes after the cursor and ignores `startTime`. Keep the same `endTime` across pages for a stable window.

## Indexing Model

Dwellir derives these endpoints from Hyperliquid L1 data and stores the customer-facing records needed for serving queries:

- outcome registration and settlement events
- current `outcomeMeta` snapshots for metadata and `sideSpecs`
- outcome-side fills from the indexed fill stream

You do not need to parse raw `replica_cmds` to use these HIP-4 query methods. Dwellir indexes the required L1 data and serves outcome market records directly. Use the [L1 gRPC Streaming API](https://www.dwellir.com/docs/hyperliquid/grpc) only when your application needs raw live block payloads.
