/** * XLayer EOA 模式批量换手 * * 专门为 XLayer 链设计,不影响 BSC 链的逻辑 * - 使用 PotatoSwap V3 Quoter * - 使用 WOKB 作为 Wrapped Native Token * - 支持多跳转账和利润刮取 */ import { type GeneratedWallet } from '../../../utils/wallet.js'; export type UserType = 'v0' | 'v1'; export type SwapRouteType = 'v2' | 'v3-single' | 'v3-multi'; export interface V2RouteParams { routeType: 'v2'; v2Path: string[]; } export interface V3SingleRouteParams { routeType: 'v3-single'; v3TokenIn: string; v3TokenOut: string; v3Fee: number; v2Path?: string[]; } export interface V3MultiRouteParams { routeType: 'v3-multi'; v3LpAddresses: string[]; v3ExactTokenIn: string; v2Path?: string[]; } export type RouteParams = V2RouteParams | V3SingleRouteParams | V3MultiRouteParams; export interface XLayerEoaSwapConfig { rpcUrl: string; gasLimit?: number | bigint; gasLimitMultiplier?: number; minGasPriceGwei?: number; maxGasPriceGwei?: number; txType?: 0 | 2; reserveGasBNB?: number; userType?: UserType; bribeAmount?: number; } export interface XLayerQuickBatchSwapParams { sellerPrivateKey: string; sellAmount?: string; sellPercentage?: number; buyerPrivateKeys: string[]; buyerRatios?: number[]; buyerAmounts?: string[]; tokenAddress: string; routeParams: RouteParams; config: XLayerEoaSwapConfig; quoteToken?: string; quoteTokenDecimals?: number; disperseHopCount?: number; startNonces?: number[]; } export interface XLayerQuickBatchSwapResult { signedTransactions: string[]; disperseHopWallets?: GeneratedWallet[]; profitHopWallets?: GeneratedWallet[]; metadata?: { sellerAddress: string; buyerAddresses: string[]; sellAmount: string; estimatedOutput: string; transferAmounts: string[]; profitAmount?: string; useNativeToken: boolean; disperseHopCount?: number; }; } export interface XLayerCrossSwapParams { sellerPrivateKeys: string[]; sellAmounts: string[]; buyerPrivateKeys: string[]; tokenAddress: string; routeParams: RouteParams; config: XLayerEoaSwapConfig; quoteToken?: string; quoteTokenDecimals?: number; buyersPerSell?: number; disperseHopCount?: number; /** ✅ 预获取的 nonce(地址 -> nonce),避免 nonce 不同步 */ startNonces?: Map; } export interface XLayerCrossSwapResult { signedTransactions: string[]; rounds: Array<{ sellerAddress: string; buyerAddresses: string[]; sellAmount: string; bundleHash?: string; }>; disperseHopWallets?: GeneratedWallet[]; profitHopWallets?: GeneratedWallet[]; } export declare function xlayerQuickBatchSwapMerkle(params: XLayerQuickBatchSwapParams): Promise; export declare function xlayerCrossSwapMerkle(params: XLayerCrossSwapParams): Promise; /** * 真正的交叉换手参数 */ export interface XLayerPureCrossSwapParams { /** 卖方私钥列表 */ sellerPrivateKeys: string[]; /** 每个卖方的卖出数量 */ sellAmounts: string[]; /** 买方私钥列表 */ buyerPrivateKeys: string[]; /** 每个买方的买入 OKB 数量 */ buyAmounts: string[]; /** 代币地址 */ tokenAddress: string; /** 路由参数 */ routeParams: RouteParams; /** 配置 */ config: XLayerEoaSwapConfig; /** 报价代币(默认 OKB) */ quoteToken?: string; /** 预获取的 nonce(地址 -> nonce) */ startNonces?: Map; } /** * 真正的交叉换手结果 */ export interface XLayerPureCrossSwapResult { signedTransactions: string[]; metadata: { sellerAddresses: string[]; buyerAddresses: string[]; sellAmounts: string[]; buyAmounts: string[]; }; } /** * ✅ 真正的交叉换手 * * 与资金利用率模式不同: * - 卖方卖出代币 → OKB 留在卖方钱包 * - 买方用自己的 OKB 买入代币 * - 无资金转移 * * 交易顺序:卖1 → 买1 → 卖2 → 买2 → ... (交替执行) */ export declare function xlayerPureCrossSwapMerkle(params: XLayerPureCrossSwapParams): Promise;