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.

101 lines (100 loc) 3.78 kB
import { StructuredTool, ToolParams } from '@langchain/core/tools'; import { z } from 'zod'; import { HCS10Client } from '../hcs10/HCS10Client'; import { IStateManager } from '../state/state-types'; export interface FeeDefinition { amount: number; collectorAccount?: string; } export interface TokenFeeDefinition extends FeeDefinition { tokenId: string; } export interface ConnectionMonitorToolParams extends ToolParams { hcsClient: HCS10Client; stateManager: IStateManager; } /** * A tool for monitoring incoming connection requests and accepting them with optional fee settings. */ export declare class ConnectionMonitorTool extends StructuredTool { name: string; description: string; schema: z.ZodObject<{ acceptAll: z.ZodOptional<z.ZodBoolean>; targetAccountId: z.ZodOptional<z.ZodString>; hbarFees: z.ZodOptional<z.ZodArray<z.ZodObject<{ amount: z.ZodNumber; collectorAccount: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { amount: number; collectorAccount?: string | undefined; }, { amount: number; collectorAccount?: string | undefined; }>, "many">>; tokenFees: z.ZodOptional<z.ZodArray<z.ZodObject<{ amount: z.ZodNumber; tokenId: z.ZodString; collectorAccount: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { amount: number; tokenId: string; collectorAccount?: string | undefined; }, { amount: number; tokenId: string; collectorAccount?: string | undefined; }>, "many">>; exemptAccountIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; monitorDurationSeconds: z.ZodOptional<z.ZodNumber>; defaultCollectorAccount: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { hbarFees?: { amount: number; collectorAccount?: string | undefined; }[] | undefined; tokenFees?: { amount: number; tokenId: string; collectorAccount?: string | undefined; }[] | undefined; exemptAccountIds?: string[] | undefined; targetAccountId?: string | undefined; acceptAll?: boolean | undefined; monitorDurationSeconds?: number | undefined; defaultCollectorAccount?: string | undefined; }, { hbarFees?: { amount: number; collectorAccount?: string | undefined; }[] | undefined; tokenFees?: { amount: number; tokenId: string; collectorAccount?: string | undefined; }[] | undefined; exemptAccountIds?: string[] | undefined; targetAccountId?: string | undefined; acceptAll?: boolean | undefined; monitorDurationSeconds?: number | undefined; defaultCollectorAccount?: string | undefined; }>; private hcsClient; private stateManager; private logger; private isMonitoring; private listConnectionsTool; constructor({ hcsClient, stateManager, ...rest }: ConnectionMonitorToolParams); updateClient(newClient: HCS10Client): void; protected _call({ acceptAll, targetAccountId, hbarFees, tokenFees, exemptAccountIds, monitorDurationSeconds, defaultCollectorAccount, }: z.infer<this['schema']>): Promise<string>; private createFeeConfig; private extractAccountId; private acceptConnectionRequest; private formatFeeString; /** * Updates the ConnectionsManager with latest connection data * This method is meant to be called when changes to connections happen * outside this tool's monitoring process */ update(): void; }