@pear-protocol/types 1.2.0 → 1.4.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/bundle.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from './fill';
7
7
  export * from './funding';
8
8
  export * from './instrument';
9
9
  export * from './instrument-precision';
10
+ export * from './ladder';
10
11
  export * from './leverage';
11
12
  export * from './market';
12
13
  export * from './misc';
package/dist/bundle.js CHANGED
@@ -7,6 +7,7 @@ export * from './fill';
7
7
  export * from './funding';
8
8
  export * from './instrument';
9
9
  export * from './instrument-precision';
10
+ export * from './ladder';
10
11
  export * from './leverage';
11
12
  export * from './market';
12
13
  export * from './misc';
@@ -3,6 +3,7 @@ export declare const ExecutionIntent: z.ZodEnum<{
3
3
  OPEN: "OPEN";
4
4
  CLOSE: "CLOSE";
5
5
  ADJUST: "ADJUST";
6
+ REVERSE: "REVERSE";
6
7
  }>;
7
8
  export type ExecutionIntent = z.infer<typeof ExecutionIntent>;
8
9
  export declare const ExecutionOrderType: z.ZodEnum<{
@@ -48,6 +49,7 @@ export declare const BaseExecution: z.ZodObject<{
48
49
  OPEN: "OPEN";
49
50
  CLOSE: "CLOSE";
50
51
  ADJUST: "ADJUST";
52
+ REVERSE: "REVERSE";
51
53
  }>;
52
54
  orderType: z.ZodEnum<{
53
55
  MARKET: "MARKET";
@@ -315,6 +317,64 @@ export declare const MarketCloseExecution: z.ZodObject<{
315
317
  exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
316
318
  }, z.core.$strip>;
317
319
  }, z.core.$strip>;
320
+ export declare const MarketReverseExecution: z.ZodObject<{
321
+ id: z.ZodUUID;
322
+ connector: z.ZodEnum<{
323
+ hyperliquid: "hyperliquid";
324
+ binance: "binance";
325
+ bybit: "bybit";
326
+ okx: "okx";
327
+ lighter: "lighter";
328
+ }>;
329
+ status: z.ZodEnum<{
330
+ CANCELLED: "CANCELLED";
331
+ IDLE: "IDLE";
332
+ ACTIVE: "ACTIVE";
333
+ COMPLETED: "COMPLETED";
334
+ FAILED: "FAILED";
335
+ }>;
336
+ error: z.ZodOptional<z.ZodString>;
337
+ createdAt: z.ZodString;
338
+ updatedAt: z.ZodString;
339
+ orders: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
340
+ id: z.ZodUUID;
341
+ connector: z.ZodEnum<{
342
+ hyperliquid: "hyperliquid";
343
+ binance: "binance";
344
+ bybit: "bybit";
345
+ okx: "okx";
346
+ lighter: "lighter";
347
+ }>;
348
+ status: z.ZodEnum<{
349
+ PENDING: "PENDING";
350
+ PARTIAL: "PARTIAL";
351
+ FILLED: "FILLED";
352
+ CANCELLED: "CANCELLED";
353
+ REJECTED: "REJECTED";
354
+ }>;
355
+ error: z.ZodOptional<z.ZodString>;
356
+ createdAt: z.ZodString;
357
+ updatedAt: z.ZodString;
358
+ type: z.ZodLiteral<"MARKET">;
359
+ symbol: z.ZodString;
360
+ side: z.ZodEnum<{
361
+ BUY: "BUY";
362
+ SELL: "SELL";
363
+ }>;
364
+ reduceOnly: z.ZodBoolean;
365
+ leverage: z.ZodInt;
366
+ quantity: z.ZodString;
367
+ price: z.ZodString;
368
+ filledQuantity: z.ZodString;
369
+ filledPrice: z.ZodOptional<z.ZodString>;
370
+ }, z.core.$strip>], "type">>>;
371
+ intent: z.ZodLiteral<"REVERSE">;
372
+ orderType: z.ZodLiteral<"MARKET">;
373
+ position: z.ZodObject<{
374
+ id: z.ZodUUID;
375
+ exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
376
+ }, z.core.$strip>;
377
+ }, z.core.$strip>;
318
378
  export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
319
379
  id: z.ZodUUID;
320
380
  connector: z.ZodEnum<{
@@ -532,6 +592,63 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
532
592
  id: z.ZodUUID;
533
593
  exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
534
594
  }, z.core.$strip>;
