@pear-protocol/types 0.0.19 → 0.0.21

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
@@ -11,6 +11,7 @@ export * from './misc';
11
11
  export * from './order';
12
12
  export * from './position';
13
13
  export * from './price';
14
+ export * from './rebalance';
14
15
  export * from './schedule';
15
16
  export * from './statistics';
16
17
  export * from './sync';
package/dist/bundle.js CHANGED
@@ -11,6 +11,7 @@ export * from './misc';
11
11
  export * from './order';
12
12
  export * from './position';
13
13
  export * from './price';
14
+ export * from './rebalance';
14
15
  export * from './schedule';
15
16
  export * from './statistics';
16
17
  export * from './sync';
@@ -7,6 +7,23 @@ export declare const InstrumentType: z.ZodEnum<{
7
7
  hip3: "hip3";
8
8
  }>;
9
9
  export type InstrumentType = z.infer<typeof InstrumentType>;
10
+ export declare const InstrumentTradeabilityStatus: z.ZodEnum<{
11
+ tradable: "tradable";
12
+ reduce_only: "reduce_only";
13
+ not_tradable: "not_tradable";
14
+ }>;
15
+ export type InstrumentTradeabilityStatus = z.infer<typeof InstrumentTradeabilityStatus>;
16
+ export declare const InstrumentTradeabilityReason: z.ZodNullable<z.ZodString>;
17
+ export type InstrumentTradeabilityReason = z.infer<typeof InstrumentTradeabilityReason>;
18
+ export declare const InstrumentTradeability: z.ZodObject<{
19
+ status: z.ZodEnum<{
20
+ tradable: "tradable";
21
+ reduce_only: "reduce_only";
22
+ not_tradable: "not_tradable";
23
+ }>;
24
+ reason: z.ZodNullable<z.ZodString>;
25
+ }, z.core.$strip>;
26
+ export type InstrumentTradeability = z.output<typeof InstrumentTradeability>;
10
27
  export declare const Instrument: z.ZodObject<{
11
28
  id: z.ZodString;
12
29
  base: z.ZodString;
@@ -40,5 +57,13 @@ export declare const Instrument: z.ZodObject<{
40
57
  max: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>>;
41
58
  }, z.core.$strip>>;
42
59
  }, z.core.$strip>;
60
+ tradeability: z.ZodObject<{
61
+ status: z.ZodEnum<{
62
+ tradable: "tradable";
63
+ reduce_only: "reduce_only";
64
+ not_tradable: "not_tradable";
65
+ }>;
66
+ reason: z.ZodNullable<z.ZodString>;
67
+ }, z.core.$strip>;
43
68
  }, z.core.$strip>;
44
69
  export type Instrument = z.output<typeof Instrument>;
@@ -4,6 +4,12 @@ import { InstrumentPrecision } from '../instrument-precision';
4
4
 
5
5
  const InstrumentId = z.string().trim().min(1, "Instrument ID is required").max(64, "Instrument ID must be at most 64 characters").regex(/^[^\s][^\s]*$/, "Instrument ID contains invalid characters");
6
6
  const InstrumentType = z.enum(["spot", "perp", "hip3"]);
7
+ const InstrumentTradeabilityStatus = z.enum(["tradable", "reduce_only", "not_tradable"]);
8
+ const InstrumentTradeabilityReason = z.string().nullable();
9
+ const InstrumentTradeability = z.object({
10
+ status: InstrumentTradeabilityStatus,
11
+ reason: InstrumentTradeabilityReason
12
+ });
7
13
  const Instrument = z.object({
8
14
  /**
9
15
  * Exchange specific instrument identifier
@@ -42,7 +48,11 @@ const Instrument = z.object({
42
48
  /**
43
49
  * The precision of the instrument.
44
50
  */
45
- precision: InstrumentPrecision
51
+ precision: InstrumentPrecision,
52
+ /**
53
+ * Whether this instrument can be traded normally.
54
+ */
55
+ tradeability: InstrumentTradeability
46
56
  });
47
57
 
48
- export { Instrument, InstrumentId, InstrumentType };
58
+ export { Instrument, InstrumentId, InstrumentTradeability, InstrumentTradeabilityReason, InstrumentTradeabilityStatus, InstrumentType };
@@ -1,4 +1,11 @@
1
1
  import { z } from 'zod';
