# setResolverAndRecords

Sets a resolver and its initial records as a resumable workflow.

## Import

```ts
import { Ensforge } from "@ensforge/sdk";
```

## Usage

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

const result = await sdk.resolution.setResolverAndRecords({
  name: "example.eth",
  records: [],
});
```

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

## Parameters

```ts
import type { SetResolverAndRecordsParameters } from "@ensforge/sdk/resolution";
```

### name

`string`

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

### records

`ReadonlyArray<SetRecordInput>`

Records selected, read, or written.

### resolver

`string | undefined`

Resolver address used by the method.

### salt

`bigint | undefined`

Value used for `salt` by this method.

### admin

`string | undefined`

Value used for `admin` by this method.

### roles

`bigint | undefined`

Role bitmask to inspect, grant, or revoke.

### setters

`ReadonlyArray<Hex> | undefined`

Value used for `setters` by this method.

### walletClient

`WalletClient | undefined`

Viem wallet client override for this operation. Defaults to the wallet resolved from the config.

### account

`Account | Address | undefined`

Account used to authorize this operation. Defaults to the account exposed by the resolved wallet client.

### confirmation

`ConfirmationPolicy | undefined`

Controls whether the action returns after submission or waits for one or more confirmations.

### resume

`SetResolverAndRecordsProgress | undefined`

Previously returned progress used to continue the workflow.

## Return Type

```ts
import type { SetResolverAndRecordsProgress } from "@ensforge/sdk/resolution";
```

| Property         | Type                    | Description                                         |
| ---------------- | ----------------------- | --------------------------------------------------- |
| `protocol`       | `"v1" \| "v2"`          | ENS protocol route used for the result.             |
| `resolver`       | `&#96;0x${string}&#96;` | The resolver value returned by the operation.       |
| `resolverSource` | `ResolverSource`        | The resolverSource value returned by the operation. |
| `write`          | `WritePlanProgress`     | Progress for the write plan used by the workflow.   |

## Effect

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

```ts
import { Effect } from "effect";
import { sdk } from "./client";

const program = sdk.resolution.setResolverAndRecords.effect(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 { SetResolverAndRecordsError } from "@ensforge/sdk/resolution";
```

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

* [`setResolverAndRecords`](/core/api/actions/resolution/set-resolver-and-records)
