/** * EIP-7702 捆绑换手 * * 在一笔交易中完成: * 1. 主钱包卖币 → 获得 OKB * 2. OKB 多跳转账 → 中间钱包1 → 中间钱包2 → 最终钱包 * 3. 最终钱包买币 * * 支持 FLAP 内盘、V2 和 V3 三种交易类型 * 只生成签名,由调用方决定如何提交 */ import type { BundleSwapParams as BaseBundleSwapParams, BundleBatchSwapParams as BaseBundleBatchSwapParams, BundleSwapResult, TradeType, EIP7702Config } from './types.js'; export interface BundleSwapParams extends BaseBundleSwapParams { /** 用户类型(影响利润率) */ userType?: UserType; /** * 是否使用资金利用率模式(默认 false) * - false(普通模式): 卖家卖出 OKB 留在卖家账户,买家用自己预存的 OKB 买入 * - true(资金利用率模式): 卖家卖出的 OKB 通过多跳转账给买家,买家用收到的 OKB 买入 */ useFundUtilization?: boolean; } export interface BundleBatchSwapParams extends BaseBundleBatchSwapParams { /** 用户类型(影响利润率) */ userType?: UserType; /** * 是否使用资金利用率模式(默认 false) * - false(普通模式): 卖家卖出 OKB 留在卖家账户,买家用自己预存的 OKB 买入 * - true(资金利用率模式): 卖家卖出的 OKB 通过多跳转账给买家,买家用收到的 OKB 买入 */ useFundUtilization?: boolean; } import { type UserType } from './utils.js'; /** * 捆绑换手 - 生成签名后的交易 * * @param params 换手参数 * @returns 签名后的交易和元数据 * * @example * // FLAP 内盘换手 * const result = await bundleSwap({ * sellerPrivateKey: '0x...', * buyerPrivateKey: '0x...', * tokenAddress: '0x...', * sellAmount: '100', * tradeType: 'FLAP', * hopCount: 2, * }); */ export declare function bundleSwap(params: BundleSwapParams): Promise; /** * 批量换手(一卖多买)- 生成签名后的交易 * * @param params 批量换手参数 * @returns 签名后的交易和元数据 * * @example * // FLAP 内盘一对多换手 * const result = await bundleBatchSwap({ * sellerPrivateKey: '0x...', * buyerPrivateKeys: ['0x...', '0x...'], * tokenAddress: '0x...', * sellAmount: '100', * tradeType: 'FLAP', * }); */ export declare function bundleBatchSwap(params: BundleBatchSwapParams): Promise; export interface BundleMultiSwapParams { /** Payer 钱包私钥(支付 Gas 费) */ mainPrivateKey: string; /** 卖出钱包私钥列表 */ sellerPrivateKeys: string[]; /** 买入钱包私钥列表 */ buyerPrivateKeys: string[]; /** 买入总金额 (OKB) */ totalBuyAmount: string; /** 代币地址 */ tokenAddress: string; /** 代币精度 */ tokenDecimals?: number; /** 卖出百分比(1-100,默认 100) */ sellPercent?: number; /** 交易类型:FLAP 内盘 / V2 / V3(默认 V3) */ tradeType?: TradeType; /** 路由地址(可选,根据 tradeType 自动选择) */ routerAddress?: string; /** V3 费率(可选,默认 2500,仅 V3 使用) */ fee?: number; /** 用户类型(影响利润率) */ userType?: UserType; /** 配置 */ config?: EIP7702Config; } export interface BundleMultiSwapResult { /** 签名后的交易 */ signedTransaction: string; /** 元数据 */ metadata: { payerAddress: string; sellerAddresses: string[]; buyerAddresses: string[]; sellerCount: number; buyerCount: number; totalBuyAmount: string; totalSellAmount: string; profitAmount: string; profitRecipient: string; userType: string; }; } /** * 多对多换手 - 多个卖家 + 多个买家 * * 核心逻辑:[利润刮取] + [卖出Ops...] + [买入Ops...] * * 特点: * - 多个卖家同时卖出 * - 多个买家同时买入 * - 所有操作在一笔交易中原子执行 * - 利润根据 userType 动态计算 * * @example * const result = await bundleMultiSwap({ * mainPrivateKey: '0x...', // Payer 支付 Gas * sellerPrivateKeys: ['0x...', '0x...'], * buyerPrivateKeys: ['0x...', '0x...'], * totalBuyAmount: '0.1', // 总买入 0.1 OKB * tokenAddress: '0x...', * tradeType: 'V3', * userType: 'v0', * }); */ export declare function bundleMultiSwap(params: BundleMultiSwapParams): Promise;