clob-client-sdks 5.3.4

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.

Potentially problematic release.


This version of clob-client-sdks might be problematic. Click here for more details.

Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -0
  3. package/dist/client.d.ts +165 -0
  4. package/dist/client.js +954 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/config.d.ts +12 -0
  7. package/dist/config.js +28 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/constants.d.ts +3 -0
  10. package/dist/constants.js +7 -0
  11. package/dist/constants.js.map +1 -0
  12. package/dist/endpoints.d.ts +67 -0
  13. package/dist/endpoints.js +82 -0
  14. package/dist/endpoints.js.map +1 -0
  15. package/dist/errors.d.ts +9 -0
  16. package/dist/errors.js +15 -0
  17. package/dist/errors.js.map +1 -0
  18. package/dist/headers/index.d.ts +7 -0
  19. package/dist/headers/index.js +41 -0
  20. package/dist/headers/index.js.map +1 -0
  21. package/dist/http-helpers/index.d.ts +21 -0
  22. package/dist/http-helpers/index.js +166 -0
  23. package/dist/http-helpers/index.js.map +1 -0
  24. package/dist/index.d.ts +8 -0
  25. package/dist/index.js +9 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/order-builder/builder.d.ts +30 -0
  28. package/dist/order-builder/builder.js +52 -0
  29. package/dist/order-builder/builder.js.map +1 -0
  30. package/dist/order-builder/helpers.d.ts +51 -0
  31. package/dist/order-builder/helpers.js +279 -0
  32. package/dist/order-builder/helpers.js.map +1 -0
  33. package/dist/order-builder/index.d.ts +1 -0
  34. package/dist/order-builder/index.js +2 -0
  35. package/dist/order-builder/index.js.map +1 -0
  36. package/dist/rfq-client.d.ts +64 -0
  37. package/dist/rfq-client.js +397 -0
  38. package/dist/rfq-client.js.map +1 -0
  39. package/dist/rfq-deps.d.ts +45 -0
  40. package/dist/rfq-deps.js +2 -0
  41. package/dist/rfq-deps.js.map +1 -0
  42. package/dist/signing/constants.d.ts +14 -0
  43. package/dist/signing/constants.js +16 -0
  44. package/dist/signing/constants.js.map +1 -0
  45. package/dist/signing/eip712.d.ts +10 -0
  46. package/dist/signing/eip712.js +34 -0
  47. package/dist/signing/eip712.js.map +1 -0
  48. package/dist/signing/hmac.d.ts +9 -0
  49. package/dist/signing/hmac.js +58 -0
  50. package/dist/signing/hmac.js.map +1 -0
  51. package/dist/signing/index.d.ts +2 -0
  52. package/dist/signing/index.js +3 -0
  53. package/dist/signing/index.js.map +1 -0
  54. package/dist/types.d.ts +667 -0
  55. package/dist/types.js +37 -0
  56. package/dist/types.js.map +1 -0
  57. package/dist/utilities.d.ts +16 -0
  58. package/dist/utilities.js +93 -0
  59. package/dist/utilities.js.map +1 -0
  60. package/package.json +110 -0
