UNPKG

tensaikit

Version:

An autonomous DeFi AI Agent Kit on Katana enabling AI agents to plan and execute on-chain financial operations.

46 lines (45 loc) 1.93 kB
import { z } from "zod"; import { ActionProvider } from "../actionProvider"; import { AlchemyTokenPricesBySymbolSchema } from "./schemas"; /** * Configuration options for initializing the AlchemyTokenPricesActionProvider. */ export interface AlchemyTokenPricesActionProviderConfig { /** * Alchemy API Key used for authenticating requests to the Alchemy Prices API. */ apiKey?: string; } /** * AlchemyTokenPricesActionProvider enables fetching real-time token price data * using the Alchemy Prices API, supporting lookups by token symbol or address. */ export declare class AlchemyTokenPricesActionProvider extends ActionProvider { private readonly apiKey; private readonly baseUrl; /** * Creates a new AlchemyTokenPricesActionProvider instance. * * @param config - Configuration including the Alchemy API key. Falls back to environment variable. * @throws If no valid API key is provided via config or environment. */ constructor(config?: AlchemyTokenPricesActionProviderConfig); /** * Fetches current prices for one or more tokens based on their symbols. * * @remarks * This uses Alchemy’s `tokens/by-symbol` GET endpoint and allows multiple symbols per request. * * @param args - Object containing an array of token symbols (e.g., ["ETH", "USDC"]). * @returns A formatted JSON string with price information or error details. */ tokenPricesBySymbol(args: z.infer<typeof AlchemyTokenPricesBySymbolSchema>): Promise<string>; supportsNetwork: () => boolean; } /** * Factory function to instantiate AlchemyTokenPricesActionProvider. * * @param config - Optional configuration object containing the Alchemy API key. * @returns A new initialized provider instance. */ export declare const alchemyTokenPricesActionProvider: (config?: AlchemyTokenPricesActionProviderConfig) => AlchemyTokenPricesActionProvider;