Skip to main content
Glama

helius_get_inflation_reward

Retrieve inflation rewards for Solana addresses by specifying addresses, epoch, and commitment level to analyze staking returns.

Instructions

Get inflation rewards for a list of addresses

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressesYes
epochNo
commitmentNo

Implementation Reference

  • Main handler function implementing the tool logic: validates addresses, calls Helius RPC getInflationReward, and formats response.
    export const getInflationRewardHandler = async (input: GetInflationRewardInput): Promise<ToolResultSchema> => {
      try {
        const addresses = [];
        for (const addr of input.addresses) {
          const result = validatePublicKey(addr);
          if (!(result instanceof PublicKey)) {
            return result; // Return the error response if any address is invalid
          }
          addresses.push(result);
        }
        
        const rewards = await (helius as any as Helius).connection.getInflationReward(addresses, input.epoch, input.commitment);
        return createSuccessResponse(`Inflation rewards: ${JSON.stringify(rewards, null, 2)}`);
      } catch (error) {
        return createErrorResponse(`Error getting inflation rewards: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • MCP tool schema definition including input validation schema for the tool.
    {
      name: "helius_get_inflation_reward",
      description: "Get inflation rewards for a list of addresses",
      inputSchema: {
        type: "object",
        properties: {
          addresses: { 
            type: "array",
            items: { type: "string" }
          },
          epoch: { type: "number" },
          commitment: { type: "string", enum: ["confirmed", "finalized", "processed"] }
        },
        required: ["addresses"]
      }
    },
  • src/tools.ts:565-565 (registration)
    Tool registration mapping the name to its handler function in the handlers dictionary.
    "helius_get_inflation_reward": getInflationRewardHandler,
  • TypeScript interface defining the input shape for the handler, used for type safety.
    export type GetInflationRewardInput = {
      addresses: string[];
      epoch?: number;
      commitment?: "confirmed" | "finalized" | "processed";
    }
  • src/tools.ts:18-18 (registration)
    Import of the handler function from handlers/helius.ts.
    getInflationRewardHandler,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dcSpark/mcp-server-helius'

If you have feedback or need assistance with the MCP directory API, please join our Discord server