pmxtjs 2.49.0 → 2.49.3

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 (62) 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/esm/pmxt/client.d.ts +3 -0
  21. package/dist/esm/pmxt/client.js +40 -5
  22. package/dist/generated/src/models/Balance.d.ts +6 -0
  23. package/dist/generated/src/models/Balance.js +2 -0
  24. package/dist/generated/src/models/BuiltOrder.d.ts +6 -0
  25. package/dist/generated/src/models/BuiltOrder.js +2 -0
  26. package/dist/generated/src/models/ErrorDetail.d.ts +58 -2
  27. package/dist/generated/src/models/ErrorDetail.js +38 -0
  28. package/dist/generated/src/models/ExchangeOptions.d.ts +70 -0
  29. package/dist/generated/src/models/ExchangeOptions.js +60 -0
  30. package/dist/generated/src/models/MatchedMarketPair.d.ts +1 -1
  31. package/dist/generated/src/models/Order.d.ts +18 -0
  32. package/dist/generated/src/models/Order.js +6 -0
  33. package/dist/generated/src/models/Position.d.ts +33 -9
  34. package/dist/generated/src/models/Position.js +12 -12
  35. package/dist/generated/src/models/UnifiedSeries.d.ts +4 -4
  36. package/dist/generated/src/models/UserTrade.d.ts +18 -0
  37. package/dist/generated/src/models/UserTrade.js +6 -0
  38. package/dist/generated/src/models/index.d.ts +1 -0
  39. package/dist/generated/src/models/index.js +1 -0
  40. package/dist/pmxt/client.d.ts +3 -0
  41. package/dist/pmxt/client.js +40 -5
  42. package/generated/.openapi-generator/FILES +2 -0
  43. package/generated/docs/Balance.md +2 -0
  44. package/generated/docs/BuiltOrder.md +2 -0
  45. package/generated/docs/ErrorDetail.md +9 -0
  46. package/generated/docs/ExchangeOptions.md +47 -0
  47. package/generated/docs/Order.md +6 -0
  48. package/generated/docs/Position.md +9 -0
  49. package/generated/docs/UserTrade.md +6 -0
  50. package/generated/package.json +1 -1
  51. package/generated/src/models/Balance.ts +8 -0
  52. package/generated/src/models/BuiltOrder.ts +8 -0
  53. package/generated/src/models/ErrorDetail.ts +67 -2
  54. package/generated/src/models/ExchangeOptions.ts +115 -0
  55. package/generated/src/models/MatchedMarketPair.ts +1 -1
  56. package/generated/src/models/Order.ts +24 -0
  57. package/generated/src/models/Position.ts +45 -17
  58. package/generated/src/models/UnifiedSeries.ts +4 -4
  59. package/generated/src/models/UserTrade.ts +24 -0
  60. package/generated/src/models/index.ts +1 -0
  61. package/package.json +2 -2
  62. package/pmxt/client.ts +47 -7
@@ -57,6 +57,24 @@ export interface UserTrade {
57
57
  * @memberof UserTrade
58
58
  */
59
59
  orderId?: string;
60
+ /**
61
+ * Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
62
+ * @type {string}
63
+ * @memberof UserTrade
64
+ */
65
+ txHash?: string | null;
66
+ /**
67
+ * Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
68
+ * @type {string}
69
+ * @memberof UserTrade
70
+ */
71
+ chain?: string | null;
72
+ /**
73
+ * Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
74
+ * @type {number}
75
+ * @memberof UserTrade
76
+ */
77
+ blockNumber?: number | null;
60
78
  }
