@lifi/perps-sdk-provider-lighter 8.0.0 → 8.1.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.
Files changed (156) hide show
  1. package/dist/cjs/LighterProvider.d.ts.map +1 -1
  2. package/dist/cjs/LighterProvider.js +3 -0
  3. package/dist/cjs/LighterProvider.js.map +1 -1
  4. package/dist/cjs/constants.d.ts.map +1 -1
  5. package/dist/cjs/constants.js.map +1 -1
  6. package/dist/cjs/signers/LighterKeyStore.d.ts.map +1 -1
  7. package/dist/cjs/signers/LighterKeyStore.js.map +1 -1
  8. package/dist/cjs/signers/LighterReadOnlyTokenManager.d.ts.map +1 -1
  9. package/dist/cjs/signers/LighterReadOnlyTokenManager.js.map +1 -1
  10. package/dist/cjs/signers/LighterSigner.d.ts.map +1 -1
  11. package/dist/cjs/signers/LighterSigner.js.map +1 -1
  12. package/dist/cjs/signers/createAuthToken.d.ts.map +1 -1
  13. package/dist/cjs/signers/createAuthToken.js.map +1 -1
  14. package/dist/cjs/signers/wasmLoader.d.ts.map +1 -1
  15. package/dist/cjs/signers/wasmLoader.js.map +1 -1
  16. package/dist/cjs/types/account.d.ts.map +1 -1
  17. package/dist/cjs/types/action.d.ts.map +1 -1
  18. package/dist/cjs/types/action.js.map +1 -1
  19. package/dist/cjs/types/activity.d.ts.map +1 -1
  20. package/dist/cjs/types/asset.d.ts.map +1 -1
  21. package/dist/cjs/types/fill.d.ts.map +1 -1
  22. package/dist/cjs/types/order.d.ts.map +1 -1
  23. package/dist/cjs/types/submit.d.ts.map +1 -1
  24. package/dist/cjs/types/ws.d.ts.map +1 -1
  25. package/dist/cjs/utils/lighterAsset.d.ts.map +1 -1
  26. package/dist/cjs/utils/lighterAsset.js.map +1 -1
  27. package/dist/cjs/utils/ohlcvInterval.d.ts.map +1 -1
  28. package/dist/cjs/utils/ohlcvInterval.js.map +1 -1
  29. package/dist/cjs/utils/transferMargin.d.ts.map +1 -1
  30. package/dist/cjs/utils/transferMargin.js +1 -2
  31. package/dist/cjs/utils/transferMargin.js.map +1 -1
  32. package/dist/cjs/utils/wireEncoding.d.ts.map +1 -1
  33. package/dist/cjs/utils/wireEncoding.js.map +1 -1
  34. package/dist/cjs/websocket/LighterWsProvider.d.ts.map +1 -1
  35. package/dist/cjs/websocket/LighterWsProvider.js.map +1 -1
  36. package/dist/esm/LighterProvider.d.ts.map +1 -1
  37. package/dist/esm/LighterProvider.js +7 -0
  38. package/dist/esm/LighterProvider.js.map +1 -1
  39. package/dist/esm/constants.d.ts +15 -2
  40. package/dist/esm/constants.d.ts.map +1 -1
  41. package/dist/esm/constants.js +15 -2
  42. package/dist/esm/constants.js.map +1 -1
  43. package/dist/esm/signers/LighterKeyStore.d.ts +31 -2
  44. package/dist/esm/signers/LighterKeyStore.d.ts.map +1 -1
  45. package/dist/esm/signers/LighterKeyStore.js +24 -1
  46. package/dist/esm/signers/LighterKeyStore.js.map +1 -1
  47. package/dist/esm/signers/LighterReadOnlyTokenManager.d.ts +23 -3
  48. package/dist/esm/signers/LighterReadOnlyTokenManager.d.ts.map +1 -1
  49. package/dist/esm/signers/LighterReadOnlyTokenManager.js +4 -0
  50. package/dist/esm/signers/LighterReadOnlyTokenManager.js.map +1 -1
  51. package/dist/esm/signers/LighterSigner.d.ts +49 -7
  52. package/dist/esm/signers/LighterSigner.d.ts.map +1 -1
  53. package/dist/esm/signers/LighterSigner.js +11 -1
  54. package/dist/esm/signers/LighterSigner.js.map +1 -1
  55. package/dist/esm/signers/createAuthToken.d.ts +8 -2
  56. package/dist/esm/signers/createAuthToken.d.ts.map +1 -1
  57. package/dist/esm/signers/createAuthToken.js.map +1 -1
  58. package/dist/esm/signers/wasmLoader.d.ts +14 -2
  59. package/dist/esm/signers/wasmLoader.d.ts.map +1 -1
  60. package/dist/esm/signers/wasmLoader.js.map +1 -1
  61. package/dist/esm/types/account.d.ts +58 -8
  62. package/dist/esm/types/account.d.ts.map +1 -1
  63. package/dist/esm/types/action.d.ts +72 -18
  64. package/dist/esm/types/action.d.ts.map +1 -1
  65. package/dist/esm/types/action.js +72 -18
  66. package/dist/esm/types/action.js.map +1 -1
  67. package/dist/esm/types/activity.d.ts +64 -10
  68. package/dist/esm/types/activity.d.ts.map +1 -1
  69. package/dist/esm/types/asset.d.ts +72 -12
  70. package/dist/esm/types/asset.d.ts.map +1 -1
  71. package/dist/esm/types/fill.d.ts +14 -2
  72. package/dist/esm/types/fill.d.ts.map +1 -1
  73. package/dist/esm/types/order.d.ts +27 -4
  74. package/dist/esm/types/order.d.ts.map +1 -1
  75. package/dist/esm/types/submit.d.ts +26 -4
  76. package/dist/esm/types/submit.d.ts.map +1 -1
  77. package/dist/esm/types/ws.d.ts +56 -8
  78. package/dist/esm/types/ws.d.ts.map +1 -1
  79. package/dist/esm/utils/lighterAsset.d.ts +7 -1
  80. package/dist/esm/utils/lighterAsset.d.ts.map +1 -1
  81. package/dist/esm/utils/lighterAsset.js +7 -1
  82. package/dist/esm/utils/lighterAsset.js.map +1 -1
  83. package/dist/esm/utils/ohlcvInterval.d.ts +6 -1
  84. package/dist/esm/utils/ohlcvInterval.d.ts.map +1 -1
  85. package/dist/esm/utils/ohlcvInterval.js +6 -1
  86. package/dist/esm/utils/ohlcvInterval.js.map +1 -1
  87. package/dist/esm/utils/transferMargin.d.ts.map +1 -1
  88. package/dist/esm/utils/transferMargin.js +2 -3
  89. package/dist/esm/utils/transferMargin.js.map +1 -1
  90. package/dist/esm/utils/wireEncoding.d.ts +58 -23
  91. package/dist/esm/utils/wireEncoding.d.ts.map +1 -1
  92. package/dist/esm/utils/wireEncoding.js +58 -23
  93. package/dist/esm/utils/wireEncoding.js.map +1 -1
  94. package/dist/esm/websocket/LighterWsProvider.d.ts +6 -0
  95. package/dist/esm/websocket/LighterWsProvider.d.ts.map +1 -1
  96. package/dist/esm/websocket/LighterWsProvider.js +6 -0
  97. package/dist/esm/websocket/LighterWsProvider.js.map +1 -1
  98. package/dist/types/LighterProvider.d.ts.map +1 -1
  99. package/dist/types/constants.d.ts +15 -2
  100. package/dist/types/constants.d.ts.map +1 -1
  101. package/dist/types/signers/LighterKeyStore.d.ts +31 -2
  102. package/dist/types/signers/LighterKeyStore.d.ts.map +1 -1
  103. package/dist/types/signers/LighterReadOnlyTokenManager.d.ts +23 -3
  104. package/dist/types/signers/LighterReadOnlyTokenManager.d.ts.map +1 -1
  105. package/dist/types/signers/LighterSigner.d.ts +49 -7
  106. package/dist/types/signers/LighterSigner.d.ts.map +1 -1
  107. package/dist/types/signers/createAuthToken.d.ts +8 -2
  108. package/dist/types/signers/createAuthToken.d.ts.map +1 -1
  109. package/dist/types/signers/wasmLoader.d.ts +14 -2
  110. package/dist/types/signers/wasmLoader.d.ts.map +1 -1
  111. package/dist/types/types/account.d.ts +58 -8
  112. package/dist/types/types/account.d.ts.map +1 -1
  113. package/dist/types/types/action.d.ts +72 -18
  114. package/dist/types/types/action.d.ts.map +1 -1
  115. package/dist/types/types/activity.d.ts +64 -10
  116. package/dist/types/types/activity.d.ts.map +1 -1
  117. package/dist/types/types/asset.d.ts +72 -12
  118. package/dist/types/types/asset.d.ts.map +1 -1
  119. package/dist/types/types/fill.d.ts +14 -2
  120. package/dist/types/types/fill.d.ts.map +1 -1
  121. package/dist/types/types/order.d.ts +27 -4
  122. package/dist/types/types/order.d.ts.map +1 -1
  123. package/dist/types/types/submit.d.ts +26 -4
  124. package/dist/types/types/submit.d.ts.map +1 -1
  125. package/dist/types/types/ws.d.ts +56 -8
  126. package/dist/types/types/ws.d.ts.map +1 -1
  127. package/dist/types/utils/lighterAsset.d.ts +7 -1
  128. package/dist/types/utils/lighterAsset.d.ts.map +1 -1
  129. package/dist/types/utils/ohlcvInterval.d.ts +6 -1
  130. package/dist/types/utils/ohlcvInterval.d.ts.map +1 -1
  131. package/dist/types/utils/transferMargin.d.ts.map +1 -1
  132. package/dist/types/utils/wireEncoding.d.ts +58 -23
  133. package/dist/types/utils/wireEncoding.d.ts.map +1 -1
  134. package/dist/types/websocket/LighterWsProvider.d.ts +6 -0
  135. package/dist/types/websocket/LighterWsProvider.d.ts.map +1 -1
  136. package/package.json +3 -3
  137. package/src/LighterProvider.ts +8 -0
  138. package/src/constants.ts +15 -2
  139. package/src/signers/LighterKeyStore.ts +31 -2
  140. package/src/signers/LighterReadOnlyTokenManager.ts +23 -3
  141. package/src/signers/LighterSigner.ts +49 -7
  142. package/src/signers/createAuthToken.ts +8 -2
  143. package/src/signers/wasmLoader.ts +14 -2
  144. package/src/types/account.ts +58 -8
  145. package/src/types/action.ts +72 -18
  146. package/src/types/activity.ts +64 -10
  147. package/src/types/asset.ts +72 -12
  148. package/src/types/fill.ts +14 -2
  149. package/src/types/order.ts +27 -4
  150. package/src/types/submit.ts +26 -4
  151. package/src/types/ws.ts +56 -8
  152. package/src/utils/lighterAsset.ts +7 -1
  153. package/src/utils/ohlcvInterval.ts +6 -1
  154. package/src/utils/transferMargin.ts +2 -6
  155. package/src/utils/wireEncoding.ts +58 -23
  156. package/src/websocket/LighterWsProvider.ts +6 -0
