@pear-protocol/types 0.0.2 → 0.0.3

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.
@@ -5,5 +5,6 @@ export declare const AuthenticatedUser: z.ZodObject<{
5
5
  basic: "basic";
6
6
  pro: "pro";
7
7
  }>;
8
+ address: z.ZodOptional<z.ZodString>;
8
9
  }, z.core.$strip>;
9
10
  export type AuthenticatedUser = z.infer<typeof AuthenticatedUser>;
@@ -2,7 +2,8 @@ import { z } from 'zod';
2
2
 
3
3
  const AuthenticatedUser = z.object({
4
4
  id: z.uuid().describe("User UUID"),
5
- role: z.enum(["basic", "pro"]).describe("User role")
5
+ role: z.enum(["basic", "pro"]).describe("User role"),
6
+ address: z.string().optional().describe("User address")
6
7
  }).describe("Current authenticated user info");
7
8
 
8
9
  export { AuthenticatedUser };
@@ -6,6 +6,7 @@ export declare const LoginResponse: z.ZodObject<{
6
6
  basic: "basic";
7
7
  pro: "pro";
8
8
  }>;
9
+ address: z.ZodOptional<z.ZodString>;
9
10
  }, z.core.$strip>;
10
11
  }, z.core.$strip>;
11
12
  export declare const RefreshTokenResponse: z.ZodObject<{
@@ -23,6 +24,7 @@ export declare const RegisterResponse: z.ZodObject<{
23
24
  basic: "basic";
24
25
  pro: "pro";
25
26
  }>;
27
+ address: z.ZodOptional<z.ZodString>;
26
28
  }, z.core.$strip>;
27
29
  }, z.core.$strip>;
28
30
  export declare const LinkResponse: z.ZodObject<{
@@ -32,6 +34,7 @@ export declare const LinkResponse: z.ZodObject<{
32
34
  basic: "basic";
33
35
  pro: "pro";
34
36
  }>;
37
+ address: z.ZodOptional<z.ZodString>;
35
38
  }, z.core.$strip>;
36
39
  }, z.core.$strip>;
37
40
  export declare const RequestNonceResponse: z.ZodObject<{
@@ -44,6 +47,7 @@ export declare const MeResponse: z.ZodObject<{
44
47
  basic: "basic";
45
48
  pro: "pro";
46
49
  }>;
50
+ address: z.ZodOptional<z.ZodString>;
47
51
  }, z.core.$strip>;
48
52
  export type RequestNonceResponse = z.infer<typeof RequestNonceResponse>;
49
53
  export type LoginResponse = z.infer<typeof LoginResponse>;
@@ -6,3 +6,25 @@ export declare const Connector: z.ZodEnum<{
6
6
  okx: "okx";
7
7
  }>;
8
8
  export type Connector = z.infer<typeof Connector>;
9
+ export type HyperliquidCredentialsDTO = {
10
+ signer_key: `0x${string}`;
11
+ };
12
+ export type BinanceUSDMCredentialsDTO = {
13
+ api_key: string;
14
+ api_secret: string;
15
+ };
16
+ export type BybitCredentialsDTO = {
17
+ api_key: string;
18
+ api_secret: string;
19
+ };
20
+ export type OkxCredentialsDTO = {
21
+ api_key: string;
22
+ api_secret: string;
23
+ api_pass: string;
24
+ };
25
+ export type ConnectorCredentialsDTO = {
26
+ hyperliquid: HyperliquidCredentialsDTO;
27
+ binanceusdm: BinanceUSDMCredentialsDTO;
28
+ bybit: BybitCredentialsDTO;
29
+ okx: OkxCredentialsDTO;
30
+ };
@@ -67,6 +67,10 @@ export declare const CreateMarketOpen: z.ZodObject<{
67
67
  threshold_bps: z.ZodNumber;
68
68
  }, z.core.$strip>;
69
69
  }, z.core.$strip>], "type">;
70
+ bracketType: z.ZodOptional<z.ZodEnum<{
71
+ STOP_LOSS: "STOP_LOSS";
72
+ TAKE_PROFIT: "TAKE_PROFIT";
73
+ }>>;
70
74
  }, z.core.$strip>>;
71
75
  }, z.core.$strip>;
