import { ethers } from 'ethers'; import { applySlippageBps } from '../../../core/constants/index.js'; import { type QuoteBNBResult, type QuoteSellParams, type RouteParams, type UserType } from './bundle-swap-types.js'; /** 路由卖出端的计价代币(path 最后一项 / v3TokenOut)。 */ export declare function routeQuoteToken(routeParams: RouteParams): string | undefined; /** * 股票池 / USDT 池 path 不是 WBNB 时,即使调用方漏传 quoteToken 也不能走 ETH 买卖。 * Pancake swapExactETH* 要求 path[0]==WETH,否则 INVALID_PATH。 */ export declare function resolvePancakeQuoteMode(params: { quoteToken?: string; routeParams: RouteParams; wrappedNative: string; }): { useNativeToken: boolean; quoteToken?: string; }; /** Pancake 买卖 minOut;实现见 core applySlippageBps。 */ export declare const applyPancakeSlippage: typeof applySlippageBps; export declare function splitQuotedMins(quotedTotal: bigint, amounts: bigint[], slippageBps?: number): bigint[]; export declare function prefixSumAmounts(amounts: bigint[]): bigint[]; /** 前缀报价差:第 i 笔顺序成交 ≈ quote(sum 0..i) - quote(sum 0..i-1)。 */ export declare function sequentialPrefixOutputs(prefixQuoted: bigint[]): bigint[]; export declare function applyTaxBps(amount: bigint, taxRateBps: number): bigint; /** 税币卖出时 pair 只收到扣税后的 amountIn,资金利用率必须按这个数量报价再转计价币。 */ export declare function taxedSellQuoteInput(sellAmountWei: bigint, taxRateBps: number): bigint; /** SupportingFeeOnTransfer 按收款余额检查,minOut 必须先扣税再滑点。 */ export declare function sequentialBuyAmountOutMins(sequentialBuyOuts: bigint[], taxRateBps: number, slippageBps: number): bigint[]; /** * 同钱包无币刷量:每个地址卖出必须等于该地址买入到手(扣税+滑点后的保底)。 * 再随机拆总量会导致有的钱包卖超实际余额。 */ export declare function pairSameWalletSellAmounts(sameWallet: boolean, guaranteedBuyOuts: bigint[], sellCount: number): bigint[] | null; export declare function isSameWalletBuySell(buyers: Array<{ address: string; }>, sellers: Array<{ address: string; }>): boolean; /** * 同钱包无币刷量卖出必须 minOut=0:同块先买后卖,卖出到账必然低于买入报价。 * quotedTotal 必须是卖出应得的计价币数量,不能传买入花费。 */ export declare function resolveBuyFirstSellMins(sameWallet: boolean, quotedTotal: bigint, sellAmounts: bigint[], slippageBps?: number): bigint[]; /** 多笔买入报价。V2 已选定路径时一次 multicall;V3 仍逐笔 eth_call。 */ export declare function quoteBuyOutputs(params: { routeParams: RouteParams; buyAmountsWei: readonly bigint[]; provider: ethers.JsonRpcProvider; v2RouterAddress?: string; }): Promise; export declare function quoteBuyOutput(params: { routeParams: RouteParams; buyAmountWei: bigint; provider: ethers.JsonRpcProvider; v2RouterAddress?: string; }): Promise; export declare function quoteSellOutput({ routeParams, sellAmountWei, provider, v2RouterAddress, }: QuoteSellParams): Promise; /** * 根据 userType 计算利润率 */ export declare function getProfitRateBps(_userType?: UserType): number; export declare function calculateProfitAmount(estimatedBNBOut: bigint, _userType?: UserType): bigint; /** 换手按卖出所得收万六会像万五点多:用所得能买回的数量把计价额抬到买侧。 */ export declare function grossUpPancakeSellProceedsToBuySide(params: { provider: ethers.JsonRpcProvider; tokenAddress: string; sellAmountWei: bigint; sellProceedsWei: bigint; quoteTokenIn: string; version: 'v2' | 'v3'; fee?: number; v2RouterAddress?: string; }): Promise; /** * ✅ 获取 ERC20 代币 → 原生代币(BNB)的报价 * 用于将 ERC20 利润转换为 BNB * 使用共享的报价函数 */ export declare function getERC20ToNativeQuote(provider: ethers.JsonRpcProvider, tokenAddress: string, tokenAmount: bigint, version?: 'v2' | 'v3', fee?: number): Promise;