@coinbase/agentkit
Version:
Coinbase AgentKit core primitives
58 lines (57 loc) • 2.1 kB
TypeScript
import { z } from "zod";
import { ActionProvider } from "../actionProvider";
import { Network } from "../../network";
import { GetSwapPriceSchema, ExecuteSwapSchema } from "./schemas";
import { EvmWalletProvider } from "../../wallet-providers";
/**
* Configuration for the ZeroXActionProvider.
*/
export interface ZeroXActionProviderConfig {
/**
* The API key to use for 0x API requests.
*/
apiKey?: string;
}
/**
* 0x API Action Provider for token swaps.
* Requires a 0x API key.
*/
export declare class ZeroXActionProvider extends ActionProvider<EvmWalletProvider> {
#private;
/**
* Constructor for the ZeroXActionProvider.
*
* @param config - Configuration for the provider.
*/
constructor(config: ZeroXActionProviderConfig);
/**
* Gets a price quote for swapping one token for another.
*
* @param walletProvider - The wallet provider to get information from.
* @param args - The input arguments for the action.
* @returns A message containing the price quote.
*/
getSwapPrice(walletProvider: EvmWalletProvider, args: z.infer<typeof GetSwapPriceSchema>): Promise<string>;
/**
* Executes a token swap using the 0x API.
*
* @param walletProvider - The wallet provider to use for the swap.
* @param args - The input arguments for the action.
* @returns A message containing the result of the swap.
*/
executeSwap(walletProvider: EvmWalletProvider, args: z.infer<typeof ExecuteSwapSchema>): Promise<string>;
/**
* Checks if the ZeroX action provider supports the given network.
*
* @param network - The network to check.
* @returns True if the ZeroX action provider supports the network, false otherwise.
*/
supportsNetwork: (network: Network) => boolean;
}
/**
* Creates a new ZeroXActionProvider with the provided configuration.
*
* @param config - Optional configuration for the provider.
* @returns A new ZeroXActionProvider.
*/
export declare const zeroXActionProvider: (config: ZeroXActionProviderConfig) => ZeroXActionProvider;