Skip to content

Account Domains

Load domains owned by an address via the Omnigraph `account` root field.
query AccountDomains(
  $address: Address!
) {
  account(by: { address: $address }) {
    domains {
      edges {
        node {
          label { interpreted }
          name
        }
      }
    }
  }
}
{
  "address": "0x205d2686da3bf33f64c17f21462c51b5ead462cf"
}
{
  "data": {
    "account": {
      "domains": {
        "edges": [
          {
            "node": {
              "label": {
                "interpreted": "5test"
              },
              "name": "5test.eth"
            }
          },
          {
            "node": {
              "label": {
                "interpreted": "666test"
              },
              "name": "666test.eth"
            }
          },
          {
            "node": {
              "label": {
                "interpreted": "999test"
              },
              "name": "999test.eth"
            }
          },
          {
            "node": {
              "label": {
                "interpreted": "indexerisfknworking"
              },
              "name": "indexerisfknworking.eth"
            }
          },
          {
            "node": {
              "label": {
                "interpreted": "oldnew"
              },
              "name": "oldnew.eth"
            }
          },
          {
            "node": {
              "label": {
                "interpreted": "test3wallet"
              },
              "name": "test3wallet.eth"
            }
          }
        ]
      }
    }
  }
}
# POST JSON to your ENSNode Omnigraph endpoint (same path enssdk uses).
curl -sS -X POST "https://api.v2-sepolia.ensnode.io/api/omnigraph" \
  -H "Content-Type: application/json" \
  -d @- <<'EOF'
{
  "query": "query AccountDomains( $address: Address! ) { account(by: { address: $address }) { domains { edges { node { label { interpreted } name } } } } }",
  "variables": {
    "address": "0x205d2686da3bf33f64c17f21462c51b5ead462cf"
  }
}
EOF
import { createEnsNodeClient } from "enssdk/core";
import { graphql, omnigraph } from "enssdk/omnigraph";

const client = createEnsNodeClient({ 
  url: process.env.ENSNODE_URL || "https://api.v2-sepolia.ensnode.io"
}).extend(omnigraph);

const AccountDomainsQuery = graphql(`
  query AccountDomains(
    $address: Address!
  ) {
    account(by: { address: $address }) {
      domains {
        edges {
          node {
            label { interpreted }
            name
          }
        }
      }
    }
  }
`);

const result = await client.omnigraph.query({
  query: AccountDomainsQuery,
  variables: {
    address: "0x205d2686da3bf33f64c17f21462c51b5ead462cf",
  },
});

if (result.errors) throw new Error(JSON.stringify(result.errors));
console.log(JSON.stringify(result.data, null, 2));
import { OmnigraphProvider, useOmnigraphQuery, graphql } from "enskit/react/omnigraph";
import { createEnsNodeClient } from "enssdk/core";
import { omnigraph } from "enssdk/omnigraph";

const client = createEnsNodeClient({
  url: import.meta.env.VITE_ENSNODE_URL || "https://api.v2-sepolia.ensnode.io"
}).extend(omnigraph);

const AccountDomainsQuery = graphql(`
  query AccountDomains(
    $address: Address!
  ) {
    account(by: { address: $address }) {
      domains {
        edges {
          node {
            label { interpreted }
            name
          }
        }
      }
    }
  }
`);

function AccountDomainsResult() {
  const [result] = useOmnigraphQuery({
    query: AccountDomainsQuery,
    variables: {
      address: "0x205d2686da3bf33f64c17f21462c51b5ead462cf",
    },
  });
  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}>
      <AccountDomainsResult />
    </OmnigraphProvider>
  );
}

        # 1. Create project
mkdir -p my-ens-script/src && cd my-ens-script
npm init -y && touch src/index.ts
npm pkg set type=module scripts.start="tsx src/index.ts"
# 2. Install dependencies
npm install enssdk@1.13.1 && npm install -D tsx typescript @types/node
# 3. Paste the TypeScript snippet above into src/index.ts
# 4. Run
ENSNODE_URL=https://api.v2-sepolia.ensnode.io npm start
      

        # 1. Create project
mkdir -p my-ens-script/src && cd my-ens-script
pnpm init && touch src/index.ts
pnpm pkg set type=module scripts.start="tsx src/index.ts"
# 2. Install dependencies
pnpm add enssdk@1.13.1 && pnpm add -D tsx typescript @types/node
# 3. Paste the TypeScript snippet above into src/index.ts
# 4. Run
ENSNODE_URL=https://api.v2-sepolia.ensnode.io pnpm start
      

        # 1. Create project
npm create vite@latest my-ens-app -- --template react-ts --no-interactive --no-immediate
cd my-ens-app
# 2. Install dependencies
npm install
npm install enskit@1.13.1 enssdk@1.13.1
# 3. Copy the TSX snippet above into src/App.tsx
# 4. Run
VITE_ENSNODE_URL=https://api.v2-sepolia.ensnode.io npm run dev
      

        # 1. Create project
pnpm create vite@latest my-ens-app --template react-ts --no-interactive --no-immediate
cd my-ens-app
# 2. Install dependencies
pnpm install
pnpm add enskit@1.13.1 enssdk@1.13.1
# 3. Copy the TSX snippet above into src/App.tsx
# 4. Run
VITE_ENSNODE_URL=https://api.v2-sepolia.ensnode.io pnpm run dev
      
Run in ENSAdmin
GraphQL Query
query AccountDomains(
$address: Address!
) {
account(by: { address: $address }) {
domains {
edges {
node {
label { interpreted }
name
}
}
}
}
}

Payload and transport examples

{
"address": "0x205d2686da3bf33f64c17f21462c51b5ead462cf"
}

Response is an illustrative snapshot; live data depends on your ENSNode instance. The curl tab shows a POST to https://api.v2-sepolia.ensnode.io/api/omnigraph

Back to Examples