tensaikit
Version:
An autonomous DeFi AI Agent Kit on Katana enabling AI agents to plan and execute on-chain financial operations.
23 lines (22 loc) • 980 B
TypeScript
/**
* Fetches a swap quote from the SushiSwap API for a given token pair and amount.
*
* This function converts the input amount to base units using the token's decimals,
* builds the required query parameters, and then fetches a quote with slippage consideration.
*
* @param chainId - The chain ID representing the target blockchain network.
* @param args - An object containing swap parameters:
* - tokenIn: The address of the input token.
* - tokenOut: The address of the output token.
* - maxSlippage: The maximum allowed slippage percentage (e.g., 0.5 for 0.5%).
* - amount: The input amount in human-readable units (e.g., 1.5 ETH).
*
* @returns A promise resolving to the swap quote data.
* @throws Throws a formatted error if token metadata fetch or quote API call fails.
*/
export declare const fetchSwapQuote: (chainId: string, args: {
tokenIn: string;
tokenOut: string;
maxSlippage: number;
amount: number;
}) => Promise<unknown>;