@pear-protocol/types 2.17.0 → 2.19.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.
Files changed (43) hide show
  1. package/dist/bundle.d.ts +1 -0
  2. package/dist/bundle.js +1 -0
  3. package/dist/common/refinement.d.ts +0 -1
  4. package/dist/common/refinement.js +1 -9
  5. package/dist/instrument/entities.d.ts +1 -0
  6. package/dist/instrument/responses.d.ts +1 -0
  7. package/dist/instrument-precision/index.d.ts +1 -0
  8. package/dist/instrument-precision/index.js +6 -1
  9. package/dist/realtime/channels.d.ts +19 -0
  10. package/dist/realtime/channels.js +16 -0
  11. package/dist/realtime/frames.d.ts +923 -0
  12. package/dist/realtime/frames.js +140 -0
  13. package/dist/realtime/index.d.ts +6 -0
  14. package/dist/realtime/index.js +6 -0
  15. package/dist/realtime/messages.d.ts +243 -0
  16. package/dist/realtime/messages.js +118 -0
  17. package/dist/realtime/public-events.d.ts +342 -0
  18. package/dist/realtime/public-events.js +92 -0
  19. package/dist/realtime/user-events.d.ts +32 -0
  20. package/dist/realtime/user-events.js +32 -0
  21. package/dist/realtime/vault-events.d.ts +71 -0
  22. package/dist/realtime/vault-events.js +42 -0
  23. package/dist/schedule/entities.d.ts +53 -163
  24. package/dist/schedule/entities.js +62 -3
  25. package/dist/schedule/queries.d.ts +7 -0
  26. package/dist/schedule/queries.js +15 -1
  27. package/dist/schedule/responses.d.ts +150 -115
  28. package/dist/schedule/responses.js +6 -2
  29. package/dist/statistics/entities.d.ts +0 -1
  30. package/dist/statistics/entities.js +0 -2
  31. package/dist/statistics/responses.d.ts +0 -1
  32. package/dist/sync/payloads.d.ts +0 -162
  33. package/dist/sync/payloads.js +1 -35
  34. package/dist/trade-accounts/entities.d.ts +0 -16
  35. package/dist/trade-accounts/entities.js +0 -2
  36. package/dist/trade-accounts/payloads.d.ts +0 -12
  37. package/dist/trade-accounts/payloads.js +1 -7
  38. package/dist/trade-accounts/response.d.ts +0 -120
  39. package/dist/traders/public.d.ts +0 -1
  40. package/dist/traders/public.js +0 -1
  41. package/dist/vaults/responses.d.ts +1 -0
  42. package/dist/vaults/responses.js +2 -1
  43. package/package.json +1 -1
