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": [ {"fanTokenSymbol":"fid:3","fanTokenAddress":"0xd83b15a9c8dc73f1a5ba279ea7815abf97a91fff","fanTokenName":"dwr.eth","amount":13020342330530892 },// Other Fan Tokens in portfolio by 0xd7029bdea1c17493893aafe29aad69ef892b8ff2 ] } }}
Get User's Fan Token Balances By FID
You can get a user's Fan Token portfolio balances by using the MoxieUserPortfolio API and inputting the user's FID in fid input:
{"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
queryGetPortfolioInfo { 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.