# AbiConstructor.fromAbi

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

## Imports

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

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

## Examples

### Extracting by Name

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

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

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

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

## Parameters

### abi

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

## Return Type

The ABI constructor.

`AbiConstructor`
