@lifi/perps-types 3.3.2 → 4.0.1

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 (82) hide show
  1. package/dist/cjs/account.d.ts +11 -2
  2. package/dist/cjs/account.d.ts.map +1 -1
  3. package/dist/cjs/action.d.ts +1 -0
  4. package/dist/cjs/action.d.ts.map +1 -1
  5. package/dist/cjs/asset.d.ts.map +1 -1
  6. package/dist/cjs/enums.d.ts +5 -0
  7. package/dist/cjs/enums.d.ts.map +1 -1
  8. package/dist/cjs/enums.js +7 -1
  9. package/dist/cjs/enums.js.map +1 -1
  10. package/dist/cjs/errors.d.ts.map +1 -1
  11. package/dist/cjs/market.d.ts +4 -0
  12. package/dist/cjs/market.d.ts.map +1 -1
  13. package/dist/cjs/primitives.d.ts.map +1 -1
  14. package/dist/cjs/providers.d.ts.map +1 -1
  15. package/dist/cjs/subscriptions.d.ts.map +1 -1
  16. package/dist/cjs/typedData.d.ts.map +1 -1
  17. package/dist/cjs/vote.d.ts.map +1 -1
  18. package/dist/cjs/vote.js.map +1 -1
  19. package/dist/esm/account.d.ts +223 -32
  20. package/dist/esm/account.d.ts.map +1 -1
  21. package/dist/esm/action.d.ts +205 -37
  22. package/dist/esm/action.d.ts.map +1 -1
  23. package/dist/esm/asset.d.ts +1 -4
  24. package/dist/esm/asset.d.ts.map +1 -1
  25. package/dist/esm/enums.d.ts +43 -20
  26. package/dist/esm/enums.d.ts.map +1 -1
  27. package/dist/esm/enums.js +43 -19
  28. package/dist/esm/enums.js.map +1 -1
  29. package/dist/esm/errors.d.ts +6 -1
  30. package/dist/esm/errors.d.ts.map +1 -1
  31. package/dist/esm/market.d.ts +57 -15
  32. package/dist/esm/market.d.ts.map +1 -1
  33. package/dist/esm/primitives.d.ts +12 -2
  34. package/dist/esm/primitives.d.ts.map +1 -1
  35. package/dist/esm/providers.d.ts +19 -6
  36. package/dist/esm/providers.d.ts.map +1 -1
  37. package/dist/esm/quote.d.ts +2 -2
  38. package/dist/esm/quote.d.ts.map +1 -1
  39. package/dist/esm/subscriptions.d.ts +27 -19
  40. package/dist/esm/subscriptions.d.ts.map +1 -1
  41. package/dist/esm/typedData.d.ts +15 -5
  42. package/dist/esm/typedData.d.ts.map +1 -1
  43. package/dist/esm/vote.d.ts +1 -3
  44. package/dist/esm/vote.d.ts.map +1 -1
  45. package/dist/esm/vote.js.map +1 -1
  46. package/dist/types/account.d.ts +223 -32
  47. package/dist/types/account.d.ts.map +1 -1
  48. package/dist/types/action.d.ts +205 -37
  49. package/dist/types/action.d.ts.map +1 -1
  50. package/dist/types/asset.d.ts +1 -4
  51. package/dist/types/asset.d.ts.map +1 -1
  52. package/dist/types/enums.d.ts +43 -20
  53. package/dist/types/enums.d.ts.map +1 -1
  54. package/dist/types/errors.d.ts +6 -1
  55. package/dist/types/errors.d.ts.map +1 -1
  56. package/dist/types/market.d.ts +57 -15
  57. package/dist/types/market.d.ts.map +1 -1
  58. package/dist/types/primitives.d.ts +12 -2
  59. package/dist/types/primitives.d.ts.map +1 -1
  60. package/dist/types/providers.d.ts +19 -6
  61. package/dist/types/providers.d.ts.map +1 -1
  62. package/dist/types/quote.d.ts +2 -2
  63. package/dist/types/quote.d.ts.map +1 -1
  64. package/dist/types/subscriptions.d.ts +27 -19
  65. package/dist/types/subscriptions.d.ts.map +1 -1
  66. package/dist/types/typedData.d.ts +15 -5
  67. package/dist/types/typedData.d.ts.map +1 -1
  68. package/dist/types/vote.d.ts +1 -3
  69. package/dist/types/vote.d.ts.map +1 -1
  70. package/package.json +1 -1
  71. package/src/account.ts +225 -37
  72. package/src/action.ts +205 -37
  73. package/src/asset.ts +1 -4
  74. package/src/enums.ts +44 -20
  75. package/src/errors.ts +6 -1
  76. package/src/market.ts +69 -16
  77. package/src/primitives.ts +12 -2
  78. package/src/providers.ts +19 -6
  79. package/src/quote.ts +2 -2
  80. package/src/subscriptions.ts +27 -19
  81. package/src/typedData.ts +15 -5
  82. package/src/vote.ts +1 -3
