import { JsonRpcProvider } from 'ethers'; import type { AmountLike } from './types.js'; import type { GeneratedWallet } from '../../../utils/wallet.js'; /** * 获取 ERC20 代币精度(带缓存) * ✅ 优化:避免每次调用都获取 network,直接使用传入的 chainId */ export declare function getErc20DecimalsMerkle(provider: JsonRpcProvider, token: string, chainId?: number): Promise; /** * ✅ 生成多跳中间钱包(返回完整钱包信息:地址 + 私钥) */ export declare function generateHopWallets(recipientCount: number, hopCount: number | number[]): GeneratedWallet[][] | null; export declare function normalizeAmounts(recipients: string[], amount?: AmountLike, amounts?: AmountLike[]): string[]; /** * 批量获取余额(原生代币或 ERC20) * ✅ 优化:原生代币也使用 Multicall3 批量获取,减少 RPC 调用 */ export declare function batchGetBalances(provider: JsonRpcProvider, addresses: string[], tokenAddress?: string): Promise; /** * 通过模拟交易获取 ERC20 转账的最小 Gas Limit * ✅ 使用 eth_estimateGas 预估实际需要的 gas,然后加一个小的缓冲量 * * @param provider - Provider 实例 * @param tokenAddress - ERC20 代币地址 * @param from - 发送方地址 * @param to - 接收方地址 * @param amount - 转账金额(wei) * @param bufferPercent - 缓冲百分比(默认 5%) * @returns 预估的 gas limit */ export declare function estimateErc20TransferGas(provider: JsonRpcProvider, tokenAddress: string, from: string, to: string, amount: bigint, bufferPercent?: number): Promise; /** * 批量预估多个 ERC20 转账的 Gas Limit * ✅ 选取最大值作为统一的 gas limit(确保所有转账都能成功) */ export declare function estimateMaxErc20TransferGas(provider: JsonRpcProvider, tokenAddress: string, from: string, recipients: string[], amounts: bigint[], bufferPercent?: number): Promise; /** * 计算 Gas Limit * - 原生代币转账: * - BSC: 21000 gas(固定) * - XLayer: 50000 gas(EIP-7702 授权地址需要更多 gas) * - ERC20 标准 transfer:约 45000-55000 gas,使用 55000 作为安全值 * * ✅ 优化:降低 ERC20 gas limit,减少中转钱包 BNB 残留 * ✅ XLayer 特殊处理:EIP-7702 授权的地址接收 OKB 时会触发 delegate 代码,需要更多 gas */ export declare function calculateGasLimit(config: any, isNative: boolean, hasHops: boolean, hopCount?: number): bigint; export declare function isNativeTokenAddress(tokenAddress?: string): boolean;