✍️ENS Domain Details

Learn how to use Airstack to fetch the ENS domain details, such as manager, text records, and multichain addresses.

Table Of Contents

In this guide, you will learn how to use Airstack to:

Pre-requisites

  • An Airstack account

  • Basic knowledge of GraphQL

Get Started

JavaScript/TypeScript/Python

If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:

React

npm install @airstack/airstack-react

Node

npm install @airstack/node

Then, add the following snippets to your code:

import { init, useQuery } from "@airstack/airstack-react";

init("YOUR_AIRSTACK_API_KEY");

const query = `YOUR_QUERY`; // Replace with GraphQL Query

const Component = () => {
  const { data, loading, error } = useQuery(query);

  if (data) {
    return <p>Data: {JSON.stringify(data)}</p>;
  }

  if (loading) {
    return <p>Loading...</p>;
  }

  if (error) {
    return <p>Error: {error.message}</p>;
  }
};

Other Programming Languages

To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.

πŸ€– AI Natural Language​

Airstack provides an AI solution for you to build GraphQL queries to fulfill your use case easily. You can find the AI prompt of each query in the demo's caption or title for yourself to try.

Get ENS Domain Manager

You can use the Domains API to fetch the manager of an ENS domain.In Domains API, there is manager field that provide a 0x address of the ENS domain manager, but if you want to fetch more information on the manager, e.g. other ENS owned by the manager, socials (Lens & Farcaster), XMTP, token balances, etc., then use managerDetails:

Try Demo

Code

query MyQuery {
  Domains(
    input: { filter: { name: { _eq: "vitalik.eth" } }, blockchain: ethereum }
  ) {
    Domain {
      manager
      managerDetails {
        addresses
        domains {
          isPrimary
          name
        }
        socials {
          profileName
          dappName
        }
        xmtp {
          isXMTPEnabled
        }
      }
    }
  }
}

Get ENS Domain Text Record

You can use the Domains API to fetch an ENS domain text records using the texts field:

Try Demo

Code

query MyQuery {
  Domains(
    input: { filter: { name: { _eq: "ens.eth" } }, blockchain: ethereum }
  ) {
    Domain {
      texts {
        key
        value
      }
    }
  }
}

Get ENS Domain Multichain Addresses

You can use the Domains API to resolve the multichain addresses of an ENS domain, that is fetching user's address on different chain, especially non-EVM ones:

Try Demo

Code

query MyQuery {
  Domains(
    input: { filter: { name: { _eq: "barmstrong.eth" } }, blockchain: ethereum }
  ) {
    Domain {
      multiChainAddresses {
        address
        symbol
      }
    }
  }
}

Developer Support

If you have any questions or need help regarding resolving identities for ENS domain(s), please join our Airstack's Telegram group.

More Resources

Last updated

Was this helpful?