@polymarket/bindings 0.13.0 → 0.14.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/chunk-JPPG656Y.js +2 -0
- package/dist/chunk-JPPG656Y.js.map +1 -0
- package/dist/chunk-YXNKEMRF.js +2 -0
- package/dist/chunk-YXNKEMRF.js.map +1 -0
- package/dist/chunk-ZMJTXTXA.js +2 -0
- package/dist/chunk-ZMJTXTXA.js.map +1 -0
- package/dist/clob/index.d.ts +489 -8
- package/dist/clob/index.js +1 -1
- package/dist/clob/index.js.map +1 -1
- package/dist/combos/index.d.ts +1 -1
- package/dist/combos/index.js +1 -1
- package/dist/combos/index.js.map +1 -1
- package/dist/{comment-CKJIqOZS.d.ts → comment-tQ-L48Di.d.ts} +2 -2
- package/dist/data/index.d.ts +276 -9
- package/dist/data/index.js +1 -1
- package/dist/data/index.js.map +1 -1
- package/dist/gamma/index.d.ts +79 -4
- package/dist/gamma/index.js +1 -1
- package/dist/gamma/index.js.map +1 -1
- package/dist/index.d.ts +108 -213
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{orders-BV68_6ST.d.ts → orders-SIFuRgWc.d.ts} +114 -2
- package/dist/perps/index.d.ts +76 -3
- package/dist/perps/index.js +1 -1
- package/dist/perps/index.js.map +1 -1
- package/dist/relayer/index.d.ts +1 -1
- package/dist/relayer/index.js +1 -1
- package/dist/shared-QrXQ5O6x.d.ts +223 -0
- package/dist/subscriptions/index.d.ts +316 -23
- package/dist/subscriptions/index.js +1 -1
- package/dist/subscriptions/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-2FRDSBWY.js +0 -2
- package/dist/chunk-2FRDSBWY.js.map +0 -1
- package/dist/chunk-3IZ4N7C2.js +0 -2
- package/dist/chunk-3IZ4N7C2.js.map +0 -1
- package/dist/chunk-Z6SGQXSJ.js +0 -2
- package/dist/chunk-Z6SGQXSJ.js.map +0 -1
package/dist/perps/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _polymarket_types from '@polymarket/types';
|
|
2
|
-
import { P as PerpsInstrumentId,
|
|
3
|
-
export { C as CreatePerpsChaseResponseSchema, F as FetchPerpsBuilderApprovalsResponseSchema,
|
|
4
|
-
import { DecimalString, EpochMilliseconds, BaseUnits, OrderSide } from '../
|
|
2
|
+
import { P as PerpsInstrumentId, a as PerpsEntityId, b as PerpsFundingPaymentId, c as PerpsDepositStatus, d as PerpsInternalTransferId, e as PerpsKnownInternalTransferType, f as PerpsInternalTransferDirection, g as PerpsWithdrawalId, h as PerpsKnownWithdrawalStatus, i as PerpsInstrumentType, j as PerpsInstrumentCategory, k as PerpsTradeId, l as PerpsSide, m as PerpsClientOrderId, n as PerpsOrderId } from '../orders-SIFuRgWc.js';
|
|
3
|
+
export { C as CreatePerpsChaseResponseSchema, F as FetchPerpsBuilderApprovalsResponseSchema, o as FetchPerpsChasesResponseSchema, p as FetchPerpsOpenOrdersResponseSchema, q as FetchPerpsOrdersResponseSchema, r as FetchPerpsUnreadNotificationsCountResponseSchema, L as ListPerpsBuilderEarningsResponseSchema, s as ListPerpsFillsResponseSchema, t as ListPerpsNotificationsResponseSchema, M as MarkPerpsNotificationsReadResponseSchema, u as PerpsAccountFill, v as PerpsAccountFillSchema, w as PerpsAccountFillUpdateSchema, x as PerpsAssetSchema, y as PerpsBuilderApproval, z as PerpsBuilderApprovalSchema, A as PerpsBuilderEarning, B as PerpsBuilderEarningId, D as PerpsBuilderEarningIdSchema, E as PerpsBuilderEarningSchema, G as PerpsBuilderEarningsAsset, H as PerpsBuilderEarningsAssetSchema, I as PerpsBuilderEarningsSnapshot, J as PerpsBuilderEarningsSnapshotSchema, K as PerpsBuilderEarningsSummary, N as PerpsBuilderEarningsSummarySchema, O as PerpsBuilderStatus, Q as PerpsBuilderStatusSchema, R as PerpsBuilderTerms, S as PerpsBuilderTermsSchema, T as PerpsCancelAllOrdersResponse, U as PerpsCancelAllOrdersResponseSchema, V as PerpsCancelOrderErrorCode, W as PerpsCancelOrderErrorCodeSchema, X as PerpsCancelOrderResult, Y as PerpsCancelOrderResultSchema, Z as PerpsChase, _ as PerpsChaseAccepted, $ as PerpsChaseAcceptedSchema, a0 as PerpsChaseId, a1 as PerpsChaseIdSchema, a2 as PerpsChaseSchema, a3 as PerpsClientOrderIdSchema, a4 as PerpsCommandAck, a5 as PerpsCommandAckSchema, a6 as PerpsCommandStatusSchema, a7 as PerpsCredentials, a8 as PerpsDataResponseSchema, a9 as PerpsDecimal, aa as PerpsDecimalInput, ab as PerpsDecimalInputSchema, ac as PerpsDepositAmount, ad as PerpsDepositStatusSchema, ae as PerpsEntityIdSchema, af as PerpsFundingInterval, ag as PerpsFundingIntervalSchema, ah as PerpsFundingPaymentIdSchema, ai as PerpsInstrumentCategorySchema, aj as PerpsInstrumentIdSchema, ak as PerpsInstrumentTypeSchema, al as PerpsInternalTransferDirectionSchema, am as PerpsInternalTransferIdSchema, an as PerpsInternalTransferType, ao as PerpsInternalTransferTypeSchema, ap as PerpsKlineInterval, aq as PerpsKlineIntervalSchema, ar as PerpsKnownCancelOrderErrorCode, as as PerpsLimitOrderCanceledNotification, at as PerpsLimitOrderCanceledNotificationSchema, au as PerpsLiquidationDetails, av as PerpsLiquidationDetailsSchema, aw as PerpsLiquidationMethod, ax as PerpsLiquidationWarningNotification, ay as PerpsLiquidationWarningNotificationSchema, az as PerpsLiquidityRole, aA as PerpsMarginType, aB as PerpsMarginTypeSchema, aC as PerpsNotification, aD as PerpsNotificationEntry, aE as PerpsNotificationEntrySchema, aF as PerpsNotificationId, aG as PerpsNotificationIdSchema, aH as PerpsNotificationOrderType, aI as PerpsNotificationOrderTypeSchema, aJ as PerpsNotificationSchema, aK as PerpsNotificationType, aL as PerpsNotificationTypeSchema, aM as PerpsOrder, aN as PerpsOrderIdSchema, aO as PerpsOrderSchema, aP as PerpsOrderStatus, aQ as PerpsOrderStatusSchema, aR as PerpsOrderUpdateSchema, aS as PerpsPnlInterval, aT as PerpsPnlIntervalSchema, aU as PerpsPositionChangeNotification, aV as PerpsPositionChangeNotificationSchema, aW as PerpsPositionClosedNotification, aX as PerpsPositionClosedNotificationSchema, aY as PerpsPositionDeleveragedNotification, aZ as PerpsPositionDeleveragedNotificationSchema, a_ as PerpsPositionLiquidatedNotification, a$ as PerpsPositionLiquidatedNotificationSchema, b0 as PerpsPostOrderAck, b1 as PerpsPostOrderAckSchema, b2 as PerpsSideSchema, b3 as PerpsSortDirection, b4 as PerpsSortDirectionSchema, b5 as PerpsTimeInForce, b6 as PerpsTimeInForceSchema, b7 as PerpsTpSlKind, b8 as PerpsTpSlKindSchema, b9 as PerpsTpSlOrderFields, ba as PerpsTpSlOrderFieldsSchema, bb as PerpsTpSlScope, bc as PerpsTpSlScopeSchema, bd as PerpsTradeIdSchema, be as PerpsTxHash, bf as PerpsTxHashSchema, bg as PerpsUpdateLeverageBatchResult, bh as PerpsUpdateLeverageBatchResultSchema, bi as PerpsUpdateLeverageRejection, bj as PerpsUpdateLeverageRejectionSchema, bk as PerpsUpdateLeverageResult, bl as PerpsUpdateLeverageResultSchema, bm as PerpsWithdrawalAmount, bn as PerpsWithdrawalIdSchema, bo as PerpsWithdrawalStatus, bp as PerpsWithdrawalStatusSchema, bq as decimalString, br as perpsBaseUnits, bs as perpsDecimal } from '../orders-SIFuRgWc.js';
|
|
4
|
+
import { y as DecimalString, H as EpochMilliseconds, B as BaseUnits, af as OrderSide } from '../shared-QrXQ5O6x.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -101,6 +101,7 @@ declare const PerpsPortfolioPositionSchema: z.ZodPipe<z.ZodObject<{
|
|
|
101
101
|
unrealized_pnl: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
102
102
|
return_on_equity: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
103
103
|
cumulative_funding: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
104
|
+
adl_index: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
|
|
104
105
|
}, z.core.$strip>, z.ZodTransform<{
|
|
105
106
|
instrumentId: PerpsInstrumentId;
|
|
106
107
|
symbol: string;
|
|
@@ -115,6 +116,8 @@ declare const PerpsPortfolioPositionSchema: z.ZodPipe<z.ZodObject<{
|
|
|
115
116
|
unrealizedPnl: DecimalString;
|
|
116
117
|
returnOnEquity: DecimalString;
|
|
117
118
|
cumulativeFunding: DecimalString;
|
|
119
|
+
/** Auto-deleveraging risk tier; higher values indicate higher risk. */
|
|
120
|
+
adlIndex: 0 | 1 | 2 | 3;
|
|
118
121
|
}, {
|
|
119
122
|
instrument_id: PerpsInstrumentId;
|
|
120
123
|
symbol: string;
|
|
@@ -129,6 +132,7 @@ declare const PerpsPortfolioPositionSchema: z.ZodPipe<z.ZodObject<{
|
|
|
129
132
|
unrealized_pnl: DecimalString;
|
|
130
133
|
return_on_equity: DecimalString;
|
|
131
134
|
cumulative_funding: DecimalString;
|
|
135
|
+
adl_index: 0 | 1 | 2 | 3;
|
|
132
136
|
}>>;
|
|
133
137
|
/**
|
|
134
138
|
* @experimental This API may change in a breaking way in any release, including patch releases.
|
|
@@ -139,6 +143,7 @@ type PerpsPortfolioPosition = z.infer<typeof PerpsPortfolioPositionSchema>;
|
|
|
139
143
|
*/
|
|
140
144
|
declare const PerpsMarginSummarySchema: z.ZodObject<{
|
|
141
145
|
totalAccountValue: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
146
|
+
availableOrderMargin: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
142
147
|
totalInitialMargin: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
143
148
|
totalMaintenanceMargin: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
144
149
|
totalPositionValue: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
@@ -165,6 +170,7 @@ declare const PerpsPortfolioSchema: z.ZodPipe<z.ZodObject<{
|
|
|
165
170
|
unrealized_pnl: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
166
171
|
return_on_equity: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
167
172
|
cumulative_funding: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
173
|
+
adl_index: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
|
|
168
174
|
}, z.core.$strip>, z.ZodTransform<{
|
|
169
175
|
instrumentId: PerpsInstrumentId;
|
|
170
176
|
symbol: string;
|
|
@@ -179,6 +185,8 @@ declare const PerpsPortfolioSchema: z.ZodPipe<z.ZodObject<{
|
|
|
179
185
|
unrealizedPnl: DecimalString;
|
|
180
186
|
returnOnEquity: DecimalString;
|
|
181
187
|
cumulativeFunding: DecimalString;
|
|
188
|
+
/** Auto-deleveraging risk tier; higher values indicate higher risk. */
|
|
189
|
+
adlIndex: 0 | 1 | 2 | 3;
|
|
182
190
|
}, {
|
|
183
191
|
instrument_id: PerpsInstrumentId;
|
|
184
192
|
symbol: string;
|
|
@@ -193,25 +201,30 @@ declare const PerpsPortfolioSchema: z.ZodPipe<z.ZodObject<{
|
|
|
193
201
|
unrealized_pnl: DecimalString;
|
|
194
202
|
return_on_equity: DecimalString;
|
|
195
203
|
cumulative_funding: DecimalString;
|
|
204
|
+
adl_index: 0 | 1 | 2 | 3;
|
|
196
205
|
}>>>;
|
|
197
206
|
margin: z.ZodPipe<z.ZodObject<{
|
|
198
207
|
total_account_value: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
208
|
+
available_order_margin: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
199
209
|
total_initial_margin: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
200
210
|
total_maintenance_margin: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
201
211
|
total_position_value: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
202
212
|
}, z.core.$strip>, z.ZodTransform<{
|
|
203
213
|
totalAccountValue: DecimalString;
|
|
214
|
+
availableOrderMargin: DecimalString;
|
|
204
215
|
totalInitialMargin: DecimalString;
|
|
205
216
|
totalMaintenanceMargin: DecimalString;
|
|
206
217
|
totalPositionValue: DecimalString;
|
|
207
218
|
}, {
|
|
208
219
|
total_account_value: DecimalString;
|
|
220
|
+
available_order_margin: DecimalString;
|
|
209
221
|
total_initial_margin: DecimalString;
|
|
210
222
|
total_maintenance_margin: DecimalString;
|
|
211
223
|
total_position_value: DecimalString;
|
|
212
224
|
}>>;
|
|
213
225
|
withdrawable: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
214
226
|
in_liquidation: z.ZodBoolean;
|
|
227
|
+
fee_tier: z.ZodNumber;
|
|
215
228
|
timestamp: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
|
|
216
229
|
}, z.core.$strip>, z.ZodTransform<{
|
|
217
230
|
positions: {
|
|
@@ -228,15 +241,20 @@ declare const PerpsPortfolioSchema: z.ZodPipe<z.ZodObject<{
|
|
|
228
241
|
unrealizedPnl: DecimalString;
|
|
229
242
|
returnOnEquity: DecimalString;
|
|
230
243
|
cumulativeFunding: DecimalString;
|
|
244
|
+
/** Auto-deleveraging risk tier; higher values indicate higher risk. */
|
|
245
|
+
adlIndex: 0 | 1 | 2 | 3;
|
|
231
246
|
}[];
|
|
232
247
|
margin: {
|
|
233
248
|
totalAccountValue: DecimalString;
|
|
249
|
+
availableOrderMargin: DecimalString;
|
|
234
250
|
totalInitialMargin: DecimalString;
|
|
235
251
|
totalMaintenanceMargin: DecimalString;
|
|
236
252
|
totalPositionValue: DecimalString;
|
|
237
253
|
};
|
|
238
254
|
withdrawable: DecimalString;
|
|
239
255
|
inLiquidation: boolean;
|
|
256
|
+
/** Zero-based index into the perpetual fee schedule's tiers. */
|
|
257
|
+
feeTier: number;
|
|
240
258
|
timestamp: EpochMilliseconds;
|
|
241
259
|
}, {
|
|
242
260
|
positions: {
|
|
@@ -253,15 +271,19 @@ declare const PerpsPortfolioSchema: z.ZodPipe<z.ZodObject<{
|
|
|
253
271
|
unrealizedPnl: DecimalString;
|
|
254
272
|
returnOnEquity: DecimalString;
|
|
255
273
|
cumulativeFunding: DecimalString;
|
|
274
|
+
/** Auto-deleveraging risk tier; higher values indicate higher risk. */
|
|
275
|
+
adlIndex: 0 | 1 | 2 | 3;
|
|
256
276
|
}[];
|
|
257
277
|
margin: {
|
|
258
278
|
totalAccountValue: DecimalString;
|
|
279
|
+
availableOrderMargin: DecimalString;
|
|
259
280
|
totalInitialMargin: DecimalString;
|
|
260
281
|
totalMaintenanceMargin: DecimalString;
|
|
261
282
|
totalPositionValue: DecimalString;
|
|
262
283
|
};
|
|
263
284
|
withdrawable: DecimalString;
|
|
264
285
|
in_liquidation: boolean;
|
|
286
|
+
fee_tier: number;
|
|
265
287
|
timestamp: EpochMilliseconds;
|
|
266
288
|
}>>;
|
|
267
289
|
/**
|
|
@@ -286,6 +308,7 @@ declare const FetchPerpsPortfolioResponseSchema: z.ZodPipe<z.ZodObject<{
|
|
|
286
308
|
unrealized_pnl: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
287
309
|
return_on_equity: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
288
310
|
cumulative_funding: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
311
|
+
adl_index: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
|
|
289
312
|
}, z.core.$strip>, z.ZodTransform<{
|
|
290
313
|
instrumentId: PerpsInstrumentId;
|
|
291
314
|
symbol: string;
|
|
@@ -300,6 +323,8 @@ declare const FetchPerpsPortfolioResponseSchema: z.ZodPipe<z.ZodObject<{
|
|
|
300
323
|
unrealizedPnl: DecimalString;
|
|
301
324
|
returnOnEquity: DecimalString;
|
|
302
325
|
cumulativeFunding: DecimalString;
|
|
326
|
+
/** Auto-deleveraging risk tier; higher values indicate higher risk. */
|
|
327
|
+
adlIndex: 0 | 1 | 2 | 3;
|
|
303
328
|
}, {
|
|
304
329
|
instrument_id: PerpsInstrumentId;
|
|
305
330
|
symbol: string;
|
|
@@ -314,25 +339,30 @@ declare const FetchPerpsPortfolioResponseSchema: z.ZodPipe<z.ZodObject<{
|
|
|
314
339
|
unrealized_pnl: DecimalString;
|
|
315
340
|
return_on_equity: DecimalString;
|
|
316
341
|
cumulative_funding: DecimalString;
|
|
342
|
+
adl_index: 0 | 1 | 2 | 3;
|
|
317
343
|
}>>>;
|
|
318
344
|
margin: z.ZodPipe<z.ZodObject<{
|
|
319
345
|
total_account_value: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
346
|
+
available_order_margin: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
320
347
|
total_initial_margin: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
321
348
|
total_maintenance_margin: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
322
349
|
total_position_value: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
323
350
|
}, z.core.$strip>, z.ZodTransform<{
|
|
324
351
|
totalAccountValue: DecimalString;
|
|
352
|
+
availableOrderMargin: DecimalString;
|
|
325
353
|
totalInitialMargin: DecimalString;
|
|
326
354
|
totalMaintenanceMargin: DecimalString;
|
|
327
355
|
totalPositionValue: DecimalString;
|
|
328
356
|
}, {
|
|
329
357
|
total_account_value: DecimalString;
|
|
358
|
+
available_order_margin: DecimalString;
|
|
330
359
|
total_initial_margin: DecimalString;
|
|
331
360
|
total_maintenance_margin: DecimalString;
|
|
332
361
|
total_position_value: DecimalString;
|
|
333
362
|
}>>;
|
|
334
363
|
withdrawable: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
335
364
|
in_liquidation: z.ZodBoolean;
|
|
365
|
+
fee_tier: z.ZodNumber;
|
|
336
366
|
timestamp: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
|
|
337
367
|
}, z.core.$strip>, z.ZodTransform<{
|
|
338
368
|
positions: {
|
|
@@ -349,15 +379,20 @@ declare const FetchPerpsPortfolioResponseSchema: z.ZodPipe<z.ZodObject<{
|
|
|
349
379
|
unrealizedPnl: DecimalString;
|
|
350
380
|
returnOnEquity: DecimalString;
|
|
351
381
|
cumulativeFunding: DecimalString;
|
|
382
|
+
/** Auto-deleveraging risk tier; higher values indicate higher risk. */
|
|
383
|
+
adlIndex: 0 | 1 | 2 | 3;
|
|
352
384
|
}[];
|
|
353
385
|
margin: {
|
|
354
386
|
totalAccountValue: DecimalString;
|
|
387
|
+
availableOrderMargin: DecimalString;
|
|
355
388
|
totalInitialMargin: DecimalString;
|
|
356
389
|
totalMaintenanceMargin: DecimalString;
|
|
357
390
|
totalPositionValue: DecimalString;
|
|
358
391
|
};
|
|
359
392
|
withdrawable: DecimalString;
|
|
360
393
|
inLiquidation: boolean;
|
|
394
|
+
/** Zero-based index into the perpetual fee schedule's tiers. */
|
|
395
|
+
feeTier: number;
|
|
361
396
|
timestamp: EpochMilliseconds;
|
|
362
397
|
}, {
|
|
363
398
|
positions: {
|
|
@@ -374,15 +409,19 @@ declare const FetchPerpsPortfolioResponseSchema: z.ZodPipe<z.ZodObject<{
|
|
|
374
409
|
unrealizedPnl: DecimalString;
|
|
375
410
|
returnOnEquity: DecimalString;
|
|
376
411
|
cumulativeFunding: DecimalString;
|
|
412
|
+
/** Auto-deleveraging risk tier; higher values indicate higher risk. */
|
|
413
|
+
adlIndex: 0 | 1 | 2 | 3;
|
|
377
414
|
}[];
|
|
378
415
|
margin: {
|
|
379
416
|
totalAccountValue: DecimalString;
|
|
417
|
+
availableOrderMargin: DecimalString;
|
|
380
418
|
totalInitialMargin: DecimalString;
|
|
381
419
|
totalMaintenanceMargin: DecimalString;
|
|
382
420
|
totalPositionValue: DecimalString;
|
|
383
421
|
};
|
|
384
422
|
withdrawable: DecimalString;
|
|
385
423
|
in_liquidation: boolean;
|
|
424
|
+
fee_tier: number;
|
|
386
425
|
timestamp: EpochMilliseconds;
|
|
387
426
|
}>>;
|
|
388
427
|
/**
|
|
@@ -1082,6 +1121,11 @@ declare const PerpsInstrumentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
1082
1121
|
lower_bound: DecimalString;
|
|
1083
1122
|
max_leverage: number;
|
|
1084
1123
|
}>>>;
|
|
1124
|
+
ui_live_time: z.ZodNullable<z.ZodPipe<z.ZodNumber, z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>>>;
|
|
1125
|
+
logo: z.ZodOptional<z.ZodObject<{
|
|
1126
|
+
light: z.ZodString;
|
|
1127
|
+
dark: z.ZodString;
|
|
1128
|
+
}, z.core.$strip>>;
|
|
1085
1129
|
}, z.core.$strip>, z.ZodTransform<{
|
|
1086
1130
|
id: PerpsInstrumentId;
|
|
1087
1131
|
category: PerpsInstrumentCategory;
|
|
@@ -1109,6 +1153,13 @@ declare const PerpsInstrumentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
1109
1153
|
lowerBound: DecimalString;
|
|
1110
1154
|
maxLeverage: number;
|
|
1111
1155
|
}[];
|
|
1156
|
+
/** Advisory visibility time; null means hidden. Does not restrict trading. */
|
|
1157
|
+
uiLiveTime: EpochMilliseconds | null;
|
|
1158
|
+
/** Immutable logo URLs for light and dark themes; absent until uploaded. */
|
|
1159
|
+
logo: {
|
|
1160
|
+
light: string;
|
|
1161
|
+
dark: string;
|
|
1162
|
+
} | undefined;
|
|
1112
1163
|
}, {
|
|
1113
1164
|
instrument_id: PerpsInstrumentId;
|
|
1114
1165
|
instrument_type: PerpsInstrumentType.Perpetual;
|
|
@@ -1132,8 +1183,13 @@ declare const PerpsInstrumentSchema: z.ZodPipe<z.ZodObject<{
|
|
|
1132
1183
|
lowerBound: DecimalString;
|
|
1133
1184
|
maxLeverage: number;
|
|
1134
1185
|
}[];
|
|
1186
|
+
ui_live_time: EpochMilliseconds | null;
|
|
1135
1187
|
display_symbol?: string | undefined;
|
|
1136
1188
|
settlement?: PerpsInstrumentSettlement | undefined;
|
|
1189
|
+
logo?: {
|
|
1190
|
+
light: string;
|
|
1191
|
+
dark: string;
|
|
1192
|
+
} | undefined;
|
|
1137
1193
|
}>>;
|
|
1138
1194
|
/**
|
|
1139
1195
|
* @experimental This API may change in a breaking way in any release, including patch releases.
|
|
@@ -1183,6 +1239,11 @@ declare const FetchPerpsInstrumentsResponseSchema: z.ZodArray<z.ZodPipe<z.ZodObj
|
|
|
1183
1239
|
lower_bound: DecimalString;
|
|
1184
1240
|
max_leverage: number;
|
|
1185
1241
|
}>>>;
|
|
1242
|
+
ui_live_time: z.ZodNullable<z.ZodPipe<z.ZodNumber, z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>>>;
|
|
1243
|
+
logo: z.ZodOptional<z.ZodObject<{
|
|
1244
|
+
light: z.ZodString;
|
|
1245
|
+
dark: z.ZodString;
|
|
1246
|
+
}, z.core.$strip>>;
|
|
1186
1247
|
}, z.core.$strip>, z.ZodTransform<{
|
|
1187
1248
|
id: PerpsInstrumentId;
|
|
1188
1249
|
category: PerpsInstrumentCategory;
|
|
@@ -1210,6 +1271,13 @@ declare const FetchPerpsInstrumentsResponseSchema: z.ZodArray<z.ZodPipe<z.ZodObj
|
|
|
1210
1271
|
lowerBound: DecimalString;
|
|
1211
1272
|
maxLeverage: number;
|
|
1212
1273
|
}[];
|
|
1274
|
+
/** Advisory visibility time; null means hidden. Does not restrict trading. */
|
|
1275
|
+
uiLiveTime: EpochMilliseconds | null;
|
|
1276
|
+
/** Immutable logo URLs for light and dark themes; absent until uploaded. */
|
|
1277
|
+
logo: {
|
|
1278
|
+
light: string;
|
|
1279
|
+
dark: string;
|
|
1280
|
+
} | undefined;
|
|
1213
1281
|
}, {
|
|
1214
1282
|
instrument_id: PerpsInstrumentId;
|
|
1215
1283
|
instrument_type: PerpsInstrumentType.Perpetual;
|
|
@@ -1233,8 +1301,13 @@ declare const FetchPerpsInstrumentsResponseSchema: z.ZodArray<z.ZodPipe<z.ZodObj
|
|
|
1233
1301
|
lowerBound: DecimalString;
|
|
1234
1302
|
maxLeverage: number;
|
|
1235
1303
|
}[];
|
|
1304
|
+
ui_live_time: EpochMilliseconds | null;
|
|
1236
1305
|
display_symbol?: string | undefined;
|
|
1237
1306
|
settlement?: PerpsInstrumentSettlement | undefined;
|
|
1307
|
+
logo?: {
|
|
1308
|
+
light: string;
|
|
1309
|
+
dark: string;
|
|
1310
|
+
} | undefined;
|
|
1238
1311
|
}>>>;
|
|
1239
1312
|
/**
|
|
1240
1313
|
* @experimental This API may change in a breaking way in any release, including patch releases.
|
package/dist/perps/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {o,a,b as b$1,c}from'../chunk-
|
|
1
|
+
import {o,a,b as b$1,c}from'../chunk-ZMJTXTXA.js';export{za as CreatePerpsChaseResponseSchema,ca as FetchPerpsAccountConfigResponseSchema,V as FetchPerpsAccountStatsResponseSchema,T as FetchPerpsBalancesResponseSchema,oa as FetchPerpsBuilderApprovalsResponseSchema,hb as FetchPerpsCandlesResponseSchema,ya as FetchPerpsChasesResponseSchema,gb as FetchPerpsFeesResponseSchema,cb as FetchPerpsFundingHistoryResponseSchema,Na as FetchPerpsInstrumentsResponseSchema,Ob as FetchPerpsOpenOrdersResponseSchema,Nb as FetchPerpsOrdersResponseSchema,Z as FetchPerpsPortfolioResponseSchema,Ta as FetchPerpsStatisticsResponseSchema,Pa as FetchPerpsTickersResponseSchema,ab as FetchPerpsTradesResponseSchema,xb as FetchPerpsUnreadNotificationsCountResponseSchema,sa as ListPerpsBuilderEarningsResponseSchema,Ba as ListPerpsDepositsResponseSchema,ea as ListPerpsEquityHistoryResponseSchema,Tb as ListPerpsFillsResponseSchema,$ as ListPerpsFundingPaymentsResponseSchema,Ia as ListPerpsInternalTransfersResponseSchema,wb as ListPerpsNotificationsResponseSchema,ga as ListPerpsPnlHistoryResponseSchema,Ea as ListPerpsWithdrawalsResponseSchema,yb as MarkPerpsNotificationsReadResponseSchema,ba as PerpsAccountConfigSchema,Sb as PerpsAccountFillSchema,Ub as PerpsAccountFillUpdateSchema,aa as PerpsAccountFundingPaymentEntrySchema,_ as PerpsAccountFundingPaymentSchema,U as PerpsAccountStatsSchema,M as PerpsAssetSchema,S as PerpsBalanceSchema,Ya as PerpsBboSchema,Za as PerpsBboUpdateSchema,Va as PerpsBookLevelSchema,Wa as PerpsBookSchema,Xa as PerpsBookUpdateSchema,na as PerpsBuilderApprovalSchema,e as PerpsBuilderEarningIdSchema,qa as PerpsBuilderEarningSchema,ta as PerpsBuilderEarningsAssetSchema,ra as PerpsBuilderEarningsSnapshotSchema,ua as PerpsBuilderEarningsSummarySchema,ma as PerpsBuilderStatusSchema,la as PerpsBuilderTermsSchema,Ib as PerpsCancelAllOrdersResponseSchema,Eb as PerpsCancelOrderErrorCodeSchema,Hb as PerpsCancelOrderResultSchema,Ra as PerpsCandleSchema,xa as PerpsChaseAcceptedSchema,va as PerpsChaseIdSchema,wa as PerpsChaseSchema,c as PerpsClientOrderIdSchema,Fb as PerpsCommandAckSchema,Cb as PerpsCommandStatusSchema,ja as PerpsCreateProxyResponseSchema,ia as PerpsCredentialsResponseSchema,O as PerpsDataResponseSchema,l as PerpsDecimalInputSchema,ka as PerpsDeleteProxyResponseSchema,Aa as PerpsDepositSchema,s as PerpsDepositStatus,F as PerpsDepositStatusSchema,Ca as PerpsDepositUpdateSchema,j as PerpsEntityIdSchema,da as PerpsEquityPointSchema,eb as PerpsFeeScheduleEntrySchema,db as PerpsFeeTierSchema,fb as PerpsFeesInfoSchema,k as PerpsFundingIntervalSchema,g as PerpsFundingPaymentIdSchema,bb as PerpsFundingRateSchema,n as PerpsInstrumentCategory,A as PerpsInstrumentCategorySchema,a as PerpsInstrumentIdSchema,Ma as PerpsInstrumentSchema,La as PerpsInstrumentSettlementSchema,m as PerpsInstrumentType,z as PerpsInstrumentTypeSchema,v as PerpsInternalTransferDirection,I as PerpsInternalTransferDirectionSchema,i as PerpsInternalTransferIdSchema,Ja as PerpsInternalTransferResponseSchema,Ha as PerpsInternalTransferSchema,H as PerpsInternalTransferTypeSchema,w as PerpsKlineInterval,J as PerpsKlineIntervalSchema,Db as PerpsKnownCancelOrderErrorCode,u as PerpsKnownInternalTransferType,t as PerpsKnownWithdrawalStatus,qb as PerpsLimitOrderCanceledNotificationSchema,Rb as PerpsLiquidationDetailsSchema,Qb as PerpsLiquidationMethod,rb as PerpsLiquidationWarningNotificationSchema,pa as PerpsLiquidityRole,X as PerpsMarginSummarySchema,mb as PerpsMarginType,nb as PerpsMarginTypeSchema,vb as PerpsNotificationEntrySchema,d as PerpsNotificationIdSchema,kb as PerpsNotificationOrderType,lb as PerpsNotificationOrderTypeSchema,ub as PerpsNotificationSchema,ib as PerpsNotificationType,jb as PerpsNotificationTypeSchema,b as PerpsOrderIdSchema,Mb as PerpsOrderSchema,zb as PerpsOrderStatus,Bb as PerpsOrderStatusSchema,Pb as PerpsOrderUpdateSchema,x as PerpsPnlInterval,K as PerpsPnlIntervalSchema,fa as PerpsPnlPointSchema,W as PerpsPortfolioPositionSchema,Y as PerpsPortfolioSchema,ob as PerpsPositionChangeNotificationSchema,pb as PerpsPositionClosedNotificationSchema,tb as PerpsPositionDeleveragedNotificationSchema,sb as PerpsPositionLiquidatedNotificationSchema,Gb as PerpsPostOrderAckSchema,ha as PerpsProxyKeySchema,_a as PerpsPublicTradeSchema,$a as PerpsPublicTradeUpdateSchema,Ka as PerpsRiskTierSchema,o as PerpsSide,B as PerpsSideSchema,y as PerpsSortDirection,L as PerpsSortDirectionSchema,Sa as PerpsStatisticSchema,Ua as PerpsStatisticUpdateSchema,Qa as PerpsTickerEntrySchema,Oa as PerpsTickerSchema,p as PerpsTimeInForce,C as PerpsTimeInForceSchema,q as PerpsTpSlKind,D as PerpsTpSlKindSchema,Ab as PerpsTpSlOrderFieldsSchema,r as PerpsTpSlScope,E as PerpsTpSlScopeSchema,f as PerpsTradeIdSchema,N as PerpsTxHashSchema,Lb as PerpsUpdateLeverageBatchResultSchema,Kb as PerpsUpdateLeverageRejectionSchema,Jb as PerpsUpdateLeverageResultSchema,Fa as PerpsWithdrawResponseSchema,h as PerpsWithdrawalIdSchema,Da as PerpsWithdrawalSchema,G as PerpsWithdrawalStatusSchema,Ga as PerpsWithdrawalUpdateSchema,R as decimalString,Q as perpsBaseUnits,P as perpsDecimal}from'../chunk-ZMJTXTXA.js';import {v as v$1,ea,Pa}from'../chunk-JPPG656Y.js';import {z as z$1}from'zod';var h=z$1.number().int().transform(e=>e===0?null:v$1(e)),Ir=z$1.object({status:z$1.literal("ok"),deadline:h}),I=z$1.object({deadline:h,triggered:z$1.number().int().nonnegative(),daily_limit:z$1.number().int().nonnegative(),next_reset:ea}).transform(e=>({deadline:e.deadline,triggered:e.triggered,dailyLimit:e.daily_limit,nextReset:e.next_reset})),vr=I;var P=(i=>(i.Ok="ok",i.NotFound="not_found",i.HistoryPending="history_pending",i.HistoryLimit="history_limit",i.ResourceLimit="resource_limit",i.TemporarilyUnavailable="temporarily_unavailable",i.Unavailable="unavailable",i))(P||{}),y=(a=>(a.Increase="increase",a.Decrease="decrease",a))(y||{}),v=z$1.object({position:z$1.number(),open:z$1.number(),high:z$1.number(),low:z$1.number(),close:z$1.number()}),A=z$1.object({position:z$1.number(),kind:z$1.enum(y)}),C=z$1.object({candles:z$1.array(v).max(22),markers:z$1.array(A).max(256)}),R=z$1.object({position_cycle_id:z$1.string(),side:z$1.enum(o),started_at:ea,as_of_at:ea,is_closed:z$1.boolean(),size_after:Pa,entry_price:Pa,as_of_price:Pa,pnl:Pa,pnl_percent:Pa.nullable(),leverage:z$1.number().int().nonnegative().nullable(),chart:C}).transform(e=>({positionCycleId:e.position_cycle_id,side:e.side,startedAt:e.started_at,asOfAt:e.as_of_at,isClosed:e.is_closed,sizeAfter:e.size_after,entryPrice:e.entry_price,asOfPrice:e.as_of_price,pnl:e.pnl,pnlPercent:e.pnl_percent,leverage:e.leverage,chart:e.chart})),z=z$1.string().regex(/^(0|[1-9][0-9]{0,19})$/).refine(e=>/^[0-9]{1,20}$/.test(e)&&BigInt(e)<=18446744073709551615n),x=z$1.object({instrument_id:a,trade_id:z.optional()}),S=z$1.discriminatedUnion("status",[x.extend({status:z$1.literal("ok"),snapshot:R}),x.extend({status:z$1.enum(P).exclude(["Ok"]),snapshot:z$1.never().optional()})]).transform(e=>{let c={instrumentId:e.instrument_id,...e.trade_id===void 0?{}:{tradeId:e.trade_id}};return e.status==="ok"?{...c,status:e.status,snapshot:e.snapshot}:{...c,status:e.status}}),w=S.transform((e,c)=>e.tradeId===void 0?(c.addIssue({code:"custom",message:"Historical snapshot requires trade_id"}),z$1.NEVER):{...e,tradeId:e.tradeId}),wr=z$1.object({history_as_of_at:ea,active:z$1.array(S),history:z$1.array(w)}).transform(e=>({historyAsOfAt:e.history_as_of_at,active:e.active,history:e.history}));var jr=z$1.object({registered:z$1.boolean()}).transform(e=>e.registered);var b=z$1.number().int().positive().max(Number.MAX_SAFE_INTEGER).transform(e=>e),g=(a=>(a.Running="running",a.Paused="paused",a))(g||{}),p=z$1.string().regex(/^\d+(?:\.\d+)?$/).pipe(Pa),O=z$1.object({twid:b,iid:a,buy:z$1.boolean(),qty:p,fill:p,dur:z$1.number().int().positive(),ivl:z$1.number().int().positive(),rnd:z$1.boolean(),slip_bps:z$1.number().int().min(0).max(1e4),min_px:p,max_px:p,ro:z$1.boolean(),st:z$1.enum(g),slices:z$1.number().int().nonnegative(),slice_count:z$1.number().int().positive(),sts:ea,ets:ea,cts:ea,avg_px:p.optional(),coid:c.optional(),oid:b$1.optional()}).transform(e=>({twapId:e.twid,instrumentId:e.iid,side:e.buy?"BUY":"SELL",quantity:e.qty,filledQuantity:e.fill,durationMs:e.dur,intervalMs:e.ivl,randomize:e.rnd,slippageBps:e.slip_bps,minPrice:e.min_px,maxPrice:e.max_px,reduceOnly:e.ro,status:e.st,slices:e.slices,sliceCount:e.slice_count,startedAt:e.sts,endsAt:e.ets,createdAt:e.cts,...e.avg_px===void 0?{}:{averagePrice:e.avg_px},...e.coid===void 0?{}:{clientOrderId:e.coid},...e.oid===void 0?{}:{orderId:e.oid}})),T=z$1.object({status:z$1.literal("ok"),twid:b,ts:ea}).transform(e=>({twapId:e.twid,timestamp:e.ts})),Lr=z$1.array(O),qr=z$1.union([T,z$1.object({status:z$1.literal("err"),error:z$1.string().min(1)})]);export{qr as CreatePerpsTwapResponseSchema,vr as FetchPerpsAutoCancelStatusResponseSchema,Lr as FetchPerpsTwapsResponseSchema,Ir as PerpsAutoCancelResponseSchema,I as PerpsAutoCancelStatusSchema,v as PerpsPositionSnapshotCandleSchema,C as PerpsPositionSnapshotChartSchema,y as PerpsPositionSnapshotMarkerKind,A as PerpsPositionSnapshotMarkerSchema,R as PerpsPositionSnapshotSchema,P as PerpsPositionSnapshotStatus,wr as PerpsPositionSnapshotsSchema,jr as PerpsRegistrationResponseSchema,T as PerpsTwapAcceptedSchema,b as PerpsTwapIdSchema,O as PerpsTwapSchema,g as PerpsTwapStatus};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/perps/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/perps/auto-cancel.ts","../../src/perps/position-snapshots.ts","../../src/perps/registration.ts","../../src/perps/twaps.ts"],"names":["AutoCancelDeadlineSchema","z","value","toEpochMilliseconds","PerpsAutoCancelResponseSchema","PerpsAutoCancelStatusSchema","EpochMillisecondsSchema","status","FetchPerpsAutoCancelStatusResponseSchema","PerpsPositionSnapshotStatus","PerpsPositionSnapshotMarkerKind","PerpsPositionSnapshotCandleSchema","PerpsPositionSnapshotMarkerSchema","PerpsPositionSnapshotChartSchema","PerpsPositionSnapshotSchema","PerpsSide","DecimalStringSchema","snapshot","TradeIdSchema","IdentitySchema","PerpsInstrumentIdSchema","ResultSchema","item","identity","HistoryResultSchema","ctx","PerpsPositionSnapshotsSchema","response","PerpsRegistrationResponseSchema","PerpsTwapIdSchema","PerpsTwapStatus","DecimalSchema","PerpsTwapSchema","PerpsClientOrderIdSchema","PerpsOrderIdSchema","run","PerpsTwapAcceptedSchema","accepted","FetchPerpsTwapsResponseSchema","CreatePerpsTwapResponseSchema"],"mappings":"6gKAIMA,CAAAA,CAA2BC,GAAAA,CAC9B,QAAO,CACP,GAAA,GACA,SAAA,CAAWC,CAAAA,EAAWA,IAAU,CAAA,CAAI,IAAA,CAAOC,EAAoBD,CAAK,CAAE,EAS5DE,EAAAA,CAAgCH,GAAAA,CAAE,MAAA,CAAO,CACpD,OAAQA,GAAAA,CAAE,OAAA,CAAQ,IAAI,CAAA,CACtB,QAAA,CAAUD,CACZ,CAAC,CAAA,CAeYK,EAA8BJ,GAAAA,CACxC,MAAA,CAAO,CACN,QAAA,CAAUD,CAAAA,CACV,UAAWC,GAAAA,CAAE,MAAA,GAAS,GAAA,EAAI,CAAE,WAAA,EAAY,CACxC,YAAaA,GAAAA,CAAE,MAAA,GAAS,GAAA,EAAI,CAAE,aAAY,CAC1C,UAAA,CAAYK,EACd,CAAC,CAAA,CACA,UAAWC,CAAAA,GAAY,CACtB,SAAUA,CAAAA,CAAO,QAAA,CACjB,UAAWA,CAAAA,CAAO,SAAA,CAClB,WAAYA,CAAAA,CAAO,WAAA,CACnB,UAAWA,CAAAA,CAAO,UACpB,EAAE,CAAA,CAUSC,EAAAA,CACXH,EChDK,IAAKI,OACVA,CAAAA,CAAA,EAAA,CAAK,KACLA,CAAAA,CAAA,QAAA,CAAW,YACXA,CAAAA,CAAA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AA,CACAnC,GAAAA,CAAE,OAAO,CAAE,MAAA,CAAQA,IAAE,OAAA,CAAQ,KAAK,EAAG,KAAA,CAAOA,GAAAA,CAAE,QAAO,CAAE,GAAA,CAAI,CAAC,CAAE,CAAC,CACjE,CAAC","file":"index.js","sourcesContent":["import { z } from 'zod';\nimport { EpochMillisecondsSchema, toEpochMilliseconds } from '../shared';\n\n// The API reports an unarmed schedule as `deadline: 0`.\nconst AutoCancelDeadlineSchema = z\n .number()\n .int()\n .transform((value) => (value === 0 ? null : toEpochMilliseconds(value)));\n\n/**\n * Acknowledgement for a Perps auto-cancel update. `deadline` echoes the armed\n * cancellation time in Unix milliseconds, or `null` when the schedule was\n * disarmed.\n *\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const PerpsAutoCancelResponseSchema = z.object({\n status: z.literal('ok'),\n deadline: AutoCancelDeadlineSchema,\n});\n\n/**\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport type PerpsAutoCancelResponse = z.infer<\n typeof PerpsAutoCancelResponseSchema\n>;\n\n/**\n * Current auto-cancel state for an account. `deadline` is `null` when no\n * schedule is armed.\n *\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const PerpsAutoCancelStatusSchema = z\n .object({\n deadline: AutoCancelDeadlineSchema,\n triggered: z.number().int().nonnegative(),\n daily_limit: z.number().int().nonnegative(),\n next_reset: EpochMillisecondsSchema,\n })\n .transform((status) => ({\n deadline: status.deadline,\n triggered: status.triggered,\n dailyLimit: status.daily_limit,\n nextReset: status.next_reset,\n }));\n\n/**\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport type PerpsAutoCancelStatus = z.infer<typeof PerpsAutoCancelStatusSchema>;\n\n/**\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const FetchPerpsAutoCancelStatusResponseSchema =\n PerpsAutoCancelStatusSchema;\n","import { z } from 'zod';\nimport { DecimalStringSchema, EpochMillisecondsSchema } from '../shared';\nimport {\n type PerpsInstrumentId,\n PerpsInstrumentIdSchema,\n PerpsSide,\n} from './common';\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport enum PerpsPositionSnapshotStatus {\n Ok = 'ok',\n NotFound = 'not_found',\n HistoryPending = 'history_pending',\n HistoryLimit = 'history_limit',\n ResourceLimit = 'resource_limit',\n TemporarilyUnavailable = 'temporarily_unavailable',\n Unavailable = 'unavailable',\n}\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport enum PerpsPositionSnapshotMarkerKind {\n Increase = 'increase',\n Decrease = 'decrease',\n}\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotCandleSchema = z.object({\n position: z.number(),\n open: z.number(),\n high: z.number(),\n low: z.number(),\n close: z.number(),\n});\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshotCandle = z.infer<\n typeof PerpsPositionSnapshotCandleSchema\n>;\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotMarkerSchema = z.object({\n position: z.number(),\n kind: z.enum(PerpsPositionSnapshotMarkerKind),\n});\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshotMarker = z.infer<\n typeof PerpsPositionSnapshotMarkerSchema\n>;\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotChartSchema = z.object({\n candles: z.array(PerpsPositionSnapshotCandleSchema).max(22),\n markers: z.array(PerpsPositionSnapshotMarkerSchema).max(256),\n});\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshotChart = z.infer<\n typeof PerpsPositionSnapshotChartSchema\n>;\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotSchema = z\n .object({\n position_cycle_id: z.string(),\n side: z.enum(PerpsSide),\n started_at: EpochMillisecondsSchema,\n as_of_at: EpochMillisecondsSchema,\n is_closed: z.boolean(),\n size_after: DecimalStringSchema,\n entry_price: DecimalStringSchema,\n as_of_price: DecimalStringSchema,\n pnl: DecimalStringSchema,\n pnl_percent: DecimalStringSchema.nullable(),\n leverage: z.number().int().nonnegative().nullable(),\n chart: PerpsPositionSnapshotChartSchema,\n })\n .transform((snapshot) => ({\n positionCycleId: snapshot.position_cycle_id,\n side: snapshot.side,\n startedAt: snapshot.started_at,\n asOfAt: snapshot.as_of_at,\n isClosed: snapshot.is_closed,\n sizeAfter: snapshot.size_after,\n entryPrice: snapshot.entry_price,\n asOfPrice: snapshot.as_of_price,\n pnl: snapshot.pnl,\n pnlPercent: snapshot.pnl_percent,\n leverage: snapshot.leverage,\n chart: snapshot.chart,\n }));\n/** A position cycle valued at captured state or immediately after a selected fill.\n * @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshot = z.infer<typeof PerpsPositionSnapshotSchema>;\n\nconst TradeIdSchema = z\n .string()\n .regex(/^(0|[1-9][0-9]{0,19})$/)\n .refine(\n (value) =>\n /^[0-9]{1,20}$/.test(value) && BigInt(value) <= 18446744073709551615n,\n );\nconst IdentitySchema = z.object({\n instrument_id: PerpsInstrumentIdSchema,\n trade_id: TradeIdSchema.optional(),\n});\nconst ResultSchema = z\n .discriminatedUnion('status', [\n IdentitySchema.extend({\n status: z.literal(PerpsPositionSnapshotStatus.Ok),\n snapshot: PerpsPositionSnapshotSchema,\n }),\n IdentitySchema.extend({\n status: z.enum(PerpsPositionSnapshotStatus).exclude(['Ok']),\n snapshot: z.never().optional(),\n }),\n ])\n .transform((item): PerpsPositionSnapshotResult => {\n const identity = {\n instrumentId: item.instrument_id,\n ...(item.trade_id === undefined ? {} : { tradeId: item.trade_id }),\n };\n return item.status === PerpsPositionSnapshotStatus.Ok\n ? { ...identity, status: item.status, snapshot: item.snapshot }\n : { ...identity, status: item.status };\n });\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshotResult =\n | {\n instrumentId: PerpsInstrumentId;\n tradeId?: string;\n status: PerpsPositionSnapshotStatus.Ok;\n snapshot: PerpsPositionSnapshot;\n }\n | {\n instrumentId: PerpsInstrumentId;\n tradeId?: string;\n status: Exclude<\n PerpsPositionSnapshotStatus,\n PerpsPositionSnapshotStatus.Ok\n >;\n };\nconst HistoryResultSchema = ResultSchema.transform((item, ctx) => {\n if (item.tradeId === undefined) {\n ctx.addIssue({\n code: 'custom',\n message: 'Historical snapshot requires trade_id',\n });\n return z.NEVER;\n }\n return { ...item, tradeId: item.tradeId };\n});\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsHistoricalPositionSnapshotResult = z.infer<\n typeof HistoryResultSchema\n>;\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotsSchema = z\n .object({\n history_as_of_at: EpochMillisecondsSchema,\n active: z.array(ResultSchema),\n history: z.array(HistoryResultSchema),\n })\n .transform((response) => ({\n historyAsOfAt: response.history_as_of_at,\n active: response.active,\n history: response.history,\n }));\n/** Ordered selections and the completed-history horizon. No pagination.\n * @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshots = z.infer<\n typeof PerpsPositionSnapshotsSchema\n>;\n","import { z } from 'zod';\n\n/**\n * Parses whether an address has a Perps account.\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const PerpsRegistrationResponseSchema = z\n .object({ registered: z.boolean() })\n .transform((response) => response.registered);\n","import { z } from 'zod';\nimport {\n DecimalStringSchema,\n EpochMillisecondsSchema,\n OrderSide,\n} from '../shared';\nimport {\n PerpsClientOrderIdSchema,\n PerpsInstrumentIdSchema,\n PerpsOrderIdSchema,\n} from './common';\n\n/** Opaque run identity.\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport type PerpsTwapId = number & { readonly __tag: 'PerpsTwapId' };\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsTwapIdSchema = z\n .number()\n .int()\n .positive()\n .max(Number.MAX_SAFE_INTEGER)\n .transform((value) => value as PerpsTwapId);\n/** Active runs only; ended runs are absent from the active collection.\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport enum PerpsTwapStatus {\n Running = 'running',\n Paused = 'paused',\n}\nconst DecimalSchema = z\n .string()\n .regex(/^\\d+(?:\\.\\d+)?$/)\n .pipe(DecimalStringSchema);\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsTwapSchema = z\n .object({\n twid: PerpsTwapIdSchema,\n iid: PerpsInstrumentIdSchema,\n buy: z.boolean(),\n qty: DecimalSchema,\n fill: DecimalSchema,\n dur: z.number().int().positive(),\n ivl: z.number().int().positive(),\n rnd: z.boolean(),\n slip_bps: z.number().int().min(0).max(10000),\n min_px: DecimalSchema,\n max_px: DecimalSchema,\n ro: z.boolean(),\n st: z.enum(PerpsTwapStatus),\n slices: z.number().int().nonnegative(),\n slice_count: z.number().int().positive(),\n sts: EpochMillisecondsSchema,\n ets: EpochMillisecondsSchema,\n cts: EpochMillisecondsSchema,\n avg_px: DecimalSchema.optional(),\n coid: PerpsClientOrderIdSchema.optional(),\n oid: PerpsOrderIdSchema.optional(),\n })\n .transform((run) => ({\n twapId: run.twid,\n instrumentId: run.iid,\n side: run.buy ? OrderSide.BUY : OrderSide.SELL,\n quantity: run.qty,\n filledQuantity: run.fill,\n durationMs: run.dur,\n intervalMs: run.ivl,\n randomize: run.rnd,\n slippageBps: run.slip_bps,\n minPrice: run.min_px,\n maxPrice: run.max_px,\n reduceOnly: run.ro,\n status: run.st,\n slices: run.slices,\n sliceCount: run.slice_count,\n startedAt: run.sts,\n endsAt: run.ets,\n createdAt: run.cts,\n ...(run.avg_px === undefined ? {} : { averagePrice: run.avg_px }),\n ...(run.coid === undefined ? {} : { clientOrderId: run.coid }),\n ...(run.oid === undefined ? {} : { orderId: run.oid }),\n }));\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsTwap = z.infer<typeof PerpsTwapSchema>;\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsTwapAcceptedSchema = z\n .object({\n status: z.literal('ok'),\n twid: PerpsTwapIdSchema,\n ts: EpochMillisecondsSchema,\n })\n .transform((accepted) => ({ twapId: accepted.twid, timestamp: accepted.ts }));\n/** Acceptance does not guarantee all scheduled quantity will fill.\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport type PerpsTwapAccepted = z.infer<typeof PerpsTwapAcceptedSchema>;\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const FetchPerpsTwapsResponseSchema = z.array(PerpsTwapSchema);\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const CreatePerpsTwapResponseSchema = z.union([\n PerpsTwapAcceptedSchema,\n z.object({ status: z.literal('err'), error: z.string().min(1) }),\n]);\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/perps/auto-cancel.ts","../../src/perps/position-snapshots.ts","../../src/perps/registration.ts","../../src/perps/twaps.ts"],"names":["AutoCancelDeadlineSchema","z","value","toEpochMilliseconds","PerpsAutoCancelResponseSchema","PerpsAutoCancelStatusSchema","EpochMillisecondsSchema","status","FetchPerpsAutoCancelStatusResponseSchema","PerpsPositionSnapshotStatus","PerpsPositionSnapshotMarkerKind","PerpsPositionSnapshotCandleSchema","PerpsPositionSnapshotMarkerSchema","PerpsPositionSnapshotChartSchema","PerpsPositionSnapshotSchema","PerpsSide","DecimalStringSchema","snapshot","TradeIdSchema","IdentitySchema","PerpsInstrumentIdSchema","ResultSchema","item","identity","HistoryResultSchema","ctx","PerpsPositionSnapshotsSchema","response","PerpsRegistrationResponseSchema","PerpsTwapIdSchema","PerpsTwapStatus","DecimalSchema","PerpsTwapSchema","PerpsClientOrderIdSchema","PerpsOrderIdSchema","run","PerpsTwapAcceptedSchema","accepted","FetchPerpsTwapsResponseSchema","CreatePerpsTwapResponseSchema"],"mappings":"qlKAIMA,CAAAA,CAA2BC,GAAAA,CAC9B,QAAO,CACP,GAAA,GACA,SAAA,CAAWC,CAAAA,EAAWA,IAAU,CAAA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CAAI,GAAA,CACZ,SAAA,CAAWA,EAAI,GAAA,CACf,GAAIA,EAAI,MAAA,GAAW,MAAA,CAAY,EAAC,CAAI,CAAE,aAAcA,CAAAA,CAAI,MAAO,EAC/D,GAAIA,CAAAA,CAAI,OAAS,MAAA,CAAY,GAAK,CAAE,aAAA,CAAeA,EAAI,IAAK,CAAA,CAC5D,GAAIA,CAAAA,CAAI,GAAA,GAAQ,OAAY,EAAC,CAAI,CAAE,OAAA,CAASA,CAAAA,CAAI,GAAI,CACtD,CAAA,CAAE,EAISC,CAAAA,CAA0BnC,GAAAA,CACpC,OAAO,CACN,MAAA,CAAQA,IAAE,OAAA,CAAQ,IAAI,CAAA,CACtB,IAAA,CAAM4B,EACN,EAAA,CAAIvB,EACN,CAAC,CAAA,CACA,SAAA,CAAW+B,IAAc,CAAE,MAAA,CAAQA,EAAS,IAAA,CAAM,SAAA,CAAWA,EAAS,EAAG,CAAA,CAAE,EAMjEC,EAAAA,CAAgCrC,GAAAA,CAAE,MAAM+B,CAAe,CAAA,CAEvDO,GAAgCtC,GAAAA,CAAE,KAAA,CAAM,CACnDmC,CAAAA,CACAnC,GAAAA,CAAE,OAAO,CAAE,MAAA,CAAQA,IAAE,OAAA,CAAQ,KAAK,EAAG,KAAA,CAAOA,GAAAA,CAAE,QAAO,CAAE,GAAA,CAAI,CAAC,CAAE,CAAC,CACjE,CAAC","file":"index.js","sourcesContent":["import { z } from 'zod';\nimport { EpochMillisecondsSchema, toEpochMilliseconds } from '../shared';\n\n// The API reports an unarmed schedule as `deadline: 0`.\nconst AutoCancelDeadlineSchema = z\n .number()\n .int()\n .transform((value) => (value === 0 ? null : toEpochMilliseconds(value)));\n\n/**\n * Acknowledgement for a Perps auto-cancel update. `deadline` echoes the armed\n * cancellation time in Unix milliseconds, or `null` when the schedule was\n * disarmed.\n *\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const PerpsAutoCancelResponseSchema = z.object({\n status: z.literal('ok'),\n deadline: AutoCancelDeadlineSchema,\n});\n\n/**\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport type PerpsAutoCancelResponse = z.infer<\n typeof PerpsAutoCancelResponseSchema\n>;\n\n/**\n * Current auto-cancel state for an account. `deadline` is `null` when no\n * schedule is armed.\n *\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const PerpsAutoCancelStatusSchema = z\n .object({\n deadline: AutoCancelDeadlineSchema,\n triggered: z.number().int().nonnegative(),\n daily_limit: z.number().int().nonnegative(),\n next_reset: EpochMillisecondsSchema,\n })\n .transform((status) => ({\n deadline: status.deadline,\n triggered: status.triggered,\n dailyLimit: status.daily_limit,\n nextReset: status.next_reset,\n }));\n\n/**\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport type PerpsAutoCancelStatus = z.infer<typeof PerpsAutoCancelStatusSchema>;\n\n/**\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const FetchPerpsAutoCancelStatusResponseSchema =\n PerpsAutoCancelStatusSchema;\n","import { z } from 'zod';\nimport { DecimalStringSchema, EpochMillisecondsSchema } from '../shared';\nimport {\n type PerpsInstrumentId,\n PerpsInstrumentIdSchema,\n PerpsSide,\n} from './common';\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport enum PerpsPositionSnapshotStatus {\n Ok = 'ok',\n NotFound = 'not_found',\n HistoryPending = 'history_pending',\n HistoryLimit = 'history_limit',\n ResourceLimit = 'resource_limit',\n TemporarilyUnavailable = 'temporarily_unavailable',\n Unavailable = 'unavailable',\n}\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport enum PerpsPositionSnapshotMarkerKind {\n Increase = 'increase',\n Decrease = 'decrease',\n}\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotCandleSchema = z.object({\n position: z.number(),\n open: z.number(),\n high: z.number(),\n low: z.number(),\n close: z.number(),\n});\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshotCandle = z.infer<\n typeof PerpsPositionSnapshotCandleSchema\n>;\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotMarkerSchema = z.object({\n position: z.number(),\n kind: z.enum(PerpsPositionSnapshotMarkerKind),\n});\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshotMarker = z.infer<\n typeof PerpsPositionSnapshotMarkerSchema\n>;\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotChartSchema = z.object({\n candles: z.array(PerpsPositionSnapshotCandleSchema).max(22),\n markers: z.array(PerpsPositionSnapshotMarkerSchema).max(256),\n});\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshotChart = z.infer<\n typeof PerpsPositionSnapshotChartSchema\n>;\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotSchema = z\n .object({\n position_cycle_id: z.string(),\n side: z.enum(PerpsSide),\n started_at: EpochMillisecondsSchema,\n as_of_at: EpochMillisecondsSchema,\n is_closed: z.boolean(),\n size_after: DecimalStringSchema,\n entry_price: DecimalStringSchema,\n as_of_price: DecimalStringSchema,\n pnl: DecimalStringSchema,\n pnl_percent: DecimalStringSchema.nullable(),\n leverage: z.number().int().nonnegative().nullable(),\n chart: PerpsPositionSnapshotChartSchema,\n })\n .transform((snapshot) => ({\n positionCycleId: snapshot.position_cycle_id,\n side: snapshot.side,\n startedAt: snapshot.started_at,\n asOfAt: snapshot.as_of_at,\n isClosed: snapshot.is_closed,\n sizeAfter: snapshot.size_after,\n entryPrice: snapshot.entry_price,\n asOfPrice: snapshot.as_of_price,\n pnl: snapshot.pnl,\n pnlPercent: snapshot.pnl_percent,\n leverage: snapshot.leverage,\n chart: snapshot.chart,\n }));\n/** A position cycle valued at captured state or immediately after a selected fill.\n * @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshot = z.infer<typeof PerpsPositionSnapshotSchema>;\n\nconst TradeIdSchema = z\n .string()\n .regex(/^(0|[1-9][0-9]{0,19})$/)\n .refine(\n (value) =>\n /^[0-9]{1,20}$/.test(value) && BigInt(value) <= 18446744073709551615n,\n );\nconst IdentitySchema = z.object({\n instrument_id: PerpsInstrumentIdSchema,\n trade_id: TradeIdSchema.optional(),\n});\nconst ResultSchema = z\n .discriminatedUnion('status', [\n IdentitySchema.extend({\n status: z.literal(PerpsPositionSnapshotStatus.Ok),\n snapshot: PerpsPositionSnapshotSchema,\n }),\n IdentitySchema.extend({\n status: z.enum(PerpsPositionSnapshotStatus).exclude(['Ok']),\n snapshot: z.never().optional(),\n }),\n ])\n .transform((item): PerpsPositionSnapshotResult => {\n const identity = {\n instrumentId: item.instrument_id,\n ...(item.trade_id === undefined ? {} : { tradeId: item.trade_id }),\n };\n return item.status === PerpsPositionSnapshotStatus.Ok\n ? { ...identity, status: item.status, snapshot: item.snapshot }\n : { ...identity, status: item.status };\n });\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshotResult =\n | {\n instrumentId: PerpsInstrumentId;\n tradeId?: string;\n status: PerpsPositionSnapshotStatus.Ok;\n snapshot: PerpsPositionSnapshot;\n }\n | {\n instrumentId: PerpsInstrumentId;\n tradeId?: string;\n status: Exclude<\n PerpsPositionSnapshotStatus,\n PerpsPositionSnapshotStatus.Ok\n >;\n };\nconst HistoryResultSchema = ResultSchema.transform((item, ctx) => {\n if (item.tradeId === undefined) {\n ctx.addIssue({\n code: 'custom',\n message: 'Historical snapshot requires trade_id',\n });\n return z.NEVER;\n }\n return { ...item, tradeId: item.tradeId };\n});\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsHistoricalPositionSnapshotResult = z.infer<\n typeof HistoryResultSchema\n>;\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotsSchema = z\n .object({\n history_as_of_at: EpochMillisecondsSchema,\n active: z.array(ResultSchema),\n history: z.array(HistoryResultSchema),\n })\n .transform((response) => ({\n historyAsOfAt: response.history_as_of_at,\n active: response.active,\n history: response.history,\n }));\n/** Ordered selections and the completed-history horizon. No pagination.\n * @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshots = z.infer<\n typeof PerpsPositionSnapshotsSchema\n>;\n","import { z } from 'zod';\n\n/**\n * Parses whether an address has a Perps account.\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const PerpsRegistrationResponseSchema = z\n .object({ registered: z.boolean() })\n .transform((response) => response.registered);\n","import { z } from 'zod';\nimport {\n DecimalStringSchema,\n EpochMillisecondsSchema,\n OrderSide,\n} from '../shared';\nimport {\n PerpsClientOrderIdSchema,\n PerpsInstrumentIdSchema,\n PerpsOrderIdSchema,\n} from './common';\n\n/** Opaque run identity.\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport type PerpsTwapId = number & { readonly __tag: 'PerpsTwapId' };\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsTwapIdSchema = z\n .number()\n .int()\n .positive()\n .max(Number.MAX_SAFE_INTEGER)\n .transform((value) => value as PerpsTwapId);\n/** Active runs only; ended runs are absent from the active collection.\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport enum PerpsTwapStatus {\n Running = 'running',\n Paused = 'paused',\n}\nconst DecimalSchema = z\n .string()\n .regex(/^\\d+(?:\\.\\d+)?$/)\n .pipe(DecimalStringSchema);\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsTwapSchema = z\n .object({\n twid: PerpsTwapIdSchema,\n iid: PerpsInstrumentIdSchema,\n buy: z.boolean(),\n qty: DecimalSchema,\n fill: DecimalSchema,\n dur: z.number().int().positive(),\n ivl: z.number().int().positive(),\n rnd: z.boolean(),\n slip_bps: z.number().int().min(0).max(10000),\n min_px: DecimalSchema,\n max_px: DecimalSchema,\n ro: z.boolean(),\n st: z.enum(PerpsTwapStatus),\n slices: z.number().int().nonnegative(),\n slice_count: z.number().int().positive(),\n sts: EpochMillisecondsSchema,\n ets: EpochMillisecondsSchema,\n cts: EpochMillisecondsSchema,\n avg_px: DecimalSchema.optional(),\n coid: PerpsClientOrderIdSchema.optional(),\n oid: PerpsOrderIdSchema.optional(),\n })\n .transform((run) => ({\n twapId: run.twid,\n instrumentId: run.iid,\n side: run.buy ? OrderSide.BUY : OrderSide.SELL,\n quantity: run.qty,\n filledQuantity: run.fill,\n durationMs: run.dur,\n intervalMs: run.ivl,\n randomize: run.rnd,\n slippageBps: run.slip_bps,\n minPrice: run.min_px,\n maxPrice: run.max_px,\n reduceOnly: run.ro,\n status: run.st,\n slices: run.slices,\n sliceCount: run.slice_count,\n startedAt: run.sts,\n endsAt: run.ets,\n createdAt: run.cts,\n ...(run.avg_px === undefined ? {} : { averagePrice: run.avg_px }),\n ...(run.coid === undefined ? {} : { clientOrderId: run.coid }),\n ...(run.oid === undefined ? {} : { orderId: run.oid }),\n }));\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsTwap = z.infer<typeof PerpsTwapSchema>;\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsTwapAcceptedSchema = z\n .object({\n status: z.literal('ok'),\n twid: PerpsTwapIdSchema,\n ts: EpochMillisecondsSchema,\n })\n .transform((accepted) => ({ twapId: accepted.twid, timestamp: accepted.ts }));\n/** Acceptance does not guarantee all scheduled quantity will fill.\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport type PerpsTwapAccepted = z.infer<typeof PerpsTwapAcceptedSchema>;\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const FetchPerpsTwapsResponseSchema = z.array(PerpsTwapSchema);\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const CreatePerpsTwapResponseSchema = z.union([\n PerpsTwapAcceptedSchema,\n z.object({ status: z.literal('err'), error: z.string().min(1) }),\n]);\n"]}
|
package/dist/relayer/index.d.ts
CHANGED
package/dist/relayer/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Na,Oa,da}from'../chunk-JPPG656Y.js';import {z}from'zod';var E=(t=>(t.SUBMITTED="SUBMITTED",t.REGISTRY_PENDING="REGISTRY_PENDING",t.REGISTERED="REGISTERED",t.FAILED="FAILED",t.SUPERSEDED="SUPERSEDED",t.REPAIR_REQUIRED="REPAIR_REQUIRED",t))(E||{}),f=z.object({status:z.enum(E),transactionHash:Oa.nullish().transform(o=>o??null),transactionId:Na}),c=(t=>(t.PENDING="PENDING",t.FENCED="FENCED",t.SWEPT="SWEPT",t.CHAIN_SUBMITTED="CHAIN_SUBMITTED",t.CONFIRMED="CONFIRMED",t.FAILED="FAILED",t))(c||{}),L=z.object({status:z.enum(c),transactionId:Na});var m=(s=>(s.SAFE="SAFE",s.PROXY="PROXY",s.SAFE_CREATE="SAFE-CREATE",s.WALLET="WALLET",s.WALLET_CREATE="WALLET-CREATE",s))(m||{}),C=z.enum(m),u=z.enum(["PROXY","SAFE","SAFE-CREATE"]),R=(t=>(t.STATE_NEW="STATE_NEW",t.STATE_EXECUTED="STATE_EXECUTED",t.STATE_MINED="STATE_MINED",t.STATE_CONFIRMED="STATE_CONFIRMED",t.STATE_INVALID="STATE_INVALID",t.STATE_FAILED="STATE_FAILED",t))(R||{}),T=z.enum(R),x=z.object({baseGas:z.string().optional(),gasLimit:z.string().optional(),gasPrice:z.string().optional(),gasToken:da.optional(),operation:z.string().optional(),payment:z.string().optional(),paymentReceiver:da.optional(),paymentToken:da.optional(),refundReceiver:da.optional(),relay:da.optional(),relayHub:da.optional(),relayerFee:z.string().optional(),safeTxnGas:z.string().optional()}),N=z.object({address:da,nonce:z.string().min(1)}),D=z.object({data:z.string().min(1),from:da,metadata:z.string().optional(),nonce:z.string().min(1).optional(),proxyWallet:da,signature:z.string().min(1),signatureParams:x,to:da,type:u,value:z.string().optional()}),I=z.object({data:z.string().min(1),target:da,value:z.string().min(1)}),h=z.object({calls:z.array(I).min(1),deadline:z.string().min(1),depositWallet:da}),A=z.object({depositWalletParams:h,from:da,metadata:z.string().optional(),nonce:z.string().min(1),signature:z.string().min(1),to:da,type:z.literal("WALLET")}),S=z.object({from:da,metadata:z.string().optional(),to:da,type:z.literal("WALLET-CREATE")}),F=z.union([D,A,S]),b=z.object({state:T,transactionHash:Oa.nullish().transform(o=>o??null),transactionID:Na}).transform(({transactionHash:o,transactionID:l,...i})=>({...i,transactionHash:o??null,transactionId:l})),G=z.object({deployed:z.boolean()}),j=z.object({error_msg:z.string().nullish(),state:T,transaction_hash:z.union([z.literal(""),Oa]).transform(o=>o===""?null:o),transaction_id:Na}).transform(({error_msg:o,transaction_hash:l,transaction_id:i,...y})=>({...y,errorMsg:o??null,transactionHash:l??null,transactionId:i}));export{I as DepositWalletCallSchema,h as DepositWalletParamsSchema,j as GaslessTransactionSchema,f as RelayerAuthorizeSessionSignerResponseSchema,E as RelayerAuthorizeSessionSignerStatus,G as RelayerDeployedResponseSchema,S as RelayerDepositWalletCreateRequestSchema,A as RelayerDepositWalletExecuteRequestSchema,N as RelayerExecuteParamsSchema,F as RelayerExecuteRequestSchema,b as RelayerExecuteResponseSchema,D as RelayerLegacyExecuteRequestSchema,L as RelayerRevokeSessionSignerResponseSchema,c as RelayerRevokeSessionSignerStatus,R as RelayerTransactionState,m as RelayerTransactionType,C as RelayerTransactionTypeSchema};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|