# event.decode

> For the complete documentation index, see [llms.txt](https://ensforge.com/llms.txt).

Normalizes the ENS events in logs or transaction receipts. Parameters, return value, errors and examples for event.decode in @ensforge/sdk.

Source: https://ensforge.com/docs/reference/sdk/event/decode

<ApiMeta kind="Read" stability="stable" since="1.0.0" source="packages/sdk/src/actions/event/decode/index.ts#L53" batchable />

Normalizes the ENS events in logs or transaction receipts.

## When to use [#when-to-use]

Use to read what a write did from its receipts, or to classify logs you fetched yourself.

## Details [#details]

- Each event carries the indexer's `type` and `action` (bigname's model), the Solidity
  event name, protocol, emitter, decoded arguments and, when the event spells it, the name.
- Logs that are not ENS events (token transfers, other contracts) are skipped.
- No RPC calls.

## Signature [#signature]

```ts
function decode(client: Like, options: decode.Options): Promise<decode.ReturnType>
```

Call it as `ens.event.decode(options)` on a client, or `Actions.event.decode(client, options)`.

`event.decode.request(options)` builds a deferred read for `Actions.batch`. See [Look up many at once](/docs/sdk/look-up-many-at-once).

## Parameters [#parameters]

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `logs` | `readonly Log[]` |  | Logs to decode. |
| `receipts` | `readonly TransactionReceipt[]` |  | Receipts whose logs to decode. |

## Returns [#returns]

Resolves to `readonly Event[]`. The ENS events, in log order.

| Field | Type | Description |
| --- | --- | --- |
| `type` | `EventType` |  |
| `action` | `EventAction` |  |
| `event` | `string` | Solidity event name, e.g. `LabelRegistered`. |
| `protocol` | `"v1" \| "v2" \| null` | Protocol of the emitting contract; `null` for resolvers ensforge does not know. |
| `contract` | `Address` | Emitting contract. |
| `name` | `string \| null` | The name the event is about, when the event or the query reveals it. |
| `node` | `Hex \| null` | ENS node the event is keyed by, for node-keyed events. |
| `args` | `Readonly<Record<string, unknown>>` | Decoded event arguments. |
| `blockNumber` | `bigint` |  |
| `transactionHash` | `Hex` |  |
| `logIndex` | `number` |  |

## Errors [#errors]

| Error | Codes | When |
| --- | --- | --- |
| [`InternalError`](/docs/reference/errors/internal-error) | [`UNEXPECTED`](/docs/reference/errors/UNEXPECTED) | malformed logs. |
| [`NetworkError`](/docs/reference/errors/network-error) | [`RPC_REQUEST_FAILED`](/docs/reference/errors/RPC_REQUEST_FAILED), [`RPC_TIMEOUT`](/docs/reference/errors/RPC_TIMEOUT), [`RATE_LIMITED`](/docs/reference/errors/RATE_LIMITED) | the RPC request fails. |

It can also fail with the errors every read can (`Errors.CommonError`: `ConfigError`, `ContractRevertError`, `InternalError`, `NetworkError`).

See [How errors work](/docs/sdk/errors-explained).

## Examples [#examples]

<Tabs groupId="api" items={["Client","Standalone","Effect"]} persist>
<Tab>
```ts title="Decoding a write's receipts"
const events = await ens.event.decode({ receipts })
```
</Tab>

<Tab>
```ts title="Decoding a write's receipts with a standalone call"
import { Actions } from "@ensforge/sdk"

const events = await Actions.event.decode(publicClient, { receipts })
```
</Tab>

<Tab>
```ts title="Decoding a write's receipts in an Effect program"
import { Actions } from "@ensforge/sdk/effect"

const events = yield* Actions.event.decode(ens, { receipts })
```
</Tab>
</Tabs>

## See also [#see-also]

- [`event.get`](/docs/reference/sdk/event/get) to fetch a name's events