<!-- Generated from the function registry (sdk/src/functions) by `cd sdk && npm run gen`. Do not edit. -->

# Events and feeds

> **Status:** Current (generated)

Contract events, the live DAG and executed commits: by cursor (long-polling) or as Server-Sent Events.

| Function | Kind | Description |
|---|---|---|
| [`events.poll`](#eventspoll) | read | Recent contract events by cursor, filtered by contract, event and address; with wait_ms, long-polls for new ones (subscriptions without a socket) |
| [`events.stream`](#eventsstream) | stream | Contract events as they execute (Server-Sent Events), with the same filters as events.poll |
| [`events.dag_poll`](#eventsdag_poll) | read | The live DAG feed by cursor: blocks this validator sees, commits it decides, leaders excluded by reputation (default: the latest 500) |
| [`events.dag_stream`](#eventsdag_stream) | stream | The live DAG as Server-Sent Events |
| [`events.commits`](#eventscommits) | read | Recently executed commits with their transactions (signed bytes), receipts and drops, by cursor: what indexers follow |

## events.poll

Recent contract events by cursor, filtered by contract, event and address; with wait_ms, long-polls for new ones (subscriptions without a socket).

- **Kind:** read
- **Runs:** JSON-RPC `mox_events` (`POST /`) on the gateway

**Input**

| Field | Type | Required | Description |
|---|---|---|---|
| `from` | integer |  | Cursor: the first event to return (default: the latest) |
| `limit` | integer |  | Most to return |
| `wait_ms` | integer |  | Long-poll: wait up to this long for new ones (≤ 30000) |
| `contract` | hex32 |  | Only events of this contract: 32 bytes, 0x hex |
| `topic` | string |  | Only this event: its name (e.g. Transfer) or its 32-byte topic hex |
| `address` | hex32 |  | Only events mentioning this address: 32 bytes, 0x hex |

**Output**

An object.

| Field | Type | Required | Description |
|---|---|---|---|
| `events` | array of object |  |  |
| `next` | integer |  | Cursor to pass as `from` next time |
| `gap` | boolean |  | Older events were no longer kept: some were missed |

**Example**

```json
{
  "name": "events.poll",
  "input": {
    "topic": "Transfer",
    "limit": 10
  }
}
```

## events.stream

Contract events as they execute (Server-Sent Events), with the same filters as events.poll.

- **Kind:** stream
- **Runs:** `GET /events` on the gateway

**Input**

| Field | Type | Required | Description |
|---|---|---|---|
| `contract` | hex32 |  | Only events of this contract: 32 bytes, 0x hex |
| `topic` | string |  | Only this event: its name (e.g. Transfer) or its 32-byte topic hex |
| `address` | hex32 |  | Only events mentioning this address: 32 bytes, 0x hex |
| `from` | integer |  | Start at this cursor |

**Output**

An object.

| Field | Type | Required | Description |
|---|---|---|---|
| `seq` | integer |  | Event cursor |
| `commit` | integer |  | Commit |
| `tx` | hex |  | Transaction hash: 0x hex |
| `contract` | hex |  | Contract: 0x hex |
| `topics` | array of hex |  |  |
| `data` | hex |  | Data: 0x hex |

## events.dag_poll

The live DAG feed by cursor: blocks this validator sees, commits it decides, leaders excluded by reputation (default: the latest 500).

- **Kind:** read
- **Runs:** JSON-RPC `mox_dag` (`POST /`) on the gateway

**Input**

| Field | Type | Required | Description |
|---|---|---|---|
| `from` | integer |  | Cursor: the first DAG event to return (default: the latest) |
| `limit` | integer |  | Most to return |
| `wait_ms` | integer |  | Long-poll: wait up to this long for new ones (≤ 30000) |

**Output**

An object.

| Field | Type | Required | Description |
|---|---|---|---|
| `events` | array of object |  |  |
| `next` | integer |  | Cursor to pass as `from` next time |
| `gap` | boolean |  | Older DAG events were no longer kept: some were missed |

## events.dag_stream

The live DAG as Server-Sent Events.

- **Kind:** stream
- **Runs:** `GET /dag` on the gateway

**Input**

| Field | Type | Required | Description |
|---|---|---|---|
| `from` | integer |  | Start at this cursor |

**Output**

object: A DAG event (block, commit or exclusion).

## events.commits

Recently executed commits with their transactions (signed bytes), receipts and drops, by cursor: what indexers follow.

- **Kind:** read
- **Runs:** JSON-RPC `mox_commits` (`POST /`) on the gateway

**Input**

| Field | Type | Required | Description |
|---|---|---|---|
| `from` | integer |  | Cursor: the first commit to return (default: the latest) |
| `limit` | integer |  | Most to return |
| `wait_ms` | integer |  | Long-poll: wait up to this long for new ones (≤ 30000) |

**Output**

An object.

| Field | Type | Required | Description |
|---|---|---|---|
| `commits` | array of object |  |  |
| `next` | integer |  | Cursor to pass as `from` next time |
| `gap` | boolean |  | Older commits were no longer kept: some were missed |
