@polyester/sdk 0.23.1 → 0.24.1

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 (64) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/account-signer/types.d.ts +1 -1
  3. package/dist/account-signer/types.js.map +1 -1
  4. package/dist/core-client.d.ts.map +1 -1
  5. package/dist/core-client.js +18 -45
  6. package/dist/core-client.js.map +1 -1
  7. package/dist/gen/orders/v1/orders_read_pb.d.ts +136 -13
  8. package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
  9. package/dist/gen/orders/v1/orders_read_pb.js +22 -16
  10. package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
  11. package/dist/index.d.ts +4 -3
  12. package/dist/realtime/client.js +45 -26
  13. package/dist/realtime/client.js.map +1 -1
  14. package/dist/services/auth/account-signer-auth.js +1 -1
  15. package/dist/services/auth/account-signer-auth.js.map +1 -1
  16. package/dist/services/candles/candles.schemas.d.ts +10 -10
  17. package/dist/services/heatmap/heatmap.schemas.d.ts +13 -13
  18. package/dist/services/market-overview/market-overview.js +5 -4
  19. package/dist/services/market-overview/market-overview.js.map +1 -1
  20. package/dist/services/market-overview/market-overview.schemas.d.ts +3 -3
  21. package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
  22. package/dist/services/orders/index.d.ts +4 -3
  23. package/dist/services/orders/order-lineage.schemas.d.ts +11 -0
  24. package/dist/services/orders/order-lineage.schemas.d.ts.map +1 -0
  25. package/dist/services/orders/order-lineage.schemas.js +13 -0
  26. package/dist/services/orders/order-lineage.schemas.js.map +1 -0
  27. package/dist/services/orders/orders-batch.schemas.d.ts +14 -14
  28. package/dist/services/orders/orders-batch.schemas.js +1 -1
  29. package/dist/services/orders/orders-input.schemas.d.ts +24 -1
  30. package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
  31. package/dist/services/orders/orders-input.schemas.js +5 -2
  32. package/dist/services/orders/orders-input.schemas.js.map +1 -1
  33. package/dist/services/orders/orders-modify.schemas.js +1 -1
  34. package/dist/services/orders/orders-output.schemas.d.ts +63 -20
  35. package/dist/services/orders/orders-output.schemas.d.ts.map +1 -1
  36. package/dist/services/orders/orders-output.schemas.js +7 -1
  37. package/dist/services/orders/orders-output.schemas.js.map +1 -1
  38. package/dist/services/orders/orders.d.ts +6 -2
  39. package/dist/services/orders/orders.d.ts.map +1 -1
  40. package/dist/services/orders/orders.js +6 -2
  41. package/dist/services/orders/orders.js.map +1 -1
  42. package/dist/services/orders/orders.schemas.d.ts +4 -3
  43. package/dist/services/orders/orders.types.d.ts +4 -3
  44. package/dist/services/subaccounts/subaccounts.schemas.d.ts +5 -5
  45. package/dist/services/trades/trades.d.ts +4 -0
  46. package/dist/services/trades/trades.d.ts.map +1 -1
  47. package/dist/services/trades/trades.js +4 -0
  48. package/dist/services/trades/trades.js.map +1 -1
  49. package/dist/services/trades/trades.schemas.d.ts +248 -4
  50. package/dist/services/trades/trades.schemas.d.ts.map +1 -1
  51. package/dist/services/trades/trades.schemas.js +52 -12
  52. package/dist/services/trades/trades.schemas.js.map +1 -1
  53. package/dist/services/triggers/trigger-input.schemas.d.ts +3 -3
  54. package/dist/services/triggers/triggers-output.schemas.d.ts +23 -23
  55. package/dist/shared/connect-error-mapping.d.ts.map +1 -1
  56. package/dist/shared/connect-error-mapping.js +15 -5
  57. package/dist/shared/connect-error-mapping.js.map +1 -1
  58. package/dist/shared/transports.d.ts +5 -1
  59. package/dist/shared/transports.d.ts.map +1 -1
  60. package/dist/shared/transports.js.map +1 -1
  61. package/dist/utils/errors.d.ts.map +1 -1
  62. package/dist/utils/errors.js +1 -0
  63. package/dist/utils/errors.js.map +1 -1
  64. package/package.json +1 -1
@@ -22,6 +22,10 @@ declare function createUserTradeSchema(scales: SdkScales): v.SchemaWithPipe<read
22
22
  readonly feeIsRebate: v.BooleanSchema<undefined>;
23
23
  readonly tsNs: v.BigintSchema<undefined>;
24
24
  readonly matchId: v.BigintSchema<undefined>;
