> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://ensforge.com/api/mcp` to find what you need.

# waitForHcaExecution

Wait for execution with bounded polling.

## Import

```ts
import { waitForHcaExecution } from "@ensforge/core/hca";
```

## Usage

:::code-group
```ts [index.ts]
import { waitForHcaExecution } from "@ensforge/core/hca";
import { config } from "./config";
import { executeHcaCalls } from "@ensforge/core/hca";

const submission = await executeHcaCalls(config, {
  hca: "0x1234567890123456789012345678901234567890",
  authorization: { kind: "owner" },
  calls: [{ to: "0x2345678901234567890123456789012345678901", value: 0n, data: "0x" }],
});

const result = await waitForHcaExecution(config, {
  submission,
});
```

```ts [config.ts]
// [!include ~/snippets/hca/config.ts]
```
:::

## Parameters

```ts
import type { WaitForHcaExecutionParameters } from "@ensforge/core/hca";
```

### submission

`HcaExecutionSubmission<unknown>`

Previously returned or explicitly recovered execution submission.

### confirmations

`number | undefined`

Required receipt confirmations.

### timeout

`number | undefined`

Maximum time to wait, in milliseconds.

### pollingInterval

`number | undefined`

Initial status polling interval, in milliseconds.

### maxPollingInterval

`number | undefined`

Upper bound for the status polling interval, in milliseconds.

### execution

`ExecutionAdapter<unknown, unknown, unknown> | undefined`

Compatible execution adapter. Omit for direct owner execution when supported.

## Return Type

```ts
import type { HcaExecutionStatus } from "@ensforge/core/hca";
```

## Effect

Use `.effect` when composing the action in an Effect program. The success and error channels remain
fully typed.

```ts
import { Effect } from "effect";

const program = waitForHcaExecution.effect(config, {
  submission,
});

type Success = Effect.Success<typeof program>;
type Failure = Effect.Error<typeof program>;

const result = await Effect.runPromise(program);
```

## Error

The Promise API rejects with the same typed failures exposed by the Effect error channel. Errors
have a stable `_tag`, `code`, and `message`; boundary errors retain their original `cause`.

See [Error Handling](/core/guides/error-handling).

## Related

* [`waitForHcaExecution`](/sdk/api/hca/wait-for-hca-execution)
* [Guide](/core/guides/hca)
