@polymarket/clob-client-v2 0.2.7 → 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 -7
  5. package/dist/index.js +2437 -7
  6. package/dist/index.js.map +1 -1
  7. package/package.json +12 -5
  8. package/dist/client.d.ts +0 -134
  9. package/dist/client.js +0 -942
  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 -2
  21. package/dist/errors.js +0 -3
  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 -6
  30. package/dist/order-builder/helpers/buildMarketOrderCreationArgs.js +0 -25
  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 -6
  36. package/dist/order-builder/helpers/buildOrderCreationArgs.js +0 -26
  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 -36
  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 -36
  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 -395
  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
@@ -1,13 +0,0 @@
1
- export * from "./exchangeOrderBuilderV1.js";
2
- export * from "./exchangeOrderBuilderV2.js";
3
- // export * from "./eip712TypedDataV1.js";
4
- import { exchangeV1Abi } from "./abi/ExchangeV1.js";
5
- import { exchangeV2Abi } from "./abi/ExchangeV2.js";
6
- export const ABIs = { exchangeV1: exchangeV1Abi, exchangeV2: exchangeV2Abi };
7
- export * from "./model/abi.js";
8
- export * from "./model/eip712.js";
9
- export * from "./model/orderDataV1.js";
10
- export * from "./model/orderDataV2.js";
11
- export * from "./model/signatureTypeV1.js";
12
- export * from "./model/signatureTypeV2.js";
13
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/order-utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAE5C,0CAA0C;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;AAE7E,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC"}
@@ -1,21 +0,0 @@
1
- export interface AbiItem {
2
- anonymous?: boolean;
3
- constant?: boolean;
4
- inputs?: AbiInput[];
5
- name?: string;
6
- outputs?: AbiOutput[];
7
- payable?: boolean;
8
- stateMutability?: string;
9
- type: string;
10
- }
11
- export interface AbiInput {
12
- name: string;
13
- type: string;
14
- indexed?: boolean;
15
- components?: AbiInput[];
16
- }
17
- export interface AbiOutput {
18
- name: string;
19
- type: string;
20
- components?: AbiOutput[];
21
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=abi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"abi.js","sourceRoot":"","sources":["../../../src/order-utils/model/abi.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- export declare const CTF_EXCHANGE_V1_DOMAIN_NAME = "Polymarket CTF Exchange";
2
- export declare const CTF_EXCHANGE_V1_DOMAIN_VERSION = "1";
3
- export declare const CTF_EXCHANGE_V1_ORDER_STRUCT: {
4
- name: string;
5
- type: string;
6
- }[];
@@ -1,17 +0,0 @@
1
- export const CTF_EXCHANGE_V1_DOMAIN_NAME = "Polymarket CTF Exchange";
2
- export const CTF_EXCHANGE_V1_DOMAIN_VERSION = "1";
3
- export const CTF_EXCHANGE_V1_ORDER_STRUCT = [
4
- { name: "salt", type: "uint256" },
5
- { name: "maker", type: "address" },
6
- { name: "signer", type: "address" },
7
- { name: "taker", type: "address" },
8
- { name: "tokenId", type: "uint256" },
9
- { name: "makerAmount", type: "uint256" },
10
- { name: "takerAmount", type: "uint256" },
11
- { name: "expiration", type: "uint256" },
12
- { name: "nonce", type: "uint256" },
13
- { name: "feeRateBps", type: "uint256" },
14
- { name: "side", type: "uint8" },
15
- { name: "signatureType", type: "uint8" },
16
- ];
17
- //# sourceMappingURL=ctfExchangeV1TypedData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ctfExchangeV1TypedData.js","sourceRoot":"","sources":["../../../src/order-utils/model/ctfExchangeV1TypedData.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AAErE,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAElD,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC3C,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;IACjC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;IACnC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IACpC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;IACxC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;IACxC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE;IACvC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE;IACvC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE;IAC/B,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE;CACxC,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare const CTF_EXCHANGE_V2_DOMAIN_NAME = "Polymarket CTF Exchange";
2
- export declare const CTF_EXCHANGE_V2_DOMAIN_VERSION = "2";
3
- export declare const CTF_EXCHANGE_V2_ORDER_STRUCT: {
4
- name: string;
5
- type: string;
6
- }[];
@@ -1,16 +0,0 @@
1
- export const CTF_EXCHANGE_V2_DOMAIN_NAME = "Polymarket CTF Exchange";
2
- export const CTF_EXCHANGE_V2_DOMAIN_VERSION = "2";
3
- export const CTF_EXCHANGE_V2_ORDER_STRUCT = [
4
- { name: "salt", type: "uint256" },
5
- { name: "maker", type: "address" },
6
- { name: "signer", type: "address" },
7
- { name: "tokenId", type: "uint256" },
8
- { name: "makerAmount", type: "uint256" },
9
- { name: "takerAmount", type: "uint256" },
10
- { name: "side", type: "uint8" },
11
- { name: "signatureType", type: "uint8" },
12
- { name: "timestamp", type: "uint256" },
13
- { name: "metadata", type: "bytes32" },
14
- { name: "builder", type: "bytes32" },
15
- ];
16
- //# sourceMappingURL=ctfExchangeV2TypedData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ctfExchangeV2TypedData.js","sourceRoot":"","sources":["../../../src/order-utils/model/ctfExchangeV2TypedData.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AAErE,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAElD,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC3C,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;IACjC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;IACnC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IACpC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;IACxC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;IACxC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE;IAC/B,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE;IACxC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;IACtC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;IACrC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;CACpC,CAAC"}
@@ -1,29 +0,0 @@
1
- export interface EIP712TypedData {
2
- types: EIP712Types;
3
- domain: EIP712Object;
4
- message: EIP712Object;
5
- primaryType: string;
6
- }
7
- export interface EIP712Types {
8
- [key: string]: EIP712Parameter[];
9
- }
10
- export interface EIP712Parameter {
11
- name: string;
12
- type: string;
13
- }
14
- export declare type EIP712ObjectValue = string | number | EIP712Object;
15
- export interface EIP712Object {
16
- [key: string]: EIP712ObjectValue;
17
- }
18
- export interface MessageTypes {
19
- [additionalProperties: string]: MessageTypeProperty[];
20
- EIP712Domain: MessageTypeProperty[];
21
- }
22
- export interface MessageTypeProperty {
23
- name: string;
24
- type: string;
25
- }
26
- export declare const EIP712_DOMAIN: {
27
- name: string;
28
- type: string;
29
- }[];
@@ -1,7 +0,0 @@
1
- export const EIP712_DOMAIN = [
2
- { name: "name", type: "string" },
3
- { name: "version", type: "string" },
4
- { name: "chainId", type: "uint256" },
5
- { name: "verifyingContract", type: "address" },
6
- ];
7
- //# sourceMappingURL=eip712.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eip712.js","sourceRoot":"","sources":["../../../src/order-utils/model/eip712.ts"],"names":[],"mappings":"AAgCA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;IAChC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE;IACnC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IACpC,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,EAAE;CAC9C,CAAC"}
@@ -1,2 +0,0 @@
1
- export type OrderSignature = string;
2
- export type OrderHash = string;
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=order.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"order.js","sourceRoot":"","sources":["../../../src/order-utils/model/order.ts"],"names":[],"mappings":""}
@@ -1,111 +0,0 @@
1
- import type { Side } from "../../types/index.js";
2
- import type { EIP712Object } from "./eip712.js";
3
- import type { OrderSignature } from "./order.js";
4
- import type { SignatureTypeV1 } from "./signatureTypeV1.js";
5
- export interface OrderDataV1 {
6
- /**
7
- * Maker of the order, i.e the source of funds for the order
8
- */
9
- maker: string;
10
- /**
11
- * Address of the order taker. The zero address is used to indicate a public order
12
- */
13
- taker: string;
14
- /**
15
- * Token Id of the CTF ERC1155 asset to be bought or sold.
16
- * If BUY, this is the tokenId of the asset to be bought, i.e the makerAssetId
17
- * If SELL, this is the tokenId of the asset to be sold, i.e the takerAssetId
18
- */
19
- tokenId: string;
20
- /**
21
- * Maker amount, i.e the max amount of tokens to be sold
22
- */
23
- makerAmount: string;
24
- /**
25
- * Taker amount, i.e the minimum amount of tokens to be received
26
- */
27
- takerAmount: string;
28
- /**
29
- * The side of the order, BUY or SELL
30
- */
31
- side: Side;
32
- /**
33
- * Fee rate, in basis points, charged to the order maker, charged on proceeds
34
- */
35
- feeRateBps: string;
36
- /**
37
- * Nonce used for onchain cancellations
38
- */
39
- nonce: string;
40
- /**
41
- * Signer of the order. Optional, if it is not present the signer is the maker of the order.
42
- */
43
- signer?: string;
44
- /**
45
- * Timestamp after which the order is expired.
46
- * Optional, if it is not present the value is '0' (no expiration)
47
- */
48
- expiration?: string;
49
- /**
50
- * Signature type used by the Order. Default value 'EOA'
51
- */
52
- signatureType?: SignatureTypeV1;
53
- }
54
- export interface OrderV1 extends EIP712Object {
55
- /**
56
- * Unique salt to ensure entropy
57
- */
58
- readonly salt: string;
59
- /**
60
- * Maker of the order, i.e the source of funds for the order
61
- */
62
- readonly maker: string;
63
- /**
64
- * Signer of the order
65
- */
66
- readonly signer: string;
67
- /**
68
- * Address of the order taker. The zero address is used to indicate a public order
69
- */
70
- readonly taker: string;
71
- /**
72
- * Token Id of the CTF ERC1155 asset to be bought or sold.
73
- * If BUY, this is the tokenId of the asset to be bought, i.e the makerAssetId
74
- * If SELL, this is the tokenId of the asset to be sold, i.e the takerAssetId
75
- */
76
- readonly tokenId: string;
77
- /**
78
- * Maker amount, i.e the max amount of tokens to be sold
79
- */
80
- readonly makerAmount: string;
81
- /**
82
- * Taker amount, i.e the minimum amount of tokens to be received
83
- */
84
- readonly takerAmount: string;
85
- /**
86
- * Timestamp after which the order is expired
87
- */
88
- readonly expiration: string;
89
- /**
90
- * Nonce used for onchain cancellations
91
- */
92
- readonly nonce: string;
93
- /**
94
- * Fee rate, in basis points, charged to the order maker, charged on proceeds
95
- */
96
- readonly feeRateBps: string;
97
- /**
98
- * The side of the order, BUY or SELL
99
- */
100
- readonly side: Side;
101
- /**
102
- * Signature type used by the Order
103
- */
104
- readonly signatureType: SignatureTypeV1;
105
- }
106
- export interface SignedOrderV1 extends OrderV1 {
107
- /**
108
- * The order signature
109
- */
110
- readonly signature: OrderSignature;
111
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=orderDataV1.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"orderDataV1.js","sourceRoot":"","sources":["../../../src/order-utils/model/orderDataV1.ts"],"names":[],"mappings":""}
@@ -1,110 +0,0 @@
1
- import type { Side } from "../../types/index.js";
2
- import type { EIP712Object } from "./eip712.js";
3
- import type { OrderSignature } from "./order.js";
4
- import type { SignatureTypeV2 } from "./signatureTypeV2.js";
5
- export interface OrderDataV2 {
6
- /**
7
- * Maker of the order, i.e the source of funds for the order
8
- */
9
- maker: string;
10
- /**
11
- * Token Id of the CTF ERC1155 asset to be bought or sold.
12
- * If BUY, this is the tokenId of the asset to be bought, i.e the makerAssetId
13
- * If SELL, this is the tokenId of the asset to be sold, i.e the takerAssetId
14
- */
15
- tokenId: string;
16
- /**
17
- * Maker amount, i.e the max amount of tokens to be sold
18
- */
19
- makerAmount: string;
20
- /**
21
- * Taker amount, i.e the minimum amount of tokens to be received
22
- */
23
- takerAmount: string;
24
- /**
25
- * The side of the order, BUY or SELL
26
- */
27
- side: Side;
28
- /**
29
- * Signer of the order. Optional, if it is not present the signer is the maker of the order.
30
- */
31
- signer?: string;
32
- /**
33
- * Signature type used by the Order. Default value 'EOA'
34
- */
35
- signatureType?: SignatureTypeV2;
36
- /**
37
- * Timestamp of the order
38
- */
39
- timestamp?: string;
40
- /**
41
- * Metadata of the order
42
- */
43
- readonly metadata?: string;
44
- /**
45
- * Builder of the order
46
- */
47
- readonly builder?: string;
48
- /**
49
- * Expiration timestamp of the order (unix seconds, "0" = no expiration)
50
- */
51
- expiration?: string;
52
- }
53
- export interface OrderV2 extends EIP712Object {
54
- /**
55
- * Unique salt to ensure entropy
56
- */
57
- readonly salt: string;
58
- /**
59
- * Maker of the order, i.e the source of funds for the order
60
- */
61
- readonly maker: string;
62
- /**
63
- * Signer of the order
64
- */
65
- readonly signer: string;
66
- /**
67
- * Token Id of the CTF ERC1155 asset to be bought or sold.
68
- * If BUY, this is the tokenId of the asset to be bought, i.e the makerAssetId
69
- * If SELL, this is the tokenId of the asset to be sold, i.e the takerAssetId
70
- */
71
- readonly tokenId: string;
72
- /**
73
- * Maker amount, i.e the max amount of tokens to be sold
74
- */
75
- readonly makerAmount: string;
76
- /**
77
- * Taker amount, i.e the minimum amount of tokens to be received
78
- */
79
- readonly takerAmount: string;
80
- /**
81
- * The side of the order, BUY or SELL
82
- */
83
- readonly side: Side;
84
- /**
85
- * Signature type used by the Order
86
- */
87
- readonly signatureType: SignatureTypeV2;
88
- /**
89
- * Timestamp of the order
90
- */
91
- readonly timestamp: string;
92
- /**
93
- * Metadata of the order
94
- */
95
- readonly metadata: string;
96
- /**
97
- * Builder of the order
98
- */
99
- readonly builder: string;
100
- /**
101
- * Expiration timestamp of the order (unix seconds, "0" = no expiration)
102
- */
103
- readonly expiration: string;
104
- }
105
- export interface SignedOrderV2 extends OrderV2 {
106
- /**
107
- * The order signature
108
- */
109
- readonly signature: OrderSignature;
110
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=orderDataV2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"orderDataV2.js","sourceRoot":"","sources":["../../../src/order-utils/model/orderDataV2.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- export declare enum Side {
2
- BUY = "BUY",
3
- SELL = "SELL"
4
- }
@@ -1,6 +0,0 @@
1
- export var Side;
2
- (function (Side) {
3
- Side["BUY"] = "BUY";
4
- Side["SELL"] = "SELL";
5
- })(Side || (Side = {}));
6
- //# sourceMappingURL=side.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"side.js","sourceRoot":"","sources":["../../../src/order-utils/model/side.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,IAGX;AAHD,WAAY,IAAI;IACf,mBAAW,CAAA;IACX,qBAAa,CAAA;AACd,CAAC,EAHW,IAAI,KAAJ,IAAI,QAGf"}
@@ -1,14 +0,0 @@
1
- export declare enum SignatureTypeV1 {
2
- /**
3
- * ECDSA EIP712 signatures signed by EOAs
4
- */
5
- EOA = 0,
6
- /**
7
- * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
8
- */
9
- POLY_PROXY = 1,
10
- /**
11
- * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
12
- */
13
- POLY_GNOSIS_SAFE = 2
14
- }
@@ -1,16 +0,0 @@
1
- export var SignatureTypeV1;
2
- (function (SignatureTypeV1) {
3
- /**
4
- * ECDSA EIP712 signatures signed by EOAs
5
- */
6
- SignatureTypeV1[SignatureTypeV1["EOA"] = 0] = "EOA";
7
- /**
8
- * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
9
- */
10
- SignatureTypeV1[SignatureTypeV1["POLY_PROXY"] = 1] = "POLY_PROXY";
11
- /**
12
- * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
13
- */
14
- SignatureTypeV1[SignatureTypeV1["POLY_GNOSIS_SAFE"] = 2] = "POLY_GNOSIS_SAFE";
15
- })(SignatureTypeV1 || (SignatureTypeV1 = {}));
16
- //# sourceMappingURL=signatureTypeV1.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signatureTypeV1.js","sourceRoot":"","sources":["../../../src/order-utils/model/signatureTypeV1.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,eAeX;AAfD,WAAY,eAAe;IAC1B;;OAEG;IACH,mDAAO,CAAA;IAEP;;OAEG;IACH,iEAAc,CAAA;IAEd;;OAEG;IACH,6EAAoB,CAAA;AACrB,CAAC,EAfW,eAAe,KAAf,eAAe,QAe1B"}
@@ -1,18 +0,0 @@
1
- export declare enum SignatureTypeV2 {
2
- /**
3
- * ECDSA EIP712 signatures signed by EOAs
4
- */
5
- EOA = 0,
6
- /**
7
- * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
8
- */
9
- POLY_PROXY = 1,
10
- /**
11
- * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
12
- */
13
- POLY_GNOSIS_SAFE = 2,
14
- /**
15
- * EIP1271 signatures signed by smart contracts. To be used by smart contract wallets or vaults
16
- */
17
- POLY_1271 = 3
18
- }
@@ -1,20 +0,0 @@
1
- export var SignatureTypeV2;
2
- (function (SignatureTypeV2) {
3
- /**
4
- * ECDSA EIP712 signatures signed by EOAs
5
- */
6
- SignatureTypeV2[SignatureTypeV2["EOA"] = 0] = "EOA";
7
- /**
8
- * EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
9
- */
10
- SignatureTypeV2[SignatureTypeV2["POLY_PROXY"] = 1] = "POLY_PROXY";
11
- /**
12
- * EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
13
- */
14
- SignatureTypeV2[SignatureTypeV2["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[SignatureTypeV2["POLY_1271"] = 3] = "POLY_1271";
19
- })(SignatureTypeV2 || (SignatureTypeV2 = {}));
20
- //# sourceMappingURL=signatureTypeV2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signatureTypeV2.js","sourceRoot":"","sources":["../../../src/order-utils/model/signatureTypeV2.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,eAoBX;AApBD,WAAY,eAAe;IAC1B;;OAEG;IACH,mDAAO,CAAA;IAEP;;OAEG;IACH,iEAAc,CAAA;IAEd;;OAEG;IACH,6EAAoB,CAAA;IAEpB;;OAEG;IACH,+DAAa,CAAA;AACd,CAAC,EApBW,eAAe,KAAf,eAAe,QAoB1B"}
@@ -1 +0,0 @@
1
- export declare function generateOrderSalt(): string;
@@ -1,4 +0,0 @@
1
- export function generateOrderSalt() {
2
- return `${Math.round(Math.random() * Date.now())}`;
3
- }
4
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/order-utils/utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB;IAChC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;AACpD,CAAC"}
@@ -1,14 +0,0 @@
1
- export declare const CLOB_DOMAIN_NAME = "ClobAuthDomain";
2
- export declare const CLOB_VERSION = "1";
3
- export declare const MSG_TO_SIGN = "This message attests that I control the given wallet";
4
- export declare const CLOB_DOMAIN: {
5
- name: string;
6
- version: string;
7
- chainId: number;
8
- };
9
- export declare const CLOB_TYPES: {
10
- ClobAuth: {
11
- name: string;
12
- type: string;
13
- }[];
14
- };
@@ -1,16 +0,0 @@
1
- export const CLOB_DOMAIN_NAME = "ClobAuthDomain";
2
- export const CLOB_VERSION = "1";
3
- export const MSG_TO_SIGN = "This message attests that I control the given wallet";
4
- export const CLOB_DOMAIN = {
5
- name: CLOB_DOMAIN_NAME,
6
- version: CLOB_VERSION,
7
- chainId: 1,
8
- };
9
- export const CLOB_TYPES = {
10
- ClobAuth: [
11
- { name: "address", type: "address" },
12
- { name: "timestamp", type: "string" },
13
- { name: "message", type: "string" },
14
- ],
15
- };
16
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/signing/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AACjD,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC;AAChC,MAAM,CAAC,MAAM,WAAW,GAAG,sDAAsD,CAAC;AAElF,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,CAAC;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,QAAQ,EAAE;QACT,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;QACpC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;QACrC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE;KACnC;CACD,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { Chain } from "../types/index.js";
2
- import { type ClobSigner } from "./signer.js";
3
- /**
4
- * Builds the canonical Polymarket CLOB EIP712 signature
5
- * @param signer
6
- * @param ts
7
- * @returns string
8
- */
9
- export declare const buildClobEip712Signature: (signer: ClobSigner, chainId: Chain, timestamp: number, nonce: number) => Promise<string>;
@@ -1,40 +0,0 @@
1
- import { MSG_TO_SIGN } from "./constants.js";
2
- import { getSignerAddress, signTypedDataWithSigner } from "./signer.js";
3
- /**
4
- * Builds the canonical Polymarket CLOB EIP712 signature
5
- * @param signer
6
- * @param ts
7
- * @returns string
8
- */
9
- export const buildClobEip712Signature = async (signer, chainId, timestamp, nonce) => {
10
- const address = await getSignerAddress(signer);
11
- const ts = timestamp.toString();
12
- const domain = {
13
- name: "ClobAuthDomain",
14
- version: "1",
15
- chainId: chainId,
16
- };
17
- const types = {
18
- ClobAuth: [
19
- { name: "address", type: "address" },
20
- { name: "timestamp", type: "string" },
21
- { name: "nonce", type: "uint256" },
22
- { name: "message", type: "string" },
23
- ],
24
- };
25
- const value = {
26
- address,
27
- timestamp: ts,
28
- nonce,
29
- message: MSG_TO_SIGN,
30
- };
31
- const sig = await signTypedDataWithSigner({
32
- signer,
33
- domain,
34
- types,
35
- value,
36
- primaryType: "ClobAuth",
37
- });
38
- return sig;
39
- };
40
- //# sourceMappingURL=eip712.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eip712.js","sourceRoot":"","sources":["../../src/signing/eip712.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAmB,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEzF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EAC5C,MAAkB,EAClB,OAAc,EACd,SAAiB,EACjB,KAAa,EACK,EAAE;IACpB,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,EAAE,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC;IAEhC,MAAM,MAAM,GAAG;QACd,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,GAAG;QACZ,OAAO,EAAE,OAAO;KAChB,CAAC;IAEF,MAAM,KAAK,GAAG;QACb,QAAQ,EAAE;YACT,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;YACpC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;YACrC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;YAClC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE;SACnC;KACD,CAAC;IACF,MAAM,KAAK,GAAG;QACb,OAAO;QACP,SAAS,EAAE,EAAE;QACb,KAAK;QACL,OAAO,EAAE,WAAW;KACpB,CAAC;IACF,MAAM,GAAG,GAAG,MAAM,uBAAuB,CAAC;QACzC,MAAM;QACN,MAAM;QACN,KAAK;QACL,KAAK;QACL,WAAW,EAAE,UAAU;KACvB,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Builds the canonical Polymarket CLOB HMAC signature
3
- * @param signer
4
- * @param key
5
- * @param secret
6
- * @param passphrase
7
- * @returns string
8
- */
9
- export declare const buildPolyHmacSignature: (secret: string, timestamp: number, method: string, requestPath: string, body?: string) => string;
@@ -1,27 +0,0 @@
1
- import crypto from "node:crypto";
2
- function replaceAll(s, search, replace) {
3
- return s.split(search).join(replace);
4
- }
5
- /**
6
- * Builds the canonical Polymarket CLOB HMAC signature
7
- * @param signer
8
- * @param key
9
- * @param secret
10
- * @param passphrase
11
- * @returns string
12
- */
13
- export const buildPolyHmacSignature = (secret, timestamp, method, requestPath, body) => {
14
- let message = timestamp + method + requestPath;
15
- if (body !== undefined) {
16
- message += body;
17
- }
18
- const base64Secret = Buffer.from(secret, "base64");
19
- const hmac = crypto.createHmac("sha256", base64Secret);
20
- const sig = hmac.update(message).digest("base64");
21
- // NOTE: Must be url safe base64 encoding, but keep base64 "=" suffix
22
- // Convert '+' to '-'
23
- // Convert '/' to '_'
24
- const sigUrlSafe = replaceAll(replaceAll(sig, "+", "-"), "/", "_");
25
- return sigUrlSafe;
26
- };
27
- //# sourceMappingURL=hmac.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hmac.js","sourceRoot":"","sources":["../../src/signing/hmac.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,SAAS,UAAU,CAAC,CAAS,EAAE,MAAc,EAAE,OAAe;IAC7D,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACrC,MAAc,EACd,SAAiB,EACjB,MAAc,EACd,WAAmB,EACnB,IAAa,EACJ,EAAE;IACX,IAAI,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,CAAC;IAC/C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,IAAI,IAAI,CAAC;IACjB,CAAC;IACD,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACvD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAElD,qEAAqE;IACrE,qBAAqB;IACrB,qBAAqB;IACrB,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACnE,OAAO,UAAU,CAAC;AACnB,CAAC,CAAC"}