pmxtjs 2.34.3 → 2.35.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/esm/generated/src/apis/DefaultApi.d.ts +35 -1
- package/dist/esm/generated/src/apis/DefaultApi.js +55 -1
- package/dist/esm/generated/src/models/FetchEventsPaginated200Response.d.ts +46 -0
- package/dist/esm/generated/src/models/FetchEventsPaginated200Response.js +47 -0
- package/dist/esm/generated/src/models/PaginatedEventsResult.d.ts +45 -0
- package/dist/esm/generated/src/models/PaginatedEventsResult.js +50 -0
- package/dist/esm/generated/src/models/index.d.ts +2 -0
- package/dist/esm/generated/src/models/index.js +2 -0
- package/dist/esm/pmxt/client.d.ts +2 -1
- package/dist/esm/pmxt/client.js +32 -0
- package/dist/esm/pmxt/models.d.ts +11 -0
- package/dist/generated/src/apis/DefaultApi.d.ts +35 -1
- package/dist/generated/src/apis/DefaultApi.js +56 -2
- package/dist/generated/src/models/FetchEventsPaginated200Response.d.ts +46 -0
- package/dist/generated/src/models/FetchEventsPaginated200Response.js +54 -0
- package/dist/generated/src/models/PaginatedEventsResult.d.ts +45 -0
- package/dist/generated/src/models/PaginatedEventsResult.js +57 -0
- package/dist/generated/src/models/index.d.ts +2 -0
- package/dist/generated/src/models/index.js +2 -0
- package/dist/pmxt/client.d.ts +2 -1
- package/dist/pmxt/client.js +32 -0
- package/dist/pmxt/models.d.ts +11 -0
- package/generated/.openapi-generator/FILES +4 -0
- package/generated/docs/DefaultApi.md +77 -0
- package/generated/docs/FetchEventsPaginated200Response.md +38 -0
- package/generated/docs/PaginatedEventsResult.md +39 -0
- package/generated/package.json +1 -1
- package/generated/src/apis/DefaultApi.ts +79 -0
- package/generated/src/models/FetchEventsPaginated200Response.ts +96 -0
- package/generated/src/models/PaginatedEventsResult.ts +91 -0
- package/generated/src/models/index.ts +2 -0
- package/package.json +2 -2
- package/pmxt/client.ts +31 -0
- package/pmxt/models.ts +14 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* PMXT Sidecar API
|
|
5
|
+
* A unified local sidecar API for prediction markets (Polymarket, Kalshi, Limitless). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.4.4
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
import type { ErrorDetail } from './ErrorDetail';
|
|
17
|
+
import {
|
|
18
|
+
ErrorDetailFromJSON,
|
|
19
|
+
ErrorDetailFromJSONTyped,
|
|
20
|
+
ErrorDetailToJSON,
|
|
21
|
+
ErrorDetailToJSONTyped,
|
|
22
|
+
} from './ErrorDetail';
|
|
23
|
+
import type { PaginatedEventsResult } from './PaginatedEventsResult';
|
|
24
|
+
import {
|
|
25
|
+
PaginatedEventsResultFromJSON,
|
|
26
|
+
PaginatedEventsResultFromJSONTyped,
|
|
27
|
+
PaginatedEventsResultToJSON,
|
|
28
|
+
PaginatedEventsResultToJSONTyped,
|
|
29
|
+
} from './PaginatedEventsResult';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @export
|
|
34
|
+
* @interface FetchEventsPaginated200Response
|
|
35
|
+
*/
|
|
36
|
+
export interface FetchEventsPaginated200Response {
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @type {boolean}
|
|
40
|
+
* @memberof FetchEventsPaginated200Response
|
|
41
|
+
*/
|
|
42
|
+
success?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @type {ErrorDetail}
|
|
46
|
+
* @memberof FetchEventsPaginated200Response
|
|
47
|
+
*/
|
|
48
|
+
error?: ErrorDetail;
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @type {PaginatedEventsResult}
|
|
52
|
+
* @memberof FetchEventsPaginated200Response
|
|
53
|
+
*/
|
|
54
|
+
data?: PaginatedEventsResult;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Check if a given object implements the FetchEventsPaginated200Response interface.
|
|
59
|
+
*/
|
|
60
|
+
export function instanceOfFetchEventsPaginated200Response(value: object): value is FetchEventsPaginated200Response {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function FetchEventsPaginated200ResponseFromJSON(json: any): FetchEventsPaginated200Response {
|
|
65
|
+
return FetchEventsPaginated200ResponseFromJSONTyped(json, false);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function FetchEventsPaginated200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FetchEventsPaginated200Response {
|
|
69
|
+
if (json == null) {
|
|
70
|
+
return json;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
|
|
74
|
+
'success': json['success'] == null ? undefined : json['success'],
|
|
75
|
+
'error': json['error'] == null ? undefined : ErrorDetailFromJSON(json['error']),
|
|
76
|
+
'data': json['data'] == null ? undefined : PaginatedEventsResultFromJSON(json['data']),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function FetchEventsPaginated200ResponseToJSON(json: any): FetchEventsPaginated200Response {
|
|
81
|
+
return FetchEventsPaginated200ResponseToJSONTyped(json, false);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function FetchEventsPaginated200ResponseToJSONTyped(value?: FetchEventsPaginated200Response | null, ignoreDiscriminator: boolean = false): any {
|
|
85
|
+
if (value == null) {
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
|
|
91
|
+
'success': value['success'],
|
|
92
|
+
'error': ErrorDetailToJSON(value['error']),
|
|
93
|
+
'data': PaginatedEventsResultToJSON(value['data']),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* PMXT Sidecar API
|
|
5
|
+
* A unified local sidecar API for prediction markets (Polymarket, Kalshi, Limitless). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.4.4
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
import type { UnifiedEvent } from './UnifiedEvent';
|
|
17
|
+
import {
|
|
18
|
+
UnifiedEventFromJSON,
|
|
19
|
+
UnifiedEventFromJSONTyped,
|
|
20
|
+
UnifiedEventToJSON,
|
|
21
|
+
UnifiedEventToJSONTyped,
|
|
22
|
+
} from './UnifiedEvent';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Shape returned by fetchEventsPaginated
|
|
26
|
+
* @export
|
|
27
|
+
* @interface PaginatedEventsResult
|
|
28
|
+
*/
|
|
29
|
+
export interface PaginatedEventsResult {
|
|
30
|
+
/**
|
|
31
|
+
* The page of unified events
|
|
32
|
+
* @type {Array<UnifiedEvent>}
|
|
33
|
+
* @memberof PaginatedEventsResult
|
|
34
|
+
*/
|
|
35
|
+
data: Array<UnifiedEvent>;
|
|
36
|
+
/**
|
|
37
|
+
* Total number of events in the snapshot
|
|
38
|
+
* @type {number}
|
|
39
|
+
* @memberof PaginatedEventsResult
|
|
40
|
+
*/
|
|
41
|
+
total: number;
|
|
42
|
+
/**
|
|
43
|
+
* Cursor to pass to the next call, or undefined if this is the last page
|
|
44
|
+
* @type {string}
|
|
45
|
+
* @memberof PaginatedEventsResult
|
|
46
|
+
*/
|
|
47
|
+
nextCursor?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Check if a given object implements the PaginatedEventsResult interface.
|
|
52
|
+
*/
|
|
53
|
+
export function instanceOfPaginatedEventsResult(value: object): value is PaginatedEventsResult {
|
|
54
|
+
if (!('data' in value) || value['data'] === undefined) return false;
|
|
55
|
+
if (!('total' in value) || value['total'] === undefined) return false;
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function PaginatedEventsResultFromJSON(json: any): PaginatedEventsResult {
|
|
60
|
+
return PaginatedEventsResultFromJSONTyped(json, false);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function PaginatedEventsResultFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedEventsResult {
|
|
64
|
+
if (json == null) {
|
|
65
|
+
return json;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
|
|
69
|
+
'data': ((json['data'] as Array<any>).map(UnifiedEventFromJSON)),
|
|
70
|
+
'total': json['total'],
|
|
71
|
+
'nextCursor': json['nextCursor'] == null ? undefined : json['nextCursor'],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function PaginatedEventsResultToJSON(json: any): PaginatedEventsResult {
|
|
76
|
+
return PaginatedEventsResultToJSONTyped(json, false);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function PaginatedEventsResultToJSONTyped(value?: PaginatedEventsResult | null, ignoreDiscriminator: boolean = false): any {
|
|
80
|
+
if (value == null) {
|
|
81
|
+
return value;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
|
|
86
|
+
'data': ((value['data'] as Array<any>).map(UnifiedEventToJSON)),
|
|
87
|
+
'total': value['total'],
|
|
88
|
+
'nextCursor': value['nextCursor'],
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
@@ -31,6 +31,7 @@ export * from './FetchEvent200Response';
|
|
|
31
31
|
export * from './FetchEventMatches200Response';
|
|
32
32
|
export * from './FetchEventMatchesParams';
|
|
33
33
|
export * from './FetchEvents200Response';
|
|
34
|
+
export * from './FetchEventsPaginated200Response';
|
|
34
35
|
export * from './FetchMarket200Response';
|
|
35
36
|
export * from './FetchMarketMatches200Response';
|
|
36
37
|
export * from './FetchMarketMatchesParams';
|
|
@@ -71,6 +72,7 @@ export * from './Order';
|
|
|
71
72
|
export * from './OrderBook';
|
|
72
73
|
export * from './OrderHistoryParams';
|
|
73
74
|
export * from './OrderLevel';
|
|
75
|
+
export * from './PaginatedEventsResult';
|
|
74
76
|
export * from './PaginatedMarketsResult';
|
|
75
77
|
export * from './Position';
|
|
76
78
|
export * from './PriceCandle';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxtjs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.35.2",
|
|
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.
|
|
46
|
+
"pmxt-core": "2.35.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/jest": "^30.0.0",
|
package/pmxt/client.ts
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
OrderBook,
|
|
30
30
|
OrderLevel,
|
|
31
31
|
PaginatedMarketsResult,
|
|
32
|
+
PaginatedEventsResult,
|
|
32
33
|
Position,
|
|
33
34
|
PriceCandle,
|
|
34
35
|
SubscribedAddressSnapshot,
|
|
@@ -737,6 +738,36 @@ export abstract class Exchange {
|
|
|
737
738
|
}
|
|
738
739
|
}
|
|
739
740
|
|
|
741
|
+
async fetchEventsPaginated(params?: any): Promise<PaginatedEventsResult> {
|
|
742
|
+
await this.initPromise;
|
|
743
|
+
try {
|
|
744
|
+
const args: any[] = [];
|
|
745
|
+
if (params !== undefined) args.push(params);
|
|
746
|
+
const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchEventsPaginated`, {
|
|
747
|
+
method: 'POST',
|
|
748
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
749
|
+
body: JSON.stringify({ args, credentials: this.getCredentials() }),
|
|
750
|
+
});
|
|
751
|
+
if (!response.ok) {
|
|
752
|
+
const body = await response.json().catch(() => ({}));
|
|
753
|
+
if (body.error && typeof body.error === "object") {
|
|
754
|
+
throw fromServerError(body.error);
|
|
755
|
+
}
|
|
756
|
+
throw new PmxtError(body.error?.message || response.statusText);
|
|
757
|
+
}
|
|
758
|
+
const json = await response.json();
|
|
759
|
+
const data = this.handleResponse(json);
|
|
760
|
+
return {
|
|
761
|
+
data: (data.data || []).map(convertEvent),
|
|
762
|
+
total: data.total,
|
|
763
|
+
nextCursor: data.nextCursor,
|
|
764
|
+
};
|
|
765
|
+
} catch (error) {
|
|
766
|
+
if (error instanceof PmxtError) throw error;
|
|
767
|
+
throw new PmxtError(`Failed to fetchEventsPaginated: ${error}`);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
740
771
|
async fetchMarket(params?: any): Promise<UnifiedMarket> {
|
|
741
772
|
await this.initPromise;
|
|
742
773
|
try {
|
package/pmxt/models.ts
CHANGED
|
@@ -210,6 +210,20 @@ export interface PaginatedMarketsResult {
|
|
|
210
210
|
nextCursor?: string;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Result of a paginated event fetch.
|
|
215
|
+
*/
|
|
216
|
+
export interface PaginatedEventsResult {
|
|
217
|
+
/** The events for this page */
|
|
218
|
+
data: UnifiedEvent[];
|
|
219
|
+
|
|
220
|
+
/** Total number of events (if available) */
|
|
221
|
+
total?: number;
|
|
222
|
+
|
|
223
|
+
/** Cursor for the next page (pass to fetchEventsPaginated) */
|
|
224
|
+
nextCursor?: string;
|
|
225
|
+
}
|
|
226
|
+
|
|
213
227
|
/**
|
|
214
228
|
* A historical trade.
|
|
215
229
|
*/
|