helius_get_block_height
Retrieve the current block height of the Solana blockchain using commitment options (confirmed, finalized, processed) for precise blockchain data querying.
Instructions
Get the block height of the Solana blockchain
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| commitment | No |
Input Schema (JSON Schema)
{
"properties": {
"commitment": {
"enum": [
"confirmed",
"finalized",
"processed"
],
"type": "string"
}
},
"required": [],
"type": "object"
}
Implementation Reference
- src/handlers/helius.ts:64-71 (handler)The handler function that executes the core logic of the 'helius_get_block_height' tool by querying the Helius connection for the current block height.export const getBlockHeightHandler = async (input: GetBlockHeightInput): Promise<ToolResultSchema> => { try { const blockHeight = await (helius as any as Helius).connection.getBlockHeight(input.commitment); return createSuccessResponse(`Block height: ${blockHeight}`); } catch (error) { return createErrorResponse(`Error getting block height: ${error instanceof Error ? error.message : String(error)}`); } }
- src/tools.ts:46-54 (schema)Defines the tool schema including name, description, and input validation schema for the 'helius_get_block_height' tool.name: "helius_get_block_height", description: "Get the block height of the Solana blockchain", inputSchema: { type: "object", properties: { commitment: { type: "string", enum: ["confirmed", "finalized", "processed"] } }, required: [] }
- src/tools.ts:549-592 (registration)Registers the 'helius_get_block_height' tool by mapping its name to the getBlockHeightHandler function in the global handlers dictionary.export const handlers: handlerDictionary = { "helius_get_balance": getBalanceHandler, "helius_get_block_height": getBlockHeightHandler, "helius_get_token_accounts_by_owner": getTokenAccountsByOwnerHandler, "helius_get_token_supply": getTokenSupplyHandler, "helius_get_token_largest_accounts": getTokenLargestAccountsHandler, "helius_get_latest_blockhash": getLatestBlockhashHandler, "helius_get_token_account_balance": getTokenAccountBalanceHandler, "helius_get_slot": getSlotHandler, "helius_get_transaction": getTransactionHandler, // New handlers "helius_get_account_info": getAccountInfoHandler, "helius_get_program_accounts": getProgramAccountsHandler, "helius_get_signatures_for_address": getSignaturesForAddressHandler, "helius_get_minimum_balance_for_rent_exemption": getMinimumBalanceForRentExemptionHandler, "helius_get_multiple_accounts": getMultipleAccountsHandler, "helius_get_inflation_reward": getInflationRewardHandler, "helius_get_epoch_info": getEpochInfoHandler, "helius_get_epoch_schedule": getEpochScheduleHandler, "helius_get_leader_schedule": getLeaderScheduleHandler, "helius_get_recent_performance_samples": getRecentPerformanceSamplesHandler, "helius_get_version": getVersionHandler, // DAS Methods "helius_get_asset": helius.getAssetHandler, "helius_get_rwa_asset": helius.getRwaAssetHandler, "helius_get_asset_batch": helius.getAssetBatchHandler, "helius_get_asset_proof": helius.getAssetProofHandler, "helius_get_assets_by_group": helius.getAssetsByGroupHandler, "helius_get_assets_by_owner": helius.getAssetsByOwnerHandler, "helius_get_assets_by_creator": helius.getAssetsByCreatorHandler, "helius_get_assets_by_authority": helius.getAssetsByAuthorityHandler, "helius_search_assets": helius.searchAssetsHandler, "helius_get_signatures_for_asset": helius.getSignaturesForAssetHandler, "helius_get_nft_editions": helius.getNftEditionsHandler, "helius_get_token_accounts": helius.getTokenAccountsHandler, // Transaction and Fee Methods "helius_get_priority_fee_estimate": helius.getPriorityFeeEstimateHandler, "helius_poll_transaction_confirmation": helius.pollTransactionConfirmationHandler, "helius_send_jito_bundle": helius.sendJitoBundleHandler, "helius_get_bundle_statuses": helius.getBundleStatusesHandler, "helius_get_fee_for_message": getFeeForMessageHandler, "helius_execute_jupiter_swap": executeJupiterSwapHandler // "print_environment": printEnvironmentHandler, }