Documentation for agents: an index at /llms.txt, every docs page in one file at /llms-full.txt, and Markdown for any docs page by adding .md to its URL.

Skip to Content
ensforgeSDK

registration.renew

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.

Writestable
Since v1.0.0View source

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

When to use

Use to extend names, including names in their grace period. Use renewSync to wait for the receipt.

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

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.

Parameters

OptionTypeDefaultDescription
names (required)string | readonly string[]One or more .eth second-level names. Normalized automatically.
duration (required)bigintRenewal length in seconds.
paymentTokenPaymentToken"usdc"Token to pay with.
referrerHexReferrer recorded by the registrar: 32 bytes, or an address (left-padded).

Also takes the write options.

Returns

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

FieldTypeDescription
hashHexHash of the last transaction.
hashesreadonly Hex[]Every submitted transaction, in order.
idstringEIP-5792 bundle id when the calls were sent as one batch.
planPlanThe plan the write executed: its steps, in order, as they were submitted.

Errors

ErrorCodesWhen
InvalidInputErrorINVALID_NAME, INVALID_ADDRESS, DURATION_TOO_SHORTinvalid input.
NameStateErrorNAME_NOT_RENEWABLEa name is neither registered nor in its grace period.
InsufficientFundsErrorINSUFFICIENT_TOKEN_BALANCEthe signer cannot pay in the payment token.
UnsupportedErrorPAYMENT_TOKEN_UNSUPPORTED, UNSUPPORTED_ON_DEPLOYMENTan unaccepted token or without ENSv2.
ConfigErrorWALLET_NOT_CONFIGUREDno signing account is known.
UserRejectedErrorUSER_REJECTEDthe user rejects the request.
WalletErrorCHAIN_MISMATCH, ACCOUNT_NOT_FOUNDthe wallet is on another chain or has no account to sign with.
UnsupportedErrorWALLET_BATCH_UNSUPPORTEDwith 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.

Examples

Renewing names
const { hash } = await ens.registration.renew({ names: ["alice.eth", "bob.eth"], duration: 31536000n })

Plan methods

Each method takes the same options as registration.renew and sends nothing. See Preview before sending.

MethodDescription
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

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.

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

Renewing names and waiting
const { receipt } = await ens.registration.renewSync({ names: ["alice.eth", "bob.eth"], duration: 31536000n })

See also

Was this page helpful?