/** * EIP-7702 转账功能 * * 支持三种模式: * 1. 分散 (disperse): 一对多分发资金 * 2. 归集 (sweep): 多对一收集资金 * 3. 多对多 (pairwise): sender[i] → receiver[i] 一一对应转账 * * 所有模式都支持: * - 原生 OKB 转账 * - ERC20 代币转账 * - 可选的多跳混淆 * * 只生成签名,由调用方决定如何提交 */ import type { GeneratedWallet, EIP7702Config } from './types.js'; import { UserType } from './utils.js'; export interface TransferResult { signedTransaction: string; hopWallets?: GeneratedWallet[]; metadata: Record; } export interface DisperseParams { /** 资金来源钱包私钥(Token/OKB 从这个钱包转出) */ mainPrivateKey: string; /** Payer 钱包私钥(可选,用于支付 gas;不传则使用 mainPrivateKey) */ payerPrivateKey?: string; /** 接收者地址列表 */ recipients: string[]; /** 每个接收者的金额 */ amounts: string[]; /** 代币地址(不填则为原生 OKB) */ tokenAddress?: string; /** 代币精度(默认 18) */ tokenDecimals?: number; /** 多跳数量(0=直接转账) */ hopCount?: number; /** 用户类型(用于计算利润刮取) */ userType?: UserType; /** EIP-7702 配置 */ config?: EIP7702Config; } export interface SweepParams { targetAddress: string; sourcePrivateKeys: string[]; payerPrivateKey?: string; tokenAddress?: string; tokenDecimals?: number; hopCount?: number; reserveGas?: boolean; percent?: number; userType?: UserType; config?: EIP7702Config; } export interface PairwiseTransferParams { senderPrivateKeys: string[]; receiverAddresses: string[]; payerPrivateKey?: string; amount?: string; amounts?: string[]; tokenAddress?: string; tokenDecimals?: number; hopCount?: number; userType?: UserType; config?: EIP7702Config; } export interface PairwiseTransferResult { signedTransaction: string; hopWallets?: GeneratedWallet[][]; metadata: { pairCount: number; totalAmount: string; profitAmount: string; isNative: boolean; tokenAddress: string | null; hopCount: number; userType?: UserType; }; }