72
76
  export declare const CreateMarketAdjust: z.ZodObject<{
@@ -171,6 +175,10 @@ export declare const CreateTradeOpen: z.ZodDiscriminatedUnion<[z.ZodObject<{
171
175
  threshold_bps: z.ZodNumber;
172
176
  }, z.core.$strip>;
173
177
  }, z.core.$strip>], "type">;
178
+ bracketType: z.ZodOptional<z.ZodEnum<{
179
+ STOP_LOSS: "STOP_LOSS";
180
+ TAKE_PROFIT: "TAKE_PROFIT";
181
+ }>>;
174
182
  }, z.core.$strip>>;
175
183
  }, z.core.$strip>], "type">;
176
184
  export declare const CreateTradeAdjust: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -16,6 +16,11 @@ export declare const TriggerCancelledReason: z.ZodEnum<{
16
16
  SYSTEM: "SYSTEM";
17
17
  }>;
18
18
  export type TriggerCancelledReason = z.infer<typeof TriggerCancelledReason>;
19
+ export declare const BracketType: z.ZodEnum<{
20
+ STOP_LOSS: "STOP_LOSS";
21
+ TAKE_PROFIT: "TAKE_PROFIT";
22
+ }>;
23
+ export type BracketType = z.infer<typeof BracketType>;
19
24
  declare const BaseTrigger: z.ZodObject<{
20
25
  id: z.ZodUUID;
21
26
  tradeAccountId: z.ZodUUID;
@@ -60,6 +65,10 @@ declare const BaseTrigger: z.ZodObject<{
60
65
  fee: z.ZodOptional<z.ZodString>;
61
66
  timestamp: z.ZodString;
62
67
  }, z.core.$strip>>>;
68
+ bracketType: z.ZodOptional<z.ZodEnum<{
69
+ STOP_LOSS: "STOP_LOSS";
70
+ TAKE_PROFIT: "TAKE_PROFIT";
71
+ }>>;
63
72
  createdAt: z.ZodString;
64
73
  updatedAt: z.ZodString;
65
74
  }, z.core.$strip>;
@@ -107,6 +116,10 @@ export declare const TriggerMarketOpen: z.ZodObject<{
107
116
  fee: z.ZodOptional<z.ZodString>;
108
117
  timestamp: z.ZodString;
109
118
  }, z.core.$strip>>>;
119
+ bracketType: z.ZodOptional<z.ZodEnum<{
120
+ STOP_LOSS: "STOP_LOSS";
121
+ TAKE_PROFIT: "TAKE_PROFIT";
122
+ }>>;
110
123
  createdAt: z.ZodString;
111
124
  updatedAt: z.ZodString;
112
125
  intent: z.ZodLiteral<"OPEN">;
@@ -250,6 +263,10 @@ export declare const TriggerMarketAdjust: z.ZodObject<{
250
263
  fee: z.ZodOptional<z.ZodString>;
251
264
  timestamp: z.ZodString;
252
265
  }, z.core.$strip>>>;
266
+ bracketType: z.ZodOptional<z.ZodEnum<{
267
+ STOP_LOSS: "STOP_LOSS";
268
+ TAKE_PROFIT: "TAKE_PROFIT";
269
+ }>>;
253
270
  createdAt: z.ZodString;
254
271
  updatedAt: z.ZodString;
255
272
  intent: z.ZodLiteral<"ADJUST">;
@@ -438,6 +455,10 @@ export declare const TriggerMarketClose: z.ZodObject<{
438
455
  fee: z.ZodOptional<z.ZodString>;
439
456
  timestamp: z.ZodString;
440
457
  }, z.core.$strip>>>;
458
+ bracketType: z.ZodOptional<z.ZodEnum<{
459
+ STOP_LOSS: "STOP_LOSS";
460
+ TAKE_PROFIT: "TAKE_PROFIT";
461
+ }>>;
441
462
  createdAt: z.ZodString;
442
463
  updatedAt: z.ZodString;
443
464
  intent: z.ZodLiteral<"CLOSE">;
@@ -601,6 +622,10 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
601
622
  fee: z.ZodOptional<z.ZodString>;
602
623
  timestamp: z.ZodString;
603
624
  }, z.core.$strip>>>;
