pmxt-core 2.41.5 → 2.41.6

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/kalshi/Kalshi.yaml
3
- * Generated at: 2026-05-16T20:04:24.141Z
3
+ * Generated at: 2026-05-16T20:58:32.432Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const kalshiApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.kalshiApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/kalshi/Kalshi.yaml
6
- * Generated at: 2026-05-16T20:04:24.141Z
6
+ * Generated at: 2026-05-16T20:58:32.432Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.kalshiApiSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/limitless/Limitless.yaml
3
- * Generated at: 2026-05-16T20:04:24.190Z
3
+ * Generated at: 2026-05-16T20:58:32.472Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const limitlessApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.limitlessApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/limitless/Limitless.yaml
6
- * Generated at: 2026-05-16T20:04:24.190Z
6
+ * Generated at: 2026-05-16T20:58:32.472Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.limitlessApiSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/myriad/myriad.yaml
3
- * Generated at: 2026-05-16T20:04:24.203Z
3
+ * Generated at: 2026-05-16T20:58:32.484Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const myriadApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.myriadApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/myriad/myriad.yaml
6
- * Generated at: 2026-05-16T20:04:24.203Z
6
+ * Generated at: 2026-05-16T20:58:32.484Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.myriadApiSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/opinion/opinion-openapi.yaml
3
- * Generated at: 2026-05-16T20:04:24.208Z
3
+ * Generated at: 2026-05-16T20:58:32.490Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const opinionApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.opinionApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/opinion/opinion-openapi.yaml
6
- * Generated at: 2026-05-16T20:04:24.208Z
6
+ * Generated at: 2026-05-16T20:58:32.490Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.opinionApiSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketClobAPI.yaml
3
- * Generated at: 2026-05-16T20:04:24.148Z
3
+ * Generated at: 2026-05-16T20:58:32.442Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const polymarketClobSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.polymarketClobSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketClobAPI.yaml
6
- * Generated at: 2026-05-16T20:04:24.148Z
6
+ * Generated at: 2026-05-16T20:58:32.442Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketClobSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/Polymarket_Data_API.yaml
3
- * Generated at: 2026-05-16T20:04:24.167Z
3
+ * Generated at: 2026-05-16T20:58:32.455Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const polymarketDataSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.polymarketDataSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/Polymarket_Data_API.yaml
6
- * Generated at: 2026-05-16T20:04:24.167Z
6
+ * Generated at: 2026-05-16T20:58:32.455Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketDataSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketGammaAPI.yaml
3
- * Generated at: 2026-05-16T20:04:24.163Z
3
+ * Generated at: 2026-05-16T20:58:32.452Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const polymarketGammaSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.polymarketGammaSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketGammaAPI.yaml
6
- * Generated at: 2026-05-16T20:04:24.163Z
6
+ * Generated at: 2026-05-16T20:58:32.452Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketGammaSpec = {
@@ -8,6 +8,7 @@ import { ExchangeCredentials } from '../../BaseExchange';
8
8
  export declare class PolymarketAuth {
9
9
  private credentials;
10
10
  private signer?;
11
+ private signerAddress?;
11
12
  private clobClient?;
12
13
  private apiCreds?;
13
14
  private discoveredProxyAddress?;
@@ -5,7 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PolymarketAuth = void 0;
7
7
  const clob_client_v2_1 = require("@polymarket/clob-client-v2");
8
- const ethers_1 = require("ethers");
8
+ const viem_1 = require("viem");
9
+ const accounts_1 = require("viem/accounts");
10
+ const chains_1 = require("viem/chains");
9
11
  const axios_1 = __importDefault(require("axios"));
10
12
  const errors_1 = require("./errors");
11
13
  const DEFAULT_POLYMARKET_HOST = process.env.POLYMARKET_CLOB_URL || 'https://clob.polymarket.com';
@@ -23,6 +25,7 @@ const SIG_TYPE_POLY_1271 = 3; // Deposit wallet (ERC-1271, recommended for new A
23
25
  class PolymarketAuth {
24
26
  credentials;
25
27
  signer;
28
+ signerAddress;
26
29
  clobClient;
27
30
  apiCreds;
28
31
  discoveredProxyAddress;
@@ -40,9 +43,8 @@ class PolymarketAuth {
40
43
  if (privateKey.includes('\\n')) {
41
44
  privateKey = privateKey.replace(/\\n/g, '\n');
42
45
  }
43
- // Validate key format before passing to ethers. Solana wallets
44
- // (e.g. Phantom) export base58 ed25519 keys which are not
45
- // compatible with EVM. Detect early and give a clear message.
46
+ // Validate key format. Solana wallets (e.g. Phantom) export
47
+ // base58 ed25519 keys which are not compatible with EVM.
46
48
  const stripped = privateKey.startsWith('0x') ? privateKey.slice(2) : privateKey;
47
49
  if (!/^[0-9a-fA-F]{64}$/.test(stripped)) {
48
50
  throw new Error('Invalid private key format. Polymarket requires a 32-byte hex EVM private key ' +
@@ -50,7 +52,14 @@ class PolymarketAuth {
50
52
  'note that Solana keys are not compatible with EVM. Import your recovery phrase ' +
51
53
  'into an EVM wallet (e.g. MetaMask) to obtain the correct key.');
52
54
  }
53
- this.signer = new ethers_1.Wallet(privateKey);
55
+ const hexKey = (privateKey.startsWith('0x') ? privateKey : `0x${privateKey}`);
56
+ const account = (0, accounts_1.privateKeyToAccount)(hexKey);
57
+ this.signerAddress = account.address;
58
+ this.signer = (0, viem_1.createWalletClient)({
59
+ account,
60
+ chain: chains_1.polygon,
61
+ transport: (0, viem_1.http)(),
62
+ });
54
63
  }
55
64
  /**
56
65
  * Get or create API credentials using L1 authentication.
@@ -116,7 +125,7 @@ class PolymarketAuth {
116
125
  signatureType: this.discoveredSignatureType ?? SIG_TYPE_EOA
117
126
  };
118
127
  }
119
- const address = this.signer.address;
128
+ const address = this.signerAddress;
120
129
  try {
121
130
  // Polymarket Data API / Profiles endpoint
122
131
  // Path-based: https://data-api.polymarket.com/profiles/0x...
@@ -189,11 +198,7 @@ class PolymarketAuth {
189
198
  // Priority order:
190
199
  // 1. Discovery (Polymarket Data API) — authoritative when it works
191
200
  // 2. User-provided signatureType — respected as explicit override
192
- // 3. Default: Gnosis Safe (2) — correct for all Polymarket
193
- // accounts created since 2023
194
- //
195
- // The previous default was EOA (0), which silently returned $0
196
- // balances for the vast majority of wallets (#80).
201
+ // 3. Default: POLY_1271 (3) — deposit wallet, the V2 standard
197
202
  const sigTypeProvided = this.credentials.signatureType !== undefined && this.credentials.signatureType !== null;
198
203
  let proxyAddress = this.credentials.funderAddress || undefined;
199
204
  let signatureType = sigTypeProvided
@@ -223,13 +228,13 @@ class PolymarketAuth {
223
228
  }
224
229
  if (signatureType === undefined) {
225
230
  // Neither user nor discovery provided a value. Default to
226
- // Gnosis Safe — the modern Polymarket standard.
231
+ // Gnosis Safe — the standard Polymarket wallet type.
227
232
  signatureType = SIG_TYPE_GNOSIS_SAFE;
228
233
  }
229
234
  // Get API credentials (L1 auth)
230
235
  const apiCreds = await this.getApiCredentials();
231
236
  // Final addresses
232
- const signerAddress = this.signer.address;
237
+ const signerAddress = this.signerAddress;
233
238
  const finalProxyAddress = (proxyAddress || signerAddress);
234
239
  const finalSignatureType = signatureType;
235
240
  // Create L2-authenticated client
@@ -259,13 +264,13 @@ class PolymarketAuth {
259
264
  * Synchronous getter for credentials funder address.
260
265
  */
261
266
  getFunderAddress() {
262
- return this.credentials.funderAddress || this.signer.address;
267
+ return this.credentials.funderAddress || this.signerAddress;
263
268
  }
264
269
  /**
265
270
  * Get the signer's address.
266
271
  */
267
272
  getAddress() {
268
- return this.signer.address;
273
+ return this.signerAddress;
269
274
  }
270
275
  /**
271
276
  * Reset cached credentials and client (useful for testing or credential rotation).
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/probable/probable.yaml
3
- * Generated at: 2026-05-16T20:04:24.197Z
3
+ * Generated at: 2026-05-16T20:58:32.478Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const probableApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.probableApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/probable/probable.yaml
6
- * Generated at: 2026-05-16T20:04:24.197Z
6
+ * Generated at: 2026-05-16T20:58:32.478Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.probableApiSpec = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxt-core",
3
- "version": "2.41.5",
3
+ "version": "2.41.6",
4
4
  "description": "pmxt is a unified prediction market data API. The ccxt for prediction markets.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,8 +29,8 @@
29
29
  "test": "jest -c jest.config.js",
30
30
  "server": "tsx watch src/server/index.ts",
31
31
  "server:prod": "node dist/server/index.js",
32
- "generate:sdk:python": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g python -o ../sdks/python/generated --package-name pmxt_internal --additional-properties=projectName=pmxt-internal,packageVersion=2.41.5,library=urllib3",
33
- "generate:sdk:typescript": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g typescript-fetch -o ../sdks/typescript/generated --additional-properties=npmName=pmxtjs,npmVersion=2.41.5,supportsES6=true,typescriptThreePlus=true && node ../sdks/typescript/scripts/fix-generated.js",
32
+ "generate:sdk:python": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g python -o ../sdks/python/generated --package-name pmxt_internal --additional-properties=projectName=pmxt-internal,packageVersion=2.41.6,library=urllib3",
33
+ "generate:sdk:typescript": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g typescript-fetch -o ../sdks/typescript/generated --additional-properties=npmName=pmxtjs,npmVersion=2.41.6,supportsES6=true,typescriptThreePlus=true && node ../sdks/typescript/scripts/fix-generated.js",
34
34
  "fetch:openapi": "node scripts/fetch-openapi-specs.js",
35
35
  "extract:jsdoc": "node ../scripts/extract-jsdoc.js",
36
36
  "generate:docs": "npm run extract:jsdoc && node ../scripts/generate-api-docs.js",
@@ -56,6 +56,7 @@
56
56
  "cors": "^2.8.5",
57
57
  "dotenv": "^17.2.3",
58
58
  "ethers": "^5.8.0",
59
+ "viem": "^2.0.0",
59
60
  "express": "^5.2.1",
60
61
  "isows": "^1.0.6",
61
62
  "jest": "^30.2.0",