@polymarket/clob-client-v2 1.0.5 → 1.0.6-main.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 (206) hide show
  1. package/README.md +3 -0
  2. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  3. package/dist/client.cjs +892 -0
  4. package/dist/client.cjs.map +1 -0
  5. package/dist/client.d.cts +167 -0
  6. package/dist/client.d.ts +169 -0
  7. package/dist/client.js +892 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/config.cjs +37 -0
  10. package/dist/config.cjs.map +1 -0
  11. package/dist/config.d.cts +17 -0
  12. package/dist/config.d.ts +17 -0
  13. package/dist/config.js +34 -0
  14. package/dist/config.js.map +1 -0
  15. package/dist/constants.cjs +15 -0
  16. package/dist/constants.cjs.map +1 -0
  17. package/dist/constants.js +10 -0
  18. package/dist/constants.js.map +1 -0
  19. package/dist/endpoints.cjs +125 -0
  20. package/dist/endpoints.cjs.map +1 -0
  21. package/dist/endpoints.js +65 -0
  22. package/dist/endpoints.js.map +1 -0
  23. package/dist/errors.cjs +20 -0
  24. package/dist/errors.cjs.map +1 -0
  25. package/dist/errors.d.cts +11 -0
  26. package/dist/errors.d.ts +11 -0
  27. package/dist/errors.js +17 -0
  28. package/dist/errors.js.map +1 -0
  29. package/dist/fees/index.cjs +21 -0
  30. package/dist/fees/index.cjs.map +1 -0
  31. package/dist/fees/index.d.cts +5 -0
  32. package/dist/fees/index.d.ts +5 -0
  33. package/dist/fees/index.js +19 -0
  34. package/dist/fees/index.js.map +1 -0
  35. package/dist/headers/index.cjs +34 -0
  36. package/dist/headers/index.cjs.map +1 -0
  37. package/dist/headers/index.d.cts +9 -0
  38. package/dist/headers/index.d.ts +11 -0
  39. package/dist/headers/index.js +33 -0
  40. package/dist/headers/index.js.map +1 -0
  41. package/dist/http-helpers/index.cjs +109 -0
  42. package/dist/http-helpers/index.cjs.map +1 -0
  43. package/dist/http-helpers/index.js +101 -0
  44. package/dist/http-helpers/index.js.map +1 -0
  45. package/dist/index.cjs +35 -2620
  46. package/dist/index.d.cts +15 -1039
  47. package/dist/index.d.ts +17 -1039
  48. package/dist/index.js +15 -2563
  49. package/dist/order-builder/helpers/buildMarketOrderCreationArgs.cjs +43 -0
  50. package/dist/order-builder/helpers/buildMarketOrderCreationArgs.cjs.map +1 -0
  51. package/dist/order-builder/helpers/buildMarketOrderCreationArgs.js +42 -0
  52. package/dist/order-builder/helpers/buildMarketOrderCreationArgs.js.map +1 -0
  53. package/dist/order-builder/helpers/buildOrder.cjs +34 -0
  54. package/dist/order-builder/helpers/buildOrder.cjs.map +1 -0
  55. package/dist/order-builder/helpers/buildOrder.js +34 -0
  56. package/dist/order-builder/helpers/buildOrder.js.map +1 -0
  57. package/dist/order-builder/helpers/buildOrderCreationArgs.cjs +45 -0
  58. package/dist/order-builder/helpers/buildOrderCreationArgs.cjs.map +1 -0
  59. package/dist/order-builder/helpers/buildOrderCreationArgs.js +44 -0
  60. package/dist/order-builder/helpers/buildOrderCreationArgs.js.map +1 -0
  61. package/dist/order-builder/helpers/calculateBuyMarketPrice.cjs +24 -0
  62. package/dist/order-builder/helpers/calculateBuyMarketPrice.cjs.map +1 -0
  63. package/dist/order-builder/helpers/calculateBuyMarketPrice.js +24 -0
  64. package/dist/order-builder/helpers/calculateBuyMarketPrice.js.map +1 -0
  65. package/dist/order-builder/helpers/calculateSellMarketPrice.cjs +24 -0
  66. package/dist/order-builder/helpers/calculateSellMarketPrice.cjs.map +1 -0
  67. package/dist/order-builder/helpers/calculateSellMarketPrice.js +24 -0
  68. package/dist/order-builder/helpers/calculateSellMarketPrice.js.map +1 -0
  69. package/dist/order-builder/helpers/createExchangeV3OrderFromAmounts.cjs +31 -0
  70. package/dist/order-builder/helpers/createExchangeV3OrderFromAmounts.cjs.map +1 -0
  71. package/dist/order-builder/helpers/createExchangeV3OrderFromAmounts.js +31 -0
  72. package/dist/order-builder/helpers/createExchangeV3OrderFromAmounts.js.map +1 -0
  73. package/dist/order-builder/helpers/createMarketOrder.cjs +34 -0
  74. package/dist/order-builder/helpers/createMarketOrder.cjs.map +1 -0
  75. package/dist/order-builder/helpers/createMarketOrder.js +34 -0
  76. package/dist/order-builder/helpers/createMarketOrder.js.map +1 -0
  77. package/dist/order-builder/helpers/createOrder.cjs +34 -0
  78. package/dist/order-builder/helpers/createOrder.cjs.map +1 -0
  79. package/dist/order-builder/helpers/createOrder.js +34 -0
  80. package/dist/order-builder/helpers/createOrder.js.map +1 -0
  81. package/dist/order-builder/helpers/getMarketOrderRawAmounts.cjs +36 -0
  82. package/dist/order-builder/helpers/getMarketOrderRawAmounts.cjs.map +1 -0
  83. package/dist/order-builder/helpers/getMarketOrderRawAmounts.js +36 -0
  84. package/dist/order-builder/helpers/getMarketOrderRawAmounts.js.map +1 -0
  85. package/dist/order-builder/helpers/getOrderRawAmounts.cjs +36 -0
  86. package/dist/order-builder/helpers/getOrderRawAmounts.cjs.map +1 -0
  87. package/dist/order-builder/helpers/getOrderRawAmounts.js +36 -0
  88. package/dist/order-builder/helpers/getOrderRawAmounts.js.map +1 -0
  89. package/dist/order-builder/helpers/roundingConfig.cjs +28 -0
  90. package/dist/order-builder/helpers/roundingConfig.cjs.map +1 -0
  91. package/dist/order-builder/helpers/roundingConfig.js +27 -0
  92. package/dist/order-builder/helpers/roundingConfig.js.map +1 -0
  93. package/dist/order-builder/index.d.ts +1 -0
  94. package/dist/order-builder/orderBuilder.cjs +58 -0
  95. package/dist/order-builder/orderBuilder.cjs.map +1 -0
  96. package/dist/order-builder/orderBuilder.d.cts +42 -0
  97. package/dist/order-builder/orderBuilder.d.ts +44 -0
  98. package/dist/order-builder/orderBuilder.js +58 -0
  99. package/dist/order-builder/orderBuilder.js.map +1 -0
  100. package/dist/order-utils/exchangeOrderBuilderV1.cjs +128 -0
  101. package/dist/order-utils/exchangeOrderBuilderV1.cjs.map +1 -0
  102. package/dist/order-utils/exchangeOrderBuilderV1.d.ts +2 -0
  103. package/dist/order-utils/exchangeOrderBuilderV1.js +127 -0
  104. package/dist/order-utils/exchangeOrderBuilderV1.js.map +1 -0
  105. package/dist/order-utils/exchangeOrderBuilderV2.cjs +196 -0
  106. package/dist/order-utils/exchangeOrderBuilderV2.cjs.map +1 -0
  107. package/dist/order-utils/exchangeOrderBuilderV2.d.ts +2 -0
  108. package/dist/order-utils/exchangeOrderBuilderV2.js +194 -0
  109. package/dist/order-utils/exchangeOrderBuilderV2.js.map +1 -0
  110. package/dist/order-utils/index.d.ts +7 -0
  111. package/dist/order-utils/model/ctfExchangeV1TypedData.cjs +60 -0
  112. package/dist/order-utils/model/ctfExchangeV1TypedData.cjs.map +1 -0
  113. package/dist/order-utils/model/ctfExchangeV1TypedData.js +57 -0
  114. package/dist/order-utils/model/ctfExchangeV1TypedData.js.map +1 -0
  115. package/dist/order-utils/model/ctfExchangeV2TypedData.cjs +58 -0
  116. package/dist/order-utils/model/ctfExchangeV2TypedData.cjs.map +1 -0
  117. package/dist/order-utils/model/ctfExchangeV2TypedData.js +54 -0
  118. package/dist/order-utils/model/ctfExchangeV2TypedData.js.map +1 -0
  119. package/dist/order-utils/model/eip712.cjs +24 -0
  120. package/dist/order-utils/model/eip712.cjs.map +1 -0
  121. package/dist/order-utils/model/eip712.d.cts +9 -0
  122. package/dist/order-utils/model/eip712.d.ts +9 -0
  123. package/dist/order-utils/model/eip712.js +23 -0
  124. package/dist/order-utils/model/eip712.js.map +1 -0
  125. package/dist/order-utils/model/order.d.cts +5 -0
  126. package/dist/order-utils/model/order.d.ts +5 -0
  127. package/dist/order-utils/model/orderDataV1.d.cts +68 -0
  128. package/dist/order-utils/model/orderDataV1.d.ts +69 -0
  129. package/dist/order-utils/model/orderDataV2.d.cts +68 -0
  130. package/dist/order-utils/model/orderDataV2.d.ts +69 -0
  131. package/dist/order-utils/model/side.cjs +11 -0
  132. package/dist/order-utils/model/side.cjs.map +1 -0
  133. package/dist/order-utils/model/side.d.cts +8 -0
  134. package/dist/order-utils/model/side.d.ts +8 -0
  135. package/dist/order-utils/model/side.js +10 -0
  136. package/dist/order-utils/model/side.js.map +1 -0
  137. package/dist/order-utils/model/signatureTypeV1.cjs +21 -0
  138. package/dist/order-utils/model/signatureTypeV1.cjs.map +1 -0
  139. package/dist/order-utils/model/signatureTypeV1.d.cts +18 -0
  140. package/dist/order-utils/model/signatureTypeV1.d.ts +18 -0
  141. package/dist/order-utils/model/signatureTypeV1.js +20 -0
  142. package/dist/order-utils/model/signatureTypeV1.js.map +1 -0
  143. package/dist/order-utils/model/signatureTypeV2.cjs +25 -0
  144. package/dist/order-utils/model/signatureTypeV2.cjs.map +1 -0
  145. package/dist/order-utils/model/signatureTypeV2.d.cts +22 -0
  146. package/dist/order-utils/model/signatureTypeV2.d.ts +22 -0
  147. package/dist/order-utils/model/signatureTypeV2.js +24 -0
  148. package/dist/order-utils/model/signatureTypeV2.js.map +1 -0
  149. package/dist/order-utils/utils.cjs +9 -0
  150. package/dist/order-utils/utils.cjs.map +1 -0
  151. package/dist/order-utils/utils.js +8 -0
  152. package/dist/order-utils/utils.js.map +1 -0
  153. package/dist/signing/constants.cjs +7 -0
  154. package/dist/signing/constants.cjs.map +1 -0
  155. package/dist/signing/constants.js +6 -0
  156. package/dist/signing/constants.js.map +1 -0
  157. package/dist/signing/eip712.cjs +51 -0
  158. package/dist/signing/eip712.cjs.map +1 -0
  159. package/dist/signing/eip712.d.ts +2 -0
  160. package/dist/signing/eip712.js +51 -0
  161. package/dist/signing/eip712.js.map +1 -0
  162. package/dist/signing/hmac.cjs +40 -0
  163. package/dist/signing/hmac.cjs.map +1 -0
  164. package/dist/signing/hmac.js +39 -0
  165. package/dist/signing/hmac.js.map +1 -0
  166. package/dist/signing/index.d.ts +2 -0
  167. package/dist/signing/signer.cjs +41 -0
  168. package/dist/signing/signer.cjs.map +1 -0
  169. package/dist/signing/signer.d.cts +17 -0
  170. package/dist/signing/signer.d.ts +17 -0
  171. package/dist/signing/signer.js +39 -0
  172. package/dist/signing/signer.js.map +1 -0
  173. package/dist/types/clob.cjs +35 -0
  174. package/dist/types/clob.cjs.map +1 -0
  175. package/dist/types/clob.d.cts +427 -0
  176. package/dist/types/clob.d.ts +427 -0
  177. package/dist/types/clob.js +32 -0
  178. package/dist/types/clob.js.map +1 -0
  179. package/dist/types/index.d.ts +6 -0
  180. package/dist/types/ordersV1.cjs +29 -0
  181. package/dist/types/ordersV1.cjs.map +1 -0
  182. package/dist/types/ordersV1.d.cts +115 -0
  183. package/dist/types/ordersV1.d.ts +116 -0
  184. package/dist/types/ordersV1.js +28 -0
  185. package/dist/types/ordersV1.js.map +1 -0
  186. package/dist/types/ordersV2.cjs +30 -0
  187. package/dist/types/ordersV2.cjs.map +1 -0
  188. package/dist/types/ordersV2.d.cts +113 -0
  189. package/dist/types/ordersV2.d.ts +114 -0
  190. package/dist/types/ordersV2.js +29 -0
  191. package/dist/types/ordersV2.js.map +1 -0
  192. package/dist/types/ordersV3.d.cts +43 -0
  193. package/dist/types/ordersV3.d.ts +43 -0
  194. package/dist/types/unifiedOrder.cjs +10 -0
  195. package/dist/types/unifiedOrder.cjs.map +1 -0
  196. package/dist/types/unifiedOrder.d.cts +56 -0
  197. package/dist/types/unifiedOrder.d.ts +57 -0
  198. package/dist/types/unifiedOrder.js +9 -0
  199. package/dist/types/unifiedOrder.js.map +1 -0
  200. package/dist/utilities.cjs +50 -0
  201. package/dist/utilities.cjs.map +1 -0
  202. package/dist/utilities.js +43 -0
  203. package/dist/utilities.js.map +1 -0
  204. package/package.json +3 -3
  205. package/dist/index.cjs.map +0 -1
  206. package/dist/index.js.map +0 -1
