@polyester/sdk 0.34.0-devnet-20261105175240 → 0.34.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/CHANGELOG.md +3 -1
  2. package/dist/services/balances/balances.d.ts.map +1 -1
  3. package/dist/services/balances/balances.js +3 -8
  4. package/dist/services/balances/balances.js.map +1 -1
  5. package/dist/services/balances/balances.schemas.d.ts +0 -5
  6. package/dist/services/balances/balances.schemas.d.ts.map +1 -1
  7. package/dist/services/balances/balances.schemas.js +34 -20
  8. package/dist/services/balances/balances.schemas.js.map +1 -1
  9. package/dist/services/candles/candles.d.ts.map +1 -1
  10. package/dist/services/candles/candles.js +7 -20
  11. package/dist/services/candles/candles.js.map +1 -1
  12. package/dist/services/candles/candles.schemas.d.ts +10 -10
  13. package/dist/services/candles/candles.schemas.d.ts.map +1 -1
  14. package/dist/services/candles/candles.schemas.js +35 -20
  15. package/dist/services/candles/candles.schemas.js.map +1 -1
  16. package/dist/services/changelog/changelog.schemas.d.ts +17 -17
  17. package/dist/services/checkpoints/checkpoints.schemas.d.ts +2 -2
  18. package/dist/services/heatmap/heatmap.schemas.d.ts +13 -13
  19. package/dist/services/lifecycle/lifecycle.schemas.d.ts +39 -39
  20. package/dist/services/market-data/market-data.d.ts.map +1 -1
  21. package/dist/services/market-data/market-data.js +3 -6
  22. package/dist/services/market-data/market-data.js.map +1 -1
  23. package/dist/services/market-data/market-data.schemas.d.ts.map +1 -1
  24. package/dist/services/market-data/market-data.schemas.js +22 -23
  25. package/dist/services/market-data/market-data.schemas.js.map +1 -1
  26. package/dist/services/market-overview/market-overview.schemas.d.ts +3 -3
  27. package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
  28. package/dist/services/orders/orders-output.schemas.d.ts +4 -3
  29. package/dist/services/orders/orders-output.schemas.d.ts.map +1 -1
  30. package/dist/services/orders/orders-output.schemas.js +100 -83
  31. package/dist/services/orders/orders-output.schemas.js.map +1 -1
  32. package/dist/services/orders/orders.d.ts.map +1 -1
  33. package/dist/services/orders/orders.js +6 -9
  34. package/dist/services/orders/orders.js.map +1 -1
  35. package/dist/services/trades/trades.d.ts.map +1 -1
  36. package/dist/services/trades/trades.js +3 -5
  37. package/dist/services/trades/trades.js.map +1 -1
  38. package/dist/services/trades/trades.schemas.d.ts +3 -2
  39. package/dist/services/trades/trades.schemas.d.ts.map +1 -1
  40. package/dist/services/trades/trades.schemas.js +42 -35
  41. package/dist/services/trades/trades.schemas.js.map +1 -1
  42. package/dist/services/triggers/triggers-output.schemas.d.ts +12 -12
  43. package/package.json +1 -1
@@ -141,7 +141,7 @@ declare const LifecycleFlowStepActivitySchema: v.SchemaWithPipe<readonly [v.Obje
141
141
  /** Chain holding `txRef`; a `GetDepositWithdrawConfig` chain ID, 0 when `txRef` is not a chain transaction. */
142
142
  readonly txChainId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, 0>;
143
143
  readonly occurredAtUnixMs: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
144
- readonly lifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle">]>;
144
+ readonly lifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle">]>;
145
145
  readonly lifecycleReason: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, LifecycleReasonValue>]>;
