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

name.getLabel

Recovers a label from its labelhash through the ENSv2 LabelStore. Parameters, return value, errors and examples for name.getLabel in @ensforge/sdk.

ReadBatchablestable
Since v1.0.0View source

Recovers a label from its labelhash through the ENSv2 LabelStore.

When to use

Use to display names that arrive as hashes, such as [af2c…].eth from events or indexers.

Details

  • ENSv2 registries store every label they register, so this covers every ENSv2 name.
  • Returns null when the LabelStore has never seen the label.

Signature

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

Call it as ens.name.getLabel(options) on a client, or Actions.name.getLabel(client, options).

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

Parameters

OptionTypeDefaultDescription
labelhash (required)HexKeccak-256 hash of the label, as from Name.labelhash.

Also takes the read options.

Returns

Resolves to string | null. The label, or null when unknown.

Errors

ErrorCodesWhen
InvalidInputErrorINVALID_RECORD_VALUElabelhash is not 32 bytes.
UnsupportedErrorUNSUPPORTED_ON_DEPLOYMENTwithout an ENSv2 deployment.
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

Recovering a label
const label = await ens.name.getLabel({ labelhash: "0x5d5727cb0fb76e4944eafb88ec9a3cf0b3c9025a4b2f947729137c5d7f84f68f" })

Example response

Recorded from Ethereum mainnet on 2026-11-18 at block 26443964. Values change as the chain does.

await ens.name.getLabel({ labelhash: "0xaf2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc" })
"vitalik"

Was this page helpful?