> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# AbiEvent.getSelector

:::info
`AbiEvent.getSelector` is a re-export of ox's [`AbiEvent.getSelector`](https://oxlib.sh/api/AbiEvent/getSelector). Refer to the ox documentation for the full reference.
:::

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

## Imports

```ts
import { AbiEvent } from 'viem/utils'
```

## Examples

```ts twoslash
// @noErrors
import { AbiEvent } from 'viem/utils'

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

```ts twoslash
// @noErrors
import { AbiEvent } from 'viem/utils'

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
```

## 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`](/docs/utilities/hash/keccak256) hash of the event signature.

`Hex.Hex`
