@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.
36 lines (35 loc) • 1.16 kB
JavaScript
import { z } from "zod";
import { BaseHederaQueryTool } from "./index20.js";
const GetContractsZodSchema = z.object({
contractId: z.string().optional().describe("Filter by specific contract ID"),
limit: z.number().optional().describe("Maximum number of contracts to return"),
order: z.enum(["asc", "desc"]).optional().describe("Order of results")
});
class HederaGetContractsTool extends BaseHederaQueryTool {
constructor(params) {
super(params);
this.name = "hedera-get-contracts";
this.description = "Retrieves contract entities from the Hedera network with optional filtering.";
this.specificInputSchema = GetContractsZodSchema;
this.namespace = "scs";
}
async executeQuery(args) {
this.logger.info("Getting contracts from the network");
const contracts = await this.hederaKit.query().getContracts(args);
if (contracts === null) {
return {
success: false,
error: "Could not retrieve contracts from the network"
};
}
return {
success: true,
contracts,
count: contracts.length
};
}
}
export {
HederaGetContractsTool
};
//# sourceMappingURL=index83.js.map