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

# watchHcaExecution

Stream execution state changes.

## Import

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

## Usage

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

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

const stopWatching = await watchHcaExecution(
  config,
  { submission },
  (status) => console.log(status.status),
  (error) => console.error(error),
);

// Call stopWatching() when the screen or task is closed.
```

```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
type WatchHcaExecutionResult = Awaited<ReturnType<typeof watchHcaExecution>>;
```

Returns `() => void`.

## Stream

```ts
const stream = watchHcaExecution.stream(config, { submission });
```

Observation does not resubmit an operation.

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

* [`watchHcaExecution`](/sdk/api/hca/watch-hca-execution)
* [Guide](/core/guides/hca)
