Skip to main content
Glama

helius_get_fee_for_message

Calculate transaction fees for Solana blockchain messages using base64-encoded data to estimate costs before execution.

Instructions

Get the fee for a serialized message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesBase64 encoded message string
commitmentNo

Implementation Reference

  • The core handler function for 'helius_get_fee_for_message'. Deserializes base64-encoded message to VersionedMessage, computes fee using Helius RPC connection.getFeeForMessage, and formats response.
    export const getFeeForMessageHandler = async (input: GetFeeForMessageInput): Promise<ToolResultSchema> => {
      try {
        const messageBytes = Buffer.from(input.message, 'base64');
        const versionedMessage = VersionedMessage.deserialize(messageBytes);
        const fee = await (helius as any as Helius).connection.getFeeForMessage(versionedMessage, input.commitment);
        return createSuccessResponse(`Fee for message: ${JSON.stringify(fee, null, 2)}`);
      } catch (error) {
        return createErrorResponse(`Error getting fee for message: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Input schema definition for the tool, specifying base64 message and optional commitment level.
    {
      name: 'helius_get_fee_for_message',
      description: 'Get the fee for a serialized message',
      inputSchema: {
        type: 'object',
        properties: {
          message: { type: 'string', description: 'Base64 encoded message string' },
          commitment: { type: 'string', enum: ['confirmed', 'finalized', 'processed'] }
        },
        required: ['message']
      }
    },
  • src/tools.ts:589-589 (registration)
    Maps the tool name 'helius_get_fee_for_message' to its handler function in the handlers dictionary.
    "helius_get_fee_for_message": getFeeForMessageHandler,

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