@pear-protocol/types 0.0.1 → 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<{
@@ -3,28 +3,9 @@ import { z } from 'zod';
3
3
  * Hyperliquid connector metadata
4
4
  */
5
5
  declare const HyperliquidMetadata: z.ZodObject<{
6
- address: z.ZodString;
6
+ agentWalletAddress: z.ZodString;
7
7
  isSubaccount: z.ZodBoolean;
8
8
  }, z.core.$strip>;
9
- /**
10
- * Binance USDM connector metadata (empty for now)
11
- */
12
- declare const BinanceUSDMMetadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
13
- /**
14
- * Bybit connector metadata (empty for now)
15
- */
16
- declare const BybitMetadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
17
- /**
18
- * OKX connector metadata (empty for now)
19
- */
20
- declare const OkxMetadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
21
- /**
22
- * Union of all connector metadata schemas
23
- */
24
- declare const ConnectorMetadata: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
25
- address: z.ZodString;
26
- isSubaccount: z.ZodBoolean;
27
- }, z.core.$strip>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>]>>;
28
9
  export declare const TradeAccount: z.ZodObject<{
29
10
  id: z.ZodUUID;
30
11
  alias: z.ZodString;
@@ -34,17 +15,14 @@ export declare const TradeAccount: z.ZodObject<{
34
15
  bybit: "bybit";
35
16
  okx: "okx";
36
17
  }>;
37
- metadata: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
38
- address: z.ZodString;
18
+ exchangeIdentifier: z.ZodString;
19
+ metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
20
+ agentWalletAddress: z.ZodString;
39
21
  isSubaccount: z.ZodBoolean;
40
- }, z.core.$strip>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>]>>;
22
+ }, z.core.$strip>]>>;
41
23
  createdAt: z.ZodString;
42
24
  updatedAt: z.ZodString;
43
25
  }, z.core.$strip>;
44
26
  export type TradeAccount = z.infer<typeof TradeAccount>;
45
27
  export type HyperliquidMetadata = z.infer<typeof HyperliquidMetadata>;
46
- export type BinanceUSDMMetadata = z.infer<typeof BinanceUSDMMetadata>;
47
- export type BybitMetadata = z.infer<typeof BybitMetadata>;
48
- export type OkxMetadata = z.infer<typeof OkxMetadata>;
49
- export type ConnectorMetadata = z.infer<typeof ConnectorMetadata>;
50
28
  export {};
@@ -1,15 +1,16 @@
1
1
  import { z } from 'zod';
2
2
  import { Connector } from '../connector';
3
3
 
