pmxt-core 2.27.9 → 2.27.10

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-04-10T16:27:26.419Z
3
+ * Generated at: 2026-04-11T09:39:36.747Z
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-04-10T16:27:26.419Z
6
+ * Generated at: 2026-04-11T09:39:36.747Z
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-04-10T16:27:26.467Z
3
+ * Generated at: 2026-04-11T09:39:36.781Z
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-04-10T16:27:26.467Z
6
+ * Generated at: 2026-04-11T09:39:36.781Z
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-04-10T16:27:26.482Z
3
+ * Generated at: 2026-04-11T09:39:36.791Z
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-04-10T16:27:26.482Z
6
+ * Generated at: 2026-04-11T09:39:36.791Z
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-04-10T16:27:26.487Z
3
+ * Generated at: 2026-04-11T09:39:36.796Z
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-04-10T16:27:26.487Z
6
+ * Generated at: 2026-04-11T09:39:36.796Z
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-04-10T16:27:26.427Z
3
+ * Generated at: 2026-04-11T09:39:36.751Z
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-04-10T16:27:26.427Z
6
+ * Generated at: 2026-04-11T09:39:36.751Z
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-04-10T16:27:26.445Z
3
+ * Generated at: 2026-04-11T09:39:36.765Z
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-04-10T16:27:26.445Z
6
+ * Generated at: 2026-04-11T09:39:36.765Z
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-04-10T16:27:26.441Z
3
+ * Generated at: 2026-04-11T09:39:36.762Z
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-04-10T16:27:26.441Z
6
+ * Generated at: 2026-04-11T09:39:36.762Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketGammaSpec = {
@@ -10,6 +10,11 @@ const axios_1 = __importDefault(require("axios"));
10
10
  const errors_1 = require("./errors");
11
11
  const POLYMARKET_HOST = 'https://clob.polymarket.com';
12
12
  const POLYGON_CHAIN_ID = 137;
13
+ // Polymarket CLOB signature types — determines how the CLOB API
14
+ // resolves the on-chain address holding the user's funds.
15
+ const SIG_TYPE_EOA = 0;
16
+ const SIG_TYPE_POLY_PROXY = 1;
17
+ const SIG_TYPE_GNOSIS_SAFE = 2;
13
18
  /**
14
19
  * Manages Polymarket authentication and CLOB client initialization.
15
20
  * Handles both L1 (wallet-based) and L2 (API credentials) authentication.
@@ -101,7 +106,7 @@ class PolymarketAuth {
101
106
  if (this.discoveredProxyAddress) {
102
107
  return {
103
108
  proxyAddress: this.discoveredProxyAddress,
104
- signatureType: this.discoveredSignatureType ?? 0
109
+ signatureType: this.discoveredSignatureType ?? SIG_TYPE_EOA
105
110
  };
106
111
  }
107
112
  const address = this.signer.address;
@@ -118,7 +123,7 @@ class PolymarketAuth {
118
123
  // Determine signature type.
119
124
  // Polymarket usually uses 1 for their own proxy and 2 for Gnosis Safe (which is what their new profiles use).
120
125
  // If it's a proxy address but we don't know the type, 1 is a safe default for Polymarket.
121
- this.discoveredSignatureType = profile.isGnosisSafe ? 2 : 1;
126
+ this.discoveredSignatureType = profile.isGnosisSafe ? SIG_TYPE_GNOSIS_SAFE : SIG_TYPE_POLY_PROXY;
122
127
  // console.log(`[PolymarketAuth] Auto-discovered proxy for ${address}: ${this.discoveredProxyAddress} (Type: ${this.discoveredSignatureType})`);
123
128
  return {
124
129
  proxyAddress: this.discoveredProxyAddress,
@@ -132,7 +137,7 @@ class PolymarketAuth {
132
137
  // Fallback to EOA if discovery fails
133
138
  return {
134
139
  proxyAddress: address,
135
- signatureType: 0
140
+ signatureType: SIG_TYPE_EOA
136
141
  };
137
142
  }
138
143
  /**
@@ -140,23 +145,22 @@ class PolymarketAuth {
140
145
  */
141
146
  mapSignatureType(type) {
142
147
  if (type === undefined || type === null)
143
- return 0;
148
+ return SIG_TYPE_EOA;
144
149
  if (typeof type === 'number')
145
150
  return type;
146
151
  const normalized = type.toLowerCase().replace(/[^a-z0-9]/g, '');
147
152
  switch (normalized) {
148
153
  case 'eoa':
149
- return 0;
154
+ return SIG_TYPE_EOA;
150
155
  case 'polyproxy':
151
156
  case 'polymarketproxy':
152
- return 1;
157
+ return SIG_TYPE_POLY_PROXY;
153
158
  case 'gnosissafe':
154
159
  case 'safe':
155
- return 2;
160
+ return SIG_TYPE_GNOSIS_SAFE;
156
161
  default:
157
- // If it's a numeric string, parse it
158
162
  const parsed = parseInt(normalized);
159
- return isNaN(parsed) ? 0 : parsed;
163
+ return isNaN(parsed) ? SIG_TYPE_EOA : parsed;
160
164
  }
161
165
  }
162
166
  /**
@@ -168,26 +172,24 @@ class PolymarketAuth {
168
172
  if (this.clobClient) {
169
173
  return this.clobClient;
170
174
  }
171
- // 1. Determine proxy and signature type early.
175
+ // 1. Determine proxy and signature type.
172
176
  //
173
- // Important: if signatureType is not provided we MUST run discovery
174
- // even when funderAddress is provided. Previously this branch was
175
- // skipped whenever funderAddress was set, which silently defaulted
176
- // signatureType to 0 (EOA). For wallets whose funds live on a Gnosis
177
- // Safe (the modern Polymarket onboarding default) the CLOB then
178
- // reports balance "0" instead of the real value, with no error.
177
+ // Priority order:
178
+ // 1. Discovery (Polymarket Data API) authoritative when it works
179
+ // 2. User-provided signatureType respected as explicit override
180
+ // 3. Default: Gnosis Safe (2) correct for all Polymarket
181
+ // accounts created since 2023
182
+ //
183
+ // The previous default was EOA (0), which silently returned $0
184
+ // balances for the vast majority of wallets (#80).
179
185
  const sigTypeProvided = this.credentials.signatureType !== undefined && this.credentials.signatureType !== null;
180
186
  let proxyAddress = this.credentials.funderAddress || undefined;
181
187
  let signatureType = sigTypeProvided
182
188
  ? this.mapSignatureType(this.credentials.signatureType)
183
189
  : undefined;
184
- // Run discovery if either piece is missing. Note: discoverProxy()
185
- // returns a synthetic { proxyAddress: signerEOA, signatureType: 0 }
186
- // fallback when its HTTP call fails — that fallback should NOT be
187
- // used to populate signatureType when funderAddress is already set,
188
- // because it would silently assign EOA semantics to a Gnosis Safe.
189
- let discoverySucceeded = false;
190
+ // Run discovery when we need to fill in missing values.
190
191
  if (!proxyAddress || signatureType === undefined) {
192
+ let discoverySucceeded = false;
191
193
  try {
192
194
  const discovered = await this.discoverProxy();
193
195
  discoverySucceeded =
@@ -201,23 +203,19 @@ class PolymarketAuth {
201
203
  }
202
204
  }
203
205
  catch {
204
- // Discovery failure is handled by the heuristic below.
206
+ // Discovery failure fall through to default below.
205
207
  }
206
208
  }
209
+ if (signatureType === undefined) {
210
+ // Neither user nor discovery provided a value. Default to
211
+ // Gnosis Safe — the modern Polymarket standard.
212
+ signatureType = SIG_TYPE_GNOSIS_SAFE;
213
+ }
207
214
  // Get API credentials (L1 auth)
208
215
  const apiCreds = await this.getApiCredentials();
209
- // 3. Defaults
216
+ // Final addresses
210
217
  const signerAddress = this.signer.address;
211
218
  const finalProxyAddress = (proxyAddress || signerAddress);
212
- // If signature type is still unknown, infer from address relationship:
213
- // when the funder differs from the signer EOA, the funder must be a
214
- // proxy/safe — default to Gnosis Safe (2), which is what Polymarket
215
- // has created for new accounts since 2023. Users on the legacy
216
- // Polymarket Proxy (1) need to set signatureType explicitly.
217
- if (signatureType === undefined) {
218
- signatureType =
219
- finalProxyAddress.toLowerCase() !== signerAddress.toLowerCase() ? 2 : 0;
220
- }
221
219
  const finalSignatureType = signatureType;
222
220
  // Create L2-authenticated client
223
221
  // console.log(`[PolymarketAuth] Initializing ClobClient | Signer: ${signerAddress} | Funder: ${finalProxyAddress} | SigType: ${finalSignatureType}`);
@@ -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-04-10T16:27:26.474Z
3
+ * Generated at: 2026-04-11T09:39:36.786Z
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-04-10T16:27:26.474Z
6
+ * Generated at: 2026-04-11T09:39:36.786Z
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.27.9",
3
+ "version": "2.27.10",
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,15 +29,16 @@
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.27.9,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.27.9,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.27.10,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.27.10,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",
37
37
  "generate:openapi": "node scripts/generate-openapi.js",
38
38
  "generate:python-exchanges": "node scripts/generate-python-exchanges.js",
39
39
  "generate:compliance": "node scripts/generate-compliance.js",
40
- "generate:sdk:all": "npm run generate:openapi && npm run generate:sdk:python && npm run generate:python-exchanges && npm run generate:sdk:typescript && npm run generate:docs && npm run generate:compliance"
40
+ "generate:mintlify": "node ../scripts/generate-mintlify-docs.js",
41
+ "generate:sdk:all": "npm run generate:openapi && npm run generate:sdk:python && npm run generate:python-exchanges && npm run generate:sdk:typescript && npm run generate:docs && npm run generate:mintlify && npm run generate:compliance"
41
42
  },
42
43
  "keywords": [],
43
44
  "author": "",