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

# useEnableHcaSessionWithRefund

Enable a session with an explicitly bounded refund. Uses the SDK from `EnsforgeProvider`.

## Import

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

## Usage

:::code-group
```tsx [component.tsx]
import { useEnableHcaSessionWithRefund } from "@ensforge/react";
import type { EnableHcaSessionWithRefundParameters } from "@ensforge/core/hca";

function Component({ session }: { session: EnableHcaSessionWithRefundParameters }) {
  const mutation = useEnableHcaSessionWithRefund();

  return (
    <button
      disabled={mutation.isWaiting}
      onClick={() =>
        mutation.mutate({
          ...session,
        })
      }
    >
      Submit
    </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 { EnableHcaSessionWithRefundParameters } from "@ensforge/sdk/hca";
```

### refund

`HcaSessionRefund`

Explicit bound for session execution refunds.

### hca

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

HCA address to inspect or operate on.

### permissionId

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

Permission identifier of the prepared or enabled session.

### sessionKey

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

Address of the session signer. The private key is not passed to the action.

### validUntil

`number`

Session expiry as a Unix timestamp in seconds.

### resolver

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

Resolver address used by the registration or session policy.

### salt

`bigint | undefined`

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

### walletClient

`WalletClient | undefined`

Viem wallet override. Defaults to the configured wallet resolver.

### account

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

Wallet account override for the operation.

## Return Type

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

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 { createEnableHcaSessionWithRefundMutationAtom } from "@ensforge/react/atoms";
import { sdk } from "./client";

const atom = createEnableHcaSessionWithRefundMutationAtom(sdk);
```

## Action

* [`enableHcaSessionWithRefund`](/core/api/actions/hca/enable-hca-session-with-refund)
* [`sdk.hca.enableHcaSessionWithRefund`](/sdk/api/hca/enable-hca-session-with-refund)