4
- const HyperliquidMetadata = z.object({ address: z.string(), isSubaccount: z.boolean() });
5
- const BinanceUSDMMetadata = z.object({}).optional();
6
- const BybitMetadata = z.object({}).optional();
7
- const OkxMetadata = z.object({}).optional();
8
- const ConnectorMetadata = z.union([HyperliquidMetadata, BinanceUSDMMetadata, BybitMetadata, OkxMetadata]).nullable();
4
+ const HyperliquidMetadata = z.object({
5
+ agentWalletAddress: z.string(),
6
+ isSubaccount: z.boolean()
7
+ });
8
+ const ConnectorMetadata = z.union([HyperliquidMetadata]).optional();
9
9
  const TradeAccount = z.object({
10
10
  id: z.uuid().describe("Trade account UUID"),
11
11
  alias: z.string().describe("User-defined trade account alias"),
12
12
  connector: Connector.describe("Exchange connector type"),
13
+ exchangeIdentifier: z.string().describe("User identifier on the exchange"),
13
14
  metadata: ConnectorMetadata.describe("Connector-specific metadata"),
14
15
  createdAt: z.string().describe("Creation timestamp (ISO 8601)"),
15
16
  updatedAt: z.string().describe("Last update timestamp (ISO 8601)")
@@ -1,3 +1,4 @@
1
1
  export * from './entities';
2
2
  export * from './payloads';
3
+ export * from './queries';
3
4
  export * from './response';
@@ -1,3 +1,4 @@
1
1
  export * from './entities';
2
2
  export * from './payloads';
3
+ export * from './queries';
3
4
  export * from './response';
@@ -9,7 +9,7 @@ declare const CreateHyperliquidCredentials: z.ZodObject<{
9
9
  * Hyperliquid connector metadata
10
10
  */
11
11
  declare const CreateHyperliquidMetadata: z.ZodObject<{
12
- address: z.ZodString;
12
+ agentWalletAddress: z.ZodString;
13
13
  isSubaccount: z.ZodBoolean;
14
14
  }, z.core.$strip>;
15
15
  /**
@@ -19,10 +19,6 @@ declare const CreateBinanceUSDMCredentials: z.ZodObject<{
19
19
  api_key: z.ZodString;
20
20
  api_secret: z.ZodString;
21
21
  }, z.core.$strip>;
22
- /**
23
- * Binance USDM connector metadata (empty for now)
24
- */
25
- declare const CreateBinanceUSDMMetadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
26
22
  /**
27
23
  * Bybit connector credentials
28
24
  */
@@ -30,10 +26,6 @@ declare const CreateBybitCredentials: z.ZodObject<{
30
26
  api_key: z.ZodString;
31
27
  api_secret: z.ZodString;
32
28
  }, z.core.$strip>;
33
- /**
34
- * Bybit connector metadata (empty for now)
35
- */
36
- declare const CreateBybitMetadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
37
29
  /**
38
30
  * OKX connector credentials
39
31
  */
@@ -42,21 +34,18 @@ declare const CreateOkxCredentials: z.ZodObject<{
42
34
  api_secret: z.ZodString;
43
35
  api_pass: z.ZodString;
44
36
  }, z.core.$strip>;
45
- /**
46
- * OKX connector metadata (empty for now)
47
- */
48
- declare const CreateOkxMetadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
49
37
  /**
50
38
  * Payload to create a new trade account
51
39
  */
52
40
  export declare const CreateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
53
41
  connector: z.ZodLiteral<"hyperliquid">;
54
42
  alias: z.ZodString;
43
+ exchangeIdentifier: z.ZodString;
55
44
  credentials: z.ZodObject<{
56
45
  signer_key: z.ZodString;
57
46
  }, z.core.$strip>;
58
47
  metadata: z.ZodObject<{
59
- address: z.ZodString;
48
+ agentWalletAddress: z.ZodString;
60
49
  isSubaccount: z.ZodBoolean;
61
50
  }, z.core.$strip>;
62
51
  }, z.core.$strip>, z.ZodObject<{
@@ -66,7 +55,7 @@ export declare const CreateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
66
55
  api_key: z.ZodString;
67
56
  api_secret: z.ZodString;
68
57
  }, z.core.$strip>;
69
- metadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
58
+ metadata: z.ZodPipe<z.ZodVoid, z.ZodTransform<undefined, void>>;
70
59
  }, z.core.$strip>, z.ZodObject<{
71
60
  connector: z.ZodLiteral<"bybit">;
72
61
  alias: z.ZodString;
@@ -74,7 +63,7 @@ export declare const CreateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
74
63
  api_key: z.ZodString;
75
64
  api_secret: z.ZodString;
76
65
  }, z.core.$strip>;
77
- metadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
66
+ metadata: z.ZodPipe<z.ZodVoid, z.ZodTransform<undefined, void>>;
78
67
  }, z.core.$strip>, z.ZodObject<{
79
68
  connector: z.ZodLiteral<"okx">;
80
69
  alias: z.ZodString;
@@ -83,10 +72,10 @@ export declare const CreateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
83
72
  api_secret: z.ZodString;
84
73
  api_pass: z.ZodString;
85
74
  }, z.core.$strip>;
