This article shows how to get onchainindividual rewards
Fuul simplifies blockchain data for you. We take complex onchain information, clean it up, and present it in a format that's more readable. Projects then can choose to get the data from Fuul's indexed data, or directly from the subgraph.
Fuul's Indexed Data
Payouts for a specific Address
Rewards data is not updated in real time due to performance considerations. Recent conversions and payouts will appear on the leaderboard within a maximum of one hour.
To get the rewards use the getPayoutsLeaderboard method filtered by user address.
import{Fuul}from ('@fuul/sdk');awaitFuul.getPayoutsLeaderboard({currency_address:'0x12345',user_identifier:'0x12345',// the address of the useruser_identifier_type:'evm_address',// evm_address | solana_address | xrpl_address from:newDate('2021-01-01'),// Optionalto:newDate('2022-01-01'),// Optionaluser_type:'all',// all, affiliate or end_userconversions:'1,2,3'// Optional});
currency_address is the address of the currency on the chain that the project is distributing payouts. Remember projects can payout different tokens for different conversions.
A simple response for retrieving this information would be the following:
You can retrieve the tier and the volume information of users by adding them on the fields parameter as follows:
The referred_volume parameter will be returned in USD values.
Payouts for a specific address per conversion
To get all payouts for an address use the getUserPayoutsByConversion method.
You can also filter out dates as follows:
Payouts history for a specific address
To get all points history for an address use the getUserPayoutMovements method.
Fuul Subgraphs
Every payout reward has an onchain record on the project's FuulProject contract. This information can be retrieved from any indexer, but using our aggregated subgraphs makes it much easier.
To get the total, claimed and unclaimed rewards for a specific user and Fuul projects, use the following query.
You can also filter out by currency like this:
Please visit the Subgraph section of the documentation to get the endpoints and know more about the schema
import { Fuul } from ('@fuul/sdk');
await Fuul.getUserPayoutsByConversion({
user_identifier: '0x12345', // the address of the user
user_identifier_type: 'evm_address', // evm_address | solana_address | xrpl_address
from: new Date('2021-01-01'),
to: new Date('2022-01-01'),
});
import { Fuul } from ('@fuul/sdk');
await Fuul.getUserPayoutMovements({
user_identifier: '0x12345', // the address of the user
user_identifier_type: 'evm_address', // evm_address | solana_address | xrpl_address
from: new Date('2021-01-01'), // optional
to: new Date('2022-01-01'), // optional
});