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

# useStartHcaRegistration

Persist and start or auto-resume registration. Uses the SDK from `EnsforgeProvider`.

## Import

```tsx
import { useStartHcaRegistration } from "@ensforge/react";
```

## Usage

:::code-group
```tsx [component.tsx]
import { useStartHcaRegistration } from "@ensforge/react";

function Component() {
  const mutation = useStartHcaRegistration();

  return (
    <button
      disabled={mutation.isWaiting}
      onClick={() =>
        mutation.mutate({
          hca: "0x1234567890123456789012345678901234567890",
          name: "example.eth",
          duration: 31_536_000n,
          resolver: "0x3456789012345678901234567890123456789012",
          paymentToken: "0x4567890123456789012345678901234567890123",
          authorization: { kind: "owner" },
          limits: {
            registrationPrice: 10_000_000n,
            fees: [],
          },
        })
      }
    >
      Start registration
    </button>
  );
}
```

```tsx [provider.tsx]
// [!include ~/snippets/hca/provider.tsx]
```
:::

## Parameters

```ts
import type { EnsMutationOptions } from "@ensforge/react";
```

The hook accepts an optional `EnsMutationOptions` object.

### retry

`false | Schedule<unknown, Failure> | undefined`

An Effect schedule used to retry typed failures. It defaults to `false`. Only retry writes that are
known to be safe and idempotent.

### onExit

`(exit: Exit<Success, Failure>, parameters: Parameters) => void`

Receives the complete Effect `Exit` and the exact mutation parameters after execution. Use
`Exit.match` or `Exit.isSuccess` to handle both outcomes without losing typed failures.

See [Mutation Options](/react/api/mutation-options) for schedules, provider defaults, and per-call
`onExit` handlers.

## Mutation Parameters

```ts
import type { StartHcaRegistrationParameters } from "@ensforge/sdk/hca";
```

### hca

`` `0x${string}` ``

HCA address to inspect or operate on.

### name

`string`

ENS name. The action normalizes it before interaction.

### duration

`bigint`

Registration duration in seconds.

### resolver

`` `0x${string}` ``

Resolver address used by the registration or session policy.

### paymentToken

`` `0x${string}` ``

Registration payment token. Amounts use its base units.

### authorization

``{ readonly kind: "owner"; } | { readonly kind: "session"; readonly permissionId: `0x${string}`; readonly enableTransactionHash: `0x${string}`; }``

Owner authorization or an enabled destination session.

### limits

`HcaRegistrationLimits`

Accepted registration price and per-chain execution fee bounds.

### id

`string | undefined`

Saved operation identifier. Start registration can generate it from matching unfinished work.

### salt

`bigint | undefined`

Account derivation salt. Defaults to the deployment profile canonical salt.

### subregistry

`` `0x${string}` | undefined ``

Subregistry assigned by the registration.

### referrer

`` `0x${string}` | undefined ``

Protocol referral identifier.

### primaryName

`boolean | undefined`

Whether to include the supported primary-name operation.

### signerReference

`string | undefined`

Protected application reference used to resolve a persistent session signer.

### storage

`WorkflowStorage | HcaRegistrationStorage | undefined`

Optional storage override. Defaults to config storage.

### execution

`HcaRegistrationExecution | undefined`

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

## Return Type

```ts
type Result = ReturnType<typeof useStartHcaRegistration>;
```

Returns an [`EnsMutationResult`](/react/api/mutation-result).

| Property       | Description                                                    |
| -------------- | -------------------------------------------------------------- |
| `mutate`       | Starts the mutation and optionally reports its `Exit`.         |
| `mutateAsync`  | Starts the mutation and returns a Promise.                     |
| `mutateEffect` | Starts the mutation and returns an Effect with typed failures. |
| `data`         | Latest successful value, or `undefined`.                       |
| `error`        | Latest typed failure, an unexpected `Error`, or `null`.        |
| `cause`        | Complete Effect cause for the latest failure.                  |
| `isInitial`    | The mutation has not executed since creation or reset.         |
| `isWaiting`    | The mutation Effect is currently running.                      |
| `isSuccess`    | The latest execution succeeded.                                |
| `isFailure`    | The latest execution failed.                                   |
| `parameters`   | Parameters used by the latest execution.                       |
| `interrupt`    | Interrupts the active Effect.                                  |
| `reset`        | Restores the mutation to its initial state.                    |
| `result`       | Underlying Effect `AsyncResult`.                               |

## Effect Atom

```ts
import { createStartHcaRegistrationMutationAtom } from "@ensforge/react/atoms";
import { sdk } from "./client";

const atom = createStartHcaRegistrationMutationAtom(sdk);
```

## Action

* [`startHcaRegistration`](/core/api/actions/hca/start-hca-registration)
* [`sdk.hca.startHcaRegistration`](/sdk/api/hca/start-hca-registration)