86
- metadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
75
+ metadata: z.ZodPipe<z.ZodVoid, z.ZodTransform<undefined, void>>;
87
76
  }, z.core.$strip>], "connector">;
88
77
  /**
89
- * Payload to update a trade account for a specific connector.
78
+ * Payload to update a trade account
90
79
  */
91
80
  export declare const UpdateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
92
81
  connector: z.ZodLiteral<"hyperliquid">;
@@ -95,7 +84,7 @@ export declare const UpdateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
95
84
  signer_key: z.ZodString;
96
85
  }, z.core.$strip>>;
97
86
  metadata: z.ZodOptional<z.ZodObject<{
98
- address: z.ZodString;
87
+ agentWalletAddress: z.ZodString;
99
88
  isSubaccount: z.ZodBoolean;
100
89
  }, z.core.$strip>>;
101
90
  }, z.core.$strip>, z.ZodObject<{
@@ -105,7 +94,7 @@ export declare const UpdateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
105
94
  api_key: z.ZodString;
106
95
  api_secret: z.ZodString;
107
96
  }, z.core.$strip>>;
108
- metadata: z.ZodOptional<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>>;
97
+ metadata: z.ZodPipe<z.ZodVoid, z.ZodTransform<undefined, void>>;
109
98
  }, z.core.$strip>, z.ZodObject<{
110
99
  connector: z.ZodLiteral<"bybit">;
111
100
  alias: z.ZodOptional<z.ZodString>;
@@ -113,7 +102,7 @@ export declare const UpdateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
113
102
  api_key: z.ZodString;
114
103
  api_secret: z.ZodString;
115
104
  }, z.core.$strip>>;
116
- metadata: z.ZodOptional<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>>;
105
+ metadata: z.ZodPipe<z.ZodVoid, z.ZodTransform<undefined, void>>;
117
106
  }, z.core.$strip>, z.ZodObject<{
118
107
  connector: z.ZodLiteral<"okx">;
119
108
  alias: z.ZodOptional<z.ZodString>;
@@ -122,16 +111,15 @@ export declare const UpdateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
122
111
  api_secret: z.ZodString;
123
112
  api_pass: z.ZodString;
124
113
  }, z.core.$strip>>;
125
- metadata: z.ZodOptional<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>>;
114
+ metadata: z.ZodPipe<z.ZodVoid, z.ZodTransform<undefined, void>>;
126
115
  }, z.core.$strip>], "connector">;
127
116
  export type CreateHyperliquidCredentials = z.infer<typeof CreateHyperliquidCredentials>;
128
117
  export type CreateHyperliquidMetadata = z.infer<typeof CreateHyperliquidMetadata>;
129
- export type CreateBinanceUSDMMetadata = z.infer<typeof CreateBinanceUSDMMetadata>;
130
118
  export type CreateBinanceUSDMCredentials = z.infer<typeof CreateBinanceUSDMCredentials>;
131
119
  export type CreateBybitCredentials = z.infer<typeof CreateBybitCredentials>;
132
- export type CreateBybitMetadata = z.infer<typeof CreateBybitMetadata>;
133
120
  export type CreateOkxCredentials = z.infer<typeof CreateOkxCredentials>;
134
- export type CreateOkxMetadata = z.infer<typeof CreateOkxMetadata>;
135
- export type CreateTradeAccount = z.infer<typeof CreateTradeAccount>;
136
- export type UpdateTradeAccount = z.infer<typeof UpdateTradeAccount>;
121
+ export type CreateTradeAccountInput = z.input<typeof CreateTradeAccount>;
122
+ export type CreateTradeAccount = z.output<typeof CreateTradeAccount>;
123
+ export type UpdateTradeAccountInput = z.input<typeof UpdateTradeAccount>;
124
+ export type UpdateTradeAccount = z.output<typeof UpdateTradeAccount>;
137
125
  export {};