61
79
  /**
62
80
  * @export
@@ -50,6 +50,9 @@ export function UserTradeFromJSONTyped(json, ignoreDiscriminator) {
50
50
  'side': json['side'],
51
51
  'outcomeId': json['outcomeId'] == null ? undefined : json['outcomeId'],
52
52
  'orderId': json['orderId'] == null ? undefined : json['orderId'],
53
+ 'txHash': json['txHash'] == null ? undefined : json['txHash'],
54
+ 'chain': json['chain'] == null ? undefined : json['chain'],
55
+ 'blockNumber': json['blockNumber'] == null ? undefined : json['blockNumber'],
53
56
  };
54
57
  }
55
58
  export function UserTradeToJSON(json) {
@@ -67,5 +70,8 @@ export function UserTradeToJSONTyped(value, ignoreDiscriminator = false) {
67
70
  'side': value['side'],
68
71
  'outcomeId': value['outcomeId'],
69
72
  'orderId': value['orderId'],
73
+ 'txHash': value['txHash'],
74
+ 'chain': value['chain'],
75
+ 'blockNumber': value['blockNumber'],
70
76
  };
71
77
  }
@@ -21,6 +21,7 @@ export * from './EventFilterCriteriaTotalVolume.js';
21
21
  export * from './EventMatchResult.js';
22
22
  export * from './ExchangeCredentials.js';
23
23
  export * from './ExchangeCredentialsSignatureType.js';
24
+ export * from './ExchangeOptions.js';
24
25
  export * from './ExecutionPriceResult.js';
25
26
  export * from './FeedFetchHistoricalPrices200Response.js';
26
27
  export * from './FeedFetchOHLCV200Response.js';
@@ -23,6 +23,7 @@ export * from './EventFilterCriteriaTotalVolume.js';
23
23
  export * from './EventMatchResult.js';
24
24
  export * from './ExchangeCredentials.js';
25
25
  export * from './ExchangeCredentialsSignatureType.js';
26
+ export * from './ExchangeOptions.js';
26
27
  export * from './ExecutionPriceResult.js';
27
28
  export * from './FeedFetchHistoricalPrices200Response.js';
28
29
  export * from './FeedFetchOHLCV200Response.js';
@@ -72,6 +72,9 @@ export interface ExchangeOptions {
72
72
  */
73
73
  export declare abstract class Exchange {
74
74
  private static readonly OBDATA_WATCH_ALL_SOURCES;
75
+ private static readonly _UUID_RE;
76
+ /** True iff `value` parses as a canonical catalog UUID string. */
77
+ protected static _isCatalogUuid(value: string): boolean;
75
78
  exchangeName: string;
76
79
  pmxtApiKey?: string;
77
80
  protected apiKey?: string;
@@ -148,6 +148,14 @@ export class Exchange {
148
148
  "kalshi",
149
149
  "opinion",
150
150
  ]);
151
+ // Match a canonical 8-4-4-4-12 UUID string. The hosted catalog emits
152
+ // UUIDs in this exact shape, so a regex is both faster and stricter
153
+ // than `crypto.randomUUID()`-style parsing.
154
+ static _UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
155
+ /** True iff `value` parses as a canonical catalog UUID string. */
156
+ static _isCatalogUuid(value) {
157
+ return Exchange._UUID_RE.test(value);
158
+ }
151
159
  // Public so structural interfaces like `HostedClientLike`
152
160
  // (./hosted-routing) can read the venue name and hosted credentials
153
161
  // without violating protected-access on this base class.
@@ -2202,12 +2210,17 @@ export class Exchange {
2202
2210
  throw new InvalidOrder("cannot specify both 'outcome' and 'marketId'/'outcomeId'");
2203
2211
  }
2204
2212
  const outcome = params.outcome;
2205
- if (!outcome.marketId) {
2206
- throw new InvalidOrder("outcome.marketId is not set; ensure the outcome comes from a fetched market");
2213
+ if (!outcome.outcomeId) {
2214
+ throw new InvalidOrder("outcome.outcomeId is not set; ensure the outcome comes from a fetched market");
2207
2215
  }
2208
- marketId = outcome.marketId;
2216
+ // marketId is optional in hosted mode -- backend derives it from
2217
+ // outcomeId (catalog UUID). Forward it when present for backcompat.
2218
+ marketId = outcome.marketId || undefined;
2209
2219
  outcomeId = outcome.outcomeId;
2210
2220
  }
