description | layout | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn how to use Airstack to universally resolve and reverse resolve ENS, Namestone, and cb.id to other web3 identities (Farcaster 0x address, Solana address). |
|
Airstack provides easy-to-use APIs for enriching ENS applications and for integrating on-chain ENS data and off-chain data from Namestone and cb.id.
In this guide you will learn how to use Airstack to:
- Get ENS from a given user(s)
- Get the 0x address, Lens, and Farcaster from a given ENS name(s)
- Get the 0x address, Lens, and Farcaster from a given cb.id (Offchain)
- Get the 0x address, Lens, and Farcaster from a given Namestone Subdomain (Offchain)
- Get All The Solana addresses from a given ENS name
- Get All The Solana addresses from a given Namestone Subdomain or cb.id (Offchain)
- An Airstack account
- Basic knowledge of GraphQL
If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:
{% tabs %} {% tab title="npm" %} React
npm install @airstack/airstack-react
Node
npm install @airstack/node
{% endtab %}
{% tab title="yarn" %} React
yarn add @airstack/airstack-react
Node
yarn add @airstack/node
{% endtab %}
{% tab title="pnpm" %} React
pnpm install @airstack/airstack-react
Node
pnpm install @airstack/node
{% endtab %}
{% tab title="pip" %}
pip install airstack
{% endtab %} {% endtabs %}
Then, add the following snippets to your code:
{% tabs %} {% tab title="React" %}
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>;
}
};
{% endtab %}
{% tab title="Node" %}
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);
{% endtab %}
{% tab title="Python" %}
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())
{% endtab %} {% endtabs %}
To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.
You can get all the ENS names and offchain domains (Namestone & cb.id) of a given user, both primary and non-primary names, by providing either 0x addresses, Solana addresses, Farcaster or Lens profile:
{% embed url="https://app.airstack.xyz/query/SkTlH3Lh3I" %} Show me the ENS of 0x4b70d04124c2996de29e0caa050a49822faec6cc, GJQUFnCu7ZJHxtxeaeskjnqyx8QFAN1PsiGuShDMPsqV, lens/@stani, fc_fname:vbuterin {% endembed %}
{% tabs %} {% tab title="Query" %}
query GetENS {
Domains(
input: {
filter: {
owner: {
_in: [
"0x4b70d04124c2996de29e0caa050a49822faec6cc"
"GJQUFnCu7ZJHxtxeaeskjnqyx8QFAN1PsiGuShDMPsqV"
"lens/@stani"
"fc_fname:vbuterin"
]
}
}
blockchain: ethereum
}
) {
Domain {
name
isPrimary
resolvedAddress
}
}
}
{% endtab %}
{% tab title="Response" %}
{
"data": {
"Domains": {
"Domain": [
{
"name": "skynft.eth",
"isPrimary": false,
"resolvedAddress": ""
},
{
"name": "quantumexchange.eth",
"isPrimary": false,
"resolvedAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
},
{
"name": "vitalik.daohall.eth",
"isPrimary": false,
"resolvedAddress": ""
},
// Other ENS domains
}
]
}
}
}
{% endtab %} {% endtabs %}
You can get the 0x address, Lens, and Farcaster of ENS names:
{% embed url="https://app.airstack.xyz/query/LAFfZPgdlt" %} show me the 0x address, Lens, Farcaster of vitalik.eth {% endembed %}
{% tabs %} {% tab title="Query" %}
query GetUserDetailsFromENS {
Domains(
input: { filter: { name: { _in: ["vitalik.eth"] } }, blockchain: ethereum }
) {
Domain {
resolvedAddress
resolvedAddressDetails {
socials {
profileName
dappName
}
}
}
}
}
{% endtab %}
{% tab title="Response" %}
{
"data": {
"Domains": {
"Domain": [
{
"resolvedAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"resolvedAddressDetails": {
"socials": [
{
"profileName": "vitalik.eth",
"dappName": "farcaster"
},
{
"profileName": "lens/@vitalik",
"dappName": "lens"
}
]
}
}
]
}
}
}
{% endtab %} {% endtabs %}
You can get the 0x address, Lens, and Farcaster of cb.ids:
{% embed url="https://app.airstack.xyz/query/OLqqmKXrqj" %} Show me the 0x address, Lens, and Farcaster of yosephks.cb.id {% endembed %}
{% tabs %} {% tab title="Query" %}
query GetCbDotID {
Domains(
input: {
filter: { name: { _in: ["yosephks.cb.id"] } }
blockchain: ethereum
}
) {
Domain {
resolvedAddress
resolvedAddressDetails {
socials {
profileName
dappName
}
}
}
}
}
{% endtab %}
{% tab title="Response" %}
{
"data": {
"Domains": {
"Domain": [
{
"resolvedAddress": "0xc7486219881c780b676499868716b27095317416",
"resolvedAddressDetails": {
"socials": [
{
"profileName": "lens/@yosephks",
"dappName": "lens"
},
{
"profileName": "yosephks.eth",
"dappName": "farcaster"
}
]
}
}
]
}
}
}
{% endtab %} {% endtabs %}
You can get the 0x address, Lens, and Farcaster of Namestone subdomains:
{% embed url="https://app.airstack.xyz/query/tYYXAwIXUu" %} Show me the 0x address, Lens, and Farcaster of namestone.testbrand.eth {% endembed %}
{% tabs %} {% tab title="Query" %}
query GetNamestone {
Domains(
input: {
filter: { name: { _in: ["namestone.testbrand.eth"] } }
blockchain: ethereum
}
) {
Domain {
resolvedAddress
resolvedAddressDetails {
socials {
profileName
dappName
}
}
}
}
}
{% endtab %}
{% tab title="Response" %}
{
"data": {
"Domains": {
"Domain": [
{
"resolvedAddress": "0x57632ba9a844af0ab7d5cdf98b0056c8d87e3a85",
"resolvedAddressDetails": {
"socials": [
{
"profileName": "heeroyuy",
"dappName": "farcaster"
}
]
}
}
]
}
}
}
{% endtab %} {% endtabs %}
You can get the Solana addresses of ENS names by using the Domains
API and checking through the registered multichainAddresses
field that has symbol
equal to SOL:
{% embed url="https://app.airstack.xyz/query/UHJdGOCe1r" %} Show me alexjcomeau.eth's multichain SOL address {% endembed %}
{% tabs %} {% tab title="Query" %}
query GetUserDetailsFromENS {
Domains(
input: {
filter: { name: { _eq: "alexjcomeau.eth" } }
blockchain: ethereum
}
) {
Domain {
multiChainAddresses {
address
symbol
}
}
}
}
{% endtab %}
{% tab title="Response" %}
{
"data": {
"Domains": {
"Domain": [
{
"multiChainAddresses": [
{
"address": "0xe0235804378c31948E81441f656D826eE5998Bc6",
"symbol": "ETH"
},
{
// This is the SOL address registered by user in ENS
"address": "GJQUFnCu7ZJHxtxeaeskjnqyx8QFAN1PsiGuShDMPsqV",
"symbol": "SOL"
}
]
}
]
}
}
}
{% endtab %} {% endtabs %}
You can get the 0x addresses of offchain domains (Namestone/cb.id) by using the Domains
API:
{% embed url="https://app.airstack.xyz/query/E2MMhhm4ql" %} Show me yosephks.cb.id's multichain SOL address {% endembed %}
{% tabs %} {% tab title="Query" %}
query MyQuery {
Domains(
input: { filter: { name: { _eq: "yosephks.cb.id" } }, blockchain: ethereum }
) {
Domain {
multiChainAddresses {
address
symbol
}
}
}
}
{% endtab %}
{% tab title="Response" %}
{
"data": {
"Domains": {
"Domain": [
{
"multiChainAddresses": [
{
"address": "bc1qetgl5rx3uuhxek7erfc3wh97m3xkshx8pkdpr5",
"symbol": "BTC"
},
{
"address": "DETcngVSTXVbetWmRo9kdQe7xD9F19uqWk",
"symbol": "DOGE"
},
{
"address": "0xc7486219881C780B676499868716B27095317416",
"symbol": "ETH"
},
{
"address": "ltc1qwsqc8y09w59yqvlwy9c4fkqxu5md33vsr2uak6",
"symbol": "LTC"
},
{
// This is the SOL address connected to yosephks.cb.id (offchain)
"address": "HyrNmmmce9W3rDdTQcZHyYvhuxPN6AaY3mVJcS9f4AZw",
"symbol": "SOL"
}
]
}
]
}
}
}
{% endtab %} {% endtabs %}
If you have any questions or need help regarding resolving ENS name(s), please join our Airstack's Telegram group.