helius_get_minimum_balance_for_rent_exemption
Calculate the minimum SOL balance required for an account of a given data size to be rent-exempt on Solana. Avoid paying rent by ensuring your account meets the exemption threshold.
Instructions
Get the minimum balance required for rent exemption
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dataSize | Yes | ||
| commitment | No |
Implementation Reference
- src/handlers/helius.ts:227-234 (handler)Main handler function that calls Helius SDK to get minimum balance for rent exemption based on dataSize and optional commitment.
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/handlers/helius.types.ts:114-117 (schema)TypeScript type definition for the input parameters (dataSize required, commitment optional).
export type GetMinimumBalanceForRentExemptionInput = { dataSize: number; commitment?: "confirmed" | "finalized" | "processed"; } - src/tools.ts:177-188 (registration)Tool definition in the tools array with name, description, and inputSchema.
{ 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)Handler mapping in the handlers dictionary that links the tool name to the handler function.
"helius_get_minimum_balance_for_rent_exemption": getMinimumBalanceForRentExemptionHandler, - src/tools.ts:16-16 (helper)Import of the handler from the handlers file (part of the registration chain).
getMinimumBalanceForRentExemptionHandler,