Domain Raw Records
For given name resolve raw records like `addresses`, `texts`, `contenthash` etc.
query DomainRecords($name: InterpretedName!) { domain(by: {name: $name}) { canonical { name { interpreted } } resolve { records { addresses(coinTypes: [60, 2147483658, 501]) { coinType address } texts(keys: ["description", "avatar", "url", "com.github", "com.twitter"]) { key value } contenthash } } }}{ "name": "gregskril.eth"}{ "data": { "domain": { "canonical": { "name": { "interpreted": "gregskril.eth" } }, "resolve": { "records": { "addresses": [ { "coinType": 60, "address": "0x179a862703a4adfb29896552df9e307980d19285" }, { "coinType": 2147483658, "address": "0x179a862703a4adfb29896552df9e307980d19285" }, { "coinType": 501, "address": "0x1350bfe02357c8bc583d7514f44ba2c31821d8739160e7b79a0a94bc113a4f73" } ], "texts": [ { "key": "description", "value": "I like baking and building apps on web3 protocols." }, { "key": "avatar", "value": "https://gregskril.com/img/profile.jpg" }, { "key": "url", "value": "https://gregskril.com/" }, { "key": "com.github", "value": "gskril" }, { "key": "com.twitter", "value": "gregskril" } ], "contenthash": "0xe30101701220f0bd3d5d672c6197d341797bb34d4a5e31fbb40c437fead8756213522b976ed9" } } } }}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 DomainRecordsQuery = graphql(` query DomainRecords($name: InterpretedName!) { domain(by: {name: $name}) { canonical { name { interpreted } } resolve { records { addresses(coinTypes: [60, 2147483658, 501]) { coinType address } texts(keys: ["description", "avatar", "url", "com.github", "com.twitter"]) { key value } contenthash } } } }`);
const result = await client.omnigraph.query({ query: DomainRecordsQuery, variables: { name: asInterpretedName("gregskril.eth"), },});
if (result.errors) throw new Error(JSON.stringify(result.errors));console.log(JSON.stringify(result.data, null, 2));{ "data": { "domain": { "canonical": { "name": { "interpreted": "gregskril.eth" } }, "resolve": { "records": { "addresses": [ { "coinType": 60, "address": "0x179a862703a4adfb29896552df9e307980d19285" }, { "coinType": 2147483658, "address": "0x179a862703a4adfb29896552df9e307980d19285" }, { "coinType": 501, "address": "0x1350bfe02357c8bc583d7514f44ba2c31821d8739160e7b79a0a94bc113a4f73" } ], "texts": [ { "key": "description", "value": "I like baking and building apps on web3 protocols." }, { "key": "avatar", "value": "https://gregskril.com/img/profile.jpg" }, { "key": "url", "value": "https://gregskril.com/" }, { "key": "com.github", "value": "gskril" }, { "key": "com.twitter", "value": "gregskril" } ], "contenthash": "0xe30101701220f0bd3d5d672c6197d341797bb34d4a5e31fbb40c437fead8756213522b976ed9" } } } }}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.1 && 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 DomainRecordsQuery = graphql(` query DomainRecords($name: InterpretedName!) { domain(by: {name: $name}) { canonical { name { interpreted } } resolve { records { addresses(coinTypes: [60, 2147483658, 501]) { coinType address } texts(keys: ["description", "avatar", "url", "com.github", "com.twitter"]) { key value } contenthash } } } }`);
function DomainRecordsResult() { const [result] = useOmnigraphQuery({ query: DomainRecordsQuery, variables: { name: asInterpretedName("gregskril.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}> <DomainRecordsResult /> </OmnigraphProvider> );}{ "data": { "domain": { "canonical": { "name": { "interpreted": "gregskril.eth" } }, "resolve": { "records": { "addresses": [ { "coinType": 60, "address": "0x179a862703a4adfb29896552df9e307980d19285" }, { "coinType": 2147483658, "address": "0x179a862703a4adfb29896552df9e307980d19285" }, { "coinType": 501, "address": "0x1350bfe02357c8bc583d7514f44ba2c31821d8739160e7b79a0a94bc113a4f73" } ], "texts": [ { "key": "description", "value": "I like baking and building apps on web3 protocols." }, { "key": "avatar", "value": "https://gregskril.com/img/profile.jpg" }, { "key": "url", "value": "https://gregskril.com/" }, { "key": "com.github", "value": "gskril" }, { "key": "com.twitter", "value": "gregskril" } ], "contenthash": "0xe30101701220f0bd3d5d672c6197d341797bb34d4a5e31fbb40c437fead8756213522b976ed9" } } } }}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.1 enssdk@1.15.1# 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 DomainRecords($name: InterpretedName!) { domain(by: {name: $name}) { canonical { name { interpreted } } resolve { records { addresses(coinTypes: [60, 2147483658, 501]) { coinType address } texts(keys: [\"description\", \"avatar\", \"url\", \"com.github\", \"com.twitter\"]) { key value } contenthash } } } }", "variables": {"name":"gregskril.eth"}}'{ "data": { "domain": { "canonical": { "name": { "interpreted": "gregskril.eth" } }, "resolve": { "records": { "addresses": [ { "coinType": 60, "address": "0x179a862703a4adfb29896552df9e307980d19285" }, { "coinType": 2147483658, "address": "0x179a862703a4adfb29896552df9e307980d19285" }, { "coinType": 501, "address": "0x1350bfe02357c8bc583d7514f44ba2c31821d8739160e7b79a0a94bc113a4f73" } ], "texts": [ { "key": "description", "value": "I like baking and building apps on web3 protocols." }, { "key": "avatar", "value": "https://gregskril.com/img/profile.jpg" }, { "key": "url", "value": "https://gregskril.com/" }, { "key": "com.github", "value": "gskril" }, { "key": "com.twitter", "value": "gregskril" } ], "contenthash": "0xe30101701220f0bd3d5d672c6197d341797bb34d4a5e31fbb40c437fead8756213522b976ed9" } } } }}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