four-flap-meme-sdk 1.4.53 → 1.4.54

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.
@@ -700,7 +700,10 @@ export async function sweepWithBundleMerkle(params) {
700
700
  _batchGetBalances(provider, addresses)
701
701
  ]);
702
702
  const gasCostBase = nativeGasLimit * gasPrice;
703
- const profitTxGas = nativeGasLimit * gasPrice;
703
+ // 修复:利润多跳需要 PROFIT_HOP_COUNT + 1 笔交易的 gas(payer → hop1 → hop2 → 利润地址)
704
+ // ✅ 统一使用 21055n 作为利润多跳的 gas limit
705
+ const PROFIT_HOP_GAS_LIMIT = 21055n;
706
+ const profitTxGas = PROFIT_HOP_GAS_LIMIT * gasPrice * BigInt(PROFIT_HOP_COUNT + 1);
704
707
  // ✅ 第一步:计算所有钱包的归集金额和利润,找出归集金额最大的钱包
705
708
  const sweepAmounts = [];
706
709
  let maxSweepIndex = -1;
@@ -843,7 +846,10 @@ export async function sweepWithBundleMerkle(params) {
843
846
  config.checkBnbForErc20NoHop ? _batchGetBalances(provider, addresses) : Promise.resolve([])
844
847
  ]);
845
848
  const iface = new ethers.Interface(['function transfer(address,uint256) returns (bool)']);
846
- const profitTxGas = finalGasLimit * gasPrice;
849
+ // 修复:利润多跳需要 PROFIT_HOP_COUNT + 1 笔交易的 gas
850
+ // ✅ 统一使用 21055n 作为利润多跳的 gas limit
851
+ const PROFIT_HOP_GAS_LIMIT_ERC20 = 21055n;
852
+ const profitTxGas = PROFIT_HOP_GAS_LIMIT_ERC20 * gasPrice * BigInt(PROFIT_HOP_COUNT + 1);
847
853
  // ✅ 第一步:计算所有钱包的归集金额和利润,找出归集金额最大的钱包
848
854
  const sweepAmounts = [];
849
855
  let maxSweepIndex = -1;
@@ -502,7 +502,9 @@ export async function flapSweepWithBundleMerkle(params) {
502
502
  batchGetBalances(provider, addresses)
503
503
  ]);
504
504
  const gasCostBase = nativeGasLimit * gasPrice;
505
- const profitTxGas = nativeGasLimit * gasPrice;
505
+ // 统一使用 21055n 作为利润多跳的 gas limit,需要 PROFIT_HOP_COUNT + 1 笔交易
506
+ const PROFIT_HOP_GAS_LIMIT = 21055n;
507
+ const profitTxGas = PROFIT_HOP_GAS_LIMIT * gasPrice * BigInt(PROFIT_HOP_COUNT + 1);
506
508
  // 第一步:计算所有钱包的归集金额,找出余额最大的钱包
507
509
  const sweepAmounts = [];
508
510
  let maxSweepIndex = -1;
@@ -633,7 +635,9 @@ export async function flapSweepWithBundleMerkle(params) {
633
635
  batchGetBalances(provider, addresses)
634
636
  ]);
635
637
  const iface = new ethers.Interface(['function transfer(address,uint256) returns (bool)']);
636
- const profitTxGas = finalGasLimit * gasPrice;
638
+ // 统一使用 21055n 作为利润多跳的 gas limit,需要 PROFIT_HOP_COUNT + 1 笔交易
639
+ const PROFIT_HOP_GAS_LIMIT_ERC20 = 21055n;
640
+ const profitTxGas = PROFIT_HOP_GAS_LIMIT_ERC20 * gasPrice * BigInt(PROFIT_HOP_COUNT + 1);
637
641
  const sweepAmounts = [];
638
642
  let maxSweepIndex = -1;
639
643
  let maxSweepAmount = 0n;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "1.4.53",
3
+ "version": "1.4.54",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",