25
+ readonly lineage: v.OptionalSchema<v.ObjectSchema<{
26
+ readonly id: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
27
+ readonly generation: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
28
+ }, undefined>, undefined>;
25
29
  }, undefined>, v.TransformAction<{
26
30
  orderId: bigint;
27
31
  symbolId: number;
@@ -41,7 +45,15 @@ declare function createUserTradeSchema(scales: SdkScales): v.SchemaWithPipe<read
41
45
  feeIsRebate: boolean;
42
46
  tsNs: bigint;
43
47
  matchId: bigint;
48
+ lineage?: {
49
+ id: string;
50
+ generation: number;
51
+ } | undefined;
44
52
  }, {
53
+ lineage?: {
54
+ id: string;
55
+ generation: number;
56
+ } | undefined;
45
57
  feeIsRebate: boolean;
46
58
  tsNs: string;
47
59
  tsIso: string;
@@ -60,29 +72,133 @@ declare function createUserTradeSchema(scales: SdkScales): v.SchemaWithPipe<read
60
72
  /** A JSON-safe authenticated trade fill returned by the SDK. */
61
73
  type Trade = v.InferOutput<ReturnType<typeof createUserTradeSchema>>;
62
74
  /** Validates filters accepted by {@link TradesService.list}. */
63
- declare const GetUserTradesInputSchema: v.SchemaWithPipe<readonly [v.UnionSchema<[v.StrictObjectSchema<{
75
+ declare const GetUserTradesInputSchema: v.SchemaWithPipe<readonly [v.UnionSchema<[v.UnionSchema<readonly [v.StrictObjectSchema<{
64
76
  readonly symbolId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.TransformAction<string, number>]>, undefined>, v.TransformAction<number | undefined, number | undefined>]>;
65
77
  readonly afterMatchId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
66
78
  readonly side: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<["buy", "sell"], undefined>, undefined>, v.TransformAction<"buy" | "sell" | undefined, Side.BUY | Side.SELL | undefined>]>;
67
79
  readonly startTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
68
80
  readonly endTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
69
- readonly limit: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
81
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
70
82
  readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
83
+ readonly includeTransfers: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
71
84
  readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
72
85
  readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
73
86
  }, undefined>], undefined>, undefined>;
87
+ } & {
88
+ readonly orderId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
89
+ readonly lineageId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
90
+ readonly throughGeneration: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
91
+ }, undefined>, v.StrictObjectSchema<{
92
+ readonly symbolId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.TransformAction<string, number>]>, undefined>, v.TransformAction<number | undefined, number | undefined>]>;
93
+ readonly afterMatchId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
94
+ readonly side: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<["buy", "sell"], undefined>, undefined>, v.TransformAction<"buy" | "sell" | undefined, Side.BUY | Side.SELL | undefined>]>;
95
+ readonly startTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
96
+ readonly endTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
97
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
98
+ readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
99
+ readonly includeTransfers: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
100
+ readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
101
+ readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
102
+ }, undefined>], undefined>, undefined>;
103
+ } & {
104
+ readonly orderId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>, v.CheckAction<bigint, `${string} must be greater than zero`>]>;
105
+ readonly lineageId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
106
+ readonly throughGeneration: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
107
+ }, undefined>, v.StrictObjectSchema<{
108
+ readonly symbolId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.TransformAction<string, number>]>, undefined>, v.TransformAction<number | undefined, number | undefined>]>;
109
+ readonly afterMatchId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
110
+ readonly side: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<["buy", "sell"], undefined>, undefined>, v.TransformAction<"buy" | "sell" | undefined, Side.BUY | Side.SELL | undefined>]>;
111
+ readonly startTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
112
+ readonly endTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
113
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
114
+ readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
115
+ readonly includeTransfers: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
116
+ readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
117
+ readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
118
+ }, undefined>], undefined>, undefined>;
119
+ } & {
120
+ readonly orderId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
121
+ readonly lineageId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>, v.CheckAction<bigint, `${string} must be greater than zero`>]>;
122
+ readonly throughGeneration: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
123
+ }, undefined>], undefined>, v.UnionSchema<readonly [v.StrictObjectSchema<{
124
+ readonly symbolId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.TransformAction<string, number>]>, v.CheckAction<number, "symbolId is required when afterMatchId is set">]>;
125
+ readonly afterMatchId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint | undefined>]>;
126
+ readonly side: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<["buy", "sell"], undefined>, undefined>, v.TransformAction<"buy" | "sell" | undefined, Side.BUY | Side.SELL | undefined>]>;
127
+ readonly startTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
128
+ readonly endTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
129
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
130
+ readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
131
+ readonly includeTransfers: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
132
+ readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
133
+ readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
134
+ }, undefined>], undefined>, undefined>;
135
+ } & {
136
+ readonly orderId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
137
+ readonly lineageId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
138
+ readonly throughGeneration: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
74
139
  }, undefined>, v.StrictObjectSchema<{
75
140
  readonly symbolId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.TransformAction<string, number>]>, v.CheckAction<number, "symbolId is required when afterMatchId is set">]>;
76
141
  readonly afterMatchId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint | undefined>]>;
77
142
  readonly side: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<["buy", "sell"], undefined>, undefined>, v.TransformAction<"buy" | "sell" | undefined, Side.BUY | Side.SELL | undefined>]>;
78
143
  readonly startTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
79
144
  readonly endTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
80
- readonly limit: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
145
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
81
146
  readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
147
+ readonly includeTransfers: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
82
148
  readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
83
149
  readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
84
150
  }, undefined>], undefined>, undefined>;
