# useResolvedNamesForAddress

React hook that lists names whose indexed resolved address matches an Ethereum address.

## Import

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

## Usage

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

function Component() {
  const result = useResolvedNamesForAddress({
    address: "0x0000000000000000000000000000000000000000",
    pageSize: 20,
  });

  return <pre>{JSON.stringify(result.data, null, 2)}</pre>;
}
```

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

## Parameters

```ts
import type { UseEnsAtomParameters } from "@ensforge/react";
import type { GetResolvedNamesForAddressParametersType } from "@ensforge/sdk/indexer";
```

### address

`0x${string}`

Address matched against indexed resolution data.

### filter

`NameFilter | undefined`

Narrows names by exact `name` or `label`, structured `search`, `owner`, `resolvedAddress`,
`resolver`, `protocol`, migration state, reachability, or expiry bounds. Conditions are combined with
AND semantics. Support is validated against the selected protocol sources before a request is sent.

`migrated` means migrated from ENSv1 to ENSv2. `true` selects migrated names from the V2
indexer; `false` includes V1 names and native V2 names. The V1 subgraph's historical registry
migration flag is not used. The returned `isMigrated` field follows the same meaning; a V1-only
source cannot establish whether a name has migrated to ENSv2.

`expiryAfter` is an exclusive lower bound and also includes names with no recorded expiry.
`expiryBefore` is an exclusive upper bound and requires a recorded expiry. When both are set,
only names with an expiry strictly between the bounds match. A missing expiry does not guarantee
that a name will remain usable: parent-name expiry or registry permissions may still affect it.

V2 queries with `expiryAfter` apply that bound locally and may fetch additional pages because the
indexer does not expose a null-expiry filter.

### order

`NameOrder | undefined`

Orders by `createdAt`, `name`, or `expiry` in `asc` or `desc` direction. The default is
`{ field: "createdAt", direction: "desc" }`. The same order must be retained when continuing from a
cursor.

### pageSize

`number | undefined`

Maximum number of items to return. It must be greater than zero and cannot exceed the
`maximumPageSize` configured for the indexer. The default is the smaller of `20` and the configured
maximum.

### cursor

`IndexerCursor | undefined`

Opaque cursor returned by the previous page. Pass it unchanged to continue the same query. A cursor
is tied to its filters, ordering, network, and enabled indexer sources; changing any of them requires
starting again without a cursor.

### enabled

`boolean | undefined`

Defaults to `true`. Set it to `false` to keep the atom idle without executing the action.

### map

`(value: Success) => Mapped | undefined`

Maps successful data for this hook without changing the value stored by the underlying atom.

### atom

`EnsAtomOptions<Failure> | undefined`

Controls the Effect Atom lifecycle for this hook.

| Property          | Type                         | Default       | Description                                     |
| ----------------- | ---------------------------- | ------------- | ----------------------------------------------- |
| `idleTTL`         | `Duration.Input`             | `"5 minutes"` | Retains an unused atom before it is disposed.   |
| `refreshInterval` | `false \| Duration.Input`    | `false`       | Refreshes the atom while it remains subscribed. |
| `retry`           | `false \| Schedule`          | `false`       | Retries typed failures with an Effect schedule. |
| `swr`             | `false \| EnsAtomSwrOptions` | enabled       | Configures stale-while-revalidate behavior.     |

See [Atom Options](/react/api/atom-options) for focused examples.

## Return Type

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

Successful `data` has type `GetResolvedNamesForAddressResultType`.

Returns an [`EnsAtomResult`](/react/api/atom-result).

| Property        | Description                                             |
| --------------- | ------------------------------------------------------- |
| `data`          | Successful action data, or `undefined` before success.  |
| `error`         | Typed action failure, an unexpected `Error`, or `null`. |
| `cause`         | Complete Effect cause for the latest failure.           |
| `isInitial`     | No execution has completed yet.                         |
| `isWaiting`     | Initial or background work is running.                  |
| `isSuccess`     | The atom contains a successful value.                   |
| `isFailure`     | The atom contains a failed result.                      |
| `refresh`       | Refreshes the atom and returns a Promise.               |
| `refreshEffect` | Refreshes with a typed Effect error channel.            |
| `result`        | Underlying Effect `AsyncResult`.                        |
| `updatedAt`     | Timestamp of the latest successful value.               |

## Suspense

Use `useResolvedNamesForAddressSuspense` beneath React [Suspense](https://react.dev/reference/react/Suspense) and an error boundary. It starts immediately, suspends during the initial load, and throws typed failures to the nearest error boundary.

### Import

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

### Usage

```tsx
const result = useResolvedNamesForAddressSuspense({
  address: "0x0000000000000000000000000000000000000000",
  pageSize: 20,
});
```

### Parameters

`useResolvedNamesForAddressSuspense` accepts the same operation parameters described above. Its Effect Atom options omit `enabled` because a Suspense read always executes.

### map

`(value: Success) => Mapped | undefined`

Maps successful data for this hook without changing the value stored by the underlying atom.

### atom

`EnsAtomOptions<Failure> | undefined`

Controls retries, refreshes, disposal, and stale-while-revalidate behavior. Suspense hooks always
execute and do not accept `enabled`.

| Property          | Type                         | Default       | Description                                     |
| ----------------- | ---------------------------- | ------------- | ----------------------------------------------- |
| `idleTTL`         | `Duration.Input`             | `"5 minutes"` | Retains an unused atom before it is disposed.   |
| `refreshInterval` | `false \| Duration.Input`    | `false`       | Refreshes the atom while it remains subscribed. |
| `retry`           | `false \| Schedule`          | `false`       | Retries typed failures with an Effect schedule. |
| `swr`             | `false \| EnsAtomSwrOptions` | enabled       | Configures stale-while-revalidate behavior.     |

See [Atom Options](/react/api/atom-options) for focused examples.

### Return Type

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

Returns `EnsSuspenseAtomResult` with successful `data`, background `isWaiting` state, and
`updatedAt`. Pending work suspends rendering and failures are thrown to the nearest error boundary.

## Effect Atom

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

const atom = getResolvedNamesForAddressAtom(sdk, parameters, options);
```

The hook creates this atom with the SDK and registry supplied by [`EnsforgeProvider`](/react/api/ensforge-provider).

## Actions

* [`getResolvedNamesForAddress`](/core/api/actions/indexer/names/get-resolved-names-for-address)
* [`sdk.indexer.getResolvedNamesForAddress`](/sdk/api/indexer/names/get-resolved-names-for-address)
