/** * ENI BatchRouter 类型定义 * * BatchRouter 是 ENI 链的原子化批量交易代理合约 * 钱包保持普通 EOA,由主钱包发起单笔 tx 完成多钱包操作 * * Phase 2 部署后启用 */ export interface BatchRouterConfig { rpcUrl?: string; /** BatchRouter 合约地址 (部署后填入) */ batchRouterAddress: string; /** 主钱包私钥 (发起交易并出资) */ mainPrivateKey: string; gasPrice?: bigint; } export interface BatchBuyParams extends BatchRouterConfig { /** Portal 或 Router 地址 */ target: string; token: string; /** 买入钱包地址 */ buyers: string[]; /** 每个钱包的买入金额 (wei EGAS) */ amounts: bigint[]; /** 利润 (wei EGAS, 合约内扣除) */ profitAmount?: bigint; } export interface BatchBuyResult { signedTx: string; from: string; nonce: number; totalValue: bigint; estimatedGas: bigint; } export interface BatchSellParams extends BatchRouterConfig { target: string; token: string; /** 卖出钱包地址 (需提前 approve BatchRouter) */ sellers: string[]; /** 每个钱包的卖出代币数量 */ amounts: bigint[]; } export interface BatchSellResult { signedTx: string; from: string; nonce: number; estimatedGas: bigint; } export interface AtomicSwapParams extends BatchRouterConfig { target: string; token: string; /** 卖出方 */ sellers: string[]; sellAmounts: bigint[]; /** 买入方 */ buyers: string[]; buyAmounts: bigint[]; /** 额外 EGAS (若买入总额 > 卖出所得) */ extraValue?: bigint; } export interface AtomicSwapResult { signedTx: string; from: string; nonce: number; totalValue: bigint; estimatedGas: bigint; } export interface BatchApproveParams { rpcUrl?: string; token: string; /** 需要 approve 的钱包私钥 */ privateKeys: string[]; /** approve 的 spender (BatchRouter 地址) */ spender: string; gasPrice?: bigint; } export interface BatchApproveResult { transactions: Array<{ signedTx: string; from: string; nonce: number; }>; } export interface BatchTransferParams extends BatchRouterConfig { /** 转账接收地址 */ recipients: string[]; /** 每个地址的转账金额 */ amounts: bigint[]; } export interface BatchTransferResult { signedTx: string; from: string; nonce: number; totalValue: bigint; }