@@ -0,0 +1,342 @@
1
+ import { z } from 'zod';
2
+ /** One instrument's price tick on the `prices` channel. */
3
+ export declare const RealtimePrice: z.ZodObject<{
4
+ id: z.ZodString;
5
+ p: z.ZodString;
6
+ bid: z.ZodNullable<z.ZodString>;
7
+ ask: z.ZodNullable<z.ZodString>;
8
+ t: z.ZodNumber;
9
+ }, z.core.$strip>;
10
+ export type RealtimePrice = z.output<typeof RealtimePrice>;
11
+ /** One instrument's funding tick on the `funding` channel. */
12
+ export declare const RealtimeFunding: z.ZodObject<{
13
+ id: z.ZodString;
14
+ r: z.ZodString;
15
+ t: z.ZodNumber;
16
+ nft: z.ZodNumber;
17
+ }, z.core.$strip>;
18
+ export type RealtimeFunding = z.output<typeof RealtimeFunding>;
19
+ /** One executed leg of a public trade or trigger fire. */
20
+ export declare const PublicTradeLeg: z.ZodObject<{
21
+ id: z.ZodOptional<z.ZodString>;
22
+ symbol: z.ZodString;
23
+ side: z.ZodEnum<{
24
+ BUY: "BUY";
25
+ SELL: "SELL";
26
+ }>;
27
+ reduceOnly: z.ZodBoolean;
28
+ quantity: z.ZodString;
29
+ price: z.ZodString;
30
+ }, z.core.$strip>;
31
+ export type PublicTradeLeg = z.output<typeof PublicTradeLeg>;
32
+ /** Payload of a `price.updated` frame: the ticks of one connector and price source, keyed by instrument id. */
33
+ export declare const PriceUpdatedData: z.ZodObject<{
34
+ connector: z.ZodEnum<{
35
+ hyperliquid: "hyperliquid";
36
+ binance: "binance";
37
+ bybit: "bybit";
38
+ okx: "okx";
39
+ lighter: "lighter";
40
+ lighter_rhc: "lighter_rhc";
41
+ }>;
42
+ source: z.ZodEnum<{
43
+ mid: "mid";
44
+ mark: "mark";
45
+ }>;
46
+ prices: z.ZodRecord<z.ZodString, z.ZodObject<{
47
+ id: z.ZodString;
48
+ p: z.ZodString;
49
+ bid: z.ZodNullable<z.ZodString>;
50
+ ask: z.ZodNullable<z.ZodString>;
51
+ t: z.ZodNumber;
52
+ }, z.core.$strip>>;
53
+ }, z.core.$strip>;
54
+ export type PriceUpdatedData = z.output<typeof PriceUpdatedData>;
55
+ /** Payload of a `funding.updated` frame: the funding ticks of one connector, keyed by instrument id. */
56
+ export declare const FundingUpdatedData: z.ZodObject<{
57
+ connector: z.ZodEnum<{
58
+ hyperliquid: "hyperliquid";
59
+ binance: "binance";
60
+ bybit: "bybit";
61
+ okx: "okx";
62
+ lighter: "lighter";
63
+ lighter_rhc: "lighter_rhc";
64
+ }>;
65
+ funding: z.ZodRecord<z.ZodString, z.ZodObject<{
66
+ id: z.ZodString;
67
+ r: z.ZodString;
68
+ t: z.ZodNumber;
69
+ nft: z.ZodNumber;
70
+ }, z.core.$strip>>;
71
+ }, z.core.$strip>;
72
+ export type FundingUpdatedData = z.output<typeof FundingUpdatedData>;
73
+ /** Payload of a `trade.executed` frame: one market execution on Pear. */
74
+ export declare const TradeExecutedData: z.ZodObject<{
75
+ connector: z.ZodEnum<{
76
+ hyperliquid: "hyperliquid";
77
+ binance: "binance";
78
+ bybit: "bybit";
79
+ okx: "okx";
80
+ lighter: "lighter";
81
+ lighter_rhc: "lighter_rhc";
82
+ }>;
83
+ source: z.ZodEnum<{
84
+ DIRECT: "DIRECT";
85
+ TRIGGER: "TRIGGER";
86
+ TWAP: "TWAP";
87
+ }>;
88
+ intent: z.ZodEnum<{
89
+ OPEN: "OPEN";
90
+ ADJUST: "ADJUST";
91
+ CLOSE: "CLOSE";
92
+ REVERSE: "REVERSE";
93
+ }>;
94
+ orderType: z.ZodEnum<{
95
+ MARKET: "MARKET";
96
+ }>;
97
+ timestamp: z.ZodISODateTime;
98
+ clientId: z.ZodOptional<z.ZodString>;
99
+ legs: z.ZodArray<z.ZodObject<{
100
+ id: z.ZodOptional<z.ZodString>;
101
+ symbol: z.ZodString;
102
+ side: z.ZodEnum<{
103
+ BUY: "BUY";
104
+ SELL: "SELL";
105
+ }>;
106
+ reduceOnly: z.ZodBoolean;
107
+ quantity: z.ZodString;
108
+ price: z.ZodString;
109
+ }, z.core.$strip>>;
110
+ }, z.core.$strip>;
111
+ export type TradeExecutedData = z.output<typeof TradeExecutedData>;
112
+ /** Payload of a `trigger.triggered.public` frame: one TP/SL trigger fire. */
113
+ export declare const TriggerTriggeredPublicData: z.ZodObject<{
114
+ connector: z.ZodEnum<{
115
+ hyperliquid: "hyperliquid";
116
+ binance: "binance";
117
+ bybit: "bybit";
118
+ okx: "okx";
119
+ lighter: "lighter";
120
+ lighter_rhc: "lighter_rhc";
121
+ }>;
122
+ accountId: z.ZodString;
123
+ triggerId: z.ZodString;
124
+ bracketType: z.ZodEnum<{
125
+ STOP_LOSS: "STOP_LOSS";
126
+ TAKE_PROFIT: "TAKE_PROFIT";
127
+ }>;
128
+ semanticBracketType: z.ZodEnum<{
129
+ STOP_LOSS: "STOP_LOSS";
130
+ TAKE_PROFIT: "TAKE_PROFIT";
131
+ }>;
132
+ intent: z.ZodEnum<{
133
+ OPEN: "OPEN";
134
+ ADJUST: "ADJUST";
135
+ CLOSE: "CLOSE";
136
+ }>;
137
+ condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
138
+ type: z.ZodLiteral<"ratio">;
139
+ data: z.ZodObject<{
140
+ priceSource: z.ZodEnum<{
141
+ mid: "mid";
142
+ mark: "mark";
143
+ }>;
144
+ symbol_a: z.ZodString;
145
+ symbol_b: z.ZodString;
146
+ track: z.ZodEnum<{
147
+ PEAK: "PEAK";
148
+ TROUGH: "TROUGH";
149
+ }>;
150
+ threshold: z.ZodNumber;
151
+ }, z.core.$strip>;
152
+ }, z.core.$strip>, z.ZodObject<{
153
+ type: z.ZodLiteral<"price">;
154
+ data: z.ZodObject<{
155
+ priceSource: z.ZodEnum<{
156
+ mid: "mid";
157
+ mark: "mark";
158
+ }>;
159
+ symbol: z.ZodString;
160
+ track: z.ZodEnum<{
161
+ PEAK: "PEAK";
162
+ TROUGH: "TROUGH";
163
+ }>;
164
+ threshold: z.ZodNumber;
165
+ }, z.core.$strip>;
166
+ }, z.core.$strip>, z.ZodObject<{
167
+ type: z.ZodLiteral<"weighted_ratio">;
168
+ data: z.ZodObject<{
169
+ priceSource: z.ZodEnum<{
170
+ mid: "mid";
171
+ mark: "mark";
172
+ }>;
173
+ basket: z.ZodArray<z.ZodObject<{
174
+ symbol: z.ZodString;
175
+ side: z.ZodEnum<{
176
+ BUY: "BUY";
177
+ SELL: "SELL";
178
+ }>;
179
+ weight: z.ZodNumber;
180
+ }, z.core.$strip>>;
181
+ track: z.ZodEnum<{
182
+ PEAK: "PEAK";
183
+ TROUGH: "TROUGH";
184
+ }>;
185
+ threshold: z.ZodNumber;
186
+ }, z.core.$strip>;
187
+ }, z.core.$strip>, z.ZodObject<{
188
+ type: z.ZodLiteral<"notional">;
189
+ data: z.ZodObject<{
190
+ priceSource: z.ZodEnum<{
191
+ mid: "mid";
192
+ mark: "mark";
193
+ }>;
194
+ track: z.ZodEnum<{
195
+ PEAK: "PEAK";
196
+ TROUGH: "TROUGH";
197
+ }>;
198
+ threshold: z.ZodNumber;
199
+ }, z.core.$strip>;
200
+ }, z.core.$strip>, z.ZodObject<{
201
+ type: z.ZodLiteral<"upnl">;
202
+ data: z.ZodObject<{
203
+ priceSource: z.ZodEnum<{
204
+ mid: "mid";
205
+ mark: "mark";
206
+ }>;
207
+ track: z.ZodEnum<{
208
+ PEAK: "PEAK";
209
+ TROUGH: "TROUGH";
210
+ }>;
211
+ threshold: z.ZodNumber;
212
+ }, z.core.$strip>;
213
+ }, z.core.$strip>, z.ZodObject<{
214
+ type: z.ZodLiteral<"upnl_bps">;
215
+ data: z.ZodObject<{
216
+ priceSource: z.ZodEnum<{
217
+ mid: "mid";
218
+ mark: "mark";
219
+ }>;
220
+ track: z.ZodEnum<{
221
+ PEAK: "PEAK";
222
+ TROUGH: "TROUGH";
223
+ }>;
224
+ threshold: z.ZodNumber;
225
+ }, z.core.$strip>;
226
+ }, z.core.$strip>, z.ZodObject<{
227
+ type: z.ZodLiteral<"ratio_trailing">;
228
+ data: z.ZodObject<{
229
+ priceSource: z.ZodEnum<{
230
+ mid: "mid";
231
+ mark: "mark";
232
+ }>;
233
+ symbol_a: z.ZodString;
234
+ symbol_b: z.ZodString;
235
+ }, z.core.$strip>;
236
+ }, z.core.$strip>, z.ZodObject<{
237
+ type: z.ZodLiteral<"price_trailing">;
238
+ data: z.ZodObject<{
239
+ priceSource: z.ZodEnum<{
240
+ mid: "mid";
241
+ mark: "mark";
242
+ }>;
243
+ symbol: z.ZodString;
244
+ }, z.core.$strip>;
245
+ }, z.core.$strip>, z.ZodObject<{
246
+ type: z.ZodLiteral<"weighted_ratio_trailing">;
247
+ data: z.ZodObject<{
248
+ priceSource: z.ZodEnum<{
249
+ mid: "mid";
250
+ mark: "mark";
251
+ }>;
252
+ basket: z.ZodArray<z.ZodObject<{
253
+ symbol: z.ZodString;
254
+ side: z.ZodEnum<{
255
+ BUY: "BUY";
256
+ SELL: "SELL";
257
+ }>;
258
+ weight: z.ZodNumber;
259
+ }, z.core.$strip>>;
260
+ }, z.core.$strip>;
261
+ }, z.core.$strip>, z.ZodObject<{
262
+ type: z.ZodLiteral<"notional_trailing">;
263
+ data: z.ZodObject<{
264
+ priceSource: z.ZodEnum<{
265
+ mid: "mid";
266
+ mark: "mark";
267
+ }>;
268
+ }, z.core.$strip>;
269
+ }, z.core.$strip>, z.ZodObject<{
270
+ type: z.ZodLiteral<"upnl_trailing">;
271
+ data: z.ZodObject<{
272
+ priceSource: z.ZodEnum<{
273
+ mid: "mid";
274
+ mark: "mark";
275
+ }>;
276
+ }, z.core.$strip>;
277
+ }, z.core.$strip>, z.ZodObject<{
278
+ type: z.ZodLiteral<"upnl_bps_trailing">;
279
+ data: z.ZodObject<{
280
+ priceSource: z.ZodEnum<{
281
+ mid: "mid";
282
+ mark: "mark";
283
+ }>;
284
+ }, z.core.$strip>;
285
+ }, z.core.$strip>, z.ZodObject<{
286
+ type: z.ZodLiteral<"funding_rate">;
287
+ data: z.ZodObject<{
288
+ connector: z.ZodEnum<{
289
+ hyperliquid: "hyperliquid";
290
+ binance: "binance";
291
+ bybit: "bybit";
292
+ okx: "okx";
293
+ lighter: "lighter";
294
+ lighter_rhc: "lighter_rhc";
295
+ }>;
296
+ symbol: z.ZodString;
297
+ track: z.ZodEnum<{
298
+ PEAK: "PEAK";
299
+ TROUGH: "TROUGH";
300
+ }>;
301
+ threshold: z.ZodNumber;
302
+ }, z.core.$strip>;
303
+ }, z.core.$strip>, z.ZodObject<{
304
+ type: z.ZodLiteral<"prediction_market">;
305
+ data: z.ZodObject<{
306
+ source: z.ZodEnum<{
307
+ kalshi: "kalshi";
308
+ polymarket: "polymarket";
309
+ }>;
310
+ marketKey: z.ZodString;
311
+ track: z.ZodEnum<{
312
+ PEAK: "PEAK";
313
+ TROUGH: "TROUGH";
314
+ }>;
315
+ threshold: z.ZodNumber;
316
+ }, z.core.$strip>;
317
+ }, z.core.$strip>, z.ZodObject<{
318
+ type: z.ZodLiteral<"btc_dominance">;
319
+ data: z.ZodObject<{
320
+ source: z.ZodLiteral<"coingecko">;
321
+ track: z.ZodEnum<{
322
+ PEAK: "PEAK";
323
+ TROUGH: "TROUGH";
324
+ }>;
325
+ threshold: z.ZodNumber;
326
+ }, z.core.$strip>;
327
+ }, z.core.$strip>], "type">;
328
+ triggerLevel: z.ZodNullable<z.ZodNumber>;
329
+ timestamp: z.ZodISODateTime;
330
+ legs: z.ZodArray<z.ZodObject<{
331
+ id: z.ZodOptional<z.ZodString>;
332
+ symbol: z.ZodString;
333
+ side: z.ZodEnum<{
334
+ BUY: "BUY";
335
+ SELL: "SELL";
336
+ }>;
337
+ reduceOnly: z.ZodBoolean;
338
+ quantity: z.ZodString;
339
+ price: z.ZodString;
340
+ }, z.core.$strip>>;
341
+ }, z.core.$strip>;
342
+ export type TriggerTriggeredPublicData = z.output<typeof TriggerTriggeredPublicData>;
@@ -0,0 +1,92 @@
1
+ import { z } from 'zod';
2
+ import { ClientIdCode } from '../common/client-id';
3
+ import { Connector } from '../connector';
4
+ import { PriceSource } from '../price';
5
+ import { TriggerConditionClose, TpSlBracketType } from '../trigger';
6
+
7
+ const RealtimePrice = z.object({
8
+ // Connector-native instrument id.
9
+ id: z.string(),
10
+ // The price for the subscribed source (mid or mark).
11
+ p: z.string(),
12
+ // Best bid, when the venue reports one.
13
+ bid: z.string().nullable(),
14
+ // Best ask, when the venue reports one.
15
+ ask: z.string().nullable(),
16
+ // Epoch milliseconds of the tick.
17
+ t: z.number()
18
+ });
19
+ const RealtimeFunding = z.object({
20
+ // Connector-native instrument id.
21
+ id: z.string(),
22
+ // Funding rate.
23
+ r: z.string(),
24
+ // Epoch milliseconds of the tick.
25
+ t: z.number(),
26
+ // Next funding time in epoch milliseconds.
27
+ nft: z.number()
28
+ });
29
+ const PublicTradeLeg = z.object({
30
+ // SYMBOL-MIGRATION switch-to-id: optional while old producers still drain; becomes required once every producer stamps it.
31
+ id: z.string().optional().describe("Connector-native instrument id"),
32
+ symbol: z.string(),
33
+ side: z.enum([
34
+ "BUY",
35
+ "SELL"
36
+ ]),
37
+ reduceOnly: z.boolean(),
38
+ quantity: z.string(),
39
+ price: z.string()
40
+ });
41
+ const PriceUpdatedData = z.object({
42
+ connector: Connector,
43
+ source: PriceSource,
44
+ prices: z.record(z.string(), RealtimePrice)
45
+ });
46
+ const FundingUpdatedData = z.object({
47
+ connector: Connector,
48
+ funding: z.record(z.string(), RealtimeFunding)
49
+ });
50
+ const TradeExecutedData = z.object({
51
+ connector: Connector,
52
+ source: z.enum([
53
+ "DIRECT",
54
+ "TWAP",
55
+ "TRIGGER"
56
+ ]),
57
+ intent: z.enum([
58
+ "OPEN",
59
+ "ADJUST",
60
+ "CLOSE",
61
+ "REVERSE"
62
+ ]),
63
+ orderType: z.enum([
64
+ "MARKET"
65
+ ]),
66
+ timestamp: z.iso.datetime(),
67
+ clientId: ClientIdCode,
68
+ legs: z.array(PublicTradeLeg).min(1)
69
+ });
70
+ const TriggerTriggeredPublicData = z.object({
71
+ connector: Connector,
72
+ accountId: z.string(),
73
+ triggerId: z.string(),
74
+ bracketType: z.enum([
75
+ "STOP_LOSS",
76
+ "TAKE_PROFIT"
77
+ ]),
78
+ // User-facing bracket semantics; `bracketType` is the crossing encoding (wire-flipped
79
+ // for a price bracket on a short watched leg). Always stated.
80
+ semanticBracketType: TpSlBracketType,
81
+ intent: z.enum([
82
+ "OPEN",
83
+ "ADJUST",
84
+ "CLOSE"
85
+ ]),
86
+ condition: TriggerConditionClose,
87
+ triggerLevel: z.number().nullable(),
88
+ timestamp: z.iso.datetime(),
89
+ legs: z.array(PublicTradeLeg).min(1)
90
+ });
91
+
92
+ export { FundingUpdatedData, PriceUpdatedData, PublicTradeLeg, RealtimeFunding, RealtimePrice, TradeExecutedData, TriggerTriggeredPublicData };
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ /** Topics of the private `user_events` channel; each tells the user one of their entities changed. */
3
+ export declare const UserEventTopic: z.ZodEnum<{
4
+ "execution.failed": "execution.failed";
5
+ "execution.completed": "execution.completed";
6
+ "position.created": "position.created";
7
+ "position.updated": "position.updated";
8
+ "position.closed": "position.closed";
9
+ "schedule.created": "schedule.created";
10
+ "schedule.completed": "schedule.completed";
11
+ "schedule.failed": "schedule.failed";
12
+ "schedule.cancelled": "schedule.cancelled";
13
+ "ladder.created": "ladder.created";
14
+ "ladder.updated": "ladder.updated";
15
+ "ladder.cancelled": "ladder.cancelled";
16
+ "trigger.created": "trigger.created";
17
+ "trigger.triggered": "trigger.triggered";
18
+ "trigger.cancelled": "trigger.cancelled";
19
+ "trigger.converted": "trigger.converted";
20
+ "rebalance.created": "rebalance.created";
21
+ "rebalance.updated": "rebalance.updated";
22
+ "rebalance.executed": "rebalance.executed";
23
+ "rebalance.paused": "rebalance.paused";
24
+ "rebalance.cancelled": "rebalance.cancelled";
25
+ "notification.created": "notification.created";
26
+ }>;
27
+ export type UserEventTopic = z.infer<typeof UserEventTopic>;
28
+ /** Invalidation-only payload of a `user_events` frame: the client refetches the named entity. */
29
+ export declare const UserEventData: z.ZodObject<{
30
+ entityId: z.ZodString;
31
+ }, z.core.$strip>;
32
+ export type UserEventData = z.output<typeof UserEventData>;
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+
3
+ const UserEventTopic = z.enum([
4
+ "execution.failed",
5
+ "execution.completed",
6
+ "position.created",
7
+ "position.updated",
8
+ "position.closed",
9
+ "schedule.created",
10
+ "schedule.completed",
11
+ "schedule.failed",
12
+ "schedule.cancelled",
13
+ "ladder.created",
14
+ "ladder.updated",
15
+ "ladder.cancelled",
16
+ "trigger.created",
17
+ "trigger.triggered",
18
+ "trigger.cancelled",
19
+ "trigger.converted",
20
+ "rebalance.created",
21
+ "rebalance.updated",
22
+ "rebalance.executed",
23
+ "rebalance.paused",
24
+ "rebalance.cancelled",
25
+ "notification.created"
26
+ ]);
27
+ const UserEventData = z.object({
28
+ // The changed entity (execution, position, schedule, ladder, trigger, rebalance or notification id).
29
+ entityId: z.string()
30
+ });
31
+
32
+ export { UserEventData, UserEventTopic };
@@ -0,0 +1,71 @@
1
+ import { z } from 'zod';
2
+ import { EthereumAddress } from '../common/address';
3
+ /** Read models behind the anonymous vault pages; anyone watching the vault on `vault_events` may hear they changed. */
4
+ export declare const PublicVaultDataset: z.ZodEnum<{
5
+ positions: "positions";
6
+ detail: "detail";
7
+ nav: "nav";
8
+ ledger: "ledger";
9
+ }>;
10
+ export type PublicVaultDataset = z.infer<typeof PublicVaultDataset>;
11
+ /** Read models behind the owner/trader-only tabs; only `vault_management` grants may hear they changed. */
12
+ export declare const ManagementVaultDataset: z.ZodEnum<{
13
+ orders: "orders";
14
+ schedules: "schedules";
15
+ private_history: "private_history";
16
+ }>;
17
+ export type ManagementVaultDataset = z.infer<typeof ManagementVaultDataset>;
18
+ /** The vault read models a client refetches when told one changed. */
19
+ export declare const VaultDataset: z.ZodEnum<{
20
+ positions: "positions";
21
+ orders: "orders";
22
+ detail: "detail";
23
+ nav: "nav";
24
+ ledger: "ledger";
25
+ schedules: "schedules";
26
+ private_history: "private_history";
27
+ }>;
28
+ export type VaultDataset = z.infer<typeof VaultDataset>;
29
+ /** Reports whether anyone, not only the vault's owner/trader, may hear that this dataset changed. */
30
+ export declare function isPublicVaultDataset(dataset: VaultDataset): dataset is PublicVaultDataset;
31
+ /** Invalidation-only notice: names the vault and dataset to refetch, never an entity or its payload. */
32
+ export declare const VaultInvalidatedData: z.ZodObject<{
33
+ vaultAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
34
+ dataset: z.ZodEnum<{
35
+ positions: "positions";
36
+ orders: "orders";
37
+ detail: "detail";
38
+ nav: "nav";
39
+ ledger: "ledger";
40
+ schedules: "schedules";
41
+ private_history: "private_history";
42
+ }>;
43
+ eventId: z.ZodUUID;
44
+ emittedAt: z.ZodNumber;
45
+ }, z.core.$strip>;
46
+ export type VaultInvalidatedData = z.output<typeof VaultInvalidatedData>;
47
+ /** The notice `vault_events` carries: only a public dataset. */
48
+ export declare const PublicVaultInvalidatedData: z.ZodObject<{
49
+ vaultAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
50
+ eventId: z.ZodUUID;
51
+ emittedAt: z.ZodNumber;
52
+ dataset: z.ZodEnum<{
53
+ positions: "positions";
54
+ detail: "detail";
55
+ nav: "nav";
56
+ ledger: "ledger";
57
+ }>;
58
+ }, z.core.$strip>;
59
+ export type PublicVaultInvalidatedData = z.output<typeof PublicVaultInvalidatedData>;
60
+ /** The notice `vault_management` carries: only an owner/trader dataset. */
61
+ export declare const ManagementVaultInvalidatedData: z.ZodObject<{
62
+ vaultAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
63
+ eventId: z.ZodUUID;
64
+ emittedAt: z.ZodNumber;
65
+ dataset: z.ZodEnum<{
66
+ orders: "orders";
67
+ schedules: "schedules";
68
+ private_history: "private_history";
69
+ }>;
70
+ }, z.core.$strip>;
71
+ export type ManagementVaultInvalidatedData = z.output<typeof ManagementVaultInvalidatedData>;
@@ -0,0 +1,42 @@
1
+ import { z } from 'zod';
2
+ import { EthereumAddress } from '../common/address';
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ const PublicVaultDataset = z.enum([
7
+ "positions",
8
+ "detail",
9
+ "nav",
10
+ "ledger"
11
+ ]);
12
+ const ManagementVaultDataset = z.enum([
13
+ "orders",
14
+ "schedules",
15
+ "private_history"
16
+ ]);
17
+ const VaultDataset = z.enum([
18
+ ...PublicVaultDataset.options,
19
+ ...ManagementVaultDataset.options
20
+ ]);
21
+ function isPublicVaultDataset(dataset) {
22
+ return PublicVaultDataset.safeParse(dataset).success;
23
+ }
24
+ __name(isPublicVaultDataset, "isPublicVaultDataset");
25
+ const VaultInvalidatedData = z.object({
26
+ // The vault whose dataset changed, lowercased.
27
+ vaultAddress: EthereumAddress,
28
+ // The read model to refetch; its visibility decides which channel carries the notice.
29
+ dataset: VaultDataset,
30
+ // Unique per emitted invalidation so clients can dedupe redeliveries.
31
+ eventId: z.uuid(),
32
+ // Epoch milliseconds when realtime emitted the invalidation.
33
+ emittedAt: z.number().int().nonnegative()
34
+ });
35
+ const PublicVaultInvalidatedData = VaultInvalidatedData.extend({
36
+ dataset: PublicVaultDataset
37
+ });
38
+ const ManagementVaultInvalidatedData = VaultInvalidatedData.extend({
39
+ dataset: ManagementVaultDataset
40
+ });
41
+
42
+ export { ManagementVaultDataset, ManagementVaultInvalidatedData, PublicVaultDataset, PublicVaultInvalidatedData, VaultDataset, VaultInvalidatedData, isPublicVaultDataset };