2
+ export declare const InstrumentScope: z.ZodEnum<{
3
+ tradable: "tradable";
4
+ reduce_only: "reduce_only";
5
+ not_tradable: "not_tradable";
6
+ all: "all";
7
+ }>;
8
+ export type InstrumentScope = z.infer<typeof InstrumentScope>;
2
9
  export declare const InstrumentListParams: z.ZodObject<{
3
10
  connector: z.ZodEnum<{
4
11
  hyperliquid: "hyperliquid";
@@ -7,5 +14,12 @@ export declare const InstrumentListParams: z.ZodObject<{
7
14
  okx: "okx";
8
15
  lighter: "lighter";
9
16
  }>;
17
+ scope: z.ZodDefault<z.ZodEnum<{
18
+ tradable: "tradable";
19
+ reduce_only: "reduce_only";
20
+ not_tradable: "not_tradable";
21
+ all: "all";
22
+ }>>;
10
23
  }, z.core.$strip>;
24
+ export type InstrumentListParamsInput = z.input<typeof InstrumentListParams>;
11
25
  export type InstrumentListParams = z.output<typeof InstrumentListParams>;
@@ -1,8 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  import { Connector } from '../connector';
3
3
 
4
+ const InstrumentScope = z.enum(["tradable", "reduce_only", "not_tradable", "all"]);
4
5
  const InstrumentListParams = z.object({
5
- connector: Connector
6
+ connector: Connector,
7
+ scope: InstrumentScope.default("all")
6
8
  });
7
9
 
8
- export { InstrumentListParams };
10
+ export { InstrumentListParams, InstrumentScope };
@@ -33,6 +33,14 @@ export declare const InstrumentListResponse: z.ZodObject<{
33
33
  max: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>>;
34
34
  }, z.core.$strip>>;
35
35
  }, z.core.$strip>;
36
+ tradeability: z.ZodObject<{
37
+ status: z.ZodEnum<{
38
+ tradable: "tradable";
39
+ reduce_only: "reduce_only";
40
+ not_tradable: "not_tradable";
41
+ }>;
42
+ reason: z.ZodNullable<z.ZodString>;
43
+ }, z.core.$strip>;
36
44
  }, z.core.$strip>>;
37
45
  }, z.core.$strip>;
38
46
  export type InstrumentListResponse = z.output<typeof InstrumentListResponse>;
@@ -0,0 +1,2 @@
1
+ export * from './payloads';
2
+ export * from './responses';
@@ -0,0 +1,2 @@
1
+ export * from './payloads';
2
+ export * from './responses';
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ export declare const RebalanceManually: z.ZodObject<{
3
+ orderType: z.ZodEnum<{
4
+ MARKET: "MARKET";
5
+ }>;
6
+ weightings: z.ZodArray<z.ZodObject<{
7
+ symbol: z.ZodString;
8
+ weight: z.ZodNumber;
9
+ }, z.core.$strip>>;
10
+ }, z.core.$strip>;
11
+ export type RebalanceManually = z.output<typeof RebalanceManually>;
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { RefineWeightingSum, RefineUniqueSymbols } from '../common/refinement';
3
+ import { ExecutionOrderType } from '../execution';
4
+ import { InstrumentId } from '../instrument';
5
+
6
+ const RebalanceManually = z.object({
7
+ orderType: ExecutionOrderType,
8
+ weightings: z.array(
9
+ z.object({
10
+ symbol: InstrumentId,
11
+ weight: z.number().positive({ message: "Weight must be greater than 0" }).max(1, { message: "Weight must be less than 1" })
12
+ })
13
+ ).superRefine(RefineWeightingSum).superRefine(RefineUniqueSymbols).describe("Array of weightings to rebalance the position")
14
+ });
15
+
16
+ export { RebalanceManually };
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ export declare const RebalanceManuallyResponse: z.ZodObject<{
3
+ plan: z.ZodUnion<readonly [z.ZodObject<{
4
+ outcome: z.ZodLiteral<"full_rebalance">;
5
+ }, z.core.$strip>, z.ZodObject<{
6
+ outcome: z.ZodUnion<readonly [z.ZodLiteral<"partial_rebalance">, z.ZodLiteral<"no_rebalance">]>;
7
+ messages: z.ZodTuple<[z.ZodString], z.ZodString>;
8
+ }, z.core.$strip>]>;
9
+ }, z.core.$strip>;
10
+ export type RebalanceManuallyResponse = z.output<typeof RebalanceManuallyResponse>;
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+
3
+ const RebalanceManuallyResponse = z.object({
4
+ plan: z.union([
5
+ z.object({
6
+ outcome: z.literal("full_rebalance")
7
+ }),
8
+ z.object({
9
+ outcome: z.union([z.literal("partial_rebalance"), z.literal("no_rebalance")]),
10
+ messages: z.tuple([z.string()]).rest(z.string())
11
+ })
12
+ ])
13
+ });
14
+
15
+ export { RebalanceManuallyResponse };
@@ -51,11 +51,55 @@ export declare const TradeAccountListResponse: z.ZodObject<{
51
51
  export type TradeAccountListResponse = z.infer<typeof TradeAccountListResponse>;
52
52
  export declare const ExchangeCredentialsResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
53
53
  connector: z.ZodLiteral<"hyperliquid">;
54
+ account: z.ZodObject<{
55
+ id: z.ZodUUID;
56
+ alias: z.ZodString;
57
+ connector: z.ZodEnum<{
58
+ hyperliquid: "hyperliquid";
59
+ binance: "binance";
60
+ bybit: "bybit";
61
+ okx: "okx";
62
+ lighter: "lighter";
63
+ }>;
64
+ exchangeIdentifier: z.ZodString;
65
+ metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
66
+ agentWalletAddress: z.ZodString;
67
+ isSubaccount: z.ZodBoolean;
68
+ mainAccountAddress: z.ZodString;
69
+ }, z.core.$strip>, z.ZodObject<{
70
+ l1_address: z.ZodString;
71
+ }, z.core.$strip>]>>;
72
+ createdAt: z.ZodString;
73
+ updatedAt: z.ZodString;
74
+ deletedAt: z.ZodOptional<z.ZodString>;
75
+ }, z.core.$strip>;
54
76
  credentials: z.ZodObject<{
55
77
  signer_key: z.ZodString;
56
78
  }, z.core.$strip>;