@@ -0,0 +1,667 @@
1
+ import type { SignatureType, SignedOrder } from "@polymarket/order-utils";
2
+ export interface ApiKeyCreds {
3
+ key: string;
4
+ secret: string;
5
+ passphrase: string;
6
+ }
7
+ export interface ApiKeyRaw {
8
+ apiKey: string;
9
+ secret: string;
10
+ passphrase: string;
11
+ }
12
+ export interface ReadonlyApiKeyResponse {
13
+ apiKey: string;
14
+ }
15
+ export interface L2HeaderArgs {
16
+ method: string;
17
+ requestPath: string;
18
+ body?: string;
19
+ }
20
+ export type SimpleHeaders = Record<string, string | number | boolean>;
21
+ export interface L1PolyHeader extends SimpleHeaders {
22
+ POLY_ADDRESS: string;
23
+ POLY_SIGNATURE: string;
24
+ POLY_TIMESTAMP: string;
25
+ POLY_NONCE: string;
26
+ }
27
+ export interface L2PolyHeader extends SimpleHeaders {
28
+ POLY_ADDRESS: string;
29
+ POLY_SIGNATURE: string;
30
+ POLY_TIMESTAMP: string;
31
+ POLY_API_KEY: string;
32
+ POLY_PASSPHRASE: string;
33
+ }
34
+ export interface L2WithBuilderHeader extends L2PolyHeader {
35
+ POLY_BUILDER_API_KEY: string;
36
+ POLY_BUILDER_TIMESTAMP: string;
37
+ POLY_BUILDER_PASSPHRASE: string;
38
+ POLY_BUILDER_SIGNATURE: string;
39
+ }
40
+ export declare enum Side {
41
+ BUY = "BUY",
42
+ SELL = "SELL"
43
+ }
44
+ export declare enum OrderType {
45
+ GTC = "GTC",
46
+ FOK = "FOK",
47
+ GTD = "GTD",
48
+ FAK = "FAK"
49
+ }
50
+ export interface PostOrdersArgs {
51
+ order: SignedOrder;
52
+ orderType: OrderType;
53
+ postOnly?: boolean;
54
+ }
55
+ export interface NewOrder<T extends OrderType> {
56
+ readonly order: {
57
+ readonly salt: number;
58
+ readonly maker: string;
59
+ readonly signer: string;
60
+ readonly taker: string;
61
+ readonly tokenId: string;
62
+ readonly makerAmount: string;
63
+ readonly takerAmount: string;
64
+ readonly expiration: string;
65
+ readonly nonce: string;
66
+ readonly feeRateBps: string;
67
+ readonly side: Side;
68
+ readonly signatureType: SignatureType;
69
+ readonly signature: string;
70
+ };
71
+ readonly owner: string;
72
+ readonly orderType: T;
73
+ readonly deferExec: boolean;
74
+ readonly postOnly?: boolean;
75
+ }
76
+ export interface UserOrder {
77
+ /**
78
+ * TokenID of the Conditional token asset being traded
79
+ */
80
+ tokenID: string;
81
+ /**
82
+ * Price used to create the order
83
+ */
84
+ price: number;
85
+ /**
86
+ * Size in terms of the ConditionalToken
87
+ */
88
+ size: number;
89
+ /**
90
+ * Side of the order
91
+ */
92
+ side: Side;
93
+ /**
94
+ * Fee rate, in basis points, charged to the order maker, charged on proceeds
95
+ */
96
+ feeRateBps?: number;
97
+ /**
98
+ * Nonce used for onchain cancellations
99
+ */
100
+ nonce?: number;
101
+ /**
102
+ * Timestamp after which the order is expired.
103
+ */
104
+ expiration?: number;
105
+ /**
106
+ * Address of the order taker. The zero address is used to indicate a public order
107
+ */
108
+ taker?: string;
109
+ }
110
+ export interface UserMarketOrder {
111
+ /**
112
+ * TokenID of the Conditional token asset being traded
113
+ */
114
+ tokenID: string;
115
+ /**
116
+ * Price used to create the order
117
+ * If it is not present the market price will be used.
118
+ */
119
+ price?: number;
120
+ /**
121
+ * BUY orders: $$$ Amount to buy
122
+ * SELL orders: Shares to sell
123
+ */
124
+ amount: number;
125
+ /**
126
+ * Side of the order
127
+ */
128
+ side: Side;
129
+ /**
130
+ * Fee rate, in basis points, charged to the order maker, charged on proceeds
131
+ */
132
+ feeRateBps?: number;
133
+ /**
134
+ * Nonce used for onchain cancellations
135
+ */
136
+ nonce?: number;
137
+ /**
138
+ * Address of the order taker. The zero address is used to indicate a public order
139
+ */
140
+ taker?: string;
141
+ /**
142
+ * Specifies the type of order execution:
143
+ * - FOK (Fill or Kill): The order must be filled entirely or not at all.
144
+ * - FAK (Fill and Kill): The order can be partially filled, and any unfilled portion is canceled.
145
+ */
146
+ orderType?: OrderType.FOK | OrderType.FAK;
147
+ }
148
+ export interface OrderPayload {
149
+ orderID: string;
150
+ }
151
+ export interface ApiKeysResponse {
152
+ apiKeys: ApiKeyCreds[];
153
+ }
154
+ export interface BanStatus {
155
+ closed_only: boolean;
156
+ }
157
+ export interface OrderResponse {
158
+ success: boolean;
159
+ errorMsg: string;
160
+ orderID: string;
161
+ transactionsHashes: string[];
162
+ status: string;
163
+ takingAmount: string;
164
+ makingAmount: string;
165
+ }
166
+ export interface OpenOrder {
167
+ id: string;
168
+ status: string;
169
+ owner: string;
170
+ maker_address: string;
171
+ market: string;
172
+ asset_id: string;
173
+ side: string;
174
+ original_size: string;
175
+ size_matched: string;
176
+ price: string;
177
+ associate_trades: string[];
178
+ outcome: string;
179
+ created_at: number;
180
+ expiration: string;
181
+ order_type: string;
182
+ }
183
+ export type OpenOrdersResponse = OpenOrder[];
184
+ export interface TradeParams {
185
+ id?: string;
186
+ maker_address?: string;
187
+ market?: string;
188
+ asset_id?: string;
189
+ before?: string;
190
+ after?: string;
191
+ }
192
+ export interface OpenOrderParams {
193
+ id?: string;
194
+ market?: string;
195
+ asset_id?: string;
196
+ }
197
+ export interface MakerOrder {
198
+ order_id: string;
199
+ owner: string;
200
+ maker_address: string;
201
+ matched_amount: string;
202
+ price: string;
203
+ fee_rate_bps: string;
204
+ asset_id: string;
205
+ outcome: string;
206
+ side: Side;
207
+ }
208
+ export interface Trade {
209
+ id: string;
210
+ taker_order_id: string;
211
+ market: string;
212
+ asset_id: string;
213
+ side: Side;
214
+ size: string;
215
+ fee_rate_bps: string;
216
+ price: string;
217
+ status: string;
218
+ match_time: string;
219
+ last_update: string;
220
+ outcome: string;
221
+ bucket_index: number;
222
+ owner: string;
223
+ maker_address: string;
224
+ maker_orders: MakerOrder[];
225
+ transaction_hash: string;
226
+ trader_side: "TAKER" | "MAKER";
227
+ }
228
+ export declare enum Chain {
229
+ POLYGON = 137,
230
+ AMOY = 80002
231
+ }
232
+ export interface MarketPrice {
233
+ t: number;
234
+ p: number;
235
+ }
236
+ export interface PriceHistoryFilterParams {
237
+ market?: string;
238
+ startTs?: number;
239
+ endTs?: number;
240
+ fidelity?: number;
241
+ interval?: PriceHistoryInterval;
242
+ }
243
+ export declare enum PriceHistoryInterval {
244
+ MAX = "max",
245
+ ONE_WEEK = "1w",
246
+ ONE_DAY = "1d",
247
+ SIX_HOURS = "6h",
248
+ ONE_HOUR = "1h"
249
+ }
250
+ export interface DropNotificationParams {
251
+ ids: string[];
252
+ }
253
+ export interface Notification {
254
+ type: number;
255
+ owner: string;
256
+ payload: any;
257
+ }
258
+ export interface OrderMarketCancelParams {
259
+ market?: string;
260
+ asset_id?: string;
261
+ }
262
+ export interface OrderBookSummary {
263
+ market: string;
264
+ asset_id: string;
265
+ timestamp: string;
266
+ bids: OrderSummary[];
267
+ asks: OrderSummary[];
268
+ min_order_size: string;
269
+ tick_size: string;
270
+ neg_risk: boolean;
271
+ last_trade_price: string;
272
+ hash: string;
273
+ }
274
+ export interface OrderSummary {
275
+ price: string;
276
+ size: string;
277
+ }
278
+ export declare enum AssetType {
279
+ COLLATERAL = "COLLATERAL",
280
+ CONDITIONAL = "CONDITIONAL"
281
+ }
282
+ export interface BalanceAllowanceParams {
283
+ asset_type: AssetType;
284
+ token_id?: string;
285
+ }
286
+ export interface BalanceAllowanceResponse {
287
+ balance: string;
288
+ allowance: string;
289
+ }
290
+ export interface OrderScoringParams {
291
+ order_id: string;
292
+ }
293
+ export interface OrderScoring {
294
+ scoring: boolean;
295
+ }
296
+ export interface OrdersScoringParams {
297
+ orderIds: string[];
298
+ }
299
+ export type OrdersScoring = {
300
+ [orderId in string]: boolean;
301
+ };
302
+ export type CreateOrderOptions = {
303
+ tickSize: TickSize;
304
+ negRisk?: boolean;
305
+ };
306
+ export type TickSize = "0.1" | "0.01" | "0.001" | "0.0001";
307
+ export interface RoundConfig {
308
+ readonly price: number;
309
+ readonly size: number;
310
+ readonly amount: number;
311
+ }
312
+ export interface TickSizes {
313
+ [tokenId: string]: TickSize;
314
+ }
315
+ export interface NegRisk {
316
+ [tokenId: string]: boolean;
317
+ }
318
+ export interface FeeRates {
319
+ [tokenId: string]: number;
320
+ }
321
+ export interface PaginationPayload {
322
+ readonly limit: number;
323
+ readonly count: number;
324
+ readonly next_cursor: string;
325
+ readonly data: any[];
326
+ }
327
+ export interface MarketTradeEvent {
328
+ event_type: string;
329
+ market: {
330
+ condition_id: string;
331
+ asset_id: string;
332
+ question: string;
333
+ icon: string;
334
+ slug: string;
335
+ };
336
+ user: {
337
+ address: string;
338
+ username: string;
339
+ profile_picture: string;
340
+ optimized_profile_picture: string;
341
+ pseudonym: string;
342
+ };
343
+ side: Side;
344
+ size: string;
345
+ fee_rate_bps: string;
346
+ price: string;
347
+ outcome: string;
348
+ outcome_index: number;
349
+ transaction_hash: string;
350
+ timestamp: string;
351
+ }
352
+ export interface BookParams {
353
+ token_id: string;
354
+ side: Side;
355
+ }
356
+ export interface UserEarning {
357
+ date: string;
358
+ condition_id: string;
359
+ asset_address: string;
360
+ maker_address: string;
361
+ earnings: number;
362
+ asset_rate: number;
363
+ }
364
+ export interface TotalUserEarning {
365
+ date: string;
366
+ asset_address: string;
367
+ maker_address: string;
368
+ earnings: number;
369
+ asset_rate: number;
370
+ }
371
+ export interface RewardsPercentages {
372
+ [market: string]: number;
373
+ }
374
+ export interface Token {
375
+ token_id: string;
376
+ outcome: string;
377
+ price: number;
378
+ }
379
+ export interface RewardsConfig {
380
+ asset_address: string;
381
+ start_date: string;
382
+ end_date: string;
383
+ rate_per_day: number;
384
+ total_rewards: number;
385
+ }
386
+ export interface MarketReward {
387
+ condition_id: string;
388
+ question: string;
389
+ market_slug: string;
390
+ event_slug: string;
391
+ image: string;
392
+ rewards_max_spread: number;
393
+ rewards_min_size: number;
394
+ tokens: Token[];
395
+ rewards_config: RewardsConfig[];
396
+ }
397
+ export interface Earning {
398
+ asset_address: string;
399
+ earnings: number;
400
+ asset_rate: number;
401
+ }
402
+ export interface BuilderApiKey {
403
+ key: string;
404
+ secret: string;
405
+ passphrase: string;
406
+ }
407
+ export interface BuilderApiKeyResponse {
408
+ key: string;
409
+ createdAt?: string;
410
+ revokedAt?: string;
411
+ }
412
+ export interface UserRewardsEarning {
413
+ condition_id: string;
414
+ question: string;
415
+ market_slug: string;
416
+ event_slug: string;
417
+ image: string;
418
+ rewards_max_spread: number;
419
+ rewards_min_size: number;
420
+ market_competitiveness: number;
421
+ tokens: Token[];
422
+ rewards_config: RewardsConfig[];
423
+ maker_address: string;
424
+ earning_percentage: number;
425
+ earnings: Earning[];
426
+ }
427
+ export interface BuilderTrade {
428
+ id: string;
429
+ tradeType: string;
430
+ takerOrderHash: string;
431
+ builder: string;
432
+ market: string;
433
+ assetId: string;
434
+ side: string;
435
+ size: string;
436
+ sizeUsdc: string;
437
+ price: string;
438
+ status: string;
439
+ outcome: string;
440
+ outcomeIndex: number;
441
+ owner: string;
442
+ maker: string;
443
+ transactionHash: string;
444
+ matchTime: string;
445
+ bucketIndex: number;
446
+ fee: string;
447
+ feeUsdc: string;
448
+ err_msg?: string | null;
449
+ createdAt: string | null;
450
+ updatedAt: string | null;
451
+ }
452
+ export interface CancelRfqRequestParams {
453
+ requestId: string;
454
+ }
455
+ export interface CreateRfqRequestParams {
456
+ assetIn: string;
457
+ assetOut: string;
458
+ amountIn: string;
459
+ amountOut: string;
460
+ userType: number;
461
+ }
462
+ export interface RfqQuoteParams {
463
+ requestId: string;
464
+ assetIn: string;
465
+ assetOut: string;
466
+ amountIn: string;
467
+ amountOut: string;
468
+ userType: number;
469
+ }
470
+ export interface CreateRfqQuoteParams {
471
+ requestId: string;
472
+ assetIn: string;
473
+ assetOut: string;
474
+ amountIn: string;
475
+ amountOut: string;
476
+ }
477
+ export interface CancelRfqQuoteParams {
478
+ quoteId: string;
479
+ }
480
+ export interface AcceptQuoteParams {
481
+ requestId: string;
482
+ quoteId: string;
483
+ expiration: number;
484
+ }
485
+ export interface ApproveOrderParams {
486
+ requestId: string;
487
+ quoteId: string;
488
+ expiration: number;
489
+ }
490
+ export type RfqListState = "active" | "inactive";
491
+ export type RfqSortDir = "asc" | "desc";
492
+ export type RfqRequestsSortBy = "price" | "expiry" | "size" | "created";
493
+ export type RfqQuotesSortBy = "price" | "expiry" | "created";
494
+ export interface GetRfqQuotesParams {
495
+ /**
496
+ * Pagination cursor, base64-encoded integer (default "MA==" → 0)
497
+ */
498
+ offset?: string;
499
+ /**
500
+ * Integer (default 50, max 100)
501
+ */
502
+ limit?: number;
503
+ /**
504
+ * Optional; active | inactive (if omitted: no state filter)
505
+ */
506
+ state?: RfqListState;
507
+ /**
508
+ * Repeatable (UUIDs; invalid UUIDs are dropped server-side)
509
+ */
510
+ quoteIds?: string[];
511
+ /**
512
+ * Repeatable (UUIDs; invalid UUIDs are dropped server-side)
513
+ */
514
+ requestIds?: string[];
515
+ /**
516
+ * Repeatable (condition ids; must be 0x + 64 hex)
517
+ */
518
+ markets?: string[];
519
+ /**
520
+ * float (token size)
521
+ */
522
+ sizeMin?: number;
523
+ /**
524
+ * float (token size)
525
+ */
526
+ sizeMax?: number;
527
+ /**
528
+ * float (USDC size)
529
+ */
530
+ sizeUsdcMin?: number;
531
+ /**
532
+ * float (USDC size)
533
+ */
534
+ sizeUsdcMax?: number;
535
+ priceMin?: number;
536
+ priceMax?: number;
537
+ /**
538
+ * price | expiry | created (default created)
539
+ */
540
+ sortBy?: RfqQuotesSortBy;
541
+ /**
542
+ * asc | desc (default asc)
543
+ */
544
+ sortDir?: RfqSortDir;
545
+ }
546
+ export interface GetRfqBestQuoteParams {
547
+ requestId?: string;
548
+ }
549
+ export type RfqUserOrder = Pick<UserOrder, "price" | "size" | "side" | "tokenID">;
550
+ export type RfqUserQuote = RfqUserOrder & {
551
+ requestId: string;
552
+ };
553
+ export interface GetRfqRequestsParams {
554
+ /**
555
+ * Pagination cursor, base64-encoded integer (default "MA==" → 0)
556
+ */
557
+ offset?: string;
558
+ /**
559
+ * Integer (default 50, max 100)
560
+ */
561
+ limit?: number;
562
+ /**
563
+ * Optional; active | inactive (if omitted: no state filter)
564
+ */
565
+ state?: RfqListState;
566
+ /**
567
+ * Repeatable (UUIDs; invalid UUIDs are dropped server-side)
568
+ */
569
+ requestIds?: string[];
570
+ /**
571
+ * Repeatable (condition ids; must be 0x + 64 hex)
572
+ */
573
+ markets?: string[];
574
+ /**
575
+ * float (token size)
576
+ */
577
+ sizeMin?: number;
578
+ /**
579
+ * float (token size)
580
+ */
581
+ sizeMax?: number;
582
+ /**
583
+ * float (USDC size)
584
+ */
585
+ sizeUsdcMin?: number;
586
+ /**
587
+ * float (USDC size)
588
+ */
589
+ sizeUsdcMax?: number;
590
+ priceMin?: number;
591
+ priceMax?: number;
592
+ /**
593
+ * price | expiry | size | created (default created)
594
+ */
595
+ sortBy?: RfqRequestsSortBy;
596
+ /**
597
+ * asc | desc (default asc)
598
+ */
599
+ sortDir?: RfqSortDir;
600
+ }
601
+ export interface RfqPaginatedResponse<T> {
602
+ readonly data: T[];
603
+ readonly next_cursor: string;
604
+ readonly limit: number;
605
+ readonly count: number;
606
+ readonly total_count?: number;
607
+ }
608
+ export interface RfqRequest {
609
+ readonly requestId: string;
610
+ readonly userAddress: string;
611
+ readonly proxyAddress: string;
612
+ readonly token: string;
613
+ readonly complement: string;
614
+ readonly condition: string;
615
+ readonly side: string;
616
+ readonly sizeIn: string;
617
+ readonly sizeOut: string;
618
+ readonly price: number;
619
+ readonly acceptedQuoteId: string;
620
+ readonly state: string;
621
+ readonly expiry: Date;
622
+ readonly createdAt: Date;
623
+ readonly updatedAt: Date;
624
+ }
625
+ export declare enum RfqMatchType {
626
+ COMPLEMENTARY = "COMPLEMENTARY",
627
+ MERGE = "MERGE",
628
+ MINT = "MINT"
629
+ }
630
+ export interface RfqQuote {
631
+ readonly quoteId: string;
632
+ readonly requestId: string;
633
+ readonly userAddress: string;
634
+ readonly proxyAddress: string;
635
+ readonly complement: string;
636
+ readonly condition: string;
637
+ readonly token: string;
638
+ readonly side: string;
639
+ readonly sizeIn: string;
640
+ readonly sizeOut: string;
641
+ readonly price: number;
642
+ readonly state: string;
643
+ readonly expiry: Date;
644
+ readonly matchType: string;
645
+ readonly createdAt: Date;
646
+ readonly updatedAt: Date;
647
+ }
648
+ export type RfqRequestsResponse = RfqPaginatedResponse<RfqRequest>;
649
+ export type RfqQuotesResponse = RfqPaginatedResponse<RfqQuote>;
650
+ export interface RfqRequestResponse {
651
+ readonly requestId: string;
652
+ readonly error?: string;
653
+ }
654
+ export interface RfqQuoteResponse {
655
+ readonly quoteId: string;
656
+ readonly error?: string;
657
+ }
658
+ export interface HeartbeatResponse {
659
+ readonly heartbeat_id: string;
660
+ readonly error?: string;
661
+ }
662
+ export interface RfqRequestOrderCreationPayload {
663
+ readonly token: string;
664
+ readonly side: Side;
665
+ readonly size: string;
666
+ readonly price: number;
667
+ }
package/dist/types.js ADDED
@@ -0,0 +1,37 @@
1
+ export var Side;
2
+ (function (Side) {
3
+ Side["BUY"] = "BUY";
4
+ Side["SELL"] = "SELL";
5
+ })(Side || (Side = {}));
6
+ export var OrderType;
7
+ (function (OrderType) {
8
+ OrderType["GTC"] = "GTC";
9
+ OrderType["FOK"] = "FOK";
10
+ OrderType["GTD"] = "GTD";
11
+ OrderType["FAK"] = "FAK";
12
+ })(OrderType || (OrderType = {}));
13
+ export var Chain;
14
+ (function (Chain) {
15
+ Chain[Chain["POLYGON"] = 137] = "POLYGON";
16
+ Chain[Chain["AMOY"] = 80002] = "AMOY";
17
+ })(Chain || (Chain = {}));
18
+ export var PriceHistoryInterval;
19
+ (function (PriceHistoryInterval) {
20
+ PriceHistoryInterval["MAX"] = "max";
21
+ PriceHistoryInterval["ONE_WEEK"] = "1w";
22
+ PriceHistoryInterval["ONE_DAY"] = "1d";
23
+ PriceHistoryInterval["SIX_HOURS"] = "6h";
24
+ PriceHistoryInterval["ONE_HOUR"] = "1h";
25
+ })(PriceHistoryInterval || (PriceHistoryInterval = {}));
26
+ export var AssetType;
27
+ (function (AssetType) {
28
+ AssetType["COLLATERAL"] = "COLLATERAL";
29
+ AssetType["CONDITIONAL"] = "CONDITIONAL";
30
+ })(AssetType || (AssetType = {}));
31
+ export var RfqMatchType;
32
+ (function (RfqMatchType) {
33
+ RfqMatchType["COMPLEMENTARY"] = "COMPLEMENTARY";
34
+ RfqMatchType["MERGE"] = "MERGE";
35
+ RfqMatchType["MINT"] = "MINT";
36
+ })(RfqMatchType || (RfqMatchType = {}));
37
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAoDA,MAAM,CAAN,IAAY,IAGX;AAHD,WAAY,IAAI;IACZ,mBAAW,CAAA;IACX,qBAAa,CAAA;AACjB,CAAC,EAHW,IAAI,KAAJ,IAAI,QAGf;AAED,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACjB,wBAAW,CAAA;IACX,wBAAW,CAAA;IACX,wBAAW,CAAA;IACX,wBAAW,CAAA;AACf,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB;AAoND,MAAM,CAAN,IAAY,KAGX;AAHD,WAAY,KAAK;IACb,yCAAa,CAAA;IACb,qCAAY,CAAA;AAChB,CAAC,EAHW,KAAK,KAAL,KAAK,QAGhB;AAeD,MAAM,CAAN,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC5B,mCAAW,CAAA;IACX,uCAAe,CAAA;IACf,sCAAc,CAAA;IACd,wCAAgB,CAAA;IAChB,uCAAe,CAAA;AACnB,CAAC,EANW,oBAAoB,KAApB,oBAAoB,QAM/B;AAoCD,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,sCAAyB,CAAA;IACzB,wCAA2B,CAAA;AAC/B,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAsYD,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACpB,+CAA+B,CAAA;IAC/B,+BAAe,CAAA;IACf,6BAAa,CAAA;AACjB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB"}
@@ -0,0 +1,16 @@
1
+ import type { SignedOrder } from "@polymarket/order-utils";
2
+ import { OrderType } from "./types.ts";
3
+ import type { NewOrder, OrderBookSummary, TickSize } from "./types.ts";
4
+ export declare function orderToJson<T extends OrderType>(order: SignedOrder, owner: string, orderType: T, deferExec?: boolean, postOnly?: boolean): NewOrder<T>;
5
+ export declare const roundNormal: (num: number, decimals: number) => number;
6
+ export declare const roundDown: (num: number, decimals: number) => number;
7
+ export declare const roundUp: (num: number, decimals: number) => number;
8
+ export declare const decimalPlaces: (num: number) => number;
9
+ /**
10
+ * Calculates the hash for the given orderbook
11
+ * @param orderbook
12
+ * @returns
13
+ */
14
+ export declare const generateOrderBookSummaryHash: (orderbook: OrderBookSummary) => Promise<string>;
15
+ export declare const isTickSizeSmaller: (a: TickSize, b: TickSize) => boolean;
16
+ export declare const priceValid: (price: number, tickSize: TickSize) => boolean;