four-flap-meme-sdk 2.2.11 → 2.2.12

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.
@@ -158,8 +158,13 @@ export async function createTokenWithBundleBuyMerkle(params) {
158
158
  profitTokenAmount = totalProfit / divisor;
159
159
  }
160
160
  // ✅ 优化:并行获取 unsignedBuys 和 buyerNonces
161
+ // TOKEN_V3_PERMIT / newTokenV7 内盘买入须 swapExactInputV3(与 create-to-dex 一致)
162
+ const usePortalSwapV3 = useV7Portal ||
163
+ (params.lpFeeProfile !== undefined && !normalizedTax) ||
164
+ (!!params.extensionID &&
165
+ params.extensionID !== '0x' + '00'.repeat(32));
161
166
  const [unsignedBuys, buyerNonces] = await Promise.all([
162
- populateBuyTransactionsWithQuote(buyers, portalAddr, tokenAddress, adjustedFundsList, inputToken, useNativeToken),
167
+ populateBuyTransactionsWithQuote(buyers, portalAddr, tokenAddress, adjustedFundsList, inputToken, useNativeToken, usePortalSwapV3, params.extensionData ?? '0x'),
163
168
  allocateBuyerNonces(buyers, extractProfit, maxFundsIndex, useNativeToken ? totalProfit : profitTokenAmount, nonceManager)
164
169
  ]);
165
170
  // ✅ 贿赂交易放在首位(提高 BlockRazor 打包优先级)
@@ -667,17 +672,22 @@ function findMaxIndex(values) {
667
672
  * ✅ 支持 quoteToken 的买入交易构建
668
673
  * 当 inputToken 为非零地址(如 USDC)时,value 为 0
669
674
  */
670
- async function populateBuyTransactionsWithQuote(buyers, portalAddr, tokenAddress, fundsList, inputToken, useNativeToken) {
675
+ async function populateBuyTransactionsWithQuote(buyers, portalAddr, tokenAddress, fundsList, inputToken, useNativeToken, usePortalSwapV3 = false, extensionData = '0x') {
671
676
  const portals = buyers.map(wallet => new ethers.Contract(portalAddr, PORTAL_ABI, wallet));
672
- return await Promise.all(portals.map((portal, i) => portal.swapExactInput.populateTransaction({
673
- inputToken,
674
- outputToken: tokenAddress,
675
- inputAmount: fundsList[i],
676
- minOutputAmount: 0n,
677
- permitData: '0x'
678
- },
679
- // ✅ 如果使用原生代币,value 为购买金额;否则为 0
680
- useNativeToken ? { value: fundsList[i] } : {})));
677
+ return await Promise.all(portals.map((portal, i) => {
678
+ const swapParams = {
679
+ inputToken,
680
+ outputToken: tokenAddress,
681
+ inputAmount: fundsList[i],
682
+ minOutputAmount: 0n,
683
+ permitData: '0x',
684
+ };
685
+ const overrides = useNativeToken ? { value: fundsList[i] } : {};
686
+ if (usePortalSwapV3) {
687
+ return portal.swapExactInputV3.populateTransaction({ ...swapParams, extensionData: extensionData ?? '0x' }, overrides);
688
+ }
689
+ return portal.swapExactInput.populateTransaction(swapParams, overrides);
690
+ }));
681
691
  }
682
692
  function buildGasLimitList(length, config) {
683
693
  const gasLimit = getGasLimit(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "2.2.11",
3
+ "version": "2.2.12",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",