import { ethers } from 'ethers'; import type { Wallet } from 'ethers'; import type { CommonBundleConfig, NonceManager } from '../../../utils/bundle-helpers.js'; import type { GeneratedWallet } from '../../../utils/wallet.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; export declare const PANCAKE_V2_ROUTER_ABI: string[]; export declare const PANCAKE_V3_ROUTER_ABI: (string | { inputs: { components: { name: string; type: string; }[]; name: string; type: string; }[]; name: string; outputs: { name: string; type: string; }[]; stateMutability: string; type: string; })[]; export declare const ERC20_BALANCE_OF_ABI: string[]; export declare const PANCAKE_V2_ROUTER_ADDRESS: "0x10ED43C718714eb63d5aA57B78B54704E256024E"; export declare const PANCAKE_V3_ROUTER_ADDRESS: "0x13f4EA83D0bd40E75C8222255bc855a974568Dd4"; export declare const FLAT_FEE = 0n; export declare const WBNB_ADDRESS: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; export type UserType = 'v0' | 'v1'; export type SwapRouteType = 'v2' | 'v3-single' | 'v3-multi'; /** * 分发多跳路径信息 */ export type DisperseHopPath = { targetAddress: string; hopWallets: Wallet[]; hopWalletsInfo: GeneratedWallet[]; }; export type QuoteSellParams = { routeParams: RouteParams; sellAmountWei: bigint; provider: ethers.JsonRpcProvider; v2RouterAddress?: string; }; export type BuildSwapParams = { routeParams: RouteParams; sellAmountWei: bigint; buyAmountBNB: bigint; buyer: Wallet; seller: Wallet; tokenAddress: string; useNativeToken?: boolean; v2RouterAddress?: string; sellAmountOutMin?: bigint; buyAmountOutMin?: bigint; }; export type BuyerBudgetParams = { buyer: Wallet; quotedBNBOut: bigint; reserveGasBNB?: number; useNativeToken?: boolean; quoteToken?: string; quoteTokenDecimals?: number; provider?: ethers.JsonRpcProvider; }; export type PlanNonceParams = { seller: Wallet; buyer: Wallet; sameAddress: boolean; approvalExists: boolean; profitNeeded: boolean; needBribeTx: boolean; nonceManager: NonceManager; }; export type BalanceValidationParams = { sameAddress: boolean; buyerBalance: bigint; buyAmountBNB: bigint; reserveGas: bigint; gasLimit: bigint; gasPrice: bigint; useNativeToken?: boolean; quoteTokenDecimals?: number; provider?: ethers.JsonRpcProvider; buyerAddress?: string; }; export interface PancakeSwapSignConfig { rpcUrl: string; gasLimit?: number | bigint; gasLimitMultiplier?: number; minGasPriceGwei?: number; maxGasPriceGwei?: number; txType?: 0 | 2; chainId?: number; reserveGasBNB?: number; userType?: UserType; bribeAmount?: number; /** 滑点基点,默认 100 = 1%。买卖 amountOutMin 都按报价下浮。 */ slippageBps?: number; v2RouterAddress?: string; } export interface PancakeSwapConfig extends CommonBundleConfig { apiKey: string; customRpcUrl?: string; bundleBlockOffset?: number; reserveGasBNB?: number; waitForConfirmation?: boolean; waitTimeoutMs?: number; } export interface V2RouteParams { routeType: 'v2'; v2Path: string[]; } export interface V3SingleRouteParams { routeType: 'v3-single'; v3TokenIn: string; v3TokenOut: string; v3Fee: number; v2Path?: string[]; } export interface V3MultiRouteParams { routeType: 'v3-multi'; v3LpAddresses: string[]; v3ExactTokenIn: string; v2Path?: string[]; } export type RouteParams = V2RouteParams | V3SingleRouteParams | V3MultiRouteParams; export interface PancakeBundleSwapSignParams { sellerPrivateKey: string; sellAmount?: string; sellPercentage?: number; buyerPrivateKey: string; tokenAddress: string; routeParams: RouteParams; config: PancakeSwapSignConfig; quoteToken?: string; quoteTokenDecimals?: number; startNonces?: number[]; } export interface PancakeBundleSwapParams { sellerPrivateKey: string; sellAmount?: string; sellPercentage?: number; buyerPrivateKey: string; tokenAddress: string; routeParams: RouteParams; config: PancakeSwapConfig; } /** ✅ Pancake Swap 结果(简化版) */ export type PancakeSwapResult = { signedTransactions: string[]; profitHopWallets?: GeneratedWallet[]; metadata?: { sellerAddress: string; buyerAddress: string; sellAmount: string; buyAmount: string; profitAmount?: string; }; }; export type PancakeContext = { chainId: number; provider: ethers.JsonRpcProvider; }; export type QuoteBNBResult = { estimatedBNBOut: bigint; }; export type SwapUnsignedResult = { sellUnsigned: ethers.TransactionLike; buyUnsigned: ethers.TransactionLike; }; export type BuyerBudget = { buyerBalance: bigint; reserveGas: bigint; requiredBalance: bigint; buyAmountBNB: bigint; useNativeToken: boolean; }; export type NoncePlan = { sellerNonce: number; buyerNonce: number; bribeNonce?: number; profitNonce?: number; }; export { ZERO_ADDRESS } from '../../../core/constants/index.js';