/** * 多跳(Hop Chain)转账链生成工具 * * 提取自 chains/bsc/four/swap.ts、chains/bsc/pancake/bundle-swap.ts、shared/flap/portal-bundle-merkle/swap.ts * 消除三个文件之间的复制代码 */ import { ethers, Wallet, JsonRpcProvider } from 'ethers'; import type { DisperseHopPath } from './types/hop-chains.js'; export type { DisperseHopPath } from './types/hop-chains.js'; export declare const NATIVE_TRANSFER_GAS_LIMIT: 21055n; export declare const ERC20_TRANSFER_GAS_LIMIT_HOP: 65000n; export declare const BRIBE_GAS_LIMIT: 21000n; /** /** * 给交易对象附加 gasPrice/maxFeePerGas(根据 txType) * 消除 `if (txType === 2) { ... } else { ... }` 手写重复 */ export declare function applyTxTypeGas(tx: ethers.TransactionLike, gasPrice: bigint, txType: 0 | 2): void; /** * 生成分发多跳路径 */ export declare function generateDisperseHopPaths(targetAddresses: string[], hopCount: number, provider: JsonRpcProvider): DisperseHopPath[]; /** * 构建原生代币多跳转账链 */ export declare function buildNativeHopChain(payer: Wallet, path: DisperseHopPath, finalAmount: bigint, gasPrice: bigint, chainId: number, txType: 0 | 2, payerNonce: number): Promise; /** * 构建 ERC20 多跳转账链(需要配合 BNB 多跳使用) */ export declare function buildERC20HopChain(payer: Wallet, path: DisperseHopPath, erc20Address: string, erc20Amount: bigint, gasPrice: bigint, chainId: number, txType: 0 | 2, payerNonce: number): Promise; /** * 构建 BNB 多跳转账链(为 ERC20 中间钱包预留 gas) */ export declare function buildBNBHopChainForERC20(payer: Wallet, path: DisperseHopPath, finalGasAmount: bigint, gasPrice: bigint, chainId: number, txType: 0 | 2, payerNonce: number): Promise;