Domain Resolver
This query loads both the assigned resolver and the ENSIP-10 effective resolver for a name.
query DomainResolver($name: InterpretedName!) { domain(by: { name: $name }) { resolver { # the Resolver explicitly assigned to this Domain assigned { contract { address } } # the Resolver that ENS Forward Resolution (ENSIP-10) actually lands # on for this Domain — i.e. its effective Resolver effective { contract { address } } } }}{ "name": "jesse.base.eth"}{ "data": { "domain": { "resolver": { "assigned": { "contract": { "address": "0xc6d566a56a1aff6508b41f6c90ff131615583bcd" } }, "effective": { "contract": { "address": "0xde9049636f4a1dfe0a64d1bfe3155c0a14c54f31" } } } } }}Output matches a point in time snapshot GraphQL response from our alpha ENSNode instance. Live output depends on the configuration of your ENSNode instance and ENS state updates.
import { createEnsNodeClient } from "enssdk/core";import { asInterpretedName } from "enssdk";import { graphql, omnigraph } from "enssdk/omnigraph";
const client = createEnsNodeClient({ url: process.env.ENSNODE_URL || "https://api.alpha.ensnode.io"}).extend(omnigraph);
const DomainResolverQuery = graphql(` query DomainResolver($name: InterpretedName!) { domain(by: { name: $name }) { resolver { # the Resolver explicitly assigned to this Domain assigned { contract { address } } # the Resolver that ENS Forward Resolution (ENSIP-10) actually lands # on for this Domain — i.e. its effective Resolver effective { contract { address } } } } }`);
const result = await client.omnigraph.query({ query: DomainResolverQuery, variables: { name: asInterpretedName("jesse.base.eth"), },});
if (result.errors) throw new Error(JSON.stringify(result.errors));console.log(JSON.stringify(result.data, null, 2));{ "data": { "domain": { "resolver": { "assigned": { "contract": { "address": "0xc6d566a56a1aff6508b41f6c90ff131615583bcd" } }, "effective": { "contract": { "address": "0xde9049636f4a1dfe0a64d1bfe3155c0a14c54f31" } } } } }}Output matches a point in time snapshot GraphQL response from our alpha ENSNode instance. Live output depends on the configuration of your ENSNode instance and ENS state updates.
enssdk package manager setup
# 1. Create projectmkdir -p my-ens-script/src && cd my-ens-scriptnpm init -y && touch src/index.tsnpm pkg set type=module scripts.start="tsx src/index.ts"# 2. Install dependenciesnpm install enssdk@1.15.2 && npm install -D tsx typescript @types/node# 3. Paste the TypeScript snippet above into src/index.ts# 4. RunENSNODE_URL=https://api.alpha.ensnode.io npm startSee the enssdk docs for gql.tada plugin and tsconfig setup.
import { OmnigraphProvider, useOmnigraphQuery, graphql } from "enskit/react/omnigraph";import { createEnsNodeClient } from "enssdk/core";import { asInterpretedName } from "enssdk";import { omnigraph } from "enssdk/omnigraph";
const client = createEnsNodeClient({ url: import.meta.env.VITE_ENSNODE_URL || "https://api.alpha.ensnode.io"}).extend(omnigraph);
const DomainResolverQuery = graphql(` query DomainResolver($name: InterpretedName!) { domain(by: { name: $name }) { resolver { # the Resolver explicitly assigned to this Domain assigned { contract { address } } # the Resolver that ENS Forward Resolution (ENSIP-10) actually lands # on for this Domain — i.e. its effective Resolver effective { contract { address } } } } }`);
function DomainResolverResult() { const [result] = useOmnigraphQuery({ query: DomainResolverQuery, variables: { name: asInterpretedName("jesse.base.eth"), }, }); const { data, fetching, error } = result; if (!data && fetching) return <p>Loading…</p>; if (error) return <p>Error: {error.message}</p>; if (!data) return <p>No data returned.</p>; const formatted = JSON.stringify( data, (_, value) => (typeof value === "bigint" ? value.toString() : value), 2, ); return <code>{formatted}</code>;}
export default function App() { return ( <OmnigraphProvider client={client}> <DomainResolverResult /> </OmnigraphProvider> );}{ "data": { "domain": { "resolver": { "assigned": { "contract": { "address": "0xc6d566a56a1aff6508b41f6c90ff131615583bcd" } }, "effective": { "contract": { "address": "0xde9049636f4a1dfe0a64d1bfe3155c0a14c54f31" } } } } }}Output matches a point in time snapshot GraphQL response from our alpha ENSNode instance. Live output depends on the configuration of your ENSNode instance and ENS state updates.
enskit package manager setup
# 1. Create projectnpm create vite@latest my-ens-app -- --template react-ts --no-interactive --no-immediatecd my-ens-app# 2. Install dependenciesnpm installnpm install enskit@1.15.2 enssdk@1.15.2# 3. Copy the TSX snippet above into src/App.tsx# 4. RunVITE_ENSNODE_URL=https://api.alpha.ensnode.io npm run devSee the enskit docs for gql.tada plugin and provider setup.
# POST JSON to your ENSNode Omnigraph endpoint (same path enssdk uses).curl -sS -X POST "https://api.alpha.ensnode.io/api/omnigraph" \ -H "Content-Type: application/json" \ -d '{ "query": "query DomainResolver($name: InterpretedName!) { domain(by: { name: $name }) { resolver { assigned { contract { address } } effective { contract { address } } } } }", "variables": {"name":"jesse.base.eth"}}'{ "data": { "domain": { "resolver": { "assigned": { "contract": { "address": "0xc6d566a56a1aff6508b41f6c90ff131615583bcd" } }, "effective": { "contract": { "address": "0xde9049636f4a1dfe0a64d1bfe3155c0a14c54f31" } } } } }}Output matches a point in time snapshot GraphQL response from our alpha ENSNode instance. Live output depends on the configuration of your ENSNode instance and ENS state updates.
Back to Examples