UNPKG

kiban-agent-kit

Version:

Open-source framework connecting AI agents to Katana ecosystem protocols

140 lines (139 loc) 4.11 kB
import { KibanAgentKit } from "../../agent/KibanAgentKit"; export declare const UNISWAP_V3_ROUTER: "0xE592427A0AEce92De3Edee1F18E0157C05861564"; export declare const UNISWAP_V3_QUOTER: "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6"; export declare const COMMON_TOKENS: { ETH: string; WETH: string; USDC: string; USDT: string; DAI: string; }; export declare const UNISWAP_V3_ROUTER_ABI: readonly [{ readonly inputs: readonly [{ readonly components: readonly [{ readonly internalType: "address"; readonly name: "tokenIn"; readonly type: "address"; }, { readonly internalType: "address"; readonly name: "tokenOut"; readonly type: "address"; }, { readonly internalType: "uint24"; readonly name: "fee"; readonly type: "uint24"; }, { readonly internalType: "address"; readonly name: "recipient"; readonly type: "address"; }, { readonly internalType: "uint256"; readonly name: "deadline"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "amountIn"; readonly type: "uint256"; }, { readonly internalType: "uint256"; readonly name: "amountOutMinimum"; readonly type: "uint256"; }, { readonly internalType: "uint160"; readonly name: "sqrtPriceLimitX96"; readonly type: "uint160"; }]; readonly internalType: "struct ISwapRouter.ExactInputSingleParams"; readonly name: "params"; readonly type: "tuple"; }]; readonly name: "exactInputSingle"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: "amountOut"; readonly type: "uint256"; }]; readonly stateMutability: "payable"; readonly type: "function"; }]; export declare const UNISWAP_V3_QUOTER_ABI: readonly [{ readonly inputs: readonly [{ readonly internalType: "address"; readonly name: "tokenIn"; readonly type: "address"; }, { readonly internalType: "address"; readonly name: "tokenOut"; readonly type: "address"; }, { readonly internalType: "uint24"; readonly name: "fee"; readonly type: "uint24"; }, { readonly internalType: "uint256"; readonly name: "amountIn"; readonly type: "uint256"; }, { readonly internalType: "uint160"; readonly name: "sqrtPriceLimitX96"; readonly type: "uint160"; }]; readonly name: "quoteExactInputSingle"; readonly outputs: readonly [{ readonly internalType: "uint256"; readonly name: "amountOut"; readonly type: "uint256"; }]; readonly stateMutability: "nonpayable"; readonly type: "function"; }]; export interface SwapParams { tokenIn: string; tokenOut: string; amount: string; slippagePercentage?: number; recipient?: string; } export interface SwapQuote { tokenIn: { address: string; symbol: string; decimals: number; amount: string; }; tokenOut: { address: string; symbol: string; decimals: number; amount: string; }; executionPrice: string; minimumAmountOut: string; priceImpact: string; } export interface SwapResult { hash: string; tokenIn: string; tokenOut: string; amountIn: string; expectedAmountOut: string; } /** * Service for token swapping using Uniswap V3 */ export declare class SwapService { private agent; constructor(agent: KibanAgentKit); /** * Helper to normalize token addresses (handle ETH vs WETH) */ private normalizeTokenAddress; /** * Get a quote for swapping tokens */ getSwapQuote(params: SwapParams): Promise<SwapQuote>; /** * Execute a token swap */ swapTokens(params: SwapParams): Promise<SwapResult>; }