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

subname.remove

Removes a subname. Parameters, return value, errors and examples for subname.remove in @ensforge/sdk. Options, result, errors and examples for subname.remove.

Writestable
Since v1.0.0View source

Removes a subname. Resolves once the transaction is submitted.

When to use

Use to take back a name you gave out, or to drop your own subname. Use removeSync to wait for the receipt.

Details

  • ENSv2: unregister in the parent's subregistry, which also clears the child's resolver and subregistry so nothing carries over to a later owner.
  • ENSv1: owner and resolver are set to zero, from the parent when the signer owns it or is its operator, otherwise as the child's owner. Under an unwrapped parent the registry clears a wrapped child, which unwraps it.

Gotchas

  • Emancipated children (ENSv1 parentCannotControl, or an emancipated ENSv2 subregistry) cannot be removed by their parent.

Signature

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

Call it as ens.subname.remove(options) on a client, or Actions.subname.remove(client, options).

Parameters

OptionTypeDefaultDescription
name (required)stringFull name of the child. Normalized automatically.

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_NAMEinvalid input.
NameStateErrorNAME_NOT_REGISTERED, NAME_EXPIREDthe child or parent does not exist.
NameStateErrorNAME_RESERVED, NAME_UNREACHABLEthe parent is reserved or ENSv2 resolution no longer reaches it.
UnauthorizedErrorMISSING_ROLES, NOT_OWNER, FUSE_BURNEDthe account may not remove it.
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

Removing a subname
const { hash } = await ens.subname.remove({ name: "pay.alice.eth" })

Plan methods

Each method takes the same options as subname.remove and sends nothing. See Preview before sending.

MethodDescription
subname.remove.prepare(options)Builds the plan without sending anything.
subname.remove.simulate(options)Simulates the plan with eth_call, reporting each step.
subname.remove.estimateGas(options)Estimates the gas and ETH the plan needs.

Wait for the receipt with removeSync

Removes a subname. Resolves once the receipt is in.

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

subname.removeSync takes the same options plus confirmations and timeout.

Resolves to Write.SyncResult. Receipts plus the submitted hashes and plan.

Removing a subname and waiting
const { receipt } = await ens.subname.removeSync({ name: "pay.alice.eth" })

See also

Was this page helpful?