@@ -4,29 +4,27 @@ const CreateHyperliquidCredentials = z.object({
4
4
  signer_key: z.string().min(1, "Signer key is required")
5
5
  });
6
6
  const CreateHyperliquidMetadata = z.object({
7
- address: z.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address"),
7
+ agentWalletAddress: z.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address"),
8
8
  isSubaccount: z.boolean()
9
9
  });
10
10
  const CreateBinanceUSDMCredentials = z.object({
11
11
  api_key: z.string().min(1, "API key is required"),
12
12
  api_secret: z.string().min(1, "API secret is required")
13
13
  });
14
- const CreateBinanceUSDMMetadata = z.object({}).optional();
15
14
  const CreateBybitCredentials = z.object({
16
15
  api_key: z.string().min(1, "API key is required"),
17
16
  api_secret: z.string().min(1, "API secret is required")
18
17
  });
19
- const CreateBybitMetadata = z.object({}).optional();
20
18
  const CreateOkxCredentials = z.object({
21
19
  api_key: z.string().min(1, "API key is required"),
22
20
  api_secret: z.string().min(1, "API secret is required"),
23
21
  api_pass: z.string().min(1, "API passphrase is required")
24
22
  });
25
- const CreateOkxMetadata = z.object({}).optional();
26
23
  const AccountAlias = z.string().min(1, "Alias is required").max(100, "Alias must be 100 characters or less");
27
24
  const CreateHyperliquidAccount = z.object({
28
25
  connector: z.literal("hyperliquid"),
29
26
  alias: AccountAlias,
27
+ exchangeIdentifier: z.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address"),
30
28
  credentials: CreateHyperliquidCredentials,
31
29
  metadata: CreateHyperliquidMetadata
32
30
  });
@@ -34,19 +32,43 @@ const CreateBinanceUSDMAccount = z.object({
34
32
  connector: z.literal("binanceusdm"),
35
33
  alias: AccountAlias,
36
34
  credentials: CreateBinanceUSDMCredentials,
37
- metadata: CreateBinanceUSDMMetadata
35
+ metadata: z.void({}).transform(() => void 0)
38
36
  });
39
37
  const CreateBybitAccount = z.object({
40
38
  connector: z.literal("bybit"),
41
39
  alias: AccountAlias,
42
40
  credentials: CreateBybitCredentials,
43
- metadata: CreateBybitMetadata
41
+ metadata: z.void({}).transform(() => void 0)
44
42
  });
45
43
  const CreateOkxAccount = z.object({
46
44
  connector: z.literal("okx"),
47
45
  alias: AccountAlias,
48
46
  credentials: CreateOkxCredentials,
49
- metadata: CreateOkxMetadata
47
+ metadata: z.void({}).transform(() => void 0)
48
+ });
49
+ const UpdateHyperliquidAccount = z.object({
50
+ connector: z.literal("hyperliquid"),
51
+ alias: AccountAlias.optional(),
52
+ credentials: CreateHyperliquidCredentials.optional(),
53
+ metadata: CreateHyperliquidMetadata.optional()
54
+ });
55
+ const UpdateBinanceUSDMAccount = z.object({
56
+ connector: z.literal("binanceusdm"),
57
+ alias: AccountAlias.optional(),
58
+ credentials: CreateBinanceUSDMCredentials.optional(),
59
+ metadata: z.void({}).transform(() => void 0)
60
+ });
61
+ const UpdateBybitAccount = z.object({
62
+ connector: z.literal("bybit"),
63
+ alias: AccountAlias.optional(),
64
+ credentials: CreateBybitCredentials.optional(),
65
+ metadata: z.void({}).transform(() => void 0)
66
+ });
67
+ const UpdateOkxAccount = z.object({
68
+ connector: z.literal("okx"),
69
+ alias: AccountAlias.optional(),
70
+ credentials: CreateOkxCredentials.optional(),
71
+ metadata: z.void({}).transform(() => void 0)
50
72
  });