package/src/action.ts CHANGED
@@ -14,13 +14,22 @@ import type { Address, Hex } from './primitives.js'
14
14
  import type { PerpsTypedData } from './typedData.js'
15
15
  import type { VoteParams } from './vote.js'
16
16
 
17
- /** @public */
17
+ /**
18
+ * Unsigned EIP-712 action step containing typed data for client signing.
19
+ *
20
+ * @public
21
+ */
18
22
  export interface Eip712ActionStep {
19
23
  action: ActionType
20
24
  typedData: PerpsTypedData
21
25
  }
22
26
 
23
- /** @public */
27
+ /**
28
+ * Unsigned WASM-blob action step containing provider-specific signing
29
+ * parameters for the client.
30
+ *
31
+ * @public
32
+ */
24
33
  export interface WasmBlobActionStep {
25
34
  action: ActionType
26
35
  wasmSignParams: Record<string, unknown>
@@ -37,12 +46,18 @@ export interface EvmCall {
37
46
  chainId: number
38
47
  to: Address
39
48
  functionName: string
49
+ /** Function arguments supplied to the contract call in declaration order. */
40
50
  args: readonly unknown[]
41
51
  /** Human-readable ABI signatures, e.g. `'function approve(address,uint256) returns (bool)'`, fed to viem `parseAbi`. */
42
52
  abi: readonly string[]
43
53
  }
44
54
 
45
- /** @public */
55
+ /**
56
+ * Unsigned EVM transaction action step. `txParams` describes the call that the
57
+ * client encodes and submits.
58
+ *
59
+ * @public
60
+ */
46
61
  export interface EvmTxActionStep {
47
62
  action: ActionType
48
63
  txParams: EvmCall
@@ -78,12 +93,20 @@ export interface HmacActionStep {
78
93
  * @public
79
94
  */
80
95
  export interface CreateDepositAddressSessionMarker {
96
+ /** Source network for the provider deposit address. */
81
97
  network: 'ethereum'
98
+ /** Deposit asset symbol; currently constrained to USDC. */
82
99
  symbol: 'USDC'
100
+ /** Provider wallet destination policy; currently constrained to margin. */
83
101
  depositDestination: { wallet: 'margin' }
84
102
  }
85
103
 
86
- /** @public */
104
+ /**
105
+ * Client-only session action step, with a provider session request marker or
106
+ * an empty session payload for actions that do not need one.
107
+ *
108
+ * @public
109
+ */
87
110
  export type SessionActionStep =
88
111
  | {
89
112
  action: Exclude<ActionType, ActionType.CREATE_DEPOSIT_ADDRESS>
@@ -94,17 +117,26 @@ export type SessionActionStep =
94
117
  session: CreateDepositAddressSessionMarker
95
118
  }
96
119
 
97
- /** @public */
120
+ /**
121
+ * Unsigned SIWE action step containing the backend-issued login challenge.
122
+ *
123
+ * @public
124
+ */
98
125
  export interface SiweActionStep {
99
126
  action: ActionType
100
127
  siwe: {
128
+ /** Backend identifier for the SIWE challenge. */
101
129
  challengeId: string
102
130
  /** The backend-built ERC-4361 challenge the wallet must `personal_sign`. */
103
131
  message: string
104
132
  }
105
133
  }
106
134
 
107
- /** @public */
135
+ /**
136
+ * Union of all unsigned action-step encodings produced by `createAction`.
137
+ *
138
+ * @public
139
+ */
108
140
  export type ActionStep =
109
141
  | Eip712ActionStep
110
142
  | WasmBlobActionStep
@@ -113,14 +145,22 @@ export type ActionStep =
113
145
  | SessionActionStep
114
146
  | SiweActionStep
115
147
 
116
- /** @public */
148
+ /**
149
+ * Signed EIP-712 action step ready for backend execution.
150
+ *
151
+ * @public
152
+ */
117
153
  export interface Eip712SignedActionStep {
118
154
  action: ActionType
119
155
  typedData: PerpsTypedData
120
156
  signature: Hex
121
157
  }
122
158
 
123
- /** @public */
159
+ /**
160
+ * Signed WASM-blob action step, including provider wire transaction details.
161
+ *
162
+ * @public
163
+ */
124
164
  export interface WasmBlobSignedActionStep {
125
165
  action: ActionType
126
166
  wasmSignParams: Record<string, unknown>
@@ -131,14 +171,22 @@ export interface WasmBlobSignedActionStep {
131
171
  }
132
172
  }
133
173
 
134
- /** @public */
174
+ /**
175
+ * Signed EVM transaction action step with the submitted transaction hash.
176
+ *
177
+ * @public
178
+ */
135
179
  export interface EvmTxSignedActionStep {
136
180
  action: ActionType
137
181
  txParams: EvmCall
138
182
  txHash: string
139
183
  }
140
184
 
141
- /** @public */
185
+ /**
186
+ * HMAC-authenticated venue request ready for backend execution.
187
+ *
188
+ * @public
189
+ */
142
190
  export interface HmacSignedActionStep {
143
191
  action: ActionType
144
192
  request: HmacActionStep['request']
@@ -154,14 +202,22 @@ export interface HmacSignedActionStep {
154
202
  }
155
203
  }
156
204
 
157
- /** @public */
205
+ /**
206
+ * Signed SIWE login action step.
207
+ *
208
+ * @public
209
+ */
158
210
  export interface SiweSignedActionStep {
159
211
  action: ActionType
160
212
  siwe: SiweActionStep['siwe']
161
213
  signature: Hex
162
214
  }
163
215
 
164
- /** @public */
216
+ /**
217
+ * Union of all signed action-step encodings accepted by `executeAction`.
218
+ *
219
+ * @public
220
+ */
165
221
  export type SignedActionStep =
166
222
  | Eip712SignedActionStep
167
223
  | WasmBlobSignedActionStep
@@ -169,7 +225,12 @@ export type SignedActionStep =
169
225
  | HmacSignedActionStep
170
226
  | SiweSignedActionStep
171
227
 
172
- /** @public */
228
+ /**
229
+ * Per-action execution result. Success arms may include a provider order id;
230
+ * failure arms carry a message and optional structured error code.
231
+ *
232
+ * @public
233
+ */
173
234
  export type ActionResult =
174
235
  | {
175
236
  action: ActionType
@@ -184,13 +245,27 @@ export type ActionResult =
184
245
  errorCode?: PerpsErrorCode
185
246
  }
186
247
 
187
- /** @public */
248
+ /**
249
+ * Trigger prices used to configure take-profit or stop-loss behavior.
250
+ * Prices are decimal strings in the market's quote currency.
251
+ *
252
+ * @public
253
+ */
188
254
  export interface TriggerOrderInput {
189
255
  triggerPrice: string
190
256
  limitPrice?: string
257
+ /**
258
+ * Base-asset size the trigger closes. Omitted covers the entire position,
259
+ * tracking later size changes; set, it is a fixed partial amount.
260
+ */
261
+ size?: string
191
262
  }
192
263
 
193
- /** @public */
264
+ /**
265
+ * Mutable fields for an existing order, identified by venue order id.
266
+ *
267
+ * @public
268
+ */
194
269
  export interface ModifyOrderInput {
195
270
  id: string
196
271
  price?: string
@@ -199,7 +274,12 @@ export interface ModifyOrderInput {
199
274
  limitPrice?: string
200
275
  }
201
276
 
202
- /** @public */
277
+ /**
278
+ * Normalized order returned by a provider, including lifecycle and trigger
279
+ * metadata. Quantities and prices are decimal strings.
280
+ *
281
+ * @public
282
+ */
203
283
  export interface Order {
204
284
  orderId: string
205
285
  market: MarketDisplay
@@ -223,7 +303,11 @@ export interface Order {
223
303
  updatedAt: string
224
304
  }
225
305
 
226
- /** @public */
306
+ /**
307
+ * Parameters for placing a regular order on a market.
308
+ *
309
+ * @public
310
+ */
227
311
  export interface PlaceOrderParams {
228
312
  market: MarketRef
229
313
  side: OrderSide
@@ -240,7 +324,11 @@ export interface PlaceOrderParams {
240
324
  stopLoss?: TriggerOrderInput
241
325
  }
242
326
 
243
- /** @public */
327
+ /**
328
+ * Parameters for placing a take-profit or stop-loss trigger order.
329
+ *
330
+ * @public
331
+ */
244
332
  export interface PlaceTriggerOrderParams {
245
333
  market: MarketRef
246
334
  side: OrderSide
@@ -248,7 +336,11 @@ export interface PlaceTriggerOrderParams {
248
336
  stopLoss?: TriggerOrderInput
249
337
  }
250
338
 
251
- /** @public */
339
+ /**
340
+ * Parameters for cancelling one or more venue orders.
341
+ *
342
+ * @public
343
+ */
252
344
  export interface CancelOrderParams {
253
345
  /** Venue order ids. Venues whose ids are scoped per market (e.g. Lighter's
254
346
  * `order_index`) also accept the composite `"<market_id>:<order_id>"`. */
@@ -257,12 +349,20 @@ export interface CancelOrderParams {
257
349
  assetId?: string
258
350
  }
259
351
 
260
- /** @public */
352
+ /**
353
+ * Parameters for applying one or more modifications to existing orders.
354
+ *
355
+ * @public
356
+ */
261
357
  export interface ModifyOrderParams {
262
358
  modifications: ModifyOrderInput[]
263
359
  }
264
360
 
265
- /** @public */
361
+ /**
362
+ * Parameters for changing leverage on a market.
363
+ *
364
+ * @public
365
+ */
266
366
  export interface UpdateLeverageParams {
267
367
  market: MarketRef
268
368
  leverage: number
@@ -270,14 +370,23 @@ export interface UpdateLeverageParams {
270
370
  marginMode?: MarginMode
271
371
  }
272
372
 
273
- /** @public */
373
+ /**
374
+ * Parameters for adding or removing margin from a market position.
375
+ * `amount` is a decimal string in the venue's collateral units.
376
+ *
377
+ * @public
378
+ */
274
379
  export interface UpdatePositionMarginParams {
275
380
  market: MarketRef
276
381
  action: 'add' | 'remove'
277
382
  amount: string
278
383
  }
279
384
 
280
- /** @public */
385
+ /**
386
+ * Parameters for enabling or disabling an asset as cross-margin collateral.
387
+ *
388
+ * @public
389
+ */
281
390
  export interface UpdateAssetCollateralParams {
282
391
  /** Provider-native spot asset id (matches `Asset.id`), keyed per asset — not per market. */
283
392
  assetId: string
@@ -285,13 +394,21 @@ export interface UpdateAssetCollateralParams {
285
394
  enabled: boolean
286
395
  }
287
396
 
288
- /** @public */
397
+ /**
398
+ * Parameters for withdrawing a decimal-string amount to an EVM address.
399
+ *
400
+ * @public
401
+ */
289
402
  export interface WithdrawalParams {
290
403
  destination: Address
291
404
  amount: string
292
405
  }
293
406
 
294
- /** @public */
407
+ /**
408
+ * Parameters for depositing a token from an EVM source chain.
409
+ *
410
+ * @public
411
+ */
295
412
  export interface DepositParams {
296
413
  /** Amount of the token to deposit (human-readable, e.g. "100.5"). */
297
414
  amount: string
@@ -301,23 +418,40 @@ export interface DepositParams {
301
418
  chainId: number
302
419
  }
303
420
 
304
- /** @public */
421
+ /**
422
+ * Parameters for approving an account agent, including an optional TTL in
423
+ * milliseconds.
424
+ *
425
+ * @public
426
+ */
305
427
  export interface ApproveAgentParams {
306
428
  agentAddress: string
307
429
  agentTtlMs?: number
308
430
  }
309
431
 
310
- /** @public */
432
+ /**
433
+ * Parameters for selecting a provider account mode by its wire value.
434
+ *
435
+ * @public
436
+ */
311
437
  export interface AccountModeParams {
312
438
  mode: string
313
439
  }
314
440
 
315
- /** @public */
441
+ /**
442
+ * Parameters for selecting a provider account tier by its wire value.
443
+ *
444
+ * @public
445
+ */
316
446
  export interface AccountTypeParams {
317
447
  tier: string
318
448
  }
319
449
 
320
- /** @public */
450
+ /**
451
+ * Parameters for moving an asset between provider DEX accounts.
452
+ *
453
+ * @public
454
+ */
321
455
  export interface SendAssetParams {
322
456
  /** Canonical `Asset.id` of the asset being moved (for Hyperliquid spot
323
457
  * assets, the token index as a string) — never a display symbol. */
@@ -327,7 +461,12 @@ export interface SendAssetParams {
327
461
  amount: string
328
462
  }
329
463
 
330
- /** @public */
464
+ /**
465
+ * Parameters for cancelling all orders immediately or through a scheduled
466
+ * cancellation instruction.
467
+ *
468
+ * @public
469
+ */
331
470
  export interface CancelAllOrdersParams {
332
471
  /** 0=immediate (cancel GTC), 1=scheduled, 2=abort scheduled */
333
472
  timeInForce: number
@@ -335,7 +474,11 @@ export interface CancelAllOrdersParams {
335
474
  timestampMs?: number
336
475
  }
337
476
 
338
- /** @public */
477
+ /**
478
+ * Parameters for registering a provider API key in a specific slot.
479
+ *
480
+ * @public
481
+ */
339
482
  export interface RegisterApiKeyParams {
340
483
  /** The API key slot index to register (0-255). Reusing a fixed slot overwrites the old key. */
341
484
  apiKeyIndex: number
@@ -348,7 +491,11 @@ export interface RegisterApiKeyParams {
348
491
  knownPublicKey?: string
349
492
  }
350
493
 
351
- /** @public */
494
+ /**
495
+ * Parameters for approving a Lighter read-only token and its scope/expiry.
496
+ *
497
+ * @public
498
+ */
352
499
  export interface ApproveReadOnlyTokenParams {
353
500
  accountIndex: number
354
501
  /** Absolute unix-seconds expiry. Lighter requires lifetime between 1 day and 10 years. */
@@ -356,7 +503,12 @@ export interface ApproveReadOnlyTokenParams {
356
503
  scope: 'single' | 'all'
357
504
  }
358
505
 
359
- /** @public */
506
+ /**
507
+ * Mapping from each {@link ActionType} to its action-specific parameter shape.
508
+ * `Record<string, never>` marks actions whose params object must be empty.
509
+ *
510
+ * @public
511
+ */
360
512
  export interface ActionParamsMap {
361
513
  [ActionType.APPROVE_AGENT]: ApproveAgentParams
362
514
  [ActionType.APPROVE_BUILDER_FEE]: Record<string, never>
@@ -385,7 +537,11 @@ export interface ActionParamsMap {
385
537
  [ActionType.META_ACCEPT_TERMS]: AcceptTermsParams
386
538
  }
387
539
 
388
- /** @public */
540
+ /**
541
+ * Discriminated request sent to create unsigned steps for one action.
542
+ *
543
+ * @public
544
+ */
389
545
  export type CreateActionRequest = {
390
546
  [K in ActionType]: {
391
547
  provider: string
@@ -396,12 +552,20 @@ export type CreateActionRequest = {
396
552
  }
397
553
  }[ActionType]
398
554
 
399
- /** @public */
555
+ /**
556
+ * Response containing the unsigned steps created for an action request.
557
+ *
558
+ * @public
559
+ */
400
560
  export interface CreateActionResponse {
401
561
  actions: ActionStep[]
402
562
  }
403
563
 
404
- /** @public */
564
+ /**
565
+ * Discriminated request sent to execute signed steps for one action.
566
+ *
567
+ * @public
568
+ */
405
569
  export type ExecuteActionRequest = {
406
570
  [K in ActionType]: {
407
571
  provider: string
@@ -412,7 +576,11 @@ export type ExecuteActionRequest = {
412
576
  }
413
577
  }[ActionType]
414
578
 
415
- /** @public */
579
+ /**
580
+ * Response containing per-action execution results.
581
+ *
582
+ * @public
583
+ */
416
584
  export interface ExecuteActionResponse {
417
585
  results: ActionResult[]
418
586
  }
package/src/asset.ts CHANGED
@@ -56,15 +56,12 @@ export interface DepositAsset {
56
56
  address: Address
57
57
  /** ERC-20 decimals, used to scale deposit amounts. */
58
58
  decimals: number
59
- /** Display ticker for UI labels; same semantics as {@link Asset.displaySymbol}. */
60
59
  displaySymbol: string
61
- /** Token logo for UI; same semantics as {@link Asset.logoURI}. */
62
60
  logoURI: string
63
- /** Optional longer display name; same semantics as {@link Asset.displayName}. */
64
61
  displayName?: string
65
62
  }
66
63
 
67
- /** @public */
64
+ /** Response containing the provider's normalized asset registry. @public */
68
65
  export interface AssetsResponse {
69
66
  assets: Asset[]
70
67
  }
package/src/enums.ts CHANGED
@@ -1,4 +1,8 @@
1
- /** @public */
1
+ /**
2
+ * Numeric error codes returned by the perps API.
3
+ *
4
+ * @public
5
+ */
2
6
  export enum PerpsErrorCode {
3
7
  // Base errors (2000-2009)
4
8
  DefaultError = 2000,
@@ -36,13 +40,13 @@ export enum PerpsErrorCode {
36
40
  RouteNotFound = 2060,
37
41
  }
38
42
 
39
- /** @public */
43
+ /** Side of an order or execution, using provider wire values. @public */
40
44
  export enum OrderSide {
41
45
  BUY = 'BUY',
42
46
  SELL = 'SELL',
43
47
  }
44
48
 
45
- /** @public */
49
+ /** Supported regular and trigger order kinds, using provider wire values. @public */
46
50
  export enum OrderType {
47
51
  MARKET = 'MARKET',
48
52
  LIMIT = 'LIMIT',
@@ -53,19 +57,29 @@ export enum OrderType {
53
57
  TRIGGER_ONLY = 'TRIGGER_ONLY',
54
58
  }
55
59
 
56
- /** @public */
60
+ /** Direction of an open position. @public */
57
61
  export enum PositionSide {
58
62
  LONG = 'LONG',
59
63
  SHORT = 'SHORT',
60
64
  }
61
65
 
62
- /** @public */
66
+ /** Margin allocation mode for a position. @public */
63
67
  export enum MarginMode {
64
68
  ISOLATED = 'ISOLATED',
65
69
  CROSS = 'CROSS',
66
70
  }
67
71
 
68
- /** @public */
72
+ /** Per-market support for changing an open position's dedicated margin. @public */
73
+ export enum PositionMarginAdjustment {
74
+ /** The venue does not expose individual position margin. */
75
+ NONE = 'NONE',
76
+ /** Margin can be added but cannot be removed. */
77
+ ADD_ONLY = 'ADD_ONLY',
78
+ /** Margin can be added and removed. */
79
+ ADD_AND_REMOVE = 'ADD_AND_REMOVE',
80
+ }
81
+
82
+ /** Provider order time-in-force policies. @public */
69
83
  export enum TimeInForce {
70
84
  GTC = 'GTC',
71
85
  IOC = 'IOC',
@@ -73,7 +87,7 @@ export enum TimeInForce {
73
87
  GTT = 'GTT',
74
88
  }
75
89
 
76
- /** @public */
90
+ /** Lifecycle status of a provider order. @public */
77
91
  export enum OrderStatus {
78
92
  PENDING = 'PENDING',
79
93
  OPEN = 'OPEN',
@@ -85,7 +99,7 @@ export enum OrderStatus {
85
99
  TRIGGERED = 'TRIGGERED',
86
100
  }
87
101
 
88
- /** @public */
102
+ /** Lifecycle status of an execution/fill. @public */
89
103
  export enum FillStatus {
90
104
  FILLED = 'FILLED',
91
105
  PARTIALLY_FILLED = 'PARTIALLY_FILLED',
@@ -93,13 +107,18 @@ export enum FillStatus {
93
107
  REJECTED = 'REJECTED',
94
108
  }
95
109
 
96
- /** @public */
110
+ /** Whether a fill supplied maker or taker liquidity. @public */
97
111
  export enum LiquidityRole {
98
112
  MAKER = 'maker',
99
113
  TAKER = 'taker',
100
114
  }
101
115
 
102
- /** @public */
116
+ /**
117
+ * Action identifiers used in setup, create-action, and execute-action
118
+ * requests. Values are the backend wire strings.
119
+ *
120
+ * @public
121
+ */
103
122
  export enum ActionType {
104
123
  APPROVE_AGENT = 'approveAgent',
105
124
  APPROVE_BUILDER_FEE = 'approveBuilderFee',
@@ -131,26 +150,26 @@ export enum ActionType {
131
150
  META_ACCEPT_TERMS = 'metaAcceptTerms',
132
151
  }
133
152
 
134
- /** @public */
153
+ /** Price relation that activates a trigger order. @public */
135
154
  export enum TriggerCondition {
136
155
  ABOVE = 'ABOVE',
137
156
  BELOW = 'BELOW',
138
157
  }
139
158
 
140
- /** @public */
159
+ /** Take-profit or stop-loss trigger order classification. @public */
141
160
  export enum TriggerOrderType {
142
161
  TAKE_PROFIT = 'TAKE_PROFIT',
143
162
  STOP_LOSS = 'STOP_LOSS',
144
163
  }
145
164
 
146
- /** @public */
165
+ /** Lifecycle status of a trigger order. @public */
147
166
  export enum TriggerOrderStatus {
148
167
  WAITING = 'WAITING',
149
168
  TRIGGERED = 'TRIGGERED',
150
169
  CANCELLED = 'CANCELLED',
151
170
  }
152
171
 
153
- /** @public */
172
+ /** Account activity record categories. @public */
154
173
  export enum ActivityType {
155
174
  DEPOSIT = 'DEPOSIT',
156
175
  WITHDRAWAL = 'WITHDRAWAL',
@@ -159,7 +178,7 @@ export enum ActivityType {
159
178
  TRANSFER = 'TRANSFER',
160
179
  }
161
180
 
162
- /** @public */
181
+ /** Human-readable classification of how a fill changed a position. @public */
163
182
  export enum FillClassification {
164
183
  OPENED_LONG = 'Opened Long',
165
184
  OPENED_SHORT = 'Opened Short',
@@ -175,24 +194,24 @@ export enum FillClassification {
175
194
  SPOT_SELL = 'Spot Sell',
176
195
  }
177
196
 
178
- /** @public */
197
+ /** Classification emitted for a liquidation activity. @public */
179
198
  export enum LiquidationClassification {
180
199
  LIQUIDATED = 'Liquidated',
181
200
  }
182
201
 
183
- /** @public */
202
+ /** Classification emitted for a funding activity. @public */
184
203
  export enum FundingClassification {
185
204
  FUNDING = 'Funding',
186
205
  }
187
206
 
188
- /** @public */
207
+ /** Classification emitted for an inbound, outbound, or internal transfer. @public */
189
208
  export enum TransferClassification {
190
209
  DEPOSIT = 'Deposit',
191
210
  WITHDRAWAL = 'Withdrawal',
192
211
  TRANSFER = 'Transfer',
193
212
  }
194
213
 
195
- /** @public */
214
+ /** Union of classifications emitted by all activity record categories. @public */
196
215
  export type ActivityClassification =
197
216
  | FillClassification
198
217
  | LiquidationClassification
@@ -213,7 +232,12 @@ export enum PerpsSigner {
213
232
  SDK = 'SDK',
214
233
  }
215
234
 
216
- /** @public */
235
+ /**
236
+ * Signing mechanisms supported by action steps. Values are serialized in
237
+ * provider metadata and action responses.
238
+ *
239
+ * @public
240
+ */
217
241
  export enum SigningMethod {
218
242
  EIP712 = 'eip712',
219
243
  WASM_BLOB = 'wasmBlob',
package/src/errors.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  import type { PerpsErrorCode } from './enums.js'
2
2
 
3
- /** @public */
3
+ /**
4
+ * Structured perps API error payload. `code` is the stable classification;
5
+ * `tool` identifies the backend tool when the provider supplies one.
6
+ *
7
+ * @public
8
+ */
4
9
  export interface PerpsErrorBody {
5
10
  code: PerpsErrorCode
6
11
  tool?: string