helius_get_minimum_balance_for_rent_exemption
Calculate the minimum balance needed for rent exemption on Solana based on data size and commitment level using Helius API.
Instructions
Get the minimum balance required for rent exemption
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| commitment | No | ||
| dataSize | Yes |
Input Schema (JSON Schema)
{
"properties": {
"commitment": {
"enum": [
"confirmed",
"finalized",
"processed"
],
"type": "string"
},
"dataSize": {
"type": "number"
}
},
"required": [
"dataSize"
],
"type": "object"
}
Implementation Reference
- src/handlers/helius.ts:227-234 (handler)The main handler function that implements the tool's core logic by calling the Solana RPC method getMinimumBalanceForRentExemption on the Helius connection and handling the response.export const getMinimumBalanceForRentExemptionHandler = async (input: GetMinimumBalanceForRentExemptionInput): Promise<ToolResultSchema> => { try { const minBalance = await (helius as any as Helius).connection.getMinimumBalanceForRentExemption(input.dataSize, input.commitment); return createSuccessResponse(`Minimum balance for rent exemption: ${minBalance}`); } catch (error) { return createErrorResponse(`Error getting minimum balance: ${error instanceof Error ? error.message : String(error)}`); } }
- src/tools.ts:177-188 (schema)Defines the tool's name, description, and input schema for validation.{ name: "helius_get_minimum_balance_for_rent_exemption", description: "Get the minimum balance required for rent exemption", inputSchema: { type: "object", properties: { dataSize: { type: "number" }, commitment: { type: "string", enum: ["confirmed", "finalized", "processed"] } }, required: ["dataSize"] } },
- src/tools.ts:563-563 (registration)Maps the tool name to its handler function in the central handlers dictionary."helius_get_minimum_balance_for_rent_exemption": getMinimumBalanceForRentExemptionHandler,
- src/handlers/helius.types.ts:114-117 (schema)TypeScript type definition for the handler's input parameter.export type GetMinimumBalanceForRentExemptionInput = { dataSize: number; commitment?: "confirmed" | "finalized" | "processed"; }