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

# Uniswap Pool State

> Stream Uniswap V3/V4 pool state updates on EVM chains.

> [!NOTE]
>
> **Room ID:** `uniswap_pool_state` \
> **Endpoint:** `wss://staging-api.struct.to/ws`

Live Uniswap V3 and V4 pool state: price, tick, liquidity, token metadata, reserves, and USD values. `protocol` on each update says which version produced it. Solana is not supported. Enabled chains are Ethereum, Base, BNB Chain, Robinhood, and Arc.

## Subscribe

Empty filters or `subscribe_all: true` receive every pool state update. Combined filters are capped at 500.

### Filters

| Filter | Type | Required | Description |
| - | - | - | - |
| `chain` | `string` | No\* | Chain name: `solana`, `bnb`, `base`, `ethereum`, `robinhood`, `arc` |
| `chain_id` | `integer` | No\* | Chain id: `-1`, `56`, `8453`, `1`, `4663`, `5042` |
| `pool_ids` | `string[]` | No | Uniswap V3 pool addresses or V4 pool ids |
| `event_types` | `string[]` | No | `initialize`, `swap`, `modify_liquidity` |
| `subscribe_all` | `boolean` | No | Receive every update |

Provide either `chain` or `chain_id`. Do not send both.

### Example

```json theme={null}
{
  "type": "join_room",
  "payload": {
    "room_id": "uniswap_pool_state"
  }
}
```

```json theme={null}
{
  "type": "room_message",
  "payload": {
    "room_id": "uniswap_pool_state",
    "message": {
      "action": "subscribe",
      "chain": "base",
      "pool_ids": [
        "0xpool"
      ],
      "event_types": [
        "swap"
      ]
    }
  }
}
```

## Events

The room emits `uniswap_pool_state_update`. Pick **Response (Long)** or **Response (Short)** in the right-hand panel. WebSocket defaults to short. See [long and short field names](https://docs.struct.to/api-reference/response-format.md#long-and-short-field-names).

```json Response (Long) theme={null}
{
  "type": "uniswap_pool_state_update",
  "room_id": "uniswap_pool_state",
  "data": {
    "chain_id": 8453,
    "protocol": "UniswapV4",
    "pool": "0x1111111111111111111111111111111111111111111111111111111111111111",
    "event_type": "swap",
    "block_number": 22100000,
    "block_timestamp": 1710000000000,
    "confirmed_at": 1710000000000,
    "sqrt_price_x96": "12345678901234567890",
    "tick": -120,
    "previous_tick": -118,
    "liquidity": "1000000000",
    "tick_crossed": true,
    "currency0": "0x0000000000000000000000000000000000000000",
    "currency1": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "currency0_decimals": 18,
    "currency1_decimals": 6,
    "currency0_price_usd": "2474.05",
    "currency1_price_usd": "1.00",
    "fee": 3000,
    "tick_spacing": 60,
    "hooks": "0x0000000000000000000000000000000000000000",
    "reserve0_raw": "934064700000000000000",
    "reserve1_raw": "2322765870000",
    "reserve0": "934.0647",
    "reserve1": "2322765.87",
    "reserve0_usd": "2310871.22",
    "reserve1_usd": "2322765.87",
    "reserves_usd": "4633637.09",
    "liquidity_delta": "0",
    "tick_lower": -180,
    "tick_upper": 60
  }
}
```

```jsonc Response (Short) theme={null}
{
  "type": "uniswap_pool_state_update",
  "room_id": "uniswap_pool_state",
  "data": {
    "ci": 8453,
    "pr": "UniswapV4",
    "p": "0x1111111111111111111111111111111111111111111111111111111111111111",
    "et": "swap",
    "bn": 22100000,
    "bts": 1710000000000,
    "ca": 1710000000000,
    "sp": "12345678901234567890",
    "tk": -120,
    "pt": -118,
    "lq": "1000000000",
    "xc": true,
    "c0": "0x0000000000000000000000000000000000000000",
    "c1": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "cd0": 18,
    "cd1": 6,
    "p0": "2474.05",
    "p1": "1.00",
    "f": 3000,
    "ts": 60,
    "h": "0x0000000000000000000000000000000000000000",
    "r0r": "934064700000000000000",
    "r1r": "2322765870000",
    "r0": "934.0647",
    "r1": "2322765.87",
    "u0": "2310871.22",
    "u1": "2322765.87",
    "ru": "4633637.09",
    "ld": "0",
    "tl": -180,
    "tu": 60
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.