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

indexer.getPrimaryName

Reads an address's primary name from the indexer, verified on-chain when the indexer can. Options, result, errors and examples for indexer.getPrimaryName.

ReadBatchablestable
Since v1.0.0View source

Reads an address's primary name from the indexer, verified on-chain when the indexer can.

When to use

Use to label many accounts quickly; for an authoritative read, use primaryName.get.

Details

  • name is the verified answer when there is one, otherwise the indexed one; source says which.
  • Every answer the indexer gave is in answers, with its status.

Signature

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

Call it as ens.indexer.getPrimaryName(options) on a client, or Actions.indexer.getPrimaryName(client, options).

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

Parameters

OptionTypeDefaultDescription
namespaceNamespaceOnly this naming system; every namespace the indexer serves when omitted.
source"indexed" | "verified"Both, verified first, when omitted.
address (required)stringThe address, all lowercase or checksummed.
coinCoinType.InputChain of the primary name, as a coin type. @default 60 (Ethereum)

Also takes the read options.

Returns

Resolves to Result<IndexedPrimaryName>. The primary name (null when none) and every answer.

Errors

ErrorCodesWhen
InvalidInputErrorINVALID_ADDRESS, INVALID_COIN_TYPEinvalid input.
ConfigErrorINDEXER_NOT_CONFIGUREDthe client has no indexer.
IndexerErrorINDEXER_UNSUPPORTEDthe indexer does not serve the query or its namespace.
IndexerErrorINDEXER_UNAVAILABLE, INDEXER_RATE_LIMITED, INDEXER_BEHIND, INDEXER_REQUEST_REJECTED, INDEXER_RESPONSE_INVALIDthe indexer is unavailable, rate limiting, behind, rejects the request or answers unexpectedly.

It can also fail with the errors every read can (Errors.CommonError: ConfigError, ContractRevertError, InternalError, NetworkError).

See How errors work.

Examples

Reading a primary name
const { name } = await ens.indexer.getPrimaryName({ address: "0xb8c2…" })

Example response

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

await ens.indexer.getPrimaryName({ address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" })
{
  "address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
  "coinType": 60,
  "namespace": "ens",
  "name": "vitalik.eth",
  "source": "verified",
  "answers": [
    {
      "source": "indexed",
      "status": "notFound",
      "name": null,
      "reason": null
    },
    {
      "source": "verified",
      "status": "ok",
      "name": "vitalik.eth",
      "reason": null
    }
  ],
  "asOf": {
    "chainId": 1,
    "blockNumber": "26443964n",
    "blockHash": "0xe75c58ea2f28bd7c6cc53c28a5ab4fc02023f3563661f0a7236a36b779e3ac86",
    "timestamp": "1795029143n"
  },
  "snapshots": {
    "1": {
      "chainId": 1,
      "blockNumber": "26443964n",
      "blockHash": "0xe75c58ea2f28bd7c6cc53c28a5ab4fc02023f3563661f0a7236a36b779e3ac86",
      "timestamp": "1795029143n"
    }
  },
  "asOfToken": "7b22657468657265756d223a7b22626c6f636b5f68617368223a22307865373563353865613266323862643763366363353363323861356162346663303230323366333536333636316630613732333661333662373739653361633836222c22626c6f636b5f6e756d626572223a32363434333936342c22636861696e5f6964223a22657468657265756d2d6d61696e6e6574222c2274696d657374616d70223a22323032362d31312d31385431393a31323a32335a227d7d",
  "completeness": "full",
  "unsupportedReason": null,
  "unsupportedFields": [],
  "origin": null,
  "indexer": "bigname"
}

See also

Was this page helpful?