pmxtjs 2.41.0 → 2.41.1
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 +24 -24
- package/dist/esm/generated/src/apis/DefaultApi.js +24 -24
- package/dist/esm/generated/src/models/UnwatchAddressRequest.d.ts +1 -1
- package/dist/esm/generated/src/models/UnwatchAddressRequest.js +1 -3
- package/dist/esm/generated/src/models/UnwatchOrderBookRequest.d.ts +1 -1
- package/dist/esm/generated/src/models/UnwatchOrderBookRequest.js +1 -3
- package/dist/esm/generated/src/models/WatchAddressRequest.d.ts +2 -3
- package/dist/esm/generated/src/models/WatchAddressRequest.js +2 -5
- package/dist/esm/generated/src/models/WatchOrderBookRequest.d.ts +2 -3
- package/dist/esm/generated/src/models/WatchOrderBookRequest.js +2 -5
- package/dist/esm/generated/src/models/WatchOrderBooksRequest.d.ts +2 -3
- package/dist/esm/generated/src/models/WatchOrderBooksRequest.js +2 -5
- package/dist/esm/generated/src/models/WatchTradesRequest.d.ts +2 -3
- package/dist/esm/generated/src/models/WatchTradesRequest.js +2 -5
- package/dist/esm/generated/src/models/index.d.ts +0 -3
- package/dist/esm/generated/src/models/index.js +0 -3
- package/dist/esm/pmxt/client.d.ts +8 -7
- package/dist/esm/pmxt/client.js +79 -11
- package/dist/generated/src/apis/DefaultApi.d.ts +24 -24
- package/dist/generated/src/apis/DefaultApi.js +24 -24
- package/dist/generated/src/models/UnwatchAddressRequest.d.ts +1 -1
- package/dist/generated/src/models/UnwatchAddressRequest.js +1 -3
- package/dist/generated/src/models/UnwatchOrderBookRequest.d.ts +1 -1
- package/dist/generated/src/models/UnwatchOrderBookRequest.js +1 -3
- package/dist/generated/src/models/WatchAddressRequest.d.ts +2 -3
- package/dist/generated/src/models/WatchAddressRequest.js +2 -5
- package/dist/generated/src/models/WatchOrderBookRequest.d.ts +2 -3
- package/dist/generated/src/models/WatchOrderBookRequest.js +2 -5
- package/dist/generated/src/models/WatchOrderBooksRequest.d.ts +2 -3
- package/dist/generated/src/models/WatchOrderBooksRequest.js +2 -5
- package/dist/generated/src/models/WatchTradesRequest.d.ts +2 -3
- package/dist/generated/src/models/WatchTradesRequest.js +2 -5
- package/dist/generated/src/models/index.d.ts +0 -3
- package/dist/generated/src/models/index.js +0 -3
- package/dist/pmxt/client.d.ts +8 -7
- package/dist/pmxt/client.js +79 -11
- package/generated/.openapi-generator/FILES +0 -6
- package/generated/docs/DefaultApi.md +24 -24
- package/generated/docs/WatchAddressRequest.md +1 -1
- package/generated/docs/WatchOrderBookRequest.md +1 -1
- package/generated/docs/WatchOrderBooksRequest.md +1 -1
- package/generated/docs/WatchTradesRequest.md +1 -1
- package/generated/package.json +1 -1
- package/generated/src/apis/DefaultApi.ts +24 -24
- package/generated/src/models/UnwatchAddressRequest.ts +2 -3
- package/generated/src/models/UnwatchOrderBookRequest.ts +2 -3
- package/generated/src/models/WatchAddressRequest.ts +4 -12
- package/generated/src/models/WatchOrderBookRequest.ts +4 -12
- package/generated/src/models/WatchOrderBooksRequest.ts +4 -12
- package/generated/src/models/WatchTradesRequest.ts +4 -12
- package/generated/src/models/index.ts +0 -3
- package/package.json +2 -2
- package/pmxt/client.ts +78 -11
- package/dist/esm/generated/src/models/WatchAddressRequestArgsInner.d.ts +0 -21
- package/dist/esm/generated/src/models/WatchAddressRequestArgsInner.js +0 -37
- package/dist/esm/generated/src/models/WatchOrderBookRequestArgsInner.d.ts +0 -21
- package/dist/esm/generated/src/models/WatchOrderBookRequestArgsInner.js +0 -43
- package/dist/esm/generated/src/models/WatchOrderBooksRequestArgsInner.d.ts +0 -21
- package/dist/esm/generated/src/models/WatchOrderBooksRequestArgsInner.js +0 -47
- package/dist/generated/src/models/WatchAddressRequestArgsInner.d.ts +0 -21
- package/dist/generated/src/models/WatchAddressRequestArgsInner.js +0 -43
- package/dist/generated/src/models/WatchOrderBookRequestArgsInner.d.ts +0 -21
- package/dist/generated/src/models/WatchOrderBookRequestArgsInner.js +0 -49
- package/dist/generated/src/models/WatchOrderBooksRequestArgsInner.d.ts +0 -21
- package/dist/generated/src/models/WatchOrderBooksRequestArgsInner.js +0 -53
- package/generated/docs/WatchAddressRequestArgsInner.md +0 -32
- package/generated/docs/WatchOrderBookRequestArgsInner.md +0 -32
- package/generated/docs/WatchOrderBooksRequestArgsInner.md +0 -32
- package/generated/src/models/WatchAddressRequestArgsInner.ts +0 -49
- package/generated/src/models/WatchOrderBookRequestArgsInner.ts +0 -55
- package/generated/src/models/WatchOrderBooksRequestArgsInner.ts +0 -59
|
@@ -32,7 +32,7 @@ export interface UnwatchOrderBookRequest {
|
|
|
32
32
|
* @type {Array<string>}
|
|
33
33
|
* @memberof UnwatchOrderBookRequest
|
|
34
34
|
*/
|
|
35
|
-
args
|
|
35
|
+
args?: Array<string>;
|
|
36
36
|
/**
|
|
37
37
|
*
|
|
38
38
|
* @type {ExchangeCredentials}
|
|
@@ -45,7 +45,6 @@ export interface UnwatchOrderBookRequest {
|
|
|
45
45
|
* Check if a given object implements the UnwatchOrderBookRequest interface.
|
|
46
46
|
*/
|
|
47
47
|
export function instanceOfUnwatchOrderBookRequest(value: object): value is UnwatchOrderBookRequest {
|
|
48
|
-
if (!('args' in value) || value['args'] === undefined) return false;
|
|
49
48
|
return true;
|
|
50
49
|
}
|
|
51
50
|
|
|
@@ -59,7 +58,7 @@ export function UnwatchOrderBookRequestFromJSONTyped(json: any, ignoreDiscrimina
|
|
|
59
58
|
}
|
|
60
59
|
return {
|
|
61
60
|
|
|
62
|
-
'args': json['args'],
|
|
61
|
+
'args': json['args'] == null ? undefined : json['args'],
|
|
63
62
|
'credentials': json['credentials'] == null ? undefined : ExchangeCredentialsFromJSON(json['credentials']),
|
|
64
63
|
};
|
|
65
64
|
}
|
|
@@ -13,13 +13,6 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { mapValues } from '../runtime';
|
|
16
|
-
import type { WatchAddressRequestArgsInner } from './WatchAddressRequestArgsInner';
|
|
17
|
-
import {
|
|
18
|
-
WatchAddressRequestArgsInnerFromJSON,
|
|
19
|
-
WatchAddressRequestArgsInnerFromJSONTyped,
|
|
20
|
-
WatchAddressRequestArgsInnerToJSON,
|
|
21
|
-
WatchAddressRequestArgsInnerToJSONTyped,
|
|
22
|
-
} from './WatchAddressRequestArgsInner';
|
|
23
16
|
import type { ExchangeCredentials } from './ExchangeCredentials';
|
|
24
17
|
import {
|
|
25
18
|
ExchangeCredentialsFromJSON,
|
|
@@ -36,10 +29,10 @@ import {
|
|
|
36
29
|
export interface WatchAddressRequest {
|
|
37
30
|
/**
|
|
38
31
|
*
|
|
39
|
-
* @type {Array<
|
|
32
|
+
* @type {Array<string>}
|
|
40
33
|
* @memberof WatchAddressRequest
|
|
41
34
|
*/
|
|
42
|
-
args
|
|
35
|
+
args?: Array<string>;
|
|
43
36
|
/**
|
|
44
37
|
*
|
|
45
38
|
* @type {ExchangeCredentials}
|
|
@@ -52,7 +45,6 @@ export interface WatchAddressRequest {
|
|
|
52
45
|
* Check if a given object implements the WatchAddressRequest interface.
|
|
53
46
|
*/
|
|
54
47
|
export function instanceOfWatchAddressRequest(value: object): value is WatchAddressRequest {
|
|
55
|
-
if (!('args' in value) || value['args'] === undefined) return false;
|
|
56
48
|
return true;
|
|
57
49
|
}
|
|
58
50
|
|
|
@@ -66,7 +58,7 @@ export function WatchAddressRequestFromJSONTyped(json: any, ignoreDiscriminator:
|
|
|
66
58
|
}
|
|
67
59
|
return {
|
|
68
60
|
|
|
69
|
-
'args':
|
|
61
|
+
'args': json['args'] == null ? undefined : json['args'],
|
|
70
62
|
'credentials': json['credentials'] == null ? undefined : ExchangeCredentialsFromJSON(json['credentials']),
|
|
71
63
|
};
|
|
72
64
|
}
|
|
@@ -82,7 +74,7 @@ export function WatchAddressRequestToJSONTyped(value?: WatchAddressRequest | nul
|
|
|
82
74
|
|
|
83
75
|
return {
|
|
84
76
|
|
|
85
|
-
'args':
|
|
77
|
+
'args': value['args'],
|
|
86
78
|
'credentials': ExchangeCredentialsToJSON(value['credentials']),
|
|
87
79
|
};
|
|
88
80
|
}
|
|
@@ -20,13 +20,6 @@ import {
|
|
|
20
20
|
ExchangeCredentialsToJSON,
|
|
21
21
|
ExchangeCredentialsToJSONTyped,
|
|
22
22
|
} from './ExchangeCredentials';
|
|
23
|
-
import type { WatchOrderBookRequestArgsInner } from './WatchOrderBookRequestArgsInner';
|
|
24
|
-
import {
|
|
25
|
-
WatchOrderBookRequestArgsInnerFromJSON,
|
|
26
|
-
WatchOrderBookRequestArgsInnerFromJSONTyped,
|
|
27
|
-
WatchOrderBookRequestArgsInnerToJSON,
|
|
28
|
-
WatchOrderBookRequestArgsInnerToJSONTyped,
|
|
29
|
-
} from './WatchOrderBookRequestArgsInner';
|
|
30
23
|
|
|
31
24
|
/**
|
|
32
25
|
*
|
|
@@ -36,10 +29,10 @@ import {
|
|
|
36
29
|
export interface WatchOrderBookRequest {
|
|
37
30
|
/**
|
|
38
31
|
*
|
|
39
|
-
* @type {Array<
|
|
32
|
+
* @type {Array<string>}
|
|
40
33
|
* @memberof WatchOrderBookRequest
|
|
41
34
|
*/
|
|
42
|
-
args
|
|
35
|
+
args?: Array<string>;
|
|
43
36
|
/**
|
|
44
37
|
*
|
|
45
38
|
* @type {ExchangeCredentials}
|
|
@@ -52,7 +45,6 @@ export interface WatchOrderBookRequest {
|
|
|
52
45
|
* Check if a given object implements the WatchOrderBookRequest interface.
|
|
53
46
|
*/
|
|
54
47
|
export function instanceOfWatchOrderBookRequest(value: object): value is WatchOrderBookRequest {
|
|
55
|
-
if (!('args' in value) || value['args'] === undefined) return false;
|
|
56
48
|
return true;
|
|
57
49
|
}
|
|
58
50
|
|
|
@@ -66,7 +58,7 @@ export function WatchOrderBookRequestFromJSONTyped(json: any, ignoreDiscriminato
|
|
|
66
58
|
}
|
|
67
59
|
return {
|
|
68
60
|
|
|
69
|
-
'args':
|
|
61
|
+
'args': json['args'] == null ? undefined : json['args'],
|
|
70
62
|
'credentials': json['credentials'] == null ? undefined : ExchangeCredentialsFromJSON(json['credentials']),
|
|
71
63
|
};
|
|
72
64
|
}
|
|
@@ -82,7 +74,7 @@ export function WatchOrderBookRequestToJSONTyped(value?: WatchOrderBookRequest |
|
|
|
82
74
|
|
|
83
75
|
return {
|
|
84
76
|
|
|
85
|
-
'args':
|
|
77
|
+
'args': value['args'],
|
|
86
78
|
'credentials': ExchangeCredentialsToJSON(value['credentials']),
|
|
87
79
|
};
|
|
88
80
|
}
|
|
@@ -20,13 +20,6 @@ import {
|
|
|
20
20
|
ExchangeCredentialsToJSON,
|
|
21
21
|
ExchangeCredentialsToJSONTyped,
|
|
22
22
|
} from './ExchangeCredentials';
|
|
23
|
-
import type { WatchOrderBooksRequestArgsInner } from './WatchOrderBooksRequestArgsInner';
|
|
24
|
-
import {
|
|
25
|
-
WatchOrderBooksRequestArgsInnerFromJSON,
|
|
26
|
-
WatchOrderBooksRequestArgsInnerFromJSONTyped,
|
|
27
|
-
WatchOrderBooksRequestArgsInnerToJSON,
|
|
28
|
-
WatchOrderBooksRequestArgsInnerToJSONTyped,
|
|
29
|
-
} from './WatchOrderBooksRequestArgsInner';
|
|
30
23
|
|
|
31
24
|
/**
|
|
32
25
|
*
|
|
@@ -36,10 +29,10 @@ import {
|
|
|
36
29
|
export interface WatchOrderBooksRequest {
|
|
37
30
|
/**
|
|
38
31
|
*
|
|
39
|
-
* @type {Array<
|
|
32
|
+
* @type {Array<string>}
|
|
40
33
|
* @memberof WatchOrderBooksRequest
|
|
41
34
|
*/
|
|
42
|
-
args
|
|
35
|
+
args?: Array<string>;
|
|
43
36
|
/**
|
|
44
37
|
*
|
|
45
38
|
* @type {ExchangeCredentials}
|
|
@@ -52,7 +45,6 @@ export interface WatchOrderBooksRequest {
|
|
|
52
45
|
* Check if a given object implements the WatchOrderBooksRequest interface.
|
|
53
46
|
*/
|
|
54
47
|
export function instanceOfWatchOrderBooksRequest(value: object): value is WatchOrderBooksRequest {
|
|
55
|
-
if (!('args' in value) || value['args'] === undefined) return false;
|
|
56
48
|
return true;
|
|
57
49
|
}
|
|
58
50
|
|
|
@@ -66,7 +58,7 @@ export function WatchOrderBooksRequestFromJSONTyped(json: any, ignoreDiscriminat
|
|
|
66
58
|
}
|
|
67
59
|
return {
|
|
68
60
|
|
|
69
|
-
'args':
|
|
61
|
+
'args': json['args'] == null ? undefined : json['args'],
|
|
70
62
|
'credentials': json['credentials'] == null ? undefined : ExchangeCredentialsFromJSON(json['credentials']),
|
|
71
63
|
};
|
|
72
64
|
}
|
|
@@ -82,7 +74,7 @@ export function WatchOrderBooksRequestToJSONTyped(value?: WatchOrderBooksRequest
|
|
|
82
74
|
|
|
83
75
|
return {
|
|
84
76
|
|
|
85
|
-
'args':
|
|
77
|
+
'args': value['args'],
|
|
86
78
|
'credentials': ExchangeCredentialsToJSON(value['credentials']),
|
|
87
79
|
};
|
|
88
80
|
}
|
|
@@ -20,13 +20,6 @@ import {
|
|
|
20
20
|
ExchangeCredentialsToJSON,
|
|
21
21
|
ExchangeCredentialsToJSONTyped,
|
|
22
22
|
} from './ExchangeCredentials';
|
|
23
|
-
import type { WatchOrderBookRequestArgsInner } from './WatchOrderBookRequestArgsInner';
|
|
24
|
-
import {
|
|
25
|
-
WatchOrderBookRequestArgsInnerFromJSON,
|
|
26
|
-
WatchOrderBookRequestArgsInnerFromJSONTyped,
|
|
27
|
-
WatchOrderBookRequestArgsInnerToJSON,
|
|
28
|
-
WatchOrderBookRequestArgsInnerToJSONTyped,
|
|
29
|
-
} from './WatchOrderBookRequestArgsInner';
|
|
30
23
|
|
|
31
24
|
/**
|
|
32
25
|
*
|
|
@@ -36,10 +29,10 @@ import {
|
|
|
36
29
|
export interface WatchTradesRequest {
|
|
37
30
|
/**
|
|
38
31
|
*
|
|
39
|
-
* @type {Array<
|
|
32
|
+
* @type {Array<string>}
|
|
40
33
|
* @memberof WatchTradesRequest
|
|
41
34
|
*/
|
|
42
|
-
args
|
|
35
|
+
args?: Array<string>;
|
|
43
36
|
/**
|
|
44
37
|
*
|
|
45
38
|
* @type {ExchangeCredentials}
|
|
@@ -52,7 +45,6 @@ export interface WatchTradesRequest {
|
|
|
52
45
|
* Check if a given object implements the WatchTradesRequest interface.
|
|
53
46
|
*/
|
|
54
47
|
export function instanceOfWatchTradesRequest(value: object): value is WatchTradesRequest {
|
|
55
|
-
if (!('args' in value) || value['args'] === undefined) return false;
|
|
56
48
|
return true;
|
|
57
49
|
}
|
|
58
50
|
|
|
@@ -66,7 +58,7 @@ export function WatchTradesRequestFromJSONTyped(json: any, ignoreDiscriminator:
|
|
|
66
58
|
}
|
|
67
59
|
return {
|
|
68
60
|
|
|
69
|
-
'args':
|
|
61
|
+
'args': json['args'] == null ? undefined : json['args'],
|
|
70
62
|
'credentials': json['credentials'] == null ? undefined : ExchangeCredentialsFromJSON(json['credentials']),
|
|
71
63
|
};
|
|
72
64
|
}
|
|
@@ -82,7 +74,7 @@ export function WatchTradesRequestToJSONTyped(value?: WatchTradesRequest | null,
|
|
|
82
74
|
|
|
83
75
|
return {
|
|
84
76
|
|
|
85
|
-
'args':
|
|
77
|
+
'args': value['args'],
|
|
86
78
|
'credentials': ExchangeCredentialsToJSON(value['credentials']),
|
|
87
79
|
};
|
|
88
80
|
}
|
|
@@ -92,10 +92,7 @@ export * from './UnwatchOrderBookRequest';
|
|
|
92
92
|
export * from './UserTrade';
|
|
93
93
|
export * from './WatchAddress200Response';
|
|
94
94
|
export * from './WatchAddressRequest';
|
|
95
|
-
export * from './WatchAddressRequestArgsInner';
|
|
96
95
|
export * from './WatchOrderBookRequest';
|
|
97
|
-
export * from './WatchOrderBookRequestArgsInner';
|
|
98
96
|
export * from './WatchOrderBooks200Response';
|
|
99
97
|
export * from './WatchOrderBooksRequest';
|
|
100
|
-
export * from './WatchOrderBooksRequestArgsInner';
|
|
101
98
|
export * from './WatchTradesRequest';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxtjs",
|
|
3
|
-
"version": "2.41.
|
|
3
|
+
"version": "2.41.1",
|
|
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.41.
|
|
46
|
+
"pmxt-core": "2.41.1",
|
|
47
47
|
"ws": "^8.18.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
package/pmxt/client.ts
CHANGED
|
@@ -230,6 +230,8 @@ export abstract class Exchange {
|
|
|
230
230
|
protected serverManager: ServerManager;
|
|
231
231
|
protected initPromise: Promise<void>;
|
|
232
232
|
protected isHosted: boolean;
|
|
233
|
+
private _hostedAccount?: { depositWallet?: string; signatureType?: number };
|
|
234
|
+
private _accountDiscoveryPromise?: Promise<void>;
|
|
233
235
|
|
|
234
236
|
/**
|
|
235
237
|
* Sticky flag: set to `true` the first time a GET read is rejected by
|
|
@@ -1601,26 +1603,26 @@ export abstract class Exchange {
|
|
|
1601
1603
|
* Requires hosted mode (`pmxtApiKey` set).
|
|
1602
1604
|
*
|
|
1603
1605
|
* @param venues - Optional venue filter (e.g. ["polymarket", "limitless"])
|
|
1604
|
-
* @returns Next
|
|
1606
|
+
* @returns Next event with source, symbol, and orderbook
|
|
1605
1607
|
*
|
|
1606
1608
|
* @example
|
|
1607
1609
|
* ```typescript
|
|
1608
1610
|
* const poly = new Polymarket({ pmxtApiKey: "pmxt_xxx" });
|
|
1609
1611
|
* while (true) {
|
|
1610
|
-
* const event = await poly.
|
|
1612
|
+
* const event = await poly.watchAllOrderBooks();
|
|
1611
1613
|
* console.log(event.source, event.symbol, event.orderbook.bids[0]);
|
|
1612
1614
|
* }
|
|
1613
1615
|
* ```
|
|
1614
1616
|
*/
|
|
1615
|
-
async
|
|
1617
|
+
async watchAllOrderBooks(venues?: string[]): Promise<FirehoseEvent> {
|
|
1616
1618
|
await this.initPromise;
|
|
1617
1619
|
|
|
1618
1620
|
if (!this.isHosted) {
|
|
1619
|
-
throw new PmxtError("
|
|
1621
|
+
throw new PmxtError("watchAllOrderBooks() requires hosted mode (set pmxtApiKey)");
|
|
1620
1622
|
}
|
|
1621
1623
|
|
|
1622
1624
|
const args: any[] = venues ? [venues] : [];
|
|
1623
|
-
const wsData = await this.watchViaWs("
|
|
1625
|
+
const wsData = await this.watchViaWs("watchAllOrderBooks", args);
|
|
1624
1626
|
if (wsData !== null) {
|
|
1625
1627
|
return {
|
|
1626
1628
|
source: (wsData as any)._source || "",
|
|
@@ -1629,7 +1631,12 @@ export abstract class Exchange {
|
|
|
1629
1631
|
};
|
|
1630
1632
|
}
|
|
1631
1633
|
|
|
1632
|
-
throw new PmxtError("
|
|
1634
|
+
throw new PmxtError("watchAllOrderBooks() requires WebSocket transport — connection failed");
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
/** @deprecated Use {@link watchAllOrderBooks} instead. */
|
|
1638
|
+
async firehose(venues?: string[]): Promise<FirehoseEvent> {
|
|
1639
|
+
return this.watchAllOrderBooks(venues);
|
|
1633
1640
|
}
|
|
1634
1641
|
|
|
1635
1642
|
/**
|
|
@@ -1850,12 +1857,69 @@ export abstract class Exchange {
|
|
|
1850
1857
|
}
|
|
1851
1858
|
}
|
|
1852
1859
|
|
|
1860
|
+
private async _discoverHostedAccount(): Promise<void> {
|
|
1861
|
+
if (this._hostedAccount) return;
|
|
1862
|
+
if (!this._accountDiscoveryPromise) {
|
|
1863
|
+
this._accountDiscoveryPromise = (async () => {
|
|
1864
|
+
try {
|
|
1865
|
+
const res = await this.fetchWithRetry(
|
|
1866
|
+
`${this.resolveBaseUrl()}/v0/account`,
|
|
1867
|
+
{ method: 'GET', headers: { ...this.getAuthHeaders() } },
|
|
1868
|
+
);
|
|
1869
|
+
if (res.ok) {
|
|
1870
|
+
const body = await res.json();
|
|
1871
|
+
this._hostedAccount = { depositWallet: body.deposit_wallet, signatureType: body.signature_type };
|
|
1872
|
+
} else { this._hostedAccount = {}; }
|
|
1873
|
+
} catch { this._hostedAccount = {}; }
|
|
1874
|
+
})();
|
|
1875
|
+
}
|
|
1876
|
+
await this._accountDiscoveryPromise;
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
private async _executeSorOrder(params: any): Promise<Order> {
|
|
1880
|
+
await this._discoverHostedAccount();
|
|
1881
|
+
|
|
1882
|
+
const buildRes = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/sor/buildOrder`, {
|
|
1883
|
+
method: 'POST',
|
|
1884
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
1885
|
+
body: JSON.stringify({ args: [params] }),
|
|
1886
|
+
});
|
|
1887
|
+
if (!buildRes.ok) throw new PmxtError(`buildOrder failed: ${await buildRes.text()}`);
|
|
1888
|
+
const buildJson = await buildRes.json();
|
|
1889
|
+
const { orderId, legs } = buildJson.data || buildJson;
|
|
1890
|
+
|
|
1891
|
+
const fills: any[] = [];
|
|
1892
|
+
for (const leg of legs) {
|
|
1893
|
+
try {
|
|
1894
|
+
const { Polymarket, Limitless } = require('pmxt-core');
|
|
1895
|
+
const VenueClass = leg.venue === 'polymarket' ? Polymarket : leg.venue === 'limitless' ? Limitless : null;
|
|
1896
|
+
if (!VenueClass) throw new Error(`unsupported venue: ${leg.venue}`);
|
|
1897
|
+
|
|
1898
|
+
const venueOpts: any = { privateKey: this.privateKey };
|
|
1899
|
+
if (leg.venue === 'polymarket' && this._hostedAccount?.depositWallet) {
|
|
1900
|
+
venueOpts.funderAddress = this._hostedAccount.depositWallet;
|
|
1901
|
+
venueOpts.signatureType = this._hostedAccount.signatureType || 3;
|
|
1902
|
+
}
|
|
1903
|
+
const venue = new VenueClass(venueOpts);
|
|
1904
|
+
const order = await venue.createOrder({ outcomeId: leg.tokenId, side: leg.side, amount: leg.shares, price: leg.price });
|
|
1905
|
+
const filledShares = order.filled || 0;
|
|
1906
|
+
fills.push({ venue: leg.venue, venueOrderId: order.id, venueMarketId: leg.venueMarketId, venueOutcomeId: leg.venueOutcomeId, shares: filledShares > 0 ? filledShares : leg.shares, price: order.price || leg.price, status: filledShares > 0 ? 'filled' : 'open' });
|
|
1907
|
+
} catch (err: any) {
|
|
1908
|
+
fills.push({ venue: leg.venue, venueMarketId: leg.venueMarketId, venueOutcomeId: leg.venueOutcomeId, shares: leg.shares, price: leg.price, status: 'failed', error: err.message });
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
const submitRes = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/sor/submitOrder`, {
|
|
1913
|
+
method: 'POST',
|
|
1914
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
1915
|
+
body: JSON.stringify({ args: [{ orderId, fills }] }),
|
|
1916
|
+
});
|
|
1917
|
+
if (!submitRes.ok) throw new PmxtError(`submitOrder failed: ${await submitRes.text()}`);
|
|
1918
|
+
const submitJson = await submitRes.json();
|
|
1919
|
+
return convertOrder(submitJson.data || submitJson);
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1853
1922
|
/**
|
|
1854
|
-
* Create a new order.
|
|
1855
|
-
*
|
|
1856
|
-
* @param params - Order parameters
|
|
1857
|
-
* @returns Created order
|
|
1858
|
-
*
|
|
1859
1923
|
* @example
|
|
1860
1924
|
* ```typescript
|
|
1861
1925
|
* const order = await exchange.createOrder({
|
|
@@ -1870,6 +1934,9 @@ export abstract class Exchange {
|
|
|
1870
1934
|
*/
|
|
1871
1935
|
async createOrder(params: any): Promise<Order> {
|
|
1872
1936
|
if (this.isHosted) {
|
|
1937
|
+
if (this.exchangeName === 'sor' && this.privateKey) {
|
|
1938
|
+
return this._executeSorOrder(params);
|
|
1939
|
+
}
|
|
1873
1940
|
throw new PmxtError(
|
|
1874
1941
|
"Trade execution is not available through the hosted API. " +
|
|
1875
1942
|
"Use the local PMXT SDK with your venue credentials instead. " +
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PMXT Sidecar API
|
|
3
|
-
* 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.
|
|
4
|
-
*
|
|
5
|
-
* The version of the OpenAPI document: 0.4.4
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
-
* https://openapi-generator.tech
|
|
10
|
-
* Do not edit the class manually.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* @type WatchAddressRequestArgsInner
|
|
14
|
-
*
|
|
15
|
-
* @export
|
|
16
|
-
*/
|
|
17
|
-
export type WatchAddressRequestArgsInner = Array<object> | string;
|
|
18
|
-
export declare function WatchAddressRequestArgsInnerFromJSON(json: any): WatchAddressRequestArgsInner;
|
|
19
|
-
export declare function WatchAddressRequestArgsInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): WatchAddressRequestArgsInner;
|
|
20
|
-
export declare function WatchAddressRequestArgsInnerToJSON(json: any): any;
|
|
21
|
-
export declare function WatchAddressRequestArgsInnerToJSONTyped(value?: WatchAddressRequestArgsInner | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
-
export function WatchAddressRequestArgsInnerFromJSON(json) {
|
|
15
|
-
return WatchAddressRequestArgsInnerFromJSONTyped(json, false);
|
|
16
|
-
}
|
|
17
|
-
export function WatchAddressRequestArgsInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
18
|
-
if (json == null) {
|
|
19
|
-
return json;
|
|
20
|
-
}
|
|
21
|
-
if (typeof json === 'string') {
|
|
22
|
-
return json;
|
|
23
|
-
}
|
|
24
|
-
return {};
|
|
25
|
-
}
|
|
26
|
-
export function WatchAddressRequestArgsInnerToJSON(json) {
|
|
27
|
-
return WatchAddressRequestArgsInnerToJSONTyped(json, false);
|
|
28
|
-
}
|
|
29
|
-
export function WatchAddressRequestArgsInnerToJSONTyped(value, ignoreDiscriminator = false) {
|
|
30
|
-
if (value == null) {
|
|
31
|
-
return value;
|
|
32
|
-
}
|
|
33
|
-
if (typeof value === 'string') {
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
36
|
-
return {};
|
|
37
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PMXT Sidecar API
|
|
3
|
-
* 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.
|
|
4
|
-
*
|
|
5
|
-
* The version of the OpenAPI document: 0.4.4
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
-
* https://openapi-generator.tech
|
|
10
|
-
* Do not edit the class manually.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* @type WatchOrderBookRequestArgsInner
|
|
14
|
-
*
|
|
15
|
-
* @export
|
|
16
|
-
*/
|
|
17
|
-
export type WatchOrderBookRequestArgsInner = number | string;
|
|
18
|
-
export declare function WatchOrderBookRequestArgsInnerFromJSON(json: any): WatchOrderBookRequestArgsInner;
|
|
19
|
-
export declare function WatchOrderBookRequestArgsInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): WatchOrderBookRequestArgsInner;
|
|
20
|
-
export declare function WatchOrderBookRequestArgsInnerToJSON(json: any): any;
|
|
21
|
-
export declare function WatchOrderBookRequestArgsInnerToJSONTyped(value?: WatchOrderBookRequestArgsInner | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
export function WatchOrderBookRequestArgsInnerFromJSON(json) {
|
|
15
|
-
return WatchOrderBookRequestArgsInnerFromJSONTyped(json, false);
|
|
16
|
-
}
|
|
17
|
-
export function WatchOrderBookRequestArgsInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
18
|
-
if (json == null) {
|
|
19
|
-
return json;
|
|
20
|
-
}
|
|
21
|
-
if (typeof json === 'number') {
|
|
22
|
-
return json;
|
|
23
|
-
}
|
|
24
|
-
if (typeof json === 'string') {
|
|
25
|
-
return json;
|
|
26
|
-
}
|
|
27
|
-
return {};
|
|
28
|
-
}
|
|
29
|
-
export function WatchOrderBookRequestArgsInnerToJSON(json) {
|
|
30
|
-
return WatchOrderBookRequestArgsInnerToJSONTyped(json, false);
|
|
31
|
-
}
|
|
32
|
-
export function WatchOrderBookRequestArgsInnerToJSONTyped(value, ignoreDiscriminator = false) {
|
|
33
|
-
if (value == null) {
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
36
|
-
if (typeof value === 'number') {
|
|
37
|
-
return value;
|
|
38
|
-
}
|
|
39
|
-
if (typeof value === 'string') {
|
|
40
|
-
return value;
|
|
41
|
-
}
|
|
42
|
-
return {};
|
|
43
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PMXT Sidecar API
|
|
3
|
-
* 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.
|
|
4
|
-
*
|
|
5
|
-
* The version of the OpenAPI document: 0.4.4
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
-
* https://openapi-generator.tech
|
|
10
|
-
* Do not edit the class manually.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* @type WatchOrderBooksRequestArgsInner
|
|
14
|
-
*
|
|
15
|
-
* @export
|
|
16
|
-
*/
|
|
17
|
-
export type WatchOrderBooksRequestArgsInner = Array<string> | number;
|
|
18
|
-
export declare function WatchOrderBooksRequestArgsInnerFromJSON(json: any): WatchOrderBooksRequestArgsInner;
|
|
19
|
-
export declare function WatchOrderBooksRequestArgsInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): WatchOrderBooksRequestArgsInner;
|
|
20
|
-
export declare function WatchOrderBooksRequestArgsInnerToJSON(json: any): any;
|
|
21
|
-
export declare function WatchOrderBooksRequestArgsInnerToJSONTyped(value?: WatchOrderBooksRequestArgsInner | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
export function WatchOrderBooksRequestArgsInnerFromJSON(json) {
|
|
15
|
-
return WatchOrderBooksRequestArgsInnerFromJSONTyped(json, false);
|
|
16
|
-
}
|
|
17
|
-
export function WatchOrderBooksRequestArgsInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
18
|
-
if (json == null) {
|
|
19
|
-
return json;
|
|
20
|
-
}
|
|
21
|
-
if (typeof json === 'number') {
|
|
22
|
-
return json;
|
|
23
|
-
}
|
|
24
|
-
if (Array.isArray(json)) {
|
|
25
|
-
if (json.every(item => typeof item === 'string')) {
|
|
26
|
-
return json;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return {};
|
|
30
|
-
}
|
|
31
|
-
export function WatchOrderBooksRequestArgsInnerToJSON(json) {
|
|
32
|
-
return WatchOrderBooksRequestArgsInnerToJSONTyped(json, false);
|
|
33
|
-
}
|
|
34
|
-
export function WatchOrderBooksRequestArgsInnerToJSONTyped(value, ignoreDiscriminator = false) {
|
|
35
|
-
if (value == null) {
|
|
36
|
-
return value;
|
|
37
|
-
}
|
|
38
|
-
if (typeof value === 'number') {
|
|
39
|
-
return value;
|
|
40
|
-
}
|
|
41
|
-
if (Array.isArray(value)) {
|
|
42
|
-
if (value.every(item => typeof item === 'string')) {
|
|
43
|
-
return value;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return {};
|
|
47
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PMXT Sidecar API
|
|
3
|
-
* 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.
|
|
4
|
-
*
|
|
5
|
-
* The version of the OpenAPI document: 0.4.4
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
-
* https://openapi-generator.tech
|
|
10
|
-
* Do not edit the class manually.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* @type WatchAddressRequestArgsInner
|
|
14
|
-
*
|
|
15
|
-
* @export
|
|
16
|
-
*/
|
|
17
|
-
export type WatchAddressRequestArgsInner = Array<object> | string;
|
|
18
|
-
export declare function WatchAddressRequestArgsInnerFromJSON(json: any): WatchAddressRequestArgsInner;
|
|
19
|
-
export declare function WatchAddressRequestArgsInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): WatchAddressRequestArgsInner;
|
|
20
|
-
export declare function WatchAddressRequestArgsInnerToJSON(json: any): any;
|
|
21
|
-
export declare function WatchAddressRequestArgsInnerToJSONTyped(value?: WatchAddressRequestArgsInner | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* tslint:disable */
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
/**
|
|
5
|
-
* PMXT Sidecar API
|
|
6
|
-
* 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.
|
|
7
|
-
*
|
|
8
|
-
* The version of the OpenAPI document: 0.4.4
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
-
* https://openapi-generator.tech
|
|
13
|
-
* Do not edit the class manually.
|
|
14
|
-
*/
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.WatchAddressRequestArgsInnerFromJSON = WatchAddressRequestArgsInnerFromJSON;
|
|
17
|
-
exports.WatchAddressRequestArgsInnerFromJSONTyped = WatchAddressRequestArgsInnerFromJSONTyped;
|
|
18
|
-
exports.WatchAddressRequestArgsInnerToJSON = WatchAddressRequestArgsInnerToJSON;
|
|
19
|
-
exports.WatchAddressRequestArgsInnerToJSONTyped = WatchAddressRequestArgsInnerToJSONTyped;
|
|
20
|
-
function WatchAddressRequestArgsInnerFromJSON(json) {
|
|
21
|
-
return WatchAddressRequestArgsInnerFromJSONTyped(json, false);
|
|
22
|
-
}
|
|
23
|
-
function WatchAddressRequestArgsInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
24
|
-
if (json == null) {
|
|
25
|
-
return json;
|
|
26
|
-
}
|
|
27
|
-
if (typeof json === 'string') {
|
|
28
|
-
return json;
|
|
29
|
-
}
|
|
30
|
-
return {};
|
|
31
|
-
}
|
|
32
|
-
function WatchAddressRequestArgsInnerToJSON(json) {
|
|
33
|
-
return WatchAddressRequestArgsInnerToJSONTyped(json, false);
|
|
34
|
-
}
|
|
35
|
-
function WatchAddressRequestArgsInnerToJSONTyped(value, ignoreDiscriminator = false) {
|
|
36
|
-
if (value == null) {
|
|
37
|
-
return value;
|
|
38
|
-
}
|
|
39
|
-
if (typeof value === 'string') {
|
|
40
|
-
return value;
|
|
41
|
-
}
|
|
42
|
-
return {};
|
|
43
|
-
}
|