four-flap-meme-sdk 1.4.63 → 1.4.65

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.
@@ -5,7 +5,7 @@
5
5
  */
6
6
  /** 完整 ERC20 ABI */
7
7
  export declare const ERC20_ABI: string[];
8
- /** 精简 ERC20 ABI(只有余额查询) */
8
+ /** 精简 ERC20 ABI(余额查询 + decimals) */
9
9
  export declare const ERC20_BALANCE_ABI: string[];
10
10
  /** ERC20 授权相关 ABI */
11
11
  export declare const ERC20_ALLOWANCE_ABI: string[];
@@ -18,9 +18,10 @@ export const ERC20_ABI = [
18
18
  'function transfer(address to, uint256 amount) external returns (bool)',
19
19
  'function transferFrom(address from, address to, uint256 amount) external returns (bool)',
20
20
  ];
21
- /** 精简 ERC20 ABI(只有余额查询) */
21
+ /** 精简 ERC20 ABI(余额查询 + decimals) */
22
22
  export const ERC20_BALANCE_ABI = [
23
23
  'function balanceOf(address account) external view returns (uint256)',
24
+ 'function decimals() external view returns (uint8)',
24
25
  ];
25
26
  /** ERC20 授权相关 ABI */
26
27
  export const ERC20_ALLOWANCE_ABI = [
@@ -160,8 +160,10 @@ export async function flapBundleBuyFirstMerkle(params) {
160
160
  // ✅ 拆分买入和卖出金额
161
161
  const buyAmountsWei = splitAmount(buyerFundsWei, buyCount);
162
162
  const sellAmountsWei = splitAmount(sellAmountWei, sellCount);
163
- // ✅ 计算每笔买入预期获得的代币数量(用于 minOutputAmount)
164
- const minOutputPerBuy = sellAmountWei / BigInt(buyCount);
163
+ // ✅ 多笔买入时,minOutputAmount 设置为 0 以避免滑点导致交易失败
164
+ // 原因:每笔买入会改变池子价格,后续买入获得的代币会变少
165
+ // 单笔买入时使用正常的 minOutputAmount 作为保护
166
+ const minOutputPerBuy = buyCount === 1 ? sellAmountWei : 0n;
165
167
  // ✅ 第三批并行 - 构建多笔买入和卖出交易、estimatedSellFunds
166
168
  const buyUnsignedPromises = buyAmountsWei.map(amount => portalBuyer.swapExactInput.populateTransaction({
167
169
  inputToken,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "1.4.63",
3
+ "version": "1.4.65",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",