@pear-protocol/types 1.14.1 → 1.15.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 (66) hide show
  1. package/dist/auth/api-keys.d.ts +0 -1
  2. package/dist/auth/api-keys.js +1 -1
  3. package/dist/auth/entities.d.ts +0 -1
  4. package/dist/auth/entities.js +1 -1
  5. package/dist/auth/response.d.ts +0 -2
  6. package/dist/bundle.d.ts +1 -1
  7. package/dist/bundle.js +1 -1
  8. package/dist/common/refinement.js +1 -1
  9. package/dist/common/schema.d.ts +0 -1
  10. package/dist/common/schema.js +1 -2
  11. package/dist/execution/entities.d.ts +0 -13
  12. package/dist/execution/responses.d.ts +0 -8
  13. package/dist/fee/entities.d.ts +41 -0
  14. package/dist/fee/entities.js +19 -0
  15. package/dist/{admin/client-ids → fee}/index.d.ts +0 -1
  16. package/dist/{admin/client-ids → fee}/index.js +0 -1
  17. package/dist/fee/queries.d.ts +17 -0
  18. package/dist/fee/queries.js +12 -0
  19. package/dist/fee/responses.d.ts +35 -0
  20. package/dist/fee/responses.js +29 -0
  21. package/dist/instrument/entities.d.ts +10 -0
  22. package/dist/instrument/entities.js +22 -1
  23. package/dist/instrument/queries.d.ts +2 -2
  24. package/dist/instrument/responses.d.ts +12 -0
  25. package/dist/instrument/responses.js +8 -2
  26. package/dist/ladder/entities.d.ts +3 -0
  27. package/dist/ladder/payloads.js +1 -2
  28. package/dist/ladder/responses.d.ts +9 -0
  29. package/dist/market/queries.d.ts +2 -2
  30. package/dist/notification/queries.d.ts +1 -1
  31. package/dist/order/entities.d.ts +0 -2
  32. package/dist/order/entities.js +1 -5
  33. package/dist/portfolio/entities.d.ts +4 -0
  34. package/dist/portfolio/entities.js +10 -1
  35. package/dist/portfolio/responses.d.ts +4 -0
  36. package/dist/schedule/entities.d.ts +27 -37
  37. package/dist/schedule/entities.js +24 -28
  38. package/dist/schedule/index.d.ts +1 -0
  39. package/dist/schedule/index.js +1 -0
  40. package/dist/schedule/payloads.d.ts +28 -28
  41. package/dist/schedule/payloads.js +23 -33
  42. package/dist/schedule/randomization.d.ts +10 -0
  43. package/dist/schedule/randomization.js +15 -0
  44. package/dist/schedule/responses.d.ts +24 -20
  45. package/dist/statistics/entities.d.ts +20 -0
  46. package/dist/statistics/entities.js +23 -1
  47. package/dist/statistics/queries.d.ts +28 -0
  48. package/dist/statistics/queries.js +26 -1
  49. package/dist/statistics/responses.d.ts +22 -0
  50. package/dist/statistics/responses.js +5 -2
  51. package/dist/trade/responses.d.ts +0 -20
  52. package/dist/trigger/entities/index.d.ts +10 -0
  53. package/dist/trigger/entities/index.js +4 -0
  54. package/dist/trigger/responses.d.ts +6 -0
  55. package/dist/users/entities.d.ts +0 -1
  56. package/dist/users/entities.js +1 -1
  57. package/dist/users/response.d.ts +0 -1
  58. package/package.json +1 -1
  59. package/dist/admin/client-ids/entities.d.ts +0 -11
  60. package/dist/admin/client-ids/entities.js +0 -13
  61. package/dist/admin/client-ids/payloads.d.ts +0 -14
  62. package/dist/admin/client-ids/payloads.js +0 -13
  63. package/dist/admin/client-ids/queries.d.ts +0 -10
  64. package/dist/admin/client-ids/queries.js +0 -7
  65. package/dist/admin/client-ids/responses.d.ts +0 -11
  66. package/dist/admin/client-ids/responses.js +0 -6
