@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.
46 lines (45 loc) • 1.67 kB
JavaScript
import { z } from "zod";
import { BaseHCS6TransactionTool } from "./standards-agent-kit.es27.js";
const CreateDynamicRegistrySchema = z.object({
ttl: z.number().min(3600).default(86400).describe("Time-to-live in seconds (minimum 3600 seconds/1 hour)"),
adminKey: z.union([z.boolean(), z.string()]).optional().describe("Admin key for the registry topic. Can be boolean (use operator key) or a public key string"),
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 BaseHCS6TransactionTool {
constructor(params) {
super(params);
this.name = "createDynamicRegistry";
this.description = "Create a new HCS-6 dynamic registry for managing evolving content";
this.schema = CreateDynamicRegistrySchema;
}
async _call(params) {
try {
const result = await this.hcs6Builder.createRegistry({
ttl: params.ttl,
adminKey: params.adminKey,
submitKey: params.submitKey
});
if (!result.success) {
throw new Error(result.error || "Failed to create dynamic registry");
}
return {
status: "success",
data: {
topicId: result.topicId,
transactionId: result.transactionId,
ttl: params.ttl,
memo: `hcs-6:1:${params.ttl}`
}
};
} catch (error) {
return {
status: "error",
message: error instanceof Error ? error.message : "Unknown error"
};
}
}
}
export {
CreateDynamicRegistryTool
};
//# sourceMappingURL=standards-agent-kit.es28.js.map