pmxtjs 2.49.0 → 2.49.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.
Files changed (57) hide show
  1. package/README.md +72 -10
  2. package/dist/esm/generated/src/models/Balance.d.ts +6 -0
  3. package/dist/esm/generated/src/models/Balance.js +2 -0
  4. package/dist/esm/generated/src/models/BuiltOrder.d.ts +6 -0
  5. package/dist/esm/generated/src/models/BuiltOrder.js +2 -0
  6. package/dist/esm/generated/src/models/ErrorDetail.d.ts +58 -2
  7. package/dist/esm/generated/src/models/ErrorDetail.js +37 -0
  8. package/dist/esm/generated/src/models/ExchangeOptions.d.ts +70 -0
  9. package/dist/esm/generated/src/models/ExchangeOptions.js +53 -0
  10. package/dist/esm/generated/src/models/MatchedMarketPair.d.ts +1 -1
  11. package/dist/esm/generated/src/models/Order.d.ts +18 -0
  12. package/dist/esm/generated/src/models/Order.js +6 -0
  13. package/dist/esm/generated/src/models/Position.d.ts +33 -9
  14. package/dist/esm/generated/src/models/Position.js +12 -12
  15. package/dist/esm/generated/src/models/UnifiedSeries.d.ts +4 -4
  16. package/dist/esm/generated/src/models/UserTrade.d.ts +18 -0
  17. package/dist/esm/generated/src/models/UserTrade.js +6 -0
  18. package/dist/esm/generated/src/models/index.d.ts +1 -0
  19. package/dist/esm/generated/src/models/index.js +1 -0
  20. package/dist/generated/src/models/Balance.d.ts +6 -0
  21. package/dist/generated/src/models/Balance.js +2 -0
  22. package/dist/generated/src/models/BuiltOrder.d.ts +6 -0
  23. package/dist/generated/src/models/BuiltOrder.js +2 -0
  24. package/dist/generated/src/models/ErrorDetail.d.ts +58 -2
  25. package/dist/generated/src/models/ErrorDetail.js +38 -0
  26. package/dist/generated/src/models/ExchangeOptions.d.ts +70 -0
  27. package/dist/generated/src/models/ExchangeOptions.js +60 -0
  28. package/dist/generated/src/models/MatchedMarketPair.d.ts +1 -1
  29. package/dist/generated/src/models/Order.d.ts +18 -0
  30. package/dist/generated/src/models/Order.js +6 -0
  31. package/dist/generated/src/models/Position.d.ts +33 -9
  32. package/dist/generated/src/models/Position.js +12 -12
  33. package/dist/generated/src/models/UnifiedSeries.d.ts +4 -4
  34. package/dist/generated/src/models/UserTrade.d.ts +18 -0
  35. package/dist/generated/src/models/UserTrade.js +6 -0
  36. package/dist/generated/src/models/index.d.ts +1 -0
  37. package/dist/generated/src/models/index.js +1 -0
  38. package/generated/.openapi-generator/FILES +2 -0
  39. package/generated/docs/Balance.md +2 -0
  40. package/generated/docs/BuiltOrder.md +2 -0
  41. package/generated/docs/ErrorDetail.md +9 -0
  42. package/generated/docs/ExchangeOptions.md +47 -0
  43. package/generated/docs/Order.md +6 -0
  44. package/generated/docs/Position.md +9 -0
  45. package/generated/docs/UserTrade.md +6 -0
  46. package/generated/package.json +1 -1
  47. package/generated/src/models/Balance.ts +8 -0
  48. package/generated/src/models/BuiltOrder.ts +8 -0
  49. package/generated/src/models/ErrorDetail.ts +67 -2
  50. package/generated/src/models/ExchangeOptions.ts +115 -0
  51. package/generated/src/models/MatchedMarketPair.ts +1 -1
  52. package/generated/src/models/Order.ts +24 -0
  53. package/generated/src/models/Position.ts +45 -17
  54. package/generated/src/models/UnifiedSeries.ts +4 -4
  55. package/generated/src/models/UserTrade.ts +24 -0
  56. package/generated/src/models/index.ts +1 -0
  57. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # pmxtjs
2
2
 
