Account Domains
Using the Unigraph SQL requires that you have the unigraph plugin activated in your ENSNode instance. Learn more
Count the Domains owned by an address, grouped by Domain type (ENSv1Domain vs ENSv2Domain) — a single query spanning both protocol versions. See Connect for setup.
The ENSIndexer Schema is a
database schema within an ENSDb instance, used to store indexed ENS data from a given ENSIndexer instance. We use ensindexer_0 as the ENSIndexer Schema Name in examples on this page, but your ENSIndexer instance may be configured to use a different schema name. Make sure to replace ensindexer_0 with the actual schema name used by your ENSIndexer instance when querying the ENSDb instance directly.
SELECT type, count(*) FROM ensindexer_0.domainsWHERE owner_id = '0xd8da6bf26964af9d7eed9e03e53415d37aa96045'GROUP BY type;Result
[
{
"type": "ENSv1Domain",
"count": 454
}
]
See how to connect to ENSDb and get access to the
ensDb query builder and ensIndexerSchema
schema definition in the Connect section if you haven't
already.
import { count, eq } from "drizzle-orm";
const counts = await ensDb .select({ type: ensIndexerSchema.domain.type, count: count() }) .from(ensIndexerSchema.domain) .where(eq(ensIndexerSchema.domain.ownerId, "0xd8da6bf26964af9d7eed9e03e53415d37aa96045")) .groupBy(ensIndexerSchema.domain.type);Result
[
{
"type": "ENSv1Domain",
"count": 454
}
]