four-flap-meme-sdk 2.2.7 → 2.2.8

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.
@@ -27,6 +27,8 @@ export declare const FLAP_ORIGINAL_PORTAL_ADDRESSES: {
27
27
  */
28
28
  export declare const FLAP_TOKEN_IMPL_ADDRESSES: {
29
29
  readonly BSC_NORMAL: "0x8b4329947e34b6d56d71a3385cac122bade7d78d";
30
+ /** TOKEN_V3_PERMIT / newTokenV7(Flap Portal v5.8.6+,vanity 后缀仍为 8888) */
31
+ readonly BSC_V3_PERMIT: "0x88881b6f03090462a969eC7f48385744Eeb63333";
30
32
  readonly BSC_TAXED: "0x29e6383F0ce68507b5A72a53c2B118a118332aA8";
31
33
  readonly BSC_TAXED_V5: "0xae562c6A05b798499507c6276C6Ed796027807BA";
32
34
  readonly BASE: "0xF3c514E04f83166E80718f29f0d34F206be40A0A";
@@ -29,6 +29,8 @@ export const FLAP_ORIGINAL_PORTAL_ADDRESSES = {
29
29
  */
30
30
  export const FLAP_TOKEN_IMPL_ADDRESSES = {
31
31
  BSC_NORMAL: '0x8b4329947e34b6d56d71a3385cac122bade7d78d',
32
+ /** TOKEN_V3_PERMIT / newTokenV7(Flap Portal v5.8.6+,vanity 后缀仍为 8888) */
33
+ BSC_V3_PERMIT: '0x88881b6f03090462a969eC7f48385744Eeb63333',
32
34
  BSC_TAXED: '0x29e6383F0ce68507b5A72a53c2B118a118332aA8', // V2: 只有运营钱包的税代币
33
35
  BSC_TAXED_V5: '0xae562c6A05b798499507c6276C6Ed796027807BA', // V5: 高级税代币 (mkt/deflation/dividend/lp)
34
36
  BASE: '0xF3c514E04f83166E80718f29f0d34F206be40A0A',
@@ -15,14 +15,12 @@ function resolveCreateTokenLaunchFlags(params) {
15
15
  const normalizedTax = normalizeTaxLaunchConfig(params.taxV2Config, params.taxRate);
16
16
  const isTaxLaunch = !!normalizedTax || (params.taxRate ?? 0) > 0;
17
17
  const hasVault = !!normalizedTax?.vaultConfig && normalizedTax.vaultConfig.vaultType !== 'none';
18
- const useV4Portal = !isTaxLaunch &&
18
+ const useV7Portal = !isTaxLaunch &&
19
19
  !hasVault &&
20
- (params.lpFeeProfile !== undefined || params.dexId !== undefined);
21
- const useClInfinityLaunch = !isTaxLaunch &&
22
- !hasVault &&
23
- !useV4Portal &&
24
- params.migratorType === MigratorType.PCS_INFINITY_CL_MIGRATOR;
25
- return { normalizedTax, isTaxLaunch, hasVault, useV4Portal, useClInfinityLaunch };
20
+ (params.lpFeeProfile !== undefined ||
21
+ params.dexId !== undefined ||
22
+ params.migratorType === MigratorType.PCS_INFINITY_CL_MIGRATOR);
23
+ return { normalizedTax, isTaxLaunch, hasVault, useV7Portal };
26
24
  }
27
25
  /**
28
26
  * 无捆绑钱包、仅 Dev 自跟买、原生报价 → Flap 文档方式 A(create 内 quoteAmt + msg.value)
@@ -54,7 +52,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
54
52
  const portalAddr = FLAP_PORTAL_ADDRESSES[chain];
55
53
  const originalPortalAddr = FLAP_ORIGINAL_PORTAL_ADDRESSES[chain];
56
54
  const portal = new ethers.Contract(originalPortalAddr, PORTAL_ABI, devWallet);
57
- const { normalizedTax, useV4Portal, useClInfinityLaunch } = resolveCreateTokenLaunchFlags(params);
55
+ const { normalizedTax, useV7Portal } = resolveCreateTokenLaunchFlags(params);
58
56
  const inputToken = params.quoteToken && params.quoteToken !== ZERO_ADDRESS ? params.quoteToken : ZERO_ADDRESS;
59
57
  const useNativeToken = inputToken === ZERO_ADDRESS;
60
58
  const extractProfit = config.extractProfitOnLaunch === false ? false : shouldExtractProfit(config);
@@ -80,8 +78,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
80
78
  lpFeeProfile: params.lpFeeProfile,
81
79
  extensionID: params.extensionID,
82
80
  extensionData: params.extensionData,
83
- useV4Portal,
84
- useClInfinityLaunch,
81
+ useV7Portal,
85
82
  taxConfig: normalizedTax,
86
83
  initialQuoteAmt: useMethodA ? methodAQuoteAmt : 0n,
87
84
  });
@@ -309,13 +309,11 @@ export async function flapBundleCreateToDex(params) {
309
309
  const normalizedTax = normalizeTaxLaunchConfig(params.taxV2Config, params.taxRate);
310
310
  const isTaxLaunch = !!normalizedTax || (params.taxRate ?? 0) > 0;
311
311
  const hasVault = !!normalizedTax?.vaultConfig && normalizedTax.vaultConfig.vaultType !== 'none';
312
- const useV4Portal = !isTaxLaunch &&
312
+ const useV7Portal = !isTaxLaunch &&
313
313
  !hasVault &&
314
- (params.lpFeeProfile !== undefined || params.dexId !== undefined);
315
- const useClInfinityLaunch = !isTaxLaunch &&
316
- !hasVault &&
317
- !useV4Portal &&
318
- params.migratorType === MigratorType.PCS_INFINITY_CL_MIGRATOR;
314
+ (params.lpFeeProfile !== undefined ||
315
+ params.dexId !== undefined ||
316
+ params.migratorType === MigratorType.PCS_INFINITY_CL_MIGRATOR);
319
317
  const createUnsigned = await populateCreateTokenTransaction({
320
318
  chain,
321
319
  devWallet,
@@ -331,8 +329,7 @@ export async function flapBundleCreateToDex(params) {
331
329
  lpFeeProfile: params.lpFeeProfile,
332
330
  extensionID: params.extensionID,
333
331
  extensionData: params.extensionData,
334
- useV4Portal,
335
- useClInfinityLaunch,
332
+ useV7Portal,
336
333
  taxConfig: normalizedTax,
337
334
  });
338
335
  const createTx = {
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * 对齐 Flap 官方文档:
5
5
  * - newTokenV6:TOKEN_V2_PERMIT / TOKEN_TAXED_V3
6
- * - newTokenV4:标准 V3Pancake V3 费率 / dexId,与 CREATE2 vanity 一致)
7
- * - newTokenV7:TOKEN_V3_PERMIT(PCS Infinity CL,需显式 migratorType=3)
6
+ * - newTokenV7:TOKEN_V3_PERMITBSC 标准 V3 / PCS Infinity CL,与 Flap 官网一致)
7
+ * - newTokenV4:已弃用(Portal FeatureDisabled,勿再使用)
8
8
  * - VaultPortal.newTaxTokenWithVault:带金库的税币(legacy 参数结构)
9
9
  */
10
10
  import { Contract, type Wallet } from 'ethers';
@@ -45,9 +45,11 @@ export type PopulateCreateTokenParams = {
45
45
  lpFeeProfile?: number;
46
46
  extensionID?: string;
47
47
  extensionData?: string;
48
- /** 标准 V3 PancakenewTokenV4 + lpFeeProfile/dexId,对齐 Portal 文档与 vanity) */
48
+ /** 标准 V3 / TOKEN_V3_PERMITnewTokenV7 + PCS_INFINITY_CL_MIGRATOR,对齐 Flap Portal v5.8.6+) */
49
+ useV7Portal?: boolean;
50
+ /** @deprecated 使用 useV7Portal */
49
51
  useV4Portal?: boolean;
50
- /** PCS Infinity CL(newTokenV7,仅 migratorType=PCS_INFINITY_CL_MIGRATOR 时启用) */
52
+ /** @deprecated 已合并到 useV7Portal */
51
53
  useClInfinityLaunch?: boolean;
52
54
  /** 高级税币 / 税币 V3 配置 */
53
55
  taxConfig?: NormalizedTaxLaunchConfig;
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * 对齐 Flap 官方文档:
5
5
  * - newTokenV6:TOKEN_V2_PERMIT / TOKEN_TAXED_V3
6
- * - newTokenV4:标准 V3Pancake V3 费率 / dexId,与 CREATE2 vanity 一致)
7
- * - newTokenV7:TOKEN_V3_PERMIT(PCS Infinity CL,需显式 migratorType=3)
6
+ * - newTokenV7:TOKEN_V3_PERMITBSC 标准 V3 / PCS Infinity CL,与 Flap 官网一致)
7
+ * - newTokenV4:已弃用(Portal FeatureDisabled,勿再使用)
8
8
  * - VaultPortal.newTaxTokenWithVault:带金库的税币(legacy 参数结构)
9
9
  */
10
10
  import { Contract, ZeroAddress } from 'ethers';
@@ -94,6 +94,47 @@ export function normalizeTaxLaunchConfig(input, fallbackTaxRate) {
94
94
  function resolveCreateQuoteAmt(params) {
95
95
  return params.initialQuoteAmt ?? 0n;
96
96
  }
97
+ function resolveUseV7Portal(params) {
98
+ return !!(params.useV7Portal ?? params.useV4Portal ?? params.useClInfinityLaunch);
99
+ }
100
+ /** Flap 文档:TOKEN_V3_PERMIT 须 migratorType=3、feeConfigs 单槽 MARKETING_OR_VAULT 10000 bps */
101
+ function buildNewTokenV7PermitParams(params) {
102
+ const emptyFeeConfig = {
103
+ feeType: FeeType.NONE,
104
+ bps: 0,
105
+ marketingAddress: ZeroAddress,
106
+ dividendToken: ZeroAddress,
107
+ minimumShareBalance: 0n,
108
+ };
109
+ const marketingFeeConfig = {
110
+ feeType: FeeType.MARKETING_OR_VAULT,
111
+ bps: 10000,
112
+ marketingAddress: params.beneficiary,
113
+ dividendToken: ZeroAddress,
114
+ minimumShareBalance: 0n,
115
+ };
116
+ return {
117
+ name: params.tokenInfo.name,
118
+ symbol: params.tokenInfo.symbol,
119
+ meta: params.tokenInfo.meta,
120
+ dexThresh: (params.dexThresh ?? 1) & 0xff,
121
+ salt: params.salt ?? zeroBytes32(),
122
+ migratorType: MigratorType.PCS_INFINITY_CL_MIGRATOR,
123
+ quoteToken: params.quoteToken || ZERO_ADDRESS,
124
+ quoteAmt: resolveCreateQuoteAmt(params),
125
+ permitData: '0x',
126
+ extensionID: params.extensionID ?? zeroBytes32(),
127
+ extensionData: params.extensionData ?? '0x',
128
+ dexId: (params.dexId ?? 0) & 0xff,
129
+ buyTaxRate: 0,
130
+ sellTaxRate: 0,
131
+ taxDuration: 0n,
132
+ antiFarmerDuration: 0n,
133
+ commissionReceiver: ZeroAddress,
134
+ tokenVersion: TokenVersion.TOKEN_V3_PERMIT,
135
+ feeConfigs: [marketingFeeConfig, emptyFeeConfig, emptyFeeConfig, emptyFeeConfig],
136
+ };
137
+ }
97
138
  export async function populateCreateTokenTransaction(params) {
98
139
  const taxConfig = params.taxConfig;
99
140
  const { buyTaxRate, sellTaxRate } = resolveTaxRates(taxConfig, params.taxRate);
@@ -156,58 +197,11 @@ export async function populateCreateTokenTransaction(params) {
156
197
  sellTaxRate,
157
198
  }, { mktBps: 10000, deflationBps: 0, dividendBps: 0, lpBps: 0 }));
158
199
  }
159
- // 3) 标准 V3 PancakenewTokenV4 — 与 memeweb 2.2.2 / CREATE2 vanity 一致)
160
- if (params.useV4Portal) {
161
- return params.originalPortal.newTokenV4.populateTransaction({
162
- name: params.tokenInfo.name,
163
- symbol: params.tokenInfo.symbol,
164
- meta: params.tokenInfo.meta,
165
- dexThresh: (params.dexThresh ?? 1) & 0xff,
166
- salt: params.salt ?? zeroBytes32(),
167
- taxRate: (params.taxRate ?? 0) & 0xffff,
168
- migratorType: (params.migratorType ?? MigratorType.V3_MIGRATOR) & 0xff,
169
- quoteToken: params.quoteToken || ZERO_ADDRESS,
170
- quoteAmt,
171
- beneficiary: params.beneficiary,
172
- permitData: '0x',
173
- extensionID: params.extensionID ?? zeroBytes32(),
174
- extensionData: params.extensionData ?? '0x',
175
- dexId: (params.dexId ?? 0) & 0xff,
176
- lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff,
177
- });
178
- }
179
- // 4) PCS Infinity CL(newTokenV7,仅显式 CL 迁移时)
180
- if (params.useClInfinityLaunch) {
181
- const emptyFeeConfig = {
182
- feeType: FeeType.NONE,
183
- bps: 0,
184
- marketingAddress: ZeroAddress,
185
- dividendToken: ZeroAddress,
186
- minimumShareBalance: 0n,
187
- };
188
- return params.originalPortal.newTokenV7.populateTransaction({
189
- name: params.tokenInfo.name,
190
- symbol: params.tokenInfo.symbol,
191
- meta: params.tokenInfo.meta,
192
- dexThresh: (params.dexThresh ?? 1) & 0xff,
193
- salt: params.salt ?? zeroBytes32(),
194
- migratorType: MigratorType.PCS_INFINITY_CL_MIGRATOR,
195
- quoteToken: params.quoteToken || ZERO_ADDRESS,
196
- quoteAmt,
197
- permitData: '0x',
198
- extensionID: params.extensionID ?? zeroBytes32(),
199
- extensionData: params.extensionData ?? '0x',
200
- dexId: (params.dexId ?? 0) & 0xff,
201
- buyTaxRate: 0,
202
- sellTaxRate: 0,
203
- taxDuration: 0n,
204
- antiFarmerDuration: 0n,
205
- commissionReceiver: ZeroAddress,
206
- tokenVersion: TokenVersion.TOKEN_V3_PERMIT,
207
- feeConfigs: [emptyFeeConfig, emptyFeeConfig, emptyFeeConfig, emptyFeeConfig],
208
- });
200
+ // 3) 标准 V3 / TOKEN_V3_PERMITnewTokenV7 — 与 Flap 官网 / Portal v5.8.6+ 一致;V4 FeatureDisabled)
201
+ if (resolveUseV7Portal(params)) {
202
+ return params.originalPortal.newTokenV7.populateTransaction(buildNewTokenV7PermitParams(params));
209
203
  }
210
- // 5) 仅 extension(newTokenV3)
204
+ // 4) 仅 extension(newTokenV3)
211
205
  const hasExtension = !!params.extensionID &&
212
206
  params.extensionID !== zeroBytes32() &&
213
207
  params.lpFeeProfile === undefined &&
@@ -229,7 +223,7 @@ export async function populateCreateTokenTransaction(params) {
229
223
  extensionData: params.extensionData ?? '0x',
230
224
  });
231
225
  }
232
- // 6) 标准 V2(newTokenV6 + TOKEN_V2_PERMIT)
226
+ // 5) 标准 V2(newTokenV6 + TOKEN_V2_PERMIT)
233
227
  return params.originalPortal.newTokenV6.populateTransaction({
234
228
  name: params.tokenInfo.name,
235
229
  symbol: params.tokenInfo.symbol,
@@ -11,7 +11,9 @@ export declare function predictVanityTokenAddress(salt: string, portal: string,
11
11
  * @param taxedV5 - 是否使用 V5 高级税代币实现 (mkt/deflation/dividend/lp)
12
12
  */
13
13
  export declare function predictVanityTokenAddressByChain(chain: 'BSC' | 'BASE' | 'XLAYER' | 'MORPH' | 'MONAD', salt: string, taxed?: boolean, taxedV5?: boolean, // ✅ V5 高级税代币标识 (mkt/deflation/dividend/lp)
14
- taxedV3?: boolean): string;
14
+ taxedV3?: boolean, // ✅ V5 + Vault 金库税代币标识
15
+ /** BSC 标准币 + newTokenV7 / TOKEN_V3_PERMIT */
16
+ useV3Permit?: boolean): string;
15
17
  /**
16
18
  * 寻找满足后缀的 salt(默认 8888)
17
19
  * 注意:该方法为同步 CPU 搜索,谨慎设置迭代限制
@@ -43,6 +45,8 @@ export declare function findSaltEndingByChain(opts: {
43
45
  taxed?: boolean;
44
46
  taxedV5?: boolean;
45
47
  taxedV3?: boolean;
48
+ /** BSC 标准币 UI「V3」/ newTokenV7 */
49
+ useV3Permit?: boolean;
46
50
  }): Promise<{
47
51
  salt: string;
48
52
  address: string;
@@ -20,7 +20,9 @@ export function predictVanityTokenAddress(salt, portal, tokenImpl) {
20
20
  * @param taxedV5 - 是否使用 V5 高级税代币实现 (mkt/deflation/dividend/lp)
21
21
  */
22
22
  export function predictVanityTokenAddressByChain(chain, salt, taxed = false, taxedV5 = false, // ✅ V5 高级税代币标识 (mkt/deflation/dividend/lp)
23
- taxedV3 = false) {
23
+ taxedV3 = false, // ✅ V5 + Vault 金库税代币标识
24
+ /** BSC 标准币 + newTokenV7 / TOKEN_V3_PERMIT */
25
+ useV3Permit = false) {
24
26
  // 使用 Flap 平台的原始 Portal 地址(用于 CREATE2)
25
27
  const portal = FLAP_ORIGINAL_PORTAL_ADDRESSES[chain];
26
28
  let tokenImpl;
@@ -29,6 +31,9 @@ taxedV3 = false) {
29
31
  // ✅ V5 高级税代币(含 vault)使用新的实现地址
30
32
  tokenImpl = FLAP_TOKEN_IMPL_ADDRESSES.BSC_TAXED_V5;
31
33
  }
34
+ else if (useV3Permit) {
35
+ tokenImpl = FLAP_TOKEN_IMPL_ADDRESSES.BSC_V3_PERMIT;
36
+ }
32
37
  else {
33
38
  tokenImpl = taxed ? FLAP_TOKEN_IMPL_ADDRESSES.BSC_TAXED : FLAP_TOKEN_IMPL_ADDRESSES.BSC_NORMAL;
34
39
  }
@@ -82,6 +87,9 @@ export async function findSaltEndingByChain(opts) {
82
87
  // ✅ V5 高级税代币(含 vault)使用新的实现地址
83
88
  tokenImpl = FLAP_TOKEN_IMPL_ADDRESSES.BSC_TAXED_V5;
84
89
  }
90
+ else if (opts.useV3Permit) {
91
+ tokenImpl = FLAP_TOKEN_IMPL_ADDRESSES.BSC_V3_PERMIT;
92
+ }
85
93
  else {
86
94
  tokenImpl = opts.taxed ? FLAP_TOKEN_IMPL_ADDRESSES.BSC_TAXED : FLAP_TOKEN_IMPL_ADDRESSES.BSC_NORMAL;
87
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "2.2.7",
3
+ "version": "2.2.8",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",