57
79
  }, z.core.$strip>, z.ZodObject<{
58
80
  connector: z.ZodLiteral<"binance">;
81
+ account: z.ZodObject<{
82
+ id: z.ZodUUID;
83
+ alias: z.ZodString;
84
+ connector: z.ZodEnum<{
85
+ hyperliquid: "hyperliquid";
86
+ binance: "binance";
87
+ bybit: "bybit";
88
+ okx: "okx";
89
+ lighter: "lighter";
90
+ }>;
91
+ exchangeIdentifier: z.ZodString;
92
+ metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
93
+ agentWalletAddress: z.ZodString;
94
+ isSubaccount: z.ZodBoolean;
95
+ mainAccountAddress: z.ZodString;
96
+ }, z.core.$strip>, z.ZodObject<{
97
+ l1_address: z.ZodString;
98
+ }, z.core.$strip>]>>;
99
+ createdAt: z.ZodString;
100
+ updatedAt: z.ZodString;
101
+ deletedAt: z.ZodOptional<z.ZodString>;
102
+ }, z.core.$strip>;
59
103
  credentials: z.ZodObject<{
60
104
  read: z.ZodObject<{
61
105
  api_key: z.ZodString;
@@ -68,12 +112,56 @@ export declare const ExchangeCredentialsResponse: z.ZodDiscriminatedUnion<[z.Zod
68
112
  }, z.core.$strip>;
69
113
  }, z.core.$strip>, z.ZodObject<{
70
114
  connector: z.ZodLiteral<"bybit">;
115
+ account: z.ZodObject<{
116
+ id: z.ZodUUID;
117
+ alias: z.ZodString;
118
+ connector: z.ZodEnum<{
119
+ hyperliquid: "hyperliquid";
120
+ binance: "binance";
121
+ bybit: "bybit";
122
+ okx: "okx";
123
+ lighter: "lighter";
124
+ }>;
125
+ exchangeIdentifier: z.ZodString;
126
+ metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
127
+ agentWalletAddress: z.ZodString;
128
+ isSubaccount: z.ZodBoolean;
129
+ mainAccountAddress: z.ZodString;
130
+ }, z.core.$strip>, z.ZodObject<{
131
+ l1_address: z.ZodString;
132
+ }, z.core.$strip>]>>;
133
+ createdAt: z.ZodString;
134
+ updatedAt: z.ZodString;
135
+ deletedAt: z.ZodOptional<z.ZodString>;
136
+ }, z.core.$strip>;
71
137
  credentials: z.ZodObject<{
72
138
  api_key: z.ZodString;
73
139
  api_secret: z.ZodString;
74
140
  }, z.core.$strip>;
