four-flap-meme-sdk 1.9.3 → 1.9.4

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.
@@ -12,7 +12,7 @@ import { NonceManager, getOptimizedGasPrice, getDeadline as _getDeadline, buildP
12
12
  import { PROFIT_CONFIG, ZERO_ADDRESS, BLOCKRAZOR_BUILDER_EOA, ADDRESSES } from '../utils/constants.js';
13
13
  import { GAS_LIMITS } from '../shared/constants/index.js';
14
14
  import { V2_ROUTER_ABI as _V2_ROUTER_ABI, V3_ROUTER02_ABI as _V3_ROUTER02_ABI, V3_ROUTER_LEGACY_ABI as _V3_ROUTER_LEGACY_ABI, SWAP_ROUTER02_V2_ABI as _SWAP_ROUTER02_V2_ABI, ERC20_ABI } from '../shared/abis/common.js';
15
- import { getTokenToNativeQuote } from '../utils/quote-helpers.js';
15
+ import { getTokenToNativeQuote, quoteV2 } from '../utils/quote-helpers.js';
16
16
  // ============================================================================
17
17
  // ✅ 方案 C:Provider 缓存(避免重复创建)
18
18
  // ============================================================================
@@ -732,11 +732,20 @@ export async function directV2BatchSell(params) {
732
732
  return profit;
733
733
  }
734
734
  else if (quoteToken) {
735
- // 卖出代币 → 得到 ERC20:先获取 V2 报价,再计算利润(✅ 使用当前 Router 报价)
736
- const estimatedBNBOut = await getTokenToNativeQuote(provider, tokenAddress, totalSellAmount, chain, 'v2', undefined, routerAddress);
735
+ // 卖出代币 → 得到 ERC20(如 USDT):两阶段报价
736
+ // IROSwap DEX 可能只有 token/USDT 池,无 USDT/WBNB,直接 token→WBNB 会失败
737
+ // 1) 用当前 Router 报价 token→quoteToken(如 VOYA→USDT)
738
+ // 2) 用默认 PancakeSwap 报价 quoteToken→WBNB(USDT/WBNB 在 Pancake 上存在)
739
+ const step1 = await quoteV2(provider, tokenAddress, quoteToken, totalSellAmount, chain, routerAddress);
740
+ if (!step1.amountOut || step1.amountOut <= 0n)
741
+ return 0n;
742
+ console.log(`[V2 Sell Profit] step1 token→quoteToken: ${step1.amountOut} wei`);
743
+ const estimatedBNBOut = await getTokenToNativeQuote(provider, quoteToken, step1.amountOut, chain, 'v2');
744
+ console.log(`[V2 Sell Profit] step2 quoteToken→BNB: ${estimatedBNBOut} wei`);
737
745
  if (estimatedBNBOut <= 0n)
738
746
  return 0n;
739
747
  const profit = calculateProfitAmount(estimatedBNBOut);
748
+ console.log(`[V2 Sell Profit] profit: ${profit}, profitBNB: ${ethers.formatEther(profit)}`);
740
749
  return profit;
741
750
  }
742
751
  return 0n;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "1.9.3",
3
+ "version": "1.9.4",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",