85
- }, undefined>], "symbolId is required when afterMatchId is set">, v.TransformAction<{
151
+ } & {
152
+ readonly orderId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>, v.CheckAction<bigint, `${string} must be greater than zero`>]>;
153
+ readonly lineageId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
154
+ readonly throughGeneration: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
155
+ }, undefined>, v.StrictObjectSchema<{
156
+ readonly symbolId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.TransformAction<string, number>]>, v.CheckAction<number, "symbolId is required when afterMatchId is set">]>;
157
+ readonly afterMatchId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint | undefined>]>;
158
+ readonly side: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<["buy", "sell"], undefined>, undefined>, v.TransformAction<"buy" | "sell" | undefined, Side.BUY | Side.SELL | undefined>]>;
159
+ readonly startTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
160
+ readonly endTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
161
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
162
+ readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
163
+ readonly includeTransfers: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
164
+ readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
165
+ readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
166
+ }, undefined>], undefined>, undefined>;
167
+ } & {
168
+ readonly orderId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
169
+ readonly lineageId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>, v.CheckAction<bigint, `${string} must be greater than zero`>]>;
170
+ readonly throughGeneration: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
171
+ }, undefined>], undefined>], ({ input }: v.UnionIssue<v.StringIssue | v.PicklistIssue | v.StrictObjectIssue | v.MinLengthIssue<string, 1> | v.UnionIssue<v.StringIssue | v.PicklistIssue | v.StrictObjectIssue | v.MinLengthIssue<string, 1>> | v.NumberIssue | v.IntegerIssue<number> | v.MaxValueIssue<number, 4294967295> | v.CheckIssue<bigint> | v.BooleanIssue | v.NeverIssue | v.MinValueIssue<number, 1> | v.MaxValueIssue<number, 1000> | v.UnionIssue<v.StringIssue | v.PicklistIssue | v.StrictObjectIssue | v.MinLengthIssue<string, 1> | v.UnionIssue<v.StringIssue | v.PicklistIssue | v.StrictObjectIssue | v.MinLengthIssue<string, 1>> | v.NumberIssue | v.IntegerIssue<number> | v.MaxValueIssue<number, 4294967295> | v.CheckIssue<bigint> | v.BooleanIssue | v.NeverIssue | v.MinValueIssue<number, 1> | v.MaxValueIssue<number, 1000>> | v.CheckIssue<number> | v.UnionIssue<v.StringIssue | v.PicklistIssue | v.StrictObjectIssue | v.MinLengthIssue<string, 1> | v.UnionIssue<v.StringIssue | v.PicklistIssue | v.StrictObjectIssue | v.MinLengthIssue<string, 1>> | v.NumberIssue | v.IntegerIssue<number> | v.MaxValueIssue<number, 4294967295> | v.CheckIssue<bigint> | v.BooleanIssue | v.NeverIssue | v.MinValueIssue<number, 1> | v.MaxValueIssue<number, 1000> | v.CheckIssue<number>>>) => "symbolId is required when afterMatchId is set" | "Provide at most one of orderId or lineageId">, v.TransformAction<{
172
+ symbolId?: number | undefined;
173
+ afterMatchId?: undefined;
174
+ side?: Side.BUY | Side.SELL | undefined;
175
+ startTsNs?: bigint | undefined;
176
+ endTsNs?: bigint | undefined;
177
+ limit?: number | undefined;
178
+ pageToken?: string | undefined;
179
+ includeTransfers?: boolean | undefined;
180
+ account?: "active" | "main" | {
181
+ subaccountId: string;
182
+ } | undefined;
183
+ orderId?: undefined;
184
+ lineageId?: undefined;
185
+ throughGeneration?: number | undefined;
186
+ } | {
187
+ symbolId?: number | undefined;
188
+ afterMatchId?: undefined;
189
+ side?: Side.BUY | Side.SELL | undefined;
190
+ startTsNs?: bigint | undefined;
191
+ endTsNs?: bigint | undefined;
192
+ limit?: number | undefined;
193
+ pageToken?: string | undefined;
194
+ includeTransfers?: boolean | undefined;
195
+ account?: "active" | "main" | {
196
+ subaccountId: string;
197
+ } | undefined;
198
+ orderId: bigint;
199
+ lineageId?: undefined;
200
+ throughGeneration?: number | undefined;
201
+ } | {
86
202
  symbolId?: number | undefined;
87
203
  afterMatchId?: undefined;
88
204
  side?: Side.BUY | Side.SELL | undefined;
@@ -90,9 +206,13 @@ declare const GetUserTradesInputSchema: v.SchemaWithPipe<readonly [v.UnionSchema
90
206
  endTsNs?: bigint | undefined;
91
207
  limit?: number | undefined;
92
208
  pageToken?: string | undefined;
209
+ includeTransfers?: boolean | undefined;
93
210
  account?: "active" | "main" | {
94
211
  subaccountId: string;
95
212
  } | undefined;
213
+ orderId?: undefined;
214
+ lineageId: bigint;
215
+ throughGeneration?: number | undefined;
96
216
  } | {
97
217
  symbolId: number;
98
218
  afterMatchId: bigint | undefined;
@@ -101,10 +221,51 @@ declare const GetUserTradesInputSchema: v.SchemaWithPipe<readonly [v.UnionSchema
101
221
  endTsNs?: bigint | undefined;
102
222
  limit?: number | undefined;
103
223
  pageToken?: string | undefined;
224
+ includeTransfers?: boolean | undefined;
104
225
  account?: "active" | "main" | {
105
226
  subaccountId: string;
106
227
  } | undefined;
228
+ orderId?: undefined;
229
+ lineageId?: undefined;
230
+ throughGeneration?: number | undefined;
231
+ } | {
232
+ symbolId: number;
233
+ afterMatchId: bigint | undefined;
234
+ side?: Side.BUY | Side.SELL | undefined;
235
+ startTsNs?: bigint | undefined;
236
+ endTsNs?: bigint | undefined;
237
+ limit?: number | undefined;
238
+ pageToken?: string | undefined;
239
+ includeTransfers?: boolean | undefined;
240
+ account?: "active" | "main" | {
241
+ subaccountId: string;
242
+ } | undefined;
243
+ orderId: bigint;
244
+ lineageId?: undefined;
245
+ throughGeneration?: number | undefined;
246
+ } | {
247
+ symbolId: number;
248
+ afterMatchId: bigint | undefined;
249
+ side?: Side.BUY | Side.SELL | undefined;
250
+ startTsNs?: bigint | undefined;
251
+ endTsNs?: bigint | undefined;
252
+ limit?: number | undefined;
253
+ pageToken?: string | undefined;
254
+ includeTransfers?: boolean | undefined;
255
+ account?: "active" | "main" | {
256
+ subaccountId: string;
257
+ } | undefined;
258
+ orderId?: undefined;
259
+ lineageId: bigint;
260
+ throughGeneration?: number | undefined;
107
261
  }, {
262
+ executionScope: {
263
+ readonly case: "orderId";
264
+ readonly value: bigint;
265
+ } | {
266
+ readonly case: "lineageId";
267
+ readonly value: bigint;
268
+ } | undefined;
108
269
  subaccountId: bigint | undefined;
109
270
  symbolId?: number | undefined;
110
271
  afterMatchId?: undefined;
@@ -113,7 +274,88 @@ declare const GetUserTradesInputSchema: v.SchemaWithPipe<readonly [v.UnionSchema
113
274
  endTsNs?: bigint | undefined;
114
275
  limit?: number | undefined;
115
276
  pageToken?: string | undefined;
277
+ includeTransfers?: boolean | undefined;
278
+ throughGeneration?: number | undefined;
116
279
  } | {
280
+ executionScope: {
281
+ readonly case: "orderId";
282
+ readonly value: bigint;
283
+ } | {
284
+ readonly case: "lineageId";
285
+ readonly value: bigint;
286
+ } | undefined;
287
+ subaccountId: bigint | undefined;
288
+ symbolId?: number | undefined;
289
+ afterMatchId?: undefined;
290
+ side?: Side.BUY | Side.SELL | undefined;
291
+ startTsNs?: bigint | undefined;
292
+ endTsNs?: bigint | undefined;
293
+ limit?: number | undefined;
294
+ pageToken?: string | undefined;
295
+ includeTransfers?: boolean | undefined;
296
+ throughGeneration?: number | undefined;
297
+ } | {
298
+ executionScope: {
299
+ readonly case: "orderId";
300
+ readonly value: bigint;
301
+ } | {
302
+ readonly case: "lineageId";
303
+ readonly value: bigint;
304
+ } | undefined;
305
+ subaccountId: bigint | undefined;
306
+ symbolId?: number | undefined;
307
+ afterMatchId?: undefined;
308
+ side?: Side.BUY | Side.SELL | undefined;
309
+ startTsNs?: bigint | undefined;
310
+ endTsNs?: bigint | undefined;
311
+ limit?: number | undefined;
312
+ pageToken?: string | undefined;
313
+ includeTransfers?: boolean | undefined;
314
+ throughGeneration?: number | undefined;
315
+ } | {
316
+ executionScope: {
317
+ readonly case: "orderId";
318
+ readonly value: bigint;
319
+ } | {
320
+ readonly case: "lineageId";
321
+ readonly value: bigint;
322
+ } | undefined;
323
+ subaccountId: bigint | undefined;
324
+ symbolId: number;
325
+ afterMatchId: bigint | undefined;
326
+ side?: Side.BUY | Side.SELL | undefined;
327
+ startTsNs?: bigint | undefined;
328
+ endTsNs?: bigint | undefined;
329
+ limit?: number | undefined;
330
+ pageToken?: string | undefined;
331
+ includeTransfers?: boolean | undefined;
332
+ throughGeneration?: number | undefined;
333
+ } | {
334
+ executionScope: {
335
+ readonly case: "orderId";
336
+ readonly value: bigint;
337
+ } | {
338
+ readonly case: "lineageId";
339
+ readonly value: bigint;
340
+ } | undefined;
341
+ subaccountId: bigint | undefined;
342
+ symbolId: number;
343
+ afterMatchId: bigint | undefined;
344
+ side?: Side.BUY | Side.SELL | undefined;
345
+ startTsNs?: bigint | undefined;
346
+ endTsNs?: bigint | undefined;
347
+ limit?: number | undefined;
348
+ pageToken?: string | undefined;
349
+ includeTransfers?: boolean | undefined;
350
+ throughGeneration?: number | undefined;
351
+ } | {
352
+ executionScope: {
353
+ readonly case: "orderId";
354
+ readonly value: bigint;
355
+ } | {
356
+ readonly case: "lineageId";
357
+ readonly value: bigint;
358
+ } | undefined;
117
359
  subaccountId: bigint | undefined;
118
360
  symbolId: number;
119
361
  afterMatchId: bigint | undefined;
@@ -122,6 +364,8 @@ declare const GetUserTradesInputSchema: v.SchemaWithPipe<readonly [v.UnionSchema
122
364
  endTsNs?: bigint | undefined;
123
365
  limit?: number | undefined;
124
366
  pageToken?: string | undefined;
367
+ includeTransfers?: boolean | undefined;
368
+ throughGeneration?: number | undefined;
125
369
  }>]>;
126
370
  /**
127
371
  * Filters accepted by {@link TradesService.list}. Passing `afterMatchId` requires
@@ -1 +1 @@
1
- {"version":3,"file":"trades.schemas.d.ts","names":[],"sources":["../../../src/services/trades/trades.schemas.ts"],"mappings":";;;;;iBAsBgB,sBAAsB,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwD3C,QAAQ,EAAE,YAAY,kBAAkB;;cAkDvC,0BAAwB,EAAA,yBAAA,EAAA,aAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAezB,qBAAqB,EAAE,kBAAkB"}
1
+ {"version":3,"file":"trades.schemas.d.ts","names":[],"sources":["../../../src/services/trades/trades.schemas.ts"],"mappings":";;;;;iBAyBgB,sBAAsB,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0D3C,QAAQ,EAAE,YAAY,kBAAkB;;cAmFvC,0BAAwB,EAAA,yBAAA,EAAA,aAAA,EAAA,sBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BzB,qBAAqB,EAAE,kBAAkB"}
@@ -2,13 +2,16 @@ import { requiredEnumLabel } from "../../shared/proto-enum-codec.js";
2
2
  import { formatId } from "../../utils/base58-id.js";
3
3
  import { parseOptionalUint64DecimalStrict } from "../../utils/numbers.js";
4
4
  import { tsNsToISO, tsNsToMs } from "../../utils/time.js";
5
+ import { PROTOBUF_UINT32_MAX } from "../../shared/wire-bounds.js";
5
6
  import { optionalUint64DecimalFilterSchema } from "../../shared/schemas.js";
6
7
  import { SideSchema } from "../shared.js";
7
8
  import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
8
9
  import { scaledToDecimalOutput } from "../../shared/decimal-surface.js";
9
10
  import { fromU128 } from "../../utils/u128.js";
11
+ import { OrderLineageSchema } from "../orders/order-lineage.schemas.js";
10
12
  import { FeeAssetCodec, OrderSideCodec } from "../orders/order-enums.codecs.js";
11
13
  import { TradeSideCodec } from "./trades.codecs.js";
14
+ import { positiveOrderIdInputSchema } from "../orders/orders-identifiers.schemas.js";
12
15
  import * as v from "valibot";
13
16
  //#region src/services/trades/trades.schemas.ts
14
17
  const U128Schema = v.object({
@@ -29,7 +32,8 @@ function createUserTradeSchema(scales) {
29
32
  referralShareAmountE18: v.optional(U128Schema),
30
33
  feeIsRebate: v.boolean(),
31
34
  tsNs: v.bigint(),
32
- matchId: v.bigint()
35
+ matchId: v.bigint(),
36
+ lineage: v.optional(OrderLineageSchema)
33
37
  }), v.transform((t) => {
34
38
  const feeAsset = requiredEnumLabel(FeeAssetCodec.protoToOutput, t.feeAsset, "UserTradeSchema", "fee asset");
35
39
  return {
@@ -46,37 +50,73 @@ function createUserTradeSchema(scales) {
46
50
  tsNs: t.tsNs.toString(),
47
51
  tsIso: tsNsToISO(t.tsNs),
48
52
  tsMs: tsNsToMs(t.tsNs),
49
- matchId: t.matchId.toString()
53
+ matchId: t.matchId.toString(),
54
+ ...t.lineage === void 0 ? {} : { lineage: t.lineage }
50
55
  };
51
56
  }));
52
57
  }
53
58
  const AFTER_MATCH_REQUIRES_SYMBOL = "symbolId is required when afterMatchId is set";
59
+ const EXECUTION_SCOPE_CONFLICT = "Provide at most one of orderId or lineageId";
54
60
  const SymbolIdStringSchema = v.pipe(v.string(), v.trim(), v.transform((value) => Number(value)));
55
61
  const GetUserTradesCommonEntries = {
56
62
  ...AccountScopeInputEntries,
57
63
  side: v.pipe(v.optional(SideSchema), v.transform((v) => v ? TradeSideCodec.inputToProto[v] : void 0)),
58
64
  startTsNs: optionalUint64DecimalFilterSchema("startTsNs"),
59
65
  endTsNs: optionalUint64DecimalFilterSchema("endTsNs"),
60
- limit: v.optional(v.number()),
61
- pageToken: v.optional(v.pipe(v.string(), v.trim()))
66
+ limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(1e3))),
67
+ pageToken: v.optional(v.pipe(v.string(), v.trim())),
68
+ includeTransfers: v.optional(v.boolean())
62
69
  };
70
+ const ThroughGenerationSchema = v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(PROTOBUF_UINT32_MAX)));
71
+ function userTradesScopeSchemas(entries) {
72
+ return [
73
+ v.strictObject({
74
+ ...entries,
75
+ orderId: v.optional(v.never()),
76
+ lineageId: v.optional(v.never()),
77
+ throughGeneration: ThroughGenerationSchema
78
+ }),
79
+ v.strictObject({
80
+ ...entries,
81
+ orderId: positiveOrderIdInputSchema("orderId"),
82
+ lineageId: v.optional(v.never()),
83
+ throughGeneration: ThroughGenerationSchema
84
+ }),
85
+ v.strictObject({
86
+ ...entries,
87
+ orderId: v.optional(v.never()),
88
+ lineageId: positiveOrderIdInputSchema("lineageId"),
89
+ throughGeneration: ThroughGenerationSchema
90
+ })
91
+ ];
92
+ }
63
93
  /** Browse mode: optional symbol filter, no replay cursor. */
64
- const BrowseUserTradesInputSchema = v.strictObject({
94
+ const BrowseUserTradesInputSchema = v.union(userTradesScopeSchemas({
65
95
  ...GetUserTradesCommonEntries,
66
96
  symbolId: v.pipe(v.optional(SymbolIdStringSchema), v.transform((sid) => sid !== void 0 && Number.isFinite(sid) && sid > 0 ? sid : void 0)),
67
97
  afterMatchId: v.optional(v.never())
68
- });
98
+ }));
69
99
  /** Replay mode: `afterMatchId` cursor, which the backend only accepts scoped to a symbol. */
70
- const ReplayUserTradesInputSchema = v.strictObject({
100
+ const ReplayUserTradesInputSchema = v.union(userTradesScopeSchemas({
71
101
  ...GetUserTradesCommonEntries,
72
102
  symbolId: v.pipe(SymbolIdStringSchema, v.check((sid) => Number.isInteger(sid) && sid > 0, AFTER_MATCH_REQUIRES_SYMBOL)),
73
103
  afterMatchId: v.pipe(v.string(), v.trim(), v.minLength(1), v.transform((value) => parseOptionalUint64DecimalStrict(value, "afterMatchId")))
74
- });
104
+ }));
75
105
  /** Validates filters accepted by {@link TradesService.list}. */
76
- const GetUserTradesInputSchema = v.pipe(v.union([BrowseUserTradesInputSchema, ReplayUserTradesInputSchema], AFTER_MATCH_REQUIRES_SYMBOL), v.transform(({ account, ...input }) => ({
77
- ...input,
78
- subaccountId: accountScopeToSubaccountId(account)
79
- })));
106
+ const GetUserTradesInputSchema = v.pipe(v.union([BrowseUserTradesInputSchema, ReplayUserTradesInputSchema], ({ input }) => typeof input === "object" && input !== null && "orderId" in input && input.orderId !== void 0 && "lineageId" in input && input.lineageId !== void 0 ? EXECUTION_SCOPE_CONFLICT : AFTER_MATCH_REQUIRES_SYMBOL), v.transform(({ account, orderId, lineageId, ...input }) => {
107
+ const executionScope = orderId !== void 0 ? {
108
+ case: "orderId",
109
+ value: orderId
110
+ } : lineageId !== void 0 ? {
111
+ case: "lineageId",
112
+ value: lineageId
113
+ } : void 0;
114
+ return {
115
+ ...input,
116
+ executionScope,
117
+ subaccountId: accountScopeToSubaccountId(account)
118
+ };
119
+ }));
80
120
  //#endregion
81
121
  export { GetUserTradesInputSchema, createUserTradeSchema };
82
122
 
@@ -1 +1 @@
1
- {"version":3,"file":"trades.schemas.js","names":[],"sources":["../../../src/services/trades/trades.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { tsNsToISO, tsNsToMs } from \"../../utils/time.js\";\nimport { SideSchema } from \"../shared.js\";\nimport { FeeAssetCodec, OrderSideCodec } from \"../orders/orders.codecs.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { optionalUint64DecimalFilterSchema } from \"../../shared/schemas.js\";\nimport { parseOptionalUint64DecimalStrict } from \"../../utils/numbers.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { TradeSideCodec } from \"./trades.codecs.js\";\nimport { requiredEnumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { E18_SCALE, scaledToDecimalOutput, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { fromU128 } from \"../../utils/u128.js\";\n\nconst U128Schema = v.object({\n hi: v.bigint(),\n lo: v.bigint(),\n});\n\n/** Parses a generated user-trade fill into the SDK's JSON-safe public shape. */\nexport function createUserTradeSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n orderId: v.bigint(),\n symbolId: v.number(),\n side: v.number(),\n isMaker: v.boolean(),\n feeAsset: v.number(),\n qtyScaled: v.bigint(),\n priceTicks: v.bigint(),\n feeAmountE18: v.optional(U128Schema),\n referralShareAmountE18: v.optional(U128Schema),\n feeIsRebate: v.boolean(),\n tsNs: v.bigint(),\n matchId: v.bigint(),\n }),\n v.transform((t) => {\n const feeAsset = requiredEnumLabel(\n FeeAssetCodec.protoToOutput,\n t.feeAsset,\n \"UserTradeSchema\",\n \"fee asset\",\n );\n return {\n orderId: formatId(t.orderId),\n symbolId: t.symbolId,\n sideLabel: requiredEnumLabel(\n OrderSideCodec.protoToOutput,\n t.side,\n \"UserTradeSchema\",\n \"side\",\n ),\n liquidityLabel: t.isMaker ? (\"maker\" as const) : (\"taker\" as const),\n feeAsset,\n qty: scaledToDecimalOutput(t.qtyScaled, scales.baseQty(t.symbolId)),\n price: scaledToDecimalOutput(t.priceTicks, scales.price()),\n fee: scaledToDecimalOutput(fromU128(t.feeAmountE18), E18_SCALE),\n ...(t.referralShareAmountE18 === undefined\n ? {}\n : {\n referralShare: scaledToDecimalOutput(\n fromU128(t.referralShareAmountE18),\n E18_SCALE,\n ),\n }),\n feeIsRebate: t.feeIsRebate,\n tsNs: t.tsNs.toString(),\n tsIso: tsNsToISO(t.tsNs),\n tsMs: tsNsToMs(t.tsNs),\n matchId: t.matchId.toString(),\n };\n }),\n );\n}\n\n/** A JSON-safe authenticated trade fill returned by the SDK. */\nexport type Trade = v.InferOutput<ReturnType<typeof createUserTradeSchema>>;\n\nconst AFTER_MATCH_REQUIRES_SYMBOL = \"symbolId is required when afterMatchId is set\";\n\nconst SymbolIdStringSchema = v.pipe(\n v.string(),\n v.trim(),\n v.transform((value) => Number(value)),\n);\n\nconst GetUserTradesCommonEntries = {\n ...AccountScopeInputEntries,\n side: v.pipe(\n v.optional(SideSchema),\n v.transform((v) => (v ? TradeSideCodec.inputToProto[v] : undefined)),\n ),\n startTsNs: optionalUint64DecimalFilterSchema(\"startTsNs\"),\n endTsNs: optionalUint64DecimalFilterSchema(\"endTsNs\"),\n limit: v.optional(v.number()),\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n};\n\n/** Browse mode: optional symbol filter, no replay cursor. */\nconst BrowseUserTradesInputSchema = v.strictObject({\n ...GetUserTradesCommonEntries,\n symbolId: v.pipe(\n v.optional(SymbolIdStringSchema),\n v.transform((sid) =>\n sid !== undefined && Number.isFinite(sid) && sid > 0 ? sid : undefined,\n ),\n ),\n afterMatchId: v.optional(v.never()),\n});\n\n/** Replay mode: `afterMatchId` cursor, which the backend only accepts scoped to a symbol. */\nconst ReplayUserTradesInputSchema = v.strictObject({\n ...GetUserTradesCommonEntries,\n symbolId: v.pipe(\n SymbolIdStringSchema,\n v.check((sid) => Number.isInteger(sid) && sid > 0, AFTER_MATCH_REQUIRES_SYMBOL),\n ),\n afterMatchId: v.pipe(\n v.string(),\n v.trim(),\n v.minLength(1),\n v.transform((value) => parseOptionalUint64DecimalStrict(value, \"afterMatchId\")),\n ),\n});\n\n/** Validates filters accepted by {@link TradesService.list}. */\nexport const GetUserTradesInputSchema = v.pipe(\n v.union(\n [BrowseUserTradesInputSchema, ReplayUserTradesInputSchema],\n AFTER_MATCH_REQUIRES_SYMBOL,\n ),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\n/**\n * Filters accepted by {@link TradesService.list}. Passing `afterMatchId` requires\n * `symbolId`; the two shapes form a discriminated union so the constraint is a compile error.\n */\nexport type GetUserTradesInput = v.InferInput<typeof GetUserTradesInputSchema>;\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,aAAa,EAAE,OAAO;CACxB,IAAI,EAAE,OAAO;CACb,IAAI,EAAE,OAAO;AACjB,CAAC;;AAGD,SAAgB,sBAAsB,QAAmB;CACrD,OAAO,EAAE,KACL,EAAE,OAAO;EACL,SAAS,EAAE,OAAO;EAClB,UAAU,EAAE,OAAO;EACnB,MAAM,EAAE,OAAO;EACf,SAAS,EAAE,QAAQ;EACnB,UAAU,EAAE,OAAO;EACnB,WAAW,EAAE,OAAO;EACpB,YAAY,EAAE,OAAO;EACrB,cAAc,EAAE,SAAS,UAAU;EACnC,wBAAwB,EAAE,SAAS,UAAU;EAC7C,aAAa,EAAE,QAAQ;EACvB,MAAM,EAAE,OAAO;EACf,SAAS,EAAE,OAAO;CACtB,CAAC,GACD,EAAE,WAAW,MAAM;EACf,MAAM,WAAW,kBACb,cAAc,eACd,EAAE,UACF,mBACA,WACJ;EACA,OAAO;GACH,SAAS,SAAS,EAAE,OAAO;GAC3B,UAAU,EAAE;GACZ,WAAW,kBACP,eAAe,eACf,EAAE,MACF,mBACA,MACJ;GACA,gBAAgB,EAAE,UAAW,UAAqB;GAClD;GACA,KAAK,sBAAsB,EAAE,WAAW,OAAO,QAAQ,EAAE,QAAQ,CAAC;GAClE,OAAO,sBAAsB,EAAE,YAAY,OAAO,MAAM,CAAC;GACzD,KAAK,sBAAsB,SAAS,EAAE,YAAY,GAAA,EAAY;GAC9D,GAAI,EAAE,2BAA2B,KAAA,IAC3B,CAAC,IACD,EACI,eAAe,sBACX,SAAS,EAAE,sBAAsB,GAAA,EAErC,EACJ;GACN,aAAa,EAAE;GACf,MAAM,EAAE,KAAK,SAAS;GACtB,OAAO,UAAU,EAAE,IAAI;GACvB,MAAM,SAAS,EAAE,IAAI;GACrB,SAAS,EAAE,QAAQ,SAAS;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src/services/trades/trades.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { tsNsToISO, tsNsToMs } from \"../../utils/time.js\";\nimport { SideSchema } from \"../shared.js\";\nimport { FeeAssetCodec, OrderSideCodec } from \"../orders/orders.codecs.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { optionalUint64DecimalFilterSchema } from \"../../shared/schemas.js\";\nimport { parseOptionalUint64DecimalStrict } from \"../../utils/numbers.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../shared/wire-bounds.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { TradeSideCodec } from \"./trades.codecs.js\";\nimport { requiredEnumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { E18_SCALE, scaledToDecimalOutput, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { fromU128 } from \"../../utils/u128.js\";\nimport { OrderLineageSchema } from \"../orders/order-lineage.schemas.js\";\nimport { positiveOrderIdInputSchema } from \"../orders/orders-identifiers.schemas.js\";\n\nconst U128Schema = v.object({\n hi: v.bigint(),\n lo: v.bigint(),\n});\n\n/** Parses a generated user-trade fill into the SDK's JSON-safe public shape. */\nexport function createUserTradeSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n orderId: v.bigint(),\n symbolId: v.number(),\n side: v.number(),\n isMaker: v.boolean(),\n feeAsset: v.number(),\n qtyScaled: v.bigint(),\n priceTicks: v.bigint(),\n feeAmountE18: v.optional(U128Schema),\n referralShareAmountE18: v.optional(U128Schema),\n feeIsRebate: v.boolean(),\n tsNs: v.bigint(),\n matchId: v.bigint(),\n lineage: v.optional(OrderLineageSchema),\n }),\n v.transform((t) => {\n const feeAsset = requiredEnumLabel(\n FeeAssetCodec.protoToOutput,\n t.feeAsset,\n \"UserTradeSchema\",\n \"fee asset\",\n );\n return {\n orderId: formatId(t.orderId),\n symbolId: t.symbolId,\n sideLabel: requiredEnumLabel(\n OrderSideCodec.protoToOutput,\n t.side,\n \"UserTradeSchema\",\n \"side\",\n ),\n liquidityLabel: t.isMaker ? (\"maker\" as const) : (\"taker\" as const),\n feeAsset,\n qty: scaledToDecimalOutput(t.qtyScaled, scales.baseQty(t.symbolId)),\n price: scaledToDecimalOutput(t.priceTicks, scales.price()),\n fee: scaledToDecimalOutput(fromU128(t.feeAmountE18), E18_SCALE),\n ...(t.referralShareAmountE18 === undefined\n ? {}\n : {\n referralShare: scaledToDecimalOutput(\n fromU128(t.referralShareAmountE18),\n E18_SCALE,\n ),\n }),\n feeIsRebate: t.feeIsRebate,\n tsNs: t.tsNs.toString(),\n tsIso: tsNsToISO(t.tsNs),\n tsMs: tsNsToMs(t.tsNs),\n matchId: t.matchId.toString(),\n ...(t.lineage === undefined ? {} : { lineage: t.lineage }),\n };\n }),\n );\n}\n\n/** A JSON-safe authenticated trade fill returned by the SDK. */\nexport type Trade = v.InferOutput<ReturnType<typeof createUserTradeSchema>>;\n\nconst AFTER_MATCH_REQUIRES_SYMBOL = \"symbolId is required when afterMatchId is set\";\nconst EXECUTION_SCOPE_CONFLICT = \"Provide at most one of orderId or lineageId\";\n\nconst SymbolIdStringSchema = v.pipe(\n v.string(),\n v.trim(),\n v.transform((value) => Number(value)),\n);\n\nconst GetUserTradesCommonEntries = {\n ...AccountScopeInputEntries,\n side: v.pipe(\n v.optional(SideSchema),\n v.transform((v) => (v ? TradeSideCodec.inputToProto[v] : undefined)),\n ),\n startTsNs: optionalUint64DecimalFilterSchema(\"startTsNs\"),\n endTsNs: optionalUint64DecimalFilterSchema(\"endTsNs\"),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(1000))),\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n includeTransfers: v.optional(v.boolean()),\n};\n\nconst ThroughGenerationSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(PROTOBUF_UINT32_MAX)),\n);\n\nfunction userTradesScopeSchemas<const TEntries extends v.ObjectEntries>(entries: TEntries) {\n return [\n v.strictObject({\n ...entries,\n orderId: v.optional(v.never()),\n lineageId: v.optional(v.never()),\n throughGeneration: ThroughGenerationSchema,\n }),\n v.strictObject({\n ...entries,\n orderId: positiveOrderIdInputSchema(\"orderId\"),\n lineageId: v.optional(v.never()),\n throughGeneration: ThroughGenerationSchema,\n }),\n v.strictObject({\n ...entries,\n orderId: v.optional(v.never()),\n lineageId: positiveOrderIdInputSchema(\"lineageId\"),\n throughGeneration: ThroughGenerationSchema,\n }),\n ] as const;\n}\n\n/** Browse mode: optional symbol filter, no replay cursor. */\nconst BrowseUserTradesInputSchema = v.union(\n userTradesScopeSchemas({\n ...GetUserTradesCommonEntries,\n symbolId: v.pipe(\n v.optional(SymbolIdStringSchema),\n v.transform((sid) =>\n sid !== undefined && Number.isFinite(sid) && sid > 0 ? sid : undefined,\n ),\n ),\n afterMatchId: v.optional(v.never()),\n }),\n);\n\n/** Replay mode: `afterMatchId` cursor, which the backend only accepts scoped to a symbol. */\nconst ReplayUserTradesInputSchema = v.union(\n userTradesScopeSchemas({\n ...GetUserTradesCommonEntries,\n symbolId: v.pipe(\n SymbolIdStringSchema,\n v.check((sid) => Number.isInteger(sid) && sid > 0, AFTER_MATCH_REQUIRES_SYMBOL),\n ),\n afterMatchId: v.pipe(\n v.string(),\n v.trim(),\n v.minLength(1),\n v.transform((value) => parseOptionalUint64DecimalStrict(value, \"afterMatchId\")),\n ),\n }),\n);\n\n/** Validates filters accepted by {@link TradesService.list}. */\nexport const GetUserTradesInputSchema = v.pipe(\n v.union([BrowseUserTradesInputSchema, ReplayUserTradesInputSchema], ({ input }) =>\n typeof input === \"object\" &&\n input !== null &&\n \"orderId\" in input &&\n input.orderId !== undefined &&\n \"lineageId\" in input &&\n input.lineageId !== undefined\n ? EXECUTION_SCOPE_CONFLICT\n : AFTER_MATCH_REQUIRES_SYMBOL,\n ),\n v.transform(({ account, orderId, lineageId, ...input }) => {\n const executionScope =\n orderId !== undefined\n ? ({ case: \"orderId\" as const, value: orderId } as const)\n : lineageId !== undefined\n ? ({ case: \"lineageId\" as const, value: lineageId } as const)\n : undefined;\n return {\n ...input,\n executionScope,\n subaccountId: accountScopeToSubaccountId(account),\n };\n }),\n);\n\n/**\n * Filters accepted by {@link TradesService.list}. Passing `afterMatchId` requires\n * `symbolId`; the two shapes form a discriminated union so the constraint is a compile error.\n */\nexport type GetUserTradesInput = v.InferInput<typeof GetUserTradesInputSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAM,aAAa,EAAE,OAAO;CACxB,IAAI,EAAE,OAAO;CACb,IAAI,EAAE,OAAO;AACjB,CAAC;;AAGD,SAAgB,sBAAsB,QAAmB;CACrD,OAAO,EAAE,KACL,EAAE,OAAO;EACL,SAAS,EAAE,OAAO;EAClB,UAAU,EAAE,OAAO;EACnB,MAAM,EAAE,OAAO;EACf,SAAS,EAAE,QAAQ;EACnB,UAAU,EAAE,OAAO;EACnB,WAAW,EAAE,OAAO;EACpB,YAAY,EAAE,OAAO;EACrB,cAAc,EAAE,SAAS,UAAU;EACnC,wBAAwB,EAAE,SAAS,UAAU;EAC7C,aAAa,EAAE,QAAQ;EACvB,MAAM,EAAE,OAAO;EACf,SAAS,EAAE,OAAO;EAClB,SAAS,EAAE,SAAS,kBAAkB;CAC1C,CAAC,GACD,EAAE,WAAW,MAAM;EACf,MAAM,WAAW,kBACb,cAAc,eACd,EAAE,UACF,mBACA,WACJ;EACA,OAAO;GACH,SAAS,SAAS,EAAE,OAAO;GAC3B,UAAU,EAAE;GACZ,WAAW,kBACP,eAAe,eACf,EAAE,MACF,mBACA,MACJ;GACA,gBAAgB,EAAE,UAAW,UAAqB;GAClD;GACA,KAAK,sBAAsB,EAAE,WAAW,OAAO,QAAQ,EAAE,QAAQ,CAAC;GAClE,OAAO,sBAAsB,EAAE,YAAY,OAAO,MAAM,CAAC;GACzD,KAAK,sBAAsB,SAAS,EAAE,YAAY,GAAA,EAAY;GAC9D,GAAI,EAAE,2BAA2B,KAAA,IAC3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Ac,2BAA2B,OAAO;CACpD;AACJ,CAAC,CACL"}
@@ -845,8 +845,8 @@ type CreateTriggerInput = v.InferInput<ReturnType<typeof createCreateTriggerInpu
845
845
  declare const ListTriggersInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
846
846
  readonly parentOrderId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
847
847
  readonly symbolId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
848
- readonly status: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["created", "armed", "running", "completed", "cancelled", "failed", "paused"], undefined>, undefined>, undefined>, v.TransformAction<("cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused")[] | undefined, (TriggerStatus.STATUS_CREATED | TriggerStatus.STATUS_ARMED | TriggerStatus.STATUS_RUNNING | TriggerStatus.STATUS_COMPLETED | TriggerStatus.STATUS_CANCELED | TriggerStatus.STATUS_FAILED | TriggerStatus.STATUS_PAUSED)[]>]>;
849
- readonly triggerType: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["stop_loss", "take_profit", "trailing_stop", "twap", "ladder"], undefined>, undefined>, v.TransformAction<"twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop" | undefined, TriggerType>]>;
848
+ readonly status: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["created", "armed", "running", "completed", "cancelled", "failed", "paused"], undefined>, undefined>, undefined>, v.TransformAction<("failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused")[] | undefined, (TriggerStatus.STATUS_CREATED | TriggerStatus.STATUS_ARMED | TriggerStatus.STATUS_RUNNING | TriggerStatus.STATUS_COMPLETED | TriggerStatus.STATUS_CANCELED | TriggerStatus.STATUS_FAILED | TriggerStatus.STATUS_PAUSED)[]>]>;
849
+ readonly triggerType: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["stop_loss", "take_profit", "trailing_stop", "twap", "ladder"], undefined>, undefined>, v.TransformAction<"stop_loss" | "take_profit" | "trailing_stop" | "twap" | "ladder" | undefined, TriggerType>]>;
850
850
  readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000, undefined>]>, 50>;
851
851
  readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, "">;
852
852
  readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
@@ -1066,7 +1066,7 @@ declare const ListTriggerEventsInputSchema: v.SchemaWithPipe<readonly [v.StrictO
1066
1066
  readonly triggerId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
1067
1067
  }, undefined>, v.TransformAction<{
1068
1068
  limit?: number | undefined;
1069
- eventType?: "updated" | "failed" | "fired" | "canceled" | undefined;
1069
+ eventType?: "failed" | "updated" | "canceled" | "fired" | undefined;
1070
1070
  pageToken: string;
1071
1071
  account?: "active" | "main" | {
1072
1072
  subaccountId: string;