UNPKG

four-flap-meme-sdk

Version:

SDK for Flap bonding curve and four.meme TokenManager

138 lines (137 loc) 5 kB
/** * 直接 Router 交易(不走代理合约) * * 支持: * - BSC: PancakeSwap V2/V3 * - Monad: PancakeSwap V2, Uniswap V2/V3 * * 收费方式:交易末尾附加利润提取交易(和内盘一致) */ /** Router 地址配置 - ✅ 使用公共模块中的地址 */ export declare const DIRECT_ROUTERS: { readonly BSC: { readonly PANCAKESWAP_V2: "0x10ED43C718714eb63d5aA57B78B54704E256024E"; readonly PANCAKESWAP_V3: "0x13f4EA83D0bd40E75C8222255bc855a974568Dd4"; readonly WBNB: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; }; readonly MONAD: { readonly PANCAKESWAP_V2: "0xB1Bc24c34e88f7D43D5923034E3a14B24DaACfF9"; readonly PANCAKESWAP_V3: "0x1b81D678ffb9C0263b24A97847620C99d213eB14"; readonly UNISWAP_V2: "0x4b2ab38dbf28d31d467aa8993f6c2585981d6804"; readonly UNISWAP_V3: "0xd6145b2d3f379919e8cdeda7b97e37c4b2ca9c40"; readonly WMON: "0x3bd359c1119da7da1d913d1c4d2b7c461115433a"; }; readonly XLAYER: { readonly POTATOSWAP_V2: "0x881fb2f98c13d521009464e7d1cbf16e1b394e8e"; readonly POTATOSWAP_V3: "0xB45D0149249488333E3F3f9F359807F4b810C1FC"; readonly DYORSWAP_ROUTER: "0xfb001fbbace32f09cb6d3c449b935183de53ee96"; readonly DYORSWAP_FACTORY: "0x2CcaDb1e437AA9cDc741574bDa154686B1F04C09"; readonly V3_ROUTER: "0xBB069e9465BcabC4F488d21e793BDEf0F2d41D41"; readonly V3_FACTORY: "0xa1415fAe79c4B196d087F02b8aD5a622B8A827E5"; readonly WOKB: "0xe538905cf8410324e03a5a23c1c177a474d59b2b"; }; }; /** ERC20 ABI - ✅ 从公共模块导入 */ export interface DirectRouterSignConfig { rpcUrl: string; chainId?: number; gasLimit?: number | bigint; gasLimitMultiplier?: number; gasPrice?: bigint; minGasPriceGwei?: number; maxGasPriceGwei?: number; txType?: 0 | 2; /** 是否跳过授权检查 */ skipApprovalCheck?: boolean; /** 滑点(基点),默认 100 = 1% */ slippageBps?: number; /** BlockRazor 贿赂金额(BNB),仅 BSC 链有效,用于提高 bundle 打包优先级 */ bribeAmount?: number; } export interface DirectV2BuyParams { chain: 'BSC' | 'MONAD' | 'XLAYER'; privateKeys: string[]; buyAmounts: string[]; tokenAddress: string; routerAddress: string; quoteToken?: string; quoteTokenDecimals?: number; startNonces?: number[]; config: DirectRouterSignConfig; } export interface DirectV2SellParams { chain: 'BSC' | 'MONAD' | 'XLAYER'; privateKeys: string[]; sellPercentages?: number[]; sellAmounts?: string[]; startNonces?: number[]; tokenAddress: string; tokenDecimals?: number; routerAddress: string; quoteToken?: string; config: DirectRouterSignConfig; } export interface DirectV3BuyParams { chain: 'BSC' | 'MONAD' | 'XLAYER'; privateKeys: string[]; buyAmounts: string[]; tokenAddress: string; routerAddress: string; fee: number; quoteToken?: string; quoteTokenDecimals?: number; startNonces?: number[]; config: DirectRouterSignConfig; } export interface DirectV3SellParams { chain: 'BSC' | 'MONAD' | 'XLAYER'; privateKeys: string[]; sellPercentages?: number[]; sellAmounts?: string[]; tokenAddress: string; tokenDecimals?: number; routerAddress: string; fee: number; quoteToken?: string; startNonces?: number[]; config: DirectRouterSignConfig; } export interface DirectRouterResult { signedTransactions: string[]; metadata?: { profitAmount: string; profitRecipient: string; totalFlow: string; }; } /** * V2 批量买入(直接调用 Router) */ export declare function directV2BatchBuy(params: DirectV2BuyParams): Promise<DirectRouterResult>; /** * V2 批量卖出(直接调用 Router) */ export declare function directV2BatchSell(params: DirectV2SellParams): Promise<DirectRouterResult>; /** * V3 批量买入(直接调用 Router) * * 自动识别 SwapRouter 版本: * - SwapRouter02 (PancakeSwap V3): exactInputSingle 不含 deadline,multicall 含 deadline * - SwapRouter (旧版 Uniswap V3): exactInputSingle 含 deadline,multicall 不含 deadline */ export declare function directV3BatchBuy(params: DirectV3BuyParams): Promise<DirectRouterResult>; /** * V3 批量卖出(直接调用 Router) * * 自动识别 SwapRouter 版本: * - SwapRouter02 (PancakeSwap V3): exactInputSingle 不含 deadline,multicall 含 deadline * - SwapRouter (旧版 Uniswap V3): exactInputSingle 含 deadline,multicall 不含 deadline */ export declare function directV3BatchSell(params: DirectV3SellParams): Promise<DirectRouterResult>; export type DexKey = 'PANCAKESWAP' | 'UNISWAP' | 'POTATOSWAP' | 'DYORSWAP'; export type RouterVersion = 'v2' | 'v3'; /** * 根据链和 DEX 获取 Router 地址 */ export declare function getRouterAddress(chain: 'BSC' | 'MONAD' | 'XLAYER', // ✅ 新增 XLAYER dexKey: DexKey, version: RouterVersion): string;