@polymarket/clob-client 5.0.1 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/package.json +90 -90
  2. package/dist/client.d.ts +0 -137
  3. package/dist/client.js +0 -828
  4. package/dist/client.js.map +0 -1
  5. package/dist/config.d.ts +0 -12
  6. package/dist/config.js +0 -28
  7. package/dist/config.js.map +0 -1
  8. package/dist/constants.d.ts +0 -3
  9. package/dist/constants.js +0 -7
  10. package/dist/constants.js.map +0 -1
  11. package/dist/endpoints.d.ts +0 -55
  12. package/dist/endpoints.js +0 -68
  13. package/dist/endpoints.js.map +0 -1
  14. package/dist/errors.d.ts +0 -4
  15. package/dist/errors.js +0 -5
  16. package/dist/errors.js.map +0 -1
  17. package/dist/headers/index.d.ts +0 -7
  18. package/dist/headers/index.js +0 -41
  19. package/dist/headers/index.js.map +0 -1
  20. package/dist/http-helpers/index.d.ts +0 -18
  21. package/dist/http-helpers/index.js +0 -105
  22. package/dist/http-helpers/index.js.map +0 -1
  23. package/dist/index.d.ts +0 -5
  24. package/dist/index.js +0 -6
  25. package/dist/index.js.map +0 -1
  26. package/dist/order-builder/builder.d.ts +0 -30
  27. package/dist/order-builder/builder.js +0 -52
  28. package/dist/order-builder/builder.js.map +0 -1
  29. package/dist/order-builder/helpers.d.ts +0 -51
  30. package/dist/order-builder/helpers.js +0 -279
  31. package/dist/order-builder/helpers.js.map +0 -1
  32. package/dist/order-builder/index.d.ts +0 -1
  33. package/dist/order-builder/index.js +0 -2
  34. package/dist/order-builder/index.js.map +0 -1
  35. package/dist/signing/constants.d.ts +0 -14
  36. package/dist/signing/constants.js +0 -16
  37. package/dist/signing/constants.js.map +0 -1
  38. package/dist/signing/eip712.d.ts +0 -10
  39. package/dist/signing/eip712.js +0 -34
  40. package/dist/signing/eip712.js.map +0 -1
  41. package/dist/signing/hmac.d.ts +0 -9
  42. package/dist/signing/hmac.js +0 -58
  43. package/dist/signing/hmac.js.map +0 -1
  44. package/dist/signing/index.d.ts +0 -2
  45. package/dist/signing/index.js +0 -3
  46. package/dist/signing/index.js.map +0 -1
  47. package/dist/types.d.ts +0 -448
  48. package/dist/types.js +0 -31
  49. package/dist/types.js.map +0 -1
  50. package/dist/utilities.d.ts +0 -16
  51. package/dist/utilities.js +0 -89
  52. package/dist/utilities.js.map +0 -1