2221
+ if (!outcomeId) {
2222
+ throw new InvalidOrder("outcomeId is required (or pass an 'outcome' from a fetched market)");
2223
+ }
2211
2224
  const side = String(params.side);
2212
2225
  const orderType = String(params.type ?? "market");
2213
2226
  const denom = params["denom"];
@@ -2244,15 +2257,37 @@ export class Exchange {
2244
2257
  }
2245
2258
  // to6dec throws InvalidOrder for sub-micro precision.
2246
2259
  const amount6dec = to6dec(params.amount).toString();
2260
+ // The supplied outcomeId may be a catalog UUID OR a venue-native id
2261
+ // (e.g. a Polymarket tokenId or an Opinion market hash). Catalog
2262
+ // UUIDs are forwarded as `outcome_id`; venue-native ids are
2263
+ // forwarded as `(venue, venue_outcome_id)` so the backend resolver
2264
+ // picks the right path. Either shape is accepted by the v0 trading
2265
+ // API.
2247
2266
  const body = {
2248
- market_id: marketId,
2249
- outcome_id: outcomeId,
2250
2267
  side,
2251
2268
  order_type: orderType,
2252
2269
  denom: resolvedDenom,
2253
2270
  amount: params.amount,
2254
2271
  amount_6dec: amount6dec,
2255
2272
  };
2273
+ if (Exchange._isCatalogUuid(outcomeId)) {
2274
+ body["outcome_id"] = outcomeId;
2275
+ // market_id is optional in hosted mode: backend derives it
2276
+ // from outcome_id (UUID) when omitted. Forward only when the
2277
+ // caller supplied a non-empty UUID -- "absent" and "null" are
2278
+ // not equivalent under some Pydantic configs on the backend.
2279
+ if (marketId && Exchange._isCatalogUuid(marketId)) {
2280
+ body["market_id"] = marketId;
2281
+ }
2282
+ }
2283
+ else {
2284
+ // Venue-native form: backend resolves the row from
2285
+ // (source_exchange, pmxt_id). marketId from a venue client is
2286
+ // itself venue-native and would fail backend UUID validation
2287
+ // if forwarded -- suppress it.
2288
+ body["venue"] = this.exchangeName;
2289
+ body["venue_outcome_id"] = outcomeId;
2290
+ }
2256
2291
  if (params.price !== undefined)
2257
2292
  body["price"] = params.price;
2258
2293
  const extra = params;
@@ -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.
@@ -44,6 +44,7 @@ function BalanceFromJSONTyped(json, ignoreDiscriminator) {
44
44
  'total': json['total'],
45
45
  'available': json['available'],
46
46
  'locked': json['locked'],
47
+ 'venue': json['venue'] == null ? undefined : json['venue'],
47
48
  };
48
49
  }
49
50
  function BalanceToJSON(json) {
@@ -58,5 +59,6 @@ function BalanceToJSONTyped(value, ignoreDiscriminator = false) {
58
59
  'total': value['total'],
59
60
  'available': value['available'],
60
61
  'locked': value['locked'],
62
+ 'venue': value['venue'],
61
63
  };
62
64
  }
@@ -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.
@@ -45,6 +45,7 @@ function BuiltOrderFromJSONTyped(json, ignoreDiscriminator) {
45
45
  'signedOrder': json['signedOrder'] == null ? undefined : json['signedOrder'],
46
46
  'tx': json['tx'] == null ? undefined : (0, BuiltOrderTx_1.BuiltOrderTxFromJSON)(json['tx']),
47
47
  'raw': json['raw'],
48
+ 'expiry': json['expiry'] == null ? undefined : json['expiry'],
48
49
  };
49
50
  }
