@polymarket/clob-client-v2 0.0.3 → 0.2.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.
- package/dist/client.d.ts +15 -29
- package/dist/client.js +723 -862
- package/dist/client.js.map +1 -1
- package/dist/config.js +5 -10
- package/dist/config.js.map +1 -1
- package/dist/constants.js +6 -9
- package/dist/constants.js.map +1 -1
- package/dist/endpoints.d.ts +1 -0
- package/dist/endpoints.js +54 -56
- package/dist/endpoints.js.map +1 -1
- package/dist/errors.js +2 -5
- package/dist/errors.js.map +1 -1
- package/dist/headers/index.d.ts +4 -5
- package/dist/headers/index.js +10 -15
- package/dist/headers/index.js.map +1 -1
- package/dist/http-helpers/index.d.ts +1 -1
- package/dist/http-helpers/index.js +41 -53
- package/dist/http-helpers/index.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +7 -10
- package/dist/index.js.map +1 -1
- package/dist/order-builder/helpers/buildMarketOrderCreationArgs.d.ts +2 -2
- package/dist/order-builder/helpers/buildMarketOrderCreationArgs.js +12 -19
- package/dist/order-builder/helpers/buildMarketOrderCreationArgs.js.map +1 -1
- package/dist/order-builder/helpers/buildOrder.d.ts +5 -6
- package/dist/order-builder/helpers/buildOrder.js +11 -18
- package/dist/order-builder/helpers/buildOrder.js.map +1 -1
- package/dist/order-builder/helpers/buildOrderCreationArgs.d.ts +2 -2
- package/dist/order-builder/helpers/buildOrderCreationArgs.js +13 -19
- package/dist/order-builder/helpers/buildOrderCreationArgs.js.map +1 -1
- package/dist/order-builder/helpers/calculateBuyMarketPrice.d.ts +1 -1
- package/dist/order-builder/helpers/calculateBuyMarketPrice.js +3 -7
- package/dist/order-builder/helpers/calculateBuyMarketPrice.js.map +1 -1
- package/dist/order-builder/helpers/calculateSellMarketPrice.d.ts +1 -1
- package/dist/order-builder/helpers/calculateSellMarketPrice.js +3 -7
- package/dist/order-builder/helpers/calculateSellMarketPrice.js.map +1 -1
- package/dist/order-builder/helpers/createMarketOrder.d.ts +5 -6
- package/dist/order-builder/helpers/createMarketOrder.js +15 -19
- package/dist/order-builder/helpers/createMarketOrder.js.map +1 -1
- package/dist/order-builder/helpers/createOrder.d.ts +5 -6
- package/dist/order-builder/helpers/createOrder.js +15 -19
- package/dist/order-builder/helpers/createOrder.js.map +1 -1
- package/dist/order-builder/helpers/getMarketOrderRawAmounts.d.ts +1 -1
- package/dist/order-builder/helpers/getMarketOrderRawAmounts.js +17 -21
- package/dist/order-builder/helpers/getMarketOrderRawAmounts.js.map +1 -1
- package/dist/order-builder/helpers/getOrderRawAmounts.d.ts +1 -1
- package/dist/order-builder/helpers/getOrderRawAmounts.js +17 -21
- package/dist/order-builder/helpers/getOrderRawAmounts.js.map +1 -1
- package/dist/order-builder/helpers/index.d.ts +10 -10
- package/dist/order-builder/helpers/index.js +10 -23
- package/dist/order-builder/helpers/index.js.map +1 -1
- package/dist/order-builder/helpers/roundingConfig.d.ts +1 -1
- package/dist/order-builder/helpers/roundingConfig.js +1 -4
- package/dist/order-builder/helpers/roundingConfig.js.map +1 -1
- package/dist/order-builder/index.d.ts +1 -1
- package/dist/order-builder/index.js +1 -4
- package/dist/order-builder/index.js.map +1 -1
- package/dist/order-builder/orderBuilder.d.ts +5 -6
- package/dist/order-builder/orderBuilder.js +34 -29
- package/dist/order-builder/orderBuilder.js.map +1 -1
- package/dist/order-utils/abi/ExchangeV1.js +1 -4
- package/dist/order-utils/abi/ExchangeV1.js.map +1 -1
- package/dist/order-utils/abi/ExchangeV2.d.ts +186 -43
- package/dist/order-utils/abi/ExchangeV2.js +234 -53
- package/dist/order-utils/abi/ExchangeV2.js.map +1 -1
- package/dist/order-utils/exchangeOrderBuilderV1.d.ts +5 -6
- package/dist/order-utils/exchangeOrderBuilderV1.js +82 -77
- package/dist/order-utils/exchangeOrderBuilderV1.js.map +1 -1
- package/dist/order-utils/exchangeOrderBuilderV2.d.ts +6 -7
- package/dist/order-utils/exchangeOrderBuilderV2.js +55 -50
- package/dist/order-utils/exchangeOrderBuilderV2.js.map +1 -1
- package/dist/order-utils/index.d.ts +2703 -0
- package/dist/order-utils/index.js +11 -11
- package/dist/order-utils/index.js.map +1 -1
- package/dist/order-utils/model/abi.js +1 -2
- package/dist/order-utils/model/ctfExchangeV1TypedData.js +3 -6
- package/dist/order-utils/model/ctfExchangeV1TypedData.js.map +1 -1
- package/dist/order-utils/model/ctfExchangeV2TypedData.js +3 -6
- package/dist/order-utils/model/ctfExchangeV2TypedData.js.map +1 -1
- package/dist/order-utils/model/eip712.js +1 -4
- package/dist/order-utils/model/eip712.js.map +1 -1
- package/dist/order-utils/model/order.js +1 -2
- package/dist/order-utils/model/orderDataV1.d.ts +4 -4
- package/dist/order-utils/model/orderDataV1.js +1 -2
- package/dist/order-utils/model/orderDataV2.d.ts +12 -13
- package/dist/order-utils/model/orderDataV2.js +1 -2
- package/dist/order-utils/model/side.js +2 -5
- package/dist/order-utils/model/side.js.map +1 -1
- package/dist/order-utils/model/signatureTypeV1.js +2 -5
- package/dist/order-utils/model/signatureTypeV1.js.map +1 -1
- package/dist/order-utils/model/signatureTypeV2.js +2 -5
- package/dist/order-utils/model/signatureTypeV2.js.map +1 -1
- package/dist/order-utils/utils.js +1 -4
- package/dist/order-utils/utils.js.map +1 -1
- package/dist/signing/constants.js +7 -10
- package/dist/signing/constants.js.map +1 -1
- package/dist/signing/eip712.d.ts +3 -4
- package/dist/signing/eip712.js +13 -12
- package/dist/signing/eip712.js.map +1 -1
- package/dist/signing/hmac.js +3 -8
- package/dist/signing/hmac.js.map +1 -1
- package/dist/signing/index.d.ts +3 -2
- package/dist/signing/index.js +3 -5
- package/dist/signing/index.js.map +1 -1
- package/dist/signing/signer.d.ts +22 -0
- package/dist/signing/signer.js +50 -0
- package/dist/signing/signer.js.map +1 -0
- package/dist/types/clob.d.ts +19 -6
- package/dist/types/clob.js +10 -13
- package/dist/types/clob.js.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.js +4 -7
- package/dist/types/index.js.map +1 -1
- package/dist/types/ordersV1.d.ts +3 -2
- package/dist/types/ordersV1.js +22 -2
- package/dist/types/ordersV1.js.map +1 -1
- package/dist/types/ordersV2.d.ts +14 -5
- package/dist/types/ordersV2.js +23 -2
- package/dist/types/ordersV2.js.map +1 -1
- package/dist/types/unifiedOrder.d.ts +4 -4
- package/dist/types/unifiedOrder.js +1 -4
- package/dist/types/unifiedOrder.js.map +1 -1
- package/dist/utilities.d.ts +1 -5
- package/dist/utilities.js +15 -72
- package/dist/utilities.js.map +1 -1
- package/package.json +24 -18
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./exchangeOrderBuilderV1.js"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./exchangeOrderBuilderV2.js"), exports);
|
|
1
|
+
export * from "./exchangeOrderBuilderV1.js";
|
|
2
|
+
export * from "./exchangeOrderBuilderV2.js";
|
|
6
3
|
// export * from "./eip712TypedDataV1.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/order-utils/index.ts"],"names":[],"mappings":"
|
|
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,9 +1,6 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.CTF_EXCHANGE_V1_DOMAIN_NAME = "Polymarket CTF Exchange";
|
|
5
|
-
exports.CTF_EXCHANGE_V1_DOMAIN_VERSION = "1";
|
|
6
|
-
exports.CTF_EXCHANGE_V1_ORDER_STRUCT = [
|
|
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 = [
|
|
7
4
|
{ name: "salt", type: "uint256" },
|
|
8
5
|
{ name: "maker", type: "address" },
|
|
9
6
|
{ name: "signer", type: "address" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ctfExchangeV1TypedData.js","sourceRoot":"","sources":["../../../src/order-utils/model/ctfExchangeV1TypedData.ts"],"names":[],"mappings":"
|
|
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,9 +1,6 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.CTF_EXCHANGE_V2_DOMAIN_NAME = "Polymarket CTF Exchange";
|
|
5
|
-
exports.CTF_EXCHANGE_V2_DOMAIN_VERSION = "2";
|
|
6
|
-
exports.CTF_EXCHANGE_V2_ORDER_STRUCT = [
|
|
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 = [
|
|
7
4
|
{ name: "salt", type: "uint256" },
|
|
8
5
|
{ name: "maker", type: "address" },
|
|
9
6
|
{ name: "signer", type: "address" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ctfExchangeV2TypedData.js","sourceRoot":"","sources":["../../../src/order-utils/model/ctfExchangeV2TypedData.ts"],"names":[],"mappings":"
|
|
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,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EIP712_DOMAIN = void 0;
|
|
4
|
-
exports.EIP712_DOMAIN = [
|
|
1
|
+
export const EIP712_DOMAIN = [
|
|
5
2
|
{ name: "name", type: "string" },
|
|
6
3
|
{ name: "version", type: "string" },
|
|
7
4
|
{ name: "chainId", type: "uint256" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eip712.js","sourceRoot":"","sources":["../../../src/order-utils/model/eip712.ts"],"names":[],"mappings":"
|
|
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,7 +1,7 @@
|
|
|
1
|
-
import type { Side } from "../../types/index.
|
|
2
|
-
import type { EIP712Object } from "./eip712.
|
|
3
|
-
import type { OrderSignature } from "./order.
|
|
4
|
-
import type { SignatureTypeV1 } from "./signatureTypeV1.
|
|
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
5
|
export interface OrderDataV1 {
|
|
6
6
|
/**
|
|
7
7
|
* Maker of the order, i.e the source of funds for the order
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Side } from "../../types/index.
|
|
2
|
-
import type { EIP712Object } from "./eip712.
|
|
3
|
-
import type { OrderSignature } from "./order.
|
|
4
|
-
import type { SignatureTypeV2 } from "./signatureTypeV2.
|
|
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
5
|
export interface OrderDataV2 {
|
|
6
6
|
/**
|
|
7
7
|
* Maker of the order, i.e the source of funds for the order
|
|
@@ -29,11 +29,6 @@ export interface OrderDataV2 {
|
|
|
29
29
|
* Signer of the order. Optional, if it is not present the signer is the maker of the order.
|
|
30
30
|
*/
|
|
31
31
|
signer?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Timestamp after which the order is expired.
|
|
34
|
-
* Optional, if it is not present the value is '0' (no expiration)
|
|
35
|
-
*/
|
|
36
|
-
expiration?: string;
|
|
37
32
|
/**
|
|
38
33
|
* Signature type used by the Order. Default value 'EOA'
|
|
39
34
|
*/
|
|
@@ -50,6 +45,10 @@ export interface OrderDataV2 {
|
|
|
50
45
|
* Builder of the order
|
|
51
46
|
*/
|
|
52
47
|
readonly builder?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Expiration timestamp of the order (unix seconds, "0" = no expiration)
|
|
50
|
+
*/
|
|
51
|
+
expiration?: string;
|
|
53
52
|
}
|
|
54
53
|
export interface OrderV2 extends EIP712Object {
|
|
55
54
|
/**
|
|
@@ -78,10 +77,6 @@ export interface OrderV2 extends EIP712Object {
|
|
|
78
77
|
* Taker amount, i.e the minimum amount of tokens to be received
|
|
79
78
|
*/
|
|
80
79
|
readonly takerAmount: string;
|
|
81
|
-
/**
|
|
82
|
-
* Timestamp after which the order is expired
|
|
83
|
-
*/
|
|
84
|
-
readonly expiration: string;
|
|
85
80
|
/**
|
|
86
81
|
* The side of the order, BUY or SELL
|
|
87
82
|
*/
|
|
@@ -102,6 +97,10 @@ export interface OrderV2 extends EIP712Object {
|
|
|
102
97
|
* Builder of the order
|
|
103
98
|
*/
|
|
104
99
|
readonly builder: string;
|
|
100
|
+
/**
|
|
101
|
+
* Expiration timestamp of the order (unix seconds, "0" = no expiration)
|
|
102
|
+
*/
|
|
103
|
+
readonly expiration: string;
|
|
105
104
|
}
|
|
106
105
|
export interface SignedOrderV2 extends OrderV2 {
|
|
107
106
|
/**
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Side = void 0;
|
|
4
|
-
var Side;
|
|
1
|
+
export var Side;
|
|
5
2
|
(function (Side) {
|
|
6
3
|
Side["BUY"] = "BUY";
|
|
7
4
|
Side["SELL"] = "SELL";
|
|
8
|
-
})(Side || (
|
|
5
|
+
})(Side || (Side = {}));
|
|
9
6
|
//# sourceMappingURL=side.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side.js","sourceRoot":"","sources":["../../../src/order-utils/model/side.ts"],"names":[],"mappings":"
|
|
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,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SignatureTypeV1 = void 0;
|
|
4
|
-
var SignatureTypeV1;
|
|
1
|
+
export var SignatureTypeV1;
|
|
5
2
|
(function (SignatureTypeV1) {
|
|
6
3
|
/**
|
|
7
4
|
* ECDSA EIP712 signatures signed by EOAs
|
|
@@ -15,5 +12,5 @@ var SignatureTypeV1;
|
|
|
15
12
|
* EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
|
|
16
13
|
*/
|
|
17
14
|
SignatureTypeV1[SignatureTypeV1["POLY_GNOSIS_SAFE"] = 2] = "POLY_GNOSIS_SAFE";
|
|
18
|
-
})(SignatureTypeV1 || (
|
|
15
|
+
})(SignatureTypeV1 || (SignatureTypeV1 = {}));
|
|
19
16
|
//# sourceMappingURL=signatureTypeV1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signatureTypeV1.js","sourceRoot":"","sources":["../../../src/order-utils/model/signatureTypeV1.ts"],"names":[],"mappings":"
|
|
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,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SignatureTypeV2 = void 0;
|
|
4
|
-
var SignatureTypeV2;
|
|
1
|
+
export var SignatureTypeV2;
|
|
5
2
|
(function (SignatureTypeV2) {
|
|
6
3
|
/**
|
|
7
4
|
* ECDSA EIP712 signatures signed by EOAs
|
|
@@ -19,5 +16,5 @@ var SignatureTypeV2;
|
|
|
19
16
|
* EIP1271 signatures signed by smart contracts. To be used by smart contract wallets or vaults
|
|
20
17
|
*/
|
|
21
18
|
SignatureTypeV2[SignatureTypeV2["POLY_1271"] = 3] = "POLY_1271";
|
|
22
|
-
})(SignatureTypeV2 || (
|
|
19
|
+
})(SignatureTypeV2 || (SignatureTypeV2 = {}));
|
|
23
20
|
//# sourceMappingURL=signatureTypeV2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signatureTypeV2.js","sourceRoot":"","sources":["../../../src/order-utils/model/signatureTypeV2.ts"],"names":[],"mappings":"
|
|
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,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateOrderSalt = generateOrderSalt;
|
|
4
|
-
function generateOrderSalt() {
|
|
1
|
+
export function generateOrderSalt() {
|
|
5
2
|
return `${Math.round(Math.random() * Date.now())}`;
|
|
6
3
|
}
|
|
7
4
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/order-utils/utils.ts"],"names":[],"mappings":"
|
|
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,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.CLOB_DOMAIN = {
|
|
8
|
-
name: exports.CLOB_DOMAIN_NAME,
|
|
9
|
-
version: exports.CLOB_VERSION,
|
|
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,
|
|
10
7
|
chainId: 1,
|
|
11
8
|
};
|
|
12
|
-
|
|
9
|
+
export const CLOB_TYPES = {
|
|
13
10
|
ClobAuth: [
|
|
14
11
|
{ name: "address", type: "address" },
|
|
15
12
|
{ name: "timestamp", type: "string" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/signing/constants.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/signing/eip712.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
3
|
-
import type { Chain } from "../types";
|
|
1
|
+
import type { Chain } from "../types/index.js";
|
|
2
|
+
import { type ClobSigner } from "./signer.js";
|
|
4
3
|
/**
|
|
5
4
|
* Builds the canonical Polymarket CLOB EIP712 signature
|
|
6
5
|
* @param signer
|
|
7
6
|
* @param ts
|
|
8
7
|
* @returns string
|
|
9
8
|
*/
|
|
10
|
-
export declare const buildClobEip712Signature: (signer:
|
|
9
|
+
export declare const buildClobEip712Signature: (signer: ClobSigner, chainId: Chain, timestamp: number, nonce: number) => Promise<string>;
|
package/dist/signing/eip712.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.buildClobEip712Signature = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const constants_1 = require("./constants");
|
|
1
|
+
import { MSG_TO_SIGN } from "./constants.js";
|
|
2
|
+
import { getSignerAddress, signTypedDataWithSigner } from "./signer.js";
|
|
6
3
|
/**
|
|
7
4
|
* Builds the canonical Polymarket CLOB EIP712 signature
|
|
8
5
|
* @param signer
|
|
9
6
|
* @param ts
|
|
10
7
|
* @returns string
|
|
11
8
|
*/
|
|
12
|
-
const buildClobEip712Signature = (signer, chainId, timestamp, nonce) =>
|
|
13
|
-
const address =
|
|
9
|
+
export const buildClobEip712Signature = async (signer, chainId, timestamp, nonce) => {
|
|
10
|
+
const address = await getSignerAddress(signer);
|
|
14
11
|
const ts = timestamp.toString();
|
|
15
12
|
const domain = {
|
|
16
13
|
name: "ClobAuthDomain",
|
|
@@ -29,11 +26,15 @@ const buildClobEip712Signature = (signer, chainId, timestamp, nonce) => tslib_1.
|
|
|
29
26
|
address,
|
|
30
27
|
timestamp: ts,
|
|
31
28
|
nonce,
|
|
32
|
-
message:
|
|
29
|
+
message: MSG_TO_SIGN,
|
|
33
30
|
};
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
const sig = await signTypedDataWithSigner({
|
|
32
|
+
signer,
|
|
33
|
+
domain,
|
|
34
|
+
types,
|
|
35
|
+
value,
|
|
36
|
+
primaryType: "ClobAuth",
|
|
37
|
+
});
|
|
36
38
|
return sig;
|
|
37
|
-
}
|
|
38
|
-
exports.buildClobEip712Signature = buildClobEip712Signature;
|
|
39
|
+
};
|
|
39
40
|
//# sourceMappingURL=eip712.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eip712.js","sourceRoot":"","sources":["../../src/signing/eip712.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/signing/hmac.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildPolyHmacSignature = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const node_crypto_1 = tslib_1.__importDefault(require("node:crypto"));
|
|
1
|
+
import crypto from "node:crypto";
|
|
6
2
|
function replaceAll(s, search, replace) {
|
|
7
3
|
return s.split(search).join(replace);
|
|
8
4
|
}
|
|
@@ -14,13 +10,13 @@ function replaceAll(s, search, replace) {
|
|
|
14
10
|
* @param passphrase
|
|
15
11
|
* @returns string
|
|
16
12
|
*/
|
|
17
|
-
const buildPolyHmacSignature = (secret, timestamp, method, requestPath, body) => {
|
|
13
|
+
export const buildPolyHmacSignature = (secret, timestamp, method, requestPath, body) => {
|
|
18
14
|
let message = timestamp + method + requestPath;
|
|
19
15
|
if (body !== undefined) {
|
|
20
16
|
message += body;
|
|
21
17
|
}
|
|
22
18
|
const base64Secret = Buffer.from(secret, "base64");
|
|
23
|
-
const hmac =
|
|
19
|
+
const hmac = crypto.createHmac("sha256", base64Secret);
|
|
24
20
|
const sig = hmac.update(message).digest("base64");
|
|
25
21
|
// NOTE: Must be url safe base64 encoding, but keep base64 "=" suffix
|
|
26
22
|
// Convert '+' to '-'
|
|
@@ -28,5 +24,4 @@ const buildPolyHmacSignature = (secret, timestamp, method, requestPath, body) =>
|
|
|
28
24
|
const sigUrlSafe = replaceAll(replaceAll(sig, "+", "-"), "/", "_");
|
|
29
25
|
return sigUrlSafe;
|
|
30
26
|
};
|
|
31
|
-
exports.buildPolyHmacSignature = buildPolyHmacSignature;
|
|
32
27
|
//# sourceMappingURL=hmac.js.map
|
package/dist/signing/hmac.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmac.js","sourceRoot":"","sources":["../../src/signing/hmac.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/signing/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export * from "./eip712";
|
|
2
|
-
export * from "./hmac";
|
|
1
|
+
export * from "./eip712.js";
|
|
2
|
+
export * from "./hmac.js";
|
|
3
|
+
export * from "./signer.js";
|
package/dist/signing/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./eip712"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./hmac"), exports);
|
|
1
|
+
export * from "./eip712.js";
|
|
2
|
+
export * from "./hmac.js";
|
|
3
|
+
export * from "./signer.js";
|
|
6
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/signing/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/signing/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Address, WalletClient } from "viem";
|
|
2
|
+
type TypedDataDomain = Record<string, unknown>;
|
|
3
|
+
type TypedDataTypes = Record<string, Array<{
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
}>>;
|
|
7
|
+
type TypedDataValue = Record<string, unknown>;
|
|
8
|
+
interface EthersSigner {
|
|
9
|
+
_signTypedData(domain: TypedDataDomain, types: TypedDataTypes, value: TypedDataValue): Promise<string>;
|
|
10
|
+
getAddress(): Promise<string>;
|
|
11
|
+
}
|
|
12
|
+
export type ClobSigner = EthersSigner | WalletClient;
|
|
13
|
+
export declare const getWalletClientAddress: (walletClient: WalletClient) => Promise<Address>;
|
|
14
|
+
export declare const getSignerAddress: (signer: ClobSigner) => Promise<string>;
|
|
15
|
+
export declare const signTypedDataWithSigner: ({ signer, domain, types, value, primaryType, }: {
|
|
16
|
+
signer: ClobSigner;
|
|
17
|
+
domain: TypedDataDomain;
|
|
18
|
+
types: TypedDataTypes;
|
|
19
|
+
value: TypedDataValue;
|
|
20
|
+
primaryType?: string;
|
|
21
|
+
}) => Promise<string>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const isEthersTypedDataSigner = (signer) =>
|
|
2
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
3
|
+
typeof signer._signTypedData === "function";
|
|
4
|
+
const isWalletClientSigner = (signer) => typeof signer.signTypedData === "function";
|
|
5
|
+
export const getWalletClientAddress = async (walletClient) => {
|
|
6
|
+
const accountAddress = walletClient.account?.address;
|
|
7
|
+
if (typeof accountAddress === "string" && accountAddress.length > 0) {
|
|
8
|
+
return accountAddress;
|
|
9
|
+
}
|
|
10
|
+
if (typeof walletClient.requestAddresses === "function") {
|
|
11
|
+
const [address] = await walletClient.requestAddresses();
|
|
12
|
+
if (typeof address === "string" && address.length > 0) {
|
|
13
|
+
return address;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if (typeof walletClient.getAddresses === "function") {
|
|
17
|
+
const [address] = await walletClient.getAddresses();
|
|
18
|
+
if (typeof address === "string" && address.length > 0) {
|
|
19
|
+
return address;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
throw new Error("wallet client is missing account address");
|
|
23
|
+
};
|
|
24
|
+
export const getSignerAddress = async (signer) => {
|
|
25
|
+
if (isEthersTypedDataSigner(signer)) {
|
|
26
|
+
return signer.getAddress();
|
|
27
|
+
}
|
|
28
|
+
if (isWalletClientSigner(signer)) {
|
|
29
|
+
return getWalletClientAddress(signer);
|
|
30
|
+
}
|
|
31
|
+
throw new Error("unsupported signer type");
|
|
32
|
+
};
|
|
33
|
+
export const signTypedDataWithSigner = async ({ signer, domain, types, value, primaryType, }) => {
|
|
34
|
+
if (isEthersTypedDataSigner(signer)) {
|
|
35
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
36
|
+
return signer._signTypedData(domain, types, value);
|
|
37
|
+
}
|
|
38
|
+
if (isWalletClientSigner(signer)) {
|
|
39
|
+
const account = signer.account ?? (await getWalletClientAddress(signer));
|
|
40
|
+
return signer.signTypedData({
|
|
41
|
+
account,
|
|
42
|
+
domain,
|
|
43
|
+
types,
|
|
44
|
+
primaryType,
|
|
45
|
+
message: value,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
throw new Error("unsupported signer type");
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=signer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../src/signing/signer.ts"],"names":[],"mappings":"AAiBA,MAAM,uBAAuB,GAAG,CAAC,MAAkB,EAA0B,EAAE;AAC9E,gDAAgD;AAChD,OAAQ,MAAuB,CAAC,cAAc,KAAK,UAAU,CAAC;AAE/D,MAAM,oBAAoB,GAAG,CAAC,MAAkB,EAA0B,EAAE,CAC3E,OAAQ,MAAuB,CAAC,aAAa,KAAK,UAAU,CAAC;AAE9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EAAE,YAA0B,EAAoB,EAAE;IAC5F,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC;IACrD,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrE,OAAO,cAAyB,CAAC;IAClC,CAAC;IAED,IAAI,OAAO,YAAY,CAAC,gBAAgB,KAAK,UAAU,EAAE,CAAC;QACzD,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,YAAY,CAAC,gBAAgB,EAAE,CAAC;QACxD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvD,OAAO,OAAkB,CAAC;QAC3B,CAAC;IACF,CAAC;IAED,IAAI,OAAO,YAAY,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;QACrD,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,YAAY,CAAC,YAAY,EAAE,CAAC;QACpD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvD,OAAO,OAAkB,CAAC;QAC3B,CAAC;IACF,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAC7D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,MAAkB,EAAmB,EAAE;IAC7E,IAAI,uBAAuB,CAAC,MAAM,CAAC,EAAE,CAAC;QACrC,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC;IAC5B,CAAC;IAED,IAAI,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,OAAO,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,EAAE,EAC7C,MAAM,EACN,MAAM,EACN,KAAK,EACL,KAAK,EACL,WAAW,GAOX,EAAmB,EAAE;IACrB,IAAI,uBAAuB,CAAC,MAAM,CAAC,EAAE,CAAC;QACrC,gDAAgD;QAChD,OAAO,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,OAAO,GAAsB,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC;QAC5F,OAAO,MAAM,CAAC,aAAa,CAAC;YAC3B,OAAO;YACP,MAAM;YACN,KAAK;YACL,WAAW;YACX,OAAO,EAAE,KAAK;SACkC,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AAC5C,CAAC,CAAC"}
|
package/dist/types/clob.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Side } from "../order-utils/model/side";
|
|
1
|
+
import { Side } from "../order-utils/model/side.js";
|
|
2
2
|
export { Side };
|
|
3
3
|
export interface ApiKeyCreds {
|
|
4
4
|
key: string;
|
|
@@ -210,14 +210,15 @@ export interface TickSizes {
|
|
|
210
210
|
export interface NegRisk {
|
|
211
211
|
[tokenId: string]: boolean;
|
|
212
212
|
}
|
|
213
|
-
export interface
|
|
214
|
-
|
|
213
|
+
export interface FeeInfo {
|
|
214
|
+
rate: number;
|
|
215
|
+
exponent: number;
|
|
215
216
|
}
|
|
216
|
-
export interface
|
|
217
|
-
[tokenId: string]:
|
|
217
|
+
export interface FeeInfos {
|
|
218
|
+
[tokenId: string]: FeeInfo;
|
|
218
219
|
}
|
|
219
220
|
export interface BuilderFeeRates {
|
|
220
|
-
[
|
|
221
|
+
[builderCode: string]: {
|
|
221
222
|
maker: number;
|
|
222
223
|
taker: number;
|
|
223
224
|
};
|
|
@@ -375,3 +376,15 @@ export interface BuilderApiKeyResponse {
|
|
|
375
376
|
export type ClobErrorResponseBody = {
|
|
376
377
|
error: string;
|
|
377
378
|
};
|
|
379
|
+
export interface TradesPaginatedResponse {
|
|
380
|
+
trades: Trade[];
|
|
381
|
+
next_cursor: string;
|
|
382
|
+
limit: number;
|
|
383
|
+
count: number;
|
|
384
|
+
}
|
|
385
|
+
export interface BuilderTradesResponse {
|
|
386
|
+
trades: BuilderTrade[];
|
|
387
|
+
next_cursor: string;
|
|
388
|
+
limit: number;
|
|
389
|
+
count: number;
|
|
390
|
+
}
|
package/dist/types/clob.js
CHANGED
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const side_1 = require("../order-utils/model/side");
|
|
5
|
-
Object.defineProperty(exports, "Side", { enumerable: true, get: function () { return side_1.Side; } });
|
|
6
|
-
var OrderType;
|
|
1
|
+
import { Side } from "../order-utils/model/side.js";
|
|
2
|
+
export { Side };
|
|
3
|
+
export var OrderType;
|
|
7
4
|
(function (OrderType) {
|
|
8
5
|
OrderType["GTC"] = "GTC";
|
|
9
6
|
OrderType["FOK"] = "FOK";
|
|
10
7
|
OrderType["GTD"] = "GTD";
|
|
11
8
|
OrderType["FAK"] = "FAK";
|
|
12
|
-
})(OrderType || (
|
|
13
|
-
var Chain;
|
|
9
|
+
})(OrderType || (OrderType = {}));
|
|
10
|
+
export var Chain;
|
|
14
11
|
(function (Chain) {
|
|
15
12
|
Chain[Chain["POLYGON"] = 137] = "POLYGON";
|
|
16
13
|
Chain[Chain["AMOY"] = 80002] = "AMOY";
|
|
17
|
-
})(Chain || (
|
|
18
|
-
var PriceHistoryInterval;
|
|
14
|
+
})(Chain || (Chain = {}));
|
|
15
|
+
export var PriceHistoryInterval;
|
|
19
16
|
(function (PriceHistoryInterval) {
|
|
20
17
|
PriceHistoryInterval["MAX"] = "max";
|
|
21
18
|
PriceHistoryInterval["ONE_WEEK"] = "1w";
|
|
22
19
|
PriceHistoryInterval["ONE_DAY"] = "1d";
|
|
23
20
|
PriceHistoryInterval["SIX_HOURS"] = "6h";
|
|
24
21
|
PriceHistoryInterval["ONE_HOUR"] = "1h";
|
|
25
|
-
})(PriceHistoryInterval || (
|
|
26
|
-
var AssetType;
|
|
22
|
+
})(PriceHistoryInterval || (PriceHistoryInterval = {}));
|
|
23
|
+
export var AssetType;
|
|
27
24
|
(function (AssetType) {
|
|
28
25
|
AssetType["COLLATERAL"] = "COLLATERAL";
|
|
29
26
|
AssetType["CONDITIONAL"] = "CONDITIONAL";
|
|
30
|
-
})(AssetType || (
|
|
27
|
+
})(AssetType || (AssetType = {}));
|
|
31
28
|
//# sourceMappingURL=clob.js.map
|
package/dist/types/clob.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clob.js","sourceRoot":"","sources":["../../src/types/clob.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clob.js","sourceRoot":"","sources":["../../src/types/clob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAEpD,OAAO,EAAE,IAAI,EAAE,CAAC;AA2ChB,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACpB,wBAAW,CAAA;IACX,wBAAW,CAAA;IACX,wBAAW,CAAA;IACX,wBAAW,CAAA;AACZ,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB;AAkGD,MAAM,CAAN,IAAY,KAGX;AAHD,WAAY,KAAK;IAChB,yCAAa,CAAA;IACb,qCAAY,CAAA;AACb,CAAC,EAHW,KAAK,KAAL,KAAK,QAGhB;AAeD,MAAM,CAAN,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC/B,mCAAW,CAAA;IACX,uCAAe,CAAA;IACf,sCAAc,CAAA;IACd,wCAAgB,CAAA;IAChB,uCAAe,CAAA;AAChB,CAAC,EANW,oBAAoB,KAApB,oBAAoB,QAM/B;AAmCD,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACpB,sCAAyB,CAAA;IACzB,wCAA2B,CAAA;AAC5B,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./clob";
|
|
2
|
-
export * from "./ordersV1";
|
|
3
|
-
export * from "./ordersV2";
|
|
4
|
-
export * from "./unifiedOrder";
|
|
1
|
+
export * from "./clob.js";
|
|
2
|
+
export * from "./ordersV1.js";
|
|
3
|
+
export * from "./ordersV2.js";
|
|
4
|
+
export * from "./unifiedOrder.js";
|