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

60 lines (57 loc) 2.51 kB
import { z } from "zod"; import { BaseHCS6QueryTool } from "./standards-agent-kit.es30.js"; import { isWalletBytesResponse } from "./standards-agent-kit.es50.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 BaseHCS6QueryTool { constructor(params) { super(params); this.name = "updateDynamicHashinal"; this.description = "Update an existing dynamic hashinal with new content while maintaining the same registry"; } get specificInputSchema() { return UpdateDynamicHashinalSchema; } async executeQuery(params, _runManager) { const result = await this.hcs6Builder.register({ metadata: params.metadata, data: params.data, memo: params.memo, registryTopicId: params.registryTopicId, submitKey: params.submitKey }); if (!("success" in result) || !result.success) { throw new Error(result.error || "Failed to update dynamic hashinal"); } if (isWalletBytesResponse(result)) { const txBytes = result.transactionBytes; return { message: "I prepared an unsigned transaction to update a dynamic hashinal. Please review and approve to submit.", transactionBytes: txBytes, metadata: { transactionBytes: txBytes, pendingApproval: true, description: `Update dynamic hashinal (registry ${params.registryTopicId})${params.memo ? ` (Memo: ${params.memo})` : ""}` } }; } return `Successfully updated dynamic hashinal! Registry Topic ID: ${params.registryTopicId} Inscription Topic ID: ${result.inscriptionTopicId}${params.memo ? ` Update Memo: ${params.memo}` : ""} The dynamic hashinal has been updated with new content.`; } } export { UpdateDynamicHashinalTool }; //# sourceMappingURL=standards-agent-kit.es33.js.map