> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notional.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Products and Asset IDs

An AssetId is Notional's code for a specific asset or market. Clients use Notional AssetIds even
when an order is executed through Hyperliquid or Polymarket.

## Encoding

Every AssetId starts with a four-character type prefix. The characters after that prefix identify
the specific market or asset.

In the formulas below, `hex(value, width)` means converting `value` to lowercase hexadecimal and
adding leading zeroes until the result contains `width` characters.

The examples below use the unprefixed format accepted by order actions and returned by market
metadata. Protocol-transfer endpoints use the same bytes with a `0x` prefix.

### Hyperliquid Perpetuals

For a perpetual in Hyperliquid's default `meta.universe`, use the market's array index.

```text theme={null}
AssetId = "0002" + hex(metaIndex, 4)
```

The `0002` prefix identifies a Hyperliquid perpetual in the default perp universe. It does not apply
to HIP-3 markets. Index `0` produces `00020000`, index `1` produces `00020001`, and index `7`
produces `00020007`.

### Hyperliquid HIP-3 Perpetuals

First calculate Hyperliquid's HIP-3 venue index, then encode it as a six-byte integer.

```text theme={null}
venueIndex = 100000 + dexIndex * 10000 + indexInDex
AssetId    = "0005" + hex(venueIndex, 12)
```

For example, `dexIndex = 188` and `indexInDex = 0` produce venue index `1980000` and AssetId
`00050000001e3660`.

### Hyperliquid Spot Tokens

Use the token's `index` in Hyperliquid's `spotMeta.tokens` with Notional's `10000` offset.

```text theme={null}
AssetId = "0001" + hex(10000 + tokenIndex, 4)
```

The `0001` prefix identifies a Hyperliquid spot token. For example, token index `0` produces
`00012710`.

### Hyperliquid Spot Pairs

Use the pair's `index` in Hyperliquid's `spotMeta.universe`.

```text theme={null}
AssetId = "0003" + hex(pairIndex, 4)
```

The `0003` prefix identifies a Hyperliquid spot pair. For example, spot-pair index `1` produces
`00030001`.

### Hyperliquid Outcomes

Each outcome side is derived from its outcome ID and side index. Side index `0` is Yes and side
index `1` is No.

```text theme={null}
hlEncoding = 100000000 + outcomeId * 10 + sideIndex
AssetId    = "0004" + hex(hlEncoding, 12)
```

For example, outcome `10218`, side `0`, produces `hlEncoding = 100102180` and AssetId
`0004000005f77024`.

### Polymarket Outcomes

Given a decimal Polymarket token ID, encode it as a 32-byte integer after the `1001` type prefix:

```text theme={null}
AssetId = "1001" + hex(tokenId, 64)
```

The equivalent JavaScript is:

```javascript theme={null}
const assetId = `1001${BigInt(tokenId).toString(16).padStart(64, "0")}`;
```

Use a decimal token ID with no sign, whitespace, or leading zeroes.

### Polygon and HyperEVM Assets

EVM AssetIds contain a four-character chain prefix, a two-character asset kind, and a 40-character
locator.

```text theme={null}
AssetId = chainPrefix + assetKind + locator
```

* Polygon uses chain type `8001`; HyperEVM uses `8002`.
* Native assets use kind `00` and a locator of 20 zero bytes.
* ERC-20 assets use kind `01` and the contract address, without `0x`, as the locator.
