@polymarket/clob-client 1.0.1 → 1.0.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.
Files changed (188) hide show
  1. package/README.md +1 -4
  2. package/dist/client.d.ts +16 -2
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +261 -11
  5. package/dist/client.js.map +1 -1
  6. package/dist/{src/constants.d.ts → constants.d.ts} +0 -0
  7. package/dist/constants.d.ts.map +1 -0
  8. package/dist/constants.js +5 -0
  9. package/dist/constants.js.map +1 -0
  10. package/dist/{src/contracts → contracts}/index.d.ts +0 -0
  11. package/dist/contracts/index.d.ts.map +1 -0
  12. package/dist/contracts/index.js +85 -0
  13. package/dist/contracts/index.js.map +1 -0
  14. package/dist/{src/endpoints.d.ts → endpoints.d.ts} +0 -0
  15. package/dist/endpoints.d.ts.map +1 -0
  16. package/dist/endpoints.js +12 -0
  17. package/dist/endpoints.js.map +1 -0
  18. package/dist/{src/errors.d.ts → errors.d.ts} +0 -0
  19. package/dist/errors.d.ts.map +1 -0
  20. package/dist/errors.js +6 -0
  21. package/dist/errors.js.map +1 -0
  22. package/dist/{src/headers → headers}/index.d.ts +0 -0
  23. package/dist/headers/index.d.ts.map +1 -0
  24. package/dist/headers/index.js +84 -0
  25. package/dist/headers/index.js.map +1 -0
  26. package/dist/{src/http_helpers → http_helpers}/index.d.ts +0 -0
  27. package/dist/http_helpers/index.d.ts.map +1 -0
  28. package/dist/http_helpers/index.js +90 -0
  29. package/dist/http_helpers/index.js.map +1 -0
  30. package/dist/index.js +14 -2
  31. package/dist/index.js.map +1 -1
  32. package/dist/{src/order-builder → order-builder}/builder.d.ts +0 -0
  33. package/dist/order-builder/builder.d.ts.map +1 -0
  34. package/dist/order-builder/builder.js +71 -0
  35. package/dist/order-builder/builder.js.map +1 -0
  36. package/dist/{src/order-builder → order-builder}/constants.d.ts +0 -0
  37. package/dist/order-builder/constants.d.ts.map +1 -0
  38. package/dist/order-builder/constants.js +6 -0
  39. package/dist/order-builder/constants.js.map +1 -0
  40. package/dist/{src/order-builder → order-builder}/helpers.d.ts +0 -0
  41. package/dist/order-builder/helpers.d.ts.map +1 -0
  42. package/dist/order-builder/helpers.js +293 -0
  43. package/dist/order-builder/helpers.js.map +1 -0
  44. package/dist/{src/order-builder → order-builder}/index.d.ts +0 -0
  45. package/dist/order-builder/index.d.ts.map +1 -0
  46. package/dist/order-builder/index.js +15 -0
  47. package/dist/order-builder/index.js.map +1 -0
  48. package/dist/{src/order-builder → order-builder}/utils.d.ts +0 -0
  49. package/dist/order-builder/utils.d.ts.map +1 -0
  50. package/dist/order-builder/utils.js +62 -0
  51. package/dist/order-builder/utils.js.map +1 -0
  52. package/dist/signing/constants.js +10 -7
  53. package/dist/signing/constants.js.map +1 -1
  54. package/dist/signing/eip712.js +72 -25
  55. package/dist/signing/eip712.js.map +1 -1
  56. package/dist/signing/hmac.d.ts.map +1 -1
  57. package/dist/signing/hmac.js +60 -16
  58. package/dist/signing/hmac.js.map +1 -1
  59. package/dist/signing/index.js +14 -2
  60. package/dist/signing/index.js.map +1 -1
  61. package/dist/types.d.ts +53 -0
  62. package/dist/types.d.ts.map +1 -1
  63. package/dist/types.js +19 -0
  64. package/dist/types.js.map +1 -1
  65. package/dist/{src/utilities.d.ts → utilities.d.ts} +0 -0
  66. package/dist/utilities.d.ts.map +1 -0
  67. package/dist/{src/utilities.js → utilities.js} +5 -2
  68. package/dist/utilities.js.map +1 -0
  69. package/package.json +14 -15
  70. package/dist/examples/createApiKey.d.ts +0 -2
  71. package/dist/examples/createApiKey.d.ts.map +0 -1
  72. package/dist/examples/createApiKey.js +0 -19
  73. package/dist/examples/createApiKey.js.map +0 -1
  74. package/dist/examples/createOrder.d.ts +0 -2
  75. package/dist/examples/createOrder.d.ts.map +0 -1
  76. package/dist/examples/createOrder.js +0 -34
  77. package/dist/examples/createOrder.js.map +0 -1
  78. package/dist/examples/getApiKeys.d.ts +0 -2
  79. package/dist/examples/getApiKeys.d.ts.map +0 -1
  80. package/dist/examples/getApiKeys.js +0 -23
  81. package/dist/examples/getApiKeys.js.map +0 -1
  82. package/dist/examples/getOpenOrders.d.ts +0 -2
  83. package/dist/examples/getOpenOrders.d.ts.map +0 -1
  84. package/dist/examples/getOpenOrders.js +0 -23
  85. package/dist/examples/getOpenOrders.js.map +0 -1
  86. package/dist/examples/getServerTime.d.ts +0 -2
  87. package/dist/examples/getServerTime.d.ts.map +0 -1
  88. package/dist/examples/getServerTime.js +0 -11
  89. package/dist/examples/getServerTime.js.map +0 -1
  90. package/dist/examples/getTradeHistory.d.ts +0 -2
  91. package/dist/examples/getTradeHistory.d.ts.map +0 -1
  92. package/dist/examples/getTradeHistory.js +0 -23
  93. package/dist/examples/getTradeHistory.js.map +0 -1
  94. package/dist/examples/marketOrder.d.ts +0 -2
  95. package/dist/examples/marketOrder.d.ts.map +0 -1
  96. package/dist/examples/marketOrder.js +0 -42
  97. package/dist/examples/marketOrder.js.map +0 -1
  98. package/dist/examples/testMarketBuy.d.ts +0 -2
  99. package/dist/examples/testMarketBuy.d.ts.map +0 -1
  100. package/dist/examples/testMarketBuy.js +0 -50
  101. package/dist/examples/testMarketBuy.js.map +0 -1
  102. package/dist/examples/testMarketSell.d.ts +0 -2
  103. package/dist/examples/testMarketSell.d.ts.map +0 -1
  104. package/dist/examples/testMarketSell.js +0 -50
  105. package/dist/examples/testMarketSell.js.map +0 -1
  106. package/dist/examples/testMultiSigMarketBuy.d.ts +0 -2
  107. package/dist/examples/testMultiSigMarketBuy.d.ts.map +0 -1
  108. package/dist/examples/testMultiSigMarketBuy.js +0 -52
  109. package/dist/examples/testMultiSigMarketBuy.js.map +0 -1
  110. package/dist/examples/testPolyProxyMarketBuy.d.ts +0 -2
  111. package/dist/examples/testPolyProxyMarketBuy.d.ts.map +0 -1
  112. package/dist/examples/testPolyProxyMarketBuy.js +0 -52
  113. package/dist/examples/testPolyProxyMarketBuy.js.map +0 -1
  114. package/dist/examples/testPolyProxyMarketSell.d.ts +0 -2
  115. package/dist/examples/testPolyProxyMarketSell.d.ts.map +0 -1
  116. package/dist/examples/testPolyProxyMarketSell.js +0 -52
  117. package/dist/examples/testPolyProxyMarketSell.js.map +0 -1
  118. package/dist/helpers/index.d.ts +0 -5
  119. package/dist/helpers/index.d.ts.map +0 -1
  120. package/dist/helpers/index.js +0 -16
  121. package/dist/helpers/index.js.map +0 -1
  122. package/dist/keys.ts/index.d.ts +0 -4
  123. package/dist/keys.ts/index.d.ts.map +0 -1
  124. package/dist/keys.ts/index.js +0 -14
  125. package/dist/keys.ts/index.js.map +0 -1
  126. package/dist/src/client.d.ts +0 -26
  127. package/dist/src/client.d.ts.map +0 -1
  128. package/dist/src/client.js +0 -134
  129. package/dist/src/client.js.map +0 -1
  130. package/dist/src/constants.d.ts.map +0 -1
  131. package/dist/src/constants.js +0 -5
  132. package/dist/src/constants.js.map +0 -1
  133. package/dist/src/contracts/index.d.ts.map +0 -1
  134. package/dist/src/contracts/index.js +0 -21
  135. package/dist/src/contracts/index.js.map +0 -1
  136. package/dist/src/endpoints.d.ts.map +0 -1
  137. package/dist/src/endpoints.js +0 -9
  138. package/dist/src/endpoints.js.map +0 -1
  139. package/dist/src/errors.d.ts.map +0 -1
  140. package/dist/src/errors.js +0 -3
  141. package/dist/src/errors.js.map +0 -1
  142. package/dist/src/headers/index.d.ts.map +0 -1
  143. package/dist/src/headers/index.js +0 -26
  144. package/dist/src/headers/index.js.map +0 -1
  145. package/dist/src/http_helpers/index.d.ts.map +0 -1
  146. package/dist/src/http_helpers/index.js +0 -25
  147. package/dist/src/http_helpers/index.js.map +0 -1
  148. package/dist/src/index.d.ts +0 -3
  149. package/dist/src/index.d.ts.map +0 -1
  150. package/dist/src/index.js +0 -3
  151. package/dist/src/index.js.map +0 -1
  152. package/dist/src/order-builder/builder.d.ts.map +0 -1
  153. package/dist/src/order-builder/builder.js +0 -22
  154. package/dist/src/order-builder/builder.js.map +0 -1
  155. package/dist/src/order-builder/constants.d.ts.map +0 -1
  156. package/dist/src/order-builder/constants.js +0 -3
  157. package/dist/src/order-builder/constants.js.map +0 -1
  158. package/dist/src/order-builder/helpers.d.ts.map +0 -1
  159. package/dist/src/order-builder/helpers.js +0 -221
  160. package/dist/src/order-builder/helpers.js.map +0 -1
  161. package/dist/src/order-builder/index.d.ts.map +0 -1
  162. package/dist/src/order-builder/index.js +0 -3
  163. package/dist/src/order-builder/index.js.map +0 -1
  164. package/dist/src/order-builder/utils.d.ts.map +0 -1
  165. package/dist/src/order-builder/utils.js +0 -21
  166. package/dist/src/order-builder/utils.js.map +0 -1
  167. package/dist/src/signing/constants.d.ts +0 -15
  168. package/dist/src/signing/constants.d.ts.map +0 -1
  169. package/dist/src/signing/constants.js +0 -16
  170. package/dist/src/signing/constants.js.map +0 -1
  171. package/dist/src/signing/eip712.d.ts +0 -10
  172. package/dist/src/signing/eip712.d.ts.map +0 -1
  173. package/dist/src/signing/eip712.js +0 -32
  174. package/dist/src/signing/eip712.js.map +0 -1
  175. package/dist/src/signing/hmac.d.ts +0 -10
  176. package/dist/src/signing/hmac.d.ts.map +0 -1
  177. package/dist/src/signing/hmac.js +0 -25
  178. package/dist/src/signing/hmac.js.map +0 -1
  179. package/dist/src/signing/index.d.ts +0 -3
  180. package/dist/src/signing/index.d.ts.map +0 -1
  181. package/dist/src/signing/index.js +0 -3
  182. package/dist/src/signing/index.js.map +0 -1
  183. package/dist/src/types.d.ts +0 -71
  184. package/dist/src/types.d.ts.map +0 -1
  185. package/dist/src/types.js +0 -7
  186. package/dist/src/types.js.map +0 -1
  187. package/dist/src/utilities.d.ts.map +0 -1
  188. package/dist/src/utilities.js.map +0 -1
