feat: 添加 Lighter 签名桥接和公钥派生脚本,支持新的签名库和环境检测功能

This commit is contained in:
discountry
2025-10-01 18:32:02 +08:00
parent c8b0ab1c8e
commit 4c4abb3b09
10 changed files with 665 additions and 253 deletions
+4 -2
View File
@@ -171,9 +171,11 @@ function defaultAsset(details: LighterAccountDetails): AsterAccountAsset[] {
function lighterPositionToAster(symbol: string, position: LighterPosition): AsterAccountPosition {
const sign = position.sign ?? 0;
const positionSide = sign > 0 ? "LONG" : sign < 0 ? "SHORT" : "BOTH";
const magnitude = Number(position.position ?? 0);
const signed = sign < 0 ? -Math.abs(magnitude) : Math.abs(magnitude);
return {
symbol: position.symbol ?? symbol,
positionAmt: position.position ?? "0",
symbol,
positionAmt: Number.isFinite(signed) ? signed.toString() : position.position ?? "0",
entryPrice: position.avg_entry_price ?? "0",
unrealizedProfit: position.unrealized_pnl ?? "0",
positionSide,