pmxt-core 2.52.0 → 2.53.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.
@@ -7,11 +7,11 @@ const errors_1 = require("../../errors");
7
7
  const PROGRAM_ERRORS = {
8
8
  6000: { type: 'bad_request', message: 'Unauthorized' },
9
9
  6001: { type: 'bad_request', message: 'Market not found' },
10
+ 6013: { type: 'bad_request', message: 'Betting is closed' }, // Changed from 6018
11
+ 6014: { type: 'bad_request', message: 'Betting is frozen' }, // Changed from 6040
10
12
  6015: { type: 'bad_request', message: 'Market is not open for betting' },
11
- 6018: { type: 'bad_request', message: 'Betting is closed' },
12
- 6020: { type: 'invalid_order', message: 'Bet amount too small' },
13
- 6040: { type: 'bad_request', message: 'Betting is frozen' },
14
- 6041: { type: 'invalid_order', message: 'Bet amount too large' },
13
+ 6023: { type: 'invalid_order', message: 'Bet amount too small' }, // Changed from 6020
14
+ 6024: { type: 'invalid_order', message: 'Bet amount too large' }, // Changed from 6041
15
15
  };
16
16
  /**
17
17
  * Maps Solana/Anchor errors to pmxt unified error types.
@@ -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-07-18T00:54:13.384Z
3
+ * Generated at: 2026-07-18T01:24:08.960Z
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-07-18T00:54:13.384Z
6
+ * Generated at: 2026-07-18T01:24:08.960Z
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-07-18T00:54:13.429Z
3
+ * Generated at: 2026-07-18T01:24:08.996Z
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-07-18T00:54:13.429Z
6
+ * Generated at: 2026-07-18T01:24:08.996Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.limitlessApiSpec = {
@@ -173,39 +173,38 @@ function mapIntervalToFidelity(interval) {
173
173
  async function paginateLimitlessMarkets(fetcher, requestedLimit, sortBy) {
174
174
  const PAGE_SIZE = 25;
175
175
  const targetLimit = requestedLimit || PAGE_SIZE;
176
- const MAX_PAGES = 20; // Safety limit to prevent infinite loops
177
- if (targetLimit <= PAGE_SIZE) {
176
+ // Over-fetch by 70% because ~30% of markets lack tokens and get filtered out
177
+ // This ensures enough raw markets survive the token filter
178
+ const OVER_FETCH_FACTOR = 1.7;
179
+ const rawTargetLimit = Math.ceil(targetLimit * OVER_FETCH_FACTOR);
180
+ if (rawTargetLimit <= PAGE_SIZE) {
178
181
  const response = await fetcher.getActiveMarkets({
179
- limit: targetLimit,
182
+ limit: rawTargetLimit,
180
183
  page: 1,
181
184
  sortBy: sortBy,
182
185
  });
183
186
  return response.data || [];
184
187
  }
185
- // Fetch more pages than theoretically needed to account for filtering
186
- // ~33% of markets lack tokens and get filtered out, so we over-fetch
187
- // by 70% to ensure we get enough valid markets after filtering
188
- const estimatedPages = Math.ceil(targetLimit / PAGE_SIZE);
189
- const pagesWithBuffer = Math.min(Math.ceil(estimatedPages * 1.7), MAX_PAGES);
190
- const pageNumbers = [];
191
- for (let i = 1; i <= pagesWithBuffer; i++) {
192
- pageNumbers.push(i);
188
+ // Sequential pagination using totalMarketsCount
189
+ const allMarkets = [];
190
+ let page = 1;
191
+ const MAX_PAGES = 50; // Safety limit
192
+ while (page <= MAX_PAGES && allMarkets.length < rawTargetLimit) {
193
+ const response = await fetcher.getActiveMarkets({
194
+ limit: PAGE_SIZE,
195
+ page: page,
196
+ sortBy: sortBy,
197
+ });
198
+ const markets = response.data || [];
199
+ if (markets.length === 0)
200
+ break;
201
+ allMarkets.push(...markets);
202
+ // Use totalMarketsCount to check if we're done
203
+ const totalCount = response.totalMarketsCount;
204
+ if (totalCount && allMarkets.length >= totalCount)
205
+ break;
206
+ page++;
193
207
  }
194
- const pages = await Promise.all(pageNumbers.map(async (page) => {
195
- try {
196
- const response = await fetcher.getActiveMarkets({
197
- limit: PAGE_SIZE,
198
- page: page,
199
- sortBy: sortBy,
200
- });
201
- return response.data || [];
202
- }
203
- catch (e) {
204
- return [];
205
- }
206
- }));
207
- const allMarkets = pages.flat();
208
- // Don't slice here - let the caller handle limiting after filtering
209
- // This ensures we return enough raw markets for the caller to filter
208
+ // Return raw markets - caller will filter tokens and apply actual limit
210
209
  return allMarkets;
211
210
  }
@@ -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-07-18T00:54:13.441Z
3
+ * Generated at: 2026-07-18T01:24:09.008Z
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-07-18T00:54:13.441Z
6
+ * Generated at: 2026-07-18T01:24:09.008Z
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-07-18T00:54:13.446Z
3
+ * Generated at: 2026-07-18T01:24:09.013Z
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-07-18T00:54:13.446Z
6
+ * Generated at: 2026-07-18T01:24:09.013Z
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-07-18T00:54:13.392Z
3
+ * Generated at: 2026-07-18T01:24:08.966Z
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-07-18T00:54:13.392Z
6
+ * Generated at: 2026-07-18T01:24:08.966Z
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-07-18T00:54:13.410Z
3
+ * Generated at: 2026-07-18T01:24:08.979Z
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-07-18T00:54:13.410Z
6
+ * Generated at: 2026-07-18T01:24:08.979Z
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-07-18T00:54:13.407Z
3
+ * Generated at: 2026-07-18T01:24:08.976Z
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-07-18T00:54:13.407Z
6
+ * Generated at: 2026-07-18T01:24:08.976Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketGammaSpec = {
@@ -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-07-18T00:54:13.436Z
3
+ * Generated at: 2026-07-18T01:24:09.002Z
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-07-18T00:54:13.436Z
6
+ * Generated at: 2026-07-18T01:24:09.002Z
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.52.0",
3
+ "version": "2.53.0",
4
4
  "description": "Local sidecar API for supported 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.52.0,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.52.0,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.53.0,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.53.0,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",