@polymarket/clob-client-v2 1.0.4 → 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 -2600
  46. package/dist/index.d.cts +15 -1039
  47. package/dist/index.d.ts +17 -1039
  48. package/dist/index.js +15 -2543
  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,69 @@
1
+ import { EIP712Object } from "./eip712.js";
2
+ import { OrderSignature } from "./order.js";
3
+ import { Side } from "./side.js";
4
+ import "../../types/index.js";
5
+ import { SignatureTypeV1 } from "./signatureTypeV1.js";
6
+
7
+ //#region src/order-utils/model/orderDataV1.d.ts
8
+
9
+ interface OrderV1 extends EIP712Object {
10
+ /**
11
+ * Unique salt to ensure entropy
12
+ */
13
+ readonly salt: string;
14
+ /**
15
+ * Maker of the order, i.e the source of funds for the order
16
+ */
17
+ readonly maker: string;
18
+ /**
19
+ * Signer of the order
20
+ */
21
+ readonly signer: string;
22
+ /**
23
+ * Address of the order taker. The zero address is used to indicate a public order
24
+ */
25
+ readonly taker: string;
26
+ /**
27
+ * Token Id of the CTF ERC1155 asset to be bought or sold.
28
+ * If BUY, this is the tokenId of the asset to be bought, i.e the makerAssetId
29
+ * If SELL, this is the tokenId of the asset to be sold, i.e the takerAssetId
30
+ */
31
+ readonly tokenId: string;
32
+ /**
33
+ * Maker amount, i.e the max amount of tokens to be sold
34
+ */
35
+ readonly makerAmount: string;
36
+ /**
37
+ * Taker amount, i.e the minimum amount of tokens to be received
38
+ */
39
+ readonly takerAmount: string;
40
+ /**
41
+ * Timestamp after which the order is expired
42
+ */
43
+ readonly expiration: string;
44
+ /**
45
+ * Nonce used for onchain cancellations
46
+ */
47
+ readonly nonce: string;
48
+ /**
49
+ * Fee rate, in basis points, charged to the order maker, charged on proceeds
50
+ */
51
+ readonly feeRateBps: string;
52
+ /**
53
+ * The side of the order, BUY or SELL
54
+ */
55
+ readonly side: Side;
56
+ /**
57
+ * Signature type used by the Order
58
+ */
59
+ readonly signatureType: SignatureTypeV1;
60
+ }
61
+ interface SignedOrderV1 extends OrderV1 {
62
+ /**
63
+ * The order signature
64
+ */
65
+ readonly signature: OrderSignature;
66
+ }
67
+ //#endregion
68
+ export { OrderV1, SignedOrderV1 };
69
+ //# sourceMappingURL=orderDataV1.d.ts.map
@@ -0,0 +1,68 @@
1
+ import { EIP712Object } from "./eip712.cjs";
2
+ import { OrderSignature } from "./order.cjs";
3
+ import { Side } from "./side.cjs";
4
+ import { SignatureTypeV2 } from "./signatureTypeV2.cjs";
5
+
6
+ //#region src/order-utils/model/orderDataV2.d.ts
7
+
8
+ interface OrderV2 extends EIP712Object {
9
+ /**
10
+ * Unique salt to ensure entropy
11
+ */
12
+ readonly salt: string;
13
+ /**
14
+ * Maker of the order, i.e the source of funds for the order
15
+ */
16
+ readonly maker: string;
17
+ /**
18
+ * Signer of the order
19
+ */
20
+ readonly signer: string;
21
+ /**
22
+ * Token Id of the CTF ERC1155 asset to be bought or sold.
23
+ * If BUY, this is the tokenId of the asset to be bought, i.e the makerAssetId
24
+ * If SELL, this is the tokenId of the asset to be sold, i.e the takerAssetId
25
+ */
26
+ readonly tokenId: string;
27
+ /**
28
+ * Maker amount, i.e the max amount of tokens to be sold
29
+ */
30
+ readonly makerAmount: string;
31
+ /**
32
+ * Taker amount, i.e the minimum amount of tokens to be received
33
+ */
34
+ readonly takerAmount: string;
35
+ /**
36
+ * The side of the order, BUY or SELL
37
+ */
38
+ readonly side: Side;
39
+ /**
40
+ * Signature type used by the Order
41
+ */
42
+ readonly signatureType: SignatureTypeV2;
43
+ /**
44
+ * Timestamp of the order
45
+ */
46
+ readonly timestamp: string;
47
+ /**
48
+ * Metadata of the order
49
+ */
50
+ readonly metadata: string;
51
+ /**
52
+ * Builder of the order
53
+ */
54
+ readonly builder: string;
55
+ /**
56
+ * Expiration timestamp of the order (unix seconds, "0" = no expiration)
57
+ */
58
+ readonly expiration: string;
59
+ }
60
+ interface SignedOrderV2 extends OrderV2 {
61
+ /**
62
+ * The order signature
63
+ */
64
+ readonly signature: OrderSignature;
65
+ }
66
+ //#endregion
67
+ export { SignedOrderV2 };
68
+ //# sourceMappingURL=orderDataV2.d.cts.map
@@ -0,0 +1,69 @@
1
+ import { EIP712Object } from "./eip712.js";
2
+ import { OrderSignature } from "./order.js";
3
+ import { Side } from "./side.js";
4
+ import "../../types/index.js";
5
+ import { SignatureTypeV2 } from "./signatureTypeV2.js";
6
+
7
+ //#region src/order-utils/model/orderDataV2.d.ts
8
+
9
+ interface OrderV2 extends EIP712Object {
10
+ /**
11
+ * Unique salt to ensure entropy
12
+ */
13
+ readonly salt: string;
14
+ /**
15
+ * Maker of the order, i.e the source of funds for the order
16
+ */
17
+ readonly maker: string;
18
+ /**
19
+ * Signer of the order
20
+ */
21
+ readonly signer: string;
22
+ /**
23
+ * Token Id of the CTF ERC1155 asset to be bought or sold.
24
+ * If BUY, this is the tokenId of the asset to be bought, i.e the makerAssetId
25
+ * If SELL, this is the tokenId of the asset to be sold, i.e the takerAssetId
26
+ */
27
+ readonly tokenId: string;
28
+ /**
29
+ * Maker amount, i.e the max amount of tokens to be sold
30
+ */
31
+ readonly makerAmount: string;
32
+ /**
33
+ * Taker amount, i.e the minimum amount of tokens to be received
34
+ */
35
+ readonly takerAmount: string;
36
+ /**
37
+ * The side of the order, BUY or SELL
38
+ */
39
+ readonly side: Side;
40
+ /**
41
+ * Signature type used by the Order
42
+ */
43
+ readonly signatureType: SignatureTypeV2;
44
+ /**
45
+ * Timestamp of the order
46
+ */
47
+ readonly timestamp: string;
48
+ /**
49
+ * Metadata of the order
50
+ */
51
+ readonly metadata: string;
52
+ /**
53
+ * Builder of the order
54
+ */
55
+ readonly builder: string;
56
+ /**
57
+ * Expiration timestamp of the order (unix seconds, "0" = no expiration)
58
+ */
59
+ readonly expiration: string;
60
+ }
61
+ interface SignedOrderV2 extends OrderV2 {
62
+ /**
63
+ * The order signature
64
+ */
65
+ readonly signature: OrderSignature;
66
+ }
67
+ //#endregion
68
+ export { OrderV2, SignedOrderV2 };
69
+ //# sourceMappingURL=orderDataV2.d.ts.map
@@ -0,0 +1,11 @@
1
+
2
+ //#region src/order-utils/model/side.ts
3
+ let Side = /* @__PURE__ */ function(Side$1) {
4
+ Side$1["BUY"] = "BUY";
5
+ Side$1["SELL"] = "SELL";
6
+ return Side$1;
7
+ }({});
8
+
9
+ //#endregion
10
+ exports.Side = Side;
11
+ //# sourceMappingURL=side.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"side.cjs","names":[],"sources":["../../../src/order-utils/model/side.ts"],"sourcesContent":["export enum Side {\n\tBUY = \"BUY\",\n\tSELL = \"SELL\",\n}\n"],"mappings":";;AAAA,IAAY,wCAAL;AACN;AACA"}
@@ -0,0 +1,8 @@
1
+ //#region src/order-utils/model/side.d.ts
2
+ declare enum Side {
3
+ BUY = "BUY",
4
+ SELL = "SELL",
5
+ }
6
+ //#endregion
7
+ export { Side };
8
+ //# sourceMappingURL=side.d.cts.map
@@ -0,0 +1,8 @@
1
+ //#region src/order-utils/model/side.d.ts
2
+ declare enum Side {
3
+ BUY = "BUY",
4
+ SELL = "SELL",
5
+ }
6
+ //#endregion
7
+ export { Side };
8
+ //# sourceMappingURL=side.d.ts.map
@@ -0,0 +1,10 @@
1
+ //#region src/order-utils/model/side.ts
2
+ let Side = /* @__PURE__ */ function(Side$1) {
3
+ Side$1["BUY"] = "BUY";
4
+ Side$1["SELL"] = "SELL";
5
+ return Side$1;
6
+ }({});
7
+
8
+ //#endregion
9
+ export { Side };
10
+ //# sourceMappingURL=side.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"side.js","names":[],"sources":["../../../src/order-utils/model/side.ts"],"sourcesContent":["export enum Side {\n\tBUY = \"BUY\",\n\tSELL = \"SELL\",\n}\n"],"mappings":";AAAA,IAAY,wCAAL;AACN;AACA"}
@@ -0,0 +1,21 @@
1
+
2
+ //#region src/order-utils/model/signatureTypeV1.ts
3
+ let SignatureTypeV1 = /* @__PURE__ */ function(SignatureTypeV1$1) {
4
+ /**
5
+ * ECDSA EIP712 signatures signed by EOAs
6
+ */
7
+ SignatureTypeV1$1[SignatureTypeV1$1["EOA"] = 0] = "EOA";
8
+ /**
9
+ * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
10
+ */
11
+ SignatureTypeV1$1[SignatureTypeV1$1["POLY_PROXY"] = 1] = "POLY_PROXY";
12
+ /**
13
+ * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
14
+ */
15
+ SignatureTypeV1$1[SignatureTypeV1$1["POLY_GNOSIS_SAFE"] = 2] = "POLY_GNOSIS_SAFE";
16
+ return SignatureTypeV1$1;
17
+ }({});
18
+
19
+ //#endregion
20
+ exports.SignatureTypeV1 = SignatureTypeV1;
21
+ //# sourceMappingURL=signatureTypeV1.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signatureTypeV1.cjs","names":[],"sources":["../../../src/order-utils/model/signatureTypeV1.ts"],"sourcesContent":["export enum SignatureTypeV1 {\n\t/**\n\t * ECDSA EIP712 signatures signed by EOAs\n\t */\n\tEOA = 0,\n\n\t/**\n\t * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets\n\t */\n\tPOLY_PROXY = 1,\n\n\t/**\n\t * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes\n\t */\n\tPOLY_GNOSIS_SAFE = 2,\n}\n"],"mappings":";;AAAA,IAAY,8DAAL;;;;AAIN;;;;AAKA;;;;AAKA"}
@@ -0,0 +1,18 @@
1
+ //#region src/order-utils/model/signatureTypeV1.d.ts
2
+ declare enum SignatureTypeV1 {
3
+ /**
4
+ * ECDSA EIP712 signatures signed by EOAs
5
+ */
6
+ EOA = 0,
7
+ /**
8
+ * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
9
+ */
10
+ POLY_PROXY = 1,
11
+ /**
12
+ * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
13
+ */
14
+ POLY_GNOSIS_SAFE = 2,
15
+ }
16
+ //#endregion
17
+ export { SignatureTypeV1 };
18
+ //# sourceMappingURL=signatureTypeV1.d.cts.map
@@ -0,0 +1,18 @@
1
+ //#region src/order-utils/model/signatureTypeV1.d.ts
2
+ declare enum SignatureTypeV1 {
3
+ /**
4
+ * ECDSA EIP712 signatures signed by EOAs
5
+ */
6
+ EOA = 0,
7
+ /**
8
+ * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
9
+ */
10
+ POLY_PROXY = 1,
11
+ /**
12
+ * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
13
+ */
14
+ POLY_GNOSIS_SAFE = 2,
15
+ }
16
+ //#endregion
17
+ export { SignatureTypeV1 };
18
+ //# sourceMappingURL=signatureTypeV1.d.ts.map
@@ -0,0 +1,20 @@
1
+ //#region src/order-utils/model/signatureTypeV1.ts
2
+ let SignatureTypeV1 = /* @__PURE__ */ function(SignatureTypeV1$1) {
3
+ /**
4
+ * ECDSA EIP712 signatures signed by EOAs
5
+ */
6
+ SignatureTypeV1$1[SignatureTypeV1$1["EOA"] = 0] = "EOA";
7
+ /**
8
+ * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
9
+ */
10
+ SignatureTypeV1$1[SignatureTypeV1$1["POLY_PROXY"] = 1] = "POLY_PROXY";
11
+ /**
12
+ * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
13
+ */
14
+ SignatureTypeV1$1[SignatureTypeV1$1["POLY_GNOSIS_SAFE"] = 2] = "POLY_GNOSIS_SAFE";
15
+ return SignatureTypeV1$1;
16
+ }({});
17
+
18
+ //#endregion
19
+ export { SignatureTypeV1 };
20
+ //# sourceMappingURL=signatureTypeV1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signatureTypeV1.js","names":[],"sources":["../../../src/order-utils/model/signatureTypeV1.ts"],"sourcesContent":["export enum SignatureTypeV1 {\n\t/**\n\t * ECDSA EIP712 signatures signed by EOAs\n\t */\n\tEOA = 0,\n\n\t/**\n\t * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets\n\t */\n\tPOLY_PROXY = 1,\n\n\t/**\n\t * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes\n\t */\n\tPOLY_GNOSIS_SAFE = 2,\n}\n"],"mappings":";AAAA,IAAY,8DAAL;;;;AAIN;;;;AAKA;;;;AAKA"}
@@ -0,0 +1,25 @@
1
+
2
+ //#region src/order-utils/model/signatureTypeV2.ts
3
+ let SignatureTypeV2 = /* @__PURE__ */ function(SignatureTypeV2$1) {
4
+ /**
5
+ * ECDSA EIP712 signatures signed by EOAs
6
+ */
7
+ SignatureTypeV2$1[SignatureTypeV2$1["EOA"] = 0] = "EOA";
8
+ /**
9
+ * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
10
+ */
11
+ SignatureTypeV2$1[SignatureTypeV2$1["POLY_PROXY"] = 1] = "POLY_PROXY";
12
+ /**
13
+ * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
14
+ */
15
+ SignatureTypeV2$1[SignatureTypeV2$1["POLY_GNOSIS_SAFE"] = 2] = "POLY_GNOSIS_SAFE";
16
+ /**
17
+ * EIP1271 signatures signed by smart contracts. To be used by smart contract wallets or vaults
18
+ */
19
+ SignatureTypeV2$1[SignatureTypeV2$1["POLY_1271"] = 3] = "POLY_1271";
20
+ return SignatureTypeV2$1;
21
+ }({});
22
+
23
+ //#endregion
24
+ exports.SignatureTypeV2 = SignatureTypeV2;
25
+ //# sourceMappingURL=signatureTypeV2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signatureTypeV2.cjs","names":[],"sources":["../../../src/order-utils/model/signatureTypeV2.ts"],"sourcesContent":["export enum SignatureTypeV2 {\n\t/**\n\t * ECDSA EIP712 signatures signed by EOAs\n\t */\n\tEOA = 0,\n\n\t/**\n\t * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets\n\t */\n\tPOLY_PROXY = 1,\n\n\t/**\n\t * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes\n\t */\n\tPOLY_GNOSIS_SAFE = 2,\n\n\t/**\n\t * EIP1271 signatures signed by smart contracts. To be used by smart contract wallets or vaults\n\t */\n\tPOLY_1271 = 3,\n}\n"],"mappings":";;AAAA,IAAY,8DAAL;;;;AAIN;;;;AAKA;;;;AAKA;;;;AAKA"}
@@ -0,0 +1,22 @@
1
+ //#region src/order-utils/model/signatureTypeV2.d.ts
2
+ declare enum SignatureTypeV2 {
3
+ /**
4
+ * ECDSA EIP712 signatures signed by EOAs
5
+ */
6
+ EOA = 0,
7
+ /**
8
+ * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
9
+ */
10
+ POLY_PROXY = 1,
11
+ /**
12
+ * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
13
+ */
14
+ POLY_GNOSIS_SAFE = 2,
15
+ /**
16
+ * EIP1271 signatures signed by smart contracts. To be used by smart contract wallets or vaults
17
+ */
18
+ POLY_1271 = 3,
19
+ }
20
+ //#endregion
21
+ export { SignatureTypeV2 };
22
+ //# sourceMappingURL=signatureTypeV2.d.cts.map
@@ -0,0 +1,22 @@
1
+ //#region src/order-utils/model/signatureTypeV2.d.ts
2
+ declare enum SignatureTypeV2 {
3
+ /**
4
+ * ECDSA EIP712 signatures signed by EOAs
5
+ */
6
+ EOA = 0,
7
+ /**
8
+ * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
9
+ */
10
+ POLY_PROXY = 1,
11
+ /**
12
+ * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
13
+ */
14
+ POLY_GNOSIS_SAFE = 2,
15
+ /**
16
+ * EIP1271 signatures signed by smart contracts. To be used by smart contract wallets or vaults
17
+ */
18
+ POLY_1271 = 3,
19
+ }
20
+ //#endregion
21
+ export { SignatureTypeV2 };
22
+ //# sourceMappingURL=signatureTypeV2.d.ts.map
@@ -0,0 +1,24 @@
1
+ //#region src/order-utils/model/signatureTypeV2.ts
2
+ let SignatureTypeV2 = /* @__PURE__ */ function(SignatureTypeV2$1) {
3
+ /**
4
+ * ECDSA EIP712 signatures signed by EOAs
5
+ */
6
+ SignatureTypeV2$1[SignatureTypeV2$1["EOA"] = 0] = "EOA";
7
+ /**
8
+ * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
9
+ */
10
+ SignatureTypeV2$1[SignatureTypeV2$1["POLY_PROXY"] = 1] = "POLY_PROXY";
11
+ /**
12
+ * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
13
+ */
14
+ SignatureTypeV2$1[SignatureTypeV2$1["POLY_GNOSIS_SAFE"] = 2] = "POLY_GNOSIS_SAFE";
15
+ /**
16
+ * EIP1271 signatures signed by smart contracts. To be used by smart contract wallets or vaults
17
+ */
18
+ SignatureTypeV2$1[SignatureTypeV2$1["POLY_1271"] = 3] = "POLY_1271";
19
+ return SignatureTypeV2$1;
20
+ }({});
21
+
22
+ //#endregion
23
+ export { SignatureTypeV2 };
24
+ //# sourceMappingURL=signatureTypeV2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signatureTypeV2.js","names":[],"sources":["../../../src/order-utils/model/signatureTypeV2.ts"],"sourcesContent":["export enum SignatureTypeV2 {\n\t/**\n\t * ECDSA EIP712 signatures signed by EOAs\n\t */\n\tEOA = 0,\n\n\t/**\n\t * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets\n\t */\n\tPOLY_PROXY = 1,\n\n\t/**\n\t * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes\n\t */\n\tPOLY_GNOSIS_SAFE = 2,\n\n\t/**\n\t * EIP1271 signatures signed by smart contracts. To be used by smart contract wallets or vaults\n\t */\n\tPOLY_1271 = 3,\n}\n"],"mappings":";AAAA,IAAY,8DAAL;;;;AAIN;;;;AAKA;;;;AAKA;;;;AAKA"}
@@ -0,0 +1,9 @@
1
+
2
+ //#region src/order-utils/utils.ts
3
+ function generateOrderSalt() {
4
+ return `${Math.round(Math.random() * Date.now())}`;
5
+ }
6
+
7
+ //#endregion
8
+ exports.generateOrderSalt = generateOrderSalt;
9
+ //# sourceMappingURL=utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs","names":[],"sources":["../../src/order-utils/utils.ts"],"sourcesContent":["export function generateOrderSalt(): string {\n\treturn `${Math.round(Math.random() * Date.now())}`;\n}\n"],"mappings":";;AAAA,SAAgB,oBAA4B;AAC3C,QAAO,GAAG,KAAK,MAAM,KAAK,QAAQ,GAAG,KAAK,KAAK,CAAC"}
@@ -0,0 +1,8 @@
1
+ //#region src/order-utils/utils.ts
2
+ function generateOrderSalt() {
3
+ return `${Math.round(Math.random() * Date.now())}`;
4
+ }
5
+
6
+ //#endregion
7
+ export { generateOrderSalt };
8
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../src/order-utils/utils.ts"],"sourcesContent":["export function generateOrderSalt(): string {\n\treturn `${Math.round(Math.random() * Date.now())}`;\n}\n"],"mappings":";AAAA,SAAgB,oBAA4B;AAC3C,QAAO,GAAG,KAAK,MAAM,KAAK,QAAQ,GAAG,KAAK,KAAK,CAAC"}
@@ -0,0 +1,7 @@
1
+
2
+ //#region src/signing/constants.ts
3
+ const MSG_TO_SIGN = "This message attests that I control the given wallet";
4
+
5
+ //#endregion
6
+ exports.MSG_TO_SIGN = MSG_TO_SIGN;
7
+ //# sourceMappingURL=constants.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.cjs","names":[],"sources":["../../src/signing/constants.ts"],"sourcesContent":["export const CLOB_DOMAIN_NAME = \"ClobAuthDomain\";\nexport const CLOB_VERSION = \"1\";\nexport const MSG_TO_SIGN = \"This message attests that I control the given wallet\";\n\nexport const CLOB_DOMAIN = {\n\tname: CLOB_DOMAIN_NAME,\n\tversion: CLOB_VERSION,\n\tchainId: 1,\n};\n\nexport const CLOB_TYPES = {\n\tClobAuth: [\n\t\t{ name: \"address\", type: \"address\" },\n\t\t{ name: \"timestamp\", type: \"string\" },\n\t\t{ name: \"message\", type: \"string\" },\n\t],\n};\n"],"mappings":";;AAEA,MAAa,cAAc"}
@@ -0,0 +1,6 @@
1
+ //#region src/signing/constants.ts
2
+ const MSG_TO_SIGN = "This message attests that I control the given wallet";
3
+
4
+ //#endregion
5
+ export { MSG_TO_SIGN };
6
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","names":[],"sources":["../../src/signing/constants.ts"],"sourcesContent":["export const CLOB_DOMAIN_NAME = \"ClobAuthDomain\";\nexport const CLOB_VERSION = \"1\";\nexport const MSG_TO_SIGN = \"This message attests that I control the given wallet\";\n\nexport const CLOB_DOMAIN = {\n\tname: CLOB_DOMAIN_NAME,\n\tversion: CLOB_VERSION,\n\tchainId: 1,\n};\n\nexport const CLOB_TYPES = {\n\tClobAuth: [\n\t\t{ name: \"address\", type: \"address\" },\n\t\t{ name: \"timestamp\", type: \"string\" },\n\t\t{ name: \"message\", type: \"string\" },\n\t],\n};\n"],"mappings":";AAEA,MAAa,cAAc"}
@@ -0,0 +1,51 @@
1
+ const require_constants = require('./constants.cjs');
2
+ const require_signer = require('./signer.cjs');
3
+
4
+ //#region src/signing/eip712.ts
5
+ /**
6
+ * Builds the canonical Polymarket CLOB EIP712 signature
7
+ * @param signer
8
+ * @param ts
9
+ * @returns string
10
+ */
11
+ const buildClobEip712Signature = async (signer, chainId, timestamp, nonce, address) => {
12
+ const resolvedAddress = address ?? await require_signer.getSignerAddress(signer);
13
+ const ts = timestamp.toString();
14
+ return await require_signer.signTypedDataWithSigner({
15
+ signer,
16
+ domain: {
17
+ name: "ClobAuthDomain",
18
+ version: "1",
19
+ chainId
20
+ },
21
+ types: { ClobAuth: [
22
+ {
23
+ name: "address",
24
+ type: "address"
25
+ },
26
+ {
27
+ name: "timestamp",
28
+ type: "string"
29
+ },
30
+ {
31
+ name: "nonce",
32
+ type: "uint256"
33
+ },
34
+ {
35
+ name: "message",
36
+ type: "string"
37
+ }
38
+ ] },
39
+ value: {
40
+ address: resolvedAddress,
41
+ timestamp: ts,
42
+ nonce,
43
+ message: require_constants.MSG_TO_SIGN
44
+ },
45
+ primaryType: "ClobAuth"
46
+ });
47
+ };
48
+
49
+ //#endregion
50
+ exports.buildClobEip712Signature = buildClobEip712Signature;
51
+ //# sourceMappingURL=eip712.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eip712.cjs","names":["getSignerAddress","signTypedDataWithSigner","MSG_TO_SIGN"],"sources":["../../src/signing/eip712.ts"],"sourcesContent":["import type { Chain } from \"../types/index.js\";\n\nimport { MSG_TO_SIGN } from \"./constants.js\";\nimport { type ClobSigner, getSignerAddress, signTypedDataWithSigner } from \"./signer.js\";\n\n/**\n * Builds the canonical Polymarket CLOB EIP712 signature\n * @param signer\n * @param ts\n * @returns string\n */\nexport const buildClobEip712Signature = async (\n\tsigner: ClobSigner,\n\tchainId: Chain,\n\ttimestamp: number,\n\tnonce: number,\n\taddress?: string,\n): Promise<string> => {\n\tconst resolvedAddress = address ?? (await getSignerAddress(signer));\n\tconst ts = timestamp.toString();\n\n\tconst domain = {\n\t\tname: \"ClobAuthDomain\",\n\t\tversion: \"1\",\n\t\tchainId: chainId,\n\t};\n\n\tconst types = {\n\t\tClobAuth: [\n\t\t\t{ name: \"address\", type: \"address\" },\n\t\t\t{ name: \"timestamp\", type: \"string\" },\n\t\t\t{ name: \"nonce\", type: \"uint256\" },\n\t\t\t{ name: \"message\", type: \"string\" },\n\t\t],\n\t};\n\tconst value = {\n\t\taddress: resolvedAddress,\n\t\ttimestamp: ts,\n\t\tnonce,\n\t\tmessage: MSG_TO_SIGN,\n\t};\n\tconst sig = await signTypedDataWithSigner({\n\t\tsigner,\n\t\tdomain,\n\t\ttypes,\n\t\tvalue,\n\t\tprimaryType: \"ClobAuth\",\n\t});\n\treturn sig;\n};\n"],"mappings":";;;;;;;;;;AAWA,MAAa,2BAA2B,OACvC,QACA,SACA,WACA,OACA,YACqB;CACrB,MAAM,kBAAkB,WAAY,MAAMA,gCAAiB,OAAO;CAClE,MAAM,KAAK,UAAU,UAAU;AA6B/B,QAPY,MAAMC,uCAAwB;EACzC;EACA,QAtBc;GACd,MAAM;GACN,SAAS;GACA;GACT;EAmBA,OAjBa,EACb,UAAU;GACT;IAAE,MAAM;IAAW,MAAM;IAAW;GACpC;IAAE,MAAM;IAAa,MAAM;IAAU;GACrC;IAAE,MAAM;IAAS,MAAM;IAAW;GAClC;IAAE,MAAM;IAAW,MAAM;IAAU;GACnC,EACD;EAWA,OAVa;GACb,SAAS;GACT,WAAW;GACX;GACA,SAASC;GACT;EAMA,aAAa;EACb,CAAC"}
@@ -0,0 +1,2 @@
1
+ import "./signer.js";
2
+ import "../types/index.js";
@@ -0,0 +1,51 @@
1
+ import { MSG_TO_SIGN } from "./constants.js";
2
+ import { getSignerAddress, signTypedDataWithSigner } from "./signer.js";
3
+
4
+ //#region src/signing/eip712.ts
5
+ /**
6
+ * Builds the canonical Polymarket CLOB EIP712 signature
7
+ * @param signer
8
+ * @param ts
9
+ * @returns string
10
+ */
11
+ const buildClobEip712Signature = async (signer, chainId, timestamp, nonce, address) => {
12
+ const resolvedAddress = address ?? await getSignerAddress(signer);
13
+ const ts = timestamp.toString();
14
+ return await signTypedDataWithSigner({
15
+ signer,
16
+ domain: {
17
+ name: "ClobAuthDomain",
18
+ version: "1",
19
+ chainId
20
+ },
21
+ types: { ClobAuth: [
22
+ {
23
+ name: "address",
24
+ type: "address"
25
+ },
26
+ {
27
+ name: "timestamp",
28
+ type: "string"
29
+ },
30
+ {
31
+ name: "nonce",
32
+ type: "uint256"
33
+ },
34
+ {
35
+ name: "message",
36
+ type: "string"
37
+ }
38
+ ] },
39
+ value: {
40
+ address: resolvedAddress,
41
+ timestamp: ts,
42
+ nonce,
43
+ message: MSG_TO_SIGN
44
+ },
45
+ primaryType: "ClobAuth"
46
+ });
47
+ };
48
+
49
+ //#endregion
50
+ export { buildClobEip712Signature };
51
+ //# sourceMappingURL=eip712.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eip712.js","names":[],"sources":["../../src/signing/eip712.ts"],"sourcesContent":["import type { Chain } from \"../types/index.js\";\n\nimport { MSG_TO_SIGN } from \"./constants.js\";\nimport { type ClobSigner, getSignerAddress, signTypedDataWithSigner } from \"./signer.js\";\n\n/**\n * Builds the canonical Polymarket CLOB EIP712 signature\n * @param signer\n * @param ts\n * @returns string\n */\nexport const buildClobEip712Signature = async (\n\tsigner: ClobSigner,\n\tchainId: Chain,\n\ttimestamp: number,\n\tnonce: number,\n\taddress?: string,\n): Promise<string> => {\n\tconst resolvedAddress = address ?? (await getSignerAddress(signer));\n\tconst ts = timestamp.toString();\n\n\tconst domain = {\n\t\tname: \"ClobAuthDomain\",\n\t\tversion: \"1\",\n\t\tchainId: chainId,\n\t};\n\n\tconst types = {\n\t\tClobAuth: [\n\t\t\t{ name: \"address\", type: \"address\" },\n\t\t\t{ name: \"timestamp\", type: \"string\" },\n\t\t\t{ name: \"nonce\", type: \"uint256\" },\n\t\t\t{ name: \"message\", type: \"string\" },\n\t\t],\n\t};\n\tconst value = {\n\t\taddress: resolvedAddress,\n\t\ttimestamp: ts,\n\t\tnonce,\n\t\tmessage: MSG_TO_SIGN,\n\t};\n\tconst sig = await signTypedDataWithSigner({\n\t\tsigner,\n\t\tdomain,\n\t\ttypes,\n\t\tvalue,\n\t\tprimaryType: \"ClobAuth\",\n\t});\n\treturn sig;\n};\n"],"mappings":";;;;;;;;;;AAWA,MAAa,2BAA2B,OACvC,QACA,SACA,WACA,OACA,YACqB;CACrB,MAAM,kBAAkB,WAAY,MAAM,iBAAiB,OAAO;CAClE,MAAM,KAAK,UAAU,UAAU;AA6B/B,QAPY,MAAM,wBAAwB;EACzC;EACA,QAtBc;GACd,MAAM;GACN,SAAS;GACA;GACT;EAmBA,OAjBa,EACb,UAAU;GACT;IAAE,MAAM;IAAW,MAAM;IAAW;GACpC;IAAE,MAAM;IAAa,MAAM;IAAU;GACrC;IAAE,MAAM;IAAS,MAAM;IAAW;GAClC;IAAE,MAAM;IAAW,MAAM;IAAU;GACnC,EACD;EAWA,OAVa;GACb,SAAS;GACT,WAAW;GACX;GACA,SAAS;GACT;EAMA,aAAa;EACb,CAAC"}