50
51
  function BuiltOrderToJSON(json) {
@@ -60,5 +61,6 @@ function BuiltOrderToJSONTyped(value, ignoreDiscriminator = false) {
60
61
  'signedOrder': value['signedOrder'],
61
62
  'tx': (0, BuiltOrderTx_1.BuiltOrderTxToJSON)(value['tx']),
62
63
  'raw': value['raw'],
64
+ 'expiry': value['expiry'],
63
65
  };
64
66
  }
@@ -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
  */
@@ -13,11 +13,41 @@
13
13
  * Do not edit the class manually.
14
14
  */
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.ErrorDetailCodeEnum = void 0;
16
17
  exports.instanceOfErrorDetail = instanceOfErrorDetail;
17
18
  exports.ErrorDetailFromJSON = ErrorDetailFromJSON;
18
19
  exports.ErrorDetailFromJSONTyped = ErrorDetailFromJSONTyped;
19
20
  exports.ErrorDetailToJSON = ErrorDetailToJSON;
20
21
  exports.ErrorDetailToJSONTyped = ErrorDetailToJSONTyped;
22
+ /**
23
+ * @export
24
+ */
25
+ exports.ErrorDetailCodeEnum = {
26
+ HostedTradingError: 'HOSTED_TRADING_ERROR',
27
+ InsufficientEscrowBalance: 'INSUFFICIENT_ESCROW_BALANCE',
28
+ OrderSizeTooSmall: 'ORDER_SIZE_TOO_SMALL',
29
+ InvalidApiKey: 'INVALID_API_KEY',
30
+ OutcomeNotFound: 'OUTCOME_NOT_FOUND',
31
+ CatalogUnavailable: 'CATALOG_UNAVAILABLE',
32
+ BuiltOrderExpired: 'BUILT_ORDER_EXPIRED',
33
+ InvalidSignature: 'INVALID_SIGNATURE',
34
+ NoLiquidity: 'NO_LIQUIDITY',
35
+ MissingWalletAddress: 'MISSING_WALLET_ADDRESS',
36
+ BadRequest: 'BAD_REQUEST',
37
+ AuthenticationError: 'AUTHENTICATION_ERROR',
38
+ PermissionDenied: 'PERMISSION_DENIED',
39
+ NotFound: 'NOT_FOUND',
40
+ OrderNotFound: 'ORDER_NOT_FOUND',
41
+ MarketNotFound: 'MARKET_NOT_FOUND',
42
+ EventNotFound: 'EVENT_NOT_FOUND',
43
+ RateLimitExceeded: 'RATE_LIMIT_EXCEEDED',
44
+ InvalidOrder: 'INVALID_ORDER',
45
+ InsufficientFunds: 'INSUFFICIENT_FUNDS',
46
+ ValidationError: 'VALIDATION_ERROR',
47
+ NetworkError: 'NETWORK_ERROR',
48
+ ExchangeNotAvailable: 'EXCHANGE_NOT_AVAILABLE',
49
+ NotSupported: 'NOT_SUPPORTED'
50
+ };
21
51
  /**
22
52
  * Check if a given object implements the ErrorDetail interface.
23
53
  */
@@ -33,6 +63,10 @@ function ErrorDetailFromJSONTyped(json, ignoreDiscriminator) {
33
63
  }
34
64
  return {
35
65
  'message': json['message'] == null ? undefined : json['message'],
66
+ 'code': json['code'] == null ? undefined : json['code'],
67
+ 'retryable': json['retryable'] == null ? undefined : json['retryable'],
68
+ 'exchange': json['exchange'] == null ? undefined : json['exchange'],
69
+ 'detail': json['detail'] == null ? undefined : json['detail'],
36
70
  };
37
71
  }
