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

primaryName.get

Reads the primary name of an address (ENSIP-19 reverse resolution), verified against the name's address record. Errors and examples for primaryName.get.

ReadBatchablestable
Since v1.0.0View source

Reads the primary name of an address (ENSIP-19 reverse resolution), verified against the name's address record.

When to use

Use to show a name instead of an address.

Details

  • The name counts only when it resolves back to the address, so nobody can claim another account's name. verify: false skips this and returns the raw reverse record.
  • coin selects the chain: "eth" (default), any EVM chain such as { chainId: 8453 }, or "default". Chains without their own primary name fall back to default.reverse.
  • Names that are not normalized are treated as unset.
  • Returns null when there is no valid primary name, unless strict is set. With strict, an address whose reverse name has no resolver or name fails PRIMARY_NAME_NOT_SET; a name that does not resolve back (no resolver, no address record or another address) fails PRIMARY_NAME_MISMATCH, whose cause names the name or the profile that failed. A resolver that reverts without data says neither, and counts as not set.

Signature

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

Call it as ens.primaryName.get(options) on a client, or Actions.primaryName.get(client, options).

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

In React, use usePrimaryName.

Parameters

OptionTypeDefaultDescription
address (required)stringAddress to look up.
coinCoinType.Input | "default""eth"Chain of the primary name: a coin symbol, { chainId }, a coin type, or "default".
verifybooleantrueRequire the name to resolve back to the address.

Also takes the read options.

Returns

Resolves to string | null. The primary name, or null when there is no valid one.

Errors

ErrorCodesWhen
InvalidInputErrorINVALID_ADDRESS, INVALID_COIN_TYPE, INVALID_NAMEinvalid input, or with strict an unnormalized name.
NotFoundErrorPRIMARY_NAME_NOT_SET, PRIMARY_NAME_MISMATCHwith strict when there is no valid primary name.
GatewayErrorGATEWAY_REQUEST_FAILED, GATEWAY_RESPONSE_INVALID, OFFCHAIN_LOOKUP_INVALIDan off-chain gateway fails.
DnsErrora DNS name's DNSSEC proof does not verify.
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

Showing a name for an address
const name = await ens.primaryName.get({ address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" })
name // "vitalik.eth"

Example response

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

await ens.primaryName.get({ address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" })
"vitalik.eth"

See also

Was this page helpful?