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.getNamespace

Finds where a name lives outside ENS's registries: the L2 namespace that holds it (Basenames, Linea Names, Celonames, Durin, Namespace) or the off-chain.

ReadBatchablestable
Since v1.1.0View source

Finds where a name lives outside ENS's registries: the L2 namespace that holds it (Basenames, Linea Names, Celonames, Durin, Namespace) or the off-chain provider that serves it.

When to use

Use to know which chain to read a name from or send its record writes to, without reading its full state. name.get returns the same location as namespace.

Details

  • kind: "l2" names the namespace family, its parent name, the L2's chainId and the registry there that holds the name (null when the L2 could not be reached).
  • kind: "offchain" names the provider whose gateway serves the name, or null when ensforge does not know it. No gateway is contacted.
  • Returns null for names in ENS, and for names nothing serves.
  • The L2 namespaces come from the client's deployment profile (Deployments.Profile.namespaces). Durin and Namespace names cost a read on Ethereum and one on their L2.
  • A client remembers a name's location for a minute, and forgets it after its own writes.

Gotchas

  • The location says where the name would live, not that it is registered there: unclaimed.base.eth is on Base too.

Signature

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

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

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

Parameters

OptionTypeDefaultDescription
name (required)stringENS name to locate. Normalized automatically.

Also takes the read options.

Returns

Resolves to NameNamespace | null. Where the name lives, or null for names in ENS.

FieldTypeDescription
kind"l2"
parentstringThe parent name the namespace hangs off, e.g. base.eth.

Errors

ErrorCodesWhen
InvalidInputErrorINVALID_NAMEthe name is invalid or the root.
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

Finding the chain of a Basename
const namespace = await ens.name.getNamespace({ name: "jesse.base.eth" })
if (namespace?.kind === "l2") console.log(namespace.id, namespace.chainId) // "basenames" 8453

See also

Was this page helpful?