> ## 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.

# Locks

> Stream real-time liquidity and token supply lock events.

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

Live lock events for tokens and pools: locks created, extended, transferred, split, withdrawn, claimed and unlocked, across chains on one connection. Covers token supply locks and liquidity locks (LP tokens, position NFTs and launchpad custody).

Subscribe with `targets`. Each target names a chain plus exactly one of `token_address` or `pool_id`:

| Target | Receives |
| - | - |
| `{ chain, token_address }` | Locks of the token's supply, plus liquidity locks in every pool that trades the token |
| `{ chain, pool_id }` | Liquidity locks of that pool (LP tokens, position NFTs, launchpad custody) |

Per connection you can follow **50** targets; extras come back in `rejected`. An event that matches several targets arrives once.

Only new events are streamed: they are delivered as they happen on-chain, and past events are not replayed when you subscribe.

## Subscribe

Every action is answered with `lock_stream_subscribe_response`: your full normalized `targets` (both `chain` and `chain_id`, EVM addresses lowercased), `events` and `rejected` entries with a reason.

### Filters

| Filter | Type | Required | Description |
| - | - | - | - |
| `action` | `string` | Yes | `subscribe` replaces targets and `events`; `add` / `remove` change targets only; `unsubscribe_all` clears everything |
| `targets` | `LockTarget[]` | Yes\* | Required for `subscribe`, `add` and `remove`. Up to 50 per connection |
| `targets[].chain` | `string` | Yes\* | Chain name: `solana`, `bnb`, `base`, `ethereum`, `robinhood`, `arc`. Provide this or `chain_id` |
| `targets[].chain_id` | `integer` | Yes\* | Chain id: `-1`, `56`, `8453`, `1`, `4663`, `5042`. Provide this or `chain` |
| `targets[].token_address` | `string` | Yes\* | Token address. Provide this or `pool_id`, not both |
| `targets[].pool_id` | `string` | Yes\* | Pool or pair address. Provide this or `token_address`, not both |
| `events` | `string[]` | No | `created`, `extended`, `transferred`, `split`, `withdrawn`, `claimed`, `unlocked`. Missing or empty = all events. Unknown values come back in `rejected`. Set on `subscribe` |

### Example

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

```json theme={null}
{
  "type": "room_message",
  "payload": {
    "room_id": "locks",
    "message": {
      "action": "subscribe",
      "targets": [
        {
          "chain": "solana",
          "token_address": "7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr"
        },
        {
          "chain_id": 4663,
          "pool_id": "0x543292e1257a838fa3bc88a69c6f0d2ea34b572ef2f23d84ff80882aa3fbeecd"
        }
      ],
      "events": [
        "created",
        "extended",
        "withdrawn"
      ]
    }
  }
}
```

### Response

```json theme={null}
{
  "type": "lock_stream_subscribe_response",
  "room_id": "locks",
  "data": {
    "targets": [
      {
        "chain": "solana",
        "chain_id": -1,
        "token_address": "7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr"
      },
      {
        "chain": "robinhood",
        "chain_id": 4663,
        "pool_id": "0x543292e1257a838fa3bc88a69c6f0d2ea34b572ef2f23d84ff80882aa3fbeecd"
      }
    ],
    "events": [
      "created",
      "extended",
      "withdrawn"
    ],
    "rejected": [
      {
        "value": {
          "chain": "solana",
          "pool_id": "not-an-address"
        },
        "reason": "invalid pool_id: not-an-address"
      }
    ]
  }
}
```

## Events

