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

62 lines (59 loc) 2.68 kB
import { z } from "zod"; import { BaseHCS6QueryTool } from "./standards-agent-kit.es30.js"; import { isWalletBytesResponse } from "./standards-agent-kit.es50.js"; const RegisterDynamicHashinalSchema = z.object({ metadata: z.record(z.unknown()).describe("Metadata object for the hashinal (e.g., name, description, attributes)"), data: z.object({ base64: z.string().optional().describe("Base64 encoded data for the hashinal"), url: z.string().optional().describe("URL to fetch data from"), mimeType: z.string().optional().describe("MIME type of the data") }).optional().describe("Data to inscribe with the hashinal"), memo: z.string().optional().describe("Optional memo for the registration"), ttl: z.number().min(3600).default(86400).describe("Time-to-live in seconds for the inscription"), registryTopicId: z.string().optional().describe("Registry topic ID to use. If not provided, a new registry will be created"), submitKey: z.string().optional().describe("Submit key for the registry (required if registry has a submit key)") }); class RegisterDynamicHashinalTool extends BaseHCS6QueryTool { constructor(params) { super(params); this.name = "registerDynamicHashinal"; this.description = "Create and register a new dynamic hashinal that can be updated over time"; } get specificInputSchema() { return RegisterDynamicHashinalSchema; } async executeQuery(params, _runManager) { const result = await this.hcs6Builder.register({ metadata: params.metadata, data: params.data, memo: params.memo, ttl: params.ttl, registryTopicId: params.registryTopicId, submitKey: params.submitKey }); if (!("success" in result) || !result.success) { throw new Error(result.error || "Failed to register dynamic hashinal"); } if (isWalletBytesResponse(result)) { const txBytes = result.transactionBytes; return { message: "I prepared an unsigned transaction to register a dynamic hashinal. Please review and approve to submit.", transactionBytes: txBytes, metadata: { transactionBytes: txBytes, pendingApproval: true, description: `Register dynamic hashinal${params.memo ? ` (Memo: ${params.memo})` : ""}` } }; } return `Successfully registered dynamic hashinal! Registry Topic ID: ${result.registryTopicId} Inscription Topic ID: ${result.inscriptionTopicId}${params.memo ? ` Memo: ${params.memo}` : ""} The dynamic hashinal has been created and can be updated using the registry topic ID.`; } } export { RegisterDynamicHashinalTool }; //# sourceMappingURL=standards-agent-kit.es32.js.map