four-flap-meme-sdk 1.4.27 → 1.4.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -748,16 +748,23 @@ export async function directV3BatchBuy(params) {
748
748
  const totalFlowWei = flowAmounts.reduce((sum, amt) => sum + amt, 0n);
749
749
  const baseProfitWei = calculateProfitAmount(totalFlowWei);
750
750
  // ✅ 方案 B:并行获取 nonces、gasPrice 和 ERC20 报价
751
+ // ✅ 修复:ERC20 报价不传 fee 参数,让报价函数自动选择最佳费率
752
+ // 因为 quoteToken/WBNB 池的费率可能与交易池(tokenAddress)的费率不同
751
753
  const [nonces, gasPrice, nativeProfitWei] = await Promise.all([
752
754
  startNonces && startNonces.length === wallets.length
753
755
  ? Promise.resolve(startNonces)
754
756
  : new NonceManager(provider).getNextNoncesForWallets(wallets),
755
757
  getGasPrice(provider, config),
756
- // ERC20 报价(V3 买入用 V3 报价)
758
+ // ERC20 报价(不传 fee,自动选择最佳费率)
757
759
  (!useNative && baseProfitWei > 0n && quoteToken)
758
- ? getTokenToNativeQuote(provider, quoteToken, baseProfitWei, chain, 'v3', fee)
760
+ ? getTokenToNativeQuote(provider, quoteToken, baseProfitWei, chain, 'v3')
759
761
  : Promise.resolve(baseProfitWei)
760
762
  ]);
763
+ // ✅ 添加详细日志
764
+ if (!useNative) {
765
+ console.log(`[V3 Buy Profit] quoteToken=${quoteToken}, baseProfitWei=${baseProfitWei} (${ethers.formatEther(baseProfitWei)} quoteToken)`);
766
+ console.log(`[V3 Buy Profit] nativeProfitWei=${nativeProfitWei} (${ethers.formatEther(nativeProfitWei)} BNB)`);
767
+ }
761
768
  const profitWei = nativeProfitWei > 0n ? nativeProfitWei : 0n;
762
769
  const gasLimit = getGasLimit(config, 300000);
763
770
  const txType = config.txType ?? 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "1.4.27",
3
+ "version": "1.4.28",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",