@lifi/perps-sdk-provider-lighter 14.0.0 → 16.0.0
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/cjs/LighterProvider.d.ts.map +1 -1
- package/dist/cjs/LighterProvider.js +84 -30
- package/dist/cjs/LighterProvider.js.map +1 -1
- package/dist/cjs/types/account.d.ts.map +1 -1
- package/dist/cjs/types/activity.d.ts +21 -1
- package/dist/cjs/types/activity.d.ts.map +1 -1
- package/dist/cjs/utils/mapFill.d.ts.map +1 -1
- package/dist/cjs/utils/mapFill.js +6 -1
- package/dist/cjs/utils/mapFill.js.map +1 -1
- package/dist/cjs/utils/mapOrder.d.ts.map +1 -1
- package/dist/cjs/utils/mapOrder.js +2 -1
- package/dist/cjs/utils/mapOrder.js.map +1 -1
- package/dist/cjs/utils/mapPosition.d.ts.map +1 -1
- package/dist/cjs/utils/mapPosition.js +1 -0
- package/dist/cjs/utils/mapPosition.js.map +1 -1
- package/dist/esm/LighterProvider.d.ts.map +1 -1
- package/dist/esm/LighterProvider.js +119 -32
- package/dist/esm/LighterProvider.js.map +1 -1
- package/dist/esm/types/account.d.ts +5 -0
- package/dist/esm/types/account.d.ts.map +1 -1
- package/dist/esm/types/activity.d.ts +55 -1
- package/dist/esm/types/activity.d.ts.map +1 -1
- package/dist/esm/utils/mapFill.d.ts.map +1 -1
- package/dist/esm/utils/mapFill.js +7 -1
- package/dist/esm/utils/mapFill.js.map +1 -1
- package/dist/esm/utils/mapOrder.d.ts.map +1 -1
- package/dist/esm/utils/mapOrder.js +2 -1
- package/dist/esm/utils/mapOrder.js.map +1 -1
- package/dist/esm/utils/mapPosition.d.ts.map +1 -1
- package/dist/esm/utils/mapPosition.js +1 -0
- package/dist/esm/utils/mapPosition.js.map +1 -1
- package/dist/types/LighterProvider.d.ts.map +1 -1
- package/dist/types/types/account.d.ts +5 -0
- package/dist/types/types/account.d.ts.map +1 -1
- package/dist/types/types/activity.d.ts +55 -1
- package/dist/types/types/activity.d.ts.map +1 -1
- package/dist/types/utils/mapFill.d.ts.map +1 -1
- package/dist/types/utils/mapOrder.d.ts.map +1 -1
- package/dist/types/utils/mapPosition.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/LighterProvider.ts +156 -59
- package/src/types/account.ts +5 -0
- package/src/types/activity.ts +65 -1
- package/src/utils/mapFill.ts +8 -1
- package/src/utils/mapOrder.ts +2 -1
- package/src/utils/mapPosition.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapPosition.js","sourceRoot":"","sources":["../../../src/utils/mapPosition.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,GAAG,MAAM,QAAQ,CAAA;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEnE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAW,EAAsB,EAAE;IACjE,IAAI,MAAW,CAAA;IACf,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAClB,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAA;AAC5C,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,GAAsB,EACtB,MAA0B,EAChB,EAAE;IACZ,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;IACp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
|
23
23
|
unrealized_pnl: string;
|
|
24
24
|
realized_pnl: string;
|
|
25
25
|
liquidation_price: string;
|
|
26
|
+
/**
|
|
27
|
+
* Funding accrued since the position opened, signed from the account's point
|
|
28
|
+
* of view despite the field name: negative is funding the account paid and
|
|
29
|
+
* positive is funding it received. Lighter resets it to `"0"` on close.
|
|
30
|
+
*/
|
|
26
31
|
total_funding_paid_out: string;
|
|
27
32
|
margin_mode: number;
|
|
28
33
|
allocated_margin: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/types/account.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,uBAAuB,EAAE,MAAM,CAAA;IAC/B,gBAAgB,EAAE,MAAM,CAAA;IACxB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,yBAAyB,EAAE,MAAM,CAAA;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,EAAE,MAAM,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,iBAAiB,EAAE,MAAM,CAAA;IACzB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,CAAA;AAEtD;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,qDAAqD;IACrD,OAAO,EAAE,MAAM,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,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,sBAAsB,EAAE,OAAO,CAAA;IAC/B,sBAAsB,EAAE,MAAM,CAAA;IAC9B,sBAAsB,EAAE,MAAM,CAAA;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,oBAAoB,EAAE,MAAM,CAAA;CAC7B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;IACzB,0BAA0B,EAAE,MAAM,CAAA;IAClC,mBAAmB,EAAE,MAAM,CAAA;IAC3B,iBAAiB,EAAE,MAAM,CAAA;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;IACxB,oBAAoB,EAAE,MAAM,CAAA;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,YAAY,EAAE,CAAA;CAC7B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LtAccountPosition } from './account.js';
|
|
1
2
|
/**
|
|
2
3
|
* Deposit history row returned by Lighter. `amount` is a decimal asset amount,
|
|
3
4
|
* `timestamp` is Unix milliseconds, and `l1_tx_hash` identifies the settlement
|
|
@@ -62,6 +63,11 @@ export interface LtPositionFunding {
|
|
|
62
63
|
timestamp: number;
|
|
63
64
|
market_id: number;
|
|
64
65
|
funding_id: number;
|
|
66
|
+
/**
|
|
67
|
+
* Signed, in quote-currency units. Positive means the account received
|
|
68
|
+
* funding; negative means the account paid it. Mapped straight onto
|
|
69
|
+
* `FundingActivity.amount`.
|
|
70
|
+
*/
|
|
65
71
|
change: string;
|
|
66
72
|
rate: string;
|
|
67
73
|
position_size: string;
|
|
@@ -78,6 +84,52 @@ export interface LtPositionFundingsResponse {
|
|
|
78
84
|
position_fundings: LtPositionFunding[];
|
|
79
85
|
next_cursor?: string;
|
|
80
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Venue liquidation type Lighter reports on a liquidation row. A margin mode
|
|
89
|
+
* is a separate value carried on the row's position.
|
|
90
|
+
*
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
export type LtLiquidationType = 'partial' | 'deleverage';
|
|
94
|
+
/**
|
|
95
|
+
* Forced trade Lighter executed to close the liquidated position. Prices,
|
|
96
|
+
* sizes and fees are decimal strings in the market's native precision.
|
|
97
|
+
*
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
export interface LtLiqTrade {
|
|
101
|
+
price: string;
|
|
102
|
+
size: string;
|
|
103
|
+
taker_fee: string;
|
|
104
|
+
maker_fee: string;
|
|
105
|
+
/** Unix timestamp in milliseconds. */
|
|
106
|
+
transaction_time: number;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Position row inside a liquidation payload. Lighter returns the full
|
|
110
|
+
* `AccountPosition` shape here; the SDK models only the members the
|
|
111
|
+
* liquidation mapper reads.
|
|
112
|
+
*
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
export type LtLiquidationPosition = Pick<LtAccountPosition, 'market_id' | 'margin_mode'>;
|
|
116
|
+
/**
|
|
117
|
+
* Account snapshot Lighter attaches to a liquidation row. `risk_info_before`
|
|
118
|
+
* is the pre-trade state that breached maintenance margin. Lighter also
|
|
119
|
+
* reports the settled risk info, mark prices, assets and asset index prices
|
|
120
|
+
* here; the SDK models only the members the liquidation mapper reads.
|
|
121
|
+
*
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
export interface LtLiquidationInfo {
|
|
125
|
+
positions: LtLiquidationPosition[];
|
|
126
|
+
risk_info_before: {
|
|
127
|
+
cross_risk_parameters?: {
|
|
128
|
+
/** Account equity as a decimal string, in quote-currency units. */
|
|
129
|
+
total_account_value: string;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
}
|
|
81
133
|
/**
|
|
82
134
|
* Liquidation event row returned by Lighter. `executed_at` is a Unix timestamp
|
|
83
135
|
* in milliseconds.
|
|
@@ -87,7 +139,9 @@ export interface LtPositionFundingsResponse {
|
|
|
87
139
|
export interface LtLiquidation {
|
|
88
140
|
id: number;
|
|
89
141
|
market_id: number;
|
|
90
|
-
type:
|
|
142
|
+
type: LtLiquidationType;
|
|
143
|
+
trade: LtLiqTrade;
|
|
144
|
+
info: LtLiquidationInfo;
|
|
91
145
|
executed_at: number;
|
|
92
146
|
}
|
|
93
147
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../../src/types/activity.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,oBAAoB,EAAE,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAA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AAE,UAAU,EAAE,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapFill.d.ts","sourceRoot":"","sources":["../../../src/utils/mapFill.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAQ5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAyChD;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAClB,OAAO,OAAO,EACd,cAAc,MAAM,EACpB,QAAQ,aAAa,KACpB,
|
|
1
|
+
{"version":3,"file":"mapFill.d.ts","sourceRoot":"","sources":["../../../src/utils/mapFill.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAQ5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAyChD;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAClB,OAAO,OAAO,EACd,cAAc,MAAM,EACpB,QAAQ,aAAa,KACpB,IAkDF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapOrder.d.ts","sourceRoot":"","sources":["../../../src/utils/mapOrder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,KAAK,EACL,YAAY,EACb,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAGL,SAAS,EAEV,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAmDhD;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SA+BzD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,SAAS,KAAG,OAIjB,CAAA;AAE/B;;;;;;;;;;;;;;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;CAsBrB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,OAAO,EACd,QAAQ,aAAa,KACpB,KAeD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapPosition.d.ts","sourceRoot":"","sources":["../../../src/utils/mapPosition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAGrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAI1D;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,SAWtD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,GACtB,KAAK,iBAAiB,EACtB,QAAQ,kBAAkB,KACzB,
|
|
1
|
+
{"version":3,"file":"mapPosition.d.ts","sourceRoot":"","sources":["../../../src/utils/mapPosition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAGrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAI1D;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,SAWtD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,GACtB,KAAK,iBAAiB,EACtB,QAAQ,kBAAkB,KACzB,QAiCF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/perps-sdk-provider-lighter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0",
|
|
4
4
|
"description": "Lighter provider plugin for @lifi/perps-sdk",
|
|
5
5
|
"homepage": "https://github.com/lifinance/perps-sdk",
|
|
6
6
|
"bugs": {
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"big.js": "^7.0.1",
|
|
46
46
|
"viem": "^2.55.18",
|
|
47
|
-
"@lifi/perps-types": "^
|
|
47
|
+
"@lifi/perps-types": "^10.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@lifi/perps-sdk": "^
|
|
50
|
+
"@lifi/perps-sdk": "^9.0.0"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
package/src/LighterProvider.ts
CHANGED
|
@@ -37,8 +37,10 @@ import type {
|
|
|
37
37
|
ActivitiesResponse,
|
|
38
38
|
ActivityItem,
|
|
39
39
|
Balance,
|
|
40
|
+
Fill,
|
|
40
41
|
FillsResponse,
|
|
41
42
|
LighterAccountConfig,
|
|
43
|
+
LiquidationActivity,
|
|
42
44
|
MarketSettings,
|
|
43
45
|
Order,
|
|
44
46
|
OrdersResponse,
|
|
@@ -91,7 +93,7 @@ import type {
|
|
|
91
93
|
LtTransferHistoryResponse,
|
|
92
94
|
LtWithdrawHistoryResponse,
|
|
93
95
|
} from './types/index.js'
|
|
94
|
-
import { LT_MARGIN_MODE_ISOLATED } from './types/index.js'
|
|
96
|
+
import { LT_MARGIN_MODE_CROSS, LT_MARGIN_MODE_ISOLATED } from './types/index.js'
|
|
95
97
|
import {
|
|
96
98
|
decodeActivityCursor,
|
|
97
99
|
encodeActivityCursor,
|
|
@@ -116,6 +118,7 @@ import {
|
|
|
116
118
|
mapOpenPositions,
|
|
117
119
|
mapOrderDetail,
|
|
118
120
|
positionMarginConstraints,
|
|
121
|
+
toBigOrNull,
|
|
119
122
|
toIsoFromMs,
|
|
120
123
|
toIsoFromSeconds,
|
|
121
124
|
toRequiredBig,
|
|
@@ -153,6 +156,24 @@ const TX_HASH_PATTERN = /^[0-9a-f]{80}$/
|
|
|
153
156
|
|
|
154
157
|
const INACTIVE_ORDERS_LOOKUP_LIMIT = 100
|
|
155
158
|
|
|
159
|
+
/** Activity surfaces whose rows name a market, so they need the market registry. */
|
|
160
|
+
const MARKET_BEARING_TYPES: ReadonlySet<ActivityType> = new Set([
|
|
161
|
+
ActivityType.FUNDING,
|
|
162
|
+
ActivityType.LIQUIDATION,
|
|
163
|
+
])
|
|
164
|
+
|
|
165
|
+
/** Activity surfaces whose rows name an asset, so they need the asset registry. */
|
|
166
|
+
const ASSET_BEARING_TYPES: ReadonlySet<ActivityType> = new Set([
|
|
167
|
+
ActivityType.DEPOSIT,
|
|
168
|
+
ActivityType.WITHDRAWAL,
|
|
169
|
+
ActivityType.TRANSFER,
|
|
170
|
+
])
|
|
171
|
+
|
|
172
|
+
const wantsAnyType = (
|
|
173
|
+
requested: ActivityType[] | undefined,
|
|
174
|
+
wanted: ReadonlySet<ActivityType>
|
|
175
|
+
): boolean => requested === undefined || requested.some((t) => wanted.has(t))
|
|
176
|
+
|
|
156
177
|
/**
|
|
157
178
|
* Expiry requested when the SDK lazily creates a Lighter read-only token for
|
|
158
179
|
* authenticated reads. One day under Lighter's 10-year maximum: the cap is
|
|
@@ -1193,9 +1214,17 @@ export const createLighterProvider = (
|
|
|
1193
1214
|
client.getAuthed<LtTradesResponse>('/api/v1/trades', tok, queryParams)
|
|
1194
1215
|
)
|
|
1195
1216
|
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1217
|
+
// `get`, not `require`: a market id the backend list no longer carries
|
|
1218
|
+
// drops only its own row instead of rejecting the whole page. The
|
|
1219
|
+
// registry warns once per unresolved id. A delisted market still
|
|
1220
|
+
// resolves, so its rows stay.
|
|
1221
|
+
const items = response.trades.flatMap((t): Fill[] => {
|
|
1222
|
+
const market = registry.get(String(t.market_id))
|
|
1223
|
+
if (market === undefined) {
|
|
1224
|
+
return []
|
|
1225
|
+
}
|
|
1226
|
+
return [mapFill(t, account.index, market)]
|
|
1227
|
+
})
|
|
1199
1228
|
|
|
1200
1229
|
return {
|
|
1201
1230
|
provider: providerKey,
|
|
@@ -1226,6 +1255,8 @@ export const createLighterProvider = (
|
|
|
1226
1255
|
const account = await fetchDetailedAccount(client, params.address)
|
|
1227
1256
|
const marketRegistry = getMarketRegistry(requireClient(), providerKey)
|
|
1228
1257
|
const assetRegistry = getAssetRegistry(requireClient(), providerKey)
|
|
1258
|
+
// Markets identify funding and liquidation rows; assets identify ledger
|
|
1259
|
+
// rows. A request for one surface must not pull the other's registry.
|
|
1229
1260
|
const [history] = await Promise.all([
|
|
1230
1261
|
retryOnRevoked(opts, params.address, token, (t) =>
|
|
1231
1262
|
fetchAllHistory(
|
|
@@ -1237,10 +1268,17 @@ export const createLighterProvider = (
|
|
|
1237
1268
|
inputCursor
|
|
1238
1269
|
)
|
|
1239
1270
|
),
|
|
1240
|
-
|
|
1241
|
-
|
|
1271
|
+
wantsAnyType(params.type, MARKET_BEARING_TYPES)
|
|
1272
|
+
? marketRegistry.sync()
|
|
1273
|
+
: Promise.resolve(),
|
|
1274
|
+
wantsAnyType(params.type, ASSET_BEARING_TYPES)
|
|
1275
|
+
? assetRegistry.sync()
|
|
1276
|
+
: Promise.resolve(),
|
|
1242
1277
|
])
|
|
1243
1278
|
|
|
1279
|
+
const assetSymbol = (assetId: number): string =>
|
|
1280
|
+
assetRegistry.get(String(assetId))?.displaySymbol ?? String(assetId)
|
|
1281
|
+
|
|
1244
1282
|
const items: ActivityItem[] = [
|
|
1245
1283
|
...history.deposits.deposits.map(
|
|
1246
1284
|
(d): ActivityItem => ({
|
|
@@ -1248,85 +1286,144 @@ export const createLighterProvider = (
|
|
|
1248
1286
|
provider: providerKey,
|
|
1249
1287
|
timestamp: toIsoFromMs(d.timestamp),
|
|
1250
1288
|
type: ActivityType.DEPOSIT,
|
|
1289
|
+
asset: assetSymbol(d.asset_id),
|
|
1251
1290
|
amount: d.amount,
|
|
1252
1291
|
explorerLink: d.l1_tx_hash
|
|
1253
1292
|
? `https://scan.li.fi/tx/${d.l1_tx_hash}`
|
|
1254
1293
|
: undefined,
|
|
1255
1294
|
})
|
|
1256
1295
|
),
|
|
1296
|
+
// `/withdraw/history` carries no fee field, so `fee` stays absent
|
|
1297
|
+
// rather than claiming a zero fee the venue never reported.
|
|
1257
1298
|
...history.withdraws.withdraws.map(
|
|
1258
1299
|
(w): ActivityItem => ({
|
|
1259
1300
|
id: w.id,
|
|
1260
1301
|
provider: providerKey,
|
|
1261
1302
|
timestamp: toIsoFromMs(w.timestamp),
|
|
1262
1303
|
type: ActivityType.WITHDRAWAL,
|
|
1304
|
+
asset: assetSymbol(w.asset_id),
|
|
1263
1305
|
amount: w.amount,
|
|
1264
|
-
fee: '0',
|
|
1265
1306
|
explorerLink: w.l1_tx_hash
|
|
1266
1307
|
? `https://scan.li.fi/tx/${w.l1_tx_hash}`
|
|
1267
1308
|
: undefined,
|
|
1268
1309
|
})
|
|
1269
1310
|
),
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
accountValue: '0',
|
|
1290
|
-
leverageType: l.type,
|
|
1291
|
-
liquidatedPositions: [
|
|
1292
|
-
{
|
|
1293
|
-
market: marketRegistry.require(String(l.market_id)),
|
|
1294
|
-
size: '0',
|
|
1295
|
-
},
|
|
1296
|
-
],
|
|
1297
|
-
})
|
|
1298
|
-
),
|
|
1299
|
-
...history.transfers.transfers.map((t): ActivityItem => {
|
|
1300
|
-
const direction: 'IN' | 'OUT' =
|
|
1301
|
-
t.from_account_index === account.index ? 'OUT' : 'IN'
|
|
1302
|
-
const counterpartyAccountIndex =
|
|
1303
|
-
direction === 'OUT' ? t.to_account_index : t.from_account_index
|
|
1304
|
-
return {
|
|
1305
|
-
id: t.id,
|
|
1306
|
-
provider: providerKey,
|
|
1307
|
-
timestamp: toIsoFromMs(t.timestamp),
|
|
1308
|
-
type: ActivityType.TRANSFER,
|
|
1309
|
-
direction,
|
|
1310
|
-
counterpartyAccountIndex,
|
|
1311
|
-
asset:
|
|
1312
|
-
assetRegistry.get(String(t.asset_id))?.displaySymbol ??
|
|
1313
|
-
String(t.asset_id),
|
|
1314
|
-
amount: t.amount,
|
|
1315
|
-
explorerLink: explorerTxUrlFromBase(explorerTxBaseUrl, t.tx_hash),
|
|
1316
|
-
meta: {
|
|
1317
|
-
transferType: t.type,
|
|
1318
|
-
txHash: t.tx_hash,
|
|
1319
|
-
fromRoute: t.from_route,
|
|
1320
|
-
toRoute: t.to_route,
|
|
1321
|
-
fee: t.fee,
|
|
1311
|
+
// `get`, not `require`: a market id the backend list no longer carries
|
|
1312
|
+
// drops only its own row instead of rejecting the whole feed. The
|
|
1313
|
+
// registry warns once per unresolved id. A delisted market still
|
|
1314
|
+
// resolves, so its rows stay.
|
|
1315
|
+
...history.fundings.position_fundings.flatMap((f): ActivityItem[] => {
|
|
1316
|
+
const market = marketRegistry.get(String(f.market_id))
|
|
1317
|
+
if (market === undefined) {
|
|
1318
|
+
return []
|
|
1319
|
+
}
|
|
1320
|
+
return [
|
|
1321
|
+
{
|
|
1322
|
+
id: `funding-${f.funding_id}`,
|
|
1323
|
+
provider: providerKey,
|
|
1324
|
+
timestamp: toIsoFromSeconds(f.timestamp),
|
|
1325
|
+
type: ActivityType.FUNDING,
|
|
1326
|
+
market,
|
|
1327
|
+
amount: f.change,
|
|
1328
|
+
positionSize: f.position_size,
|
|
1329
|
+
fundingRate: f.rate,
|
|
1322
1330
|
},
|
|
1331
|
+
]
|
|
1332
|
+
}),
|
|
1333
|
+
// A `/liquidations` row carries the forced trade in `trade` and the
|
|
1334
|
+
// account snapshot that triggered it in `info`. Its `type` field is a
|
|
1335
|
+
// venue liquidation type, not a margin mode, so `leverageType` reads
|
|
1336
|
+
// the row's own position in `info.positions` instead. The endpoint
|
|
1337
|
+
// exposes no cascade identity, so one cross-margin cascade arrives as
|
|
1338
|
+
// several independent rows and each stays its own activity; grouping
|
|
1339
|
+
// them by `executed_at` would invent a relationship Lighter does not
|
|
1340
|
+
// report.
|
|
1341
|
+
...history.liquidations.liquidations.flatMap((l): ActivityItem[] => {
|
|
1342
|
+
const market = marketRegistry.get(String(l.market_id))
|
|
1343
|
+
if (market === undefined) {
|
|
1344
|
+
return []
|
|
1323
1345
|
}
|
|
1346
|
+
const price = toBigOrNull(l.trade.price)
|
|
1347
|
+
const size = toBigOrNull(l.trade.size)
|
|
1348
|
+
const marginMode = l.info.positions.find(
|
|
1349
|
+
(p) => p.market_id === l.market_id
|
|
1350
|
+
)?.margin_mode
|
|
1351
|
+
// Lighter reports the margin mode as an integer, so the venue
|
|
1352
|
+
// vocabulary the contract asks for is the SDK's own literal. An
|
|
1353
|
+
// integer outside the two documented modes maps to no claim at all.
|
|
1354
|
+
const leverageType =
|
|
1355
|
+
marginMode === LT_MARGIN_MODE_ISOLATED
|
|
1356
|
+
? ('isolated' as const)
|
|
1357
|
+
: marginMode === LT_MARGIN_MODE_CROSS
|
|
1358
|
+
? ('cross' as const)
|
|
1359
|
+
: undefined
|
|
1360
|
+
const accountValue =
|
|
1361
|
+
l.info.risk_info_before.cross_risk_parameters?.total_account_value
|
|
1362
|
+
return [
|
|
1363
|
+
{
|
|
1364
|
+
id: `liquidation-${l.id}`,
|
|
1365
|
+
provider: providerKey,
|
|
1366
|
+
timestamp: toIsoFromMs(l.executed_at),
|
|
1367
|
+
type: ActivityType.LIQUIDATION,
|
|
1368
|
+
...(price === null || size === null
|
|
1369
|
+
? {}
|
|
1370
|
+
: {
|
|
1371
|
+
liquidatedNotionalPosition: price
|
|
1372
|
+
.times(size)
|
|
1373
|
+
.abs()
|
|
1374
|
+
.toFixed(),
|
|
1375
|
+
}),
|
|
1376
|
+
// The account value at liquidation time is the pre-trade
|
|
1377
|
+
// snapshot, not the settled one Lighter also reports.
|
|
1378
|
+
...(accountValue === undefined ? {} : { accountValue }),
|
|
1379
|
+
...(leverageType === undefined ? {} : { leverageType }),
|
|
1380
|
+
liquidatedPositions: [{ market, size: l.trade.size }],
|
|
1381
|
+
} satisfies LiquidationActivity,
|
|
1382
|
+
]
|
|
1324
1383
|
}),
|
|
1384
|
+
// `/transfer/history` also reports the account's own spot/perps route
|
|
1385
|
+
// moves, where both indices are this account. Those are not transfers
|
|
1386
|
+
// between accounts, so they are excluded from the ledger.
|
|
1387
|
+
...history.transfers.transfers
|
|
1388
|
+
.filter((t) => t.from_account_index !== t.to_account_index)
|
|
1389
|
+
.map((t): ActivityItem => {
|
|
1390
|
+
const direction: 'IN' | 'OUT' =
|
|
1391
|
+
t.from_account_index === account.index ? 'OUT' : 'IN'
|
|
1392
|
+
const counterpartyAccountIndex =
|
|
1393
|
+
direction === 'OUT' ? t.to_account_index : t.from_account_index
|
|
1394
|
+
return {
|
|
1395
|
+
id: t.id,
|
|
1396
|
+
provider: providerKey,
|
|
1397
|
+
timestamp: toIsoFromMs(t.timestamp),
|
|
1398
|
+
type: ActivityType.TRANSFER,
|
|
1399
|
+
direction,
|
|
1400
|
+
counterpartyAccountIndex,
|
|
1401
|
+
asset: assetSymbol(t.asset_id),
|
|
1402
|
+
amount: t.amount,
|
|
1403
|
+
explorerLink: explorerTxUrlFromBase(explorerTxBaseUrl, t.tx_hash),
|
|
1404
|
+
meta: {
|
|
1405
|
+
transferType: t.type,
|
|
1406
|
+
txHash: t.tx_hash,
|
|
1407
|
+
fromRoute: t.from_route,
|
|
1408
|
+
toRoute: t.to_route,
|
|
1409
|
+
fee: t.fee,
|
|
1410
|
+
},
|
|
1411
|
+
}
|
|
1412
|
+
}),
|
|
1325
1413
|
]
|
|
1326
1414
|
|
|
1327
1415
|
const merged = [...(inputCursor?.overflow ?? []), ...items]
|
|
1328
1416
|
|
|
1417
|
+
// The type filter also applies to replayed overflow rows: a cursor
|
|
1418
|
+
// minted under one filter must never leak another surface's rows when
|
|
1419
|
+
// the caller pages the two surfaces independently.
|
|
1420
|
+
const requestedTypes =
|
|
1421
|
+
params.type === undefined ? undefined : new Set(params.type)
|
|
1422
|
+
|
|
1329
1423
|
const filtered = merged.filter((it) => {
|
|
1424
|
+
if (requestedTypes !== undefined && !requestedTypes.has(it.type)) {
|
|
1425
|
+
return false
|
|
1426
|
+
}
|
|
1330
1427
|
const ts = new Date(it.timestamp).getTime()
|
|
1331
1428
|
if (params.startTime !== undefined && ts < params.startTime) {
|
|
1332
1429
|
return false
|
package/src/types/account.ts
CHANGED
|
@@ -26,6 +26,11 @@ export type LtAccountPosition = {
|
|
|
26
26
|
unrealized_pnl: string
|
|
27
27
|
realized_pnl: string
|
|
28
28
|
liquidation_price: string
|
|
29
|
+
/**
|
|
30
|
+
* Funding accrued since the position opened, signed from the account's point
|
|
31
|
+
* of view despite the field name: negative is funding the account paid and
|
|
32
|
+
* positive is funding it received. Lighter resets it to `"0"` on close.
|
|
33
|
+
*/
|
|
29
34
|
total_funding_paid_out: string
|
|
30
35
|
margin_mode: number
|
|
31
36
|
allocated_margin: string
|
package/src/types/activity.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Activity history shapes returned by Lighter's REST API
|
|
2
2
|
// (deposits, withdrawals, funding payments, liquidations, transfers).
|
|
3
3
|
|
|
4
|
+
import type { LtAccountPosition } from './account.js'
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* Deposit history row returned by Lighter. `amount` is a decimal asset amount,
|
|
6
8
|
* `timestamp` is Unix milliseconds, and `l1_tx_hash` identifies the settlement
|
|
@@ -69,6 +71,11 @@ export interface LtPositionFunding {
|
|
|
69
71
|
timestamp: number
|
|
70
72
|
market_id: number
|
|
71
73
|
funding_id: number
|
|
74
|
+
/**
|
|
75
|
+
* Signed, in quote-currency units. Positive means the account received
|
|
76
|
+
* funding; negative means the account paid it. Mapped straight onto
|
|
77
|
+
* `FundingActivity.amount`.
|
|
78
|
+
*/
|
|
72
79
|
change: string
|
|
73
80
|
rate: string
|
|
74
81
|
position_size: string
|
|
@@ -87,6 +94,61 @@ export interface LtPositionFundingsResponse {
|
|
|
87
94
|
next_cursor?: string
|
|
88
95
|
}
|
|
89
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Venue liquidation type Lighter reports on a liquidation row. A margin mode
|
|
99
|
+
* is a separate value carried on the row's position.
|
|
100
|
+
*
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
export type LtLiquidationType = 'partial' | 'deleverage'
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Forced trade Lighter executed to close the liquidated position. Prices,
|
|
107
|
+
* sizes and fees are decimal strings in the market's native precision.
|
|
108
|
+
*
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
export interface LtLiqTrade {
|
|
112
|
+
price: string
|
|
113
|
+
size: string
|
|
114
|
+
taker_fee: string
|
|
115
|
+
maker_fee: string
|
|
116
|
+
/** Unix timestamp in milliseconds. */
|
|
117
|
+
transaction_time: number
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Position row inside a liquidation payload. Lighter returns the full
|
|
122
|
+
* `AccountPosition` shape here; the SDK models only the members the
|
|
123
|
+
* liquidation mapper reads.
|
|
124
|
+
*
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
export type LtLiquidationPosition = Pick<
|
|
128
|
+
LtAccountPosition,
|
|
129
|
+
'market_id' | 'margin_mode'
|
|
130
|
+
>
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Account snapshot Lighter attaches to a liquidation row. `risk_info_before`
|
|
134
|
+
* is the pre-trade state that breached maintenance margin. Lighter also
|
|
135
|
+
* reports the settled risk info, mark prices, assets and asset index prices
|
|
136
|
+
* here; the SDK models only the members the liquidation mapper reads.
|
|
137
|
+
*
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
140
|
+
export interface LtLiquidationInfo {
|
|
141
|
+
positions: LtLiquidationPosition[]
|
|
142
|
+
risk_info_before: {
|
|
143
|
+
// Lighter's OpenAPI does not require this member, so an account without
|
|
144
|
+
// cross exposure may omit it.
|
|
145
|
+
cross_risk_parameters?: {
|
|
146
|
+
/** Account equity as a decimal string, in quote-currency units. */
|
|
147
|
+
total_account_value: string
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
90
152
|
/**
|
|
91
153
|
* Liquidation event row returned by Lighter. `executed_at` is a Unix timestamp
|
|
92
154
|
* in milliseconds.
|
|
@@ -96,7 +158,9 @@ export interface LtPositionFundingsResponse {
|
|
|
96
158
|
export interface LtLiquidation {
|
|
97
159
|
id: number
|
|
98
160
|
market_id: number
|
|
99
|
-
type:
|
|
161
|
+
type: LtLiquidationType
|
|
162
|
+
trade: LtLiqTrade
|
|
163
|
+
info: LtLiquidationInfo
|
|
100
164
|
executed_at: number
|
|
101
165
|
}
|
|
102
166
|
|
package/src/utils/mapFill.ts
CHANGED
|
@@ -75,6 +75,9 @@ export const mapFill = (
|
|
|
75
75
|
const entryQuoteBefore = isMaker
|
|
76
76
|
? trade.maker_entry_quote_before
|
|
77
77
|
: trade.taker_entry_quote_before
|
|
78
|
+
const feeAmount = isMaker
|
|
79
|
+
? trade.maker_fee?.toString()
|
|
80
|
+
: trade.taker_fee?.toString()
|
|
78
81
|
|
|
79
82
|
return {
|
|
80
83
|
id: trade.trade_id.toString(),
|
|
@@ -86,7 +89,11 @@ export const mapFill = (
|
|
|
86
89
|
price: trade.price,
|
|
87
90
|
status: FillStatus.FILLED,
|
|
88
91
|
liquidity: isMaker ? LiquidityRole.MAKER : LiquidityRole.TAKER,
|
|
89
|
-
fee
|
|
92
|
+
// Lighter charges the fill fee in the market's quote asset.
|
|
93
|
+
fee:
|
|
94
|
+
feeAmount === undefined
|
|
95
|
+
? undefined
|
|
96
|
+
: { amount: feeAmount, asset: market.quoteAsset.displaySymbol },
|
|
90
97
|
realizedPnl: deriveRealizedPnl(
|
|
91
98
|
startPosition,
|
|
92
99
|
entryQuoteBefore,
|
package/src/utils/mapOrder.ts
CHANGED
|
@@ -185,7 +185,8 @@ export const mapOrder = (order: LtOrder, market: MarketDisplay): OpenOrder => ({
|
|
|
185
185
|
market,
|
|
186
186
|
side: order.is_ask ? OrderSide.SELL : OrderSide.BUY,
|
|
187
187
|
type: mapOrderType(order.type),
|
|
188
|
-
|
|
188
|
+
originalSize: order.initial_base_amount,
|
|
189
|
+
remainingSize: order.remaining_base_amount,
|
|
189
190
|
price: order.price,
|
|
190
191
|
filledSize: order.filled_base_amount,
|
|
191
192
|
reduceOnly: order.reduce_only,
|
package/src/utils/mapPosition.ts
CHANGED
|
@@ -60,6 +60,7 @@ export const mapPosition = (
|
|
|
60
60
|
: positionValue.div(size.abs()).toFixed(),
|
|
61
61
|
liquidationPrice: pos.liquidation_price,
|
|
62
62
|
unrealizedPnl: pos.unrealized_pnl,
|
|
63
|
+
accruedFunding: pos.total_funding_paid_out,
|
|
63
64
|
leverage: leverageFromImf(pos.initial_margin_fraction) ?? 1,
|
|
64
65
|
marginUsed,
|
|
65
66
|
initialMarginRequirement: initialMarginRequirement.toFixed(),
|