package/package.json CHANGED
@@ -1,96 +1,96 @@
1
1
  {
2
- "name": "@polymarket/clob-client",
3
- "description": "Typescript client for Polymarket's CLOB",
4
- "version": "5.0.1",
5
- "contributors": [
6
- {
7
- "name": "Jonathan Amenechi",
8
- "url": "https://github.com/JonathanAmenechi"
2
+ "name": "@polymarket/clob-client",
3
+ "description": "Typescript client for Polymarket's CLOB",
4
+ "version": "5.1.0",
5
+ "contributors": [
6
+ {
7
+ "name": "Jonathan Amenechi",
8
+ "url": "https://github.com/JonathanAmenechi"
9
+ },
10
+ {
11
+ "name": "Rodrigo Calvo",
12
+ "url": "https://github.com/poly-rodr"
13
+ },
14
+ {
15
+ "name": "Matt Walker",
16
+ "url": "https://github.com/mttwlkr"
17
+ },
18
+ {
19
+ "name": "Liam Kovatch",
20
+ "url": "https://github.com/l-kov"
21
+ },
22
+ {
23
+ "name": "Mike Shrieve",
24
+ "url": "https://github.com/mshrieve"
25
+ },
26
+ {
27
+ "name": "Danny Dresner",
28
+ "url": "https://github.com/ddresner-pm"
29
+ }
30
+ ],
31
+ "main": "dist/index.js",
32
+ "types": "dist/index.d.ts",
33
+ "type": "module",
34
+ "files": [
35
+ "/dist"
36
+ ],
37
+ "sideEffects": false,
38
+ "keywords": [
39
+ "blockchain",
40
+ "ethereum"
41
+ ],
42
+ "engines": {
43
+ "node": ">=20.10",
44
+ "yarn": ">=1"
9
45
  },
10
- {
11
- "name": "Rodrigo Calvo",
12
- "url": "https://github.com/poly-rodr"
46
+ "license": "MIT",
47
+ "scripts": {
48
+ "build": "make build",
49
+ "lint": "make lint",
50
+ "deploy": "yarn build && npm publish",
51
+ "test": "make test"
13
52
  },
14
- {
15
- "name": "Matt Walker",
16
- "url": "https://github.com/mttwlkr"
53
+ "dependencies": {
54
+ "@ethersproject/providers": "^5.7.2",
55
+ "@ethersproject/units": "^5.7.0",
56
+ "@ethersproject/wallet": "^5.7.0",
57
+ "@polymarket/builder-signing-sdk": "^0.0.8",
58
+ "@polymarket/order-utils": "^3.0.1",
59
+ "axios": "^1.0.0",
60
+ "browser-or-node": "^2.1.1",
61
+ "ethers": "^5.7.1",
62
+ "tslib": "^2.4.0"
17
63
  },
18
- {
19
- "name": "Liam Kovatch",
20
- "url": "https://github.com/l-kov"
64
+ "devDependencies": {
65
+ "@babel/core": "7.23.2",
66
+ "@babel/traverse": ">=7.23.2",
67
+ "@types/chai": "^4.3.3",
68
+ "@types/mocha": "^9.1.1",
69
+ "@types/node": "^22.19.1",
70
+ "@types/ws": "^8.5.3",
71
+ "@typescript-eslint/eslint-plugin": "^5.37.0",
72
+ "@typescript-eslint/parser": "^5.37.0",
73
+ "chai": "^4.3.6",
74
+ "dotenv": "^16.0.2",
75
+ "eslint": "^8.23.1",
76
+ "eslint-config-prettier": "^8.5.0",
77
+ "eslint-config-standard-with-typescript": "^23.0.0",
78
+ "eslint-plugin-import": "^2.26.0",
79
+ "eslint-plugin-n": "^15.2.5",
80
+ "eslint-plugin-node": "^11.1.0",
81
+ "eslint-plugin-promise": "^6.0.1",
82
+ "eslint-plugin-unused-imports": "^2.0.0",
83
+ "jsdom": "^20.0.0",
84
+ "jsdom-global": "^3.0.2",
85
+ "mocha": "^10.0.0",
86
+ "nyc": "^15.1.0",
87
+ "path": "^0.12.7",
88
+ "prettier": "^2.7.1",
89
+ "ts-mocha": "^10.0.0",
90
+ "typescript": "^5.9.3",
91
+ "ws": "^8.11.0"
21
92
  },
22
- {
23
- "name": "Mike Shrieve",
24
- "url": "https://github.com/mshrieve"
25
- },
26
- {
27
- "name": "Danny Dresner",
28
- "url": "https://github.com/ddresner-pm"
93
+ "resolutions": {
94
+ "@babel/traverse": ">=7.23.2"
29
95
  }
30
- ],
31
- "main": "dist/index.js",
32
- "types": "dist/index.d.ts",
33
- "type": "module",
34
- "files": [
35
- "/dist"
36
- ],
37
- "sideEffects": false,
38
- "keywords": [
39
- "blockchain",
40
- "ethereum"
41
- ],
42
- "engines": {
43
- "node": ">=20.10",
44
- "yarn": ">=1"
45
- },
46
- "license": "MIT",
47
- "dependencies": {
48
- "@ethersproject/providers": "^5.7.2",
49
- "@ethersproject/units": "^5.7.0",
50
- "@ethersproject/wallet": "^5.7.0",
51
- "@polymarket/builder-signing-sdk": "^0.0.8",
52
- "@polymarket/order-utils": "^3.0.1",
53
- "axios": "^1.0.0",
54
- "browser-or-node": "^2.1.1",
55
- "ethers": "^5.7.1",
56
- "tslib": "^2.4.0"
57
- },
58
- "devDependencies": {
59
- "@babel/core": "7.23.2",
60
- "@babel/traverse": ">=7.23.2",
61
- "@types/chai": "^4.3.3",
62
- "@types/mocha": "^9.1.1",
63
- "@types/node": "^22.19.1",
64
- "@types/ws": "^8.5.3",
65
- "@typescript-eslint/eslint-plugin": "^5.37.0",
66
- "@typescript-eslint/parser": "^5.37.0",
67
- "chai": "^4.3.6",
68
- "dotenv": "^16.0.2",
69
- "eslint": "^8.23.1",
70
- "eslint-config-prettier": "^8.5.0",
71
- "eslint-config-standard-with-typescript": "^23.0.0",
72
- "eslint-plugin-import": "^2.26.0",
73
- "eslint-plugin-n": "^15.2.5",
74
- "eslint-plugin-node": "^11.1.0",
75
- "eslint-plugin-promise": "^6.0.1",
76
- "eslint-plugin-unused-imports": "^2.0.0",
77
- "jsdom": "^20.0.0",
78
- "jsdom-global": "^3.0.2",
79
- "mocha": "^10.0.0",
80
- "nyc": "^15.1.0",
81
- "path": "^0.12.7",
82
- "prettier": "^2.7.1",
83
- "ts-mocha": "^10.0.0",
84
- "typescript": "^5.9.3",
85
- "ws": "^8.11.0"
86
- },
87
- "resolutions": {
88
- "@babel/traverse": ">=7.23.2"
89
- },
90
- "scripts": {
91
- "build": "make build",
92
- "lint": "make lint",
93
- "deploy": "yarn build && npm publish",
94
- "test": "make test"
95
- }
96
- }
96
+ }
package/dist/client.d.ts DELETED
@@ -1,137 +0,0 @@
1
- import type { Wallet } from "@ethersproject/wallet";
2
- import type { JsonRpcSigner } from "@ethersproject/providers";
3
- import { SignatureType } from "@polymarket/order-utils";
4
- import type { SignedOrder } from "@polymarket/order-utils";
5
- import type { BuilderConfig } from "@polymarket/builder-signing-sdk";
6
- import { OrderType, Side } from "./types.ts";
7
- import type { ApiKeyCreds, ApiKeysResponse, Chain, CreateOrderOptions, MarketPrice, OpenOrderParams, OpenOrdersResponse, OrderMarketCancelParams, OrderBookSummary, OrderPayload, Trade, Notification, TradeParams, UserMarketOrder, UserOrder, BalanceAllowanceParams, BalanceAllowanceResponse, OrderScoringParams, OrderScoring, OpenOrder, TickSizes, TickSize, OrdersScoringParams, OrdersScoring, PriceHistoryFilterParams, PaginationPayload, MarketTradeEvent, DropNotificationParams, BookParams, UserEarning, RewardsPercentages, MarketReward, UserRewardsEarning, TotalUserEarning, NegRisk, BanStatus, PostOrdersArgs, FeeRates, BuilderTrade, BuilderApiKey, BuilderApiKeyResponse, ReadonlyApiKeyResponse } from "./types.ts";
8
- import { OrderBuilder } from "./order-builder/builder.ts";
9
- export declare class ClobClient {
10
- readonly host: string;
11
- readonly chainId: Chain;
12
- readonly signer?: Wallet | JsonRpcSigner;
13
- readonly creds?: ApiKeyCreds;
14
- readonly orderBuilder: OrderBuilder;
15
- readonly tickSizes: TickSizes;
16
- readonly negRisk: NegRisk;
17
- readonly feeRates: FeeRates;
18
- readonly geoBlockToken?: string;
19
- readonly useServerTime?: boolean;
20
- readonly builderConfig?: BuilderConfig;
21
- constructor(host: string, chainId: Chain, signer?: Wallet | JsonRpcSigner, creds?: ApiKeyCreds, signatureType?: SignatureType, funderAddress?: string, geoBlockToken?: string, useServerTime?: boolean, builderConfig?: BuilderConfig, getSigner?: () => Promise<Wallet | JsonRpcSigner> | (Wallet | JsonRpcSigner));
22
- getOk(): Promise<any>;
23
- getServerTime(): Promise<number>;
24
- getSamplingSimplifiedMarkets(next_cursor?: string): Promise<PaginationPayload>;
25
- getSamplingMarkets(next_cursor?: string): Promise<PaginationPayload>;
26
- getSimplifiedMarkets(next_cursor?: string): Promise<PaginationPayload>;
27
- getMarkets(next_cursor?: string): Promise<PaginationPayload>;
28
- getMarket(conditionID: string): Promise<any>;
29
- getOrderBook(tokenID: string): Promise<OrderBookSummary>;
30
- getOrderBooks(params: BookParams[]): Promise<OrderBookSummary[]>;
31
- getTickSize(tokenID: string): Promise<TickSize>;
32
- getNegRisk(tokenID: string): Promise<boolean>;
33
- getFeeRateBps(tokenID: string): Promise<number>;
34
- /**
35
- * Calculates the hash for the given orderbook
36
- * @param orderbook
37
- * @returns
38
- */
39
- getOrderBookHash(orderbook: OrderBookSummary): Promise<string>;
40
- getMidpoint(tokenID: string): Promise<any>;
41
- getMidpoints(params: BookParams[]): Promise<any>;
42
- getPrice(tokenID: string, side: string): Promise<any>;
43
- getPrices(params: BookParams[]): Promise<any>;
44
- getSpread(tokenID: string): Promise<any>;
45
- getSpreads(params: BookParams[]): Promise<any>;
46
- getLastTradePrice(tokenID: string): Promise<any>;
47
- getLastTradesPrices(params: BookParams[]): Promise<any>;
48
- getPricesHistory(params: PriceHistoryFilterParams): Promise<MarketPrice[]>;
49
- /**
50
- * Creates a new API key for a user
51
- * @param nonce
52
- * @returns ApiKeyCreds
53
- */
54
- createApiKey(nonce?: number): Promise<ApiKeyCreds>;
55
- /**
56
- * Derives an existing API key for a user
57
- * @param nonce
58
- * @returns ApiKeyCreds
59
- */
60
- deriveApiKey(nonce?: number): Promise<ApiKeyCreds>;
61
- createOrDeriveApiKey(nonce?: number): Promise<ApiKeyCreds>;
62
- getApiKeys(): Promise<ApiKeysResponse>;
63
- getClosedOnlyMode(): Promise<BanStatus>;
64
- deleteApiKey(): Promise<any>;
65
- /**
66
- * Creates a new readonly API key for a user
67
- * @returns ReadonlyApiKeyResponse
68
- */
69
- createReadonlyApiKey(): Promise<ReadonlyApiKeyResponse>;
70
- getReadonlyApiKeys(): Promise<string[]>;
71
- /**
72
- * Deletes a readonly API key for a user
73
- * @param key The readonly API key to delete
74
- * @returns boolean
75
- */
76
- deleteReadonlyApiKey(key: string): Promise<boolean>;
77
- /**
78
- * Validates a readonly API key for a given address
79
- * @param address The wallet address
80
- * @param key The readonly API key to validate
81
- * @returns string
82
- */
83
- validateReadonlyApiKey(address: string, key: string): Promise<string>;
84
- getOrder(orderID: string): Promise<OpenOrder>;
85
- getTrades(params?: TradeParams, only_first_page?: boolean, next_cursor?: string): Promise<Trade[]>;
86
- getTradesPaginated(params?: TradeParams, next_cursor?: string): Promise<{
87
- trades: Trade[];
88
- next_cursor: string;
89
- limit: number;
90
- count: number;
91
- }>;
92
- getBuilderTrades(params?: TradeParams, next_cursor?: string): Promise<{
93
- trades: BuilderTrade[];
94
- next_cursor: string;
95
- limit: number;
96
- count: number;
97
- }>;
98
- getNotifications(): Promise<Notification[]>;
99
- dropNotifications(params?: DropNotificationParams): Promise<void>;
100
- getBalanceAllowance(params?: BalanceAllowanceParams): Promise<BalanceAllowanceResponse>;
101
- updateBalanceAllowance(params?: BalanceAllowanceParams): Promise<void>;
102
- createOrder(userOrder: UserOrder, options?: Partial<CreateOrderOptions>): Promise<SignedOrder>;
103
- createMarketOrder(userMarketOrder: UserMarketOrder, options?: Partial<CreateOrderOptions>): Promise<SignedOrder>;
104
- createAndPostOrder<T extends OrderType.GTC | OrderType.GTD = OrderType.GTC>(userOrder: UserOrder, options?: Partial<CreateOrderOptions>, orderType?: T, deferExec?: boolean): Promise<any>;
105
- createAndPostMarketOrder<T extends OrderType.FOK | OrderType.FAK = OrderType.FOK>(userMarketOrder: UserMarketOrder, options?: Partial<CreateOrderOptions>, orderType?: T, deferExec?: boolean): Promise<any>;
106
- getOpenOrders(params?: OpenOrderParams, only_first_page?: boolean, next_cursor?: string): Promise<OpenOrdersResponse>;
107
- postOrder<T extends OrderType = OrderType.GTC>(order: SignedOrder, orderType?: T, deferExec?: boolean): Promise<any>;
108
- postOrders(args: PostOrdersArgs[], deferExec?: boolean): Promise<any>;
109
- cancelOrder(payload: OrderPayload): Promise<any>;
110
- cancelOrders(ordersHashes: string[]): Promise<any>;
111
- cancelAll(): Promise<any>;
112
- cancelMarketOrders(payload: OrderMarketCancelParams): Promise<any>;
113
- isOrderScoring(params?: OrderScoringParams): Promise<OrderScoring>;
114
- areOrdersScoring(params?: OrdersScoringParams): Promise<OrdersScoring>;
115
- getEarningsForUserForDay(date: string): Promise<UserEarning[]>;
116
- getTotalEarningsForUserForDay(date: string): Promise<TotalUserEarning[]>;
117
- getUserEarningsAndMarketsConfig(date: string, order_by?: string, position?: string, no_competition?: boolean): Promise<UserRewardsEarning[]>;
118
- getRewardPercentages(): Promise<RewardsPercentages>;
119
- getCurrentRewards(): Promise<MarketReward[]>;
120
- getRawRewardsForMarket(conditionId: string): Promise<MarketReward[]>;
121
- getMarketTradesEvents(conditionID: string): Promise<MarketTradeEvent[]>;
122
- calculateMarketPrice(tokenID: string, side: Side, amount: number, orderType?: OrderType): Promise<number>;
123
- createBuilderApiKey(): Promise<BuilderApiKey>;
124
- getBuilderApiKeys(): Promise<BuilderApiKeyResponse[]>;
125
- revokeBuilderApiKey(): Promise<any>;
126
- private canL1Auth;
127
- private canL2Auth;
128
- private mustBuilderAuth;
129
- private canBuilderAuth;
130
- private _resolveTickSize;
131
- private _resolveFeeRateBps;
132
- private _generateBuilderHeaders;
133
- private _getBuilderHeaders;
134
- private get;
135
- private post;
136
- private del;
137
- }