four-flap-meme-sdk 1.5.29 → 1.5.30

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.
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { Wallet, ethers } from 'ethers';
5
5
  import { AANonceMap, } from './types.js';
6
- import { FLAP_PORTAL, } from './constants.js';
6
+ import { FLAP_PORTAL, ZERO_ADDRESS, } from './constants.js';
7
7
  import { AAAccountManager, encodeExecute } from './aa-account.js';
8
8
  import { encodeBuyCall, encodeSellCall, encodeApproveCall, PortalQuery, parseOkb, } from './portal-ops.js';
9
9
  import { BundleExecutor } from './bundle.js';
@@ -70,7 +70,18 @@ export class AAPortalSwapExecutor {
70
70
  needApprove = allowance < sellAmountWei;
71
71
  }
72
72
  // 3. 报价买入 OKB
73
- const quoted = await this.portalQuery.previewSell(tokenAddress, sellAmountWei);
73
+ // 关键修复:
74
+ // 在部分代币(例如已迁移到 DEX 的 token)上,FlapPortal.previewSell 会 revert(unknown custom error: 0xac5f6092)。
75
+ // 这会导致 AA 捆绑换手在“签名前置报价阶段”直接失败。
76
+ // 对这类 token,Portal 的 quoteExactInput.staticCall 可以正常返回报价,因此这里做降级。
77
+ const quoted = await (async () => {
78
+ try {
79
+ return await this.portalQuery.previewSell(tokenAddress, sellAmountWei);
80
+ }
81
+ catch {
82
+ return await this.portalQuery.quoteExactInput(tokenAddress, ZERO_ADDRESS, sellAmountWei);
83
+ }
84
+ })();
74
85
  const finalBuyAmountWei = buyAmountOkb
75
86
  ? parseOkb(String(buyAmountOkb))
76
87
  : (quoted * BigInt(10000 - slippageBps)) / 10000n;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "1.5.29",
3
+ "version": "1.5.30",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",