pmxtjs 2.43.24 → 2.43.25
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/esm/pmxt/client.d.ts +15 -1
- package/dist/esm/pmxt/client.js +39 -0
- package/dist/pmxt/client.d.ts +15 -1
- package/dist/pmxt/client.js +39 -0
- package/generated/package.json +1 -1
- package/package.json +2 -2
- package/pmxt/client.ts +40 -1
|
@@ -150,9 +150,16 @@ export declare abstract class Exchange {
|
|
|
150
150
|
* @internal — shared transport used by every generated read method.
|
|
151
151
|
*/
|
|
152
152
|
protected sidecarReadRequest(methodName: string, query: Record<string, unknown>, args: unknown[]): Promise<any>;
|
|
153
|
+
/**
|
|
154
|
+
* Dispatch a sidecar POST method with positional args and credentials.
|
|
155
|
+
*
|
|
156
|
+
* @internal - shared transport for hand-maintained methods that should
|
|
157
|
+
* never use the GET read path.
|
|
158
|
+
*/
|
|
159
|
+
protected sidecarPostRequest(methodName: string, args: unknown[]): Promise<any>;
|
|
153
160
|
loadMarkets(reload?: boolean): Promise<Record<string, UnifiedMarket>>;
|
|
154
161
|
fetchMarkets(params?: MarketFetchParams): Promise<UnifiedMarket[]>;
|
|
155
|
-
fetchMarketsPaginated(params?:
|
|
162
|
+
fetchMarketsPaginated(params?: any): Promise<PaginatedMarketsResult>;
|
|
156
163
|
fetchEvents(params?: EventFetchParams): Promise<UnifiedEvent[]>;
|
|
157
164
|
fetchMarket(params?: MarketFetchParams): Promise<UnifiedMarket>;
|
|
158
165
|
fetchEvent(params?: EventFetchParams): Promise<UnifiedEvent>;
|
|
@@ -480,6 +487,13 @@ export interface PolymarketOptions {
|
|
|
480
487
|
}
|
|
481
488
|
export declare class Polymarket extends Exchange {
|
|
482
489
|
constructor(options?: PolymarketOptions);
|
|
490
|
+
/**
|
|
491
|
+
* Initialize Polymarket L2 API credentials for implicit API signing.
|
|
492
|
+
*
|
|
493
|
+
* Call this before private Polymarket implicit-API endpoints when the
|
|
494
|
+
* underlying CLOB credentials have not been created yet.
|
|
495
|
+
*/
|
|
496
|
+
initAuth(): Promise<void>;
|
|
483
497
|
}
|
|
484
498
|
/**
|
|
485
499
|
* Kalshi exchange client.
|
package/dist/esm/pmxt/client.js
CHANGED
|
@@ -463,6 +463,27 @@ export class Exchange {
|
|
|
463
463
|
}
|
|
464
464
|
return response.json();
|
|
465
465
|
}
|
|
466
|
+
/**
|
|
467
|
+
* Dispatch a sidecar POST method with positional args and credentials.
|
|
468
|
+
*
|
|
469
|
+
* @internal - shared transport for hand-maintained methods that should
|
|
470
|
+
* never use the GET read path.
|
|
471
|
+
*/
|
|
472
|
+
async sidecarPostRequest(methodName, args) {
|
|
473
|
+
const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/${methodName}`, {
|
|
474
|
+
method: 'POST',
|
|
475
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
476
|
+
body: JSON.stringify({ args, credentials: this.getCredentials() }),
|
|
477
|
+
});
|
|
478
|
+
if (!response.ok) {
|
|
479
|
+
const body = await response.json().catch(() => ({}));
|
|
480
|
+
if (body.error && typeof body.error === "object") {
|
|
481
|
+
throw fromServerError(body.error);
|
|
482
|
+
}
|
|
483
|
+
throw new PmxtError(body.error?.message || response.statusText);
|
|
484
|
+
}
|
|
485
|
+
return response.json();
|
|
486
|
+
}
|
|
466
487
|
// BEGIN GENERATED METHODS
|
|
467
488
|
async loadMarkets(reload = false) {
|
|
468
489
|
await this.initPromise;
|
|
@@ -2219,6 +2240,24 @@ export class Polymarket extends Exchange {
|
|
|
2219
2240
|
};
|
|
2220
2241
|
super("polymarket", polyOptions);
|
|
2221
2242
|
}
|
|
2243
|
+
/**
|
|
2244
|
+
* Initialize Polymarket L2 API credentials for implicit API signing.
|
|
2245
|
+
*
|
|
2246
|
+
* Call this before private Polymarket implicit-API endpoints when the
|
|
2247
|
+
* underlying CLOB credentials have not been created yet.
|
|
2248
|
+
*/
|
|
2249
|
+
async initAuth() {
|
|
2250
|
+
await this.initPromise;
|
|
2251
|
+
try {
|
|
2252
|
+
const json = await this.sidecarPostRequest('initAuth', []);
|
|
2253
|
+
this.handleResponse(json);
|
|
2254
|
+
}
|
|
2255
|
+
catch (error) {
|
|
2256
|
+
if (error instanceof PmxtError)
|
|
2257
|
+
throw error;
|
|
2258
|
+
throw new PmxtError(`Failed to initAuth: ${error}`);
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2222
2261
|
}
|
|
2223
2262
|
/**
|
|
2224
2263
|
* Kalshi exchange client.
|
package/dist/pmxt/client.d.ts
CHANGED
|
@@ -150,9 +150,16 @@ export declare abstract class Exchange {
|
|
|
150
150
|
* @internal — shared transport used by every generated read method.
|
|
151
151
|
*/
|
|
152
152
|
protected sidecarReadRequest(methodName: string, query: Record<string, unknown>, args: unknown[]): Promise<any>;
|
|
153
|
+
/**
|
|
154
|
+
* Dispatch a sidecar POST method with positional args and credentials.
|
|
155
|
+
*
|
|
156
|
+
* @internal - shared transport for hand-maintained methods that should
|
|
157
|
+
* never use the GET read path.
|
|
158
|
+
*/
|
|
159
|
+
protected sidecarPostRequest(methodName: string, args: unknown[]): Promise<any>;
|
|
153
160
|
loadMarkets(reload?: boolean): Promise<Record<string, UnifiedMarket>>;
|
|
154
161
|
fetchMarkets(params?: MarketFetchParams): Promise<UnifiedMarket[]>;
|
|
155
|
-
fetchMarketsPaginated(params?:
|
|
162
|
+
fetchMarketsPaginated(params?: any): Promise<PaginatedMarketsResult>;
|
|
156
163
|
fetchEvents(params?: EventFetchParams): Promise<UnifiedEvent[]>;
|
|
157
164
|
fetchMarket(params?: MarketFetchParams): Promise<UnifiedMarket>;
|
|
158
165
|
fetchEvent(params?: EventFetchParams): Promise<UnifiedEvent>;
|
|
@@ -480,6 +487,13 @@ export interface PolymarketOptions {
|
|
|
480
487
|
}
|
|
481
488
|
export declare class Polymarket extends Exchange {
|
|
482
489
|
constructor(options?: PolymarketOptions);
|
|
490
|
+
/**
|
|
491
|
+
* Initialize Polymarket L2 API credentials for implicit API signing.
|
|
492
|
+
*
|
|
493
|
+
* Call this before private Polymarket implicit-API endpoints when the
|
|
494
|
+
* underlying CLOB credentials have not been created yet.
|
|
495
|
+
*/
|
|
496
|
+
initAuth(): Promise<void>;
|
|
483
497
|
}
|
|
484
498
|
/**
|
|
485
499
|
* Kalshi exchange client.
|
package/dist/pmxt/client.js
CHANGED
|
@@ -466,6 +466,27 @@ class Exchange {
|
|
|
466
466
|
}
|
|
467
467
|
return response.json();
|
|
468
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* Dispatch a sidecar POST method with positional args and credentials.
|
|
471
|
+
*
|
|
472
|
+
* @internal - shared transport for hand-maintained methods that should
|
|
473
|
+
* never use the GET read path.
|
|
474
|
+
*/
|
|
475
|
+
async sidecarPostRequest(methodName, args) {
|
|
476
|
+
const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/${methodName}`, {
|
|
477
|
+
method: 'POST',
|
|
478
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
479
|
+
body: JSON.stringify({ args, credentials: this.getCredentials() }),
|
|
480
|
+
});
|
|
481
|
+
if (!response.ok) {
|
|
482
|
+
const body = await response.json().catch(() => ({}));
|
|
483
|
+
if (body.error && typeof body.error === "object") {
|
|
484
|
+
throw (0, errors_js_1.fromServerError)(body.error);
|
|
485
|
+
}
|
|
486
|
+
throw new errors_js_1.PmxtError(body.error?.message || response.statusText);
|
|
487
|
+
}
|
|
488
|
+
return response.json();
|
|
489
|
+
}
|
|
469
490
|
// BEGIN GENERATED METHODS
|
|
470
491
|
async loadMarkets(reload = false) {
|
|
471
492
|
await this.initPromise;
|
|
@@ -2223,6 +2244,24 @@ class Polymarket extends Exchange {
|
|
|
2223
2244
|
};
|
|
2224
2245
|
super("polymarket", polyOptions);
|
|
2225
2246
|
}
|
|
2247
|
+
/**
|
|
2248
|
+
* Initialize Polymarket L2 API credentials for implicit API signing.
|
|
2249
|
+
*
|
|
2250
|
+
* Call this before private Polymarket implicit-API endpoints when the
|
|
2251
|
+
* underlying CLOB credentials have not been created yet.
|
|
2252
|
+
*/
|
|
2253
|
+
async initAuth() {
|
|
2254
|
+
await this.initPromise;
|
|
2255
|
+
try {
|
|
2256
|
+
const json = await this.sidecarPostRequest('initAuth', []);
|
|
2257
|
+
this.handleResponse(json);
|
|
2258
|
+
}
|
|
2259
|
+
catch (error) {
|
|
2260
|
+
if (error instanceof errors_js_1.PmxtError)
|
|
2261
|
+
throw error;
|
|
2262
|
+
throw new errors_js_1.PmxtError(`Failed to initAuth: ${error}`);
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2226
2265
|
}
|
|
2227
2266
|
exports.Polymarket = Polymarket;
|
|
2228
2267
|
/**
|
package/generated/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxtjs",
|
|
3
|
-
"version": "2.43.
|
|
3
|
+
"version": "2.43.25",
|
|
4
4
|
"description": "Unified prediction market data API - The ccxt for prediction markets",
|
|
5
5
|
"author": "PMXT Contributors",
|
|
6
6
|
"repository": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"unified"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"pmxt-core": "2.43.
|
|
46
|
+
"pmxt-core": "2.43.25",
|
|
47
47
|
"ws": "^8.18.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
package/pmxt/client.ts
CHANGED
|
@@ -610,6 +610,28 @@ export abstract class Exchange {
|
|
|
610
610
|
return response.json();
|
|
611
611
|
}
|
|
612
612
|
|
|
613
|
+
/**
|
|
614
|
+
* Dispatch a sidecar POST method with positional args and credentials.
|
|
615
|
+
*
|
|
616
|
+
* @internal - shared transport for hand-maintained methods that should
|
|
617
|
+
* never use the GET read path.
|
|
618
|
+
*/
|
|
619
|
+
protected async sidecarPostRequest(methodName: string, args: unknown[]): Promise<any> {
|
|
620
|
+
const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/${methodName}`, {
|
|
621
|
+
method: 'POST',
|
|
622
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
623
|
+
body: JSON.stringify({ args, credentials: this.getCredentials() }),
|
|
624
|
+
});
|
|
625
|
+
if (!response.ok) {
|
|
626
|
+
const body = await response.json().catch(() => ({}));
|
|
627
|
+
if (body.error && typeof body.error === "object") {
|
|
628
|
+
throw fromServerError(body.error);
|
|
629
|
+
}
|
|
630
|
+
throw new PmxtError(body.error?.message || response.statusText);
|
|
631
|
+
}
|
|
632
|
+
return response.json();
|
|
633
|
+
}
|
|
634
|
+
|
|
613
635
|
// BEGIN GENERATED METHODS
|
|
614
636
|
|
|
615
637
|
async loadMarkets(reload: boolean = false): Promise<Record<string, UnifiedMarket>> {
|
|
@@ -668,7 +690,7 @@ export abstract class Exchange {
|
|
|
668
690
|
}
|
|
669
691
|
}
|
|
670
692
|
|
|
671
|
-
async fetchMarketsPaginated(params?:
|
|
693
|
+
async fetchMarketsPaginated(params?: any): Promise<PaginatedMarketsResult> {
|
|
672
694
|
await this.initPromise;
|
|
673
695
|
try {
|
|
674
696
|
const args: any[] = [];
|
|
@@ -2449,6 +2471,23 @@ export class Polymarket extends Exchange {
|
|
|
2449
2471
|
};
|
|
2450
2472
|
super("polymarket", polyOptions as ExchangeOptions);
|
|
2451
2473
|
}
|
|
2474
|
+
|
|
2475
|
+
/**
|
|
2476
|
+
* Initialize Polymarket L2 API credentials for implicit API signing.
|
|
2477
|
+
*
|
|
2478
|
+
* Call this before private Polymarket implicit-API endpoints when the
|
|
2479
|
+
* underlying CLOB credentials have not been created yet.
|
|
2480
|
+
*/
|
|
2481
|
+
async initAuth(): Promise<void> {
|
|
2482
|
+
await this.initPromise;
|
|
2483
|
+
try {
|
|
2484
|
+
const json = await this.sidecarPostRequest('initAuth', []);
|
|
2485
|
+
this.handleResponse(json);
|
|
2486
|
+
} catch (error) {
|
|
2487
|
+
if (error instanceof PmxtError) throw error;
|
|
2488
|
+
throw new PmxtError(`Failed to initAuth: ${error}`);
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2452
2491
|
}
|
|
2453
2492
|
|
|
2454
2493
|
/**
|