Skip to content

Ens.labelhash

Hashes ENS label.

Since ENS labels prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS labels with UTS-46 normalization before passing them to labelhash. You can use the built-in Ens.normalize function for this.

Imports

Named
import { Ens } from 'ox'

Examples

import { Ens } from 'ox'
Ens.labelhash('eth')
'0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0'

Definition

function labelhash(
  label: string,
): `0x${string}`

Source: src/Ens.ts

Parameters

label

  • Type: string

ENS label.

Return Type

ENS labelhash.

0x${string}

Error Type

Ens.labelhash.ErrorType