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.

54 lines (53 loc) 2.06 kB
import { z } from "zod"; import { BaseHCS6TransactionTool } from "./standards-agent-kit.es27.js"; const UpdateDynamicHashinalSchema = z.object({ registryTopicId: z.string().describe("The registry topic ID that tracks this dynamic hashinal"), metadata: z.record(z.unknown()).describe("Updated metadata object for the hashinal"), data: z.object({ base64: z.string().optional().describe("Base64 encoded data for the updated hashinal"), url: z.string().optional().describe("URL to fetch updated data from"), mimeType: z.string().optional().describe("MIME type of the data") }).optional().describe("Updated data to inscribe"), memo: z.string().optional().describe('Optional memo for the update (e.g., "Level up", "Version 2.0")'), submitKey: z.string().describe("Submit key for the registry (required to update)") }); class UpdateDynamicHashinalTool extends BaseHCS6TransactionTool { constructor(params) { super(params); this.name = "updateDynamicHashinal"; this.description = "Update an existing dynamic hashinal with new content while maintaining the same registry"; this.schema = UpdateDynamicHashinalSchema; } async _call(params) { try { const result = await this.hcs6Builder.register({ metadata: params.metadata, data: params.data, memo: params.memo, registryTopicId: params.registryTopicId, submitKey: params.submitKey }); if (!result.success) { throw new Error(result.error || "Failed to update dynamic hashinal"); } return { status: "success", data: { registryTopicId: result.registryTopicId, newInscriptionTopicId: result.inscriptionTopicId, transactionId: result.transactionId, updateMemo: params.memo } }; } catch (error) { return { status: "error", message: error instanceof Error ? error.message : "Unknown error" }; } } } export { UpdateDynamicHashinalTool }; //# sourceMappingURL=standards-agent-kit.es30.js.map