UNPKG

@hashgraphonline/standards-agent-kit

Version:

A modular SDK for building on-chain autonomous agents using Hashgraph Online Standards, including HCS-10 for agent discovery and communication. https://hol.org

49 lines (46 loc) 1.86 kB
import { z } from "zod"; import { BaseHCS6QueryTool } from "./standards-agent-kit.es30.js"; import { isWalletBytesResponse } from "./standards-agent-kit.es50.js"; const CreateDynamicRegistrySchema = z.object({ ttl: z.number().min(3600).default(86400).describe("Time-to-live in seconds (minimum 3600 seconds/1 hour)"), submitKey: z.union([z.boolean(), z.string()]).optional().describe("Submit key for the registry topic. Can be boolean (use operator key) or a public key string") }); class CreateDynamicRegistryTool extends BaseHCS6QueryTool { constructor(params) { super(params); this.name = "createDynamicRegistry"; this.description = "Create a new HCS-6 dynamic registry for managing evolving content"; } get specificInputSchema() { return CreateDynamicRegistrySchema; } async executeQuery(params, _runManager) { const result = await this.hcs6Builder.createRegistry({ ttl: params.ttl, submitKey: params.submitKey }); if (!("success" in result) || !result.success) { throw new Error(result.error || "Failed to create dynamic registry"); } if (isWalletBytesResponse(result)) { const txBytes = result.transactionBytes; return { message: "I prepared an unsigned transaction to create your HCS-6 dynamic registry. Please review and approve to submit.", transactionBytes: txBytes, metadata: { transactionBytes: txBytes, pendingApproval: true, description: `Create HCS-6 dynamic registry (TTL: ${params.ttl}s)` } }; } return `Successfully created HCS-6 dynamic registry! Topic ID: ${result.topicId} TTL: ${params.ttl} seconds You can now register dynamic hashinals to this registry using the topic ID.`; } } export { CreateDynamicRegistryTool }; //# sourceMappingURL=standards-agent-kit.es31.js.map