Account Domains
Performing SQL queries on the ENS Unigraph 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.
It is the name of an ENSDb Writer Schema, which is a database schema within an ENSDb instance, used to store indexed ENS data from a given ENSDb Writer instance. We use ensindexer_0 as the ENSDb Writer Schema Name in examples on this page, but your ENSDb Writer instance may be configured to use a different schema name. Make sure to replace
ensindexer_0 with the actual schema name used by your ENSDb Writer instance
when querying the ENSDb instance directly. For example, ENSIndexer allows configuring its own ENSDb Writer Schema Name with the ENSINDEXER_SCHEMA_NAME environment variable.
SELECT type, count(*) FROM ensindexer_0.domainsWHERE owner_id = '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'GROUP BY type;| # | type | count |
|---|---|---|
| 1 | ENSv1Domain | 2 |
| 2 | ENSv2Domain | 14 |
Output matches a result snapshot; live output depends on your ENSNode instance.
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, "0x70997970c51812dc3a010c7d01b50e0d17dc79c8")) .groupBy(ensIndexerSchema.domain.type);| # | type | count |
|---|---|---|
| 1 | ENSv1Domain | 2 |
| 2 | ENSv2Domain | 14 |
Output matches a result snapshot; live output depends on your ENSNode instance.