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

# AbiConstructor.fromAbi

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

Extracts an [`AbiConstructor.AbiConstructor`](/docs/utilities/abiconstructor/types#abiconstructor) from an [`Abi.Abi`](/docs/utilities/abi/types#abi) given a name and optional arguments.

## Imports

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

## Examples

### Extracting by Name

ABI Events can be extracted by their name using the `name` option:

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

const abi = Abi.from([
  'constructor(address owner)',
  'function foo()',
  'event Transfer(address owner, address to, uint256 tokenId)',
  'function bar(string a) returns (uint256 x)'
])

const item = AbiConstructor.fromAbi(abi) // [!code focus]
//    ^?
```

## Definition

```ts
function fromAbi(
  abi: Abi.Abi | readonly unknown[],
): AbiConstructor
```

## Parameters

### abi

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

## Return Type

The ABI constructor.

`AbiConstructor`
