# registration.renew

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

Renews one or more .eth names, ENSv1 or ENSv2, paying in an ERC-20 token. Parameters, return value, errors and examples for registration.renew in @ensforge/sdk.

Source: https://ensforge.com/docs/reference/sdk/registration/renew

<ApiMeta kind="Write" stability="stable" since="1.0.0" source="packages/sdk/src/actions/registration/renew/index.ts#L62" />

Renews one or more `.eth` names, ENSv1 or ENSv2, paying in an ERC-20 token. Resolves once the transaction is submitted.

## When to use [#when-to-use]

Use to extend names, including names in their grace period. Use [`renewSync`](/docs/reference/sdk/registration/renew#wait-for-the-receipt-with-renewsync) to wait for the receipt.

## Details [#details]

- ENSv2 names renew through the `ETHRegistrar`, names still on ENSv1 through `ETHRenewerV1`
  (which also extends wrapped names); each route is one `renewBatch` call.
- Token approvals are added for each contract whose allowance is short.
- Anyone can renew any name; the payer is the signer.
- A name listed twice is renewed once, for `duration`.

## Signature [#signature]

```ts
function renew(
  client: Like,
  options: renew.Options & Write.Options,
): Promise<renew.ReturnType>
```

Call it as `ens.registration.renew(options)` on a client, or `Actions.registration.renew(client, options)`.

In React, use [`useRenew`](/docs/reference/react/use-renew).

## Parameters [#parameters]

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `names` (required) | `string \| readonly string[]` |  | One or more `.eth` second-level names. Normalized automatically. |
| `duration` (required) | `bigint` |  | Renewal length in seconds. |
| `paymentToken` | `PaymentToken` | `"usdc"` | Token to pay with. |
| `referrer` | `Hex` |  | Referrer recorded by the registrar: 32 bytes, or an address (left-padded). |

Also takes the [write options](/docs/reference/sdk/client#write-options).

## Returns [#returns]

Resolves to `Write.Result`. Submitted transaction hashes and the plan that produced them.

| Field | Type | Description |
| --- | --- | --- |
| `hash` | `Hex` | Hash of the last transaction. |
| `hashes` | `readonly Hex[]` | Every submitted transaction, in order. |
| `id` | `string` | EIP-5792 bundle id when the calls were sent as one batch. |
| `plan` | `Plan` | The plan the write executed: its steps, in order, as they were submitted. |

## Errors [#errors]

| Error | Codes | When |
| --- | --- | --- |
| [`InvalidInputError`](/docs/reference/errors/invalid-input-error) | [`INVALID_NAME`](/docs/reference/errors/INVALID_NAME), [`INVALID_ADDRESS`](/docs/reference/errors/INVALID_ADDRESS), [`DURATION_TOO_SHORT`](/docs/reference/errors/DURATION_TOO_SHORT) | invalid input. |
| [`NameStateError`](/docs/reference/errors/name-state-error) | [`NAME_NOT_RENEWABLE`](/docs/reference/errors/NAME_NOT_RENEWABLE) | a name is neither registered nor in its grace period. |
| [`InsufficientFundsError`](/docs/reference/errors/insufficient-funds-error) | [`INSUFFICIENT_TOKEN_BALANCE`](/docs/reference/errors/INSUFFICIENT_TOKEN_BALANCE) | the signer cannot pay in the payment token. |
| [`UnsupportedError`](/docs/reference/errors/unsupported-error) | [`PAYMENT_TOKEN_UNSUPPORTED`](/docs/reference/errors/PAYMENT_TOKEN_UNSUPPORTED), [`UNSUPPORTED_ON_DEPLOYMENT`](/docs/reference/errors/UNSUPPORTED_ON_DEPLOYMENT) | an unaccepted token or without ENSv2. |
| [`ConfigError`](/docs/reference/errors/config-error) | [`WALLET_NOT_CONFIGURED`](/docs/reference/errors/WALLET_NOT_CONFIGURED) | no signing account is known. |
| [`UserRejectedError`](/docs/reference/errors/user-rejected-error) | [`USER_REJECTED`](/docs/reference/errors/USER_REJECTED) | the user rejects the request. |
| [`WalletError`](/docs/reference/errors/wallet-error) | [`CHAIN_MISMATCH`](/docs/reference/errors/CHAIN_MISMATCH), [`ACCOUNT_NOT_FOUND`](/docs/reference/errors/ACCOUNT_NOT_FOUND) | the wallet is on another chain or has no account to sign with. |
| [`UnsupportedError`](/docs/reference/errors/unsupported-error) | [`WALLET_BATCH_UNSUPPORTED`](/docs/reference/errors/WALLET_BATCH_UNSUPPORTED) | with `mode: "batch"` or a paymaster when the wallet cannot send calls as one batch. |

It can also fail with the errors every write can (`Errors.WriteError`: the common errors plus `InsufficientFundsError`, `TransactionError`, `UnsupportedError`, `UserRejectedError`, `WalletError`).

See [How errors work](/docs/sdk/errors-explained).

## Examples [#examples]

<Tabs groupId="api" items={["Client","Standalone","Effect"]} persist>
<Tab>
```ts title="Renewing names"
const { hash } = await ens.registration.renew({ names: ["alice.eth", "bob.eth"], duration: 31536000n })
```
</Tab>

<Tab>
```ts title="Renewing names with a standalone call"
import { Actions } from "@ensforge/sdk"

await Actions.registration.renew(ens, { names: ["alice.eth", "bob.eth"], duration: 31536000n })
```
</Tab>

<Tab>
```ts title="Renewing names in an Effect program"
import { Actions } from "@ensforge/sdk/effect"

yield* Actions.registration.renew(ens, { names: ["alice.eth", "bob.eth"], duration: 31536000n })
```
</Tab>
</Tabs>

## Plan methods [#plan-methods]

Each method takes the same options as `registration.renew` and sends nothing. See [Preview before sending](/docs/sdk/preview-before-sending).

| Method | Description |
| --- | --- |
| `registration.renew.prepare(options)` | Builds the plan without sending anything. |
| `registration.renew.simulate(options)` | Simulates the plan with `eth_call`, reporting each step. |
| `registration.renew.estimateGas(options)` | Estimates the gas and ETH the plan needs. |

## Wait for the receipt with `renewSync` [#wait-for-the-receipt-with-renewsync]

Renews one or more `.eth` names, ENSv1 or ENSv2, paying in an ERC-20 token. Resolves once the receipt is in.

Use when the next step depends on the change being on-chain.

`registration.renewSync` takes the same options plus [`confirmations` and `timeout`](/docs/reference/sdk/client#sync-options).

Resolves to `renewSync.ReturnType`. Receipts, the new expiry of each name and the amount paid.

<Tabs groupId="api" items={["Client","Standalone","Effect"]} persist>
<Tab>
```ts title="Renewing names and waiting"
const { receipt } = await ens.registration.renewSync({ names: ["alice.eth", "bob.eth"], duration: 31536000n })
```
</Tab>

<Tab>
```ts title="Waiting with a standalone call"
import { Actions } from "@ensforge/sdk"

await Actions.registration.renewSync(ens, { names: ["alice.eth", "bob.eth"], duration: 31536000n })
```
</Tab>

<Tab>
```ts title="Waiting in an Effect program"
import { Actions } from "@ensforge/sdk/effect"

yield* Actions.registration.renewSync(ens, { names: ["alice.eth", "bob.eth"], duration: 31536000n })
```
</Tab>
</Tabs>

## See also [#see-also]

- [`registration.getRenewalPrice`](/docs/reference/sdk/registration/get-renewal-price) to quote it