# Transfer a name

> For the complete documentation index, see [llms.txt](https://ensforge.com/llms.txt).

Send a name to another account, or hand its manager role or its record control to someone else, and check the new owner afterwards.

Source: https://ensforge.com/docs/sdk/transfer-a-name

You will send a [name](/docs/reference/glossary#name) you own to another address. ensforge moves the right token for the name's kind, so one call works for [ENSv2](/docs/reference/glossary#ensv2) names, unwrapped [ENSv1](/docs/reference/glossary#ensv1) names and wrapped names.

## Prerequisites [#prerequisites]

- A wallet client for the account that owns the name. See [Create a client](/docs/sdk/create-a-client).
- A registered name. Expired, reserved and unregistered names cannot be transferred.

## 1. Send the name [#1-send-the-name]

[`name.transfer`](/docs/reference/sdk/name/transfer) takes the name and the recipient. `name.transferSync` also waits for the receipt.

**Example** (Sending a Name)

```ts title="transfer.ts"
import { createPublicClient, createWalletClient, http, type Hex } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { sepolia } from "viem/chains";
import { Ensforge, ensActions } from "@ensforge/sdk";

const account = privateKeyToAccount(process.env.PRIVATE_KEY as Hex);
const transport = http(process.env.SEPOLIA_RPC_URL);

const ens = Ensforge.create({
  publicClient: createPublicClient({ chain: sepolia, transport }),
  walletClient: createWalletClient({ account, chain: sepolia, transport }),
}).extend(ensActions());

const { hash } = await ens.name.transfer({
  name: "ensforge-docs-demo.eth",
  to: "0xB0b0000000000000000000000000000000000000",
});
```

What moves depends on where the name lives:

| Name                           | What `transfer` moves                                         |
| ------------------------------ | ------------------------------------------------------------- |
| On ENSv2                       | The name's registry token.                                    |
| Wrapped on ENSv1               | The NameWrapper token.                                        |
| Unwrapped `.eth` name on ENSv1 | The registrar token and the registry ownership (the manager). |
| Other unwrapped ENSv1 name     | The registry owner.                                           |

| Option    | Type                      | Default   | Description                                                                 |
| --------- | ------------------------- | --------- | --------------------------------------------------------------------------- |
| `name`    | `string`                  | required  | The name to send. Normalised automatically.                                 |
| `to`      | `string`                  | required  | The recipient address.                                                      |
| `role`    | `"owner" \| "registrant"` | `"owner"` | Unwrapped `.eth` names only. `"registrant"` moves only the registrar token. |
| `unsafe`  | `boolean`                 | `false`   | ENSv2 only. Send even while other accounts still hold roles on the name.    |
| `records` | `"keep" \| "handover"`    | `"keep"`  | ENSv2 only. What happens to the sender's roles on the name's resolver.      |

## 2. Decide who keeps control of the records [#2-decide-who-keeps-control-of-the-records]

On ENSv2, a name's [resolver](/docs/reference/glossary#resolver) has its own [roles](/docs/reference/glossary#role). By default they stay with the sender, who can still edit the records after the transfer. The plan carries a `RECORD_CONTROL_RETAINED` warning.

Pass `records: "handover"` to grant them to the recipient and revoke the sender's in the same step.

**Example** (Handing Over Record Control)

```ts title="transfer-handover.ts"
import { createPublicClient, createWalletClient, http, type Hex } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { sepolia } from "viem/chains";
import { Ensforge, ensActions } from "@ensforge/sdk";

const account = privateKeyToAccount(process.env.PRIVATE_KEY as Hex);
const transport = http(process.env.SEPOLIA_RPC_URL);

const ens = Ensforge.create({
  publicClient: createPublicClient({ chain: sepolia, transport }),
  walletClient: createWalletClient({ account, chain: sepolia, transport }),
}).extend(ensActions());

await ens.name.transferSync({
  name: "ensforge-docs-demo.eth",
  to: "0xB0b0000000000000000000000000000000000000",
  records: "handover",
});
```

`"handover"` is refused for the sender's shared `"owned"` resolver, because its roles cover other names too. See [Resolvers and shared records](/docs/sdk/resolvers-and-shared-records).

## Give only the registrar token (ENSv1) [#give-only-the-registrar-token-ensv1]

An unwrapped `.eth` name on ENSv1 has two holders. The [registrant](/docs/reference/glossary#registrant) holds the registrar token and owns the name. The [manager](/docs/reference/glossary#manager) is the registry owner and edits records and subnames. See [Who can change a name](/docs/sdk/who-can-change-a-name).

- `role: "registrant"` on `name.transfer` moves only the registrar token.
- [`name.setManager`](/docs/reference/sdk/name/set-manager) lets another account edit records and subnames while you keep ownership.
- [`name.reclaim`](/docs/reference/sdk/name/reclaim) resets the manager to the registrant (or to `owner`). Use it after receiving a registrar token, or to repair a lost manager.

`setManager` and `reclaim` fail with [`UNSUPPORTED_PROTOCOL`](/docs/reference/errors/UNSUPPORTED_PROTOCOL) for ENSv2 names and wrapped names, and `reclaim` also for names that are not `.eth` names. ENSv2 uses roles instead. See [Roles and permissions](/docs/sdk/roles-and-permissions).

## Check the result [#check-the-result]

Read the name with [`name.get`](/docs/reference/sdk/name/get) and compare `owner` with the recipient. See [Get a name's owner, expiry and status](/docs/sdk/get-name-details).

## Troubleshooting [#troubleshooting]

### `NOT_OWNER` [#not_owner]

The signer does not own the name. Send from the owner's account. See [`NOT_OWNER`](/docs/reference/errors/NOT_OWNER).

### `TRANSFER_DISALLOWED` [#transfer_disallowed]

The owner lacks the role to transfer, other accounts hold roles on an ENSv2 name, or the recipient (an HCA) refuses it. Revoke the other roles, or pass `unsafe: true`. See [`TRANSFER_DISALLOWED`](/docs/reference/errors/TRANSFER_DISALLOWED).

### `NAME_EXPIRED`, `NAME_RESERVED` or `NAME_NOT_REGISTERED` [#name_expired-name_reserved-or-name_not_registered]

Only registered names can be sent. See [`NAME_EXPIRED`](/docs/reference/errors/NAME_EXPIRED), [`NAME_RESERVED`](/docs/reference/errors/NAME_RESERVED) and [`NAME_NOT_REGISTERED`](/docs/reference/errors/NAME_NOT_REGISTERED).

### `UNSUPPORTED_PROTOCOL` [#unsupported_protocol]

You passed `role: "registrant"` for a name that has no registrant. See [`UNSUPPORTED_PROTOCOL`](/docs/reference/errors/UNSUPPORTED_PROTOCOL).

### `INVALID_ADDRESS` [#invalid_address]

`to` is not an address. See [`INVALID_ADDRESS`](/docs/reference/errors/INVALID_ADDRESS).