âī¸ ENS Domain DetailsLearn 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
Basic knowledge of GraphQL
Get Started
JavaScript/TypeScript/Python
If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:
npm yarn pnpm pip
React
Copy npm install @airstack/airstack-react
Node
Copy npm install @airstack/node
React
Copy yarn add @airstack/airstack-react
Node
Copy yarn add @airstack/node
React
Copy pnpm install @airstack/airstack-react
Node
Copy pnpm install @airstack/node
Then, add the following snippets to your code:
React Node Python
Copy 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 >;
}
};
Copy import { init , fetchQuery } from "@airstack/node" ;
init ( "YOUR_AIRSTACK_API_KEY" );
const query = `YOUR_QUERY` ; // Replace with GraphQL Query
const { data , error } = await fetchQuery (query);
console .log ( "data:" , data);
console .log ( "error:" , error);
Copy import asyncio
from airstack . execute_query import AirstackClient
api_client = AirstackClient (api_key = "YOUR_AIRSTACK_API_KEY" )
query = """YOUR_QUERY""" # Replace with GraphQL Query
async def main ():
execute_query_client = api_client . create_execute_query_object (
query = query)
query_response = await execute_query_client . execute_query ()
print (query_response.data)
asyncio . run ( main ())
Other Programming Languages
To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.
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 Response
Copy query MyQuery {
Domains(
input: { filter : { name : { _eq : "vitalik.eth" } }, blockchain : ethereum }
) {
Domain {
manager
managerDetails {
addresses
domains {
isPrimary
name
}
socials {
profileName
dappName
}
xmtp {
isXMTPEnabled
}
}
}
}
}
Copy {
"data" : {
"Domains" : {
"Domain" : [
{
"manager" : "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" ,
"managerDetails" : {
"addresses" : [ "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" ] ,
"domains" : [
{
"isPrimary" : false ,
"name" : "quantumdapps.eth"
} ,
{
"isPrimary" : true ,
"name" : "vitalik.eth"
}
// Other ENS domains
] ,
"socials" : [
{
"profileName" : "vitalik.eth" ,
"dappName" : "farcaster"
} ,
{
"profileName" : "lens/@vitalik" ,
"dappName" : "lens"
}
] ,
"xmtp" : [
{
"isXMTPEnabled" : true
}
]
}
}
]
}
}
}
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 Response
Copy query MyQuery {
Domains(
input: { filter : { name : { _eq : "ens.eth" } }, blockchain : ethereum }
) {
Domain {
texts {
key
value
}
}
}
}
Copy {
"data" : {
"Domains" : {
"Domain" : [
{
"texts" : [
{
"key" : "url" ,
"value" : "https://ens.domains/"
} ,
{
"key" : "avatar" ,
"value" : "https://i.imgur.com/ga6y0c0.jpg"
} ,
{
"key" : "com.github" ,
"value" : "ensdomains"
} ,
{
"key" : "com.twitter" ,
"value" : "ensdomains"
} ,
{
"key" : "snapshot" ,
"value" : "ipns://storage.snapshot.page/registry/0xb6E040C9ECAaE172a89bD561c5F73e1C48d28cd9/ens.eth"
}
]
}
]
}
}
}
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 Response
Copy query MyQuery {
Domains(
input: { filter : { name : { _eq : "barmstrong.eth" } }, blockchain : ethereum }
) {
Domain {
multiChainAddresses {
address
symbol
}
}
}
}
Copy {
"data" : {
"Domains" : {
"Domain" : [
{
"multiChainAddresses" : [
{
// BTC address
"address" : "3BFFsrzv9npUkP53XEwf8kKLPHSu8yniaa" ,
"symbol" : "BTC"
} ,
{
// ETH address
"address" : "0x5b76f5B8fc9D700624F78208132f91AD4e61a1f0" ,
"symbol" : "ETH"
}
]
}
]
}
}
}
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 3 months ago