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

# Event.getSelector

> Compute the 32-byte selector (topic0) for an event

## Overview

`Event.getSelector` returns the keccak256 hash of the event signature. This value is used as `topic0` for non-anonymous events.

## Quick Start

```typescript theme={null}
import { Abi } from '@tevm/voltaire/Abi';
import { Hex } from '@tevm/voltaire/Hex';

const Transfer = {
  type: 'event',
  name: 'Transfer',
  inputs: [
    { type: 'address', name: 'from', indexed: true },
    { type: 'address', name: 'to', indexed: true },
    { type: 'uint256', name: 'value' }
  ]
} as const;

const topic0 = Abi.Event.getSelector(Transfer);
const topicHex = Hex.fromBytes(topic0);
```

## Use in Log Filters

```typescript theme={null}
const logs = await provider.getLogs({
  address: tokenAddress,
  topics: [Hex.fromBytes(Abi.Event.getSelector(Transfer))]
});
```

## Multiple Event Types

```typescript theme={null}
const Approval = {
  type: 'event',
  name: 'Approval',
  inputs: [
    { type: 'address', name: 'owner', indexed: true },
    { type: 'address', name: 'spender', indexed: true },
    { type: 'uint256', name: 'value' }
  ]
} as const;

const topics = [[
  Hex.fromBytes(Abi.Event.getSelector(Transfer)),
  Hex.fromBytes(Abi.Event.getSelector(Approval))
]];

const logs = await provider.getLogs({ address: tokenAddress, topics });
```

## Anonymous Events

Anonymous events do not include `topic0`. You should not filter on a selector for anonymous events.

## See Also

* [getSignature](/primitives/abi/event/get-signature) - Event signature string
* [encodeTopics](/primitives/abi/event/encode-topics) - Build topic arrays
