four-flap-meme-sdk 1.7.85 → 1.7.86
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
|
@@ -349,6 +349,10 @@ export async function inspectTokenLP(token, opts) {
|
|
|
349
349
|
price: formatBalance(st.price, shouldFormat),
|
|
350
350
|
taxRate, // ✅ 包含税率
|
|
351
351
|
};
|
|
352
|
+
// ✅ 同时设置顶层税率,方便统一读取
|
|
353
|
+
if (taxRate && taxRate > 0) {
|
|
354
|
+
result.taxRate = taxRate;
|
|
355
|
+
}
|
|
352
356
|
return result;
|
|
353
357
|
}
|
|
354
358
|
}
|
|
@@ -511,6 +515,28 @@ export async function inspectTokenLP(token, opts) {
|
|
|
511
515
|
}
|
|
512
516
|
// 确定平台类型
|
|
513
517
|
result.platform = determinePlatform(result.allPools);
|
|
518
|
+
// ========================================
|
|
519
|
+
// 4. 外盘税率查询(仅 Flap 链)
|
|
520
|
+
// ========================================
|
|
521
|
+
// 对于已毕业到外盘的代币,尝试从 Flap Portal 获取税率
|
|
522
|
+
if (opts.flapChain && !result.flap && result.platform !== 'UNKNOWN') {
|
|
523
|
+
try {
|
|
524
|
+
const flap = new FlapPortal({ chain: opts.flapChain, rpcUrl: opts.rpcUrl });
|
|
525
|
+
const stV7 = await flap.getTokenV7(token);
|
|
526
|
+
// taxRate 是 bigint,需要转换为 number
|
|
527
|
+
const taxRate = typeof stV7.taxRate === 'bigint' ? Number(stV7.taxRate) : Number(stV7.taxRate ?? 0);
|
|
528
|
+
if (taxRate > 0) {
|
|
529
|
+
result.taxRate = taxRate;
|
|
530
|
+
if (opts.debug)
|
|
531
|
+
console.log('[LP Inspect] 外盘税率:', taxRate, 'bps');
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
catch (err) {
|
|
535
|
+
// V7 不支持或代币不是 Flap 创建的,忽略
|
|
536
|
+
if (opts.debug)
|
|
537
|
+
console.log('[LP Inspect] 外盘税率查询失败(可忽略):', err);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
514
540
|
return result;
|
|
515
541
|
}
|
|
516
542
|
// ============================================================================
|