• Retrieves all staking rewards for a given public key.

    Parameters

    • endpoint: string

      The Solana network endpoint to connect to.

    • pubkey: string

      The public key of the account for which to retrieve staking rewards.

    Returns Promise<RewardDataResponse>

    • A promise that resolves to a RewardDataResponse object containing the total reward amount, total balance, and individual rewards for each stake account.

    Throws

    • Throws an error if unable to fetch the stake accounts or rewards.

    Example

    const endpoint = 'https://api.mainnet-beta.solana.com';
    const publicKey = 'YourPublicKeyHere';

    try {
    const rewardData = await getAllStakeRewardsByPubkey(endpoint, publicKey);
    console.log('Stake rewards data:', rewardData);
    } catch (error) {
    console.error('Error fetching stake rewards:', error);
    }

Generated using TypeDoc