# AbiError.extract

Extracts an [`AbiError.AbiError`](/api/AbiError/types#abierror) from an [`Abi.Abi`](/api/Abi/types#abi) and decodes its arguments from error data.

## Imports

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

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

## Examples

```ts twoslash
import { Abi, AbiError } from 'ox'

const abi = Abi.from([
  'error InvalidSignature(uint r, uint s, uint8 yParity)'
])

const { error, args } = AbiError.extract(
  abi,
  '0xecde634900000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001'
)
// @log: {
// @log:   error: { name: 'InvalidSignature', type: 'error', ... },
// @log:   args: [420n, 69n, 1],
// @log: }
```

## Definition

```ts
function extract<abi, as>(
  abi: abi | Abi.Abi | readonly unknown[],
  data: Hex.Hex,
  options?: extract.Options<as>,
): extract.ReturnType<extract.ExtractError<abi>, as>
```

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

## Parameters

### abi

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

The ABI to extract from.

### data

* **Type:** `Hex.Hex`

The error data.

### options

* **Type:** `extract.Options<as>`
* **Optional**

Extraction options.

## Return Type

The extracted ABI Error and decoded arguments.

`extract.ReturnType<extract.ExtractError<abi>, as>`
