@polymarket/clob-client-v2 1.0.0 → 1.0.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 (148) hide show
  1. package/dist/index.cjs +2495 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +1000 -0
  4. package/dist/index.d.ts +1000 -8
  5. package/dist/index.js +2437 -8
  6. package/dist/index.js.map +1 -1
  7. package/package.json +12 -5
  8. package/dist/client.d.ts +0 -139
  9. package/dist/client.js +0 -973
  10. package/dist/client.js.map +0 -1
  11. package/dist/config.d.ts +0 -14
  12. package/dist/config.js +0 -32
  13. package/dist/config.js.map +0 -1
  14. package/dist/constants.d.ts +0 -6
  15. package/dist/constants.js +0 -10
  16. package/dist/constants.js.map +0 -1
  17. package/dist/endpoints.d.ts +0 -60
  18. package/dist/endpoints.js +0 -75
  19. package/dist/endpoints.js.map +0 -1
  20. package/dist/errors.d.ts +0 -7
  21. package/dist/errors.js +0 -13
  22. package/dist/errors.js.map +0 -1
  23. package/dist/headers/index.d.ts +0 -4
  24. package/dist/headers/index.js +0 -38
  25. package/dist/headers/index.js.map +0 -1
  26. package/dist/http-helpers/index.d.ts +0 -18
  27. package/dist/http-helpers/index.js +0 -124
  28. package/dist/http-helpers/index.js.map +0 -1
  29. package/dist/order-builder/helpers/buildMarketOrderCreationArgs.d.ts +0 -5
  30. package/dist/order-builder/helpers/buildMarketOrderCreationArgs.js +0 -37
  31. package/dist/order-builder/helpers/buildMarketOrderCreationArgs.js.map +0 -1
  32. package/dist/order-builder/helpers/buildOrder.d.ts +0 -14
  33. package/dist/order-builder/helpers/buildOrder.js +0 -29
  34. package/dist/order-builder/helpers/buildOrder.js.map +0 -1
  35. package/dist/order-builder/helpers/buildOrderCreationArgs.d.ts +0 -5
  36. package/dist/order-builder/helpers/buildOrderCreationArgs.js +0 -39
  37. package/dist/order-builder/helpers/buildOrderCreationArgs.js.map +0 -1
  38. package/dist/order-builder/helpers/calculateBuyMarketPrice.d.ts +0 -8
  39. package/dist/order-builder/helpers/calculateBuyMarketPrice.js +0 -34
  40. package/dist/order-builder/helpers/calculateBuyMarketPrice.js.map +0 -1
  41. package/dist/order-builder/helpers/calculateSellMarketPrice.d.ts +0 -8
  42. package/dist/order-builder/helpers/calculateSellMarketPrice.js +0 -34
  43. package/dist/order-builder/helpers/calculateSellMarketPrice.js.map +0 -1
  44. package/dist/order-builder/helpers/createMarketOrder.d.ts +0 -5
  45. package/dist/order-builder/helpers/createMarketOrder.js +0 -33
  46. package/dist/order-builder/helpers/createMarketOrder.js.map +0 -1
  47. package/dist/order-builder/helpers/createOrder.d.ts +0 -5
  48. package/dist/order-builder/helpers/createOrder.js +0 -33
  49. package/dist/order-builder/helpers/createOrder.js.map +0 -1
  50. package/dist/order-builder/helpers/getMarketOrderRawAmounts.d.ts +0 -6
  51. package/dist/order-builder/helpers/getMarketOrderRawAmounts.js +0 -37
  52. package/dist/order-builder/helpers/getMarketOrderRawAmounts.js.map +0 -1
  53. package/dist/order-builder/helpers/getOrderRawAmounts.d.ts +0 -6
  54. package/dist/order-builder/helpers/getOrderRawAmounts.js +0 -37
  55. package/dist/order-builder/helpers/getOrderRawAmounts.js.map +0 -1
  56. package/dist/order-builder/helpers/index.d.ts +0 -10
  57. package/dist/order-builder/helpers/index.js +0 -11
  58. package/dist/order-builder/helpers/index.js.map +0 -1
  59. package/dist/order-builder/helpers/roundingConfig.d.ts +0 -2
  60. package/dist/order-builder/helpers/roundingConfig.js +0 -23
  61. package/dist/order-builder/helpers/roundingConfig.js.map +0 -1
  62. package/dist/order-builder/index.d.ts +0 -1
  63. package/dist/order-builder/index.js +0 -2
  64. package/dist/order-builder/index.js.map +0 -1
  65. package/dist/order-builder/orderBuilder.d.ts +0 -28
  66. package/dist/order-builder/orderBuilder.js +0 -52
  67. package/dist/order-builder/orderBuilder.js.map +0 -1
  68. package/dist/order-utils/abi/ExchangeV1.d.ts +0 -1444
  69. package/dist/order-utils/abi/ExchangeV1.js +0 -1853
  70. package/dist/order-utils/abi/ExchangeV1.js.map +0 -1
  71. package/dist/order-utils/abi/ExchangeV2.d.ts +0 -1259
  72. package/dist/order-utils/abi/ExchangeV2.js +0 -1614
  73. package/dist/order-utils/abi/ExchangeV2.js.map +0 -1
  74. package/dist/order-utils/exchangeOrderBuilderV1.d.ts +0 -42
  75. package/dist/order-utils/exchangeOrderBuilderV1.js +0 -148
  76. package/dist/order-utils/exchangeOrderBuilderV1.js.map +0 -1
  77. package/dist/order-utils/exchangeOrderBuilderV2.d.ts +0 -42
  78. package/dist/order-utils/exchangeOrderBuilderV2.js +0 -119
  79. package/dist/order-utils/exchangeOrderBuilderV2.js.map +0 -1
  80. package/dist/order-utils/index.d.ts +0 -2711
  81. package/dist/order-utils/index.js +0 -13
  82. package/dist/order-utils/index.js.map +0 -1
  83. package/dist/order-utils/model/abi.d.ts +0 -21
  84. package/dist/order-utils/model/abi.js +0 -2
  85. package/dist/order-utils/model/abi.js.map +0 -1
  86. package/dist/order-utils/model/ctfExchangeV1TypedData.d.ts +0 -6
  87. package/dist/order-utils/model/ctfExchangeV1TypedData.js +0 -17
  88. package/dist/order-utils/model/ctfExchangeV1TypedData.js.map +0 -1
  89. package/dist/order-utils/model/ctfExchangeV2TypedData.d.ts +0 -6
  90. package/dist/order-utils/model/ctfExchangeV2TypedData.js +0 -16
  91. package/dist/order-utils/model/ctfExchangeV2TypedData.js.map +0 -1
  92. package/dist/order-utils/model/eip712.d.ts +0 -29
  93. package/dist/order-utils/model/eip712.js +0 -7
  94. package/dist/order-utils/model/eip712.js.map +0 -1
  95. package/dist/order-utils/model/order.d.ts +0 -2
  96. package/dist/order-utils/model/order.js +0 -2
  97. package/dist/order-utils/model/order.js.map +0 -1
  98. package/dist/order-utils/model/orderDataV1.d.ts +0 -111
  99. package/dist/order-utils/model/orderDataV1.js +0 -2
  100. package/dist/order-utils/model/orderDataV1.js.map +0 -1
  101. package/dist/order-utils/model/orderDataV2.d.ts +0 -110
  102. package/dist/order-utils/model/orderDataV2.js +0 -2
  103. package/dist/order-utils/model/orderDataV2.js.map +0 -1
  104. package/dist/order-utils/model/side.d.ts +0 -4
  105. package/dist/order-utils/model/side.js +0 -6
  106. package/dist/order-utils/model/side.js.map +0 -1
  107. package/dist/order-utils/model/signatureTypeV1.d.ts +0 -14
  108. package/dist/order-utils/model/signatureTypeV1.js +0 -16
  109. package/dist/order-utils/model/signatureTypeV1.js.map +0 -1
  110. package/dist/order-utils/model/signatureTypeV2.d.ts +0 -18
  111. package/dist/order-utils/model/signatureTypeV2.js +0 -20
  112. package/dist/order-utils/model/signatureTypeV2.js.map +0 -1
  113. package/dist/order-utils/utils.d.ts +0 -1
  114. package/dist/order-utils/utils.js +0 -4
  115. package/dist/order-utils/utils.js.map +0 -1
  116. package/dist/signing/constants.d.ts +0 -14
  117. package/dist/signing/constants.js +0 -16
  118. package/dist/signing/constants.js.map +0 -1
  119. package/dist/signing/eip712.d.ts +0 -9
  120. package/dist/signing/eip712.js +0 -40
  121. package/dist/signing/eip712.js.map +0 -1
  122. package/dist/signing/hmac.d.ts +0 -9
  123. package/dist/signing/hmac.js +0 -27
  124. package/dist/signing/hmac.js.map +0 -1
  125. package/dist/signing/index.d.ts +0 -3
  126. package/dist/signing/index.js +0 -4
  127. package/dist/signing/index.js.map +0 -1
  128. package/dist/signing/signer.d.ts +0 -22
  129. package/dist/signing/signer.js +0 -50
  130. package/dist/signing/signer.js.map +0 -1
  131. package/dist/types/clob.d.ts +0 -398
  132. package/dist/types/clob.js +0 -28
  133. package/dist/types/clob.js.map +0 -1
  134. package/dist/types/index.d.ts +0 -4
  135. package/dist/types/index.js +0 -5
  136. package/dist/types/index.js.map +0 -1
  137. package/dist/types/ordersV1.d.ts +0 -108
  138. package/dist/types/ordersV1.js +0 -24
  139. package/dist/types/ordersV1.js.map +0 -1
  140. package/dist/types/ordersV2.d.ts +0 -99
  141. package/dist/types/ordersV2.js +0 -25
  142. package/dist/types/ordersV2.js.map +0 -1
  143. package/dist/types/unifiedOrder.d.ts +0 -38
  144. package/dist/types/unifiedOrder.js +0 -9
  145. package/dist/types/unifiedOrder.js.map +0 -1
  146. package/dist/utilities.d.ts +0 -13
  147. package/dist/utilities.js +0 -47
  148. package/dist/utilities.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,8 +1,1000 @@