595
+ }, z.core.$strip>, z.ZodObject<{
596
+ id: z.ZodUUID;
597
+ connector: z.ZodEnum<{
598
+ hyperliquid: "hyperliquid";
599
+ binance: "binance";
600
+ bybit: "bybit";
601
+ okx: "okx";
602
+ lighter: "lighter";
603
+ }>;
604
+ status: z.ZodEnum<{
605
+ CANCELLED: "CANCELLED";
606
+ IDLE: "IDLE";
607
+ ACTIVE: "ACTIVE";
608
+ COMPLETED: "COMPLETED";
609
+ FAILED: "FAILED";
610
+ }>;
611
+ error: z.ZodOptional<z.ZodString>;
612
+ createdAt: z.ZodString;
613
+ updatedAt: z.ZodString;
614
+ orders: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
615
+ id: z.ZodUUID;
616
+ connector: z.ZodEnum<{
617
+ hyperliquid: "hyperliquid";
618
+ binance: "binance";
619
+ bybit: "bybit";
620
+ okx: "okx";
621
+ lighter: "lighter";
622
+ }>;
623
+ status: z.ZodEnum<{
624
+ PENDING: "PENDING";
625
+ PARTIAL: "PARTIAL";
626
+ FILLED: "FILLED";
627
+ CANCELLED: "CANCELLED";
628
+ REJECTED: "REJECTED";
629
+ }>;
630
+ error: z.ZodOptional<z.ZodString>;
631
+ createdAt: z.ZodString;
632
+ updatedAt: z.ZodString;
633
+ type: z.ZodLiteral<"MARKET">;
634
+ symbol: z.ZodString;
635
+ side: z.ZodEnum<{
636
+ BUY: "BUY";
637
+ SELL: "SELL";
638
+ }>;
639
+ reduceOnly: z.ZodBoolean;
640
+ leverage: z.ZodInt;
641
+ quantity: z.ZodString;
642
+ price: z.ZodString;
643
+ filledQuantity: z.ZodString;
644
+ filledPrice: z.ZodOptional<z.ZodString>;
645
+ }, z.core.$strip>], "type">>>;
646
+ intent: z.ZodLiteral<"REVERSE">;
647
+ orderType: z.ZodLiteral<"MARKET">;
648
+ position: z.ZodObject<{
649
+ id: z.ZodUUID;
650
+ exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
651
+ }, z.core.$strip>;
535
652
  }, z.core.$strip>], "intent">;
536
653
  export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
537
654
  id: z.ZodUUID;
@@ -750,12 +867,70 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
750
867
  id: z.ZodUUID;
751
868
  exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
752
869
  }, z.core.$strip>;
870
+ }, z.core.$strip>, z.ZodObject<{
871
+ id: z.ZodUUID;
872
+ connector: z.ZodEnum<{
873
+ hyperliquid: "hyperliquid";
874
+ binance: "binance";
875
+ bybit: "bybit";
876
+ okx: "okx";
877
+ lighter: "lighter";
878
+ }>;
879
+ status: z.ZodEnum<{
880
+ CANCELLED: "CANCELLED";
881
+ IDLE: "IDLE";
882
+ ACTIVE: "ACTIVE";
883
+ COMPLETED: "COMPLETED";
884
+ FAILED: "FAILED";
885
+ }>;
886
+ error: z.ZodOptional<z.ZodString>;
887
+ createdAt: z.ZodString;
888
+ updatedAt: z.ZodString;
889
+ orders: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
890
+ id: z.ZodUUID;
891
+ connector: z.ZodEnum<{
892
+ hyperliquid: "hyperliquid";
893
+ binance: "binance";
894
+ bybit: "bybit";
895
+ okx: "okx";
896
+ lighter: "lighter";
897
+ }>;
898
+ status: z.ZodEnum<{
899
+ PENDING: "PENDING";
900
+ PARTIAL: "PARTIAL";
901
+ FILLED: "FILLED";
902
+ CANCELLED: "CANCELLED";
903
+ REJECTED: "REJECTED";
904
+ }>;
905
+ error: z.ZodOptional<z.ZodString>;
906
+ createdAt: z.ZodString;
907
+ updatedAt: z.ZodString;
908
+ type: z.ZodLiteral<"MARKET">;
909
+ symbol: z.ZodString;
910
+ side: z.ZodEnum<{
911
+ BUY: "BUY";
912
+ SELL: "SELL";
913
+ }>;
914
+ reduceOnly: z.ZodBoolean;
915
+ leverage: z.ZodInt;
916
+ quantity: z.ZodString;
917
+ price: z.ZodString;
918
+ filledQuantity: z.ZodString;
919
+ filledPrice: z.ZodOptional<z.ZodString>;
920
+ }, z.core.$strip>], "type">>>;
921
+ intent: z.ZodLiteral<"REVERSE">;
922
+ orderType: z.ZodLiteral<"MARKET">;
923
+ position: z.ZodObject<{
924
+ id: z.ZodUUID;
925
+ exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
926
+ }, z.core.$strip>;
753
927
  }, z.core.$strip>], "intent">], "orderType">;
754
928
  export type ExecutionLeg = z.infer<typeof ExecutionLeg>;
755
929
  export type BaseExecution = z.output<typeof BaseExecution>;
756
930
  export type MarketOpenExecution = z.output<typeof MarketOpenExecution>;
757
931
  export type MarketAdjustExecution = z.output<typeof MarketAdjustExecution>;
758
932
  export type MarketCloseExecution = z.output<typeof MarketCloseExecution>;
933
+ export type MarketReverseExecution = z.output<typeof MarketReverseExecution>;
759
934
  export type MarketExecution = z.output<typeof MarketExecution>;
