> **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.from

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

Parses an arbitrary **JSON ABI Event** or **Human Readable ABI Event** into a typed [`AbiEvent.AbiEvent`](/docs/utilities/abievent/types#abievent).

## Imports

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

## Examples

### JSON ABIs

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

const transfer = AbiEvent.from({
  name: 'Transfer',
  type: 'event',
  inputs: [
    { name: 'from', type: 'address', indexed: true },
    { name: 'to', type: 'address', indexed: true },
    { name: 'value', type: 'uint256' }
  ]
})

transfer
//^?
```

### Human Readable ABIs

A Human Readable ABI can be parsed into a typed ABI object:

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

const transfer = AbiEvent.from(
  'event Transfer(address indexed from, address indexed to, uint256 value)' // [!code hl]
)

transfer
//^?
```

## Definition

```ts
function from<abiEvent>(
  abiEvent: (abiEvent | AbiEvent | string | readonly string[]) & ((abiEvent extends string ? internal.Signature<abiEvent> : never) | (abiEvent extends readonly string[] ? internal.Signatures<abiEvent> : never) | AbiEvent),
  options?: from.Options,
): from.ReturnType<abiEvent>
```

## Parameters

### abiEvent

* **Type:** `(abiEvent | AbiEvent | string | readonly string[]) & ((abiEvent extends string ? internal.Signature<abiEvent> : never) | (abiEvent extends readonly string[] ? internal.Signatures<abiEvent> : never) | AbiEvent)`

The ABI Event to parse.

### options

* **Type:** `from.Options`
* **Optional**

#### options.prepare

* **Type:** `boolean`
* **Optional**

Whether or not to prepare the extracted event (optimization for encoding performance).
When `true`, the `hash` property is computed and included in the returned value.

## Return Type

Typed ABI Event.

`from.ReturnType<abiEvent>`
