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
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | Base64 encoded message string | |
| commitment | No |
Implementation Reference
- src/handlers/helius.ts:508-517 (handler)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)}`); } }
- src/tools.ts:504-515 (schema)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,