3
- A unified TypeScript/Node.js SDK for prediction markets - The ccxt for prediction markets.
3
+ A unified TypeScript/Node.js SDK for prediction markets The ccxt for prediction markets.
4
+
5
+ > **Note**: Use with a PMXT API key (hosted, recommended) or self-host the sidecar locally. Get a key at [pmxt.dev/dashboard](https://pmxt.dev/dashboard).
4
6
 
5
7
  ## Installation
6
8
 
@@ -10,15 +12,19 @@ npm install pmxtjs
10
12
 
11
13
  ## Quick Start
12
14
 
15
+ Get your API key at [pmxt.dev/dashboard](https://pmxt.dev/dashboard). For reads, only `pmxtApiKey` and `walletAddress` are required.
16
+
13
17
  ```typescript
14
- import pmxt from 'pmxtjs';
18
+ import { Polymarket } from "pmxtjs";
15
19
 
16
- // Initialize exchanges
17
- const poly = new pmxt.Polymarket();
18
- const kalshi = new pmxt.Kalshi();
20
+ // Reads — pmxtApiKey + walletAddress only
21
+ const client = new Polymarket({
22
+ pmxtApiKey: "pmxt_live_...",
23
+ walletAddress: "0xYourWalletAddress",
24
+ });
19
25
 
20
26
  // Search for markets
21
- const markets = await poly.fetchMarkets({ query: 'Trump' });
27
+ const markets = await client.fetchMarkets({ query: "Trump" });
22
28
  console.log(markets[0].title);
23
29
 
24
30
  // Get outcome details
@@ -26,17 +32,29 @@ const outcome = markets[0].outcomes[0];
26
32
  console.log(`${outcome.label}: ${(outcome.price * 100).toFixed(1)}%`);
27
33
 
28
34
  // Fetch historical data (use outcome.outcomeId!)
29
- const candles = await poly.fetchOHLCV(outcome.outcomeId, {
35
+ const candles = await client.fetchOHLCV(outcome.outcomeId, {
30
36
  resolution: '1d',
31
- limit: 30
37
+ limit: 30,
32
38
  });
33
39
 
34
40
  // Get current order book
35
- const orderBook = await poly.fetchOrderBook(outcome.outcomeId);
41
+ const orderBook = await client.fetchOrderBook(outcome.outcomeId);
36
42
  const spread = orderBook.asks[0].price - orderBook.bids[0].price;
37
43
  console.log(`Spread: ${(spread * 100).toFixed(2)}%`);
44
+
45
+ // Account reads
46
+ const positions = await client.fetchPositions();
47
+ const balance = await client.fetchBalance();
38
48
  ```
39
49
 
50
+ ### How it works (hosted)
51
+
52
+ When you pass `pmxtApiKey`, the SDK talks to PMXT's hosted services: catalog requests go to `api.pmxt.dev`, trading requests go to `trade.pmxt.dev`. The SDK does **not** spawn a local process. For Polymarket and Opinion, PMXT's PreFundedEscrow handles custody — you sign orders with your own key, PMXT settles on-chain.
53
+
54
+ ### How it works (self-hosted)
55
+
56
+ Omit `pmxtApiKey` to use the local sidecar. Install `pmxt-core` from npm and supply venue credentials directly. See [Self-hosted trading (advanced)](#self-hosted-trading-advanced) below.
57
+
40
58
  ## Core Methods
41
59
 
42
60
  ### Market Data
@@ -77,7 +95,51 @@ console.log(`Spread: ${(spread * 100).toFixed(2)}%`);
77
95
 
78
96
  ## Trading
79
97
 
80
- ### Authentication
98
+ ### Hosted trading (recommended)
99
+
100
+ With a PMXT API key, pass `pmxtApiKey`, `walletAddress`, and `privateKey`. The SDK auto-wraps your key into an `EthersSigner` and PMXT settles the order on-chain.
101
+
102
+ **Polymarket:**
103
+ ```typescript
104
+ import { Polymarket } from "pmxtjs";
105
+
106
+ const trader = new Polymarket({
107
+ pmxtApiKey: "pmxt_live_...",
108
+ walletAddress: "0xYourWalletAddress",
109
+ privateKey: "0xYourPrivateKey",
110
+ });
111
+
112
+ const balance = await trader.fetchBalance();
113
+ console.log(`Available: $${balance[0].available}`);
114
+
115
+ const order = await trader.createOrder({
116
+ marketId: "market-uuid",
117
+ outcomeId: "outcome-uuid",
118
+ side: "buy",
119
+ type: "market",
120
+ amount: 5.0,
121
+ denom: "usdc",
122
+ slippage_pct: 30.0,
123
+ } as any);
124
+ console.log(`Order status: ${order.status}`);
125
+ ```
126
+
127
+ **Opinion:**
128
+ ```typescript
129
+ import { Opinion } from "pmxtjs";
130
+
131
+ const trader = new Opinion({
132
+ pmxtApiKey: "pmxt_live_...",
133
+ walletAddress: "0xYourWalletAddress",
134
+ privateKey: "0xYourPrivateKey",
135
+ });
136
+ ```
137
+
138
+ See the full [hosted trading guide](https://pmxt.dev/docs/concepts/hosted-trading) for venue support, custody model, and limits.
139
+
140
+ ### Self-hosted trading (advanced)
141
+
142
+ When self-hosting, supply venue credentials directly — no `pmxtApiKey`. The SDK spawns a local sidecar process.
81
143
 
82
144
  **Polymarket:**
83
145
  ```typescript
@@ -39,6 +39,12 @@ export interface Balance {
39
39
  * @memberof Balance
40
40
  */
41
41
  locked: number;
42
+ /**
43
+ * Hosted-mode: which venue this balance belongs to in a multi-venue response. Null when the balance is venue-agnostic.
44
+ * @type {string}
45
+ * @memberof Balance
46
+ */
47
+ venue?: string | null;
42
48
  }
43
49
  /**
44
50
  * Check if a given object implements the Balance interface.
@@ -37,6 +37,7 @@ export function BalanceFromJSONTyped(json, ignoreDiscriminator) {
37
37
  'total': json['total'],
38
38
  'available': json['available'],
39
39
  'locked': json['locked'],
40
+ 'venue': json['venue'] == null ? undefined : json['venue'],
40
41
  };
41
42
  }
42
43
  export function BalanceToJSON(json) {
@@ -51,5 +52,6 @@ export function BalanceToJSONTyped(value, ignoreDiscriminator = false) {
51
52
  'total': value['total'],
52
53
  'available': value['available'],
53
54
  'locked': value['locked'],
55
+ 'venue': value['venue'],
54
56
  };
55
57
  }
@@ -49,6 +49,12 @@ export interface BuiltOrder {
49
49
  * @memberof BuiltOrder
50
50
  */
51
51
  raw: any | null;
52
+ /**
53
+ * Unix epoch (ms) when this built order expires server-side. Submitting after expiry returns BUILT_ORDER_EXPIRED.
54
+ * @type {number}
55
+ * @memberof BuiltOrder
56
+ */
57
+ expiry?: number | null;
52
58
  }
53
59
  /**
54
60
  * Check if a given object implements the BuiltOrder interface.
@@ -38,6 +38,7 @@ export function BuiltOrderFromJSONTyped(json, ignoreDiscriminator) {
38
38
  'signedOrder': json['signedOrder'] == null ? undefined : json['signedOrder'],
39
39
  'tx': json['tx'] == null ? undefined : BuiltOrderTxFromJSON(json['tx']),
40
40
  'raw': json['raw'],
41
+ 'expiry': json['expiry'] == null ? undefined : json['expiry'],
41
42
  };
42
43
  }
43
44
  export function BuiltOrderToJSON(json) {
@@ -53,5 +54,6 @@ export function BuiltOrderToJSONTyped(value, ignoreDiscriminator = false) {
53
54
  'signedOrder': value['signedOrder'],
54
55
  'tx': BuiltOrderTxToJSON(value['tx']),
55
56
  'raw': value['raw'],
57
+ 'expiry': value['expiry'],
56
58
  };
57
59
  }
@@ -10,18 +10,74 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  /**
13
- *
13
+ * Structured error envelope returned inside `BaseResponse.error` and `ErrorResponse.error`. Hosted-mode endpoints populate `code`, `retryable`, and optionally `exchange` / `detail`; legacy local-mode endpoints may still return only `message`.
14
14
  * @export
15
15
  * @interface ErrorDetail
16
16
  */
17
17
  export interface ErrorDetail {
18
18
  /**
19
- *
19
+ * Human-readable error message.
20
20
  * @type {string}
21
21
  * @memberof ErrorDetail
22
22
  */
23
23
  message?: string;
24
+ /**
25
+ * Stable machine-readable error code. Hosted-mode errors use the `HostedTradingError` family (e.g. `INSUFFICIENT_ESCROW_BALANCE`, `BUILT_ORDER_EXPIRED`); pre-hosted local errors use the legacy family (e.g. `BAD_REQUEST`, `NOT_FOUND`).
26
+ * @type {string}
27
+ * @memberof ErrorDetail
28
+ */
29
+ code?: ErrorDetailCodeEnum;
30
+ /**
31
+ * Hint for clients: when `true`, the same request may succeed on retry (e.g. transient network or rate-limit conditions); when `false`, the caller should not retry without modifying the request.
32
+ * @type {boolean}
33
+ * @memberof ErrorDetail
34
+ */
35
+ retryable?: boolean;
36
+ /**
37
+ * Venue the error originated from, when known (e.g. 'polymarket', 'kalshi').
38
+ * @type {string}
39
+ * @memberof ErrorDetail
40
+ */
41
+ exchange?: string | null;
42
+ /**
43
+ * Free-form hosted-mode detail blob. Shape depends on `code` — e.g. for `INSUFFICIENT_ESCROW_BALANCE` it may include `{ requested, available }`; for `ORDER_SIZE_TOO_SMALL` it may include `{ min }`; for `BUILT_ORDER_EXPIRED` it may include `{ expiry }`.
44
+ * @type {{ [key: string]: any; }}
45
+ * @memberof ErrorDetail
46
+ */
47
+ detail?: {
48
+ [key: string]: any;
49
+ } | null;
24
50
  }
51
+ /**
52
+ * @export
53
+ */
54
+ export declare const ErrorDetailCodeEnum: {
55
+ readonly HostedTradingError: "HOSTED_TRADING_ERROR";
56
+ readonly InsufficientEscrowBalance: "INSUFFICIENT_ESCROW_BALANCE";
57
+ readonly OrderSizeTooSmall: "ORDER_SIZE_TOO_SMALL";
58
+ readonly InvalidApiKey: "INVALID_API_KEY";
59
+ readonly OutcomeNotFound: "OUTCOME_NOT_FOUND";
60
+ readonly CatalogUnavailable: "CATALOG_UNAVAILABLE";
61
+ readonly BuiltOrderExpired: "BUILT_ORDER_EXPIRED";
62
+ readonly InvalidSignature: "INVALID_SIGNATURE";
63
+ readonly NoLiquidity: "NO_LIQUIDITY";
64
+ readonly MissingWalletAddress: "MISSING_WALLET_ADDRESS";
65
+ readonly BadRequest: "BAD_REQUEST";
66
+ readonly AuthenticationError: "AUTHENTICATION_ERROR";
67
+ readonly PermissionDenied: "PERMISSION_DENIED";
68
+ readonly NotFound: "NOT_FOUND";
69
+ readonly OrderNotFound: "ORDER_NOT_FOUND";
70
+ readonly MarketNotFound: "MARKET_NOT_FOUND";
71
+ readonly EventNotFound: "EVENT_NOT_FOUND";
72
+ readonly RateLimitExceeded: "RATE_LIMIT_EXCEEDED";
73
+ readonly InvalidOrder: "INVALID_ORDER";
74
+ readonly InsufficientFunds: "INSUFFICIENT_FUNDS";
75
+ readonly ValidationError: "VALIDATION_ERROR";
76
+ readonly NetworkError: "NETWORK_ERROR";
77
+ readonly ExchangeNotAvailable: "EXCHANGE_NOT_AVAILABLE";
78
+ readonly NotSupported: "NOT_SUPPORTED";
79
+ };
80
+ export type ErrorDetailCodeEnum = typeof ErrorDetailCodeEnum[keyof typeof ErrorDetailCodeEnum];
25
81
  /**
26
82
  * Check if a given object implements the ErrorDetail interface.
27
83
  */
@@ -11,6 +11,35 @@
11
11
  * https://openapi-generator.tech
12
12
  * Do not edit the class manually.
13
13
  */
14
+ /**
15
+ * @export
16
+ */
17
+ export const ErrorDetailCodeEnum = {
18
+ HostedTradingError: 'HOSTED_TRADING_ERROR',
19
+ InsufficientEscrowBalance: 'INSUFFICIENT_ESCROW_BALANCE',
20
+ OrderSizeTooSmall: 'ORDER_SIZE_TOO_SMALL',
21
+ InvalidApiKey: 'INVALID_API_KEY',
22
+ OutcomeNotFound: 'OUTCOME_NOT_FOUND',
23
+ CatalogUnavailable: 'CATALOG_UNAVAILABLE',
24
+ BuiltOrderExpired: 'BUILT_ORDER_EXPIRED',
25
+ InvalidSignature: 'INVALID_SIGNATURE',
26
+ NoLiquidity: 'NO_LIQUIDITY',
27
+ MissingWalletAddress: 'MISSING_WALLET_ADDRESS',
28
+ BadRequest: 'BAD_REQUEST',
29
+ AuthenticationError: 'AUTHENTICATION_ERROR',
30
+ PermissionDenied: 'PERMISSION_DENIED',
31
+ NotFound: 'NOT_FOUND',
32
+ OrderNotFound: 'ORDER_NOT_FOUND',
33
+ MarketNotFound: 'MARKET_NOT_FOUND',
34
+ EventNotFound: 'EVENT_NOT_FOUND',
35
+ RateLimitExceeded: 'RATE_LIMIT_EXCEEDED',
36
+ InvalidOrder: 'INVALID_ORDER',
37
+ InsufficientFunds: 'INSUFFICIENT_FUNDS',
38
+ ValidationError: 'VALIDATION_ERROR',
39
+ NetworkError: 'NETWORK_ERROR',
40
+ ExchangeNotAvailable: 'EXCHANGE_NOT_AVAILABLE',
41
+ NotSupported: 'NOT_SUPPORTED'
42
+ };
14
43
  /**
15
44
  * Check if a given object implements the ErrorDetail interface.
16
45
  */
@@ -26,6 +55,10 @@ export function ErrorDetailFromJSONTyped(json, ignoreDiscriminator) {
26
55
  }
27
56
  return {
28
57
  'message': json['message'] == null ? undefined : json['message'],
58
+ 'code': json['code'] == null ? undefined : json['code'],
59
+ 'retryable': json['retryable'] == null ? undefined : json['retryable'],
60
+ 'exchange': json['exchange'] == null ? undefined : json['exchange'],
61
+ 'detail': json['detail'] == null ? undefined : json['detail'],
29
62
  };
30
63
  }
31
64
  export function ErrorDetailToJSON(json) {
@@ -37,5 +70,9 @@ export function ErrorDetailToJSONTyped(value, ignoreDiscriminator = false) {
37
70
  }
38
71
  return {
39
72
  'message': value['message'],
73
+ 'code': value['code'],
74
+ 'retryable': value['retryable'],
75
+ 'exchange': value['exchange'],
76
+ 'detail': value['detail'],
40
77
  };
41
78
  }
@@ -0,0 +1,70 @@
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
+ * Constructor-level options for venue clients (Polymarket, Kalshi, Opinion, etc.).
14
+ * Hosted mode is the default when pmxtApiKey is set; otherwise the SDK runs against
15
+ * a local sidecar with venue credentials.
16
+ * @export
17
+ * @interface ExchangeOptions
18
+ */
19
+ export interface ExchangeOptions {
20
+ /**
21
+ * PMXT customer API key. When set, the SDK routes to api.pmxt.dev (catalog) and trade.pmxt.dev (trading). Get one at pmxt.dev/dashboard.
22
+ * @type {string}
23
+ * @memberof ExchangeOptions
24
+ */
25
+ pmxtApiKey?: string;
26
+ /**
27
+ * EVM wallet address for hosted reads/writes. Required for endpoints that operate on a wallet (balances, positions, trades, open orders).
28
+ * @type {string}
29
+ * @memberof ExchangeOptions
30
+ */
31
+ walletAddress?: string | null;
32
+ /**
33
+ * Optional pre-built signer for hosted writes. If absent and privateKey is set, the SDK auto-wraps privateKey into a signer.
34
+ * @type {object}
35
+ * @memberof ExchangeOptions
36
+ */
37
+ signer?: object | null;
38
+ /**
39
+ * Private key. In hosted mode, used to derive an EIP-712 signer for writes (wraps into EthAccountSigner/EthersSigner). In self-hosted mode, used as the venue credential directly.
40
+ * @type {string}
41
+ * @memberof ExchangeOptions
42
+ */
43
+ privateKey?: string | null;
44
+ /**
45
+ * Explicit base URL override. When unset, the SDK uses api.pmxt.dev when pmxtApiKey is set, or the local sidecar otherwise.
46
+ * @type {string}
47
+ * @memberof ExchangeOptions
48
+ */
49
+ baseUrl?: string | null;
50
+ /**
51
+ * Venue-side API key (e.g. Polymarket CLOB key). Only relevant for self-hosted mode.
52
+ * @type {string}
53
+ * @memberof ExchangeOptions
54
+ */
55
+ apiKey?: string | null;
56
+ /**
57
+ * Auto-start the local sidecar when running self-hosted. Defaults to true when no pmxtApiKey is set, false when hosted.
58
+ * @type {boolean}
59
+ * @memberof ExchangeOptions
60
+ */
61
+ autoStartServer?: boolean | null;
62
+ }
63
+ /**
64
+ * Check if a given object implements the ExchangeOptions interface.
65
+ */
66
+ export declare function instanceOfExchangeOptions(value: object): value is ExchangeOptions;
67
+ export declare function ExchangeOptionsFromJSON(json: any): ExchangeOptions;
68
+ export declare function ExchangeOptionsFromJSONTyped(json: any, ignoreDiscriminator: boolean): ExchangeOptions;
69
+ export declare function ExchangeOptionsToJSON(json: any): ExchangeOptions;
70
+ export declare function ExchangeOptionsToJSONTyped(value?: ExchangeOptions | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,53 @@
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
+ * Check if a given object implements the ExchangeOptions interface.
16
+ */
17
+ export function instanceOfExchangeOptions(value) {
18
+ return true;
19
+ }
20
+ export function ExchangeOptionsFromJSON(json) {
21
+ return ExchangeOptionsFromJSONTyped(json, false);
22
+ }
23
+ export function ExchangeOptionsFromJSONTyped(json, ignoreDiscriminator) {
24
+ if (json == null) {
25
+ return json;
26
+ }
27
+ return {
28
+ 'pmxtApiKey': json['pmxtApiKey'] == null ? undefined : json['pmxtApiKey'],
29
+ 'walletAddress': json['walletAddress'] == null ? undefined : json['walletAddress'],
30
+ 'signer': json['signer'] == null ? undefined : json['signer'],
31
+ 'privateKey': json['privateKey'] == null ? undefined : json['privateKey'],
32
+ 'baseUrl': json['baseUrl'] == null ? undefined : json['baseUrl'],
33
+ 'apiKey': json['apiKey'] == null ? undefined : json['apiKey'],
34
+ 'autoStartServer': json['autoStartServer'] == null ? undefined : json['autoStartServer'],
35
+ };
36
+ }
37
+ export function ExchangeOptionsToJSON(json) {
38
+ return ExchangeOptionsToJSONTyped(json, false);
39
+ }
40
+ export function ExchangeOptionsToJSONTyped(value, ignoreDiscriminator = false) {
41
+ if (value == null) {
42
+ return value;
43
+ }
44
+ return {
45
+ 'pmxtApiKey': value['pmxtApiKey'],
46
+ 'walletAddress': value['walletAddress'],
47
+ 'signer': value['signer'],
48
+ 'privateKey': value['privateKey'],
49
+ 'baseUrl': value['baseUrl'],
50
+ 'apiKey': value['apiKey'],
51
+ 'autoStartServer': value['autoStartServer'],
52
+ };
53
+ }
@@ -71,7 +71,7 @@ export interface MatchedMarketPair {
71
71
  */
72
72
  confidence?: number;
73
73
  /**
74
- *
74
+ * Why the two markets were matched.
75
75
  * @type {string}
76
76
  * @memberof MatchedMarketPair
77
77
  */
@@ -99,6 +99,24 @@ export interface Order {
99
99
  * @memberof Order
100
100
  */
101
101
  feeRateBps?: number;
102
+ /**
103
+ * Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
104
+ * @type {string}
105
+ * @memberof Order
106
+ */
107
+ txHash?: string | null;
108
+ /**
109
+ * Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
110
+ * @type {string}
111
+ * @memberof Order
112
+ */
113
+ chain?: string | null;
114
+ /**
115
+ * Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
116
+ * @type {number}
117
+ * @memberof Order
118
+ */
119
+ blockNumber?: number | null;
102
120
  }
103
121
  /**
104
122
  * @export
@@ -83,6 +83,9 @@ export function OrderFromJSONTyped(json, ignoreDiscriminator) {
83
83
  'timestamp': json['timestamp'],
84
84
  'fee': json['fee'] == null ? undefined : json['fee'],
85
85
  'feeRateBps': json['feeRateBps'] == null ? undefined : json['feeRateBps'],
86
+ 'txHash': json['txHash'] == null ? undefined : json['txHash'],
87
+ 'chain': json['chain'] == null ? undefined : json['chain'],
88
+ 'blockNumber': json['blockNumber'] == null ? undefined : json['blockNumber'],
86
89
  };
87
90
  }
88
91
  export function OrderToJSON(json) {
@@ -107,5 +110,8 @@ export function OrderToJSONTyped(value, ignoreDiscriminator = false) {
107
110
  'timestamp': value['timestamp'],
108
111
  'fee': value['fee'],
109
112
  'feeRateBps': value['feeRateBps'],
113
+ 'txHash': value['txHash'],
114
+ 'chain': value['chain'],
115
+ 'blockNumber': value['blockNumber'],
110
116
  };
111
117
  }
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  /**
13
- *
13
+ * A current position in a market. In hosted mode, `outcomeLabel`, `entryPrice`, `currentPrice` and `unrealizedPnL` may be null when the server cannot derive them (e.g. `with_mtm=false` or no fill history). Venue-direct callers continue to populate every field.
14
14
  * @export
15
15
  * @interface Position
16
16
  */
@@ -28,11 +28,11 @@ export interface Position {
28
28
  */
29
29
  outcomeId: string;
30
30
  /**
31
- * Human-readable label for the outcome held.
31
+ * Human-readable label for the outcome held. Optional in hosted mode.
32
32
  * @type {string}
33
33
  * @memberof Position
34
34
  */
35
- outcomeLabel: string;
35
+ outcomeLabel?: string | null;
36
36
  /**
37
37
  * Positive for long, negative for short
38
38
  * @type {number}
@@ -40,29 +40,53 @@ export interface Position {
40
40
  */
41
41
  size: number;
42
42
  /**
43
- * Average entry price for the position (probability between 0.0 and 1.0).
43
+ * Average entry price for the position (probability between 0.0 and 1.0). Optional in hosted mode when no fill history is available.
44
+ * @type {number}
45
+ * @memberof Position
46
+ */
47
+ entryPrice?: number | null;
48
+ /**
49
+ * Current mark price for the position (probability between 0.0 and 1.0). Optional in hosted mode when mark-to-market data is unavailable.
44
50
  * @type {number}
45
51
  * @memberof Position
46
52
  */
47
- entryPrice: number;
53
+ currentPrice?: number | null;
48
54
  /**
49
- * Current mark price for the position (probability between 0.0 and 1.0).
55
+ * Current market value of the position (size * currentPrice). Null when currentPrice is unavailable.
50
56
  * @type {number}
51
57
  * @memberof Position
52
58
  */
53
- currentPrice: number;
59
+ currentValue?: number | null;
54
60
  /**
55
- * Unrealized profit or loss at the current price (USD).
61
+ * Unrealized profit or loss at the current price (USD). Optional in hosted mode when mark-to-market data is unavailable.
56
62
  * @type {number}
57
63
  * @memberof Position
58
64
  */
59
- unrealizedPnL: number;
65
+ unrealizedPnL?: number | null;
60
66
  /**
61
67
  * Realized profit or loss booked so far (USD).
62
68
  * @type {number}
63
69
  * @memberof Position
64
70
  */
65
71
  realizedPnL?: number;
72
+ /**
73
+ * Populated in hosted mode after on-chain settlement (from the last fill); null for local-mode and for non-on-chain venues.
74
+ * @type {string}
75
+ * @memberof Position
76
+ */
77
+ txHash?: string | null;
78
+ /**
79
+ * Populated in hosted mode after on-chain settlement (from the last fill); null for local-mode and for non-on-chain venues.
80
+ * @type {string}
81
+ * @memberof Position
82
+ */
83
+ chain?: string | null;
84
+ /**
85
+ * Populated in hosted mode after on-chain settlement (from the last fill); null for local-mode and for non-on-chain venues.
86
+ * @type {number}
87
+ * @memberof Position
88
+ */
89
+ blockNumber?: number | null;
66
90
  }
67
91
  /**
68
92
  * Check if a given object implements the Position interface.
@@ -19,16 +19,8 @@ export function instanceOfPosition(value) {
19
19
  return false;
20
20
  if (!('outcomeId' in value) || value['outcomeId'] === undefined)
21
21
  return false;
22
- if (!('outcomeLabel' in value) || value['outcomeLabel'] === undefined)
23
- return false;
24
22
  if (!('size' in value) || value['size'] === undefined)
25
23
  return false;
26
- if (!('entryPrice' in value) || value['entryPrice'] === undefined)
27
- return false;
28
- if (!('currentPrice' in value) || value['currentPrice'] === undefined)
29
- return false;
30
- if (!('unrealizedPnL' in value) || value['unrealizedPnL'] === undefined)
31
- return false;
32
24
  return true;
33
25
  }
34
26
  export function PositionFromJSON(json) {
@@ -41,12 +33,16 @@ export function PositionFromJSONTyped(json, ignoreDiscriminator) {
41
33
  return {
42
34
  'marketId': json['marketId'],
43
35
  'outcomeId': json['outcomeId'],
44
- 'outcomeLabel': json['outcomeLabel'],
36
+ 'outcomeLabel': json['outcomeLabel'] == null ? undefined : json['outcomeLabel'],
45
37
  'size': json['size'],
46
- 'entryPrice': json['entryPrice'],
47
- 'currentPrice': json['currentPrice'],
48
- 'unrealizedPnL': json['unrealizedPnL'],
38
+ 'entryPrice': json['entryPrice'] == null ? undefined : json['entryPrice'],
39
+ 'currentPrice': json['currentPrice'] == null ? undefined : json['currentPrice'],
40
+ 'currentValue': json['currentValue'] == null ? undefined : json['currentValue'],
41
+ 'unrealizedPnL': json['unrealizedPnL'] == null ? undefined : json['unrealizedPnL'],
49
42
  'realizedPnL': json['realizedPnL'] == null ? undefined : json['realizedPnL'],
43
+ 'txHash': json['txHash'] == null ? undefined : json['txHash'],
44
+ 'chain': json['chain'] == null ? undefined : json['chain'],
45
+ 'blockNumber': json['blockNumber'] == null ? undefined : json['blockNumber'],
50
46
  };
51
47
  }
52
48
  export function PositionToJSON(json) {
@@ -63,7 +59,11 @@ export function PositionToJSONTyped(value, ignoreDiscriminator = false) {
63
59
  'size': value['size'],
64
60
  'entryPrice': value['entryPrice'],
65
61
  'currentPrice': value['currentPrice'],
62
+ 'currentValue': value['currentValue'],
66
63
  'unrealizedPnL': value['unrealizedPnL'],
67
64
  'realizedPnL': value['realizedPnL'],
65
+ 'txHash': value['txHash'],
66
+ 'chain': value['chain'],
67
+ 'blockNumber': value['blockNumber'],
68
68
  };
69
69
  }
@@ -41,13 +41,13 @@ export interface UnifiedSeries {
41
41
  */
42
42
  title: string;
43
43
  /**
44
- *
44
+ * Long-form series description.
45
45
  * @type {string}
46
46
  * @memberof UnifiedSeries
47
47
  */
48
48
  description?: string | null;
49
49
  /**
50
- *
50
+ * Recurrence cadence the venue reports ('daily', 'weekly', 'annual', ...).
51
51
  * @type {string}
52
52
  * @memberof UnifiedSeries
53
53
  */
@@ -59,13 +59,13 @@ export interface UnifiedSeries {
59
59
  */
60
60
  events?: Array<UnifiedEvent>;
61
61
  /**
62
- *
62
+ * Canonical venue URL for the series.
63
63
  * @type {string}
64
64
  * @memberof UnifiedSeries
65
65
  */
66
66
  url?: string | null;
67
67
  /**
68
- *
68
+ * Venue-hosted image.
69
69
  * @type {string}
70
70
  * @memberof UnifiedSeries
71
71
  */