pmxt-core 2.48.0 → 2.48.2
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/exchanges/kalshi/api.d.ts +1 -1
- package/dist/exchanges/kalshi/api.js +1 -1
- package/dist/exchanges/limitless/api.d.ts +1 -1
- package/dist/exchanges/limitless/api.js +1 -1
- package/dist/exchanges/limitless/client.js +2 -1
- package/dist/exchanges/limitless/index.js +1 -1
- package/dist/exchanges/limitless/utils.d.ts +4 -0
- package/dist/exchanges/limitless/utils.js +18 -0
- package/dist/exchanges/myriad/api.d.ts +1 -1
- package/dist/exchanges/myriad/api.js +1 -1
- package/dist/exchanges/opinion/api.d.ts +1 -1
- package/dist/exchanges/opinion/api.js +1 -1
- package/dist/exchanges/polymarket/api-clob.d.ts +1 -1
- package/dist/exchanges/polymarket/api-clob.js +1 -1
- package/dist/exchanges/polymarket/api-data.d.ts +1 -1
- package/dist/exchanges/polymarket/api-data.js +1 -1
- package/dist/exchanges/polymarket/api-gamma.d.ts +1 -1
- package/dist/exchanges/polymarket/api-gamma.js +1 -1
- package/dist/exchanges/probable/api.d.ts +1 -1
- package/dist/exchanges/probable/api.js +1 -1
- package/dist/server/app.js +20 -3
- package/dist/server/openapi.yaml +1 -13
- package/package.json +3 -3
|
@@ -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-
|
|
3
|
+
* Generated at: 2026-06-01T12:08:37.100Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T12:08:37.100Z
|
|
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-
|
|
3
|
+
* Generated at: 2026-06-01T12:08:37.142Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T12:08:37.142Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.limitlessApiSpec = {
|
|
@@ -4,6 +4,7 @@ exports.LimitlessClient = void 0;
|
|
|
4
4
|
const sdk_1 = require("@limitless-exchange/sdk");
|
|
5
5
|
const ethers_1 = require("ethers");
|
|
6
6
|
const config_1 = require("./config");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
7
8
|
const DEFAULT_LIMITLESS_API_URL = process.env.LIMITLESS_BASE_URL || 'https://api.limitless.exchange';
|
|
8
9
|
/**
|
|
9
10
|
* Wrapper client for Limitless Exchange using the official SDK.
|
|
@@ -315,7 +316,7 @@ class LimitlessClient {
|
|
|
315
316
|
}
|
|
316
317
|
const balance = await contract.balanceOf(this.signer.address);
|
|
317
318
|
const decimals = await contract.decimals(); // Should be 6
|
|
318
|
-
return
|
|
319
|
+
return (0, utils_1.scaledIntegerToNumber)(balance, Number(decimals));
|
|
319
320
|
}
|
|
320
321
|
}
|
|
321
322
|
exports.LimitlessClient = LimitlessClient;
|
|
@@ -510,7 +510,7 @@ class LimitlessExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
510
510
|
const usdcContract = new ethers_1.Contract(usdcAddress, ['function balanceOf(address) view returns (uint256)'], provider);
|
|
511
511
|
const rawBalance = await usdcContract.balanceOf(targetAddress);
|
|
512
512
|
const USDC_DECIMALS = 6;
|
|
513
|
-
const total =
|
|
513
|
+
const total = (0, utils_1.scaledIntegerToNumber)(rawBalance, USDC_DECIMALS);
|
|
514
514
|
return [{
|
|
515
515
|
currency: 'USDC',
|
|
516
516
|
total,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { UnifiedMarket, CandleInterval } from '../../types';
|
|
2
2
|
export declare const DEFAULT_LIMITLESS_API_URL = "https://api.limitless.exchange";
|
|
3
|
+
export declare function scaledIntegerToNumber(value: bigint | {
|
|
4
|
+
toBigInt?: () => bigint;
|
|
5
|
+
toString(): string;
|
|
6
|
+
}, decimals: number): number;
|
|
3
7
|
export interface LimitlessMarketContext {
|
|
4
8
|
eventId?: string;
|
|
5
9
|
eventTitle?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_LIMITLESS_API_URL = void 0;
|
|
4
|
+
exports.scaledIntegerToNumber = scaledIntegerToNumber;
|
|
4
5
|
exports.mapMarketToUnified = mapMarketToUnified;
|
|
5
6
|
exports.mapIntervalToFidelity = mapIntervalToFidelity;
|
|
6
7
|
exports.paginateLimitlessMarkets = paginateLimitlessMarkets;
|
|
@@ -22,6 +23,23 @@ const LIMITLESS_PROMOTED_MARKET_KEYS = [
|
|
|
22
23
|
'__pmxtEventId', '__pmxtEventTitle', '__pmxtEventDescription',
|
|
23
24
|
'__pmxtCategories', '__pmxtTags',
|
|
24
25
|
];
|
|
26
|
+
function scaledIntegerToNumber(value, decimals) {
|
|
27
|
+
if (!Number.isInteger(decimals) || decimals < 0) {
|
|
28
|
+
throw new Error(`[limitless] Invalid token decimals: ${decimals}`);
|
|
29
|
+
}
|
|
30
|
+
const raw = typeof value === 'bigint'
|
|
31
|
+
? value
|
|
32
|
+
: typeof value.toBigInt === 'function'
|
|
33
|
+
? value.toBigInt()
|
|
34
|
+
: BigInt(value.toString());
|
|
35
|
+
const sign = raw < 0n ? -1 : 1;
|
|
36
|
+
const abs = raw < 0n ? -raw : raw;
|
|
37
|
+
const scale = 10n ** BigInt(decimals);
|
|
38
|
+
const whole = abs / scale;
|
|
39
|
+
const fraction = abs % scale;
|
|
40
|
+
const amount = Number(whole) + (Number(fraction) / Number(scale));
|
|
41
|
+
return sign * amount;
|
|
42
|
+
}
|
|
25
43
|
function mapMarketToUnified(market, context = {}) {
|
|
26
44
|
if (!market)
|
|
27
45
|
return null;
|
|
@@ -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-
|
|
3
|
+
* Generated at: 2026-06-01T12:08:37.157Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T12:08:37.157Z
|
|
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-
|
|
3
|
+
* Generated at: 2026-06-01T12:08:37.162Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T12:08:37.162Z
|
|
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-
|
|
3
|
+
* Generated at: 2026-06-01T12:08:37.108Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T12:08:37.108Z
|
|
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-
|
|
3
|
+
* Generated at: 2026-06-01T12:08:37.121Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T12:08:37.121Z
|
|
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-
|
|
3
|
+
* Generated at: 2026-06-01T12:08:37.119Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T12:08:37.119Z
|
|
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-
|
|
3
|
+
* Generated at: 2026-06-01T12:08:37.151Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T12:08:37.151Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.probableApiSpec = {
|
package/dist/server/app.js
CHANGED
|
@@ -384,13 +384,30 @@ function createApp(options = {}) {
|
|
|
384
384
|
});
|
|
385
385
|
// POST /api/:exchange/:method
|
|
386
386
|
//
|
|
387
|
-
//
|
|
387
|
+
// Supports two calling conventions:
|
|
388
|
+
// - Envelope: { args: [...], credentials? } — original RPC shape, used by SDKs
|
|
389
|
+
// - Flat body: { slug: "wta", limit: 3, ... } — raw-curl / documentation examples
|
|
390
|
+
//
|
|
391
|
+
// When `args` is a valid array it is used directly (envelope path).
|
|
392
|
+
// When the body is a plain object without an `args` array, the body minus
|
|
393
|
+
// the reserved envelope keys (`args`, `credentials`) becomes args[0].
|
|
388
394
|
// Accepts every method, including reads — so pre-existing clients
|
|
389
395
|
// that POST reads keep working forever.
|
|
390
396
|
app.post("/api/:exchange/:method", async (req, res, next) => {
|
|
391
397
|
const methodName = req.params.method;
|
|
392
|
-
const
|
|
393
|
-
const credentials =
|
|
398
|
+
const body = req.body;
|
|
399
|
+
const credentials = body.credentials;
|
|
400
|
+
let args;
|
|
401
|
+
if (Array.isArray(body.args)) {
|
|
402
|
+
args = body.args;
|
|
403
|
+
}
|
|
404
|
+
else if (body && typeof body === 'object' && !Array.isArray(body)) {
|
|
405
|
+
const { args: _ignored, credentials: _creds, ...rest } = body;
|
|
406
|
+
args = Object.keys(rest).length > 0 ? [rest] : [];
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
args = [];
|
|
410
|
+
}
|
|
394
411
|
await dispatchMethod(req, res, next, methodName, args, credentials);
|
|
395
412
|
});
|
|
396
413
|
// Error handler
|
package/dist/server/openapi.yaml
CHANGED
|
@@ -383,19 +383,7 @@ paths:
|
|
|
383
383
|
summary: Fetch Series
|
|
384
384
|
operationId: fetchSeries
|
|
385
385
|
parameters:
|
|
386
|
-
-
|
|
387
|
-
name: exchange
|
|
388
|
-
schema:
|
|
389
|
-
type: string
|
|
390
|
-
enum:
|
|
391
|
-
- polymarket
|
|
392
|
-
- kalshi
|
|
393
|
-
- kalshi-demo
|
|
394
|
-
- opinion
|
|
395
|
-
- polymarket_us
|
|
396
|
-
- router
|
|
397
|
-
required: true
|
|
398
|
-
description: The prediction market exchange to target.
|
|
386
|
+
- $ref: '#/components/parameters/ExchangeParam'
|
|
399
387
|
responses:
|
|
400
388
|
'200':
|
|
401
389
|
description: Fetch Series response
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxt-core",
|
|
3
|
-
"version": "2.48.
|
|
3
|
+
"version": "2.48.2",
|
|
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.48.
|
|
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.48.
|
|
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.48.2,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.48.2,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",
|