@@ -0,0 +1,427 @@
1
+ import { Side } from "../order-utils/model/side.js";
2
+
3
+ //#region src/types/clob.d.ts
4
+ interface ApiKeyCreds {
5
+ key: string;
6
+ secret: string;
7
+ passphrase: string;
8
+ }
9
+ interface BuilderConfig {
10
+ builderCode: string;
11
+ }
12
+ interface ApiKeyRaw {
13
+ apiKey: string;
14
+ secret: string;
15
+ passphrase: string;
16
+ }
17
+ interface L2HeaderArgs {
18
+ method: string;
19
+ requestPath: string;
20
+ body?: string;
21
+ }
22
+ type SimpleHeaders = Record<string, string | number | boolean>;
23
+ interface L1PolyHeader extends SimpleHeaders {
24
+ POLY_ADDRESS: string;
25
+ POLY_SIGNATURE: string;
26
+ POLY_TIMESTAMP: string;
27
+ POLY_NONCE: string;
28
+ }
29
+ interface L2PolyHeader extends SimpleHeaders {
30
+ POLY_ADDRESS: string;
31
+ POLY_SIGNATURE: string;
32
+ POLY_TIMESTAMP: string;
33
+ POLY_API_KEY: string;
34
+ POLY_PASSPHRASE: string;
35
+ }
36
+ declare enum OrderType {
37
+ GTC = "GTC",
38
+ FOK = "FOK",
39
+ GTD = "GTD",
40
+ FAK = "FAK",
41
+ }
42
+ interface OrderPayload {
43
+ orderID: string;
44
+ }
45
+ interface OrderResponse {
46
+ success: boolean;
47
+ errorMsg: string;
48
+ orderID: string;
49
+ transactionsHashes?: string[];
50
+ tradeIDs?: string[];
51
+ status: string;
52
+ takingAmount: string;
53
+ makingAmount: string;
54
+ }
55
+ interface OpenOrder {
56
+ id: string;
57
+ status: string;
58
+ owner: string;
59
+ maker_address: string;
60
+ market: string;
61
+ asset_id: string;
62
+ side: string;
63
+ original_size: string;
64
+ size_matched: string;
65
+ price: string;
66
+ associate_trades: string[];
67
+ outcome: string;
68
+ created_at: number;
69
+ expiration: string;
70
+ order_type: string;
71
+ }
72
+ type OpenOrdersResponse = OpenOrder[];
73
+ type PreMigrationOrder = OpenOrder;
74
+ type PreMigrationOrdersResponse = PreMigrationOrder[];
75
+ interface MakerOrder {
76
+ order_id: string;
77
+ owner: string;
78
+ maker_address: string;
79
+ matched_amount: string;
80
+ price: string;
81
+ fee_rate_bps: string;
82
+ asset_id: string;
83
+ outcome: string;
84
+ side?: Side;
85
+ builder_fee?: string;
86
+ builder_code?: string;
87
+ }
88
+ interface Trade {
89
+ id: string;
90
+ taker_order_id: string;
91
+ market: string;
92
+ asset_id: string;
93
+ side: Side;
94
+ size: string;
95
+ fee_rate_bps: string;
96
+ price: string;
97
+ status: string;
98
+ match_time: string;
99
+ match_time_nano?: string;
100
+ last_update: string;
101
+ outcome: string;
102
+ bucket_index: number;
103
+ owner: string;
104
+ maker_address: string;
105
+ maker_orders: MakerOrder[];
106
+ transaction_hash?: string;
107
+ err_msg?: string | null;
108
+ trader_side: "TAKER" | "MAKER";
109
+ }
110
+ interface ApiKeysResponse {
111
+ apiKeys: ApiKeyCreds[];
112
+ }
113
+ interface BanStatus {
114
+ closed_only: boolean;
115
+ }
116
+ interface TradeParams {
117
+ id?: string;
118
+ maker_address?: string;
119
+ market?: string;
120
+ asset_id?: string;
121
+ before?: string;
122
+ after?: string;
123
+ }
124
+ interface BuilderTradeParams extends TradeParams {
125
+ builder_code: string;
126
+ }
127
+ interface OpenOrderParams {
128
+ id?: string;
129
+ market?: string;
130
+ asset_id?: string;
131
+ }
132
+ declare enum Chain {
133
+ POLYGON = 137,
134
+ AMOY = 80002,
135
+ }
136
+ interface MarketPrice {
137
+ t: number;
138
+ p: number;
139
+ }
140
+ interface PriceHistoryFilterParams {
141
+ market?: string;
142
+ startTs?: number;
143
+ endTs?: number;
144
+ fidelity?: number;
145
+ interval?: PriceHistoryInterval;
146
+ }
147
+ declare enum PriceHistoryInterval {
148
+ MAX = "max",
149
+ ONE_WEEK = "1w",
150
+ ONE_DAY = "1d",
151
+ SIX_HOURS = "6h",
152
+ ONE_HOUR = "1h",
153
+ }
154
+ interface DropNotificationParams {
155
+ ids: string[];
156
+ }
157
+ interface Notification {
158
+ type: number;
159
+ owner: string;
160
+ payload: any;
161
+ }
162
+ interface OrderMarketCancelParams {
163
+ market?: string;
164
+ asset_id?: string;
165
+ }
166
+ interface OrderBookSummary {
167
+ market: string;
168
+ asset_id: string;
169
+ timestamp: string;
170
+ bids: OrderSummary[];
171
+ asks: OrderSummary[];
172
+ min_order_size: string;
173
+ tick_size: string;
174
+ neg_risk: boolean;
175
+ hash: string;
176
+ last_trade_price: string;
177
+ }
178
+ interface OrderSummary {
179
+ price: string;
180
+ size: string;
181
+ }
182
+ declare enum AssetType {
183
+ COLLATERAL = "COLLATERAL",
184
+ CONDITIONAL = "CONDITIONAL",
185
+ }
186
+ interface BalanceAllowanceParams {
187
+ asset_type: AssetType;
188
+ token_id?: string;
189
+ }
190
+ interface BalanceAllowanceResponse {
191
+ balance: string;
192
+ allowances: Record<string, string>;
193
+ }
194
+ interface OrderScoringParams {
195
+ order_id: string;
196
+ }
197
+ interface OrderScoring {
198
+ scoring: boolean;
199
+ }
200
+ interface OrdersScoringParams {
201
+ orderIds: string[];
202
+ }
203
+ type OrdersScoring = { [orderId in string]: boolean };
204
+ type OrderVersion = 1 | 2 | 3;
205
+ type CreateOrderOptions = {
206
+ tickSize: TickSize;
207
+ negRisk?: boolean;
208
+ version?: OrderVersion;
209
+ };
210
+ type TickSize = "0.1" | "0.01" | "0.001" | "0.0001";
211
+ interface RoundConfig {
212
+ readonly price: number;
213
+ readonly size: number;
214
+ readonly amount: number;
215
+ }
216
+ interface TickSizes {
217
+ [tokenId: string]: TickSize;
218
+ }
219
+ interface FeeRates {
220
+ [tokenId: string]: number;
221
+ }
222
+ interface NegRisk {
223
+ [tokenId: string]: boolean;
224
+ }
225
+ interface FeeInfo {
226
+ rate: number;
227
+ exponent: number;
228
+ }
229
+ interface FeeInfos {
230
+ [tokenId: string]: FeeInfo;
231
+ }
232
+ interface BuilderFeeRates {
233
+ [builderCode: string]: {
234
+ maker: number;
235
+ taker: number;
236
+ };
237
+ }
238
+ type TokenConditionMap = Record<string, string>;
239
+ interface FeeDetails {
240
+ r?: number;
241
+ e?: number;
242
+ to?: boolean;
243
+ }
244
+ interface ClobRewards {
245
+ mi?: number;
246
+ ma?: number;
247
+ e?: boolean;
248
+ smoa?: boolean;
249
+ moas?: number;
250
+ }
251
+ interface ClobToken {
252
+ t: string;
253
+ o: string;
254
+ }
255
+ interface MarketDetails {
256
+ c: string;
257
+ t: [ClobToken, ClobToken];
258
+ mts: number;
259
+ nr?: boolean;
260
+ fd?: FeeDetails;
261
+ mbf?: number;
262
+ tbf?: number;
263
+ r: ClobRewards | null;
264
+ ao?: boolean;
265
+ mos?: number;
266
+ sd?: number;
267
+ gst?: string;
268
+ cbos?: boolean;
269
+ aot?: string;
270
+ rfqe?: boolean;
271
+ itode?: boolean;
272
+ ibce?: boolean;
273
+ }
274
+ interface PaginationPayload {
275
+ readonly limit: number;
276
+ readonly count: number;
277
+ readonly next_cursor: string;
278
+ readonly data: any[];
279
+ }
280
+ interface BookParams {
281
+ token_id: string;
282
+ side: Side;
283
+ }
284
+ interface UserEarning {
285
+ date: string;
286
+ condition_id: string;
287
+ asset_address: string;
288
+ maker_address: string;
289
+ earnings: number;
290
+ asset_rate: number;
291
+ }
292
+ interface TotalUserEarning {
293
+ date: string;
294
+ asset_address: string;
295
+ maker_address: string;
296
+ earnings: number;
297
+ asset_rate: number;
298
+ }
299
+ interface RewardsPercentages {
300
+ [market: string]: number;
301
+ }
302
+ interface Token {
303
+ token_id: string;
304
+ outcome: string;
305
+ price: number;
306
+ }
307
+ interface RewardsConfig {
308
+ asset_address: string;
309
+ start_date: string;
310
+ end_date: string;
311
+ rate_per_day: number;
312
+ total_rewards: number;
313
+ }
314
+ interface MarketReward {
315
+ condition_id: string;
316
+ question: string;
317
+ market_slug: string;
318
+ event_slug: string;
319
+ image: string;
320
+ rewards_max_spread: number;
321
+ rewards_min_size: number;
322
+ tokens: Token[];
323
+ rewards_config: RewardsConfig[];
324
+ }
325
+ interface Earning {
326
+ asset_address: string;
327
+ earnings: number;
328
+ asset_rate: number;
329
+ }
330
+ interface UserRewardsEarning {
331
+ condition_id: string;
332
+ question: string;
333
+ market_slug: string;
334
+ event_slug: string;
335
+ image: string;
336
+ rewards_max_spread: number;
337
+ rewards_min_size: number;
338
+ market_competitiveness: number;
339
+ tokens: Token[];
340
+ rewards_config: RewardsConfig[];
341
+ maker_address: string;
342
+ earning_percentage: number;
343
+ earnings: Earning[];
344
+ }
345
+ interface BuilderTrade {
346
+ id: string;
347
+ tradeType: string;
348
+ takerOrderHash: string;
349
+ builder: string;
350
+ market: string;
351
+ assetId: string;
352
+ side: string;
353
+ size: string;
354
+ sizeUsdc: string;
355
+ price: string;
356
+ status: string;
357
+ outcome: string;
358
+ outcomeIndex: number;
359
+ owner: string;
360
+ maker: string;
361
+ transactionHash: string;
362
+ matchTime: string;
363
+ bucketIndex: number;
364
+ fee: string;
365
+ feeUsdc: string;
366
+ builderFee: string;
367
+ builderCode: string;
368
+ err_msg?: string | null;
369
+ createdAt: string | null;
370
+ updatedAt: string | null;
371
+ }
372
+ interface ReadonlyApiKeyResponse {
373
+ apiKey: string;
374
+ }
375
+ interface MarketTradeEvent {
376
+ event_type: string;
377
+ market: {
378
+ condition_id: string;
379
+ asset_id: string;
380
+ question: string;
381
+ icon: string;
382
+ slug: string;
383
+ };
384
+ user: {
385
+ address: string;
386
+ username: string;
387
+ profile_picture: string;
388
+ optimized_profile_picture: string;
389
+ pseudonym: string;
390
+ };
391
+ side: Side;
392
+ size: string;
393
+ fee_rate_bps: string;
394
+ price: string;
395
+ outcome: string;
396
+ outcome_index: number;
397
+ transaction_hash: string;
398
+ timestamp: string;
399
+ }
400
+ interface BuilderApiKey {
401
+ key: string;
402
+ secret: string;
403
+ passphrase: string;
404
+ }
405
+ interface BuilderApiKeyResponse {
406
+ key: string;
407
+ createdAt?: string;
408
+ revokedAt?: string;
409
+ }
410
+ type ClobErrorResponseBody = {
411
+ error: string;
412
+ };
413
+ interface TradesPaginatedResponse {
414
+ trades: Trade[];
415
+ next_cursor: string;
416
+ limit: number;
417
+ count: number;
418
+ }
419
+ interface BuilderTradesResponse {
420
+ trades: BuilderTrade[];
421
+ next_cursor: string;
422
+ limit: number;
423
+ count: number;
424
+ }
425
+ //#endregion
426
+ export { ApiKeyCreds, ApiKeyRaw, ApiKeysResponse, AssetType, BalanceAllowanceParams, BalanceAllowanceResponse, BanStatus, BookParams, BuilderApiKey, BuilderApiKeyResponse, BuilderConfig, BuilderFeeRates, BuilderTrade, BuilderTradeParams, BuilderTradesResponse, Chain, ClobErrorResponseBody, ClobRewards, ClobToken, CreateOrderOptions, DropNotificationParams, Earning, FeeDetails, FeeInfo, FeeInfos, FeeRates, L1PolyHeader, L2HeaderArgs, L2PolyHeader, MakerOrder, MarketDetails, MarketPrice, MarketReward, MarketTradeEvent, NegRisk, Notification, OpenOrder, OpenOrderParams, OpenOrdersResponse, OrderBookSummary, OrderMarketCancelParams, OrderPayload, OrderResponse, OrderScoring, OrderScoringParams, OrderSummary, OrderType, OrderVersion, OrdersScoring, OrdersScoringParams, PaginationPayload, PreMigrationOrder, PreMigrationOrdersResponse, PriceHistoryFilterParams, PriceHistoryInterval, ReadonlyApiKeyResponse, RewardsConfig, RewardsPercentages, RoundConfig, SimpleHeaders, TickSize, TickSizes, Token, TokenConditionMap, TotalUserEarning, Trade, TradeParams, TradesPaginatedResponse, UserEarning, UserRewardsEarning };
427
+ //# sourceMappingURL=clob.d.ts.map
@@ -0,0 +1,32 @@
1
+ import { Side } from "../order-utils/model/side.js";
2
+
3
+ //#region src/types/clob.ts
4
+ let OrderType = /* @__PURE__ */ function(OrderType$1) {
5
+ OrderType$1["GTC"] = "GTC";
6
+ OrderType$1["FOK"] = "FOK";
7
+ OrderType$1["GTD"] = "GTD";
8
+ OrderType$1["FAK"] = "FAK";
9
+ return OrderType$1;
10
+ }({});
11
+ let Chain = /* @__PURE__ */ function(Chain$1) {
12
+ Chain$1[Chain$1["POLYGON"] = 137] = "POLYGON";
13
+ Chain$1[Chain$1["AMOY"] = 80002] = "AMOY";
14
+ return Chain$1;
15
+ }({});
16
+ let PriceHistoryInterval = /* @__PURE__ */ function(PriceHistoryInterval$1) {
17
+ PriceHistoryInterval$1["MAX"] = "max";
18
+ PriceHistoryInterval$1["ONE_WEEK"] = "1w";
19
+ PriceHistoryInterval$1["ONE_DAY"] = "1d";
20
+ PriceHistoryInterval$1["SIX_HOURS"] = "6h";
21
+ PriceHistoryInterval$1["ONE_HOUR"] = "1h";
22
+ return PriceHistoryInterval$1;
23
+ }({});
24
+ let AssetType = /* @__PURE__ */ function(AssetType$1) {
25
+ AssetType$1["COLLATERAL"] = "COLLATERAL";
26
+ AssetType$1["CONDITIONAL"] = "CONDITIONAL";
27
+ return AssetType$1;
28
+ }({});
29
+
30
+ //#endregion
31
+ export { AssetType, Chain, OrderType, PriceHistoryInterval };
32
+ //# sourceMappingURL=clob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clob.js","names":[],"sources":["../../src/types/clob.ts"],"sourcesContent":["import { Side } from \"../order-utils/model/side.js\";\n\nexport { Side };\n\nexport interface ApiKeyCreds {\n\tkey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface BuilderConfig {\n\tbuilderCode: string;\n}\n\nexport interface ApiKeyRaw {\n\tapiKey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface L2HeaderArgs {\n\tmethod: string;\n\trequestPath: string;\n\tbody?: string;\n}\n\nexport type SimpleHeaders = Record<string, string | number | boolean>;\n\n// EIP712 sig verification\nexport interface L1PolyHeader extends SimpleHeaders {\n\tPOLY_ADDRESS: string;\n\tPOLY_SIGNATURE: string;\n\tPOLY_TIMESTAMP: string;\n\tPOLY_NONCE: string;\n}\n\n// API key verification\nexport interface L2PolyHeader extends SimpleHeaders {\n\tPOLY_ADDRESS: string;\n\tPOLY_SIGNATURE: string;\n\tPOLY_TIMESTAMP: string;\n\tPOLY_API_KEY: string;\n\tPOLY_PASSPHRASE: string;\n}\n\nexport enum OrderType {\n\tGTC = \"GTC\",\n\tFOK = \"FOK\",\n\tGTD = \"GTD\",\n\tFAK = \"FAK\",\n}\n\nexport interface OrderPayload {\n\torderID: string;\n}\n\nexport interface OrderResponse {\n\tsuccess: boolean;\n\terrorMsg: string;\n\torderID: string;\n\ttransactionsHashes?: string[];\n\ttradeIDs?: string[];\n\tstatus: string;\n\ttakingAmount: string;\n\tmakingAmount: string;\n}\n\nexport interface OpenOrder {\n\tid: string;\n\tstatus: string;\n\towner: string;\n\tmaker_address: string;\n\tmarket: string;\n\tasset_id: string;\n\tside: string;\n\toriginal_size: string;\n\tsize_matched: string;\n\tprice: string;\n\tassociate_trades: string[];\n\toutcome: string;\n\tcreated_at: number;\n\texpiration: string;\n\torder_type: string;\n}\n\nexport type OpenOrdersResponse = OpenOrder[];\n\nexport type PreMigrationOrder = OpenOrder;\n\nexport type PreMigrationOrdersResponse = PreMigrationOrder[];\n\nexport interface MakerOrder {\n\torder_id: string;\n\towner: string;\n\tmaker_address: string;\n\tmatched_amount: string;\n\tprice: string;\n\tfee_rate_bps: string;\n\tasset_id: string;\n\toutcome: string;\n\tside?: Side;\n\tbuilder_fee?: string;\n\tbuilder_code?: string;\n}\n\nexport interface Trade {\n\tid: string;\n\ttaker_order_id: string;\n\tmarket: string;\n\tasset_id: string;\n\tside: Side;\n\tsize: string;\n\tfee_rate_bps: string;\n\tprice: string;\n\tstatus: string;\n\tmatch_time: string;\n\tmatch_time_nano?: string;\n\tlast_update: string;\n\toutcome: string;\n\tbucket_index: number;\n\towner: string;\n\tmaker_address: string;\n\tmaker_orders: MakerOrder[];\n\ttransaction_hash?: string;\n\terr_msg?: string | null;\n\ttrader_side: \"TAKER\" | \"MAKER\";\n}\n\nexport interface ApiKeysResponse {\n\tapiKeys: ApiKeyCreds[];\n}\n\nexport interface BanStatus {\n\tclosed_only: boolean;\n}\n\nexport interface TradeParams {\n\tid?: string;\n\tmaker_address?: string;\n\tmarket?: string;\n\tasset_id?: string;\n\tbefore?: string;\n\tafter?: string;\n}\n\nexport interface BuilderTradeParams extends TradeParams {\n\tbuilder_code: string;\n}\n\nexport interface OpenOrderParams {\n\tid?: string;\n\tmarket?: string;\n\tasset_id?: string;\n}\n\nexport enum Chain {\n\tPOLYGON = 137,\n\tAMOY = 80002,\n}\n\nexport interface MarketPrice {\n\tt: number; // timestamp\n\tp: number; // price\n}\n\nexport interface PriceHistoryFilterParams {\n\tmarket?: string;\n\tstartTs?: number;\n\tendTs?: number;\n\tfidelity?: number;\n\tinterval?: PriceHistoryInterval;\n}\n\nexport enum PriceHistoryInterval {\n\tMAX = \"max\",\n\tONE_WEEK = \"1w\",\n\tONE_DAY = \"1d\",\n\tSIX_HOURS = \"6h\",\n\tONE_HOUR = \"1h\",\n}\n\nexport interface DropNotificationParams {\n\tids: string[];\n}\n\nexport interface Notification {\n\ttype: number;\n\towner: string;\n\n\tpayload: any;\n}\n\nexport interface OrderMarketCancelParams {\n\tmarket?: string;\n\tasset_id?: string;\n}\n\nexport interface OrderBookSummary {\n\tmarket: string;\n\tasset_id: string;\n\ttimestamp: string;\n\tbids: OrderSummary[];\n\tasks: OrderSummary[];\n\tmin_order_size: string;\n\ttick_size: string;\n\tneg_risk: boolean;\n\thash: string;\n\tlast_trade_price: string;\n}\n\nexport interface OrderSummary {\n\tprice: string;\n\tsize: string;\n}\n\nexport enum AssetType {\n\tCOLLATERAL = \"COLLATERAL\",\n\tCONDITIONAL = \"CONDITIONAL\",\n}\n\nexport interface BalanceAllowanceParams {\n\tasset_type: AssetType;\n\ttoken_id?: string;\n}\n\nexport interface BalanceAllowanceResponse {\n\tbalance: string;\n\tallowances: Record<string, string>;\n}\n\nexport interface OrderScoringParams {\n\torder_id: string;\n}\n\nexport interface OrderScoring {\n\tscoring: boolean;\n}\n\nexport interface OrdersScoringParams {\n\torderIds: string[];\n}\n\nexport type OrdersScoring = { [orderId in string]: boolean };\n\nexport type OrderVersion = 1 | 2 | 3;\n\nexport type CreateOrderOptions = {\n\ttickSize: TickSize;\n\tnegRisk?: boolean;\n\tversion?: OrderVersion;\n};\n\nexport type TickSize = \"0.1\" | \"0.01\" | \"0.001\" | \"0.0001\";\n\nexport interface RoundConfig {\n\treadonly price: number;\n\treadonly size: number;\n\treadonly amount: number;\n}\n\nexport interface TickSizes {\n\t[tokenId: string]: TickSize;\n}\n\nexport interface FeeRates {\n\t[tokenId: string]: number;\n}\n\nexport interface NegRisk {\n\t[tokenId: string]: boolean;\n}\n\nexport interface FeeInfo {\n\trate: number;\n\texponent: number;\n}\n\nexport interface FeeInfos {\n\t[tokenId: string]: FeeInfo;\n}\n\nexport interface BuilderFeeRates {\n\t[builderCode: string]: { maker: number; taker: number };\n}\n\nexport type TokenConditionMap = Record<string, string>;\n\nexport interface FeeDetails {\n\tr?: number; // fee rate\n\te?: number; // fee exponent\n\tto?: boolean; // taker only (omitted when false)\n}\n\nexport interface ClobRewards {\n\tmi?: number; // min size\n\tma?: number; // max spread\n\te?: boolean; // enabled\n\tsmoa?: boolean; // skip min order age\n\tmoas?: number; // min order age seconds\n}\n\nexport interface ClobToken {\n\tt: string; // token ID\n\to: string; // outcome\n}\n\nexport interface MarketDetails {\n\tc: string; // condition ID\n\tt: [ClobToken, ClobToken]; // YES and NO tokens\n\tmts: number; // min tick size\n\tnr?: boolean; // neg risk (omitted when false)\n\tfd?: FeeDetails; // platform fee details\n\tmbf?: number; // maker base fee\n\ttbf?: number; // taker base fee\n\tr: ClobRewards | null; // rewards config (always present, null if unset)\n\tao?: boolean; // accepting orders\n\tmos?: number; // min order size\n\tsd?: number; // seconds delay\n\tgst?: string; // game start time (ISO 8601)\n\tcbos?: boolean; // clear book on start\n\taot?: string; // accepting orders timestamp (ISO 8601)\n\trfqe?: boolean; // RFQ enabled\n\titode?: boolean; // taker order delay enabled\n\tibce?: boolean; // blockaid check enabled\n}\n\nexport interface PaginationPayload {\n\treadonly limit: number;\n\treadonly count: number;\n\treadonly next_cursor: string;\n\treadonly data: any[];\n}\n\nexport interface BookParams {\n\ttoken_id: string;\n\tside: Side;\n}\n\nexport interface UserEarning {\n\tdate: string;\n\tcondition_id: string;\n\tasset_address: string;\n\tmaker_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface TotalUserEarning {\n\tdate: string;\n\tasset_address: string;\n\tmaker_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface RewardsPercentages {\n\t[market: string]: number;\n}\n\nexport interface Token {\n\ttoken_id: string;\n\toutcome: string;\n\tprice: number;\n}\n\nexport interface RewardsConfig {\n\tasset_address: string;\n\tstart_date: string;\n\tend_date: string;\n\trate_per_day: number;\n\ttotal_rewards: number;\n}\n\nexport interface MarketReward {\n\tcondition_id: string;\n\tquestion: string;\n\tmarket_slug: string;\n\tevent_slug: string;\n\timage: string;\n\trewards_max_spread: number;\n\trewards_min_size: number;\n\ttokens: Token[];\n\trewards_config: RewardsConfig[];\n}\n\nexport interface Earning {\n\tasset_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface UserRewardsEarning {\n\tcondition_id: string;\n\tquestion: string;\n\tmarket_slug: string;\n\tevent_slug: string;\n\timage: string;\n\trewards_max_spread: number;\n\trewards_min_size: number;\n\tmarket_competitiveness: number;\n\ttokens: Token[];\n\trewards_config: RewardsConfig[];\n\tmaker_address: string;\n\tearning_percentage: number;\n\tearnings: Earning[];\n}\n\nexport interface BuilderTrade {\n\tid: string;\n\ttradeType: string;\n\ttakerOrderHash: string;\n\tbuilder: string;\n\tmarket: string;\n\tassetId: string;\n\tside: string;\n\tsize: string;\n\tsizeUsdc: string;\n\tprice: string;\n\tstatus: string;\n\toutcome: string;\n\toutcomeIndex: number;\n\towner: string;\n\tmaker: string;\n\ttransactionHash: string;\n\tmatchTime: string;\n\tbucketIndex: number;\n\tfee: string;\n\tfeeUsdc: string;\n\tbuilderFee: string;\n\tbuilderCode: string;\n\terr_msg?: string | null;\n\tcreatedAt: string | null;\n\tupdatedAt: string | null;\n}\n\nexport interface ReadonlyApiKeyResponse {\n\tapiKey: string;\n}\n\nexport interface MarketTradeEvent {\n\tevent_type: string;\n\tmarket: {\n\t\tcondition_id: string;\n\t\tasset_id: string;\n\t\tquestion: string;\n\t\ticon: string;\n\t\tslug: string;\n\t};\n\tuser: {\n\t\taddress: string;\n\t\tusername: string;\n\t\tprofile_picture: string;\n\t\toptimized_profile_picture: string;\n\t\tpseudonym: string;\n\t};\n\tside: Side;\n\tsize: string;\n\tfee_rate_bps: string;\n\tprice: string;\n\toutcome: string;\n\toutcome_index: number;\n\ttransaction_hash: string;\n\ttimestamp: string;\n}\n\nexport interface BuilderApiKey {\n\tkey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface BuilderApiKeyResponse {\n\tkey: string;\n\tcreatedAt?: string;\n\trevokedAt?: string;\n}\n\nexport type ClobErrorResponseBody = {\n\terror: string;\n};\n\nexport interface TradesPaginatedResponse {\n\ttrades: Trade[];\n\tnext_cursor: string;\n\tlimit: number;\n\tcount: number;\n}\n\nexport interface BuilderTradesResponse {\n\ttrades: BuilderTrade[];\n\tnext_cursor: string;\n\tlimit: number;\n\tcount: number;\n}\n"],"mappings":";;;AA6CA,IAAY,kDAAL;AACN;AACA;AACA;AACA;;;AA0GD,IAAY,0CAAL;AACN;AACA;;;AAgBD,IAAY,wEAAL;AACN;AACA;AACA;AACA;AACA;;;AAqCD,IAAY,kDAAL;AACN;AACA"}
@@ -0,0 +1,6 @@
1
+ import { Side } from "../order-utils/model/side.js";
2
+ import { ApiKeyCreds, ApiKeyRaw, ApiKeysResponse, AssetType, BalanceAllowanceParams, BalanceAllowanceResponse, BanStatus, BookParams, BuilderApiKey, BuilderApiKeyResponse, BuilderConfig, BuilderFeeRates, BuilderTrade, BuilderTradeParams, BuilderTradesResponse, Chain, ClobErrorResponseBody, ClobRewards, ClobToken, CreateOrderOptions, DropNotificationParams, Earning, FeeDetails, FeeInfo, FeeInfos, FeeRates, L1PolyHeader, L2HeaderArgs, L2PolyHeader, MakerOrder, MarketDetails, MarketPrice, MarketReward, MarketTradeEvent, NegRisk, Notification, OpenOrder, OpenOrderParams, OpenOrdersResponse, OrderBookSummary, OrderMarketCancelParams, OrderPayload, OrderResponse, OrderScoring, OrderScoringParams, OrderSummary, OrderType, OrderVersion, OrdersScoring, OrdersScoringParams, PaginationPayload, PreMigrationOrder, PreMigrationOrdersResponse, PriceHistoryFilterParams, PriceHistoryInterval, ReadonlyApiKeyResponse, RewardsConfig, RewardsPercentages, RoundConfig, SimpleHeaders, TickSize, TickSizes, Token, TokenConditionMap, TotalUserEarning, Trade, TradeParams, TradesPaginatedResponse, UserEarning, UserRewardsEarning } from "./clob.js";
3
+ import { NewOrderV1, PostOrdersV1Args, UserMarketOrderV1, UserOrderV1, orderToJsonV1 } from "./ordersV1.js";
4
+ import { NewOrderV2, PostOrdersV2Args, UserMarketOrderV2, UserOrderV2, orderToJsonV2 } from "./ordersV2.js";
5
+ import { ExchangeV3OrderAmounts } from "./ordersV3.js";
6
+ import { PostOrdersArgs, SignedOrder, VersionedPostOrdersArgs, VersionedSignedOrder, VersionedUserMarketOrder, VersionedUserOrder, isV2Order } from "./unifiedOrder.js";
@@ -0,0 +1,29 @@
1
+
2
+ //#region src/types/ordersV1.ts
3
+ function orderToJsonV1(order, owner, orderType, postOnly = false, deferExec = false) {
4
+ return {
5
+ deferExec,
6
+ postOnly,
7
+ order: {
8
+ salt: parseInt(order.salt, 10),
9
+ maker: order.maker,
10
+ signer: order.signer,
11
+ taker: order.taker,
12
+ tokenId: order.tokenId,
13
+ makerAmount: order.makerAmount,
14
+ takerAmount: order.takerAmount,
15
+ side: order.side,
16
+ expiration: order.expiration,
17
+ nonce: order.nonce,
18
+ feeRateBps: order.feeRateBps,
19
+ signatureType: order.signatureType,
20
+ signature: order.signature
21
+ },
22
+ owner,
23
+ orderType
24
+ };
25
+ }
26
+
27
+ //#endregion
28
+ exports.orderToJsonV1 = orderToJsonV1;
29
+ //# sourceMappingURL=ordersV1.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ordersV1.cjs","names":[],"sources":["../../src/types/ordersV1.ts"],"sourcesContent":["import type { SignatureTypeV1, SignedOrderV1 } from \"../order-utils/index.js\";\n\nimport type { OrderType, Side } from \"./clob.js\";\n\nexport function orderToJsonV1<T extends OrderType>(\n\torder: SignedOrderV1,\n\towner: string,\n\torderType: T,\n\tpostOnly = false,\n\tdeferExec = false,\n): NewOrderV1<T> {\n\treturn {\n\t\tdeferExec,\n\t\tpostOnly,\n\t\torder: {\n\t\t\tsalt: parseInt(order.salt, 10),\n\t\t\tmaker: order.maker,\n\t\t\tsigner: order.signer,\n\t\t\ttaker: order.taker,\n\t\t\ttokenId: order.tokenId,\n\t\t\tmakerAmount: order.makerAmount,\n\t\t\ttakerAmount: order.takerAmount,\n\t\t\tside: order.side,\n\t\t\texpiration: order.expiration,\n\t\t\tnonce: order.nonce,\n\t\t\tfeeRateBps: order.feeRateBps,\n\t\t\tsignatureType: order.signatureType,\n\t\t\tsignature: order.signature,\n\t\t},\n\t\towner,\n\t\torderType,\n\t} as NewOrderV1<T>;\n}\n\nexport interface PostOrdersV1Args {\n\torder: SignedOrderV1;\n\torderType: OrderType;\n}\n\nexport interface NewOrderV1<T extends OrderType> {\n\treadonly order: {\n\t\treadonly salt: number;\n\t\treadonly maker: string;\n\t\treadonly signer: string;\n\t\treadonly taker: string;\n\t\treadonly tokenId: string;\n\t\treadonly makerAmount: string;\n\t\treadonly takerAmount: string;\n\t\treadonly expiration: string;\n\t\treadonly nonce: string;\n\t\treadonly feeRateBps: string;\n\t\treadonly side: string;\n\t\treadonly signatureType: SignatureTypeV1;\n\t\treadonly signature: string;\n\t};\n\treadonly owner: string;\n\treadonly orderType: T;\n\treadonly deferExec: boolean;\n\treadonly postOnly: boolean;\n}\n\n// Simplified order for users\nexport interface UserOrderV1 {\n\t/**\n\t * TokenID of the Conditional token asset being traded\n\t */\n\ttokenID: string;\n\n\t/**\n\t * Price used to create the order\n\t */\n\tprice: number;\n\n\t/**\n\t * Size in terms of the ConditionalToken\n\t */\n\tsize: number;\n\n\t/**\n\t * Side of the order\n\t */\n\tside: Side;\n\n\t/**\n\t * Fee rate, in basis points, charged to the order maker, charged on proceeds\n\t */\n\tfeeRateBps?: number;\n\n\t/**\n\t * Nonce used for onchain cancellations\n\t */\n\tnonce?: number;\n\n\t/**\n\t * Timestamp after which the order is expired.\n\t */\n\texpiration?: number;\n\n\t/**\n\t * Address of the order taker. The zero address is used to indicate a public order\n\t */\n\ttaker?: string;\n\n\t/**\n\t * Builder code (bytes32)\n\t */\n\tbuilderCode?: string;\n}\n\n// Simplified market order for users\nexport interface UserMarketOrderV1 {\n\t/**\n\t * TokenID of the Conditional token asset being traded\n\t */\n\ttokenID: string;\n\n\t/**\n\t * Price used to create the order\n\t * If it is not present the market price will be used.\n\t */\n\tprice?: number;\n\n\t/**\n\t * BUY orders: $$$ Amount to buy\n\t * SELL orders: Shares to sell\n\t */\n\tamount: number;\n\n\t/**\n\t * Side of the order\n\t */\n\tside: Side;\n\n\t/**\n\t * Fee rate, in basis points, charged to the order maker, charged on proceeds\n\t */\n\tfeeRateBps?: number;\n\n\t/**\n\t * Nonce used for onchain cancellations\n\t */\n\tnonce?: number;\n\n\t/**\n\t * Address of the order taker. The zero address is used to indicate a public order\n\t */\n\ttaker?: string;\n\n\t/**\n\t * Specifies the type of order execution:\n\t * - FOK (Fill or Kill): The order must be filled entirely or not at all.\n\t * - FAK (Fill and Kill): The order can be partially filled, and any unfilled portion is canceled.\n\t */\n\torderType?: OrderType.FOK | OrderType.FAK;\n\n\t/**\n\t * Builder code (bytes32)\n\t */\n\tbuilderCode?: string;\n}\n"],"mappings":";;AAIA,SAAgB,cACf,OACA,OACA,WACA,WAAW,OACX,YAAY,OACI;AAChB,QAAO;EACN;EACA;EACA,OAAO;GACN,MAAM,SAAS,MAAM,MAAM,GAAG;GAC9B,OAAO,MAAM;GACb,QAAQ,MAAM;GACd,OAAO,MAAM;GACb,SAAS,MAAM;GACf,aAAa,MAAM;GACnB,aAAa,MAAM;GACnB,MAAM,MAAM;GACZ,YAAY,MAAM;GAClB,OAAO,MAAM;GACb,YAAY,MAAM;GAClB,eAAe,MAAM;GACrB,WAAW,MAAM;GACjB;EACD;EACA;EACA"}
@@ -0,0 +1,115 @@
1
+ import { Side } from "../order-utils/model/side.cjs";
2
+ import { OrderType } from "./clob.cjs";
3
+ import { SignatureTypeV1 } from "../order-utils/model/signatureTypeV1.cjs";
4
+ import { SignedOrderV1 } from "../order-utils/model/orderDataV1.cjs";
5
+
6
+ //#region src/types/ordersV1.d.ts
7
+ declare function orderToJsonV1<T extends OrderType>(order: SignedOrderV1, owner: string, orderType: T, postOnly?: boolean, deferExec?: boolean): NewOrderV1<T>;
8
+ interface PostOrdersV1Args {
9
+ order: SignedOrderV1;
10
+ orderType: OrderType;
11
+ }
12
+ interface NewOrderV1<T extends OrderType> {
13
+ readonly order: {
14
+ readonly salt: number;
15
+ readonly maker: string;
16
+ readonly signer: string;
17
+ readonly taker: string;
18
+ readonly tokenId: string;
19
+ readonly makerAmount: string;
20
+ readonly takerAmount: string;
21
+ readonly expiration: string;
22
+ readonly nonce: string;
23
+ readonly feeRateBps: string;
24
+ readonly side: string;
25
+ readonly signatureType: SignatureTypeV1;
26
+ readonly signature: string;
27
+ };
28
+ readonly owner: string;
29
+ readonly orderType: T;
30
+ readonly deferExec: boolean;
31
+ readonly postOnly: boolean;
32
+ }
33
+ interface UserOrderV1 {
34
+ /**
35
+ * TokenID of the Conditional token asset being traded
36
+ */
37
+ tokenID: string;
38
+ /**
39
+ * Price used to create the order
40
+ */
41
+ price: number;
42
+ /**
43
+ * Size in terms of the ConditionalToken
44
+ */
45
+ size: number;
46
+ /**
47
+ * Side of the order
48
+ */
49
+ side: Side;
50
+ /**
51
+ * Fee rate, in basis points, charged to the order maker, charged on proceeds
52
+ */
53
+ feeRateBps?: number;
54
+ /**
55
+ * Nonce used for onchain cancellations
56
+ */
57
+ nonce?: number;
58
+ /**
59
+ * Timestamp after which the order is expired.
60
+ */
61
+ expiration?: number;
62
+ /**
63
+ * Address of the order taker. The zero address is used to indicate a public order
64
+ */
65
+ taker?: string;
66
+ /**
67
+ * Builder code (bytes32)
68
+ */
69
+ builderCode?: string;
70
+ }
71
+ interface UserMarketOrderV1 {
72
+ /**
73
+ * TokenID of the Conditional token asset being traded
74
+ */
75
+ tokenID: string;
76
+ /**
77
+ * Price used to create the order
78
+ * If it is not present the market price will be used.
79
+ */
80
+ price?: number;
81
+ /**
82
+ * BUY orders: $$$ Amount to buy
83
+ * SELL orders: Shares to sell
84
+ */
85
+ amount: number;
86
+ /**
87
+ * Side of the order
88
+ */
89
+ side: Side;
90
+ /**
91
+ * Fee rate, in basis points, charged to the order maker, charged on proceeds
92
+ */
93
+ feeRateBps?: number;
94
+ /**
95
+ * Nonce used for onchain cancellations
96
+ */
97
+ nonce?: number;
98
+ /**
99
+ * Address of the order taker. The zero address is used to indicate a public order
100
+ */
101
+ taker?: string;
102
+ /**
103
+ * Specifies the type of order execution:
104
+ * - FOK (Fill or Kill): The order must be filled entirely or not at all.
105
+ * - FAK (Fill and Kill): The order can be partially filled, and any unfilled portion is canceled.
106
+ */
107
+ orderType?: OrderType.FOK | OrderType.FAK;
108
+ /**
109
+ * Builder code (bytes32)
110
+ */
111
+ builderCode?: string;
112
+ }
113
+ //#endregion
114
+ export { NewOrderV1, PostOrdersV1Args, UserMarketOrderV1, UserOrderV1, orderToJsonV1 };
115
+ //# sourceMappingURL=ordersV1.d.cts.map