625
+ bracketType: z.ZodOptional<z.ZodEnum<{
626
+ STOP_LOSS: "STOP_LOSS";
627
+ TAKE_PROFIT: "TAKE_PROFIT";
628
+ }>>;
604
629
  createdAt: z.ZodString;
605
630
  updatedAt: z.ZodString;
606
631
  intent: z.ZodLiteral<"OPEN">;
@@ -743,6 +768,10 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
743
768
  fee: z.ZodOptional<z.ZodString>;
744
769
  timestamp: z.ZodString;
745
770
  }, z.core.$strip>>>;
771
+ bracketType: z.ZodOptional<z.ZodEnum<{
772
+ STOP_LOSS: "STOP_LOSS";
773
+ TAKE_PROFIT: "TAKE_PROFIT";
774
+ }>>;
746
775
  createdAt: z.ZodString;
747
776
  updatedAt: z.ZodString;
748
777
  intent: z.ZodLiteral<"ADJUST">;
@@ -930,6 +959,10 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
930
959
  fee: z.ZodOptional<z.ZodString>;
931
960
  timestamp: z.ZodString;
932
961
  }, z.core.$strip>>>;
962
+ bracketType: z.ZodOptional<z.ZodEnum<{
963
+ STOP_LOSS: "STOP_LOSS";
964
+ TAKE_PROFIT: "TAKE_PROFIT";
965
+ }>>;
933
966
  createdAt: z.ZodString;
934
967
  updatedAt: z.ZodString;
935
968
  intent: z.ZodLiteral<"CLOSE">;
@@ -1093,6 +1126,10 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
1093
1126
  fee: z.ZodOptional<z.ZodString>;
1094
1127
  timestamp: z.ZodString;
1095
1128
  }, z.core.$strip>>>;
1129
+ bracketType: z.ZodOptional<z.ZodEnum<{
1130
+ STOP_LOSS: "STOP_LOSS";
1131
+ TAKE_PROFIT: "TAKE_PROFIT";
1132
+ }>>;
1096
1133
  createdAt: z.ZodString;
1097
1134
  updatedAt: z.ZodString;
1098
1135
  intent: z.ZodLiteral<"OPEN">;
@@ -1235,6 +1272,10 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
1235
1272
  fee: z.ZodOptional<z.ZodString>;
1236
1273
  timestamp: z.ZodString;
1237
1274
  }, z.core.$strip>>>;
1275
+ bracketType: z.ZodOptional<z.ZodEnum<{
1276
+ STOP_LOSS: "STOP_LOSS";
1277
+ TAKE_PROFIT: "TAKE_PROFIT";
1278
+ }>>;
1238
1279
  createdAt: z.ZodString;
1239
1280
  updatedAt: z.ZodString;
1240
1281
  intent: z.ZodLiteral<"ADJUST">;
@@ -1422,6 +1463,10 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
1422
1463
  fee: z.ZodOptional<z.ZodString>;
1423
1464
  timestamp: z.ZodString;
1424
1465
  }, z.core.$strip>>>;
1466
+ bracketType: z.ZodOptional<z.ZodEnum<{
1467
+ STOP_LOSS: "STOP_LOSS";
1468
+ TAKE_PROFIT: "TAKE_PROFIT";
1469
+ }>>;
1425
1470
  createdAt: z.ZodString;
1426
1471
  updatedAt: z.ZodString;
1427
1472
  intent: z.ZodLiteral<"CLOSE">;
@@ -7,6 +7,7 @@ import { TriggerConditionOpen, TriggerConditionAdjust, TriggerConditionClose } f
7
7
  const TriggerIntent = z.enum(["OPEN", "CLOSE"]);
8
8
  const TriggerStatus = z.enum(["ACTIVE", "TRIGGERED", "CANCELLED"]);
9
9
  const TriggerCancelledReason = z.enum(["POSITION_CLOSED", "USER", "SYSTEM"]);
