🔑0x Address

Learn how to use Airstack to universally resolve and reverse resolve 0x addresses to Solana addresses, web3 socials (Lens & Farcaster) and ENS Domains (including offchain Namestone & cb.id).

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.

Get All Solana Addresses Connected To 0x Address

You can get all the solana addresses connected to a given 0x addresss by using the Wallet API:

Try Demo

Code

query MyQuery {
  Wallet(
    input: {identity: "0xe0235804378c31948e81441f656d826ee5998bc6", blockchain: ethereum}
  ) {
    farcaster: socials(input: {filter: {dappName: {_eq: farcaster}}}) {
      connectedAddresses { # Fetch all SOL connected addresses from Farcaster (if any)
        address
        chainId
        blockchain
        timestamp
      }
    }
    domains {
      multiChainAddresses { # Fetch all SOL address registered with ENS (if any)
        address
        symbol
      }
    }
  }
}

Get All 0x Addresses Connected To Solana Address

You can get all the 0x addresses connected to a given solana addresss by using the Wallet API:

Try Demo

Code

query MyQuery {
  Wallet(
    input: {
      identity: "GJQUFnCu7ZJHxtxeaeskjnqyx8QFAN1PsiGuShDMPsqV"
      blockchain: ethereum
    }
  ) {
    addresses
  }
}

Get All Web3 Social Accounts (Lens, Farcaster) and ENS Domains Resolved From An Array of 0x addresses

You can resolve an array of 0x addresses to their web3 socials and ENS Domains (including offchain domains, e.g. Namestone & cb.id) using the Socials and Domains API:

Try Demo

Code

query MyQuery {
  # Get All Web3 socials (Lens/Farcaster)
  Socials(
    input: {
      filter: {
        identity: {
          _in: ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"]
        }
      },
      blockchain: ethereum
    }
  ) {
    Social {
      userAssociatedAddresses
      dappName
      profileName
    }
  }
  # Get All ENS domains, including offchain Namestone & cb.id
  Domains(
    input: {
      filter: {
        resolvedAddress: {
          _in: ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"]
        }
      },
      blockchain: ethereum
    }
  ) {
    Domain {
      resolvedAddress
      name
      isPrimary
    }
  }
}

Get All The 0x addresses from a given ENS name(s)

You can get the 0x addresses of ENS names by using the Domains API:

Try Demo

Code

query GetUserDetailsFromENS {
  Domains(
    input: {
      filter: {
        name: {
          # Add more ENS Domains into the array
          _in: ["vitalik.eth"]
        }
      },
      blockchain: ethereum
    }
  ) {
    Domain {
      resolvedAddress
      name
    }
  }
}

Get All The 0x addresses from a given Namestone Subdomain or cb.id (Offchain)

You can get the 0x addresses of offchain domains (Namestone/cb.id) by using the Domains API:

Try Demo

Code

query GetCbDotID {
  Domains(
    input: {
      filter: {
        name: {
          # Add more namestone subdomains/cb.ids into the array
          _in: ["yosephks.cb.id"]
        }
      },
      blockchain: ethereum
    }
  ) {
    Domain {
      resolvedAddress
      name
    }
  }
}

Get All 0x addresses of Lens profile(s)

You can resolve an array of Lens profile(s) to their 0x addresses by using Socials API:

Try Demo

Code

query GetAddressesOfLens {
  Socials(
    input: {
      filter: {
        identity: { _in: ["lens/@nader", "lens_id:0x0187b3"] }
        dappName: { _eq: lens }
      }
      blockchain: ethereum
    }
  ) {
    Social {
      profileName
      profileTokenId
      profileTokenIdHex
      userAssociatedAddresses
    }
  }
}

Get All 0x addresses of Farcaster user(s)

You can resolve an array of Farcaster user(s) to their 0x addresses by using Socials API:

Try Demo

Code

query GetAddressesOfFarcasters {
  Socials(
    input: {
      filter: {
        identity: {
          # Add more Farcaster fname or fid into the array
          _in: ["fc_fname:dwr.eth", "fc_fid:1"]
        }
      }
      blockchain: ethereum
    }
  ) {
    Social {
      userAssociatedAddresses
    }
  }
}

Developer Support

If you have any questions or need help regarding resolving 0x address(es), please join our Airstack's Telegram group.

More Resources

Last updated

Was this helpful?

#946:

Change request updated