@@ -51,7 +51,6 @@ export declare const ApiKeyMeResponse: z.ZodObject<{
51
51
  role: z.ZodEnum<{
52
52
  basic: "basic";
53
53
  pro: "pro";
54
- admin: "admin";
55
54
  }>;
56
55
  scope: z.ZodEnum<{
57
56
  read: "read";
@@ -27,7 +27,7 @@ const ApiKeySummary = z.object({
27
27
  const ListApiKeysOutput = z.array(ApiKeySummary).describe("All API keys for the user");
28
28
  const ApiKeyMeResponse = z.object({
29
29
  id: z.uuid().describe("User UUID that owns the API key"),
30
- role: z.enum(["basic", "pro", "admin"]).describe("User role"),
30
+ role: z.enum(["basic", "pro"]).describe("User role"),
31
31
  scope: ApiKeyScope,
32
32
  authMethod: z.literal("api_key")
33
33
  }).describe("Identity of the caller authenticated via an API key");
@@ -9,7 +9,6 @@ export declare const AuthenticatedUser: z.ZodObject<{
9
9
  role: z.ZodEnum<{
10
10
  basic: "basic";
11
11
  pro: "pro";
12
- admin: "admin";
13
12
  }>;
14
13
  providerId: z.ZodNullable<z.ZodString>;
15
14
  loginMethod: z.ZodEnum<{
@@ -3,7 +3,7 @@ import { z } from 'zod';
3
3
  const LoginMethod = z.enum(["email", "evm_wallet", "oauth"]).describe("Authentication provider used for the current session");
4
4
  const AuthenticatedUser = z.object({
5
5
  id: z.uuid().describe("User UUID"),
6
- role: z.enum(["basic", "pro", "admin"]).describe("User role"),
6
+ role: z.enum(["basic", "pro"]).describe("User role"),
7
7
  providerId: z.string().nullable().describe("Provider identifier (wallet address or email)"),
8
8
  loginMethod: LoginMethod.describe("Authentication provider used for the current session")
9
9
  }).describe("Current authenticated user info");
@@ -7,7 +7,6 @@ export declare const LoginResponse: z.ZodObject<{
7
7
  role: z.ZodEnum<{
8
8
  basic: "basic";
9
9
  pro: "pro";
10
- admin: "admin";
11
10
  }>;
12
11
  providerId: z.ZodNullable<z.ZodString>;
13
12
  loginMethod: z.ZodEnum<{
@@ -61,7 +60,6 @@ export declare const MeResponse: z.ZodObject<{
61
60
  role: z.ZodEnum<{
62
61
  basic: "basic";
63
62
  pro: "pro";
64
- admin: "admin";
65
63
  }>;
66
64
  providerId: z.ZodNullable<z.ZodString>;
67
65
  loginMethod: z.ZodEnum<{
package/dist/bundle.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export * from './admin/client-ids';
2
1
  export * from './auth';
3
2
  export * from './common/trade-legs';
4
3
  export * from './connector';
5
4
  export * from './execution';
5
+ export * from './fee';
6
6
  export * from './fill';
7
7
  export * from './funding';
8
8
  export * from './instrument';
package/dist/bundle.js CHANGED
@@ -1,8 +1,8 @@
1
- export * from './admin/client-ids';
2
1
  export * from './auth';
3
2
  export * from './common/trade-legs';
4
3
  export * from './connector';
5
4
  export * from './execution';
5
+ export * from './fee';
6
6
  export * from './fill';
7
7
  export * from './funding';
8
8
  export * from './instrument';
@@ -38,7 +38,7 @@ const RefineUniqueSymbols = (basket, ctx) => {
38
38
  };
39
39
  const RefineWeightingSum = (basket, ctx) => {
40
40
  const totalWeight = basket.reduce((acc, curr) => acc + curr.weight, 0);
41
- if (totalWeight !== 1) {
41
+ if (Math.abs(totalWeight - 1) > 1e-9) {
42
42
  ctx.addIssue({
43
43
  code: "custom",
44
44
  message: `The sum of weights must be exactly 1, but got ${totalWeight}`,
@@ -1,7 +1,6 @@
1
1
  import z from 'zod';
2
2
  export declare const UnsignedDecimalString: z.ZodString;
3
3
  export declare const SignedDecimalString: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
4
- export declare const Leverage: z.ZodInt;
5
4
  export declare const Side: z.ZodEnum<{
6
5
  BUY: "BUY";
7
6
  SELL: "SELL";
@@ -2,10 +2,9 @@ import z from 'zod';
2
2
 
3
3
  const UnsignedDecimalString = z.string().regex(/^\d+(\.\d+)?$/, "Must be a valid decimal string");
4
4
  const SignedDecimalString = z.string().regex(/^[+-]\d+(\.\d+)?$/, "Must be a valid signed decimal string").transform((val) => val);
5
- const Leverage = z.int({ message: "Leverage must be an integer" }).positive({ message: "Leverage must be greater than 0" }).max(100, { message: "Leverage must be less than 100" });
6
5
  const Side = z.enum(["BUY", "SELL"], {
7
6
  message: "Side must be either BUY or SELL"
8
7
  });
9
8
  const AssetWeight = z.number().positive({ message: "Weight must be greater than 0" }).max(1, { message: "Weight must be less than 1" });
10
9
 
11
- export { AssetWeight, Leverage, Side, SignedDecimalString, UnsignedDecimalString };
10
+ export { AssetWeight, Side, SignedDecimalString, UnsignedDecimalString };
@@ -90,7 +90,6 @@ export declare const BaseExecution: z.ZodObject<{
90
90
  SELL: "SELL";
91
91
  }>;
92
92
  reduceOnly: z.ZodBoolean;
93
- leverage: z.ZodInt;
94
93
  quantity: z.ZodString;
95
94
  price: z.ZodString;
96
95
  filledQuantity: z.ZodString;
@@ -142,7 +141,6 @@ export declare const MarketOpenExecution: z.ZodObject<{
142
141
  SELL: "SELL";
143
142
  }>;
144
143
  reduceOnly: z.ZodBoolean;
145
- leverage: z.ZodInt;
146
144
  quantity: z.ZodString;
147
145
  price: z.ZodString;
148
146
  filledQuantity: z.ZodString;
@@ -221,7 +219,6 @@ export declare const MarketAdjustExecution: z.ZodObject<{
221
219
  SELL: "SELL";
222
220
  }>;
223
221
  reduceOnly: z.ZodBoolean;
224
- leverage: z.ZodInt;
225
222
  quantity: z.ZodString;
226
223
  price: z.ZodString;
227
224
  filledQuantity: z.ZodString;
@@ -304,7 +301,6 @@ export declare const MarketCloseExecution: z.ZodObject<{
304
301
  SELL: "SELL";
305
302
  }>;
306
303
  reduceOnly: z.ZodBoolean;
307
- leverage: z.ZodInt;
308
304
  quantity: z.ZodString;
309
305
  price: z.ZodString;
310
306
  filledQuantity: z.ZodString;
@@ -362,7 +358,6 @@ export declare const MarketReverseExecution: z.ZodObject<{
362
358
  SELL: "SELL";
363
359
  }>;
364
360
  reduceOnly: z.ZodBoolean;
365
- leverage: z.ZodInt;
366
361
  quantity: z.ZodString;
367
362
  price: z.ZodString;
368
363
  filledQuantity: z.ZodString;
@@ -420,7 +415,6 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
420
415
  SELL: "SELL";
421
416
  }>;
422
417
  reduceOnly: z.ZodBoolean;
423
- leverage: z.ZodInt;
424
418
  quantity: z.ZodString;
425
419
  price: z.ZodString;
426
420
  filledQuantity: z.ZodString;
@@ -498,7 +492,6 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
498
492
  SELL: "SELL";
499
493
  }>;
500
494
  reduceOnly: z.ZodBoolean;
501
- leverage: z.ZodInt;
502
495
  quantity: z.ZodString;
503
496
  price: z.ZodString;
504
497
  filledQuantity: z.ZodString;
@@ -580,7 +573,6 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
580
573
  SELL: "SELL";
581
574
  }>;
582
575
  reduceOnly: z.ZodBoolean;
583
- leverage: z.ZodInt;
584
576
  quantity: z.ZodString;
585
577
  price: z.ZodString;
586
578
  filledQuantity: z.ZodString;
@@ -637,7 +629,6 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
637
629
  SELL: "SELL";
638
630
  }>;
639
631
  reduceOnly: z.ZodBoolean;
640
- leverage: z.ZodInt;
641
632
  quantity: z.ZodString;
642
633
  price: z.ZodString;
643
634
  filledQuantity: z.ZodString;
@@ -695,7 +686,6 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
695
686
  SELL: "SELL";
696
687
  }>;
697
688
  reduceOnly: z.ZodBoolean;
698
- leverage: z.ZodInt;
699
689
  quantity: z.ZodString;
700
690
  price: z.ZodString;
701
691
  filledQuantity: z.ZodString;
@@ -773,7 +763,6 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
773
763
  SELL: "SELL";
774
764
  }>;
775
765
  reduceOnly: z.ZodBoolean;
776
- leverage: z.ZodInt;
777
766
  quantity: z.ZodString;
778
767
  price: z.ZodString;
779
768
  filledQuantity: z.ZodString;
@@ -855,7 +844,6 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
855
844
  SELL: "SELL";
856
845
  }>;
857
846
  reduceOnly: z.ZodBoolean;
858
- leverage: z.ZodInt;
859
847
  quantity: z.ZodString;
860
848
  price: z.ZodString;
861
849
  filledQuantity: z.ZodString;
@@ -912,7 +900,6 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
912
900
  SELL: "SELL";
913
901
  }>;
914
902
  reduceOnly: z.ZodBoolean;
915
- leverage: z.ZodInt;
916
903
  quantity: z.ZodString;
917
904
  price: z.ZodString;
918
905
  filledQuantity: z.ZodString;
@@ -47,7 +47,6 @@ export declare const ExecutionListResponse: z.ZodObject<{
47
47
  SELL: "SELL";
48
48
  }>;
49
49
  reduceOnly: z.ZodBoolean;
50
- leverage: z.ZodInt;
51
50
  quantity: z.ZodString;
52
51
  price: z.ZodString;
53
52
  filledQuantity: z.ZodString;
@@ -125,7 +124,6 @@ export declare const ExecutionListResponse: z.ZodObject<{
125
124
  SELL: "SELL";
126
125
  }>;
127
126
  reduceOnly: z.ZodBoolean;
128
- leverage: z.ZodInt;
129
127
  quantity: z.ZodString;
130
128
  price: z.ZodString;
131
129
  filledQuantity: z.ZodString;
@@ -207,7 +205,6 @@ export declare const ExecutionListResponse: z.ZodObject<{
207
205
  SELL: "SELL";
208
206
  }>;
209
207
  reduceOnly: z.ZodBoolean;
210
- leverage: z.ZodInt;
211
208
  quantity: z.ZodString;
212
209
  price: z.ZodString;
213
210
  filledQuantity: z.ZodString;
@@ -264,7 +261,6 @@ export declare const ExecutionListResponse: z.ZodObject<{
264
261
  SELL: "SELL";
265
262
  }>;
266
263
  reduceOnly: z.ZodBoolean;
267
- leverage: z.ZodInt;
268
264
  quantity: z.ZodString;
269
265
  price: z.ZodString;
270
266
  filledQuantity: z.ZodString;
@@ -325,7 +321,6 @@ export declare const GetExecutionResponse: z.ZodObject<{
325
321
  SELL: "SELL";
326
322
  }>;
327
323
  reduceOnly: z.ZodBoolean;
328
- leverage: z.ZodInt;
329
324
  quantity: z.ZodString;
330
325
  price: z.ZodString;
331
326
  filledQuantity: z.ZodString;
@@ -403,7 +398,6 @@ export declare const GetExecutionResponse: z.ZodObject<{
403
398
  SELL: "SELL";
404
399
  }>;
405
400
  reduceOnly: z.ZodBoolean;
406
- leverage: z.ZodInt;
407
401
  quantity: z.ZodString;
408
402
  price: z.ZodString;
409
403
  filledQuantity: z.ZodString;
@@ -485,7 +479,6 @@ export declare const GetExecutionResponse: z.ZodObject<{
485
479
  SELL: "SELL";
486
480
  }>;
487
481
  reduceOnly: z.ZodBoolean;
488
- leverage: z.ZodInt;
489
482
  quantity: z.ZodString;
490
483
  price: z.ZodString;
491
484
  filledQuantity: z.ZodString;
@@ -542,7 +535,6 @@ export declare const GetExecutionResponse: z.ZodObject<{
542
535
  SELL: "SELL";
543
536
  }>;
544
537
  reduceOnly: z.ZodBoolean;
545
- leverage: z.ZodInt;
546
538
  quantity: z.ZodString;
547
539
  price: z.ZodString;
548
540
  filledQuantity: z.ZodString;
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ export declare const MAX_FEE_BPS = 10;
3
+ export declare const FeeOverrideScope: z.ZodEnum<{
4
+ user: "user";
5
+ client_id: "client_id";
6
+ }>;
7
+ export type FeeOverrideScope = z.output<typeof FeeOverrideScope>;
8
+ export declare const FeeDiscountScope: z.ZodEnum<{
9
+ user: "user";
10
+ connector: "connector";
11
+ all: "all";
12
+ client_id: "client_id";
13
+ }>;
14
+ export type FeeDiscountScope = z.output<typeof FeeDiscountScope>;
15
+ export declare const FeeConnector: z.ZodEnum<{
16
+ hyperliquid: "hyperliquid";
17
+ binance: "binance";
18
+ bybit: "bybit";
19
+ okx: "okx";
20
+ lighter: "lighter";
21
+ }>;
22
+ export type FeeConnector = z.output<typeof FeeConnector>;
23
+ export declare const FeeRole: z.ZodEnum<{
24
+ basic: "basic";
25
+ pro: "pro";
26
+ }>;
27
+ export type FeeRole = z.output<typeof FeeRole>;
28
+ export declare const FeeBps: z.ZodString;
29
+ export type FeeBps = z.output<typeof FeeBps>;
30
+ export declare const DiscountRate: z.ZodString;
31
+ export type DiscountRate = z.output<typeof DiscountRate>;
32
+ export declare const ORDERED_VALIDITY_WINDOW_MESSAGE = "endsAt must be later than startsAt";
33
+ /**
34
+ * True when a validity window runs forwards. Only a window naming both bounds can fail, and one
35
+ * that does is inert rather than wrong-looking: it is active at no moment, matches nothing for the
36
+ * overlap check to catch, and is refused by the CHECK constraint — so it has to be stopped here.
37
+ */
38
+ export declare function hasOrderedValidityWindow(window: {
39
+ startsAt?: string;
40
+ endsAt?: string;
41
+ }): boolean;
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { Connector } from '../connector';
3
+
4
+ const MAX_FEE_BPS = 10;
5
+ const FeeOverrideScope = z.enum(["user", "client_id"]);
6
+ const FeeDiscountScope = z.enum(["user", "client_id", "connector", "all"]);
7
+ const FeeConnector = z.enum(Connector.options);
8
+ const FeeRole = z.enum(["basic", "pro"]);
9
+ const FeeBps = z.string().regex(/^\d{1,2}(\.\d)?$/, "Fee bps must be a decimal with at most one decimal place").refine((value) => Number(value) <= MAX_FEE_BPS, `Fee bps must not exceed ${MAX_FEE_BPS}`);
10
+ const DiscountRate = z.string().regex(/^(0(\.\d{1,4})?|1(\.0{1,4})?)$/, 'Discount rate must be a fraction from 0 to 1, e.g. "0.2" for 20% off');
11
+ const ORDERED_VALIDITY_WINDOW_MESSAGE = "endsAt must be later than startsAt";
12
+ function hasOrderedValidityWindow(window) {
13
+ if (!window.startsAt || !window.endsAt) {
14
+ return true;
15
+ }
16
+ return new Date(window.startsAt).getTime() < new Date(window.endsAt).getTime();
17
+ }
18
+
19
+ export { DiscountRate, FeeBps, FeeConnector, FeeDiscountScope, FeeOverrideScope, FeeRole, MAX_FEE_BPS, ORDERED_VALIDITY_WINDOW_MESSAGE, hasOrderedValidityWindow };
@@ -1,4 +1,3 @@
1
1
  export * from './entities';
2
- export * from './payloads';
3
2
  export * from './queries';
4
3
  export * from './responses';
@@ -1,4 +1,3 @@
1
1
  export * from './entities';
2
- export * from './payloads';
3
2
  export * from './queries';
4
3
  export * from './responses';
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ export declare const QuoteFeeParams: z.ZodObject<{
3
+ clientId: z.ZodOptional<z.ZodString>;
4
+ }, z.core.$strip>;
5
+ export type QuoteFeeParamsInput = z.input<typeof QuoteFeeParams>;
6
+ export type QuoteFeeParams = z.output<typeof QuoteFeeParams>;
7
+ export declare const GetFeeRecipientParams: z.ZodObject<{
8
+ connector: z.ZodEnum<{
9
+ hyperliquid: "hyperliquid";
10
+ binance: "binance";
11
+ bybit: "bybit";
12
+ okx: "okx";
13
+ lighter: "lighter";
14
+ }>;
15
+ }, z.core.$strip>;
16
+ export type GetFeeRecipientParamsInput = z.input<typeof GetFeeRecipientParams>;
17
+ export type GetFeeRecipientParams = z.output<typeof GetFeeRecipientParams>;
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { ClientIdCode } from '../common/client-id';
3
+ import { FeeConnector } from './entities';
4
+
5
+ const QuoteFeeParams = z.object({
6
+ clientId: ClientIdCode
7
+ });
8
+ const GetFeeRecipientParams = z.object({
9
+ connector: FeeConnector
10
+ });
11
+
12
+ export { GetFeeRecipientParams, QuoteFeeParams };
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ export declare const AppliedFeeDiscount: z.ZodObject<{
3
+ scope: z.ZodEnum<{
4
+ user: "user";
5
+ connector: "connector";
6
+ all: "all";
7
+ client_id: "client_id";
8
+ }>;
9
+ rate: z.ZodString;
10
+ }, z.core.$strip>;
11
+ export type AppliedFeeDiscount = z.output<typeof AppliedFeeDiscount>;
12
+ export declare const FeeResponse: z.ZodObject<{
13
+ feeRecipient: z.ZodOptional<z.ZodString>;
14
+ baseBps: z.ZodString;
15
+ overrideBps: z.ZodOptional<z.ZodString>;
16
+ overrideScope: z.ZodOptional<z.ZodEnum<{
17
+ user: "user";
18
+ client_id: "client_id";
19
+ }>>;
20
+ discounts: z.ZodArray<z.ZodObject<{
21
+ scope: z.ZodEnum<{
22
+ user: "user";
23
+ connector: "connector";
24
+ all: "all";
25
+ client_id: "client_id";
26
+ }>;
27
+ rate: z.ZodString;
28
+ }, z.core.$strip>>;
29
+ finalBps: z.ZodString;
30
+ }, z.core.$strip>;
31
+ export type FeeResponse = z.output<typeof FeeResponse>;
32
+ export declare const FeeRecipientResponse: z.ZodObject<{
33
+ recipient: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$strip>;
35
+ export type FeeRecipientResponse = z.output<typeof FeeRecipientResponse>;
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { DiscountRate, FeeDiscountScope, FeeBps, FeeOverrideScope } from './entities';
3
+
4
+ const AppliedFeeDiscount = z.object({
5
+ scope: FeeDiscountScope,
6
+ rate: DiscountRate
7
+ }).describe("A discount applied to the quoted fee");
8
+ const FeeResponse = z.object({
9
+ // Connector-native fee recipient; absent means the order names none, so it carries no fee
10
+ feeRecipient: z.string().optional(),
11
+ // The (role, connector) rate the quote started from
12
+ baseBps: FeeBps,
13
+ // The rate that replaced the base; absent when no override matched
14
+ overrideBps: FeeBps.optional(),
15
+ // Which scope that override came from
16
+ overrideScope: FeeOverrideScope.optional(),
17
+ // Every discount taken off the amount. Rates add up rather than compound, and the total is
18
+ // capped at 100%, so a deep stack floors the fee at zero.
19
+ discounts: z.array(AppliedFeeDiscount),
20
+ // What the trade actually pays. Always a multiple of 0.1 bps: resolution rounds up to that step
21
+ // so a discounted fee cannot shrink to nothing.
22
+ finalBps: FeeBps
23
+ }).describe("Resolved trading fee and connector fee recipient for the caller's trade account");
24
+ const FeeRecipientResponse = z.object({
25
+ // Connector-native recipient identifier (Hyperliquid builder address, Lighter integrator account index)
26
+ recipient: z.string().optional()
27
+ }).describe("Connector-native fee recipient to approve for the caller's role");
28
+
29
+ export { AppliedFeeDiscount, FeeRecipientResponse, FeeResponse };
@@ -67,3 +67,13 @@ export declare const Instrument: z.ZodObject<{
67
67
  }, z.core.$strip>;
68
68
  }, z.core.$strip>;
69
69
  export type Instrument = z.output<typeof Instrument>;
70
+ export declare const InstrumentLite: z.ZodObject<{
71
+ id: z.ZodString;
72
+ base: z.ZodString;
73
+ precision: z.ZodObject<{
74
+ quantity: z.ZodObject<{
75
+ contractSize: z.ZodNumber;
76
+ }, z.core.$strip>;
77
+ }, z.core.$strip>;
78
+ }, z.core.$strip>;
79
+ export type InstrumentLite = z.output<typeof InstrumentLite>;
@@ -54,5 +54,26 @@ const Instrument = z.object({
54
54
  */
55
55
  tradeability: InstrumentTradeability
56
56
  });
57
+ const InstrumentLite = z.object({
58
+ /**
59
+ * Exchange specific instrument identifier
60
+ * @example (dexIndex + assetIndex) on Hyperliquid
61
+ * @example "BTCUSDT" on Binance
62
+ */
63
+ id: InstrumentId,
64
+ /**
65
+ * The base asset of the instrument.
66
+ * @example "BTC"
67
+ */
68
+ base: z.string(),
69
+ /**
70
+ * Minimal precision — only the contract size the syncer needs for BASE-unit normalization.
71
+ */
72
+ precision: z.object({
73
+ quantity: z.object({
74
+ contractSize: z.number()
75
+ })
76
+ })
77
+ });
57
78
 
58
- export { Instrument, InstrumentId, InstrumentTradeability, InstrumentTradeabilityReason, InstrumentTradeabilityStatus, InstrumentType };
79
+ export { Instrument, InstrumentId, InstrumentLite, InstrumentTradeability, InstrumentTradeabilityReason, InstrumentTradeabilityStatus, InstrumentType };
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  export declare const InstrumentScope: z.ZodEnum<{
3
- all: "all";
4
3
  tradable: "tradable";
5
4
  reduce_only: "reduce_only";
6
5
  not_tradable: "not_tradable";
6
+ all: "all";
7
7
  }>;
8
8
  export type InstrumentScope = z.infer<typeof InstrumentScope>;
9
9
  export declare const InstrumentListParams: z.ZodObject<{
@@ -15,10 +15,10 @@ export declare const InstrumentListParams: z.ZodObject<{
15
15
  lighter: "lighter";
16
16
  }>;
17
17
  scope: z.ZodDefault<z.ZodEnum<{
18
- all: "all";
19
18
  tradable: "tradable";
20
19
  reduce_only: "reduce_only";
21
20
  not_tradable: "not_tradable";
21
+ all: "all";
22
22
  }>>;
23
23
  }, z.core.$strip>;
24
24
  export type InstrumentListParamsInput = z.input<typeof InstrumentListParams>;
@@ -48,3 +48,15 @@ export declare const InstrumentSymbolToIdMapResponse: z.ZodObject<{
48
48
  data: z.ZodRecord<z.ZodString, z.ZodString>;
49
49
  }, z.core.$strip>;
50
50
  export type InstrumentSymbolToIdMapResponse = z.output<typeof InstrumentSymbolToIdMapResponse>;
51
+ export declare const InstrumentListLiteResponse: z.ZodObject<{
52
+ instruments: z.ZodArray<z.ZodObject<{
53
+ id: z.ZodString;
54
+ base: z.ZodString;
55
+ precision: z.ZodObject<{
56
+ quantity: z.ZodObject<{
57
+ contractSize: z.ZodNumber;
58
+ }, z.core.$strip>;
59
+ }, z.core.$strip>;
60
+ }, z.core.$strip>>;
61
+ }, z.core.$strip>;
62
+ export type InstrumentListLiteResponse = z.output<typeof InstrumentListLiteResponse>;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { Instrument, InstrumentId } from './entities';
2
+ import { Instrument, InstrumentId, InstrumentLite } from './entities';
3
3
 
4
4
  const InstrumentListResponse = z.object({
5
5
  /**
@@ -10,5 +10,11 @@ const InstrumentListResponse = z.object({
10
10
  const InstrumentSymbolToIdMapResponse = z.object({
11
11
  data: z.record(z.string(), InstrumentId)
12
12
  });
13
+ const InstrumentListLiteResponse = z.object({
14
+ /**
15
+ * The list of instruments, trimmed to the fields the account syncer reads.
16
+ */
17
+ instruments: z.array(InstrumentLite)
18
+ });
13
19
 
14
- export { InstrumentListResponse, InstrumentSymbolToIdMapResponse };
20
+ export { InstrumentListLiteResponse, InstrumentListResponse, InstrumentSymbolToIdMapResponse };
@@ -43,6 +43,7 @@ export declare const Ladder: z.ZodObject<{
43
43
  }>;
44
44
  ladderId: z.ZodOptional<z.ZodUUID>;
45
45
  ladderIndex: z.ZodOptional<z.ZodNumber>;
46
+ parentTriggerId: z.ZodOptional<z.ZodUUID>;
46
47
  triggeredAt: z.ZodOptional<z.ZodString>;
47
48
  cancelledAt: z.ZodOptional<z.ZodString>;
48
49
  cancelledReason: z.ZodOptional<z.ZodEnum<{
@@ -243,6 +244,7 @@ export declare const Ladder: z.ZodObject<{
243
244
  }>;
244
245
  ladderId: z.ZodOptional<z.ZodUUID>;
245
246
  ladderIndex: z.ZodOptional<z.ZodNumber>;
247
+ parentTriggerId: z.ZodOptional<z.ZodUUID>;
246
248
  triggeredAt: z.ZodOptional<z.ZodString>;
247
249
  cancelledAt: z.ZodOptional<z.ZodString>;
248
250
  cancelledReason: z.ZodOptional<z.ZodEnum<{
@@ -489,6 +491,7 @@ export declare const Ladder: z.ZodObject<{
489
491
  }>;
490
492
  ladderId: z.ZodOptional<z.ZodUUID>;
491
493
  ladderIndex: z.ZodOptional<z.ZodNumber>;
494
+ parentTriggerId: z.ZodOptional<z.ZodUUID>;
492
495
  triggeredAt: z.ZodOptional<z.ZodString>;
493
496
  cancelledAt: z.ZodOptional<z.ZodString>;
494
497
  cancelledReason: z.ZodOptional<z.ZodEnum<{
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { ClientIdCode } from '../common/client-id';
3
3
  import { RefineMinimumTwoSymbols, RefineUniqueSymbols, RefineWeightingSum, RefineMinimumOneBuyOneSell, RefineTwoUniqueSymbols, RefineMinimumOneSymbol } from '../common/refinement';
4
- import { Side } from '../common/schema';
4
+ import { AssetWeight, Side } from '../common/schema';
5
5
  import { TradeLegPostOnly } from '../common/trade-legs';
6
6
  import { InstrumentId } from '../instrument';
7
7
  import { MetricTrack } from '../trigger/common';
@@ -20,7 +20,6 @@ const LadderConfig = z.object({
20
20
  const PriceSource = z.enum(["mid", "mark"], {
21
21
  message: "Price source must be mid or mark"
22
22
  });
23
- const AssetWeight = z.number().positive({ message: "Weight must be greater than 0" }).max(1, { message: "Weight must be less than 1" });
24
23
  const WeightedRatioBasketItem = z.object({
25
24
  symbol: InstrumentId,
26
25
  side: Side,
@@ -38,6 +38,7 @@ export declare const CreateLadderResponse: z.ZodObject<{
38
38
  }>;
39
39
  ladderId: z.ZodOptional<z.ZodUUID>;
40
40
  ladderIndex: z.ZodOptional<z.ZodNumber>;
41
+ parentTriggerId: z.ZodOptional<z.ZodUUID>;
41
42
  triggeredAt: z.ZodOptional<z.ZodString>;
42
43
  cancelledAt: z.ZodOptional<z.ZodString>;
43
44
  cancelledReason: z.ZodOptional<z.ZodEnum<{
@@ -238,6 +239,7 @@ export declare const CreateLadderResponse: z.ZodObject<{
238
239
  }>;
239
240
  ladderId: z.ZodOptional<z.ZodUUID>;
240
241
  ladderIndex: z.ZodOptional<z.ZodNumber>;
242
+ parentTriggerId: z.ZodOptional<z.ZodUUID>;
241
243
  triggeredAt: z.ZodOptional<z.ZodString>;
242
244
  cancelledAt: z.ZodOptional<z.ZodString>;
243
245
  cancelledReason: z.ZodOptional<z.ZodEnum<{
@@ -484,6 +486,7 @@ export declare const CreateLadderResponse: z.ZodObject<{
484
486
  }>;
485
487
  ladderId: z.ZodOptional<z.ZodUUID>;
486
488
  ladderIndex: z.ZodOptional<z.ZodNumber>;
489
+ parentTriggerId: z.ZodOptional<z.ZodUUID>;
487
490
  triggeredAt: z.ZodOptional<z.ZodString>;
488
491
  cancelledAt: z.ZodOptional<z.ZodString>;
489
492
  cancelledReason: z.ZodOptional<z.ZodEnum<{
@@ -792,6 +795,7 @@ export declare const LadderResponse: z.ZodObject<{
792
795
  }>;
793
796
  ladderId: z.ZodOptional<z.ZodUUID>;
794
797
  ladderIndex: z.ZodOptional<z.ZodNumber>;
798
+ parentTriggerId: z.ZodOptional<z.ZodUUID>;
795
799
  triggeredAt: z.ZodOptional<z.ZodString>;
796
800
  cancelledAt: z.ZodOptional<z.ZodString>;
797
801
  cancelledReason: z.ZodOptional<z.ZodEnum<{
@@ -992,6 +996,7 @@ export declare const LadderResponse: z.ZodObject<{
992
996
  }>;
993
997
  ladderId: z.ZodOptional<z.ZodUUID>;
994
998
  ladderIndex: z.ZodOptional<z.ZodNumber>;
999
+ parentTriggerId: z.ZodOptional<z.ZodUUID>;
995
1000
  triggeredAt: z.ZodOptional<z.ZodString>;
996
1001
  cancelledAt: z.ZodOptional<z.ZodString>;
997
1002
  cancelledReason: z.ZodOptional<z.ZodEnum<{
@@ -1238,6 +1243,7 @@ export declare const LadderResponse: z.ZodObject<{
1238
1243
  }>;
1239
1244
  ladderId: z.ZodOptional<z.ZodUUID>;
1240
1245
  ladderIndex: z.ZodOptional<z.ZodNumber>;
1246
+ parentTriggerId: z.ZodOptional<z.ZodUUID>;
1241
1247
  triggeredAt: z.ZodOptional<z.ZodString>;
1242
1248
  cancelledAt: z.ZodOptional<z.ZodString>;
1243
1249
  cancelledReason: z.ZodOptional<z.ZodEnum<{
@@ -1548,6 +1554,7 @@ export declare const LadderListResponse: z.ZodObject<{
1548
1554
  }>;
1549
1555
  ladderId: z.ZodOptional<z.ZodUUID>;
1550
1556
  ladderIndex: z.ZodOptional<z.ZodNumber>;
1557
+ parentTriggerId: z.ZodOptional<z.ZodUUID>;
1551
1558
  triggeredAt: z.ZodOptional<z.ZodString>;
1552
1559
  cancelledAt: z.ZodOptional<z.ZodString>;
1553
1560
  cancelledReason: z.ZodOptional<z.ZodEnum<{
@@ -1748,6 +1755,7 @@ export declare const LadderListResponse: z.ZodObject<{
1748
1755
  }>;
1749
1756
  ladderId: z.ZodOptional<z.ZodUUID>;
1750
1757
  ladderIndex: z.ZodOptional<z.ZodNumber>;
1758
+ parentTriggerId: z.ZodOptional<z.ZodUUID>;
1751
1759
  triggeredAt: z.ZodOptional<z.ZodString>;
1752
1760
  cancelledAt: z.ZodOptional<z.ZodString>;
1753
1761
  cancelledReason: z.ZodOptional<z.ZodEnum<{
@@ -1994,6 +2002,7 @@ export declare const LadderListResponse: z.ZodObject<{
1994
2002
  }>;
1995
2003
  ladderId: z.ZodOptional<z.ZodUUID>;
1996
2004
  ladderIndex: z.ZodOptional<z.ZodNumber>;
2005
+ parentTriggerId: z.ZodOptional<z.ZodUUID>;
1997
2006
  triggeredAt: z.ZodOptional<z.ZodString>;
1998
2007
  cancelledAt: z.ZodOptional<z.ZodString>;
1999
2008
  cancelledReason: z.ZodOptional<z.ZodEnum<{