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.
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: falseskips this and returns the raw reverse record. coinselects the chain:"eth"(default), any EVM chain such as{ chainId: 8453 }, or"default". Chains without their own primary name fall back todefault.reverse.- Names that are not normalized are treated as unset.
- Returns
nullwhen there is no valid primary name, unlessstrictis set. Withstrict, an address whose reverse name has no resolver or name failsPRIMARY_NAME_NOT_SET; a name that does not resolve back (no resolver, no address record or another address) failsPRIMARY_NAME_MISMATCH, whosecausenames 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
| Option | Type | Default | Description |
|---|---|---|---|
address (required) | string | Address to look up. | |
coin | CoinType.Input | "default" | "eth" | Chain of the primary name: a coin symbol, { chainId }, a coin type, or "default". |
verify | boolean | true | Require 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
| Error | Codes | When |
|---|---|---|
InvalidInputError | INVALID_ADDRESS, INVALID_COIN_TYPE, INVALID_NAME | invalid input, or with strict an unnormalized name. |
NotFoundError | PRIMARY_NAME_NOT_SET, PRIMARY_NAME_MISMATCH | with strict when there is no valid primary name. |
GatewayError | GATEWAY_REQUEST_FAILED, GATEWAY_RESPONSE_INVALID, OFFCHAIN_LOOKUP_INVALID | an off-chain gateway fails. |
DnsError | a DNS name's DNSSEC proof does not verify. | |
NetworkError | RPC_REQUEST_FAILED, RPC_TIMEOUT, RATE_LIMITED | the RPC request fails. |
It can also fail with the errors every read can (Errors.CommonError: ConfigError, ContractRevertError, InternalError, NetworkError).
See How errors work.
Examples
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
primaryName.setto set it
Was this page helpful?