760
935
  export type Execution = z.output<typeof Execution>;
761
936
  export {};
@@ -5,7 +5,7 @@ import { InstrumentId } from '../instrument';
5
5
  import { Order } from '../order';
6
6
  import { Position } from '../position';
7
7
 
8
- const ExecutionIntent = z.enum(["OPEN", "CLOSE", "ADJUST"]);
8
+ const ExecutionIntent = z.enum(["OPEN", "CLOSE", "ADJUST", "REVERSE"]);
9
9
  const ExecutionOrderType = z.enum(["MARKET"]);
10
10
  const ExecutionStatus = z.enum(["IDLE", "ACTIVE", "COMPLETED", "FAILED", "CANCELLED"]);
11
11
  const ExecutionLegMode = z.enum(["QUANTITY", "USD"]);
@@ -115,11 +115,26 @@ const MarketCloseExecution = BaseExecution.extend({
115
115
  */
116
116
  position: Position.pick({ id: true, exposure: true })
117
117
  });
118
+ const MarketReverseExecution = BaseExecution.extend({
119
+ /**
120
+ * Intent
121
+ */
122
+ intent: z.literal("REVERSE"),
123
+ /**
124
+ * Order type
125
+ */
126
+ orderType: z.literal("MARKET"),
127
+ /**
128
+ * Position
129
+ */
130
+ position: Position.pick({ id: true, exposure: true })
131
+ });
118
132
  const MarketExecution = z.discriminatedUnion("intent", [
119
133
  MarketOpenExecution,
120
134
  MarketAdjustExecution,
121
- MarketCloseExecution
135
+ MarketCloseExecution,
136
+ MarketReverseExecution
122
137
  ]);
123
138
  const Execution = z.discriminatedUnion("orderType", [MarketExecution]);
124
139
 
125
- export { BaseExecution, Execution, ExecutionIntent, ExecutionLegMode, ExecutionOrderType, ExecutionStatus, MarketAdjustExecution, MarketCloseExecution, MarketExecution, MarketOpenExecution };
140
+ export { BaseExecution, Execution, ExecutionIntent, ExecutionLegMode, ExecutionOrderType, ExecutionStatus, MarketAdjustExecution, MarketCloseExecution, MarketExecution, MarketOpenExecution, MarketReverseExecution };
@@ -219,6 +219,63 @@ export declare const ExecutionListResponse: z.ZodObject<{
219
219
  id: z.ZodUUID;
220
220
  exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
221
221
  }, z.core.$strip>;
222
+ }, z.core.$strip>, z.ZodObject<{
223
+ id: z.ZodUUID;
224
+ connector: z.ZodEnum<{
225
+ hyperliquid: "hyperliquid";
226
+ binance: "binance";
227
+ bybit: "bybit";
228
+ okx: "okx";
229
+ lighter: "lighter";
230
+ }>;
231
+ status: z.ZodEnum<{
232
+ CANCELLED: "CANCELLED";
233
+ IDLE: "IDLE";
234
+ ACTIVE: "ACTIVE";
235
+ COMPLETED: "COMPLETED";
236
+ FAILED: "FAILED";
237
+ }>;
238
+ error: z.ZodOptional<z.ZodString>;
239
+ createdAt: z.ZodString;
240
+ updatedAt: z.ZodString;
241
+ orders: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
242
+ id: z.ZodUUID;
243
+ connector: z.ZodEnum<{
244
+ hyperliquid: "hyperliquid";
245
+ binance: "binance";
246
+ bybit: "bybit";
247
+ okx: "okx";
248
+ lighter: "lighter";
249
+ }>;
250
+ status: z.ZodEnum<{
251
+ PENDING: "PENDING";
252
+ PARTIAL: "PARTIAL";
253
+ FILLED: "FILLED";
254
+ CANCELLED: "CANCELLED";
255
+ REJECTED: "REJECTED";
256
+ }>;
257
+ error: z.ZodOptional<z.ZodString>;
258
+ createdAt: z.ZodString;
259
+ updatedAt: z.ZodString;
260
+ type: z.ZodLiteral<"MARKET">;
261
+ symbol: z.ZodString;
262
+ side: z.ZodEnum<{
263
+ BUY: "BUY";
264
+ SELL: "SELL";
265
+ }>;
266
+ reduceOnly: z.ZodBoolean;
267
+ leverage: z.ZodInt;
268
+ quantity: z.ZodString;
269
+ price: z.ZodString;
270
+ filledQuantity: z.ZodString;
271
+ filledPrice: z.ZodOptional<z.ZodString>;
272
+ }, z.core.$strip>], "type">>>;
273
+ intent: z.ZodLiteral<"REVERSE">;
274
+ orderType: z.ZodLiteral<"MARKET">;
275
+ position: z.ZodObject<{
276
+ id: z.ZodUUID;
277
+ exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
278
+ }, z.core.$strip>;
222
279
  }, z.core.$strip>], "intent">], "orderType">>;
223
280
  }, z.core.$strip>;
224
281
  export type ExecutionListResponse = z.output<typeof ExecutionListResponse>;