• A React Query hook for fetching a user's profile on RewardKit, containing active, claimed, and claimable boosts along with total amounts in USD.

    See useQuery from react-query

    Parameters

    • params: RewardKitProfileParams

      Object containing additional filter parameters.

      • creatorAddress

        Only show offers created by this user's address

      • claimantAddress

        Address of the claimant

      • budgetAccount

        Only show offers funded by this budget account

      • targetContract

        Only show offers with actions that target this contract address. If specifying, you must also specify chainId

      • chainId

        Only show offers with actions that target a contract on this chain ID. You must specify this if also specifying targetContract

    Returns UseQueryResult<
        {
            activeBoosts: {
                id: string;
                chainId: number;
                incentives: {
                    type: IncentiveTypeString;
                    assetAddress?: `0x${string}`;
                    rewardAmount?: string;
                    rewardAmountFormatted?: string;
                    rewardPercentage?: number;
                    maxReward?: string;
                    rewardUsdValue?: number;
                    tokenSymbol?: string;
                    tokenImageUri?: string;
                    metadata?: | null
                    | {
                        id: string;
                        chainId: number;
                        address: `0x${string}`;
                        decimals: number;
                        name: string;
                        symbol: string;
                        imageUri: string;
                    };
                }[];
                actionTemplate: | null
                | {
                    id: string;
                    actionType: string;
                    projectId: string;
                    projectImage?: string;
                };
                boostName?: null
                | string;
                tokenImageUri?: null | string;
                nftImageUri?: null | string;
                nftName?: null | string;
                status?: "active" | "claimable" | "claimed";
                txHash?: string;
                blockTimestamp?: string;
            }[];
            claimedBoosts: {
                id: string;
                chainId: number;
                incentives: {
                    type: IncentiveTypeString;
                    assetAddress?: `0x${string}`;
                    rewardAmount?: string;
                    rewardAmountFormatted?: string;
                    rewardPercentage?: number;
                    maxReward?: string;
                    rewardUsdValue?: number;
                    tokenSymbol?: string;
                    tokenImageUri?: string;
                    metadata?: | null
                    | {
                        id: string;
                        chainId: number;
                        address: `0x${string}`;
                        decimals: number;
                        name: string;
                        symbol: string;
                        imageUri: string;
                    };
                }[];
                actionTemplate: | null
                | {
                    id: string;
                    actionType: string;
                    projectId: string;
                    projectImage?: string;
                };
                boostName?: null
                | string;
                tokenImageUri?: null | string;
                nftImageUri?: null | string;
                nftName?: null | string;
                status?: "active" | "claimable" | "claimed";
                txHash?: string;
                blockTimestamp?: string;
            }[];
            claimableBoosts: {
                id: string;
                chainId: number;
                incentives: {
                    type: IncentiveTypeString;
                    assetAddress?: `0x${string}`;
                    rewardAmount?: string;
                    rewardAmountFormatted?: string;
                    rewardPercentage?: number;
                    maxReward?: string;
                    rewardUsdValue?: number;
                    tokenSymbol?: string;
                    tokenImageUri?: string;
                    metadata?: | null
                    | {
                        id: string;
                        chainId: number;
                        address: `0x${string}`;
                        decimals: number;
                        name: string;
                        symbol: string;
                        imageUri: string;
                    };
                }[];
                actionTemplate: | null
                | {
                    id: string;
                    actionType: string;
                    projectId: string;
                    projectImage?: string;
                };
                boostName?: null
                | string;
                tokenImageUri?: null | string;
                nftImageUri?: null | string;
                nftName?: null | string;
                status?: "active" | "claimable" | "claimed";
                txHash?: string;
                blockTimestamp?: string;
            }[];
            totalClaimedAmountUsd: number;
            totalClaimableAmountUsd: number;
        },
        Error,
    >

    Query result containing boost lists and USD totals

    const { data, isLoading } = useRewardKitProfile({
    creatorAddress: "0x123...",
    claimantAddress: "0x456..."
    });

    if (isLoading) return <div>Loading...</div>;

    return (
    <div>
    <p>Claimable Amount: ${data?.totalClaimableAmountUsd}</p>
    <p>Number of Active Boosts: {data?.activeBoosts.length}</p>
    </div>
    );