/** * EIP-7702 XLayer 刷量功能 * * 支持两种模式: * 1. 无币模式 (Wash): 单钱包买入+卖出,不需要预先持有代币 * 2. 捆绑模式 (Bundle): 多钱包批量买入 + 批量卖出 * * 支持池子类型: * - FLAP: 内盘 (Flap Portal) * - V2: PotatoSwap V2 外盘 * - V3: PotatoSwap V3 外盘 * * 只生成签名,由调用方决定如何提交 */ import type { EIP7702Config, TradeType, GeneratedWallet } from './types.js'; import { type UserType } from './utils.js'; export type VolumeMode = 'wash' | 'bundle'; export type PoolType = 'FLAP' | 'V2' | 'V3'; export interface VolumeProgress { currentRound: number; totalRounds: number; status: 'pending' | 'running' | 'completed' | 'failed'; message?: string; } export interface WashVolumeParams { /** Payer 钱包私钥(支付 Gas 费) */ mainPrivateKey: string; /** 钱包私钥列表(每个钱包独立执行买入+卖出) */ privateKeys: string[]; /** 代币地址 */ tokenAddress: string; /** 代币精度 */ tokenDecimals?: number; /** 每个钱包的买入金额 (OKB) */ buyAmountPerWallet: string; /** 卖出百分比(1-100) */ sellPercent?: number; /** 池子类型 */ poolType?: PoolType; /** 路由地址(V2/V3 模式) */ routerAddress?: string; /** V3 费率 */ fee?: number; /** 用户类型(影响利润率) */ userType?: UserType; /** EIP-7702 配置 */ config?: EIP7702Config; } export interface WashVolumeResult { signedTransaction: string; metadata: { walletCount: number; buyAmountPerWallet: string; totalBuyAmount: string; sellPercent: number; poolType: PoolType; profitAmount: string; }; } /** * 无币刷量 - 每个钱包执行买入+卖出 * * 核心逻辑:[利润刮取] + [钱包1买入] + [钱包1卖出] + [钱包2买入] + [钱包2卖出] + ... * * 特点: * - 钱包不需要预先持有代币 * - 每个钱包在同一笔交易中完成买入和卖出 * - 利润从主钱包统一支付 * * @example * const result = await washVolume({ * privateKeys: ['0x...', '0x...'], * tokenAddress: '0x...', * buyAmountPerWallet: '0.01', * sellPercent: 100, * poolType: 'V3', * }); */ export declare function washVolume(params: WashVolumeParams): Promise; export interface BundleVolumeParams { /** Payer 钱包私钥(支付 Gas 费) */ mainPrivateKey: string; /** 买入钱包私钥列表 */ buyerPrivateKeys: string[]; /** 每个买家的买入金额 (OKB) */ buyAmounts: string[]; /** 卖出钱包私钥列表 */ sellerPrivateKeys: string[]; /** 每个卖家的卖出数量(代币)或百分比 */ sellAmounts?: string[]; /** 卖出百分比(当 sellAmounts 未提供时使用) */ sellPercent?: number; /** 代币地址 */ tokenAddress: string; /** 代币精度 */ tokenDecimals?: number; /** 池子类型 */ poolType?: PoolType; /** 路由地址 */ routerAddress?: string; /** V3 费率 */ fee?: number; /** 用户类型(影响利润率) */ userType?: UserType; /** EIP-7702 配置 */ config?: EIP7702Config; } export interface BundleVolumeResult { signedTransaction: string; metadata: { buyerCount: number; sellerCount: number; totalBuyAmount: string; totalSellAmount: string; poolType: PoolType; profitAmount: string; }; } /** * 捆绑刷量 - 多钱包批量买入 + 批量卖出 * * 核心逻辑:[利润刮取] + [买入Ops...] + [卖出Ops...] * * 特点: * - 买入和卖出可以使用不同的钱包 * - 所有操作在一笔交易中原子执行 * - 卖出钱包需要预先持有代币 * * @example * const result = await bundleVolume({ * buyerPrivateKeys: ['0x...', '0x...'], * buyAmounts: ['0.01', '0.02'], * sellerPrivateKeys: ['0x...'], * sellPercent: 100, * tokenAddress: '0x...', * poolType: 'FLAP', * }); */ export declare function bundleVolume(params: BundleVolumeParams): Promise; export interface SingleRoundVolumeResult { buySignedTransaction: string; sellSignedTransaction: string; metadata: { buyAmount: string; sellPercent: number; walletCount: number; }; } /** * 生成单轮刷量签名(买入 + 卖出分开) * * 注意:买入和卖出是两笔独立交易 */ export declare function singleRoundVolume(params: { privateKeys: string[]; tokenAddress: string; tokenDecimals?: number; buyAmountPerWallet: string; sellPercent?: number; tradeType?: TradeType; routerAddress?: string; fee?: number; config?: EIP7702Config; }): Promise; export interface MakeVolumeParams { privateKeys: string[]; tokenAddress: string; tokenDecimals?: number; buyAmountPerRound: string; rounds: number; tradeType?: TradeType; routerAddress?: string; fee?: number; onProgress?: (progress: VolumeProgress) => void; config?: EIP7702Config; } export interface MakeVolumeSignResult { rounds: SingleRoundVolumeResult[]; metadata: { totalRounds: number; totalBuyAmount: string; walletCount: number; }; } /** * 生成多轮刷量签名 * * 注意:由于 nonce 问题,只能预生成第一轮 * 后续轮次需要在前一轮交易确认后才能生成 */ export declare function makeVolume(params: MakeVolumeParams): Promise; export interface SwapVolumeSignResult { signedTransaction: string; hopWallets: GeneratedWallet[]; metadata: { sellerAddress: string; buyerAddress: string; sellAmount: string; }; } /** * 生成换手刷量签名 */ export declare function makeVolumeWithSwap(params: { sellerPrivateKey: string; buyerPrivateKey: string; tokenAddress: string; tokenDecimals?: number; sellAmount: string; hopCount?: number; tradeType?: TradeType; routerAddress?: string; fee?: number; config?: EIP7702Config; }): Promise;