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.
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:
unregisterin 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
| Option | Type | Default | Description |
|---|---|---|---|
name (required) | string | Full 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.
| 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
| Error | Codes | When |
|---|---|---|
InvalidInputError | INVALID_NAME | invalid input. |
NameStateError | NAME_NOT_REGISTERED, NAME_EXPIRED | the child or parent does not exist. |
NameStateError | NAME_RESERVED, NAME_UNREACHABLE | the parent is reserved or ENSv2 resolution no longer reaches it. |
UnauthorizedError | MISSING_ROLES, NOT_OWNER, FUSE_BURNED | the account may not remove it. |
ConfigError | WALLET_NOT_CONFIGURED | no signing account is known. |
UserRejectedError | USER_REJECTED | the user rejects the request. |
WalletError | CHAIN_MISMATCH, ACCOUNT_NOT_FOUND | the wallet is on another chain or has no account to sign with. |
UnsupportedError | 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.
Examples
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.
| Method | Description |
|---|---|
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.
const { receipt } = await ens.subname.removeSync({ name: "pay.alice.eth" })See also
subname.createto create it again
Was this page helpful?