75
141
  }, z.core.$strip>, z.ZodObject<{
76
142
  connector: z.ZodLiteral<"okx">;
143
+ account: z.ZodObject<{
144
+ id: z.ZodUUID;
145
+ alias: z.ZodString;
146
+ connector: z.ZodEnum<{
147
+ hyperliquid: "hyperliquid";
148
+ binance: "binance";
149
+ bybit: "bybit";
150
+ okx: "okx";
151
+ lighter: "lighter";
152
+ }>;
153
+ exchangeIdentifier: z.ZodString;
154
+ metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
155
+ agentWalletAddress: z.ZodString;
156
+ isSubaccount: z.ZodBoolean;
157
+ mainAccountAddress: z.ZodString;
158
+ }, z.core.$strip>, z.ZodObject<{
159
+ l1_address: z.ZodString;
160
+ }, z.core.$strip>]>>;
161
+ createdAt: z.ZodString;
162
+ updatedAt: z.ZodString;
163
+ deletedAt: z.ZodOptional<z.ZodString>;
164
+ }, z.core.$strip>;
77
165
  credentials: z.ZodObject<{
78
166
  api_key: z.ZodString;
79
167
  api_secret: z.ZodString;
@@ -81,6 +169,28 @@ export declare const ExchangeCredentialsResponse: z.ZodDiscriminatedUnion<[z.Zod
81
169
  }, z.core.$strip>;
82
170
  }, z.core.$strip>, z.ZodObject<{
83
171
  connector: z.ZodLiteral<"lighter">;
172
+ account: z.ZodObject<{
173
+ id: z.ZodUUID;
174
+ alias: z.ZodString;
175
+ connector: z.ZodEnum<{
176
+ hyperliquid: "hyperliquid";
177
+ binance: "binance";
178
+ bybit: "bybit";
179
+ okx: "okx";
180
+ lighter: "lighter";
181
+ }>;
182
+ exchangeIdentifier: z.ZodString;
183
+ metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
184
+ agentWalletAddress: z.ZodString;
185
+ isSubaccount: z.ZodBoolean;
186
+ mainAccountAddress: z.ZodString;
187
+ }, z.core.$strip>, z.ZodObject<{
188
+ l1_address: z.ZodString;
189
+ }, z.core.$strip>]>>;
190
+ createdAt: z.ZodString;
191
+ updatedAt: z.ZodString;
192
+ deletedAt: z.ZodOptional<z.ZodString>;
193
+ }, z.core.$strip>;
84
194
  credentials: z.ZodObject<{
85
195
  api_private_key: z.ZodString;
86
196
  api_key_index: z.ZodNumber;
@@ -5,6 +5,7 @@ const TradeAccountResponse = z.object({ account: TradeAccount });
5
5
  const TradeAccountListResponse = z.object({ accounts: z.array(TradeAccount) });
6
6
  const HyperliquidCredentialsResponse = z.object({
7
7
  connector: z.literal("hyperliquid"),
8
+ account: TradeAccount,
8
9
  credentials: z.object({
9
10
  signer_key: z.string()
10
11
  })
@@ -15,6 +16,7 @@ const BinanceApiKeyPairResponse = z.object({
15
16
  });
16
17
  const BinanceCredentialsResponse = z.object({
17
18
  connector: z.literal("binance"),
19
+ account: TradeAccount,
18
20
  credentials: z.object({
19
21
  read: BinanceApiKeyPairResponse,
20
22
  write: BinanceApiKeyPairResponse
@@ -22,6 +24,7 @@ const BinanceCredentialsResponse = z.object({
22
24
  });
23
25
  const BybitCredentialsResponse = z.object({
24
26
  connector: z.literal("bybit"),
27
+ account: TradeAccount,
25
28
  credentials: z.object({
26
29
  api_key: z.string(),
27
30
  api_secret: z.string()
@@ -29,6 +32,7 @@ const BybitCredentialsResponse = z.object({
29
32
  });
30
33
  const OkxCredentialsResponse = z.object({
31
34
  connector: z.literal("okx"),
35
+ account: TradeAccount,
32
36
  credentials: z.object({
33
37
  api_key: z.string(),
34
38
  api_secret: z.string(),
@@ -37,6 +41,7 @@ const OkxCredentialsResponse = z.object({
37
41
  });
38
42
  const LighterCredentialsResponse = z.object({
39
43
  connector: z.literal("lighter"),
44
+ account: TradeAccount,
40
45
  credentials: z.object({
41
46
  api_private_key: z.string(),
42
47
  api_key_index: z.number()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/types",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "Pear Protocol Types definitions",
5
5
  "private": false,
6
6
  "type": "module",