four-flap-meme-sdk 1.2.97 → 1.2.99

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.
@@ -7,9 +7,9 @@ export declare function predictVanityTokenAddress(salt: string, portal: string,
7
7
  * 预测 vanity 地址(使用链枚举)
8
8
  * SDK 自动使用该链的 Portal 和 TokenImpl 地址
9
9
  * 注意:使用 Flap 平台的原始 Portal 地址进行 CREATE2 计算
10
- * BSC 默认使用 NORMAL 实现(非税版)
10
+ * BSC/MONAD 默认使用 NORMAL 实现(非税版)
11
11
  */
12
- export declare function predictVanityTokenAddressByChain(chain: 'BSC' | 'BASE' | 'XLAYER' | 'MORPH', salt: string, taxed?: boolean): string;
12
+ export declare function predictVanityTokenAddressByChain(chain: 'BSC' | 'BASE' | 'XLAYER' | 'MORPH' | 'MONAD', salt: string, taxed?: boolean): string;
13
13
  /**
14
14
  * 寻找满足后缀的 salt(默认 8888)
15
15
  * 注意:该方法为同步 CPU 搜索,谨慎设置迭代限制
@@ -29,10 +29,10 @@ export declare function findSaltEnding(opts: {
29
29
  * 寻找满足后缀的 salt(使用链枚举)
30
30
  * SDK 自动使用该链的 Portal 和 TokenImpl 地址
31
31
  * 注意:使用 Flap 平台的原始 Portal 地址进行 CREATE2 计算
32
- * BSC 默认使用 NORMAL 实现(非税版)
32
+ * BSC/MONAD 默认使用 NORMAL 实现(非税版)
33
33
  */
34
34
  export declare function findSaltEndingByChain(opts: {
35
- chain: 'BSC' | 'BASE' | 'XLAYER' | 'MORPH';
35
+ chain: 'BSC' | 'BASE' | 'XLAYER' | 'MORPH' | 'MONAD';
36
36
  suffix?: string;
37
37
  maxIterations?: number;
38
38
  seed?: string;
@@ -18,7 +18,7 @@ export function predictVanityTokenAddress(salt, portal, tokenImpl) {
18
18
  * 预测 vanity 地址(使用链枚举)
19
19
  * SDK 自动使用该链的 Portal 和 TokenImpl 地址
20
20
  * 注意:使用 Flap 平台的原始 Portal 地址进行 CREATE2 计算
21
- * BSC 默认使用 NORMAL 实现(非税版)
21
+ * BSC/MONAD 默认使用 NORMAL 实现(非税版)
22
22
  */
23
23
  export function predictVanityTokenAddressByChain(chain, salt, taxed = false) {
24
24
  // 使用 Flap 平台的原始 Portal 地址(用于 CREATE2)
@@ -27,6 +27,10 @@ export function predictVanityTokenAddressByChain(chain, salt, taxed = false) {
27
27
  if (chain === 'BSC') {
28
28
  tokenImpl = taxed ? FLAP_TOKEN_IMPL_ADDRESSES.BSC_TAXED : FLAP_TOKEN_IMPL_ADDRESSES.BSC_NORMAL;
29
29
  }
30
+ else if (chain === 'MONAD') {
31
+ // ✅ Monad 链支持税版和普通版
32
+ tokenImpl = taxed ? FLAP_TOKEN_IMPL_ADDRESSES.MONAD_TAXED : FLAP_TOKEN_IMPL_ADDRESSES.MONAD_NORMAL;
33
+ }
30
34
  else {
31
35
  tokenImpl = FLAP_TOKEN_IMPL_ADDRESSES[chain];
32
36
  }
@@ -59,7 +63,7 @@ export async function findSaltEnding(opts) {
59
63
  * 寻找满足后缀的 salt(使用链枚举)
60
64
  * SDK 自动使用该链的 Portal 和 TokenImpl 地址
61
65
  * 注意:使用 Flap 平台的原始 Portal 地址进行 CREATE2 计算
62
- * BSC 默认使用 NORMAL 实现(非税版)
66
+ * BSC/MONAD 默认使用 NORMAL 实现(非税版)
63
67
  */
64
68
  export async function findSaltEndingByChain(opts) {
65
69
  // 使用 Flap 平台的原始 Portal 地址(用于 CREATE2)
@@ -68,6 +72,10 @@ export async function findSaltEndingByChain(opts) {
68
72
  if (opts.chain === 'BSC') {
69
73
  tokenImpl = opts.taxed ? FLAP_TOKEN_IMPL_ADDRESSES.BSC_TAXED : FLAP_TOKEN_IMPL_ADDRESSES.BSC_NORMAL;
70
74
  }
75
+ else if (opts.chain === 'MONAD') {
76
+ // ✅ Monad 链支持税版和普通版
77
+ tokenImpl = opts.taxed ? FLAP_TOKEN_IMPL_ADDRESSES.MONAD_TAXED : FLAP_TOKEN_IMPL_ADDRESSES.MONAD_NORMAL;
78
+ }
71
79
  else {
72
80
  tokenImpl = FLAP_TOKEN_IMPL_ADDRESSES[opts.chain];
73
81
  }
@@ -150,11 +150,19 @@ export async function inspectTokenLP(token, opts) {
150
150
  if (Number(st.status) !== 4) {
151
151
  out.platform = 'FLAP';
152
152
  out.decimals = tokenDecimals;
153
+ // ✅ 动态获取 quoteToken 的精度
154
+ // 如果 quoteToken 是零地址,则使用原生代币精度 (18)
155
+ // 否则查询 quoteToken 的精度(如 USDC 是 6 位)
156
+ const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
157
+ let quoteDecimals = 18;
158
+ if (st.quoteTokenAddress && st.quoteTokenAddress.toLowerCase() !== ZERO_ADDRESS) {
159
+ quoteDecimals = await getTokenDecimals(st.quoteTokenAddress, provider);
160
+ }
153
161
  out.flap = {
154
162
  quoteToken: st.quoteTokenAddress,
155
- reserveNative: formatBalance(st.reserve, shouldFormat),
156
- circulatingSupply: formatBalance(st.circulatingSupply, shouldFormat),
157
- price: formatBalance(st.price, shouldFormat),
163
+ reserveNative: formatBalance(st.reserve, shouldFormat, quoteDecimals),
164
+ circulatingSupply: formatBalance(st.circulatingSupply, shouldFormat, tokenDecimals ?? 18),
165
+ price: formatBalance(st.price, shouldFormat), // price 保持 18 位(合约返回的是 18 位精度)
158
166
  };
159
167
  return out;
160
168
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "1.2.97",
3
+ "version": "1.2.99",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",