Indexer has methods for fetching single or multiple L2 subnames.

1. getL2Subname

The getL2Subname method retrieves a single subname registered on an L2 chain.

Usage

const response = await client.getL2Subname({
  chainId: 10,
  nameOrNamehash: "lucas.oppunk.eth",
});
  • chainId: The id of the target L2 network (e.g., base(8453), optimism(10), baseSepolia(84532))
  • nameOrNamehash: Name or namehash representation of an ENS name

Return Type

export interface L2SubnameResponse {
  name: string;
  namehash: string;
  label: string;
  parentNamehash: string;
  owner: string;
  texts: Record<string, string>;
  addresses: Record<string, string>;
  contenthash?: string;
  chainId: number;
  expiry: number;
  mintTransaction?: {
    price: number;
    paymentReceiver: string;
  };
}

Field Description

FieldDescription
nameFull subname (e.g., alice.oppunk.eth)
namehashENS-compatible namehash of the subname
labelThe label (left-most part) of the subname (e.g., alice)
parentNamehashNamehash of the parent domain (e.g., oppunk.eth)
ownerEthereum address of the current owner
textsMap of text records associated with the subname
addressesMap of address records (coin type → address)
contenthashContent hash (e.g., IPFS, Arweave link)
chainIdChain ID where the subname is registered (e.g., 8453 for Base, 10 for Optimism)
expiryUnix timestamp indicating when the subname will expire (0 for non-expirable subnames)
mintTransactionObject describing the minting transaction
priceMinting price in ETH
paymentReceiverEthereum address that received the mint payment (e.g., 0x1234...abcd)

2. getL2Subnames

The getL2Subnames method allows you to retrieve a paginated list of Layer 2 (L2) subnames based on various filter criteria.

Usage

// Fetch first page of subnames by owner
const byOwner = await client.getL2Subnames({
  owner: "0x123400000000000000000000000000000000abcd",
  chainId: 10,
  page: 0,
  size: 10,
});

Query Parameters

export interface GetL2SubnamesQuery {
  owner?: string;
  chainId?: number;
  page?: number;
  size?: number;
  parent?: string;
  isTestnet?: boolean;
  stringSearch?: string;
}

Return Type

export interface L2SubnamePagedResponse {
  items: L2SubnameResponse[];
  total: number;
  page: number;
  size: number;
}