UNPKG

@hashgraphonline/hedera-agent-kit

Version:

Build LLM-powered applications that interact with the Hedera Network. Create conversational agents that can understand user requests in natural language and execute Hedera transactions, or build backend systems that leverage AI for on-chain operations.

37 lines (36 loc) 1.18 kB
import { z } from "zod"; import { BaseHederaQueryTool } from "./index20.js"; const GetBlocksZodSchema = z.object({ blockNumber: z.string().optional().describe("Filter by block number"), timestamp: z.string().optional().describe("Filter by timestamp"), limit: z.number().optional().describe("Maximum number of blocks to return"), order: z.enum(["asc", "desc"]).optional().describe("Order of results") }); class HederaGetBlocksTool extends BaseHederaQueryTool { constructor(params) { super(params); this.name = "hedera-get-blocks"; this.description = "Retrieves blocks from the Hedera network with optional filtering."; this.specificInputSchema = GetBlocksZodSchema; this.namespace = "network"; } async executeQuery(args) { this.logger.info("Getting blocks from the network"); const blocks = await this.hederaKit.query().getBlocks(args); if (blocks === null) { return { success: false, error: "Could not retrieve blocks from the network" }; } return { success: true, blocks, count: blocks.length }; } } export { HederaGetBlocksTool }; //# sourceMappingURL=index82.js.map