38
72
  function ErrorDetailToJSON(json) {
@@ -44,5 +78,9 @@ function ErrorDetailToJSONTyped(value, ignoreDiscriminator = false) {
44
78
  }
45
79
  return {
46
80
  'message': value['message'],
81
+ 'code': value['code'],
82
+ 'retryable': value['retryable'],
83
+ 'exchange': value['exchange'],
84
+ 'detail': value['detail'],
47
85
  };
48
86
  }
@@ -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,60 @@
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.instanceOfExchangeOptions = instanceOfExchangeOptions;
17
+ exports.ExchangeOptionsFromJSON = ExchangeOptionsFromJSON;
18
+ exports.ExchangeOptionsFromJSONTyped = ExchangeOptionsFromJSONTyped;
19
+ exports.ExchangeOptionsToJSON = ExchangeOptionsToJSON;
20
+ exports.ExchangeOptionsToJSONTyped = ExchangeOptionsToJSONTyped;
21
+ /**
22
+ * Check if a given object implements the ExchangeOptions interface.
23
+ */
24
+ function instanceOfExchangeOptions(value) {
25
+ return true;
26
+ }
27
+ function ExchangeOptionsFromJSON(json) {
28
+ return ExchangeOptionsFromJSONTyped(json, false);
29
+ }
30
+ function ExchangeOptionsFromJSONTyped(json, ignoreDiscriminator) {
31
+ if (json == null) {
32
+ return json;
33
+ }
34
+ return {
35
+ 'pmxtApiKey': json['pmxtApiKey'] == null ? undefined : json['pmxtApiKey'],
36
+ 'walletAddress': json['walletAddress'] == null ? undefined : json['walletAddress'],
37
+ 'signer': json['signer'] == null ? undefined : json['signer'],
38
+ 'privateKey': json['privateKey'] == null ? undefined : json['privateKey'],
39
+ 'baseUrl': json['baseUrl'] == null ? undefined : json['baseUrl'],
40
+ 'apiKey': json['apiKey'] == null ? undefined : json['apiKey'],
41
+ 'autoStartServer': json['autoStartServer'] == null ? undefined : json['autoStartServer'],
42
+ };
43
+ }
44
+ function ExchangeOptionsToJSON(json) {
45
+ return ExchangeOptionsToJSONTyped(json, false);
46
+ }
47
+ function ExchangeOptionsToJSONTyped(value, ignoreDiscriminator = false) {
48
+ if (value == null) {
49
+ return value;
50
+ }
51
+ return {
52
+ 'pmxtApiKey': value['pmxtApiKey'],
53
+ 'walletAddress': value['walletAddress'],
54
+ 'signer': value['signer'],
55
+ 'privateKey': value['privateKey'],
56
+ 'baseUrl': value['baseUrl'],
57
+ 'apiKey': value['apiKey'],
58
+ 'autoStartServer': value['autoStartServer'],
59
+ };
60
+ }
@@ -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
@@ -91,6 +91,9 @@ function OrderFromJSONTyped(json, ignoreDiscriminator) {
91
91
  'timestamp': json['timestamp'],
92
92
  'fee': json['fee'] == null ? undefined : json['fee'],
93
93
  'feeRateBps': json['feeRateBps'] == null ? undefined : json['feeRateBps'],
94
+ 'txHash': json['txHash'] == null ? undefined : json['txHash'],
95
+ 'chain': json['chain'] == null ? undefined : json['chain'],
96
+ 'blockNumber': json['blockNumber'] == null ? undefined : json['blockNumber'],
94
97
  };
95
98
  }
96
99
  function OrderToJSON(json) {
@@ -115,5 +118,8 @@ function OrderToJSONTyped(value, ignoreDiscriminator = false) {
115
118
  'timestamp': value['timestamp'],
116
119
  'fee': value['fee'],
117
120
  'feeRateBps': value['feeRateBps'],
121
+ 'txHash': value['txHash'],
122
+ 'chain': value['chain'],
123
+ 'blockNumber': value['blockNumber'],
118
124
  };
119
125
  }
@@ -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.