10
+ const BracketType = z.enum(["STOP_LOSS", "TAKE_PROFIT"]);
10
11
  const BaseTrigger = z.object({
11
12
  /**
12
13
  * Trigger UUID
@@ -40,6 +41,10 @@ const BaseTrigger = z.object({
40
41
  * Fills for the trigger
41
42
  */
42
43
  fills: z.array(Fill).optional(),
44
+ /**
45
+ * Optional: bracket type for CLOSE triggers (stop loss / take profit)
46
+ */
47
+ bracketType: BracketType.optional(),
43
48
  /**
44
49
  * Created at timestamp
45
50
  */
@@ -120,4 +125,4 @@ const TriggerMarket = z.discriminatedUnion("intent", [
120
125
  ]);
121
126
  const Trigger = z.discriminatedUnion("type", [TriggerMarket]);
122
127
 
123
- export { Trigger, TriggerCancelledReason, TriggerIntent, TriggerMarket, TriggerMarketAdjust, TriggerMarketClose, TriggerMarketOpen, TriggerStatus };
128
+ export { BracketType, Trigger, TriggerCancelledReason, TriggerIntent, TriggerMarket, TriggerMarketAdjust, TriggerMarketClose, TriggerMarketOpen, TriggerStatus };
@@ -208,6 +208,10 @@ export declare const CreateTriggerMarketClose: z.ZodObject<{
208
208
  }, z.core.$strip>;
209
209
  }, z.core.$strip>], "type">;
210
210
  positionId: z.ZodUUID;
211
+ bracketType: z.ZodOptional<z.ZodEnum<{
212
+ STOP_LOSS: "STOP_LOSS";
213
+ TAKE_PROFIT: "TAKE_PROFIT";
214
+ }>>;
211
215
  }, z.core.$strip>;
212
216
  export declare const AttachTriggerMarketClose: z.ZodObject<{
213
217
  intent: z.ZodLiteral<"CLOSE">;
@@ -252,6 +256,10 @@ export declare const AttachTriggerMarketClose: z.ZodObject<{
252
256
  threshold_bps: z.ZodNumber;
253
257
  }, z.core.$strip>;
254
258
  }, z.core.$strip>], "type">;
259
+ bracketType: z.ZodOptional<z.ZodEnum<{
260
+ STOP_LOSS: "STOP_LOSS";
261
+ TAKE_PROFIT: "TAKE_PROFIT";
262
+ }>>;
255
263
  }, z.core.$strip>;
256
264
  export declare const CreateTriggerOpen: z.ZodDiscriminatedUnion<[z.ZodObject<{
257
265
  intent: z.ZodLiteral<"OPEN">;
@@ -462,6 +470,10 @@ export declare const CreateTriggerClose: z.ZodDiscriminatedUnion<[z.ZodObject<{
462
470
  }, z.core.$strip>;
463
471
  }, z.core.$strip>], "type">;
464
472
  positionId: z.ZodUUID;
473
+ bracketType: z.ZodOptional<z.ZodEnum<{
474
+ STOP_LOSS: "STOP_LOSS";
475
+ TAKE_PROFIT: "TAKE_PROFIT";
476
+ }>>;
465
477
  }, z.core.$strip>], "type">;
466
478
  export type CreateTriggerMarketOpen = z.output<typeof CreateTriggerMarketOpen>;
467
479
  export type CreateTriggerMarketClose = z.output<typeof CreateTriggerMarketClose>;
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { RefineMinimumOneSymbol, RefineUniqueSymbols } from '../../common/refinement';
3
3
  import { TradeLegPostOnly } from '../../common/trade-legs';
4
+ import { BracketType } from '../entities';
4
5
  import { CreateTriggerConditionOpen, CreateTriggerConditionClose, CreateTriggerConditionAttach } from './conditions';
5
6
 
