> **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 { Ensforge } from "@ensforge/sdk";
```

## Usage

:::code-group
```ts [index.ts]
import { sdk } from "./client";

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

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

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

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

## Parameters

```ts
import type { WaitForHcaExecutionParameters } from "@ensforge/sdk/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 sdk.hca.watchHcaExecution>>;
```

Returns `() => void`.

## Stream

```ts
const stream = sdk.hca.watchHcaExecution.stream({ submission });
```

Observation does not resubmit an operation.

## Error

The method rejects with the corresponding Core action errors. Use `.effect` to keep those failures
in the typed Effect error channel.

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

## Action

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