Learn how to fetch user's Fan Token portfolio balances across all their wallets and vesting contracts. In addition, you will also learn how you can setup Fan Token gating for your project/application.
{
"data": {
"MoxieUserPortfolios": {
"MoxieUserPortfolio": [
{
"fanTokenAddress": "0xbe2f22ae9f1bff46a9d814395cf70bfae8ed3a86",
"fanTokenName": "betashop.eth",
"fanTokenSymbol": "fid:602",
"amount": 10000000000000000000
},
// Other Fan Tokens owned by FID 3
]
}
}
}
Check If Certain User Hold Certain Fan Token
You can check if a certain user hold a certain Fan Token in their portfolio balance by using the MoxieUserPortfolio API and inputting the user's wallet to the walletAddress input and the Fan Token symbol to the fanTokenSymbol input:
Alternatively, you can also use fid and fanTokenAddress to specify the user and Fan Token input, respectively.
Try Demo
Code
query GetPortfolioInfo {
MoxieUserPortfolios(
input: {
filter: {
walletAddress: {
# user's wallet address
_eq: "0xd7029bdea1c17493893aafe29aad69ef892b8ff2"
},
fanTokenSymbol: {
# Fan Token to check, symbol will be based on types:
# - User: fid:<FID>
# - Channel: cid:<CHANNEL-ID>
# - Network: id:farcaster
_eq: "fid:3"
}
}
}
) {
MoxieUserPortfolio {
amount: totalUnlockedAmount
}
}
}
{
"data": {
"MoxieUserPortfolios": {
"MoxieUserPortfolio": [
// If not `null`, then it indicates that the user hold the FT
{
"amount": 13020342330530892
}
]
}
}
}
Developer Support
If you have any questions or need help regarding fetching Farcaster user's Moxie Fan Token portfolio data, please join our Airstack's Telegram group.