# AbiEvent.getSelector

Computes the event selector (hash of event signature) for an [`AbiEvent.AbiEvent`](/api/AbiEvent/types#abievent).

## Imports

:::code-group
```ts [Named]
import { AbiEvent } from 'ox'
```

```ts [Entrypoint]
import * as AbiEvent from 'ox/AbiEvent'
```
:::

## Examples

```ts twoslash
import { AbiEvent } from 'ox'

const selector = AbiEvent.getSelector(
  'event Transfer(address indexed from, address indexed to, uint256 value)'
)
// @log: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f556a2'
```

```ts twoslash
import { AbiEvent } from 'ox'

const selector = AbiEvent.getSelector({
  name: 'Transfer',
  type: 'event',
  inputs: [
    { name: 'from', type: 'address', indexed: true },
    { name: 'to', type: 'address', indexed: true },
    { name: 'value', type: 'uint256' }
  ]
})
// @log: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f556a2'
```

## Definition

```ts
function getSelector(
  abiItem: string | AbiEvent,
): Hex.Hex
```

**Source:** [src/core/AbiEvent.ts](https://github.com/wevm/ox/blob/main/src/core/AbiEvent.ts#L1981)

## Parameters

### abiItem

* **Type:** `string | AbiEvent`

The ABI event to compute the selector for.

#### abiItem.hash

* **Type:** `0x${string}`
* **Optional**

#### abiItem.overloads

* **Type:** `readonly any[]`
* **Optional**

## Return Type

The [`Hash.keccak256`](/api/Hash/keccak256) hash of the event signature.

`Hex.Hex`