@@ -1,12 +1,15 @@
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,
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLOB_TYPES = exports.CLOB_DOMAIN = exports.MSG_TO_SIGN = exports.CLOB_VERSION = exports.CLOB_DOMAIN_NAME = void 0;
4
+ exports.CLOB_DOMAIN_NAME = "ClobAuthDomain";
5
+ exports.CLOB_VERSION = "1";
6
+ exports.MSG_TO_SIGN = "This message attests that I control the given wallet";
7
+ exports.CLOB_DOMAIN = {
8
+ name: exports.CLOB_DOMAIN_NAME,
9
+ version: exports.CLOB_VERSION,
7
10
  chainId: 1,
8
11
  };
9
- export const CLOB_TYPES = {
12
+ exports.CLOB_TYPES = {
10
13
  ClobAuth: [
11
14
  { name: "address", type: "address" },
12
15
  { name: "timestamp", type: "string" },
@@ -1 +1 @@
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;IACvB,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,CAAC;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,QAAQ,EAAE;QACN,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;KACtC;CACJ,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/signing/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,gBAAgB,CAAC;AACpC,QAAA,YAAY,GAAG,GAAG,CAAC;AACnB,QAAA,WAAW,GAAG,sDAAsD,CAAC;AAErE,QAAA,WAAW,GAAG;IACvB,IAAI,EAAE,wBAAgB;IACtB,OAAO,EAAE,oBAAY;IACrB,OAAO,EAAE,CAAC;CACb,CAAC;AAEW,QAAA,UAAU,GAAG;IACtB,QAAQ,EAAE;QACN,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;KACtC;CACJ,CAAC"}
@@ -1,32 +1,79 @@
1
- import { MSG_TO_SIGN } from "./constants";
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.buildClobEip712Signature = void 0;
40
+ var constants_1 = require("./constants");
2
41
  /**
3
42
  * Builds the canonical Polymarket CLOB EIP712 signature
4
43
  * @param signer
5
44
  * @param ts
6
45
  * @returns string
7
46
  */
8
- export const buildClobEip712Signature = async (signer, timestamp) => {
9
- const address = await signer.getAddress();
10
- const ts = `${timestamp}`;
11
- const domain = {
12
- name: "ClobAuthDomain",
13
- version: "1",
14
- chainId: 1,
15
- };
16
- const types = {
17
- ClobAuth: [
18
- { name: "address", type: "address" },
19
- { name: "timestamp", type: "string" },
20
- { name: "message", type: "string" },
21
- ],
22
- };
23
- const value = {
24
- address,
25
- timestamp: ts,
26
- message: MSG_TO_SIGN,
27
- };
28
- // eslint-disable-next-line no-underscore-dangle
29
- const sig = await signer._signTypedData(domain, types, value);
30
- return sig;
31
- };
47
+ exports.buildClobEip712Signature = function (signer, timestamp) { return __awaiter(void 0, void 0, void 0, function () {
48
+ var address, ts, domain, types, value, sig;
49
+ return __generator(this, function (_a) {
50
+ switch (_a.label) {
51
+ case 0: return [4 /*yield*/, signer.getAddress()];
52
+ case 1:
53
+ address = _a.sent();
54
+ ts = "" + timestamp;
55
+ domain = {
56
+ name: "ClobAuthDomain",
57
+ version: "1",
58
+ chainId: 1,
59
+ };
60
+ types = {
61
+ ClobAuth: [
62
+ { name: "address", type: "address" },
63
+ { name: "timestamp", type: "string" },
64
+ { name: "message", type: "string" },
65
+ ],
66
+ };
67
+ value = {
68
+ address: address,
69
+ timestamp: ts,
70
+ message: constants_1.MSG_TO_SIGN,
71
+ };
72
+ return [4 /*yield*/, signer._signTypedData(domain, types, value)];
73
+ case 2:
74
+ sig = _a.sent();
75
+ return [2 /*return*/, sig];
76
+ }
77
+ });
78
+ }); };
32
79
  //# sourceMappingURL=eip712.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eip712.js","sourceRoot":"","sources":["../../src/signing/eip712.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EAAE,MAA8B,EAAE,SAAiB,EAAmB,EAAE;IACjH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;IAC1C,MAAM,EAAE,GAAG,GAAG,SAAS,EAAE,CAAC;IAE1B,MAAM,MAAM,GAAG;QACX,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,GAAG;QACZ,OAAO,EAAE,CAAC;KACb,CAAC;IAEF,MAAM,KAAK,GAAG;QACV,QAAQ,EAAE;YACN,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;YACpC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;YACrC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE;SACtC;KACJ,CAAC;IACF,MAAM,KAAK,GAAG;QACV,OAAO;QACP,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,WAAW;KACvB,CAAC;IACF,gDAAgD;IAChD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9D,OAAO,GAAG,CAAC;AACf,CAAC,CAAC"}
1
+ {"version":3,"file":"eip712.js","sourceRoot":"","sources":["../../src/signing/eip712.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,yCAA0C;AAE1C;;;;;GAKG;AACU,QAAA,wBAAwB,GAAG,UAAO,MAA8B,EAAE,SAAiB;;;;oBAC5E,qBAAM,MAAM,CAAC,UAAU,EAAE,EAAA;;gBAAnC,OAAO,GAAG,SAAyB;gBACnC,EAAE,GAAG,KAAG,SAAW,CAAC;gBAEpB,MAAM,GAAG;oBACX,IAAI,EAAE,gBAAgB;oBACtB,OAAO,EAAE,GAAG;oBACZ,OAAO,EAAE,CAAC;iBACb,CAAC;gBAEI,KAAK,GAAG;oBACV,QAAQ,EAAE;wBACN,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;wBACpC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;wBACrC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE;qBACtC;iBACJ,CAAC;gBACI,KAAK,GAAG;oBACV,OAAO,SAAA;oBACP,SAAS,EAAE,EAAE;oBACb,OAAO,EAAE,uBAAW;iBACvB,CAAC;gBAEU,qBAAM,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,EAAA;;gBAAvD,GAAG,GAAG,SAAiD;gBAC7D,sBAAO,GAAG,EAAC;;;KACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["../../src/signing/hmac.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,WACvB,MAAM,aACH,MAAM,UACT,MAAM,eACD,MAAM,gCAEpB,OAAO,CAAC,MAAM,CAchB,CAAC"}
1
+ {"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["../../src/signing/hmac.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,WACvB,MAAM,aACH,MAAM,UACT,MAAM,eACD,MAAM,gCAEpB,OAAO,CAAC,MAAM,CAchB,CAAC"}
@@ -1,5 +1,49 @@
1
- /* eslint-disable import/no-extraneous-dependencies */
2
- import crypto from "crypto";
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.buildPolyHmacSignature = void 0;
43
+ var crypto_1 = __importDefault(require("crypto"));
44
+ function replaceAll(s, search, replace) {
45
+ return s.split(search).join(replace);
46
+ }
3
47
  /**
4
48
  * Builds the canonical Polymarket CLOB HMAC signature
5
49
  * @param signer
@@ -8,18 +52,18 @@ import crypto from "crypto";
8
52
  * @param passphrase
9
53
  * @returns string
10
54
  */
11
- export const buildPolyHmacSignature = async (secret, timestamp, method, requestPath, body) => {
12
- let message = timestamp + method + requestPath;
13
- if (body !== undefined) {
14
- message += body;
15
- }
16
- const base64Secret = Buffer.from(secret, "base64");
17
- const hmac = crypto.createHmac("sha256", base64Secret);
18
- const sig = hmac.update(message).digest("base64");
19
- // NOTE: Must be url safe base64 encoding, but keep base64 "=" suffix
20
- const sigUrlSafe = sig
21
- .replaceAll(/\+/g, "-") // Convert '+' to '-'
22
- .replaceAll(/\//g, "_"); // Convert '/' to '_'
23
- return sigUrlSafe;
24
- };
55
+ exports.buildPolyHmacSignature = function (secret, timestamp, method, requestPath, body) { return __awaiter(void 0, void 0, void 0, function () {
56
+ var message, base64Secret, hmac, sig, sigUrlSafe;
57
+ return __generator(this, function (_a) {
58
+ message = timestamp + method + requestPath;
59
+ if (body !== undefined) {
60
+ message += body;
61
+ }
62
+ base64Secret = Buffer.from(secret, "base64");
63
+ hmac = crypto_1.default.createHmac("sha256", base64Secret);
64
+ sig = hmac.update(message).digest("base64");
65
+ sigUrlSafe = replaceAll(replaceAll(sig, "+", "-"), "/", "_");
66
+ return [2 /*return*/, sigUrlSafe];
67
+ });
68
+ }); };
25
69
  //# sourceMappingURL=hmac.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hmac.js","sourceRoot":"","sources":["../../src/signing/hmac.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACvC,MAAc,EACd,SAAiB,EACjB,MAAc,EACd,WAAmB,EACnB,IAAa,EACE,EAAE;IACjB,IAAI,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,CAAC;IAC/C,IAAI,IAAI,KAAK,SAAS,EAAE;QACpB,OAAO,IAAI,IAAI,CAAC;KACnB;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,MAAM,UAAU,GAAG,GAAG;SACjB,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,qBAAqB;SAC5C,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,qBAAqB;IAClD,OAAO,UAAU,CAAC;AACtB,CAAC,CAAC"}
1
+ {"version":3,"file":"hmac.js","sourceRoot":"","sources":["../../src/signing/hmac.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA4B;AAE5B,SAAS,UAAU,CAAC,CAAS,EAAE,MAAc,EAAE,OAAe;IAC1D,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;;GAOG;AACU,QAAA,sBAAsB,GAAG,UAClC,MAAc,EACd,SAAiB,EACjB,MAAc,EACd,WAAmB,EACnB,IAAa;;;QAET,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,CAAC;QAC/C,IAAI,IAAI,KAAK,SAAS,EAAE;YACpB,OAAO,IAAI,IAAI,CAAC;SACnB;QACK,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC7C,IAAI,GAAG,gBAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QACjD,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAK5C,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QACnE,sBAAO,UAAU,EAAC;;KACrB,CAAC"}
@@ -1,3 +1,15 @@
1
- export * from "./eip712";
2
- export * from "./hmac";
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./eip712"), exports);
14
+ __exportStar(require("./hmac"), exports);
3
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/signing/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/signing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,yCAAuB"}
package/dist/types.d.ts CHANGED
@@ -1,8 +1,14 @@
1
+ export * from "@polymarket/order-utils";
1
2
  export interface ApiKeyCreds {
2
3
  key: string;
3
4
  secret: string;
4
5
  passphrase: string;
5
6
  }
7
+ export interface L2HeaderArgs {
8
+ method: string;
9
+ requestPath: string;
10
+ body?: string;
11
+ }
6
12
  export interface L1PolyHeader {
7
13
  POLY_ADDRESS: string;
8
14
  POLY_SIGNATURE: string;
@@ -15,4 +21,51 @@ export interface L2PolyHeader {
15
21
  POLY_API_KEY: string;
16
22
  POLY_PASSPHRASE: string;
17
23
  }
24
+ export declare enum Side {
25
+ BUY = "buy",
26
+ SELL = "sell"
27
+ }
28
+ export interface Asset {
29
+ address: string;
30
+ condition: string;
31
+ }
32
+ export interface UserLimitOrder {
33
+ asset: Asset;
34
+ price: number;
35
+ size: number;
36
+ side: Side;
37
+ }
38
+ export interface UserMarketOrder {
39
+ asset: Asset;
40
+ size: number;
41
+ side: Side;
42
+ }
43
+ export interface OrderPayload {
44
+ orderID: string;
45
+ }
46
+ export interface OrderCreationArgs {
47
+ chainID: number;
48
+ exchange: string;
49
+ signer: string;
50
+ maker: string;
51
+ makerAsset: string;
52
+ makerAmount: string;
53
+ makerAssetID?: number;
54
+ takerAsset: string;
55
+ takerAmount: string;
56
+ takerAssetID?: number;
57
+ signatureType: number;
58
+ }
59
+ export interface MarketOrderCreationArgs {
60
+ chainID: number;
61
+ exchange: string;
62
+ signer: string;
63
+ maker: string;
64
+ makerAsset: string;
65
+ makerAmount: string;
66
+ makerAssetID?: number;
67
+ takerAsset: string;
68
+ takerAssetID?: number;
69
+ signatureType: number;
70
+ }
18
71
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACtB;AAGD,MAAM,WAAW,YAAY;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAGD,MAAM,WAAW,YAAY;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CAC3B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AAExC,MAAM,WAAW,WAAW;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAGD,MAAM,WAAW,YAAY;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAGD,MAAM,WAAW,YAAY;IACzB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E,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACzB"}
package/dist/types.js CHANGED
@@ -1 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.Side = void 0;
14
+ __exportStar(require("@polymarket/order-utils"), exports);
15
+ var Side;
16
+ (function (Side) {
17
+ Side["BUY"] = "buy";
18
+ Side["SELL"] = "sell";
19
+ })(Side = exports.Side || (exports.Side = {}));
1
20
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,0DAAwC;AA8BxC,IAAY,IAGX;AAHD,WAAY,IAAI;IACZ,mBAAW,CAAA;IACX,qBAAa,CAAA;AACjB,CAAC,EAHW,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAGf"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAE1F,eAAO,MAAM,gBAAgB,UAAW,sBAAsB,KAAG,GAmBhE,CAAC;AAEF,eAAO,MAAM,iBAAiB,aAAc,uBAAuB,KAAG,GAerE,CAAC"}
@@ -1,4 +1,7 @@
1
- export const limitOrderToJson = (order) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.marketOrderToJson = exports.limitOrderToJson = void 0;
4
+ exports.limitOrderToJson = function (order) {
2
5
  return {
3
6
  order: {
4
7
  salt: parseInt(order.order.salt, 10),
@@ -18,7 +21,7 @@ export const limitOrderToJson = (order) => {
18
21
  orderType: order.orderType,
19
22
  };
20
23
  };
21
- export const marketOrderToJson = (mktOrder) => {
24
+ exports.marketOrderToJson = function (mktOrder) {
22
25
  return {
23
26
  order: {
24
27
  salt: parseInt(mktOrder.order.salt, 10),
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities.js","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAG,UAAC,KAA6B;IAC1D,OAAO;QACH,KAAK,EAAE;YACH,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;YACpC,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU;YAClC,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU;YAClC,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,cAAc;YAC1C,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,cAAc;YAC1C,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,cAAc;YAC1C,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,cAAc;YAC1C,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS;YAChC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM;YAC1B,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW;YACpC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM;YAC1B,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO;SAC/B;QACD,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,SAAS,EAAE,KAAK,CAAC,SAAS;KAC7B,CAAC;AACN,CAAC,CAAC;AAEW,QAAA,iBAAiB,GAAG,UAAC,QAAiC;IAC/D,OAAO;QACH,KAAK,EAAE;YACH,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;YACvC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK;YAC3B,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;YACrC,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,WAAW;YACvC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,YAAY;YACzC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;YACrC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,YAAY;YACzC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM;YAC7B,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO;SAClC;QACD,SAAS,EAAE,QAAQ,CAAC,SAAS;KAChC,CAAC;AACN,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@polymarket/clob-client",
3
3
  "description": "Typescript client for Polymarket's CLOB",
4
- "version": "1.0.1",
4
+ "version": "1.0.4",
5
5
  "contributors": [
6
6
  {
7
7
  "name": "Jonathan Amenechi",
@@ -10,19 +10,19 @@
10
10
  ],
11
11
  "main": "dist/index.js",
12
12
  "types": "dist/index.d.ts",
13
- "devDependencies": {
13
+ "dependencies": {
14
14
  "@commitlint/cli": "^9.1.2",
15
15
  "@commitlint/config-conventional": "^9.1.2",
16
- "@ethersproject/abstract-provider": "^5.4.5",
17
- "@ethersproject/abstract-signer": "^5.4.5",
18
- "@ethersproject/bignumber": "^5.4.5",
19
- "@ethersproject/constants": "^5.4.5",
20
- "@ethersproject/contracts": "^5.4.5",
21
- "@ethersproject/hash": "^5.4.5",
22
- "@ethersproject/providers": "^5.4.5",
23
- "@ethersproject/random": "^5.4.5",
24
- "@ethersproject/transactions": "^5.4.5",
25
- "@ethersproject/wallet": "^5.4.5",
16
+ "@ethersproject/abstract-provider": "^5.5.1",
17
+ "@ethersproject/abstract-signer": "^5.5.0",
18
+ "@ethersproject/bignumber": "^5.5.0",
19
+ "@ethersproject/constants": "^5.5.0",
20
+ "@ethersproject/contracts": "^5.5.0",
21
+ "@ethersproject/hash": "^5.5.0",
22
+ "@ethersproject/providers": "^5.5.1",
23
+ "@ethersproject/random": "^5.5.0",
24
+ "@ethersproject/transactions": "^5.5.0",
25
+ "@ethersproject/wallet": "^5.5.0",
26
26
  "@polymarket/order-utils": "^1.1.5",
27
27
  "axios": "^0.21.1",
28
28
  "commitizen": "^4.2.1",
@@ -32,7 +32,7 @@
32
32
  "eslint-config-airbnb-base-typescript-prettier": "^4.1.0",
33
33
  "eslint-config-prettier": "^6.12.0",
34
34
  "eslint-plugin-import": "^2.22.1",
35
- "ethers": "^5.4.5",
35
+ "ethers": "^5.5.2",
36
36
  "husky": "^4.3.0",
37
37
  "mocha": "^8.1.3",
38
38
  "prettier": "^2.1.2",
@@ -51,7 +51,6 @@
51
51
  "license": "MIT",
52
52
  "scripts": {
53
53
  "build": "tsc",
54
- "deploy": "yarn build && npm publish",
55
- "lint": "eslint --config ./.eslintrc.js --ignore-path ./.eslintignore src"
54
+ "deploy": "yarn build && npm publish"
56
55
  }
57
56
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=createApiKey.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createApiKey.d.ts","sourceRoot":"","sources":["../../examples/createApiKey.ts"],"names":[],"mappings":""}
@@ -1,19 +0,0 @@
1
- import { ethers } from "ethers";
2
- import { config as dotenvConfig } from "dotenv";
3
- import { resolve } from "path";
4
- import { ClobClient } from "../src";
5
- dotenvConfig({ path: resolve(__dirname, "../.env") });
6
- async function main() {
7
- const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_RPC_URL);
8
- const pk = new ethers.Wallet(`${process.env.PK}`);
9
- const wallet = pk.connect(provider);
10
- console.log(`Address: ${await wallet.getAddress()}`);
11
- const host = "http://localhost:8080";
12
- const clobClient = new ClobClient(host, wallet);
13
- console.log(`Response: `);
14
- const resp = await clobClient.createApiKey();
15
- console.log(resp);
16
- console.log(`Complete!`);
17
- }
18
- main();
19
- //# sourceMappingURL=createApiKey.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createApiKey.js","sourceRoot":"","sources":["../../examples/createApiKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;AAEtD,KAAK,UAAU,IAAI;IACf,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC/E,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAErD,MAAM,IAAI,GAAG,uBAAuB,CAAC;IACrC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAEhD,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,YAAY,EAAE,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAC7B,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=createOrder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createOrder.d.ts","sourceRoot":"","sources":["../../examples/createOrder.ts"],"names":[],"mappings":""}
@@ -1,34 +0,0 @@
1
- import { ethers } from "ethers";
2
- import { config as dotenvConfig } from "dotenv";
3
- import { resolve } from "path";
4
- import { ClobClient, Side } from "../src";
5
- dotenvConfig({ path: resolve(__dirname, "../.env") });
6
- async function main() {
7
- const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_RPC_URL);
8
- const pk = new ethers.Wallet(`${process.env.PK}`);
9
- const wallet = pk.connect(provider);
10
- console.log(`Address: ${await wallet.getAddress()}`);
11
- const host = "http://localhost:8080";
12
- const creds = {
13
- key: `${process.env.CLOB_API_KEY}`,
14
- secret: `${process.env.CLOB_SECRET}`,
15
- passphrase: `${process.env.CLOB_PASS_PHRASE}`,
16
- };
17
- const clobClient = new ClobClient(host, wallet, creds);
18
- // Create a buy order for 100 YES for 0.50c
19
- const order = await clobClient.createLimitOrder({
20
- asset: {
21
- address: "0xadbeD21409324e0fcB80AE8b5e662B0C857D85ed",
22
- condition: "YES",
23
- },
24
- price: 0.5,
25
- side: Side.BUY,
26
- size: 100,
27
- });
28
- // Send it to the server
29
- const resp = await clobClient.postLimitOrder(order);
30
- console.log(resp);
31
- console.log(`Done!`);
32
- }
33
- main();
34
- //# sourceMappingURL=createOrder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createOrder.js","sourceRoot":"","sources":["../../examples/createOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,C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;KACZ,CAAC,CAAC;IAEH,wBAAwB;IACxB,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACpD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=getApiKeys.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getApiKeys.d.ts","sourceRoot":"","sources":["../../examples/getApiKeys.ts"],"names":[],"mappings":""}
@@ -1,23 +0,0 @@
1
- import { ethers } from "ethers";
2
- import { config as dotenvConfig } from "dotenv";
3
- import { resolve } from "path";
4
- import { ClobClient } from "../src";
5
- dotenvConfig({ path: resolve(__dirname, "../.env") });
6
- async function main() {
7
- const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_RPC_URL);
8
- const pk = new ethers.Wallet(`${process.env.PK}`);
9
- const wallet = pk.connect(provider);
10
- console.log(`Address: ${await wallet.getAddress()}`);
11
- const host = "http://localhost:8080";
12
- const creds = {
13
- key: `${process.env.CLOB_API_KEY}`,
14
- secret: `${process.env.CLOB_SECRET}`,
15
- passphrase: `${process.env.CLOB_PASS_PHRASE}`,
16
- };
17
- const clobClient = new ClobClient(host, wallet, creds);
18
- console.log(`Response: `);
19
- const resp = await clobClient.getApiKeys();
20
- console.log(resp);
21
- }
22
- main();
23
- //# sourceMappingURL=getApiKeys.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getApiKeys.js","sourceRoot":"","sources":["../../examples/getApiKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAe,UAAU,EAA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import { ethers } from "ethers";
2
- import { config as dotenvConfig } from "dotenv";
3
- import { resolve } from "path";
4
- import { ClobClient } from "../src";
5
- dotenvConfig({ path: resolve(__dirname, "../.env") });
6
- async function main() {
7
- const provider = new ethers.providers.JsonRpcProvider(process.env.ETH_RPC_URL);
8
- const pk = new ethers.Wallet(`${process.env.PK}`);
9
- const wallet = pk.connect(provider);
10
- console.log(`Address: ${await wallet.getAddress()}`);
11
- const host = "http://localhost:8080";
12
- const creds = {
13
- key: `${process.env.CLOB_API_KEY}`,
14
- secret: `${process.env.CLOB_SECRET}`,
15
- passphrase: `${process.env.CLOB_PASS_PHRASE}`,
16
- };
17
- const clobClient = new ClobClient(host, wallet, creds);
18
- const resp = await clobClient.getOpenOrders();
19
- console.log(resp);
20
- console.log(`Done!`);
21
- }
22
- main();
23
- //# sourceMappingURL=getOpenOrders.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getOpenOrders.js","sourceRoot":"","sources":["../../examples/getOpenOrders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAe,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEjD,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;AAEtD,KAAK,UAAU,IAAI;IACf,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC/E,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAErD,MAAM,IAAI,GAAG,uBAAuB,CAAC;IACrC,MAAM,KAAK,GAAgB;QACvB,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE;QAClC,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE;QACpC,UAAU,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE;KAChD,CAAC;IACF,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAEvD,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,aAAa,EAAE,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=getServerTime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getServerTime.d.ts","sourceRoot":"","sources":["../../examples/getServerTime.ts"],"names":[],"mappings":""}