Learn how to fetch Farcaster Moxie Rewards earned by Farcaster users, channels, and the Farcaster network. In addition, learn how to sort by the earnings to get the top earners of Moxie.
Introduction
The Moxie Protocol enables Farcaster Members to earn Everyday Rewards based on who engages with their casts. Developers can also earn rewards for each unique FID who interacts with their frames.
Get The Split Details Of Moxie Earned By Certain User
You can use the FarcasterMoxieEarningStats to fetch the split details of the total Moxie earned by a certain user entity on Moxie protocol that shows how much is distributed to the caster, the caster's fans, channel fans, and the Farcaster network token holders.
To get the split details, simply provide the FID of the user in entityId:
{"data": {"FarcasterMoxieEarningStats": {"FarcasterMoxieEarningStat": [ {"splitDetails": [ {"castEarningsAmount":2420.289836734585,"frameDevEarningsAmount":0,"otherEarningsAmount":0,// Earnings split for the caster's fans"entityType":"CREATOR_FANS" }, {"castEarningsAmount":1080.3288640185472,"frameDevEarningsAmount":0,"otherEarningsAmount":0,// Earnings split for channel fans"entityType":"CHANNEL_FANS" }, {"castEarningsAmount":7390.685564552501,"frameDevEarningsAmount":0,"otherEarningsAmount":0,// Earnings split for the caster him/herself"entityType":"CREATOR" }, {"castEarningsAmount":1210.1449183672926,"frameDevEarningsAmount":0,"otherEarningsAmount":0,// Earnings split for the Farcaster network token holder"entityType":"NETWORK" } ] } ] } }}
Top Moxie Earning Entities Based On Highest Moxie Earnings
You can fetch the top entities w/ highest Moxie earnings by specifying order.allEarnings to DESC:
Try Demo
Code
queryMyQuery { FarcasterMoxieEarningStats( input: {timeframe: LIFETIME,blockchain: ALL,filter: {entityType: {_eq: USER} # alternatively can be CHANNEL }, # Order by All earning for sorting by total earnings in # descending orderorder: {allEarnings: DESC} } ) { FarcasterMoxieEarningStat { allEarningsAmount allEarningsAmountInWei castEarningsAmount castEarningsAmountInWei entityId entityType frameDevEarningsAmount frameDevEarningsAmountInWei otherEarningsAmount otherEarningsAmountInWei timeframe } }}
{"data": {"FarcasterMoxieEarningStats": {"FarcasterMoxieEarningStat": [ {"allEarningsAmount":10136643.391825985,"allEarningsAmountInWei":"10136643391825986000000000","castEarningsAmount":51821.7356651616,"castEarningsAmountInWei":"51821735665161600000000","entityId":"336022","entityType":"USER","frameDevEarningsAmount":0,"frameDevEarningsAmountInWei":"0","otherEarningsAmount":10084821.656160824,"otherEarningsAmountInWei":"10084821656160823000000000","timeframe":"LIFETIME" },// Other top Farcaster user with most Moxie earned ] } }}
Developer Support
If you have any questions or need help regarding fetching Moxie earnings data, please join our Airstack's Telegram group.