@@ -48,7 +48,13 @@ function defaultAssetUrl(filename: string): URL {
48
48
  return new URL(`../../wasm/${filename}`, currentModuleUrl())
49
49
  }
50
50
 
51
- /** @public */
51
+ /**
52
+ * Overrides for locating the Lighter Go WASM binary and its runtime loader.
53
+ * Supplying explicit URLs or source is useful when a bundler does not preserve
54
+ * the package's relative asset layout.
55
+ *
56
+ * @public
57
+ */
52
58
  export interface LoadLighterWasmOptions {
53
59
  /** Override URL for the `.wasm` binary (browser: fetch; Node: fs). */
54
60
  wasmBinaryUrl?: string | URL
@@ -68,7 +74,13 @@ export interface LoadLighterWasmOptions {
68
74
  wasmExecJsSource?: string
69
75
  }
70
76
 
71
- /** @public */
77
+ /**
78
+ * Function table installed by the Lighter Go WASM runtime. Methods mirror the
79
+ * venue signer ABI and return a result containing either signed transaction
80
+ * fields or an error; positional argument contracts are documented per method.
81
+ *
82
+ * @public
83
+ */
72
84
  export interface LighterWasmExports {
73
85
  GenerateAPIKey: () => {
74
86
  publicKey?: string
@@ -1,7 +1,16 @@
1
1
  // Account / balance shapes returned by Lighter's `/api/v1/account` and
2
2
  // `/api/v1/accountLimits` endpoints.
3
3
 
4
- /** @public */
4
+ /**
5
+ * Per-market position row returned by Lighter's account endpoints.
6
+ *
7
+ * Amounts and prices are decimal strings in the market's native precision.
8
+ * `position` is the size magnitude as a decimal string. `sign` is the
9
+ * authoritative side indicator: values greater than or equal to zero represent
10
+ * long positions and values less than zero represent short positions.
11
+ *
12
+ * @public
13
+ */
5
14
  export type LtAccountPosition = {
6
15
  market_id: number
7
16
  /** Present on REST `/api/v1/account` rows; WS position frames may omit it. */
@@ -23,7 +32,14 @@ export type LtAccountPosition = {
23
32
  total_discount: string
24
33
  }
25
34
 
26
- /** @public */
35
+ /**
36
+ * Collateral asset row returned in a Lighter account response. `balance` and
37
+ * `locked_balance` are decimal strings in the asset's native precision.
38
+ * `margin_mode`, when present, is Lighter's cross-margin flag: `0` disables
39
+ * margin use for the asset and `1` enables it.
40
+ *
41
+ * @public
42
+ */
27
43
  export type LtAccountAsset = {
28
44
  symbol: string
29
45
  asset_id: number
@@ -46,7 +62,13 @@ export type LtAccountAsset = {
46
62
  */
47
63
  export type LtDetailedAccountPosition = LtAccountPosition
48
64
 
49
- /** @public */
65
+ /**
66
+ * Integrator approval and fee caps attached to a detailed account.
67
+ * Fee values are Lighter's integer fee ticks; `approval_expiry` is a Unix
68
+ * timestamp.
69
+ *
70
+ * @public
71
+ */
50
72
  export interface LtApprovedIntegrator {
51
73
  account_index: number
52
74
  name: string
@@ -57,7 +79,14 @@ export interface LtApprovedIntegrator {
57
79
  approval_expiry: number
58
80
  }
59
81
 
60
- /** @public */
82
+ /**
83
+ * Detailed account payload returned by Lighter's account endpoint, including
84
+ * account metadata, aggregate collateral values, assets, and positions.
85
+ * Balance and value fields are decimal strings in the relevant asset/quote
86
+ * precision; numeric status and mode fields are Lighter wire enums.
87
+ *
88
+ * @public
89
+ */
61
90
  export interface LtDetailedAccount {
62
91
  code: number
63
92
  account_type: number
@@ -85,14 +114,25 @@ export interface LtDetailedAccount {
85
114
  approved_integrators?: LtApprovedIntegrator[]
86
115
  }
87
116
 
88
- /** @public */
117
+ /**
118
+ * Response envelope for a detailed-account lookup. `code` is Lighter's
119
+ * endpoint result code and `total` is the number of account rows returned.
120
+ *
121
+ * @public
122
+ */
89
123
  export interface LtDetailedAccountsResponse {
90
124
  code: number
91
125
  total: number
92
126
  accounts: LtDetailedAccount[]
93
127
  }
94
128
 
95
- /** @public */
129
+ /**
130
+ * Account-level limits and fee information returned by Lighter's
131
+ * `/api/v1/accountLimits` endpoint. Amount fields are decimal strings;
132
+ * `current_*_fee_tick` values use Lighter's integer fee-tick scale.
133
+ *
134
+ * @public
135
+ */
96
136
  export interface LtAccountLimits {
97
137
  code: number
98
138
  message?: string
@@ -107,7 +147,13 @@ export interface LtAccountLimits {
107
147
  effective_lit_stakes: string
108
148
  }
109
149
 
110
- /** @public */
150
+ /**
151
+ * Sub-account summary returned by Lighter's `accountsByL1Address` endpoint.
152
+ * Balance and collateral values are decimal strings; status and trading-mode
153
+ * fields are Lighter wire values.
154
+ *
155
+ * @public
156
+ */
111
157
  export interface LtSubAccount {
112
158
  code: number
113
159
  account_type: number
@@ -124,7 +170,11 @@ export interface LtSubAccount {
124
170
  account_trading_mode: number
125
171
  }
126
172
 
127
- /** @public */
173
+ /**
174
+ * Response envelope for an L1-address sub-account lookup.
175
+ *
176
+ * @public
177
+ */
128
178
  export interface LtAccountsByL1AddressResponse {
129
179
  code: number
130
180
  l1_address: string
@@ -109,47 +109,101 @@ export type LtChangePubKeyWasmParams = {
109
109
  nonce: number
110
110
  }
111
111
 
112
- /** @public */
112
+ /**
113
+ * Lighter wire value for limit orders.
114
+ * @public
115
+ */
113
116
  export const LT_ORDER_TYPE_LIMIT = 0
114
- /** @public */
117
+ /**
118
+ * Lighter wire value for market orders.
119
+ * @public
120
+ */
115
121
  export const LT_ORDER_TYPE_MARKET = 1
116
- /** @public */
122
+ /**
123
+ * Lighter wire value for stop-loss market orders.
124
+ * @public
125
+ */
117
126
  export const LT_ORDER_TYPE_STOP_LOSS = 2
118
- /** @public */
127
+ /**
128
+ * Lighter wire value for stop-loss limit orders.
129
+ * @public
130
+ */
119
131
  export const LT_ORDER_TYPE_STOP_LOSS_LIMIT = 3
120
- /** @public */
132
+ /**
133
+ * Lighter wire value for take-profit market orders.
134
+ * @public
135
+ */
121
136
  export const LT_ORDER_TYPE_TAKE_PROFIT = 4
122
- /** @public */
137
+ /**
138
+ * Lighter wire value for take-profit limit orders.
139
+ * @public
140
+ */
123
141
  export const LT_ORDER_TYPE_TAKE_PROFIT_LIMIT = 5
124
- /** @public */
142
+ /**
143
+ * Lighter wire value for TWAP orders.
144
+ * @public
145
+ */
125
146
  export const LT_ORDER_TYPE_TWAP = 6
126
147
 
127
- /** @public */
148
+ /**
149
+ * Lighter wire value for immediate-or-cancel time in force.
150
+ * @public
151
+ */
128
152
  export const LT_TIME_IN_FORCE_IOC = 0
129
- /** @public */
153
+ /**
154
+ * Lighter wire value for good-til-cancelled time in force.
155
+ * @public
156
+ */
130
157
  export const LT_TIME_IN_FORCE_GTC = 1
131
- /** @public */
158
+ /**
159
+ * Lighter wire value for post-only time in force.
160
+ * @public
161
+ */
132
162
  export const LT_TIME_IN_FORCE_POST_ONLY = 2
133
163
 
134
- /** @public */
164
+ /**
165
+ * Lighter cross-margin mode value.
166
+ * @public
167
+ */
135
168
  export const LT_MARGIN_MODE_CROSS = 0
136
- /** @public */
169
+ /**
170
+ * Lighter isolated-margin mode value.
171
+ * @public
172
+ */
137
173
  export const LT_MARGIN_MODE_ISOLATED = 1
138
174
 
139
- /** @public */
175
+ /**
176
+ * Lighter margin-direction value for removing margin.
177
+ * @public
178
+ */
140
179
  export const LT_MARGIN_DIRECTION_REMOVE = 0
141
- /** @public */
180
+ /**
181
+ * Lighter margin-direction value for adding margin.
182
+ * @public
183
+ */
142
184
  export const LT_MARGIN_DIRECTION_ADD = 1
143
185
 
144
- /** @public */
186
+ /**
187
+ * Lighter route selector for perpetuals transfers.
188
+ * @public
189
+ */
145
190
  export const LT_ROUTE_PERP = 0
146
- /** @public */
191
+ /**
192
+ * Lighter route selector for spot transfers.
193
+ * @public
194
+ */
147
195
  export const LT_ROUTE_SPOT = 1
148
196
 
149
- /** @public */
197
+ /**
198
+ * Lighter spot USDC asset id.
199
+ * @public
200
+ */
150
201
  export const LT_ASSET_ID_USDC = 3
151
202
 
152
- /** @public */
203
+ /**
204
+ * Wire sentinel for an omitted trigger price.
205
+ * @public
206
+ */
153
207
  export const LT_NIL_TRIGGER_PRICE = 0
154
208
  /**
155
209
  * Sentinel the lighter-go WASM signer translates to "default 28-day expiry
@@ -1,7 +1,13 @@
1
1
  // Activity history shapes returned by Lighter's REST API
2
2
  // (deposits, withdrawals, funding payments, liquidations, transfers).
3
3
 
4
- /** @public */
4
+ /**
5
+ * Deposit history row returned by Lighter. `amount` is a decimal asset amount,
6
+ * `timestamp` is Unix milliseconds, and `l1_tx_hash` identifies the settlement
7
+ * transaction on the L1 bridge.
8
+ *
9
+ * @public
10
+ */
5
11
  export interface LtDepositHistoryItem {
6
12
  id: string
7
13
  asset_id: number
@@ -11,14 +17,25 @@ export interface LtDepositHistoryItem {
11
17
  l1_tx_hash: string
12
18
  }
13
19
 
14
- /** @public */
20
+ /**
21
+ * Paginated deposit-history response from Lighter. `cursor` is an opaque
22
+ * continuation value for the next page.
23
+ *
24
+ * @public
25
+ */
15
26
  export interface LtDepositHistoryResponse {
16
27
  code: number
17
28
  deposits: LtDepositHistoryItem[]
18
29
  cursor?: string
19
30
  }
20
31
 
21
- /** @public */
32
+ /**
33
+ * Withdrawal history row returned by Lighter. `amount` is a decimal asset
34
+ * amount, `timestamp` is Unix milliseconds, and `l1_tx_hash` identifies the
35
+ * associated L1 transaction.
36
+ *
37
+ * @public
38
+ */
22
39
  export interface LtWithdrawHistoryItem {
23
40
  id: string
24
41
  asset_id: number
@@ -29,14 +46,25 @@ export interface LtWithdrawHistoryItem {
29
46
  l1_tx_hash: string
30
47
  }
31
48
 
32
- /** @public */
49
+ /**
50
+ * Paginated withdrawal-history response from Lighter. `cursor` is an opaque
51
+ * continuation value for the next page.
52
+ *
53
+ * @public
54
+ */
33
55
  export interface LtWithdrawHistoryResponse {
34
56
  code: number
35
57
  withdraws: LtWithdrawHistoryItem[]
36
58
  cursor?: string
37
59
  }
38
60
 
39
- /** @public */
61
+ /**
62
+ * Funding-payment history row for one perpetual position. `change`,
63
+ * `position_size`, and `rate` are decimal strings; `timestamp` is a Unix
64
+ * timestamp in seconds and `position_side` is Lighter's side literal.
65
+ *
66
+ * @public
67
+ */
40
68
  export interface LtPositionFunding {
41
69
  timestamp: number
42
70
  market_id: number
@@ -47,14 +75,24 @@ export interface LtPositionFunding {
47
75
  position_side: string
48
76
  }
49
77
 
50
- /** @public */
78
+ /**
79
+ * Paginated position-funding response from Lighter. `next_cursor` is an opaque
80
+ * continuation value for the next page.
81
+ *
82
+ * @public
83
+ */
51
84
  export interface LtPositionFundingsResponse {
52
85
  code: number
53
86
  position_fundings: LtPositionFunding[]
54
87
  next_cursor?: string
55
88
  }
56
89
 
57
- /** @public */
90
+ /**
91
+ * Liquidation event row returned by Lighter. `executed_at` is a Unix timestamp
92
+ * in milliseconds.
93
+ *
94
+ * @public
95
+ */
58
96
  export interface LtLiquidation {
59
97
  id: number
60
98
  market_id: number
@@ -62,14 +100,25 @@ export interface LtLiquidation {
62
100
  executed_at: number
63
101
  }
64
102
 
65
- /** @public */
103
+ /**
104
+ * Paginated liquidation-history response from Lighter. `next_cursor` is an
105
+ * opaque continuation value for the next page.
106
+ *
107
+ * @public
108
+ */
66
109
  export interface LtLiquidationsResponse {
67
110
  code: number
68
111
  liquidations: LtLiquidation[]
69
112
  next_cursor?: string
70
113
  }
71
114
 
72
- /** @public */
115
+ /**
116
+ * Asset transfer-history row returned by Lighter. Amounts and fees are decimal
117
+ * strings in the asset's precision; route literals identify the source and
118
+ * destination account ledger (`spot` or `perps`).
119
+ *
120
+ * @public
121
+ */
73
122
  export interface LtTransfer {
74
123
  id: string
75
124
  asset_id: number
@@ -86,7 +135,12 @@ export interface LtTransfer {
86
135
  tx_hash: string
87
136
  }
88
137
 
89
- /** @public */
138
+ /**
139
+ * Paginated transfer-history response from Lighter. `cursor` is an opaque
140
+ * continuation value for the next page.
141
+ *
142
+ * @public
143
+ */
90
144
  export interface LtTransferHistoryResponse {
91
145
  code: number
92
146
  transfers: LtTransfer[]
@@ -1,6 +1,12 @@
1
1
  // Market / asset / orderbook metadata returned by Lighter's REST API.
2
2
 
3
- /** @public */
3
+ /**
4
+ * Venue configuration nested in a Lighter perpetual-market descriptor.
5
+ * Numeric fields are Lighter wire mode values; booleans indicate whether the
6
+ * market is currently restricted or hidden.
7
+ *
8
+ * @public
9
+ */
4
10
  export interface LtMarketConfig {
5
11
  market_margin_mode: number
6
12
  insurance_fund_account_index: number
@@ -11,7 +17,14 @@ export interface LtMarketConfig {
11
17
  hidden: boolean
12
18
  }
13
19
 
14
- /** @public */
20
+ /**
21
+ * Perpetual-market metadata returned by Lighter's order-book-details endpoint.
22
+ * Decimal strings use the market's native asset/quote precision. Decimal-count
23
+ * fields describe supported and canonical order precision; fee and margin
24
+ * fractions use Lighter's wire representation.
25
+ *
26
+ * @public
27
+ */
15
28
  export interface LtPerpsOrderBookDetail {
16
29
  symbol: string
17
30
  market_id: number
@@ -48,7 +61,13 @@ export interface LtPerpsOrderBookDetail {
48
61
  strategy_index: number
49
62
  }
50
63
 
51
- /** @public */
64
+ /**
65
+ * Spot-market metadata returned by Lighter's order-book-details endpoint.
66
+ * Decimal strings use the market's native asset/quote precision; decimal-count
67
+ * fields describe supported order precision.
68
+ *
69
+ * @public
70
+ */
52
71
  export interface LtSpotOrderBookDetail {
53
72
  symbol: string
54
73
  market_id: number
@@ -77,14 +96,23 @@ export interface LtSpotOrderBookDetail {
77
96
  daily_chart: Record<string, unknown>
78
97
  }
79
98
 
80
- /** @public */
99
+ /**
100
+ * Response envelope containing both perpetual and spot market descriptors.
101
+ *
102
+ * @public
103
+ */
81
104
  export interface LtOrderBookDetailsResponse {
82
105
  code: number
83
106
  order_book_details: LtPerpsOrderBookDetail[]
84
107
  spot_order_book_details: LtSpotOrderBookDetail[]
85
108
  }
86
109
 
87
- /** @public */
110
+ /**
111
+ * Token metadata returned by Lighter's token-list endpoint. `market` identifies
112
+ * whether the token is associated with a perpetual or spot market.
113
+ *
114
+ * @public
115
+ */
88
116
  export interface LtToken {
89
117
  symbol: string
90
118
  name: string
@@ -93,13 +121,22 @@ export interface LtToken {
93
121
  market: 'PERPS' | 'SPOT'
94
122
  }
95
123
 
96
- /** @public */
124
+ /**
125
+ * Response envelope for Lighter's token-list endpoint.
126
+ *
127
+ * @public
128
+ */
97
129
  export interface LtTokenListResponse {
98
130
  code: number
99
131
  tokens: LtToken[]
100
132
  }
101
133
 
102
- /** @public */
134
+ /**
135
+ * Asset metadata returned by Lighter. `l1_decimals` is the token precision on
136
+ * L1; `decimals` is the Lighter ledger precision.
137
+ *
138
+ * @public
139
+ */
103
140
  export interface LtAssetDetail {
104
141
  asset_id: number
105
142
  symbol: string
@@ -108,13 +145,22 @@ export interface LtAssetDetail {
108
145
  l1_address: string
109
146
  }
110
147
 
111
- /** @public */
148
+ /**
149
+ * Response envelope for Lighter's asset-details endpoint.
150
+ *
151
+ * @public
152
+ */
112
153
  export interface LtAssetDetailsResponse {
113
154
  code: number
114
155
  asset_details: LtAssetDetail[]
115
156
  }
116
157
 
117
- /** @public */
158
+ /**
159
+ * OHLCV candle returned by Lighter. `t` is the candle timestamp in Unix
160
+ * milliseconds; `o`, `h`, `l`, and `c` are prices and `v` is volume.
161
+ *
162
+ * @public
163
+ */
118
164
  export interface LtCandle {
119
165
  t: number
120
166
  o: number
@@ -124,14 +170,24 @@ export interface LtCandle {
124
170
  v: number
125
171
  }
126
172
 
127
- /** @public */
173
+ /**
174
+ * Response envelope for a Lighter candle query. `r` is the endpoint's result
175
+ * value and `c` contains the returned candles.
176
+ *
177
+ * @public
178
+ */
128
179
  export interface LtCandlesResponse {
129
180
  code: number
130
181
  r: string
131
182
  c: LtCandle[]
132
183
  }
133
184
 
134
- /** @public */
185
+ /**
186
+ * Funding-rate snapshot for one Lighter perpetual market. `rate` is the
187
+ * venue-provided funding-rate value for the named exchange and market.
188
+ *
189
+ * @public
190
+ */
135
191
  export interface LtFundingRate {
136
192
  market_id: number
137
193
  exchange: string
@@ -139,7 +195,11 @@ export interface LtFundingRate {
139
195
  rate: number
140
196
  }
141
197
 
142
- /** @public */
198
+ /**
199
+ * Response envelope containing current funding rates by market.
200
+ *
201
+ * @public
202
+ */
143
203
  export interface LtFundingRatesResponse {
144
204
  code: number
145
205
  funding_rates: LtFundingRate[]
package/src/types/fill.ts CHANGED
@@ -1,6 +1,13 @@
1
1
  // Trade (fill) shapes returned by Lighter's `/api/v1/trades` endpoint.
2
2
 
3
- /** @public */
3
+ /**
4
+ * Public trade/fill row returned by Lighter's `/api/v1/trades` endpoint.
5
+ * Size, price, and notional fields are decimal strings in market precision;
6
+ * `timestamp` and `transaction_time` are Unix millisecond timestamps. The
7
+ * optional fee fields are integer fee ticks and may be absent on older rows.
8
+ *
9
+ * @public
10
+ */
4
11
  export type LtTrade = {
5
12
  trade_id: number
6
13
  tx_hash: string
@@ -34,7 +41,12 @@ export type LtTrade = {
34
41
  maker_entry_quote_before?: string
35
42
  }
36
43
 
37
- /** @public */
44
+ /**
45
+ * Paginated trade-history response from Lighter. `next_cursor` is an opaque
46
+ * continuation value for the next page.
47
+ *
48
+ * @public
49
+ */
38
50
  export interface LtTradesResponse {
39
51
  code: number
40
52
  next_cursor: string
@@ -1,6 +1,14 @@
1
1
  // Order shapes returned by Lighter's REST API.
2
2
 
3
- /** @public */
3
+ /**
4
+ * Order payload returned by Lighter's REST API. Amounts and prices are decimal
5
+ * strings in market precision. `order_expiry` is an absolute Unix-millisecond
6
+ * expiry; `created_at`, `updated_at`, and `transaction_time` are Unix seconds.
7
+ * Enum-like side, type, time-in-force, status, and trigger fields retain
8
+ * Lighter's wire strings.
9
+ *
10
+ * @public
11
+ */
4
12
  export type LtOrder = {
5
13
  order_index: number
6
14
  client_order_index: number
@@ -36,14 +44,25 @@ export type LtOrder = {
36
44
  transaction_time: number
37
45
  }
38
46
 
39
- /** @public */
47
+ /**
48
+ * Paginated order-history response from Lighter. `next_cursor` is an opaque
49
+ * continuation value for the next page.
50
+ *
51
+ * @public
52
+ */
40
53
  export interface LtOrdersResponse {
41
54
  code: number
42
55
  next_cursor: string
43
56
  orders: LtOrder[]
44
57
  }
45
58
 
46
- /** @public */
59
+ /**
60
+ * Single order-book level returned by Lighter. Amounts and prices are decimal
61
+ * strings in the market's native precision; expiry and transaction time are
62
+ * Unix milliseconds.
63
+ *
64
+ * @public
65
+ */
47
66
  export interface LtOrderBookOrder {
48
67
  order_index: number
49
68
  order_id: string
@@ -55,7 +74,11 @@ export interface LtOrderBookOrder {
55
74
  transaction_time: number
56
75
  }
57
76
 
58
- /** @public */
77
+ /**
78
+ * Order-book response containing separate ask and bid levels plus their counts.
79
+ *
80
+ * @public
81
+ */
59
82
  export interface LtOrderBookOrdersResponse {
60
83
  code: number
61
84
  total_asks: number
@@ -1,13 +1,24 @@
1
1
  // Lighter submit/execute-path wire shapes (sendTx, fastwithdraw, changeAccountTier).
2
2
 
3
- /** @public */
3
+ /**
4
+ * Request body for Lighter's `/api/v1/sendTx` endpoint. `tx_type` and
5
+ * `tx_info` are the signed WASM transaction envelope; `price_protection` is an
6
+ * optional venue-side execution guard.
7
+ *
8
+ * @public
9
+ */
4
10
  export interface LtSendTxRequest {
5
11
  tx_type: number
6
12
  tx_info: string
7
13
  price_protection?: boolean
8
14
  }
9
15
 
10
- /** @public */
16
+ /**
17
+ * Response from Lighter's `/api/v1/sendTx` endpoint. `tx_hash` identifies the
18
+ * submitted transaction; timing and quota fields are optional venue estimates.
19
+ *
20
+ * @public
21
+ */
11
22
  export interface LtSendTxResponse {
12
23
  code: number
13
24
  message: string
@@ -16,13 +27,24 @@ export interface LtSendTxResponse {
16
27
  volume_quota_remaining?: number
17
28
  }
18
29
 
19
- /** @public */
30
+ /**
31
+ * Batch request body for Lighter's transaction submission endpoint.
32
+ * `tx_types` is a JSON-encoded number array and `tx_infos` a JSON-encoded
33
+ * string array; corresponding entries are submitted in array order.
34
+ *
35
+ * @public
36
+ */
20
37
  export interface LtSendTxBatchRequest {
21
38
  tx_types: string // JSON-encoded number[]
22
39
  tx_infos: string // JSON-encoded string[]
23
40
  }
24
41
 
25
- /** @public */
42
+ /**
43
+ * Batch submission response from Lighter. Each `tx_hash` corresponds to the
44
+ * transaction at the same index in the submitted batch.
45
+ *
46
+ * @public
47
+ */
26
48
  export interface LtSendTxBatchResponse {
27
49
  code: number
28
50
  message: string