146
146
  readonly zipperReason: v.OptionalSchema<v.ObjectSchema<{
147
147
  readonly code: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -169,7 +169,7 @@ declare const LifecycleFlowStepActivitySchema: v.SchemaWithPipe<readonly [v.Obje
169
169
  txRef: string;
170
170
  txChainId: number;
171
171
  occurredAtUnixMs: number;
172
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
172
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
173
173
  lifecycleReason: LifecycleReasonValue;
174
174
  zipperReason?: {
175
175
  code: number;
@@ -191,7 +191,7 @@ declare const LifecycleFlowStepActivitySchema: v.SchemaWithPipe<readonly [v.Obje
191
191
  txRef: string;
192
192
  txChainId: number;
193
193
  occurredAtUnixMs: number;
194
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
194
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
195
195
  lifecycleReason: LifecycleReasonValue;
196
196
  zipperReason?: {
197
197
  code: number;
@@ -262,7 +262,7 @@ declare const LifecycleFlowStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
262
262
  readonly milestoneTxRef: v.StringSchema<undefined>;
263
263
  /** Chain holding `milestoneTxRef`; a `GetDepositWithdrawConfig` chain ID, 0 when it is not a chain transaction. */
264
264
  readonly milestoneTxChainId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, 0>;
265
- readonly lifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle">]>;
265
+ readonly lifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle">]>;
266
266
  readonly lifecycleReason: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, LifecycleReasonValue>]>;
267
267
  readonly zipperReason: v.OptionalSchema<v.ObjectSchema<{
268
268
  readonly code: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -284,7 +284,7 @@ declare const LifecycleFlowStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
284
284
  /** Chain holding `txRef`; a `GetDepositWithdrawConfig` chain ID, 0 when `txRef` is not a chain transaction. */
285
285
  readonly txChainId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, 0>;
286
286
  readonly occurredAtUnixMs: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
287
- readonly lifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle">]>;
287
+ readonly lifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle">]>;
288
288
  readonly lifecycleReason: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, LifecycleReasonValue>]>;
289
289
  readonly zipperReason: v.OptionalSchema<v.ObjectSchema<{
290
290
  readonly code: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -312,7 +312,7 @@ declare const LifecycleFlowStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
312
312
  txRef: string;
313
313
  txChainId: number;
314
314
  occurredAtUnixMs: number;
315
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
315
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
316
316
  lifecycleReason: LifecycleReasonValue;
317
317
  zipperReason?: {
318
318
  code: number;
@@ -334,7 +334,7 @@ declare const LifecycleFlowStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
334
334
  txRef: string;
335
335
  txChainId: number;
336
336
  occurredAtUnixMs: number;
337
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
337
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
338
338
  lifecycleReason: LifecycleReasonValue;
339
339
  zipperReason?: {
340
340
  code: number;
@@ -376,7 +376,7 @@ declare const LifecycleFlowStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
376
376
  }) | undefined;
377
377
  milestoneTxRef: string;
378
378
  milestoneTxChainId: number;
379
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
379
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
380
380
  lifecycleReason: LifecycleReasonValue;
381
381
  zipperReason?: {
382
382
  code: number;
@@ -397,7 +397,7 @@ declare const LifecycleFlowStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
397
397
  txRef: string;
398
398
  txChainId: number;
399
399
  occurredAtUnixMs: number;
400
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
400
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
401
401
  lifecycleReason: LifecycleReasonValue;
402
402
  zipperReason?: {
403
403
  code: number;
@@ -439,7 +439,7 @@ declare const LifecycleFlowStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
439
439
  }) | undefined;
440
440
  milestoneTxRef: string;
441
441
  milestoneTxChainId: number;
442
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
442
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
443
443
  lifecycleReason: LifecycleReasonValue;
444
444
  zipperReason?: {
445
445
  code: number;
@@ -460,7 +460,7 @@ declare const LifecycleFlowStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
460
460
  txRef: string;
461
461
  txChainId: number;
462
462
  occurredAtUnixMs: number;
463
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
463
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
464
464
  lifecycleReason: LifecycleReasonValue;
465
465
  zipperReason?: {
466
466
  code: number;
@@ -558,7 +558,7 @@ declare const LifecycleFlowSummarySchema: v.SchemaWithPipe<readonly [v.ObjectSch
558
558
  readonly sourceDomain: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending">]>;
559
559
  readonly destinationDomain: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending">]>;
560
560
  readonly latestTxRef: v.StringSchema<undefined>;
561
- readonly latestLifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle">]>;
561
+ readonly latestLifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle">]>;
562
562
  readonly lifecycleReason: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, LifecycleReasonValue>]>;
563
563
  readonly zipperReason: v.OptionalSchema<v.ObjectSchema<{
564
564
  readonly code: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -622,7 +622,7 @@ declare const LifecycleFlowSummarySchema: v.SchemaWithPipe<readonly [v.ObjectSch
622
622
  sourceDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
623
623
  destinationDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
624
624
  latestTxRef: string;
625
- latestLifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
625
+ latestLifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
626
626
  lifecycleReason: LifecycleReasonValue;
627
627
  zipperReason?: {
628
628
  code: number;
@@ -685,7 +685,7 @@ declare const LifecycleFlowSummarySchema: v.SchemaWithPipe<readonly [v.ObjectSch
685
685
  sourceDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
686
686
  destinationDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
687
687
  latestTxRef: string;
688
- latestLifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
688
+ latestLifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
689
689
  lifecycleReason: LifecycleReasonValue;
690
690
  zipperReason?: {
691
691
  code: number;
@@ -780,7 +780,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
780
780
  readonly sourceDomain: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending">]>;
781
781
  readonly destinationDomain: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending">]>;
782
782
  readonly latestTxRef: v.StringSchema<undefined>;
783
- readonly latestLifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle">]>;
783
+ readonly latestLifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle">]>;
784
784
  readonly lifecycleReason: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, LifecycleReasonValue>]>;
785
785
  readonly zipperReason: v.OptionalSchema<v.ObjectSchema<{
786
786
  readonly code: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -844,7 +844,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
844
844
  sourceDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
845
845
  destinationDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
846
846
  latestTxRef: string;
847
- latestLifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
847
+ latestLifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
848
848
  lifecycleReason: LifecycleReasonValue;
849
849
  zipperReason?: {
850
850
  code: number;
@@ -907,7 +907,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
907
907
  sourceDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
908
908
  destinationDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
909
909
  latestTxRef: string;
910
- latestLifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
910
+ latestLifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
911
911
  lifecycleReason: LifecycleReasonValue;
912
912
  zipperReason?: {
913
913
  code: number;
@@ -994,7 +994,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
994
994
  readonly milestoneTxRef: v.StringSchema<undefined>;
995
995
  /** Chain holding `milestoneTxRef`; a `GetDepositWithdrawConfig` chain ID, 0 when it is not a chain transaction. */
996
996
  readonly milestoneTxChainId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, 0>;
997
- readonly lifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle">]>;
997
+ readonly lifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle">]>;
998
998
  readonly lifecycleReason: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, LifecycleReasonValue>]>;
999
999
  readonly zipperReason: v.OptionalSchema<v.ObjectSchema<{
1000
1000
  readonly code: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -1016,7 +1016,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
1016
1016
  /** Chain holding `txRef`; a `GetDepositWithdrawConfig` chain ID, 0 when `txRef` is not a chain transaction. */
1017
1017
  readonly txChainId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, 0>;
1018
1018
  readonly occurredAtUnixMs: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
1019
- readonly lifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle">]>;
1019
+ readonly lifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle">]>;
1020
1020
  readonly lifecycleReason: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, LifecycleReasonValue>]>;
1021
1021
  readonly zipperReason: v.OptionalSchema<v.ObjectSchema<{
1022
1022
  readonly code: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -1044,7 +1044,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
1044
1044
  txRef: string;
1045
1045
  txChainId: number;
1046
1046
  occurredAtUnixMs: number;
1047
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1047
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1048
1048
  lifecycleReason: LifecycleReasonValue;
1049
1049
  zipperReason?: {
1050
1050
  code: number;
@@ -1066,7 +1066,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
1066
1066
  txRef: string;
1067
1067
  txChainId: number;
1068
1068
  occurredAtUnixMs: number;
1069
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1069
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1070
1070
  lifecycleReason: LifecycleReasonValue;
1071
1071
  zipperReason?: {
1072
1072
  code: number;
@@ -1108,7 +1108,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
1108
1108
  }) | undefined;
1109
1109
  milestoneTxRef: string;
1110
1110
  milestoneTxChainId: number;
1111
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1111
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1112
1112
  lifecycleReason: LifecycleReasonValue;
1113
1113
  zipperReason?: {
1114
1114
  code: number;
@@ -1129,7 +1129,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
1129
1129
  txRef: string;
1130
1130
  txChainId: number;
1131
1131
  occurredAtUnixMs: number;
1132
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1132
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1133
1133
  lifecycleReason: LifecycleReasonValue;
1134
1134
  zipperReason?: {
1135
1135
  code: number;
@@ -1171,7 +1171,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
1171
1171
  }) | undefined;
1172
1172
  milestoneTxRef: string;
1173
1173
  milestoneTxChainId: number;
1174
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1174
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1175
1175
  lifecycleReason: LifecycleReasonValue;
1176
1176
  zipperReason?: {
1177
1177
  code: number;
@@ -1192,7 +1192,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
1192
1192
  txRef: string;
1193
1193
  txChainId: number;
1194
1194
  occurredAtUnixMs: number;
1195
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1195
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1196
1196
  lifecycleReason: LifecycleReasonValue;
1197
1197
  zipperReason?: {
1198
1198
  code: number;
@@ -1276,7 +1276,7 @@ declare const ListLifecycleFlowsOutputSchema: v.ObjectSchema<{
1276
1276
  readonly sourceDomain: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending">]>;
1277
1277
  readonly destinationDomain: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending">]>;
1278
1278
  readonly latestTxRef: v.StringSchema<undefined>;
1279
- readonly latestLifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle">]>;
1279
+ readonly latestLifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle">]>;
1280
1280
  readonly lifecycleReason: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, LifecycleReasonValue>]>;
1281
1281
  readonly zipperReason: v.OptionalSchema<v.ObjectSchema<{
1282
1282
  readonly code: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -1340,7 +1340,7 @@ declare const ListLifecycleFlowsOutputSchema: v.ObjectSchema<{
1340
1340
  sourceDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
1341
1341
  destinationDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
1342
1342
  latestTxRef: string;
1343
- latestLifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1343
+ latestLifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1344
1344
  lifecycleReason: LifecycleReasonValue;
1345
1345
  zipperReason?: {
1346
1346
  code: number;
@@ -1403,7 +1403,7 @@ declare const ListLifecycleFlowsOutputSchema: v.ObjectSchema<{
1403
1403
  sourceDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
1404
1404
  destinationDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
1405
1405
  latestTxRef: string;
1406
- latestLifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1406
+ latestLifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1407
1407
  lifecycleReason: LifecycleReasonValue;
1408
1408
  zipperReason?: {
1409
1409
  code: number;
@@ -1501,7 +1501,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
1501
1501
  readonly sourceDomain: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending">]>;
1502
1502
  readonly destinationDomain: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending">]>;
1503
1503
  readonly latestTxRef: v.StringSchema<undefined>;
1504
- readonly latestLifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle">]>;
1504
+ readonly latestLifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle">]>;
1505
1505
  readonly lifecycleReason: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, LifecycleReasonValue>]>;
1506
1506
  readonly zipperReason: v.OptionalSchema<v.ObjectSchema<{
1507
1507
  readonly code: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -1565,7 +1565,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
1565
1565
  sourceDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
1566
1566
  destinationDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
1567
1567
  latestTxRef: string;
1568
- latestLifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1568
+ latestLifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1569
1569
  lifecycleReason: LifecycleReasonValue;
1570
1570
  zipperReason?: {
1571
1571
  code: number;
@@ -1628,7 +1628,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
1628
1628
  sourceDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
1629
1629
  destinationDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
1630
1630
  latestTxRef: string;
1631
- latestLifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1631
+ latestLifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1632
1632
  lifecycleReason: LifecycleReasonValue;
1633
1633
  zipperReason?: {
1634
1634
  code: number;
@@ -1715,7 +1715,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
1715
1715
  readonly milestoneTxRef: v.StringSchema<undefined>;
1716
1716
  /** Chain holding `milestoneTxRef`; a `GetDepositWithdrawConfig` chain ID, 0 when it is not a chain transaction. */
1717
1717
  readonly milestoneTxChainId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, 0>;
1718
- readonly lifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle">]>;
1718
+ readonly lifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle">]>;
1719
1719
  readonly lifecycleReason: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, LifecycleReasonValue>]>;
1720
1720
  readonly zipperReason: v.OptionalSchema<v.ObjectSchema<{
1721
1721
  readonly code: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -1737,7 +1737,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
1737
1737
  /** Chain holding `txRef`; a `GetDepositWithdrawConfig` chain ID, 0 when `txRef` is not a chain transaction. */
1738
1738
  readonly txChainId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, 0>;
1739
1739
  readonly occurredAtUnixMs: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
1740
- readonly lifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle">]>;
1740
+ readonly lifecycleSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle">]>;
1741
1741
  readonly lifecycleReason: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, LifecycleReasonValue>]>;
1742
1742
  readonly zipperReason: v.OptionalSchema<v.ObjectSchema<{
1743
1743
  readonly code: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -1765,7 +1765,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
1765
1765
  txRef: string;
1766
1766
  txChainId: number;
1767
1767
  occurredAtUnixMs: number;
1768
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1768
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1769
1769
  lifecycleReason: LifecycleReasonValue;
1770
1770
  zipperReason?: {
1771
1771
  code: number;
@@ -1787,7 +1787,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
1787
1787
  txRef: string;
1788
1788
  txChainId: number;
1789
1789
  occurredAtUnixMs: number;
1790
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1790
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1791
1791
  lifecycleReason: LifecycleReasonValue;
1792
1792
  zipperReason?: {
1793
1793
  code: number;
@@ -1829,7 +1829,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
1829
1829
  }) | undefined;
1830
1830
  milestoneTxRef: string;
1831
1831
  milestoneTxChainId: number;
1832
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1832
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1833
1833
  lifecycleReason: LifecycleReasonValue;
1834
1834
  zipperReason?: {
1835
1835
  code: number;
@@ -1850,7 +1850,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
1850
1850
  txRef: string;
1851
1851
  txChainId: number;
1852
1852
  occurredAtUnixMs: number;
1853
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1853
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1854
1854
  lifecycleReason: LifecycleReasonValue;
1855
1855
  zipperReason?: {
1856
1856
  code: number;
@@ -1892,7 +1892,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
1892
1892
  }) | undefined;
1893
1893
  milestoneTxRef: string;
1894
1894
  milestoneTxChainId: number;
1895
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1895
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1896
1896
  lifecycleReason: LifecycleReasonValue;
1897
1897
  zipperReason?: {
1898
1898
  code: number;
@@ -1913,7 +1913,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
1913
1913
  txRef: string;
1914
1914
  txChainId: number;
1915
1915
  occurredAtUnixMs: number;
1916
- lifecycleSource: "unspecified" | "relayer" | "polyester_chain" | "executor" | "ledger" | "lifecycle";
1916
+ lifecycleSource: "unspecified" | "ledger" | "relayer" | "polyester_chain" | "executor" | "lifecycle";
1917
1917
  lifecycleReason: LifecycleReasonValue;
1918
1918
  zipperReason?: {
1919
1919
  code: number;
@@ -1 +1 @@
1
- {"version":3,"file":"market-data.d.ts","names":[],"sources":["../../../src/services/market-data/market-data.ts"],"mappings":";;;;;;;;UA8BU,6BAA6B,mBAAmB;EACtD;;;;;cAMS;;EAMG,YAAA,YAAY,qBAAqB,UAAU,mBAAmB,QAAQ;;;;;;;;;;EAgB5E,WACF,OAAO,sBACP,UAAU,0BACX;IAAU,QAAQ;IAAe;IAAuB,WAAW;;;;;;;;;EAsBhE,cAAc,UAAU,0BAA0B,QAAQ;;;;;;EAUhE,gBAAgB,OAAO"}
1
+ {"version":3,"file":"market-data.d.ts","names":[],"sources":["../../../src/services/market-data/market-data.ts"],"mappings":";;;;;;;;UA6BU,6BAA6B,mBAAmB;EACtD;;;;;cAMS;;EAKG,YAAA,YAAY,qBAAqB,UAAU,mBAAmB,QAAQ;;;;;;;;;;EAe5E,WACF,OAAO,sBACP,UAAU,0BACX;IAAU,QAAQ;IAAe;IAAuB,WAAW;;;;;;;;;EAsBhE,cAAc,UAAU,0BAA0B,QAAQ;;;;;;EAUhE,gBAAgB,OAAO"}
@@ -5,9 +5,8 @@ import { SymbolIdInputSchema } from "../shared.js";
5
5
  import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
6
6
  import { MarketDataService as MarketDataService$1, MarketTradeBatchSchema } from "../../gen/marketdata/v1/marketdata_pb.js";
7
7
  import { isDev } from "../../utils/is-dev.js";
8
- import { GetMarketTradesInputSchema, SpotConfigSchema, TradeBackfillSchema, createMarketTradeSchema } from "./market-data.schemas.js";
8
+ import { GetMarketTradesInputSchema, SpotConfigSchema, TradeBackfillSchema, formatMarketTrade } from "./market-data.schemas.js";
9
9
  import { createClient } from "@connectrpc/connect";
10
- import * as v from "valibot";
11
10
  //#region src/services/market-data/market-data.ts
12
11
  /**
13
12
  * Exposes public spot trades, spot configuration, and live trade streams.
@@ -16,12 +15,10 @@ var MarketDataService = class {
16
15
  #client;
17
16
  #realtime;
18
17
  #scales;
19
- #marketTradeSchema;
20
18
  constructor(transports, realtime, scales) {
21
19
  this.#client = createClient(MarketDataService$1, transports.publicApi);
22
20
  this.#realtime = realtime;
23
21
  this.#scales = scales;
24
- this.#marketTradeSchema = createMarketTradeSchema(scales);
25
22
  }
26
23
  /**
27
24
  * Returns recent public trades for one spot market, ordered newest-first by execution timestamp with match id as a tie-breaker. Supports limit, time bounds, side filtering, and match-id pagination.
@@ -36,7 +33,7 @@ var MarketDataService = class {
36
33
  await this.#scales.ready();
37
34
  const validatedInput = parse(GetMarketTradesInputSchema, input);
38
35
  const res = await this.#client.getTrades(validatedInput, toConnectCallOptions(options));
39
- const trades = parse(v.array(this.#marketTradeSchema), res.trades);
36
+ const trades = res.trades.map((trade) => formatMarketTrade(this.#scales, trade));
40
37
  if (validatedInput.afterTradeId === void 0) return {
41
38
  trades,
42
39
  nextPageToken: res.nextPageToken
@@ -73,7 +70,7 @@ var MarketDataService = class {
73
70
  channel,
74
71
  schema: MarketTradeBatchSchema,
75
72
  ready: () => this.#scales.ready(),
76
- onPublication: (batch) => deliverBatch(channel, batch.events, (trade) => input.onEvent(parse(this.#marketTradeSchema, trade)), notifyError),
73
+ onPublication: (batch) => deliverBatch(channel, batch.events, (trade) => input.onEvent(formatMarketTrade(this.#scales, trade)), notifyError),
77
74
  onConnected: () => input.onOpen?.(),
78
75
  onDisconnected: () => input.onClose?.(),
79
76
  onError: notifyError
@@ -1 +1 @@
1
- {"version":3,"file":"market-data.js","names":["#client","Proto.MarketDataService","#realtime","#scales","#marketTradeSchema","Proto.MarketTradeBatchSchema"],"sources":["../../../src/services/market-data/market-data.ts"],"sourcesContent":["import * as Proto from \"../../gen/marketdata/v1/marketdata_pb.js\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\nimport type { PolyesterRealtime } from \"../../realtime/types.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport {\n deliverBatch,\n type SdkSubscriptionErrorContext,\n} from \"../../shared/subscription-errors.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport { connectReadyGatedProtoChannel } from \"../../realtime/ready-gated-subscription.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport type { PublicApiTransports } from \"../../shared/transports.js\";\nimport {\n GetMarketTradesInputSchema,\n createMarketTradeSchema,\n type GetMarketTradesInput,\n type SpotConfig,\n SpotConfigSchema,\n type MarketTrade,\n TradeBackfillSchema,\n type TradeBackfill,\n} from \"./market-data.schemas.js\";\nimport { isDev } from \"../../utils/is-dev.js\";\n\ninterface SubscribeTradesInput extends BaseSubscribeInput<MarketTrade> {\n symbolId: number;\n}\n\n/**\n * Exposes public spot trades, spot configuration, and live trade streams.\n */\nexport class MarketDataService {\n #client: Client<typeof Proto.MarketDataService>;\n #realtime: PolyesterRealtime;\n #scales: SdkScales;\n #marketTradeSchema: ReturnType<typeof createMarketTradeSchema>;\n\n constructor(transports: PublicApiTransports, realtime: PolyesterRealtime, scales: SdkScales) {\n this.#client = createClient(Proto.MarketDataService, transports.publicApi);\n this.#realtime = realtime;\n this.#scales = scales;\n this.#marketTradeSchema = createMarketTradeSchema(scales);\n }\n\n /**\n * Returns recent public trades for one spot market, ordered newest-first by execution timestamp with match id as a tie-breaker. Supports limit, time bounds, side filtering, and match-id pagination.\n *\n * With `afterTradeId`, it instead walks the symbol's trades by `matchId`, oldest first and\n * gap-free, to backfill trades missed on a live stream, and the result carries `backfill`.\n * Start from `\"0\"`, then pass `backfill.nextAfterTradeId`; when it equals the `afterTradeId`\n * sent, nothing newer is available yet, so retry later with backoff. `afterTradeId` cannot\n * be combined with `side`, `startTsNs`, `endTsNs` or `pageToken`.\n */\n async listTrades(\n input: GetMarketTradesInput,\n options?: PolyesterRequestOptions,\n ): Promise<{ trades: MarketTrade[]; nextPageToken: string; backfill?: TradeBackfill }> {\n await this.#scales.ready();\n const validatedInput = parse(GetMarketTradesInputSchema, input);\n const res = await this.#client.getTrades(validatedInput, toConnectCallOptions(options));\n const trades = parse(v.array(this.#marketTradeSchema), res.trades);\n if (validatedInput.afterTradeId === undefined) {\n return { trades, nextPageToken: res.nextPageToken };\n }\n return {\n trades,\n nextPageToken: res.nextPageToken,\n backfill: parse(TradeBackfillSchema, res),\n };\n }\n\n /**\n * Returns the cacheable spot reference-data snapshot, including asset metadata, pair trading constraints, display scales, statuses, and market slippage defaults.\n *\n * This is the catalog's own data source, so it must never wait on catalog\n * readiness (that would deadlock the initial catalog refresh) and carries\n * no decimal conversion.\n */\n async getSpotConfig(options?: PolyesterRequestOptions): Promise<SpotConfig> {\n const res = await this.#client.getSpotConfig({}, toConnectCallOptions(options));\n return parse(SpotConfigSchema, res);\n }\n\n /**\n * Subscribes to public trade prints on public:spot:market:trades:{symbolId}:proto for the requested symbol and emits parsed market trades.\n * Each publication batches trades, emitted one at a time in execution order; a trade\n * whose `matchId` was already emitted replaces the earlier copy.\n */\n subscribeTrades(input: SubscribeTradesInput): () => void {\n const symbolId = parse(SymbolIdInputSchema, input.symbolId);\n const channel = `public:spot:market:trades:${symbolId}:proto`;\n const notifyError = (error: SdkSubscriptionErrorContext) => {\n if (isDev()) {\n console.error(\"Market trades subscription error\", error);\n }\n input.onError?.(error);\n };\n return connectReadyGatedProtoChannel(this.#realtime, {\n channel,\n schema: Proto.MarketTradeBatchSchema,\n ready: () => this.#scales.ready(),\n onPublication: (batch) =>\n deliverBatch(\n channel,\n batch.events,\n (trade) => input.onEvent(parse(this.#marketTradeSchema, trade)),\n notifyError,\n ),\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: notifyError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAqCA,IAAa,oBAAb,MAA+B;CAC3B;CACA;CACA;CACA;CAEA,YAAY,YAAiC,UAA6B,QAAmB;EACzF,KAAKA,UAAU,aAAaC,qBAAyB,WAAW,SAAS;EACzE,KAAKC,YAAY;EACjB,KAAKC,UAAU;EACf,KAAKC,qBAAqB,wBAAwB,MAAM;CAC5D;;;;;;;;;;CAWA,MAAM,WACF,OACA,SACmF;EACnF,MAAM,KAAKD,QAAQ,MAAM;EACzB,MAAM,iBAAiB,MAAM,4BAA4B,KAAK;EAC9D,MAAM,MAAM,MAAM,KAAKH,QAAQ,UAAU,gBAAgB,qBAAqB,OAAO,CAAC;EACtF,MAAM,SAAS,MAAM,EAAE,MAAM,KAAKI,kBAAkB,GAAG,IAAI,MAAM;EACjE,IAAI,eAAe,iBAAiB,KAAA,GAChC,OAAO;GAAE;GAAQ,eAAe,IAAI;EAAc;EAEtD,OAAO;GACH;GACA,eAAe,IAAI;GACnB,UAAU,MAAM,qBAAqB,GAAG;EAC5C;CACJ;;;;;;;;CASA,MAAM,cAAc,SAAwD;EACxE,MAAM,MAAM,MAAM,KAAKJ,QAAQ,cAAc,CAAC,GAAG,qBAAqB,OAAO,CAAC;EAC9E,OAAO,MAAM,kBAAkB,GAAG;CACtC;;;;;;CAOA,gBAAgB,OAAyC;EAErD,MAAM,UAAU,6BADC,MAAM,qBAAqB,MAAM,QACE,EAAE;EACtD,MAAM,eAAe,UAAuC;GACxD,IAAI,MAAM,GACN,QAAQ,MAAM,oCAAoC,KAAK;GAE3D,MAAM,UAAU,KAAK;EACzB;EACA,OAAO,8BAA8B,KAAKE,WAAW;GACjD;GACA,QAAQG;GACR,aAAa,KAAKF,QAAQ,MAAM;GAChC,gBAAgB,UACZ,aACI,SACA,MAAM,SACL,UAAU,MAAM,QAAQ,MAAM,KAAKC,oBAAoB,KAAK,CAAC,GAC9D,WACJ;GACJ,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS;EACb,CAAC;CACL;AACJ"}
1
+ {"version":3,"file":"market-data.js","names":["#client","Proto.MarketDataService","#realtime","#scales","Proto.MarketTradeBatchSchema"],"sources":["../../../src/services/market-data/market-data.ts"],"sourcesContent":["import * as Proto from \"../../gen/marketdata/v1/marketdata_pb.js\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\nimport type { PolyesterRealtime } from \"../../realtime/types.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport {\n deliverBatch,\n type SdkSubscriptionErrorContext,\n} from \"../../shared/subscription-errors.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport { connectReadyGatedProtoChannel } from \"../../realtime/ready-gated-subscription.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport type { PublicApiTransports } from \"../../shared/transports.js\";\nimport {\n GetMarketTradesInputSchema,\n formatMarketTrade,\n type GetMarketTradesInput,\n type SpotConfig,\n SpotConfigSchema,\n type MarketTrade,\n TradeBackfillSchema,\n type TradeBackfill,\n} from \"./market-data.schemas.js\";\nimport { isDev } from \"../../utils/is-dev.js\";\n\ninterface SubscribeTradesInput extends BaseSubscribeInput<MarketTrade> {\n symbolId: number;\n}\n\n/**\n * Exposes public spot trades, spot configuration, and live trade streams.\n */\nexport class MarketDataService {\n #client: Client<typeof Proto.MarketDataService>;\n #realtime: PolyesterRealtime;\n #scales: SdkScales;\n\n constructor(transports: PublicApiTransports, realtime: PolyesterRealtime, scales: SdkScales) {\n this.#client = createClient(Proto.MarketDataService, transports.publicApi);\n this.#realtime = realtime;\n this.#scales = scales;\n }\n\n /**\n * Returns recent public trades for one spot market, ordered newest-first by execution timestamp with match id as a tie-breaker. Supports limit, time bounds, side filtering, and match-id pagination.\n *\n * With `afterTradeId`, it instead walks the symbol's trades by `matchId`, oldest first and\n * gap-free, to backfill trades missed on a live stream, and the result carries `backfill`.\n * Start from `\"0\"`, then pass `backfill.nextAfterTradeId`; when it equals the `afterTradeId`\n * sent, nothing newer is available yet, so retry later with backoff. `afterTradeId` cannot\n * be combined with `side`, `startTsNs`, `endTsNs` or `pageToken`.\n */\n async listTrades(\n input: GetMarketTradesInput,\n options?: PolyesterRequestOptions,\n ): Promise<{ trades: MarketTrade[]; nextPageToken: string; backfill?: TradeBackfill }> {\n await this.#scales.ready();\n const validatedInput = parse(GetMarketTradesInputSchema, input);\n const res = await this.#client.getTrades(validatedInput, toConnectCallOptions(options));\n const trades = res.trades.map((trade) => formatMarketTrade(this.#scales, trade));\n if (validatedInput.afterTradeId === undefined) {\n return { trades, nextPageToken: res.nextPageToken };\n }\n return {\n trades,\n nextPageToken: res.nextPageToken,\n backfill: parse(TradeBackfillSchema, res),\n };\n }\n\n /**\n * Returns the cacheable spot reference-data snapshot, including asset metadata, pair trading constraints, display scales, statuses, and market slippage defaults.\n *\n * This is the catalog's own data source, so it must never wait on catalog\n * readiness (that would deadlock the initial catalog refresh) and carries\n * no decimal conversion.\n */\n async getSpotConfig(options?: PolyesterRequestOptions): Promise<SpotConfig> {\n const res = await this.#client.getSpotConfig({}, toConnectCallOptions(options));\n return parse(SpotConfigSchema, res);\n }\n\n /**\n * Subscribes to public trade prints on public:spot:market:trades:{symbolId}:proto for the requested symbol and emits parsed market trades.\n * Each publication batches trades, emitted one at a time in execution order; a trade\n * whose `matchId` was already emitted replaces the earlier copy.\n */\n subscribeTrades(input: SubscribeTradesInput): () => void {\n const symbolId = parse(SymbolIdInputSchema, input.symbolId);\n const channel = `public:spot:market:trades:${symbolId}:proto`;\n const notifyError = (error: SdkSubscriptionErrorContext) => {\n if (isDev()) {\n console.error(\"Market trades subscription error\", error);\n }\n input.onError?.(error);\n };\n return connectReadyGatedProtoChannel(this.#realtime, {\n channel,\n schema: Proto.MarketTradeBatchSchema,\n ready: () => this.#scales.ready(),\n onPublication: (batch) =>\n deliverBatch(\n channel,\n batch.events,\n (trade) => input.onEvent(formatMarketTrade(this.#scales, trade)),\n notifyError,\n ),\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: notifyError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAoCA,IAAa,oBAAb,MAA+B;CAC3B;CACA;CACA;CAEA,YAAY,YAAiC,UAA6B,QAAmB;EACzF,KAAKA,UAAU,aAAaC,qBAAyB,WAAW,SAAS;EACzE,KAAKC,YAAY;EACjB,KAAKC,UAAU;CACnB;;;;;;;;;;CAWA,MAAM,WACF,OACA,SACmF;EACnF,MAAM,KAAKA,QAAQ,MAAM;EACzB,MAAM,iBAAiB,MAAM,4BAA4B,KAAK;EAC9D,MAAM,MAAM,MAAM,KAAKH,QAAQ,UAAU,gBAAgB,qBAAqB,OAAO,CAAC;EACtF,MAAM,SAAS,IAAI,OAAO,KAAK,UAAU,kBAAkB,KAAKG,SAAS,KAAK,CAAC;EAC/E,IAAI,eAAe,iBAAiB,KAAA,GAChC,OAAO;GAAE;GAAQ,eAAe,IAAI;EAAc;EAEtD,OAAO;GACH;GACA,eAAe,IAAI;GACnB,UAAU,MAAM,qBAAqB,GAAG;EAC5C;CACJ;;;;;;;;CASA,MAAM,cAAc,SAAwD;EACxE,MAAM,MAAM,MAAM,KAAKH,QAAQ,cAAc,CAAC,GAAG,qBAAqB,OAAO,CAAC;EAC9E,OAAO,MAAM,kBAAkB,GAAG;CACtC;;;;;;CAOA,gBAAgB,OAAyC;EAErD,MAAM,UAAU,6BADC,MAAM,qBAAqB,MAAM,QACE,EAAE;EACtD,MAAM,eAAe,UAAuC;GACxD,IAAI,MAAM,GACN,QAAQ,MAAM,oCAAoC,KAAK;GAE3D,MAAM,UAAU,KAAK;EACzB;EACA,OAAO,8BAA8B,KAAKE,WAAW;GACjD;GACA,QAAQE;GACR,aAAa,KAAKD,QAAQ,MAAM;GAChC,gBAAgB,UACZ,aACI,SACA,MAAM,SACL,UAAU,MAAM,QAAQ,kBAAkB,KAAKA,SAAS,KAAK,CAAC,GAC/D,WACJ;GACJ,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS;EACb,CAAC;CACL;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"market-data.schemas.d.ts","names":[],"sources":["../../../src/services/market-data/market-data.schemas.ts"],"mappings":";;;;;iBAoBgB,wBAAwB,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;KA0B7C,cAAc,EAAE,YAAY,kBAAkB;;cAiC7C,qBAAmB,EAAA;;;;;;;;;;;;;;KAoBpB,gBAAgB,EAAE,mBAAmB;iBAEjC,oCAAgC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIpC,uBAAuB,EAAE,WACjC,kBAAkB"}
1
+ {"version":3,"file":"market-data.schemas.d.ts","names":[],"sources":["../../../src/services/market-data/market-data.schemas.ts"],"mappings":";;;;;iBA+CgB,wBAAwB,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;KAO7C,cAAc,EAAE,YAAY,kBAAkB;;cAiC7C,qBAAmB,EAAA;;;;;;;;;;;;;;KAoBpB,gBAAgB,EAAE,mBAAmB;iBAEjC,oCAAgC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIpC,uBAAuB,EAAE,WACjC,kBAAkB"}
@@ -7,28 +7,27 @@ import { SideSchema, SymbolIdInputSchema } from "../shared.js";
7
7
  import { timestampToMs, tsNsToTimestamp } from "../../utils/timestamp.js";
8
8
  import { PairStatusCodec, SideFilterCodec } from "./market-data.codecs.js";
9
9
  import * as v from "valibot";
10
- //#region src/services/market-data/market-data.schemas.ts
11
- function createMarketTradeSchema(scales) {
12
- return v.pipe(v.object({
13
- symbolId: v.number(),
14
- matchId: v.bigint(),
15
- isBuy: v.boolean(),
16
- priceTicks: v.bigint(),
17
- qtyScaled: v.bigint(),
18
- tsNs: v.optional(v.bigint(), 0n)
19
- }), v.transform((t) => {
20
- const sideLabel = t.isBuy ? "buy" : "sell";
21
- return {
22
- symbolId: t.symbolId,
23
- matchId: t.matchId.toString(),
24
- isBuy: t.isBuy,
25
- sideLabel,
26
- qty: scaledToDecimalOutput(t.qtyScaled, scales.baseQty(t.symbolId)),
27
- price: scaledToDecimalOutput(t.priceTicks, scales.price()),
28
- tsNs: t.tsNs.toString(),
29
- tsMs: tsNsToMs(t.tsNs)
30
- };
31
- }));
10
+ v.object({
11
+ symbolId: v.number(),
12
+ matchId: v.bigint(),
13
+ isBuy: v.boolean(),
14
+ priceTicks: v.bigint(),
15
+ qtyScaled: v.bigint(),
16
+ tsNs: v.optional(v.bigint(), 0n)
17
+ });
18
+ /** Formats a market trade; protobuf-decoded trades can be passed directly, they need no re-validation. */
19
+ function formatMarketTrade(scales, t) {
20
+ const sideLabel = t.isBuy ? "buy" : "sell";
21
+ return {
22
+ symbolId: t.symbolId,
23
+ matchId: t.matchId.toString(),
24
+ isBuy: t.isBuy,
25
+ sideLabel,
26
+ qty: scaledToDecimalOutput(t.qtyScaled, scales.baseQty(t.symbolId)),
27
+ price: scaledToDecimalOutput(t.priceTicks, scales.price()),
28
+ tsNs: t.tsNs.toString(),
29
+ tsMs: tsNsToMs(t.tsNs)
30
+ };
32
31
  }
33
32
  const GetMarketTradesInputSchema = v.pipe(v.object({
34
33
  symbolId: SymbolIdInputSchema,
@@ -231,6 +230,6 @@ const SpotConfigSchema = v.object({
231
230
  tsSec: v.pipe(v.bigint(), v.transform((v) => Number(v) * 1e3))
232
231
  });
233
232
  //#endregion
234
- export { AssetConfigSchema, GetMarketTradesInputSchema, PairConfigSchema, PairMarketDataConfigSchema, SpotConfigSchema, TradeBackfillSchema, createMarketTradeSchema };
233
+ export { AssetConfigSchema, GetMarketTradesInputSchema, PairConfigSchema, PairMarketDataConfigSchema, SpotConfigSchema, TradeBackfillSchema, formatMarketTrade };
235
234
 
236
235
  //# sourceMappingURL=market-data.schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"market-data.schemas.js","names":[],"sources":["../../../src/services/market-data/market-data.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { SideSchema, SymbolIdInputSchema } from \"../shared.js\";\nimport {\n PAIR_STATUSES,\n type AssetConfig,\n type PairConfig,\n type PairMarketDataConfig,\n type PairStatus,\n type SpotConfig,\n} from \"../../shared/catalog-config.js\";\nimport { tsNsToMs } from \"../../utils/time.js\";\nimport { timestampToMs, tsNsToTimestamp } from \"../../utils/timestamp.js\";\nimport { optionalUint64DecimalFilterSchema } from \"../../shared/schemas.js\";\nimport { scaledToDecimalOutput, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../shared/wire-bounds.js\";\nimport { PairStatusCodec, SideFilterCodec } from \"./market-data.codecs.js\";\n\nexport type { AssetConfig, PairConfig, PairMarketDataConfig, PairStatus, SpotConfig };\nexport { PAIR_STATUSES };\n\nexport function createMarketTradeSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n symbolId: v.number(),\n matchId: v.bigint(),\n isBuy: v.boolean(),\n priceTicks: v.bigint(),\n qtyScaled: v.bigint(),\n tsNs: v.optional(v.bigint(), 0n),\n }),\n v.transform((t) => {\n const sideLabel: v.InferOutput<typeof SideSchema> = t.isBuy ? \"buy\" : \"sell\";\n return {\n symbolId: t.symbolId,\n matchId: t.matchId.toString(),\n isBuy: t.isBuy,\n sideLabel,\n qty: scaledToDecimalOutput(t.qtyScaled, scales.baseQty(t.symbolId)),\n price: scaledToDecimalOutput(t.priceTicks, scales.price()),\n tsNs: t.tsNs.toString(),\n tsMs: tsNsToMs(t.tsNs),\n };\n }),\n );\n}\n\nexport type MarketTrade = v.InferOutput<ReturnType<typeof createMarketTradeSchema>>;\n\nexport const GetMarketTradesInputSchema = v.pipe(\n v.object({\n symbolId: SymbolIdInputSchema,\n side: v.optional(SideSchema),\n startTsNs: optionalUint64DecimalFilterSchema(\"startTsNs\"),\n endTsNs: optionalUint64DecimalFilterSchema(\"endTsNs\"),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(1_000))),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n afterTradeId: optionalUint64DecimalFilterSchema(\"afterTradeId\"),\n }),\n v.check(\n (input) =>\n input.afterTradeId === undefined ||\n (input.side === undefined &&\n input.startTsNs === undefined &&\n input.endTsNs === undefined &&\n input.pageToken === \"\"),\n \"afterTradeId cannot be combined with side, startTsNs, endTsNs or pageToken\",\n ),\n v.transform((input) => ({\n symbolId: input.symbolId,\n side: input.side ? SideFilterCodec.inputToProto[input.side] : undefined,\n startTime: tsNsToTimestamp(input.startTsNs),\n endTime: tsNsToTimestamp(input.endTsNs),\n limit: input.limit,\n pageToken: input.pageToken,\n afterTradeId: input.afterTradeId,\n })),\n);\n\n/** Cursor fields of a gap-free `afterTradeId` backfill page. */\nexport const TradeBackfillSchema = v.object({\n completeThroughTradeId: v.pipe(\n v.bigint(),\n v.transform((value) => value.toString()),\n ),\n nextAfterTradeId: v.pipe(\n v.bigint(),\n v.transform((value) => value.toString()),\n ),\n epochEnds: v.array(\n v.pipe(\n v.object({ epoch: v.bigint(), lastTradeId: v.bigint() }),\n v.transform(({ epoch, lastTradeId }) => ({\n epoch: epoch.toString(),\n lastTradeId: lastTradeId.toString(),\n })),\n ),\n ),\n});\n\nexport type TradeBackfill = v.InferOutput<typeof TradeBackfillSchema>;\n\nexport function createGetMarketTradesInputSchema() {\n return GetMarketTradesInputSchema;\n}\n\nexport type GetMarketTradesInput = v.InferInput<\n ReturnType<typeof createGetMarketTradesInputSchema>\n>;\nexport type GetMarketTradesRequest = v.InferOutput<\n ReturnType<typeof createGetMarketTradesInputSchema>\n>;\n\n/** Integer wire scales are protocol-bounded to 0..18 decimal places. */\nconst WireScaleSchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(18));\nconst OptionalDecimalLimitSchema = v.optional(v.pipe(v.string(), v.regex(/^\\d+(\\.\\d+)?$/)));\nconst OpenOrdersLimitSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX)),\n 0,\n);\n\nexport const AssetConfigSchema = v.pipe(\n v.object({\n /**\n * Asset identifier/symbol, e.g. 'USDT', 'BTC'.\n */\n asset: v.string(),\n /**\n * Internal ledger identifier for settlement systems.\n */\n ledgerId: v.number(),\n /**\n * The friendly display name for the asset (e.g. 'Bitcoin').\n */\n name: v.string(),\n /**\n * UI-only display precision for asset amounts/balances.\n */\n quantityDisplayDecimals: v.number(),\n /**\n * Fixed integer scaling for quantities/amounts in this asset (0..18).\n */\n quantityScale: v.number(),\n /**\n * Integer scale for public candle and market-overview base volume (0..18).\n */\n marketDataVolumeScale: v.optional(WireScaleSchema, 0),\n }),\n v.transform((a) => ({\n symbol: a.asset,\n ledgerId: a.ledgerId,\n name: a.name,\n quantityDisplayDecimals: a.quantityDisplayDecimals,\n quantityScale: a.quantityScale,\n marketDataVolumeScale: a.marketDataVolumeScale,\n })),\n);\n\nexport const PairMarketDataConfigSchema = v.optional(\n v.object({\n /**\n * Available price grouping sizes for the orderbook in quote units.\n * Allows viewing orders bucketed by larger increments (e.g., [0.01, 0.1, 1, 10]).\n */\n orderbookPriceBuckets: v.array(v.number()),\n }),\n {\n orderbookPriceBuckets: [] as number[],\n },\n);\n\nfunction bpsToPercent(bps: number): number {\n return bps / 100;\n}\n\nexport const PairConfigSchema = v.pipe(\n v.object({\n /**\n * Internal engine symbol id for the pair.\n */\n symbolId: v.number(),\n /**\n * Pair symbol string, e.g. 'BTC-USDT'\n */\n symbol: v.string(),\n /**\n * Base asset symbol, e.g. 'BTC'\n */\n baseAsset: v.string(),\n /**\n * Quote asset symbol, e.g. 'USDT'\n */\n quoteAsset: v.string(),\n /**\n * (e.g., \"0.01\") - The smallest price increment allowed. If tick size is 0.01, you can price at $100.00, $100.01, $100.02... but NOT $100.005.\n */\n tickSize: v.string(),\n /**\n * (e.g., \"0.0001\") - The smallest quantity increment allowed. If step size is 0.0001, you can order 100.0000, 100.0001, 100.0002... but NOT 100.00005.\n */\n stepSize: v.string(),\n /**\n * (e.g., \"1\") - Minimum order value in quote currency. If it's \"1\" and quote is USD, your order must be worth at least $1. So you can't buy $0.50 worth of something.\n */\n minNotionalQuote: v.string(),\n /**\n * Minimum quantity you can order in base currency terms. If it's \"0.001\" for BTC, smallest order is 0.001 BTC.\n */\n minQtyBase: v.string(),\n /**\n * Largest quantity of one limit order in base units. A replace is checked on its\n * new total less the filled quantity. Absent when the pair has no maximum.\n */\n maxLimitQtyBase: OptionalDecimalLimitSchema,\n /**\n * Largest quantity of one market order in base units, after converting a\n * quote-sized order to base. Absent when the pair has no maximum.\n */\n maxMarketQtyBase: OptionalDecimalLimitSchema,\n /**\n * Largest notional of one order in quote units: quantity times limit price, or\n * times protection price for a market order. Absent when the pair has no maximum.\n */\n maxOrderNotionalQuote: OptionalDecimalLimitSchema,\n /**\n * Largest notional of one market order in quote units, compared exactly with no\n * rounding. A buy is valued at its protection price and a sell at its reference\n * price (the touch or the client's reference price), before slippage. An order\n * above it is rejected with `MAX_NOTIONAL`. Absent when the pair has no maximum.\n */\n maxMarketNotionalQuote: OptionalDecimalLimitSchema,\n /**\n * Default resting-order limit (GTC and GTD) for a typical account on this pair.\n * An account may have a lower limit of its own.\n */\n maxOpenOrdersPerPair: OpenOrdersLimitSchema,\n\n /**\n * Controls whether trading fee can be deducted from what you receive when buying.\n * Example\n * - You buy 1 ETH, fee is 0.1%\n * - if `true`, you receive 0.999 ETH (fee taken from ETH you're getting)\n * - if `false`, you receive 1 ETH, but you pay the fee separately in the quote currency (e.g., extra USDT)\n */\n allowBuyFeeFromBase: v.boolean(),\n /**\n * Default market slippage for buy orders in basis points from proto.\n */\n defaultMarketSlippageBpsBuy: v.optional(v.number(), 0),\n /**\n * Default market slippage for sell orders in basis points from proto.\n */\n defaultMarketSlippageBpsSell: v.optional(v.number(), 0),\n /**\n * Maximum server/client reference-price drift in basis points from proto.\n */\n maxClientRefDriftBps: v.optional(v.number(), 0),\n\n /**\n * Market-data configuration for this pair (orderbook bucket sizes, depths).\n */\n marketdata: v.optional(PairMarketDataConfigSchema),\n /**\n * Base asset quantity scale copied from AssetConfig.quantityScale.\n */\n baseQuantityScale: v.number(),\n /**\n * Quote asset quantity scale copied from AssetConfig.quantityScale.\n */\n quoteQuantityScale: v.number(),\n /**\n * Integer scale for composite reference prices in candle responses (0..18).\n * Primary market and execution prices use the fixed scale 9.\n */\n referencePriceScale: v.optional(WireScaleSchema, 0),\n /**\n * Optional scheduled listing timestamp (UTC).\n */\n listingAt: v.pipe(v.optional(v.unknown()), v.transform(timestampToMs)),\n /**\n * Optional scheduled delisting timestamp (UTC).\n */\n delistingAt: v.pipe(v.optional(v.unknown()), v.transform(timestampToMs)),\n /**\n * Operational status of the pair.\n */\n status: v.pipe(\n v.number(),\n v.transform(\n (status): PairStatus =>\n PairStatusCodec.protoToOutput[\n status as keyof typeof PairStatusCodec.protoToOutput\n ] ?? \"unknown\",\n ),\n ),\n }),\n v.transform(\n ({\n defaultMarketSlippageBpsBuy,\n defaultMarketSlippageBpsSell,\n maxClientRefDriftBps,\n ...pair\n }) => ({\n ...pair,\n defaultMarketSlippagePctBuy: bpsToPercent(defaultMarketSlippageBpsBuy),\n defaultMarketSlippagePctSell: bpsToPercent(defaultMarketSlippageBpsSell),\n maxClientRefDriftPct: bpsToPercent(maxClientRefDriftBps),\n }),\n ),\n);\n\nexport const SpotConfigSchema = v.object({\n assets: v.array(AssetConfigSchema),\n pairs: v.array(PairConfigSchema),\n /**\n * Default resting-order limit (GTC and GTD) for a typical account across all pairs.\n * An account may have a lower limit of its own.\n */\n maxOpenOrdersTotal: OpenOrdersLimitSchema,\n tsSec: v.pipe(\n v.bigint(),\n v.transform((v) => Number(v) * 1000),\n ),\n});\n"],"mappings":";;;;;;;;;;AAoBA,SAAgB,wBAAwB,QAAmB;CACvD,OAAO,EAAE,KACL,EAAE,OAAO;EACL,UAAU,EAAE,OAAO;EACnB,SAAS,EAAE,OAAO;EAClB,OAAO,EAAE,QAAQ;EACjB,YAAY,EAAE,OAAO;EACrB,WAAW,EAAE,OAAO;EACpB,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACnC,CAAC,GACD,EAAE,WAAW,MAAM;EACf,MAAM,YAA8C,EAAE,QAAQ,QAAQ;EACtE,OAAO;GACH,UAAU,EAAE;GACZ,SAAS,EAAE,QAAQ,SAAS;GAC5B,OAAO,EAAE;GACT;GACA,KAAK,sBAAsB,EAAE,WAAW,OAAO,QAAQ,EAAE,QAAQ,CAAC;GAClE,OAAO,sBAAsB,EAAE,YAAY,OAAO,MAAM,CAAC;GACzD,MAAM,EAAE,KAAK,SAAS;GACtB,MAAM,SAAS,EAAE,IAAI;EACzB;CACJ,CAAC,CACL;AACJ;AAIA,MAAa,6BAA6B,EAAE,KACxC,EAAE,OAAO;CACL,UAAU;CACV,MAAM,EAAE,SAAS,UAAU;CAC3B,WAAW,kCAAkC,WAAW;CACxD,SAAS,kCAAkC,SAAS;CACpD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,SAAS,GAAK,CAAC,CAAC;CAClF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE;CACtD,cAAc,kCAAkC,cAAc;AAClE,CAAC,GACD,EAAE,OACG,UACG,MAAM,iBAAiB,KAAA,KACtB,M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,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,GAAG,EAAE,UAAU,aAAa,CAAC;;;;CAIrE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,GAAG,EAAE,UAAU,aAAa,CAAC;;;;CAIvE,QAAQ,EAAE,KACN,EAAE,OAAO,GACT,EAAE,WACG,WACG,gBAAgB,cACZ,WACC,SACb,CACJ;AACJ,CAAC,GACD,EAAE,WACG,EACG,6BACA,8BACA,sBACA,GAAG,YACA;CACH,GAAG;CACH,6BAA6B,aAAa,2BAA2B;CACrE,8BAA8B,aAAa,4BAA4B;CACvE,sBAAsB,aAAa,oBAAoB;AAC3D,EACJ,CACJ;AAEA,MAAa,mBAAmB,EAAE,OAAO;CACrC,QAAQ,EAAE,MAAM,iBAAiB;CACjC,OAAO,EAAE,MAAM,gBAAgB;;;;;CAK/B,oBAAoB;CACpB,OAAO,EAAE,KACL,EAAE,OAAO,GACT,EAAE,WAAW,MAAM,OAAO,CAAC,IAAI,GAAI,CACvC;AACJ,CAAC"}
1
+ {"version":3,"file":"market-data.schemas.js","names":[],"sources":["../../../src/services/market-data/market-data.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { SideSchema, SymbolIdInputSchema } from \"../shared.js\";\nimport {\n PAIR_STATUSES,\n type AssetConfig,\n type PairConfig,\n type PairMarketDataConfig,\n type PairStatus,\n type SpotConfig,\n} from \"../../shared/catalog-config.js\";\nimport { tsNsToMs } from \"../../utils/time.js\";\nimport { timestampToMs, tsNsToTimestamp } from \"../../utils/timestamp.js\";\nimport { optionalUint64DecimalFilterSchema } from \"../../shared/schemas.js\";\nimport { scaledToDecimalOutput, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../shared/wire-bounds.js\";\nimport { PairStatusCodec, SideFilterCodec } from \"./market-data.codecs.js\";\n\nexport type { AssetConfig, PairConfig, PairMarketDataConfig, PairStatus, SpotConfig };\nexport { PAIR_STATUSES };\n\nconst MarketTradeFieldsSchema = v.object({\n symbolId: v.number(),\n matchId: v.bigint(),\n isBuy: v.boolean(),\n priceTicks: v.bigint(),\n qtyScaled: v.bigint(),\n tsNs: v.optional(v.bigint(), 0n),\n});\n\n/** Formats a market trade; protobuf-decoded trades can be passed directly, they need no re-validation. */\nexport function formatMarketTrade(\n scales: SdkScales,\n t: v.InferOutput<typeof MarketTradeFieldsSchema>,\n) {\n const sideLabel: v.InferOutput<typeof SideSchema> = t.isBuy ? \"buy\" : \"sell\";\n return {\n symbolId: t.symbolId,\n matchId: t.matchId.toString(),\n isBuy: t.isBuy,\n sideLabel,\n qty: scaledToDecimalOutput(t.qtyScaled, scales.baseQty(t.symbolId)),\n price: scaledToDecimalOutput(t.priceTicks, scales.price()),\n tsNs: t.tsNs.toString(),\n tsMs: tsNsToMs(t.tsNs),\n };\n}\n\nexport function createMarketTradeSchema(scales: SdkScales) {\n return v.pipe(\n MarketTradeFieldsSchema,\n v.transform((t) => formatMarketTrade(scales, t)),\n );\n}\n\nexport type MarketTrade = v.InferOutput<ReturnType<typeof createMarketTradeSchema>>;\n\nexport const GetMarketTradesInputSchema = v.pipe(\n v.object({\n symbolId: SymbolIdInputSchema,\n side: v.optional(SideSchema),\n startTsNs: optionalUint64DecimalFilterSchema(\"startTsNs\"),\n endTsNs: optionalUint64DecimalFilterSchema(\"endTsNs\"),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(1_000))),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n afterTradeId: optionalUint64DecimalFilterSchema(\"afterTradeId\"),\n }),\n v.check(\n (input) =>\n input.afterTradeId === undefined ||\n (input.side === undefined &&\n input.startTsNs === undefined &&\n input.endTsNs === undefined &&\n input.pageToken === \"\"),\n \"afterTradeId cannot be combined with side, startTsNs, endTsNs or pageToken\",\n ),\n v.transform((input) => ({\n symbolId: input.symbolId,\n side: input.side ? SideFilterCodec.inputToProto[input.side] : undefined,\n startTime: tsNsToTimestamp(input.startTsNs),\n endTime: tsNsToTimestamp(input.endTsNs),\n limit: input.limit,\n pageToken: input.pageToken,\n afterTradeId: input.afterTradeId,\n })),\n);\n\n/** Cursor fields of a gap-free `afterTradeId` backfill page. */\nexport const TradeBackfillSchema = v.object({\n completeThroughTradeId: v.pipe(\n v.bigint(),\n v.transform((value) => value.toString()),\n ),\n nextAfterTradeId: v.pipe(\n v.bigint(),\n v.transform((value) => value.toString()),\n ),\n epochEnds: v.array(\n v.pipe(\n v.object({ epoch: v.bigint(), lastTradeId: v.bigint() }),\n v.transform(({ epoch, lastTradeId }) => ({\n epoch: epoch.toString(),\n lastTradeId: lastTradeId.toString(),\n })),\n ),\n ),\n});\n\nexport type TradeBackfill = v.InferOutput<typeof TradeBackfillSchema>;\n\nexport function createGetMarketTradesInputSchema() {\n return GetMarketTradesInputSchema;\n}\n\nexport type GetMarketTradesInput = v.InferInput<\n ReturnType<typeof createGetMarketTradesInputSchema>\n>;\nexport type GetMarketTradesRequest = v.InferOutput<\n ReturnType<typeof createGetMarketTradesInputSchema>\n>;\n\n/** Integer wire scales are protocol-bounded to 0..18 decimal places. */\nconst WireScaleSchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(18));\nconst OptionalDecimalLimitSchema = v.optional(v.pipe(v.string(), v.regex(/^\\d+(\\.\\d+)?$/)));\nconst OpenOrdersLimitSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX)),\n 0,\n);\n\nexport const AssetConfigSchema = v.pipe(\n v.object({\n /**\n * Asset identifier/symbol, e.g. 'USDT', 'BTC'.\n */\n asset: v.string(),\n /**\n * Internal ledger identifier for settlement systems.\n */\n ledgerId: v.number(),\n /**\n * The friendly display name for the asset (e.g. 'Bitcoin').\n */\n name: v.string(),\n /**\n * UI-only display precision for asset amounts/balances.\n */\n quantityDisplayDecimals: v.number(),\n /**\n * Fixed integer scaling for quantities/amounts in this asset (0..18).\n */\n quantityScale: v.number(),\n /**\n * Integer scale for public candle and market-overview base volume (0..18).\n */\n marketDataVolumeScale: v.optional(WireScaleSchema, 0),\n }),\n v.transform((a) => ({\n symbol: a.asset,\n ledgerId: a.ledgerId,\n name: a.name,\n quantityDisplayDecimals: a.quantityDisplayDecimals,\n quantityScale: a.quantityScale,\n marketDataVolumeScale: a.marketDataVolumeScale,\n })),\n);\n\nexport const PairMarketDataConfigSchema = v.optional(\n v.object({\n /**\n * Available price grouping sizes for the orderbook in quote units.\n * Allows viewing orders bucketed by larger increments (e.g., [0.01, 0.1, 1, 10]).\n */\n orderbookPriceBuckets: v.array(v.number()),\n }),\n {\n orderbookPriceBuckets: [] as number[],\n },\n);\n\nfunction bpsToPercent(bps: number): number {\n return bps / 100;\n}\n\nexport const PairConfigSchema = v.pipe(\n v.object({\n /**\n * Internal engine symbol id for the pair.\n */\n symbolId: v.number(),\n /**\n * Pair symbol string, e.g. 'BTC-USDT'\n */\n symbol: v.string(),\n /**\n * Base asset symbol, e.g. 'BTC'\n */\n baseAsset: v.string(),\n /**\n * Quote asset symbol, e.g. 'USDT'\n */\n quoteAsset: v.string(),\n /**\n * (e.g., \"0.01\") - The smallest price increment allowed. If tick size is 0.01, you can price at $100.00, $100.01, $100.02... but NOT $100.005.\n */\n tickSize: v.string(),\n /**\n * (e.g., \"0.0001\") - The smallest quantity increment allowed. If step size is 0.0001, you can order 100.0000, 100.0001, 100.0002... but NOT 100.00005.\n */\n stepSize: v.string(),\n /**\n * (e.g., \"1\") - Minimum order value in quote currency. If it's \"1\" and quote is USD, your order must be worth at least $1. So you can't buy $0.50 worth of something.\n */\n minNotionalQuote: v.string(),\n /**\n * Minimum quantity you can order in base currency terms. If it's \"0.001\" for BTC, smallest order is 0.001 BTC.\n */\n minQtyBase: v.string(),\n /**\n * Largest quantity of one limit order in base units. A replace is checked on its\n * new total less the filled quantity. Absent when the pair has no maximum.\n */\n maxLimitQtyBase: OptionalDecimalLimitSchema,\n /**\n * Largest quantity of one market order in base units, after converting a\n * quote-sized order to base. Absent when the pair has no maximum.\n */\n maxMarketQtyBase: OptionalDecimalLimitSchema,\n /**\n * Largest notional of one order in quote units: quantity times limit price, or\n * times protection price for a market order. Absent when the pair has no maximum.\n */\n maxOrderNotionalQuote: OptionalDecimalLimitSchema,\n /**\n * Largest notional of one market order in quote units, compared exactly with no\n * rounding. A buy is valued at its protection price and a sell at its reference\n * price (the touch or the client's reference price), before slippage. An order\n * above it is rejected with `MAX_NOTIONAL`. Absent when the pair has no maximum.\n */\n maxMarketNotionalQuote: OptionalDecimalLimitSchema,\n /**\n * Default resting-order limit (GTC and GTD) for a typical account on this pair.\n * An account may have a lower limit of its own.\n */\n maxOpenOrdersPerPair: OpenOrdersLimitSchema,\n\n /**\n * Controls whether trading fee can be deducted from what you receive when buying.\n * Example\n * - You buy 1 ETH, fee is 0.1%\n * - if `true`, you receive 0.999 ETH (fee taken from ETH you're getting)\n * - if `false`, you receive 1 ETH, but you pay the fee separately in the quote currency (e.g., extra USDT)\n */\n allowBuyFeeFromBase: v.boolean(),\n /**\n * Default market slippage for buy orders in basis points from proto.\n */\n defaultMarketSlippageBpsBuy: v.optional(v.number(), 0),\n /**\n * Default market slippage for sell orders in basis points from proto.\n */\n defaultMarketSlippageBpsSell: v.optional(v.number(), 0),\n /**\n * Maximum server/client reference-price drift in basis points from proto.\n */\n maxClientRefDriftBps: v.optional(v.number(), 0),\n\n /**\n * Market-data configuration for this pair (orderbook bucket sizes, depths).\n */\n marketdata: v.optional(PairMarketDataConfigSchema),\n /**\n * Base asset quantity scale copied from AssetConfig.quantityScale.\n */\n baseQuantityScale: v.number(),\n /**\n * Quote asset quantity scale copied from AssetConfig.quantityScale.\n */\n quoteQuantityScale: v.number(),\n /**\n * Integer scale for composite reference prices in candle responses (0..18).\n * Primary market and execution prices use the fixed scale 9.\n */\n referencePriceScale: v.optional(WireScaleSchema, 0),\n /**\n * Optional scheduled listing timestamp (UTC).\n */\n listingAt: v.pipe(v.optional(v.unknown()), v.transform(timestampToMs)),\n /**\n * Optional scheduled delisting timestamp (UTC).\n */\n delistingAt: v.pipe(v.optional(v.unknown()), v.transform(timestampToMs)),\n /**\n * Operational status of the pair.\n */\n status: v.pipe(\n v.number(),\n v.transform(\n (status): PairStatus =>\n PairStatusCodec.protoToOutput[\n status as keyof typeof PairStatusCodec.protoToOutput\n ] ?? \"unknown\",\n ),\n ),\n }),\n v.transform(\n ({\n defaultMarketSlippageBpsBuy,\n defaultMarketSlippageBpsSell,\n maxClientRefDriftBps,\n ...pair\n }) => ({\n ...pair,\n defaultMarketSlippagePctBuy: bpsToPercent(defaultMarketSlippageBpsBuy),\n defaultMarketSlippagePctSell: bpsToPercent(defaultMarketSlippageBpsSell),\n maxClientRefDriftPct: bpsToPercent(maxClientRefDriftBps),\n }),\n ),\n);\n\nexport const SpotConfigSchema = v.object({\n assets: v.array(AssetConfigSchema),\n pairs: v.array(PairConfigSchema),\n /**\n * Default resting-order limit (GTC and GTD) for a typical account across all pairs.\n * An account may have a lower limit of its own.\n */\n maxOpenOrdersTotal: OpenOrdersLimitSchema,\n tsSec: v.pipe(\n v.bigint(),\n v.transform((v) => Number(v) * 1000),\n ),\n});\n"],"mappings":";;;;;;;;;AAoBgC,EAAE,OAAO;CACrC,UAAU,EAAE,OAAO;CACnB,SAAS,EAAE,OAAO;CAClB,OAAO,EAAE,QAAQ;CACjB,YAAY,EAAE,OAAO;CACrB,WAAW,EAAE,OAAO;CACpB,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;AACnC,CAAC;;AAGD,SAAgB,kBACZ,QACA,GACF;CACE,MAAM,YAA8C,EAAE,QAAQ,QAAQ;CACtE,OAAO;EACH,UAAU,EAAE;EACZ,SAAS,EAAE,QAAQ,SAAS;EAC5B,OAAO,EAAE;EACT;EACA,KAAK,sBAAsB,EAAE,WAAW,OAAO,QAAQ,EAAE,QAAQ,CAAC;EAClE,OAAO,sBAAsB,EAAE,YAAY,OAAO,MAAM,CAAC;EACzD,MAAM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