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

73 lines (72 loc) 2.95 kB
import { z } from "zod"; import { BaseHCS10TransactionTool } from "./standards-agent-kit.es10.js"; const ConnectionMonitorZodSchema = z.object({ acceptAll: z.boolean().optional().describe( "Whether to automatically accept all incoming connection requests. Default is false." ), targetAccountId: z.string().optional().describe( "If provided, only accept connection requests from this specific account ID." ), hbarFees: z.array( z.object({ amount: z.number(), collectorAccount: z.string().optional() }) ).optional().describe( "Array of HBAR fee amounts to charge per message (with optional collector accounts)." ), tokenFees: z.array( z.object({ amount: z.number(), tokenId: z.string(), collectorAccount: z.string().optional() }) ).optional().describe( "Array of token fee amounts and IDs to charge per message (with optional collector accounts)." ), exemptAccountIds: z.array(z.string()).optional().describe( "Array of account IDs to exempt from ALL fees set in this request." ), monitorDurationSeconds: z.number().optional().describe( "How long to monitor for incoming requests in seconds. Default is 120." ), defaultCollectorAccount: z.string().optional().describe( "Default account to collect fees if not specified at the fee level. Defaults to the agent account." ) }); class ConnectionMonitorTool extends BaseHCS10TransactionTool { constructor(params) { super(params); this.name = "monitor_connections"; this.description = "Monitors for incoming connection requests and accepts them with optional fee settings. Use this to watch for connection requests and accept them, optionally setting HBAR or token fees on the connection. Note: When acceptAll=true, this tool requires multiple transactions and cannot be used in returnBytes mode."; this.specificInputSchema = ConnectionMonitorZodSchema; this.neverScheduleThisTool = true; this.requiresMultipleTransactions = true; } async callBuilderMethod(builder, specificArgs) { const hcs10Builder = builder; await hcs10Builder.monitorConnections({ ...specificArgs.acceptAll !== void 0 && { acceptAll: specificArgs.acceptAll }, ...specificArgs.targetAccountId !== void 0 && { targetAccountId: specificArgs.targetAccountId }, ...specificArgs.monitorDurationSeconds !== void 0 && { monitorDurationSeconds: specificArgs.monitorDurationSeconds }, hbarFees: specificArgs.hbarFees || [], tokenFees: specificArgs.tokenFees || [], ...specificArgs.exemptAccountIds !== void 0 && { exemptAccountIds: specificArgs.exemptAccountIds }, ...specificArgs.defaultCollectorAccount !== void 0 && { defaultCollectorAccount: specificArgs.defaultCollectorAccount } }); } } export { ConnectionMonitorTool }; //# sourceMappingURL=standards-agent-kit.es17.js.map