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

Waits for a dispute game after an L2 position.

## Usage

Poll until a respected dispute game anchors a position after the requested L2 block number or timestamp.

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

const game = await client.game.waitForNextGame({ // [!code focus]
  l2BlockNumber: 123_456_789n, // [!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.waitForNextGame` 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 game = await Actions.l1.waitForNextGame(client, { // [!code focus]
  l2BlockNumber: 123_456_789n, // [!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
Game.Game & {
  l2BlockNumber: bigint
  usesSuperRoots: boolean
}
```

The next respected dispute game and its anchored L2 position.

## Parameters

### chain

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

The L1 chain used to read recent games.

### disputeGameFactoryAddress

* **Type:** `Address`

An explicit Dispute Game Factory address. Supply it with `portalAddress` when omitting `targetChain`.

### intervalBuffer

* **Type:** `number`
* **Default:** `1.1`

The multiplier applied to the observed interval before polling begins.

### l2BlockNumber

* **Type:** `bigint`

The minimum anchored L2 block number, or timestamp for super-root games.

### limit

* **Type:** `number`
* **Default:** `100`

The maximum number of recent games to inspect while polling.

### pollingInterval

* **Type:** `number`
* **Default:** `client.pollingInterval`

The polling interval in milliseconds.

### portalAddress

* **Type:** `Address`

An explicit Optimism Portal address. Supply it with `disputeGameFactoryAddress` when omitting `targetChain`.

### targetChain

* **Type:** `Chain`

The OP Stack L2 [Chain](/docs/chains) whose L1 contracts are used.
