four-flap-meme-sdk 1.2.97 → 1.2.98

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.
@@ -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.98",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",