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

approval.getToken

Reads the address approved to transfer one ENSv1 name token (getApproved). Parameters, return value, errors and examples for approval.getToken in @ensforge/sdk.

ReadBatchablestable
Since v1.0.0View source

Reads the address approved to transfer one ENSv1 name token (getApproved).

When to use

Use to check a pending single-name approval, e.g. before listing a name for sale.

Details

  • Wrapped names use the NameWrapper token; unwrapped .eth names the BaseRegistrar token.
  • ENSv2 names have no single-token approval; use operators.

Signature

function getToken(client: Like, options: getToken.Options): Promise<getToken.ReturnType>

Call it as ens.approval.getToken(options) on a client, or Actions.approval.getToken(client, options).

approval.getToken.request(options) builds a deferred read for Actions.batch. See Look up many at once.

Parameters

OptionTypeDefaultDescription
name (required)stringENS name. Normalized automatically.

Also takes the read options.

Returns

Resolves to Address | null. The approved address, or null.

Errors

ErrorCodesWhen
InvalidInputErrorINVALID_NAMEthe name cannot be normalized.
UnsupportedErrorUNSUPPORTED_PROTOCOLENSv2 names and unwrapped subnames.
NetworkErrorRPC_REQUEST_FAILED, RPC_TIMEOUT, RATE_LIMITEDthe RPC request fails.

It can also fail with the errors every read can (Errors.CommonError: ConfigError, ContractRevertError, InternalError, NetworkError).

See How errors work.

Examples

Reading a name's approval
const approved = await ens.approval.getToken({ name: "alice.eth" })

See also

Was this page helpful?