Onchain Data Solana Resolve IdentitiesLearn how to use Airstack to universally resolve and reverse resolve Solana addresses to other web3 identities (Farcaster, ENS, and 0x address).
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 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 Response
Copy query MyQuery {
Wallet(
input: {
identity: "GJQUFnCu7ZJHxtxeaeskjnqyx8QFAN1PsiGuShDMPsqV"
blockchain: ethereum
}
) {
addresses
}
}
Copy {
"data": {
"Wallet": {
"addresses": ["0xe0235804378c31948e81441f656d826ee5998bc6"]
}
}
}
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 Response
Copy 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
}
}
}
}
Copy {
"data": {
"Wallet": {
"farcaster": [
{
"connectedAddresses": [ // No SOL address connected in FC
{
"address": "0xe0235804378c31948e81441f656d826ee5998bc6",
"chainId": "1",
"blockchain": "ethereum",
"timestamp": "2023-07-04T18:54:04Z"
}
]
}
],
"domains": [
{
"multiChainAddresses": [
{
// This is the SOL address registered by user in ENS
"address": "GJQUFnCu7ZJHxtxeaeskjnqyx8QFAN1PsiGuShDMPsqV",
"symbol": "SOL"
},
{
"address": "0xe0235804378c31948E81441f656D826eE5998Bc6",
"symbol": "ETH"
}
]
}
]
}
}
}
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 Response
Copy 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
}
}
}
Copy {
"data": {
"Wallet": {
"farcaster": [
{
"profileName": "alexjcomeau.eth"
}
],
"lens": [
{
"profileName": "lens/@alexj"
}
],
"domains": [
{
"name": "alexjcomeau.eth"
}
]
}
}
}
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 Response
Copy query GetUserDetailsFromENS {
Domains(
input: {
filter: { name: { _eq: "alexjcomeau.eth" } }
blockchain: ethereum
}
) {
Domain {
multiChainAddresses {
address
symbol
}
}
}
}
Copy {
"data": {
"Domains": {
"Domain": [
{
"multiChainAddresses": [
{
"address": "0xe0235804378c31948E81441f656D826eE5998Bc6",
"symbol": "ETH"
},
{
// This is the SOL address registered by user in ENS
"address": "GJQUFnCu7ZJHxtxeaeskjnqyx8QFAN1PsiGuShDMPsqV",
"symbol": "SOL"
}
]
}
]
}
}
}
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 Response
Copy query MyQuery {
Domains(
input: { filter: { name: { _eq: "yosephks.cb.id" } }, blockchain: ethereum }
) {
Domain {
multiChainAddresses {
address
symbol
}
}
}
}
Copy {
"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"
}
]
}
]
}
}
}
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 Response
Copy query MyQuery {
Socials(
input: {
filter: { dappName: { _eq: farcaster }, profileName: { _eq: "v" } }
blockchain: ethereum
}
) {
Social {
connectedAddresses {
address
blockchain
chainId
timestamp
}
}
}
}
Copy {
"data": {
"Socials": {
"Social": [
{
"connectedAddresses": [
{
"address": "9t92xZy9q5SyfKBH4rZwEDFXjaZKgzj5PgviPhKtBjyy",
"blockchain": "solana",
"chainId": "900",
"timestamp": "2024-02-16T22:13:14Z"
},
{
"address": "0x91031dcfdea024b4d51e775486111d2b2a715871",
"blockchain": "ethereum",
"chainId": "1",
"timestamp": "2023-04-28T17:42:20Z"
},
{
"address": "0x182327170fc284caaa5b1bc3e3878233f529d741",
"blockchain": "ethereum",
"chainId": "1",
"timestamp": "2023-07-26T20:46:33Z"
}
]
}
]
}
}
}
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 4 months ago