You can fetch the Farcaster profile's connected addresses of a 0x address by using the Socials API and provide the 0x address to the identity filter input and all the connected addresses will be returned in the userAssociatedAddresses field:
Get Farcaster User's Followers and Following Counts
You can fetch the Farcaster profile's connected addresses of a 0x address by using the Socials API and provide the 0x address to the identity filter input.
The number of people following and people followed by the given Farcaster profile will be returned in the followerCount and followingCount, respectively:
You can fetch all the users following 0x address on Farcaster by using the SocialFollowers API and provide the 0x address to the identity filter input:
You can fetch all the users being followed by 0x address on Farcaster by using the SocialFollowings API and provide the 0x address to the identity filter input:
You can fetch Farcaster user's historical NFT balances and their time series data at a specified time by using Snapshots API and providing the given Farcaster user's 0x address to the owner input and specifying tokenType with the token type ERC721 and ERC1155:
For fetching historical NFT balances data from multiple chains, check out Cross-Chain Queries.
Try Demo
Code
queryMyQuery { Snapshots( input: {filter: {owner: {_eq: "0xD7029BDEa1c17493893AAfE29AAD69EF892B8ff2" },date: {_eq: "2023-08-18"} # Specifying date to Aug 18, 2023tokenType: {_in: [ERC721, ERC1155]} },blockchain: ethereum,limit: 200 } ) { Snapshot { tokenAddress tokenId tokenType token { name symbol isSpam } tokenNft { contentValue { image { extraSmall large medium original small } } } startBlockNumber startBlockTimestamp endBlockNumber endBlockTimestamp } }}
{"data": {"Snapshots": {"Snapshot": [ {"tokenAddress":"0x2dec96736e7d24e382e25d386457f490ae64889e","tokenId":"1570","tokenType":"ERC721","token": {"name":"Peacefall","symbol":"PF","isSpam":false },"tokenNft": {"contentValue": {"image": { "extraSmall": "https://assets.airstack.xyz/image/nft/pL4M7vP0WKi6EzxauXahZ3bnHOWqaDGo1gQv53MH7J/WW6v19vhKaQ9tTSsZS9nzP9ipEmB0+c+aeAlAf9RGMA==/extra_small.gif",
"large": "https://assets.airstack.xyz/image/nft/pL4M7vP0WKi6EzxauXahZ3bnHOWqaDGo1gQv53MH7J/WW6v19vhKaQ9tTSsZS9nzP9ipEmB0+c+aeAlAf9RGMA==/large.gif",
"medium": "https://assets.airstack.xyz/image/nft/pL4M7vP0WKi6EzxauXahZ3bnHOWqaDGo1gQv53MH7J/WW6v19vhKaQ9tTSsZS9nzP9ipEmB0+c+aeAlAf9RGMA==/medium.gif",
"original": "https://assets.airstack.xyz/image/nft/pL4M7vP0WKi6EzxauXahZ3bnHOWqaDGo1gQv53MH7J/WW6v19vhKaQ9tTSsZS9nzP9ipEmB0+c+aeAlAf9RGMA==/original_image.gif",
"small": "https://assets.airstack.xyz/image/nft/pL4M7vP0WKi6EzxauXahZ3bnHOWqaDGo1gQv53MH7J/WW6v19vhKaQ9tTSsZS9nzP9ipEmB0+c+aeAlAf9RGMA==/small.gif"
} } },"startBlockNumber":14450519,"startBlockTimestamp":"2022-03-24T18:12:38Z","endBlockNumber":-1,// -1 implies that the token is no longer held"endBlockTimestamp":"2024-01-15T15:42:14Z" },// Other historical Ethereum NFT balances ever held ] } }}
Get Historical ERC20 Token Balance of Farcaster User
You can fetch Farcaster user's historical ERC20 token balances and their time series data at a specified time by using Snapshots API and providing the given Farcaster user's 0x address to the owner input and specifying tokenType with the token type ERC20:
For fetching historical ERC20 token balances data from multiple chains, check out Cross-Chain Queries.
Try Demo
Code
queryMyQuery { Snapshots( input: {filter: {owner: {_eq: "0xD7029BDEa1c17493893AAfE29AAD69EF892B8ff2" },date: {_eq: "2023-08-18"} # Specifying date to Aug 18, 2023tokenType: {_in: [ERC20]} },blockchain: ethereum,limit: 200 } ) { Snapshot { tokenAddress token { name symbol isSpam } startBlockNumber startBlockTimestamp endBlockNumber endBlockTimestamp } }}
{"data": {"Snapshots": {"Snapshot": [ {"tokenAddress":"0x3ebd76b25a453252ca6b61334ed6f156bf5dd928","token": {"name":"pudgy.looksrare.team","symbol":"pudgy.looksrare.team","isSpam":false },"startBlockNumber":15566321,"startBlockTimestamp":"2022-09-19T08:17:35Z","endBlockNumber":-1,// -1 implies that the token is no longer held"endBlockTimestamp":"2024-01-15T15:37:28Z" }, {"tokenAddress":"0xd13017c013ae2eb708c4fcdb70b20d16ba3b64a9","token": {"name":"os20.io","symbol":"Opensea","isSpam":false },"startBlockNumber":15675664,"startBlockTimestamp":"2022-10-04T15:28:47Z","endBlockNumber":-1,// -1 implies that the token is no longer held"endBlockTimestamp":"2024-01-15T15:37:28Z" },// Other historical Ethereum ERC20 token balances ever held ], } }}
Get NFT Mints By A Farcaster User
You can fetch all NFTs minted by a Farcaster user across multiple chains, such as Ethereum, Base, Degen Chain, and other Airstack-supported chains, by using the TokenTransfers API:
For fetching NFT mints data from multiple chains, check out Cross-Chain Queries.
Try Demo
Code
queryMyQuery { TokenTransfers( input: {filter: { # Only get mints that are executed by the same Farcaster useroperator: {_eq: "0xeaf55242a90bb3289dB8184772b0B98562053559"}, # Mints are token transfers that has null address as `from`from: {_eq: "0x0000000000000000000000000000000000000000"}, # Set this to the Farcaster user that receive the token mintsto: {_eq: "0xeaf55242a90bb3289dB8184772b0B98562053559"}, # Get only NFTs (ERC721/1155)tokenType: {_in: [ERC721, ERC1155]}, },blockchain: ethereum,order: {blockTimestamp: DESC} } ) { TokenTransfer { blockchain formattedAmount tokenAddress tokenId tokenNft { metaData { name } contentValue { image { medium } } } tokenType } }}
{"data": {"TokenTransfers": {"TokenTransfer": [ {"blockchain":"ethereum","formattedAmount":1,"tokenAddress":"0x0f92612c5f539c89dc379e8aa42e3ba862a34b7e","tokenId":"8","tokenNft": {"metaData": {"name":"Venture Club Alpha Membership NFT" },"contentValue": {"image": { "medium": "https://assets.uat.airstack.xyz/image/nft/li5d4XIGDPxtahI+EMjNmOiSymdFmCR0OsRC2p13nDaZQijmEYVpYlbV0t57GD8K/medium.jpg"
} } },"tokenType":"ERC721" }// Other Ethereum NFTs minted by 0xeaf55242a90bb3289dB8184772b0B98562053559 ] } }}
Get ERC20 Token Mints By A Farcaster User
You can fetch all ERC20 tokens minted by a Farcaster user across multiple chains, such as Ethereum, Base, Degen Chain, and other Airstack-supported chains, by using the TokenTransfers API:
For fetching ERC20 mints data from multiple chains, check out Cross-Chain Queries.
Try Demo
Code
queryMyQuery { TokenTransfers( input: {filter: { # Only get mints that are executed by the same Farcaster useroperator: {_eq: "0xB59Aa5Bb9270d44be3fA9b6D67520a2d28CF80AB"}, # Mints are token transfers that has null address as `from`from: {_eq: "0x0000000000000000000000000000000000000000"}, # Set this to the Farcaster user that receive the token mintsto: {_eq: "0xB59Aa5Bb9270d44be3fA9b6D67520a2d28CF80AB"}, # Get only ERC20 tokenstokenType: {_eq: ERC20}, },blockchain: polygon,order: {blockTimestamp: DESC} } ) { TokenTransfer { blockchain formattedAmount tokenAddress token { name } } }}
{"data": {"TokenTransfers": {"TokenTransfer": [ {"blockchain":"polygon","formattedAmount":0.01697896348647009,"tokenAddress":"0xadbf1854e5883eb8aa7baf50705338739e558e5b","token": {"name":"Uniswap V2" } }// Other ERC20 tokens minted by ipeciura.eth on Polygon ] } }}
Get Token Transfers Sent From A Farcaster User
You can fetch all token transfers sent by a given Farcaster user across multiple chains, such as Ethereum, Base, Degen Chain, and other Airstack-supported chains, by using the TokenTransfers API:
For fetching token transfers data sent from a Farcaster user from multiple chains, check out Cross-Chain Queries.
Try Demo
Code
queryGetTokenTransfers { TokenTransfers( input: {filter: { # Only get token transfers from 0xeaf55242a90bb3289dB8184772b0B98562053559from: {_eq: "0xeaf55242a90bb3289dB8184772b0B98562053559"}, # Only get token transfers with non-zero amountformattedAmount: {_gt: 0}, # Remove all minting/burning + self-transfer_nor: {from: {_in: ["0x0000000000000000000000000000000000000000","0x000000000000000000000000000000000000dEaD" ] },to: {_in: ["0x0000000000000000000000000000000000000000","0x000000000000000000000000000000000000dEaD","0xeaf55242a90bb3289dB8184772b0B98562053559" ] } } },blockchain: ethereum,limit: 50 } ) { TokenTransfer { formattedAmount tokenType token { name } } }}
{"data": {"TokenTransfers": {"TokenTransfer": [ {"formattedAmount":25,"tokenType":"ERC20","token": {"name":"USD Coin" } }, {"formattedAmount":25,"tokenType":"ERC20","token": {"name":"USD Coin" } }// Other token transfers from 0xeaf55242a90bb3289dB8184772b0B98562053559 on Ethereum ] } }}
Get Token Transfers Received By A Farcaster User
You can fetch all token transfers received by a given Farcaster user across multiple chains, such as Ethereum, Base, Degen Chain, and other Airstack-supported chains, by using the TokenTransfers API:
For fetching token transfers data received by a Farcaster user from multiple chains, check out Cross-Chain Queries.
Try Demo
Code
queryGetTokenTransfers { TokenTransfers( input: {filter: { # Only get token transfers to 0xeaf55242a90bb3289dB8184772b0B98562053559to: {_eq: "0xeaf55242a90bb3289dB8184772b0B98562053559"}, # Only get token transfers with non-zero amountformattedAmount: {_gt: 0}, # Remove all minting/burning + self-transfer_nor: {from: {_in: ["0x0000000000000000000000000000000000000000","0x000000000000000000000000000000000000dEaD","0xeaf55242a90bb3289dB8184772b0B98562053559" ] },to: {_in: ["0x0000000000000000000000000000000000000000","0x000000000000000000000000000000000000dEaD" ] } } },blockchain: ethereum,limit: 50 } ) { TokenTransfer { formattedAmount tokenType token { name } } }}
{"data": {"TokenTransfers": {"TokenTransfer": [ {"formattedAmount":1,"tokenType":"ERC721","token": {"name":"ETHGlobal Pragma Lisbon" } }, {"formattedAmount":0.00005,"tokenType":"ERC20","token": {"name":"Wrapped Ether" } }// Other Token Transfers received by 0xeaf55242a90bb3289dB8184772b0B98562053559 on Ethereum ] } }}
Get All Farcaster Users Whose Names Start With Certain Terms (auto-complete)
You can fetch all Farcaster users that starts with given words by providing the regex pattern "^<given-words>" to the _regex operator in Socials API:
Try Demo
Code
queryMyQuery { Socials( input: {filter: { # This regex pattern will search all Farcaster users # starting with "a"profileName: {_regex: "^a"},dappName: {_eq: farcaster} },blockchain: ethereum } ) { Social { dappName profileName } }}
{"data": {"Socials": {"Social": [ {"dappName":"farcaster","profileName":"atty" }, {"dappName":"farcaster","profileName":"anita-mpf" }, {"dappName":"farcaster","profileName":"amarraghu" }// Other Farcaster users starting with "a" ] } }}
Get All Farcaster Users Whose Names Contain Certain Terms (auto-complete)
You can fetch all Farcaster users that contains given words by providing "<given-words>" directly to the _regex operator in Socials API:
Try Demo
Code
queryMyQuery { Socials( input: {filter: { # This regex pattern will search all Farcaster users # containing "abc"profileName: {_regex: "abc"},dappName: {_eq: farcaster} },blockchain: ethereum } ) { Social { dappName profileName } }}
{"data": {"Socials": {"Social": [ {"dappName":"farcaster","profileName":"abcabc" }, {"dappName":"farcaster","profileName":"krabchinski" }, {"dappName":"farcaster","profileName":"861213abcc" }// Other Farcaster users containing with "abc" ] } }}
Next Steps
To further enrich and improve the user experience for your Farcaster application, you can use Airstack to fetch a user's onchain contacts, which will provide all the users that have onchain connection to you, e.g. Farcaster followers/following, attended the same POAP events, holder of the same token, etc.