@agentek/tools
Version:
Blockchain tools for AI agents
62 lines • 2.09 kB
TypeScript
import { type WalletClient, type Transport, type Chain, type Account, Address, Hex } from "viem";
import { z } from "zod";
export interface BaseTool {
name: string;
description: string;
parameters: z.ZodObject<any, any, any, any>;
execute: (client: AgentekClient, args: any) => Promise<any>;
supportedChains?: Chain[];
}
export interface Op {
target: Address;
value: string;
data: Hex;
}
interface RequestIntent {
intent: string;
ops: Op[];
chain: number;
}
interface CompletedIntent {
intent: string;
ops: Op[];
chain: number;
hash: string;
}
export type Intent = RequestIntent | CompletedIntent;
export interface AgentekClientConfig {
transports: Transport[];
chains: Chain[];
accountOrAddress: Account | Address;
tools: BaseTool[];
}
export declare class AgentekClient {
private publicClients;
private walletClients;
private tools;
private chains;
private accountOrAddress;
constructor(config: AgentekClientConfig);
getAddress(): Promise<Address>;
getPublicClient(chainId?: number): any;
getPublicClients(): Map<number, any>;
getWalletClient(chainId?: number): WalletClient | undefined;
getWalletClients(): Map<number, WalletClient>;
getChains(): Chain[];
getTools(): Map<string, BaseTool>;
filterSupportedChains(supportedChains: Chain[], chainId?: number): Chain[];
addTools(tools: BaseTool[]): void;
executeOps(ops: Op[], chainId: number): Promise<string>;
execute(method: string, args: any): Promise<any>;
}
export declare function createAgentekClient(config: AgentekClientConfig): AgentekClient;
export declare function createTool<T extends z.ZodObject<any, any, any, any>>({ name, description, parameters, execute, supportedChains, }: {
name: string;
description: string;
parameters: T;
execute: (client: AgentekClient, args: z.infer<T>) => Promise<any>;
supportedChains?: Chain[];
}): BaseTool;
export declare function createToolCollection(tools: BaseTool[]): BaseTool[];
export {};
//# sourceMappingURL=client.d.ts.map