@coinbase/agentkit
Version:
Coinbase AgentKit core primitives
59 lines (58 loc) • 2.33 kB
TypeScript
import { Address, Hex, TransactionReceipt } from "viem";
import { BuySwapAmounts, SellSwapAmounts, PermitSingle, PoolSwapEventArgs } from "./types";
import { EvmWalletProvider } from "../../wallet-providers";
export declare const getAmountWithSlippage: (amount: bigint | undefined, slippage: string, swapType: "EXACT_IN" | "EXACT_OUT") => bigint;
export declare const ethToMemecoin: (params: {
sender: Address;
memecoin: Address;
chainId: number;
referrer: Address | null;
swapType: "EXACT_IN" | "EXACT_OUT";
amountIn?: bigint;
amountOutMin?: bigint;
amountOut?: bigint;
amountInMax?: bigint;
}) => {
calldata: `0x${string}`;
commands: `0x${string}`;
inputs: `0x${string}`[];
};
export declare const memecoinToEthWithPermit2: (params: {
chainId: number;
memecoin: Address;
amountIn: bigint;
ethOutMin: bigint;
permitSingle: PermitSingle | undefined;
signature: Hex | undefined;
referrer: Address | null;
}) => {
calldata: `0x${string}`;
commands: `0x${string}`;
inputs: `0x${string}`[];
};
export declare const getSwapAmountsFromLog: ({ filteredPoolSwapEvent, coinAddress, chainId, }: {
filteredPoolSwapEvent: PoolSwapEventArgs;
coinAddress: Address;
chainId: number;
}) => BuySwapAmounts | SellSwapAmounts;
export declare const getSwapAmountsFromReceipt: ({ receipt, coinAddress, chainId, }: {
receipt: TransactionReceipt;
coinAddress: Address;
chainId: number;
}) => BuySwapAmounts | SellSwapAmounts;
/**
* Buys a flaunch coin using ETH input.
*
* @param walletProvider - The wallet provider instance for blockchain interactions
* @param coinAddress - The address of the coin to buy
* @param swapType - The type of swap to perform
* @param swapParams - The parameters for the swap
* @param swapParams.amountIn - The amount of ETH to spend (for EXACT_IN)
* @param swapParams.amountOut - The amount of coins to buy (for EXACT_OUT)
* @param slippagePercent - The slippage percentage
* @returns A promise that resolves to a string describing the transaction result
*/
export declare function buyFlaunchCoin(walletProvider: EvmWalletProvider, coinAddress: string, swapType: "EXACT_IN" | "EXACT_OUT", swapParams: {
amountIn?: string;
amountOut?: string;
}, slippagePercent: number): Promise<string>;