6
7
  const CreateTriggerMarketOpen = z.object({
@@ -31,7 +32,11 @@ const CreateTriggerMarketClose = z.object({
31
32
  /**
32
33
  * Position UUID
33
34
  */
34
- positionId: z.uuid()
35
+ positionId: z.uuid(),
36
+ /**
37
+ * Optional: bracket type (stop loss / take profit)
38
+ */
39
+ bracketType: BracketType.optional()
35
40
  });
36
41
  const AttachTriggerMarketClose = z.object({
37
42
  intent: z.literal("CLOSE"),
@@ -39,7 +44,11 @@ const AttachTriggerMarketClose = z.object({
39
44
  /**
40
45
  * Condition to fire the trigger
41
46
  */
42
- condition: CreateTriggerConditionAttach
47
+ condition: CreateTriggerConditionAttach,
48
+ /**
49
+ * Optional: bracket type (stop loss / take profit)
50
+ */
51
+ bracketType: BracketType.optional()
43
52
  });
44
53
  const CreateTriggerOpen = z.discriminatedUnion("type", [CreateTriggerMarketOpen]);
45
54
  const CreateTriggerClose = z.discriminatedUnion("type", [CreateTriggerMarketClose]);
@@ -46,6 +46,10 @@ export declare const TriggerListResponse: z.ZodObject<{
46
46
  fee: z.ZodOptional<z.ZodString>;
47
47
  timestamp: z.ZodString;
48
48
  }, z.core.$strip>>>;
49
+ bracketType: z.ZodOptional<z.ZodEnum<{
50
+ STOP_LOSS: "STOP_LOSS";
51
+ TAKE_PROFIT: "TAKE_PROFIT";
52
+ }>>;
49
53
  createdAt: z.ZodString;
50
54
  updatedAt: z.ZodString;
51
55
  intent: z.ZodLiteral<"OPEN">;
@@ -188,6 +192,10 @@ export declare const TriggerListResponse: z.ZodObject<{
188
192
  fee: z.ZodOptional<z.ZodString>;
189
193
  timestamp: z.ZodString;
190
194
  }, z.core.$strip>>>;
195
+ bracketType: z.ZodOptional<z.ZodEnum<{
196
+ STOP_LOSS: "STOP_LOSS";
197
+ TAKE_PROFIT: "TAKE_PROFIT";
198
+ }>>;
191
199
  createdAt: z.ZodString;
192
200
  updatedAt: z.ZodString;
193
201
  intent: z.ZodLiteral<"ADJUST">;
@@ -375,6 +383,10 @@ export declare const TriggerListResponse: z.ZodObject<{
375
383
  fee: z.ZodOptional<z.ZodString>;
376
384
  timestamp: z.ZodString;
377
385
  }, z.core.$strip>>>;
386
+ bracketType: z.ZodOptional<z.ZodEnum<{
387
+ STOP_LOSS: "STOP_LOSS";
388
+ TAKE_PROFIT: "TAKE_PROFIT";
389
+ }>>;
378
390
  createdAt: z.ZodString;
379
391
  updatedAt: z.ZodString;
380
392
  intent: z.ZodLiteral<"CLOSE">;
@@ -541,6 +553,10 @@ export declare const CreateTriggerResponse: z.ZodObject<{
541
553
  fee: z.ZodOptional<z.ZodString>;
542
554
  timestamp: z.ZodString;
543
555
  }, z.core.$strip>>>;
556
+ bracketType: z.ZodOptional<z.ZodEnum<{
557
+ STOP_LOSS: "STOP_LOSS";
558
+ TAKE_PROFIT: "TAKE_PROFIT";
559
+ }>>;
544
560
  createdAt: z.ZodString;
545
561
  updatedAt: z.ZodString;
546
562
  intent: z.ZodLiteral<"OPEN">;
@@ -683,6 +699,10 @@ export declare const CreateTriggerResponse: z.ZodObject<{
683
699
  fee: z.ZodOptional<z.ZodString>;
684
700
  timestamp: z.ZodString;
685
701
  }, z.core.$strip>>>;
702
+ bracketType: z.ZodOptional<z.ZodEnum<{
703
+ STOP_LOSS: "STOP_LOSS";
704
+ TAKE_PROFIT: "TAKE_PROFIT";
705
+ }>>;
686
706
  createdAt: z.ZodString;
687
707
  updatedAt: z.ZodString;
688
708
  intent: z.ZodLiteral<"ADJUST">;
@@ -870,6 +890,10 @@ export declare const CreateTriggerResponse: z.ZodObject<{
870
890
  fee: z.ZodOptional<z.ZodString>;
871
891
  timestamp: z.ZodString;
872
892
  }, z.core.$strip>>>;
893
+ bracketType: z.ZodOptional<z.ZodEnum<{
894
+ STOP_LOSS: "STOP_LOSS";
895
+ TAKE_PROFIT: "TAKE_PROFIT";
896
+ }>>;
873
897
  createdAt: z.ZodString;
874
898
  updatedAt: z.ZodString;
875
899
  intent: z.ZodLiteral<"CLOSE">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/types",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Pear Protocol Types definitions",
5
5
  "private": false,
6
6
  "type": "module",