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

# `l1.getPortalVersion`

Retrieves the deployed Optimism Portal semantic version.

## Usage

Read and parse the portal's `version()` response.

:::code-group
```ts twoslash [example.ts]
import { optimism } from 'viem/chains'
import { client } from './viem.config'

const version = await client.portal.getPortalVersion({ // [!code focus]
  targetChain: optimism, // [!code focus]
}) // [!code focus]
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/op-stack/l1.config.ts:setup]
```
:::

### Standalone Action

Call `Actions.l1.getPortalVersion` directly by passing the [Client](/docs/clients) as the first argument.

:::code-group
```ts twoslash [example.ts]
import { optimism } from 'viem/chains'
import { Actions } from 'viem/op-stack'
import { client } from './viem.config'

const version = await Actions.l1.getPortalVersion(client, { // [!code focus]
  targetChain: optimism, // [!code focus]
}) // [!code focus]
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/op-stack/l1.config.ts:setup]
```
:::

## Return Value

```ts
{
  major: number
  minor: number
  patch: number
}
```

The parsed semantic version.

## Parameters

### chain

* **Type:** `Chain`
* **Default:** `client.chain`

The L1 chain used to resolve the portal address.

### portalAddress

* **Type:** `Address`

An explicit Optimism Portal address. When supplied, `targetChain` is optional.

### targetChain

* **Type:** `Chain`

The OP Stack L2 [Chain](/docs/chains) whose portal contract is used.
