four-flap-meme-sdk 1.7.84 → 1.7.85
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.
package/dist/utils/lp-inspect.js
CHANGED
|
@@ -313,7 +313,23 @@ export async function inspectTokenLP(token, opts) {
|
|
|
313
313
|
if (opts.flapChain) {
|
|
314
314
|
try {
|
|
315
315
|
const flap = new FlapPortal({ chain: opts.flapChain, rpcUrl: opts.rpcUrl });
|
|
316
|
-
|
|
316
|
+
// ✅ 优先尝试 getTokenV7(包含 taxRate),失败则 fallback 到 getTokenV5
|
|
317
|
+
let st = null;
|
|
318
|
+
let taxRate;
|
|
319
|
+
try {
|
|
320
|
+
const stV7 = await flap.getTokenV7(token);
|
|
321
|
+
st = stV7;
|
|
322
|
+
// taxRate 是 bigint,需要转换为 number
|
|
323
|
+
taxRate = typeof stV7.taxRate === 'bigint' ? Number(stV7.taxRate) : Number(stV7.taxRate ?? 0);
|
|
324
|
+
if (opts.debug)
|
|
325
|
+
console.log('[LP Inspect] Flap V7 taxRate:', taxRate);
|
|
326
|
+
}
|
|
327
|
+
catch {
|
|
328
|
+
// V7 不支持,fallback 到 V5
|
|
329
|
+
st = await flap.getTokenV5(token);
|
|
330
|
+
if (opts.debug)
|
|
331
|
+
console.log('[LP Inspect] Flap V7 failed, using V5');
|
|
332
|
+
}
|
|
317
333
|
if (st && st.status !== undefined && Number(st.status) !== 4) {
|
|
318
334
|
result.platform = 'FLAP';
|
|
319
335
|
let quoteDecimals = 18;
|
|
@@ -331,6 +347,7 @@ export async function inspectTokenLP(token, opts) {
|
|
|
331
347
|
reserveNative: formatBalance(st.reserve, shouldFormat, quoteDecimals),
|
|
332
348
|
circulatingSupply: formatBalance(st.circulatingSupply, shouldFormat, tokenDecimals ?? 18),
|
|
333
349
|
price: formatBalance(st.price, shouldFormat),
|
|
350
|
+
taxRate, // ✅ 包含税率
|
|
334
351
|
};
|
|
335
352
|
return result;
|
|
336
353
|
}
|