# getNameHistory

Gets the normalized event history for one ENS name.

## Import

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

## Usage

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

const result = await getNameHistory(config, {
  name: "example.eth",
  fromBlock: 22_000_000n,
});
```

```ts [config.ts]
// [!include ~/snippets/core/config.ts]
```
:::

## Parameters

```ts
import type { GetNameHistoryParameters } from "@ensforge/core";
```

### name

`string`

ENS name to operate on. ensforge normalizes it before hashing or contract interaction.

### fromBlock

`bigint`

First block included in the event query.

### toBlock

`bigint | undefined`

Last block included in the event query.

## Return Type

```ts
type GetNameHistoryResult = Awaited<ReturnType<typeof getNameHistory>>;
```

| Property | Type                                                                                                                                                                                                                                                                                                                            | Description                                 |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
| `name`   | `string & Brand<"NormalizedName">`                                                                                                                                                                                                                                                                                              | Normalized ENS name.                        |
| `events` | `readonly { readonly blockNumber: bigint \| null; readonly transactionHash: &#96;0x${string}&#96; \| null; readonly protocol: "v1" \| "v2"; readonly kind: "records" \| "ownership" \| "resolver" \| "commitment" \| ... 5 more ... \| "other"; ... 15 more ...; readonly commitment?: &#96;0x${string}&#96; \| undefined; }[]` | The events value returned by the operation. |

## Effect

Use `.effect` when composing the action in an Effect program. The success and error channels remain
fully typed.

```ts
import { Effect } from "effect";

const program = getNameHistory.effect(config, parameters);

type Success = Effect.Effect.Success<typeof program>;
type Failure = Effect.Effect.Error<typeof program>;

const result = await Effect.runPromise(program);
```

## Error

```ts
import type { GetNameHistoryError } from "@ensforge/core";
```

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

* [`sdk.events.getNameHistory`](/sdk/api/events/get-name-history)
