πŸŒ…Solana Address

Learn how to use Airstack to universally resolve and reverse resolve Solana addresses to other web3 identities (Farcaster, ENS, Lens, 0x address).

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 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 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 Web3 Social Accounts (Farcaster, Lens) and ENS Domains Resolved From Solana Address

You can resolve a Solana addresses to their web3 socials and ENS Domains (including offchain domains, e.g. Namestone & cb.id) using the Wallet API:

Try Demo

Code

query MyQuery {
  Wallet(
    input: {
      identity: "GJQUFnCu7ZJHxtxeaeskjnqyx8QFAN1PsiGuShDMPsqV"
      blockchain: ethereum
    }
  ) {
    farcaster: socials(input: { filter: { dappName: { _eq: farcaster } } }) {
      profileName
    }
    lens: socials(input: { filter: { dappName: { _eq: lens } } }) {
      profileName
    }
    domains {
      name
    }
  }
}

Get All The Solana addresses from a given ENS name

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:

Try Demo

Code

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

Get All The Solana 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 MyQuery {
  Domains(
    input: { filter: { name: { _eq: "yosephks.cb.id" } }, blockchain: ethereum }
  ) {
    Domain {
      multiChainAddresses {
        address
        symbol
      }
    }
  }
}

Get All Solana addresses of Farcaster user

You can resolve a Farcaster user to their Solana addresses by using Socials API:

Try Demo

Code

query MyQuery {
  Socials(
    input: {
      filter: { dappName: { _eq: farcaster }, profileName: { _eq: "v" } }
      blockchain: ethereum
    }
  ) {
    Social {
      connectedAddresses {
        address
        blockchain
        chainId
        timestamp
      }
    }
  }
}

Get All Solana addresses of Lens profile

You can resolve a profile to their 0x addresses by using Socials API:

Try Demo

Code

query MyQuery {
  Wallet(input: { identity: "lens/@alexj", blockchain: ethereum }) {
    farcaster: socials(input: { filter: { dappName: { _eq: farcaster } } }) {
      connectedAddresses {
        address
        chainId
        blockchain
        timestamp
      }
    }
    domains {
      multiChainAddresses {
        address
        symbol
      }
    }
  }
}

Developer Support

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

More Resources

Last updated

Was this helpful?