1
- export * from "./client.js";
2
- export * from "./config.js";
3
- export * from "./errors.js";
4
- export * from "./headers/index.js";
5
- export * from "./order-builder/index.js";
6
- export * from "./order-utils/model/signatureTypeV1.js";
7
- export * from "./order-utils/model/signatureTypeV2.js";
8
- export * from "./types/index.js";
1
+ import { WalletClient } from 'viem';
2
+
3
+ type TypedDataDomain = Record<string, unknown>;
4
+ type TypedDataTypes = Record<string, Array<{
5
+ name: string;
6
+ type: string;
7
+ }>>;
8
+ type TypedDataValue = Record<string, unknown>;
9
+ interface EthersSigner {
10
+ _signTypedData(domain: TypedDataDomain, types: TypedDataTypes, value: TypedDataValue): Promise<string>;
11
+ getAddress(): Promise<string>;
12
+ }
13
+ type ClobSigner = EthersSigner | WalletClient;
14
+
15
+ declare type EIP712ObjectValue = string | number | EIP712Object;
16
+ interface EIP712Object {
17
+ [key: string]: EIP712ObjectValue;
18
+ }
19
+
20
+ type OrderSignature = string;
21
+
22
+ declare enum Side {
23
+ BUY = "BUY",
24
+ SELL = "SELL"
25
+ }
26
+
27
+ interface ApiKeyCreds {
28
+ key: string;
29
+ secret: string;
30
+ passphrase: string;
31
+ }
32
+ interface BuilderConfig {
33
+ builderCode: string;
34
+ }
35
+ interface ApiKeyRaw {
36
+ apiKey: string;
37
+ secret: string;
38
+ passphrase: string;
39
+ }
40
+ interface L2HeaderArgs {
41
+ method: string;
42
+ requestPath: string;
43
+ body?: string;
44
+ }
45
+ type SimpleHeaders = Record<string, string | number | boolean>;
46
+ interface L1PolyHeader extends SimpleHeaders {
47
+ POLY_ADDRESS: string;
48
+ POLY_SIGNATURE: string;
49
+ POLY_TIMESTAMP: string;
50
+ POLY_NONCE: string;
51
+ }
52
+ interface L2PolyHeader extends SimpleHeaders {
53
+ POLY_ADDRESS: string;
54
+ POLY_SIGNATURE: string;
55
+ POLY_TIMESTAMP: string;
56
+ POLY_API_KEY: string;
57
+ POLY_PASSPHRASE: string;
58
+ }
59
+ declare enum OrderType {
60
+ GTC = "GTC",
61
+ FOK = "FOK",
62
+ GTD = "GTD",
63
+ FAK = "FAK"
64
+ }
65
+ interface OrderPayload {
66
+ orderID: string;
67
+ }
68
+ interface OrderResponse {
69
+ success: boolean;
70
+ errorMsg: string;
71
+ orderID: string;
72
+ transactionsHashes: string[];
73
+ status: string;
74
+ takingAmount: string;
75
+ makingAmount: string;
76
+ }
77
+ interface OpenOrder {
78
+ id: string;
79
+ status: string;
80
+ owner: string;
81
+ maker_address: string;
82
+ market: string;
83
+ asset_id: string;
84
+ side: string;
85
+ original_size: string;
86
+ size_matched: string;
87
+ price: string;
88
+ associate_trades: string[];
89
+ outcome: string;
90
+ created_at: number;
91
+ expiration: string;
92
+ order_type: string;
93
+ }
94
+ type OpenOrdersResponse = OpenOrder[];
95
+ type PreMigrationOrder = OpenOrder;
96
+ type PreMigrationOrdersResponse = PreMigrationOrder[];
97
+ interface MakerOrder {
98
+ order_id: string;
99
+ owner: string;
100
+ maker_address: string;
101
+ matched_amount: string;
102
+ price: string;
103
+ fee_rate_bps: string;
104
+ asset_id: string;
105
+ outcome: string;
106
+ side: Side;
107
+ }
108
+ interface Trade {
109
+ id: string;
110
+ taker_order_id: string;
111
+ market: string;
112
+ asset_id: string;
113
+ side: Side;
114
+ size: string;
115
+ fee_rate_bps: string;
116
+ price: string;
117
+ status: string;
118
+ match_time: string;
119
+ last_update: string;
120
+ outcome: string;
121
+ bucket_index: number;
122
+ owner: string;
123
+ maker_address: string;
124
+ maker_orders: MakerOrder[];
125
+ transaction_hash: string;
126
+ trader_side: "TAKER" | "MAKER";
127
+ }
128
+ interface ApiKeysResponse {
129
+ apiKeys: ApiKeyCreds[];
130
+ }
131
+ interface BanStatus {
132
+ closed_only: boolean;
133
+ }
134
+ interface TradeParams {
135
+ id?: string;
136
+ maker_address?: string;
137
+ market?: string;
138
+ asset_id?: string;
139
+ before?: string;
140
+ after?: string;
141
+ }
142
+ interface BuilderTradeParams extends TradeParams {
143
+ builder_code: string;
144
+ }
145
+ interface OpenOrderParams {
146
+ id?: string;
147
+ market?: string;
148
+ asset_id?: string;
149
+ }
150
+ declare enum Chain {
151
+ POLYGON = 137,
152
+ AMOY = 80002
153
+ }
154
+ interface MarketPrice {
155
+ t: number;
156
+ p: number;
157
+ }
158
+ interface PriceHistoryFilterParams {
159
+ market?: string;
160
+ startTs?: number;
161
+ endTs?: number;
162
+ fidelity?: number;
163
+ interval?: PriceHistoryInterval;
164
+ }
165
+ declare enum PriceHistoryInterval {
166
+ MAX = "max",
167
+ ONE_WEEK = "1w",
168
+ ONE_DAY = "1d",
169
+ SIX_HOURS = "6h",
170
+ ONE_HOUR = "1h"
171
+ }
172
+ interface DropNotificationParams {
173
+ ids: string[];
174
+ }
175
+ interface Notification {
176
+ type: number;
177
+ owner: string;
178
+ payload: any;
179
+ }
180
+ interface OrderMarketCancelParams {
181
+ market?: string;
182
+ asset_id?: string;
183
+ }
184
+ interface OrderBookSummary {
185
+ market: string;
186
+ asset_id: string;
187
+ timestamp: string;
188
+ bids: OrderSummary[];
189
+ asks: OrderSummary[];
190
+ min_order_size: string;
191
+ tick_size: string;
192
+ neg_risk: boolean;
193
+ hash: string;
194
+ }
195
+ interface OrderSummary {
196
+ price: string;
197
+ size: string;
198
+ }
199
+ declare enum AssetType {
200
+ COLLATERAL = "COLLATERAL",
201
+ CONDITIONAL = "CONDITIONAL"
202
+ }
203
+ interface BalanceAllowanceParams {
204
+ asset_type: AssetType;
205
+ token_id?: string;
206
+ }
207
+ interface BalanceAllowanceResponse {
208
+ balance: string;
209
+ allowance: string;
210
+ }
211
+ interface OrderScoringParams {
212
+ order_id: string;
213
+ }
214
+ interface OrderScoring {
215
+ scoring: boolean;
216
+ }
217
+ interface OrdersScoringParams {
218
+ orderIds: string[];
219
+ }
220
+ type OrdersScoring = {
221
+ [orderId in string]: boolean;
222
+ };
223
+ type CreateOrderOptions = {
224
+ tickSize: TickSize;
225
+ negRisk?: boolean;
226
+ };
227
+ type TickSize = "0.1" | "0.01" | "0.001" | "0.0001";
228
+ interface RoundConfig {
229
+ readonly price: number;
230
+ readonly size: number;
231
+ readonly amount: number;
232
+ }
233
+ interface TickSizes {
234
+ [tokenId: string]: TickSize;
235
+ }
236
+ interface FeeRates {
237
+ [tokenId: string]: number;
238
+ }
239
+ interface NegRisk {
240
+ [tokenId: string]: boolean;
241
+ }
242
+ interface FeeInfo {
243
+ rate: number;
244
+ exponent: number;
245
+ }
246
+ interface FeeInfos {
247
+ [tokenId: string]: FeeInfo;
248
+ }
249
+ interface BuilderFeeRates {
250
+ [builderCode: string]: {
251
+ maker: number;
252
+ taker: number;
253
+ };
254
+ }
255
+ type TokenConditionMap = Record<string, string>;
256
+ interface FeeDetails {
257
+ r?: number;
258
+ e?: number;
259
+ to: boolean;
260
+ }
261
+ interface ClobToken {
262
+ t: string;
263
+ o: string;
264
+ }
265
+ interface MarketDetails {
266
+ c: string;
267
+ t: [ClobToken | null, ClobToken | null];
268
+ mts: number;
269
+ nr: boolean;
270
+ fd?: FeeDetails;
271
+ mbf?: number;
272
+ tbf?: number;
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
+ err_msg?: string | null;
367
+ createdAt: string | null;
368
+ updatedAt: string | null;
369
+ }
370
+ interface ReadonlyApiKeyResponse {
371
+ apiKey: string;
372
+ }
373
+ interface MarketTradeEvent {
374
+ event_type: string;
375
+ market: {
376
+ condition_id: string;
377
+ asset_id: string;
378
+ question: string;
379
+ icon: string;
380
+ slug: string;
381
+ };
382
+ user: {
383
+ address: string;
384
+ username: string;
385
+ profile_picture: string;
386
+ optimized_profile_picture: string;
387
+ pseudonym: string;
388
+ };
389
+ side: Side;
390
+ size: string;
391
+ fee_rate_bps: string;
392
+ price: string;
393
+ outcome: string;
394
+ outcome_index: number;
395
+ transaction_hash: string;
396
+ timestamp: string;
397
+ }
398
+ interface BuilderApiKey {
399
+ key: string;
400
+ secret: string;
401
+ passphrase: string;
402
+ }
403
+ interface BuilderApiKeyResponse {
404
+ key: string;
405
+ createdAt?: string;
406
+ revokedAt?: string;
407
+ }
408
+ type ClobErrorResponseBody = {
409
+ error: string;
410
+ };
411
+ interface TradesPaginatedResponse {
412
+ trades: Trade[];
413
+ next_cursor: string;
414
+ limit: number;
415
+ count: number;
416
+ }
417
+ interface BuilderTradesResponse {
418
+ trades: BuilderTrade[];
419
+ next_cursor: string;
420
+ limit: number;
421
+ count: number;
422
+ }
423
+
424
+ declare function orderToJsonV1<T extends OrderType>(order: SignedOrderV1, owner: string, orderType: T, postOnly?: boolean, deferExec?: boolean): NewOrderV1<T>;
425
+ interface PostOrdersV1Args {
426
+ order: SignedOrderV1;
427
+ orderType: OrderType;
428
+ }
429
+ interface NewOrderV1<T extends OrderType> {
430
+ readonly order: {
431
+ readonly salt: number;
432
+ readonly maker: string;
433
+ readonly signer: string;
434
+ readonly taker: string;
435
+ readonly tokenId: string;
436
+ readonly makerAmount: string;
437
+ readonly takerAmount: string;
438
+ readonly expiration: string;
439
+ readonly nonce: string;
440
+ readonly feeRateBps: string;
441
+ readonly side: string;
442
+ readonly signatureType: SignatureTypeV1;
443
+ readonly signature: string;
444
+ };
445
+ readonly owner: string;
446
+ readonly orderType: T;
447
+ readonly deferExec: boolean;
448
+ readonly postOnly: boolean;
449
+ }
450
+ interface UserOrderV1 {
451
+ /**
452
+ * TokenID of the Conditional token asset being traded
453
+ */
454
+ tokenID: string;
455
+ /**
456
+ * Price used to create the order
457
+ */
458
+ price: number;
459
+ /**
460
+ * Size in terms of the ConditionalToken
461
+ */
462
+ size: number;
463
+ /**
464
+ * Side of the order
465
+ */
466
+ side: Side;
467
+ /**
468
+ * Fee rate, in basis points, charged to the order maker, charged on proceeds
469
+ */
470
+ feeRateBps?: number;
471
+ /**
472
+ * Nonce used for onchain cancellations
473
+ */
474
+ nonce?: number;
475
+ /**
476
+ * Timestamp after which the order is expired.
477
+ */
478
+ expiration?: number;
479
+ /**
480
+ * Address of the order taker. The zero address is used to indicate a public order
481
+ */
482
+ taker?: string;
483
+ /**
484
+ * Builder code (bytes32)
485
+ */
486
+ builderCode?: string;
487
+ }
488
+ interface UserMarketOrderV1 {
489
+ /**
490
+ * TokenID of the Conditional token asset being traded
491
+ */
492
+ tokenID: string;
493
+ /**
494
+ * Price used to create the order
495
+ * If it is not present the market price will be used.
496
+ */
497
+ price?: number;
498
+ /**
499
+ * BUY orders: $$$ Amount to buy
500
+ * SELL orders: Shares to sell
501
+ */
502
+ amount: number;
503
+ /**
504
+ * Side of the order
505
+ */
506
+ side: Side;
507
+ /**
508
+ * Fee rate, in basis points, charged to the order maker, charged on proceeds
509
+ */
510
+ feeRateBps?: number;
511
+ /**
512
+ * Nonce used for onchain cancellations
513
+ */
514
+ nonce?: number;
515
+ /**
516
+ * Address of the order taker. The zero address is used to indicate a public order
517
+ */
518
+ taker?: string;
519
+ /**
520
+ * Specifies the type of order execution:
521
+ * - FOK (Fill or Kill): The order must be filled entirely or not at all.
522
+ * - FAK (Fill and Kill): The order can be partially filled, and any unfilled portion is canceled.
523
+ */
524
+ orderType?: OrderType.FOK | OrderType.FAK;
525
+ /**
526
+ * Builder code (bytes32)
527
+ */
528
+ builderCode?: string;
529
+ }
530
+
531
+ declare function orderToJsonV2<T extends OrderType>(order: SignedOrderV2, owner: string, orderType: T, postOnly?: boolean, deferExec?: boolean): NewOrderV2<T>;
532
+ interface PostOrdersV2Args {
533
+ order: SignedOrderV2;
534
+ orderType: OrderType;
535
+ }
536
+ interface NewOrderV2<T extends OrderType> {
537
+ readonly order: {
538
+ readonly salt: number;
539
+ readonly maker: string;
540
+ readonly signer: string;
541
+ readonly taker: string;
542
+ readonly tokenId: string;
543
+ readonly makerAmount: string;
544
+ readonly takerAmount: string;
545
+ readonly side: string;
546
+ readonly signatureType: SignatureTypeV2;
547
+ readonly timestamp: string;
548
+ readonly expiration: string;
549
+ readonly metadata: string;
550
+ readonly builder: string;
551
+ readonly signature: string;
552
+ };
553
+ readonly owner: string;
554
+ readonly orderType: T;
555
+ readonly deferExec: boolean;
556
+ readonly postOnly: boolean;
557
+ }
558
+ interface UserOrderV2 {
559
+ /**
560
+ * TokenID of the Conditional token asset being traded
561
+ */
562
+ tokenID: string;
563
+ /**
564
+ * Price used to create the order
565
+ */
566
+ price: number;
567
+ /**
568
+ * Size in terms of the ConditionalToken
569
+ */
570
+ size: number;
571
+ /**
572
+ * Side of the order
573
+ */
574
+ side: Side;
575
+ /**
576
+ * Metadata (bytes32)
577
+ */
578
+ metadata?: string;
579
+ /**
580
+ * Builder code (bytes32)
581
+ */
582
+ builderCode?: string;
583
+ /**
584
+ * Expiration timestamp (unix seconds). Defaults to 0 (no expiration).
585
+ */
586
+ expiration?: number;
587
+ }
588
+ interface UserMarketOrderV2 {
589
+ /**
590
+ * TokenID of the Conditional token asset being traded
591
+ */
592
+ tokenID: string;
593
+ /**
594
+ * Price used to create the order
595
+ * If it is not present the market price will be used.
596
+ */
597
+ price?: number;
598
+ /**
599
+ * BUY orders: $$$ Amount to buy
600
+ * SELL orders: Shares to sell
601
+ */
602
+ amount: number;
603
+ /**
604
+ * Side of the order
605
+ */
606
+ side: Side;
607
+ /**
608
+ * Specifies the type of order execution:
609
+ * - FOK (Fill or Kill): The order must be filled entirely or not at all.
610
+ * - FAK (Fill and Kill): The order can be partially filled, and any unfilled portion is canceled.
611
+ */
612
+ orderType?: OrderType.FOK | OrderType.FAK;
613
+ /**
614
+ * User's USDC balance. If provided and sufficient to cover amount + fees, the order
615
+ * amount is used as-is. Otherwise fees are deducted from the amount.
616
+ * If this field is left empty, the default flow is to use the order amount as-is
617
+ */
618
+ userUSDCBalance?: number;
619
+ /**
620
+ * Metadata (bytes32)
621
+ */
622
+ metadata?: string;
623
+ /**
624
+ * Builder code (bytes32)
625
+ */
626
+ builderCode?: string;
627
+ }
628
+
629
+ type SignedOrder = SignedOrderV1 | SignedOrderV2;
630
+ type PostOrdersArgs = {
631
+ order: SignedOrder;
632
+ orderType: OrderType;
633
+ };
634
+ type VersionedSignedOrder = {
635
+ version: 1;
636
+ order: SignedOrderV1;
637
+ } | {
638
+ version: 2;
639
+ order: SignedOrderV2;
640
+ };
641
+ type VersionedUserOrder = {
642
+ version: 1;
643
+ order: UserOrderV1;
644
+ } | {
645
+ version: 2;
646
+ order: UserOrderV2;
647
+ };
648
+ type VersionedUserMarketOrder = {
649
+ version: 1;
650
+ order: UserMarketOrderV1;
651
+ } | {
652
+ version: 2;
653
+ order: UserMarketOrderV2;
654
+ };
655
+ type VersionedPostOrdersArgs = {
656
+ version: 1;
657
+ args: PostOrdersV1Args;
658
+ } | {
659
+ version: 2;
660
+ args: PostOrdersV2Args;
661
+ };
662
+ declare function isV2Order(order: SignedOrder | VersionedSignedOrder): order is SignedOrderV2;
663
+
664
+ declare enum SignatureTypeV1 {
665
+ /**
666
+ * ECDSA EIP712 signatures signed by EOAs
667
+ */
668
+ EOA = 0,
669
+ /**
670
+ * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
671
+ */
672
+ POLY_PROXY = 1,
673
+ /**
674
+ * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
675
+ */
676
+ POLY_GNOSIS_SAFE = 2
677
+ }
678
+
679
+ interface OrderV1 extends EIP712Object {
680
+ /**
681
+ * Unique salt to ensure entropy
682
+ */
683
+ readonly salt: string;
684
+ /**
685
+ * Maker of the order, i.e the source of funds for the order
686
+ */
687
+ readonly maker: string;
688
+ /**
689
+ * Signer of the order
690
+ */
691
+ readonly signer: string;
692
+ /**
693
+ * Address of the order taker. The zero address is used to indicate a public order
694
+ */
695
+ readonly taker: string;
696
+ /**
697
+ * Token Id of the CTF ERC1155 asset to be bought or sold.
698
+ * If BUY, this is the tokenId of the asset to be bought, i.e the makerAssetId
699
+ * If SELL, this is the tokenId of the asset to be sold, i.e the takerAssetId
700
+ */
701
+ readonly tokenId: string;
702
+ /**
703
+ * Maker amount, i.e the max amount of tokens to be sold
704
+ */
705
+ readonly makerAmount: string;
706
+ /**
707
+ * Taker amount, i.e the minimum amount of tokens to be received
708
+ */
709
+ readonly takerAmount: string;
710
+ /**
711
+ * Timestamp after which the order is expired
712
+ */
713
+ readonly expiration: string;
714
+ /**
715
+ * Nonce used for onchain cancellations
716
+ */
717
+ readonly nonce: string;
718
+ /**
719
+ * Fee rate, in basis points, charged to the order maker, charged on proceeds
720
+ */
721
+ readonly feeRateBps: string;
722
+ /**
723
+ * The side of the order, BUY or SELL
724
+ */
725
+ readonly side: Side;
726
+ /**
727
+ * Signature type used by the Order
728
+ */
729
+ readonly signatureType: SignatureTypeV1;
730
+ }
731
+ interface SignedOrderV1 extends OrderV1 {
732
+ /**
733
+ * The order signature
734
+ */
735
+ readonly signature: OrderSignature;
736
+ }
737
+
738
+ declare enum SignatureTypeV2 {
739
+ /**
740
+ * ECDSA EIP712 signatures signed by EOAs
741
+ */
742
+ EOA = 0,
743
+ /**
744
+ * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
745
+ */
746
+ POLY_PROXY = 1,
747
+ /**
748
+ * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
749
+ */
750
+ POLY_GNOSIS_SAFE = 2,
751
+ /**
752
+ * EIP1271 signatures signed by smart contracts. To be used by smart contract wallets or vaults
753
+ */
754
+ POLY_1271 = 3
755
+ }
756
+
757
+ interface OrderV2 extends EIP712Object {
758
+ /**
759
+ * Unique salt to ensure entropy
760
+ */
761
+ readonly salt: string;
762
+ /**
763
+ * Maker of the order, i.e the source of funds for the order
764
+ */
765
+ readonly maker: string;
766
+ /**
767
+ * Signer of the order
768
+ */
769
+ readonly signer: string;
770
+ /**
771
+ * Token Id of the CTF ERC1155 asset to be bought or sold.
772
+ * If BUY, this is the tokenId of the asset to be bought, i.e the makerAssetId
773
+ * If SELL, this is the tokenId of the asset to be sold, i.e the takerAssetId
774
+ */
775
+ readonly tokenId: string;
776
+ /**
777
+ * Maker amount, i.e the max amount of tokens to be sold
778
+ */
779
+ readonly makerAmount: string;
780
+ /**
781
+ * Taker amount, i.e the minimum amount of tokens to be received
782
+ */
783
+ readonly takerAmount: string;
784
+ /**
785
+ * The side of the order, BUY or SELL
786
+ */
787
+ readonly side: Side;
788
+ /**
789
+ * Signature type used by the Order
790
+ */
791
+ readonly signatureType: SignatureTypeV2;
792
+ /**
793
+ * Timestamp of the order
794
+ */
795
+ readonly timestamp: string;
796
+ /**
797
+ * Metadata of the order
798
+ */
799
+ readonly metadata: string;
800
+ /**
801
+ * Builder of the order
802
+ */
803
+ readonly builder: string;
804
+ /**
805
+ * Expiration timestamp of the order (unix seconds, "0" = no expiration)
806
+ */
807
+ readonly expiration: string;
808
+ }
809
+ interface SignedOrderV2 extends OrderV2 {
810
+ /**
811
+ * The order signature
812
+ */
813
+ readonly signature: OrderSignature;
814
+ }
815
+
816
+ declare class OrderBuilder {
817
+ readonly signer: ClobSigner;
818
+ readonly chainId: Chain;
819
+ readonly signatureType: SignatureTypeV2;
820
+ readonly funderAddress?: string;
821
+ /**
822
+ * Optional function to dynamically resolve the signer.
823
+ * If provided, this function will be called to obtain a fresh signer instance
824
+ * (e.g., for smart contract wallets or when the signer may change).
825
+ * Should return a Wallet or JsonRpcSigner, or a Promise resolving to one.
826
+ * If not provided, the static `signer` property is used.
827
+ */
828
+ private getSigner?;
829
+ constructor(signer: ClobSigner, chainId: Chain, signatureType?: SignatureTypeV2, funderAddress?: string, getSigner?: () => Promise<ClobSigner> | ClobSigner);
830
+ /**
831
+ * Generate and sign a order
832
+ */
833
+ buildOrder(userOrder: UserOrderV1 | UserOrderV2, options: CreateOrderOptions, version: number): Promise<SignedOrderV1 | SignedOrderV2>;
834
+ /**
835
+ * Generate and sign a market order
836
+ */
837
+ buildMarketOrder(userMarketOrder: UserMarketOrderV1 | UserMarketOrderV2, options: CreateOrderOptions, version: number): Promise<SignedOrderV1 | SignedOrderV2>;
838
+ /** Unified getter: use fresh signer if available */
839
+ private resolveSigner;
840
+ }
841
+
842
+ declare function adjustBuyAmountForFees(amount: number, price: number, userUSDCBalance: number, feeRate: number, feeExponent: number, builderTakerFeeRate: number): number;
843
+ interface ClobClientOptions {
844
+ host: string;
845
+ chain: Chain;
846
+ signer?: ClobSigner;
847
+ creds?: ApiKeyCreds;
848
+ signatureType?: SignatureTypeV2;
849
+ funderAddress?: string;
850
+ useServerTime?: boolean;
851
+ builderConfig?: BuilderConfig;
852
+ getSigner?: () => Promise<ClobSigner> | ClobSigner;
853
+ retryOnError?: boolean;
854
+ throwOnError?: boolean;
855
+ }
856
+ declare class ClobClient {
857
+ readonly host: string;
858
+ readonly chainId: Chain;
859
+ readonly signer?: ClobSigner;
860
+ readonly creds?: ApiKeyCreds;
861
+ readonly orderBuilder: OrderBuilder;
862
+ readonly tickSizes: TickSizes;
863
+ readonly negRisk: NegRisk;
864
+ readonly feeInfos: FeeInfos;
865
+ readonly feeRates: FeeRates;
866
+ readonly builderFeeRates: BuilderFeeRates;
867
+ private readonly tokenConditionMap;
868
+ readonly useServerTime?: boolean;
869
+ readonly builderConfig?: BuilderConfig;
870
+ private cachedVersion?;
871
+ readonly retryOnError?: boolean;
872
+ readonly throwOnError?: boolean;
873
+ constructor({ host, chain, signer, creds, signatureType, funderAddress, useServerTime, builderConfig, getSigner, retryOnError, throwOnError, }: ClobClientOptions);
874
+ getOk(): Promise<any>;
875
+ postHeartbeat(heartbeatId?: string): Promise<{
876
+ heartbeat_id: string;
877
+ error_msg?: string;
878
+ }>;
879
+ getVersion(): Promise<number>;
880
+ getServerTime(): Promise<number>;
881
+ getSamplingSimplifiedMarkets(next_cursor?: string): Promise<PaginationPayload>;
882
+ getSamplingMarkets(next_cursor?: string): Promise<PaginationPayload>;
883
+ getSimplifiedMarkets(next_cursor?: string): Promise<PaginationPayload>;
884
+ getMarkets(next_cursor?: string): Promise<PaginationPayload>;
885
+ getMarket(conditionID: string): Promise<any>;
886
+ getClobMarketInfo(conditionID: string): Promise<MarketDetails>;
887
+ getOrderBook(tokenID: string): Promise<OrderBookSummary>;
888
+ getOrderBooks(params: BookParams[]): Promise<OrderBookSummary[]>;
889
+ getTickSize(tokenID: string): Promise<TickSize>;
890
+ getNegRisk(tokenID: string): Promise<boolean>;
891
+ getFeeRateBps(tokenID: string): Promise<number>;
892
+ getFeeExponent(tokenID: string): Promise<number>;
893
+ /**
894
+ * Calculates the hash for the given orderbook
895
+ * @param orderbook
896
+ * @returns
897
+ */
898
+ getOrderBookHash(orderbook: OrderBookSummary): string;
899
+ getMidpoint(tokenID: string): Promise<any>;
900
+ getMidpoints(params: BookParams[]): Promise<any>;
901
+ getPrice(tokenID: string, side: string): Promise<any>;
902
+ getPrices(params: BookParams[]): Promise<any>;
903
+ getSpread(tokenID: string): Promise<any>;
904
+ getSpreads(params: BookParams[]): Promise<any>;
905
+ getLastTradePrice(tokenID: string): Promise<any>;
906
+ getLastTradesPrices(params: BookParams[]): Promise<any>;
907
+ getPricesHistory(params: PriceHistoryFilterParams): Promise<MarketPrice[]>;
908
+ /**
909
+ * Creates a new API key for a user
910
+ * @param nonce
911
+ * @returns ApiKeyCreds
912
+ */
913
+ createApiKey(nonce?: number): Promise<ApiKeyCreds>;
914
+ /**
915
+ * Derives an existing API key for a user
916
+ * @param nonce
917
+ * @returns ApiKeyCreds
918
+ */
919
+ deriveApiKey(nonce?: number): Promise<ApiKeyCreds>;
920
+ createOrDeriveApiKey(nonce?: number): Promise<ApiKeyCreds>;
921
+ getApiKeys(): Promise<ApiKeysResponse>;
922
+ getClosedOnlyMode(): Promise<BanStatus>;
923
+ deleteApiKey(): Promise<any>;
924
+ createReadonlyApiKey(): Promise<ReadonlyApiKeyResponse>;
925
+ getReadonlyApiKeys(): Promise<string[]>;
926
+ deleteReadonlyApiKey(key: string): Promise<boolean>;
927
+ getOrder(orderID: string): Promise<OpenOrder>;
928
+ getTrades(params?: TradeParams, only_first_page?: boolean, next_cursor?: string): Promise<Trade[]>;
929
+ getTradesPaginated(params?: TradeParams, next_cursor?: string): Promise<TradesPaginatedResponse>;
930
+ getBuilderTrades(params: BuilderTradeParams, next_cursor?: string): Promise<BuilderTradesResponse>;
931
+ getNotifications(): Promise<Notification[]>;
932
+ dropNotifications(params?: DropNotificationParams): Promise<void>;
933
+ getBalanceAllowance(params?: BalanceAllowanceParams): Promise<BalanceAllowanceResponse>;
934
+ updateBalanceAllowance(params?: BalanceAllowanceParams): Promise<void>;
935
+ createOrder(userOrder: UserOrderV1 | UserOrderV2, options?: Partial<CreateOrderOptions>): Promise<SignedOrder>;
936
+ createMarketOrder(userMarketOrder: UserMarketOrderV1 | UserMarketOrderV2, options?: Partial<CreateOrderOptions>): Promise<SignedOrder>;
937
+ createAndPostOrder<T extends OrderType.GTC | OrderType.GTD = OrderType.GTC>(userOrder: UserOrderV1 | UserOrderV2, options?: Partial<CreateOrderOptions>, orderType?: T, postOnly?: boolean, deferExec?: boolean): Promise<any>;
938
+ createAndPostMarketOrder<T extends OrderType.FOK | OrderType.FAK = OrderType.FOK>(userMarketOrder: UserMarketOrderV1 | UserMarketOrderV2, options?: Partial<CreateOrderOptions>, orderType?: T, deferExec?: boolean): Promise<any>;
939
+ getOpenOrders(params?: OpenOrderParams, only_first_page?: boolean, next_cursor?: string): Promise<OpenOrdersResponse>;
940
+ getPreMigrationOrders(only_first_page?: boolean, next_cursor?: string): Promise<PreMigrationOrdersResponse>;
941
+ postOrder<T extends OrderType = OrderType.GTC>(order: SignedOrder, orderType?: T, postOnly?: boolean, deferExec?: boolean): Promise<any>;
942
+ postOrders(args: PostOrdersArgs[], postOnly?: boolean, deferExec?: boolean): Promise<any>;
943
+ cancelOrder(payload: OrderPayload): Promise<any>;
944
+ cancelOrders(ordersHashes: string[]): Promise<any>;
945
+ cancelAll(): Promise<any>;
946
+ cancelMarketOrders(payload: OrderMarketCancelParams): Promise<any>;
947
+ isOrderScoring(params?: OrderScoringParams): Promise<OrderScoring>;
948
+ areOrdersScoring(params?: OrdersScoringParams): Promise<OrdersScoring>;
949
+ getEarningsForUserForDay(date: string): Promise<UserEarning[]>;
950
+ getTotalEarningsForUserForDay(date: string): Promise<TotalUserEarning[]>;
951
+ getUserEarningsAndMarketsConfig(date: string, order_by?: string, position?: string, no_competition?: boolean): Promise<UserRewardsEarning[]>;
952
+ getRewardPercentages(): Promise<RewardsPercentages>;
953
+ getCurrentRewards(): Promise<MarketReward[]>;
954
+ getRawRewardsForMarket(conditionId: string): Promise<MarketReward[]>;
955
+ calculateMarketPrice(tokenID: string, side: Side, amount: number, orderType?: OrderType): Promise<number>;
956
+ createBuilderApiKey(): Promise<BuilderApiKey>;
957
+ getBuilderApiKeys(): Promise<BuilderApiKeyResponse[]>;
958
+ revokeBuilderApiKey(): Promise<any>;
959
+ getMarketTradesEvents(conditionID: string): Promise<MarketTradeEvent[]>;
960
+ private canL1Auth;
961
+ private canL2Auth;
962
+ private isBuilderOrder;
963
+ private _ensureMarketInfoCached;
964
+ private ensureBuilderFeeRateCached;
965
+ private _resolveTickSize;
966
+ private _resolveFeeRateBps;
967
+ private resolveVersion;
968
+ private _retryOnVersionUpdate;
969
+ private _isOrderVersionMismatch;
970
+ private throwIfError;
971
+ private get;
972
+ private post;
973
+ private del;
974
+ }
975
+
976
+ type ContractConfig = {
977
+ exchange: string;
978
+ negRiskAdapter: string;
979
+ negRiskExchange: string;
980
+ collateral: string;
981
+ conditionalTokens: string;
982
+ exchangeV2: string;
983
+ negRiskExchangeV2: string;
984
+ };
985
+ declare const COLLATERAL_TOKEN_DECIMALS = 6;
986
+ declare const CONDITIONAL_TOKEN_DECIMALS = 6;
987
+ declare const getContractConfig: (chainID: number) => ContractConfig;
988
+
989
+ declare const L1_AUTH_UNAVAILABLE_ERROR: Error;
990
+ declare const L2_AUTH_NOT_AVAILABLE: Error;
991
+ declare class ApiError extends Error {
992
+ readonly status?: number;
993
+ readonly data?: unknown;
994
+ constructor(message: string, status?: number, data?: unknown);
995
+ }
996
+
997
+ declare const createL1Headers: (signer: ClobSigner, chainId: Chain, nonce?: number, timestamp?: number) => Promise<L1PolyHeader>;
998
+ declare const createL2Headers: (signer: ClobSigner, creds: ApiKeyCreds, l2HeaderArgs: L2HeaderArgs, timestamp?: number) => Promise<L2PolyHeader>;
999
+
1000
+ export { ApiError, type ApiKeyCreds, type ApiKeyRaw, type ApiKeysResponse, AssetType, type BalanceAllowanceParams, type BalanceAllowanceResponse, type BanStatus, type BookParams, type BuilderApiKey, type BuilderApiKeyResponse, type BuilderConfig, type BuilderFeeRates, type BuilderTrade, type BuilderTradeParams, type BuilderTradesResponse, COLLATERAL_TOKEN_DECIMALS, CONDITIONAL_TOKEN_DECIMALS, Chain, ClobClient, type ClobClientOptions, type ClobErrorResponseBody, type ClobToken, type ContractConfig, type CreateOrderOptions, type DropNotificationParams, type Earning, type FeeDetails, type FeeInfo, type FeeInfos, type FeeRates, type L1PolyHeader, L1_AUTH_UNAVAILABLE_ERROR, type L2HeaderArgs, type L2PolyHeader, L2_AUTH_NOT_AVAILABLE, type MakerOrder, type MarketDetails, type MarketPrice, type MarketReward, type MarketTradeEvent, type NegRisk, type NewOrderV1, type NewOrderV2, type Notification, type OpenOrder, type OpenOrderParams, type OpenOrdersResponse, type OrderBookSummary, OrderBuilder, type OrderMarketCancelParams, type OrderPayload, type OrderResponse, type OrderScoring, type OrderScoringParams, type OrderSummary, OrderType, type OrdersScoring, type OrdersScoringParams, type PaginationPayload, type PostOrdersArgs, type PostOrdersV1Args, type PostOrdersV2Args, type PreMigrationOrder, type PreMigrationOrdersResponse, type PriceHistoryFilterParams, PriceHistoryInterval, type ReadonlyApiKeyResponse, type RewardsConfig, type RewardsPercentages, type RoundConfig, Side, SignatureTypeV1, SignatureTypeV2, type SignedOrder, type SimpleHeaders, type TickSize, type TickSizes, type Token, type TokenConditionMap, type TotalUserEarning, type Trade, type TradeParams, type TradesPaginatedResponse, type UserEarning, type UserMarketOrderV1, type UserMarketOrderV2, type UserOrderV1, type UserOrderV2, type UserRewardsEarning, type VersionedPostOrdersArgs, type VersionedSignedOrder, type VersionedUserMarketOrder, type VersionedUserOrder, adjustBuyAmountForFees, createL1Headers, createL2Headers, getContractConfig, isV2Order, orderToJsonV1, orderToJsonV2 };