51
73
  const CreateTradeAccount = z.discriminatedUnion("connector", [
52
74
  CreateHyperliquidAccount,
@@ -55,30 +77,10 @@ const CreateTradeAccount = z.discriminatedUnion("connector", [
55
77
  CreateOkxAccount
56
78
  ]);
57
79
  const UpdateTradeAccount = z.discriminatedUnion("connector", [
58
- z.object({
59
- connector: z.literal("hyperliquid"),
60
- alias: AccountAlias.optional(),
61
- credentials: CreateHyperliquidCredentials.optional(),
62
- metadata: CreateHyperliquidMetadata.optional()
63
- }),
64
- z.object({
65
- connector: z.literal("binanceusdm"),
66
- alias: AccountAlias.optional(),
67
- credentials: CreateBinanceUSDMCredentials.optional(),
68
- metadata: CreateBinanceUSDMMetadata.optional()
69
- }),
70
- z.object({
71
- connector: z.literal("bybit"),
72
- alias: AccountAlias.optional(),
73
- credentials: CreateBybitCredentials.optional(),
74
- metadata: CreateBybitMetadata.optional()
75
- }),
76
- z.object({
77
- connector: z.literal("okx"),
78
- alias: AccountAlias.optional(),
79
- credentials: CreateOkxCredentials.optional(),
80
- metadata: CreateOkxMetadata.optional()
81
- })
80
+ UpdateHyperliquidAccount,
81
+ UpdateBinanceUSDMAccount,
82
+ UpdateBybitAccount,
83
+ UpdateOkxAccount
82
84
  ]);
83
85
 
84
86
  export { CreateTradeAccount, UpdateTradeAccount };
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ export declare const TradeAccountListParams: z.ZodObject<{
3
+ includeDeleted: z.ZodDefault<z.ZodOptional<z.ZodCoercedBoolean<boolean>>>;
4
+ }, z.core.$strip>;
5
+ export type TradeAccountListParamsInput = z.input<typeof TradeAccountListParams>;
6
+ export type TradeAccountListParams = z.output<typeof TradeAccountListParams>;
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+
3
+ const TradeAccountListParams = z.object({
4
+ includeDeleted: z.coerce.boolean().optional().default(false)
5
+ });
6
+
7
+ export { TradeAccountListParams };
@@ -9,10 +9,11 @@ export declare const TradeAccountResponse: z.ZodObject<{
9
9
  bybit: "bybit";
10
10
  okx: "okx";
11
11
  }>;
12
- metadata: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
13
- address: z.ZodString;
12
+ exchangeIdentifier: z.ZodString;
13
+ metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
14
+ agentWalletAddress: z.ZodString;
14
15
  isSubaccount: z.ZodBoolean;
15
- }, z.core.$strip>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>]>>;
16
+ }, z.core.$strip>]>>;
16
17
  createdAt: z.ZodString;
17
18
  updatedAt: z.ZodString;
18
19
  }, z.core.$strip>;
@@ -28,10 +29,11 @@ export declare const TradeAccountListResponse: z.ZodObject<{
28
29
  bybit: "bybit";
29
30
  okx: "okx";
30
31
  }>;
31
- metadata: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
32
- address: z.ZodString;
32
+ exchangeIdentifier: z.ZodString;
33
+ metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
34
+ agentWalletAddress: z.ZodString;
33
35
  isSubaccount: z.ZodBoolean;
34
- }, z.core.$strip>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>]>>;
36
+ }, z.core.$strip>]>>;
35
37
  createdAt: z.ZodString;
36
38
  updatedAt: z.ZodString;
37
39
  }, z.core.$strip>>;
@@ -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.1",
3
+ "version": "0.0.3",
4
4
  "description": "Pear Protocol Types definitions",
5
5
  "private": false,
6
6
  "type": "module",