Each lock event arrives as `lock_event`. `data` is the event plus `lock`, the lock's state right after the event, when available. Keys follow the connection's field mode (long shown; WebSocket defaults to short). See [long and short field names](https://docs.struct.to/api-reference/response-format.md#long-and-short-field-names).

Liquidity locks have the same shape with `pool_id` set and `position.type` set to `lp_token`, `position_nft` or `direct_position` (with `venue`, e.g. `v2`, `v3`, `v4`).

```json Response (Long) theme={null}
{
  "type": "lock_event",
  "room_id": "locks",
  "data": {
    "id": "-1:5h3k...:2:0",
    "chain_id": -1,
    "hash": "5h3kXq9...signature",
    "block": 457336048,
    "confirmed_at": 1792094588000,
    "event": "created",
    "locker": {
      "id": "streamflow",
      "address": "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m",
      "name": "Streamflow",
      "kind": "timed",
      "logo": "https://struct-images.fra1.digitaloceanspaces.com/lockers/streamflow.webp"
    },
    "lock_id": "9xQe...contract",
    "position": {
      "type": "token"
    },
    "token_address": "7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr",
    "amount": 25000000.0,
    "amount_raw": "25000000000000",
    "share_percent": 2.5,
    "owner": "8sLb...owner",
    "from": "8sLb...owner",
    "to": "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m",
    "unlock_at": 1823630588000,
    "lock": {
      "chain_id": -1,
      "token_address": "7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr",
      "locker": {
        "id": "streamflow",
        "address": "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m",
        "name": "Streamflow",
        "kind": "timed"
      },
      "lock_id": "9xQe...contract",
      "owner": "8sLb...owner",
      "position": {
        "type": "token"
      },
      "amount": 25000000.0,
      "amount_raw": "25000000000000",
      "share_percent": 2.5,
      "locked_percent": 2.5,
      "claimable_percent": 0.0,
      "status": "locked",
      "unlock_at": 1823630588000,
      "url": "https://app.streamflow.finance/contract/solana/mainnet/9xQe...contract",
      "created_at": 1792094588000,
      "updated_at": 1792094588000
    }
  }
}
```

### Event fields

| Field | Type | Description |
| - | - | - |
| `id` | `string` | Opaque, stable event id |
| `chain_id` | `integer` | Chain of the event (`-1` Solana, `4663` Robinhood, ...) |
| `hash` | `string` | Transaction hash or signature. Absent for time-based `unlocked` events, which have no transaction |
| `block` | `integer` | Block or slot |
| `confirmed_at` | `integer` | Block time in ms; for time-based unlocks, the unlock time |
| `event` | `string` | `created`, `extended`, `transferred`, `split`, `withdrawn`, `claimed` or `unlocked` |
| `locker` | `object` | The locker contract (see below) |
| `lock_id` | `string` | The locker's lock, deposit or vesting id |
| `position` | `object` | What the lock holds (see below) |
| `token_address` | `string` | The locked token (supply locks), or the pool's LP token for fungible LP locks |
| `pool_id` | `string` | The pool whose liquidity is locked (liquidity locks only) |
| `amount` | `number` | Amount moved, scaled by the token's decimals when known |
| `amount_raw` | `string` | Amount moved, raw integer units |
| `share_percent` | `number` | Share of the pool or supply moved (0-100) |
| `owner` | `string` | The lock's owner at this event |
| `from` | `string` | Movement source: the owner (`created`), the previous owner (`transferred`) or the locker (`withdrawn` / `claimed`). Absent for `extended`, `split` and `unlocked` |
| `to` | `string` | Movement target: the locker (`created`), the new owner (`transferred`) or the recipient (`withdrawn` / `claimed`) |
| `unlock_at` | `integer` | Unlock time in ms |
| `lock` | `object` | The lock's state right after the event, when available (see below) |

### `locker`

| Field | Type | Description |
| - | - | - |
| `id` | `string` | Locker slug, e.g. `uncx`, `goplus`, `streamflow`, or a launchpad |
| `address` | `string` | Locker contract address |
| `name` | `string` | Display name, e.g. `UNCX Network`, `Streamflow` |
| `kind` | `string` | `timed`, `vesting`, `permanent` or `custodial` |
| `logo` | `string` | Locker logo URL, when available |

### `position`

| Field | Type | Description |
| - | - | - |
| `type` | `string` | `token`, `lp_token`, `position_nft` or `direct_position` |
| `venue` | `string` | Pool venue for liquidity positions (`v2`, `v3`, `v4`, `clmm`, ...) |
| `position_id` | `string` | Position NFT id (EVM) or position mint (Solana) |

### `lock`

| Field | Type | Description |
| - | - | - |
| `chain_id` | `integer` | Chain of the lock |
| `token_address` | `string` | The locked token, or the pool's LP token for fungible LP locks; absent for position NFTs |
| `pool_id` | `string` | The pool whose liquidity is locked (liquidity locks only) |
| `locker` | `object` | The locker contract (same shape as above) |
| `lock_id` | `string` | The locker's lock, deposit or vesting id |
| `owner` | `string` | Who can withdraw (owner or beneficiary). Absent for custodial lockers |
| `position` | `object` | What the lock holds (same shape as above) |
| `amount` | `number` | Amount still locked, scaled by the token's decimals when known |
| `amount_raw` | `string` | Amount still locked, raw integer units |
| `share_percent` | `number` | Share of the pool or supply held by this lock (0-100) |
| `locked_percent` | `number` | Share still locked |
| `claimable_percent` | `number` | Share released and withdrawable |
| `status` | `string` | `locked`, `partially_unlocked`, `unlocked`, `withdrawn` or `permanent` |
| `unlock_at` | `integer` | First release in ms; absent when the lock never unlocks |
| `vesting` | `object` | Vesting terms, for vesting locks: `start_at`, `end_at`, `next_step_at` (ms), `cycle_seconds`, `cycle_percent`, `first_unlock_percent`, `claimed_amount`, `claimed_amount_raw` |
| `url` | `string` | The locker's page for this lock |
| `created_at` | `integer` | When the lock was created (ms), when known |
| `updated_at` | `integer` | Last change (ms) |

### Delivery

* Events are delivered as they happen on-chain. Past events are not replayed on subscribe.
* An event that matches several of your targets is delivered once per connection.
* Time-based `unlocked` events have no transaction, so they carry no `hash`; `confirmed_at` is the unlock time.


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