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

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

Extracts and decodes Logs that match an ABI Event in an ABI.

## Imports

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

## Examples

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

const abi = Abi.from([
  'event Transfer(address indexed from, address indexed to, uint256 value)'
])

const logs = AbiEvent.extractLogs(abi, [
  {
    data: '0x0000000000000000000000000000000000000000000000000000000000000001',
    topics: [
      '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
      '0x000000000000000000000000a5cc3c03994db5b0d9a5eedd10cabab0813678ac',
      '0x000000000000000000000000a5cc3c03994db5b0d9a5eedd10cabab0813678ac'
    ]
  }
])
// @log: [{
// @log:   eventName: 'Transfer',
// @log:   args: {
// @log:     from: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
// @log:     to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
// @log:     value: 1n,
// @log:   },
// @log:   topics: [...],
// @log:   data: '0x...',
// @log: }]
```

## Definition

```ts
function extractLogs<abi, logs, eventName, strict>(
  abi: abi | Abi.Abi | readonly unknown[],
  logs: logs | readonly extractLogs.Log[],
  options?: extractLogs.Options<abi, eventName, strict>,
): extractLogs.ReturnType<extractLogs.ExtractEvent<abi, eventName>, logs[number], strict>[]
```

## Parameters

### abi

* **Type:** `abi | Abi.Abi | readonly unknown[]`

The ABI to extract events from.

### logs

* **Type:** `logs | readonly extractLogs.Log[]`

Logs to extract.

### options

* **Type:** `extractLogs.Options<abi, eventName, strict>`
* **Optional**

Extraction options.

#### options.args

* **Type:** `abiEvent["inputs"] extends readonly [] ? never : ParametersToPrimitiveTypes`
* **Optional**

Arguments to match against decoded event arguments.

#### options.checksumAddress

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

Whether decoded addresses should be checksummed.

#### options.eventName

* **Type:** `eventName | Name[]`
* **Optional**

Event name, or event names, to extract.

#### options.strict

* **Type:** `boolean | strict`
* **Optional**

Whether to strictly decode log topics and data.

## Return Type

The extracted logs.

`extractLogs.ReturnType<extractLogs.ExtractEvent<abi, eventName>, logs[number], strict>[]`
