@predictorsdk/client 0.4.0 → 0.6.0
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/Client.d.ts +80 -0
- package/dist/Client.js +432 -0
- package/dist/api/client/requests/GetEventRequest.d.ts +13 -0
- package/dist/api/client/requests/GetEventRequest.js +2 -0
- package/dist/api/client/requests/GetMarketRequest.d.ts +13 -0
- package/dist/api/client/requests/GetMarketRequest.js +2 -0
- package/dist/api/client/requests/ListPolymarketWalletPositionsRequest.d.ts +16 -0
- package/dist/api/client/requests/ListPolymarketWalletPositionsRequest.js +2 -0
- package/dist/api/client/requests/index.d.ts +3 -0
- package/dist/api/types/EventFanout.d.ts +8 -0
- package/dist/api/types/EventFanout.js +2 -0
- package/dist/api/types/EventMarket.d.ts +6 -0
- package/dist/api/types/EventMarket.js +2 -0
- package/dist/api/types/EventResponse.d.ts +13 -0
- package/dist/api/types/EventResponse.js +2 -0
- package/dist/api/types/EventResponsePlatform.d.ts +8 -0
- package/dist/api/types/EventResponsePlatform.js +8 -0
- package/dist/api/types/GetEventRequestPlatform.d.ts +7 -0
- package/dist/api/types/GetEventRequestPlatform.js +7 -0
- package/dist/api/types/GetMarketRequestPlatform.d.ts +7 -0
- package/dist/api/types/GetMarketRequestPlatform.js +7 -0
- package/dist/api/types/MarketDetailOutcome.d.ts +4 -0
- package/dist/api/types/MarketDetailOutcome.js +2 -0
- package/dist/api/types/MarketDetailResponse.d.ts +18 -0
- package/dist/api/types/MarketDetailResponse.js +2 -0
- package/dist/api/types/MarketDetailResponseProvider.d.ts +8 -0
- package/dist/api/types/MarketDetailResponseProvider.js +8 -0
- package/dist/api/types/MarketDetailResponseStatus.d.ts +7 -0
- package/dist/api/types/MarketDetailResponseStatus.js +7 -0
- package/dist/api/types/PaginationBlock.d.ts +1 -1
- package/dist/api/types/PolymarketPosition.d.ts +8 -0
- package/dist/api/types/PolymarketPosition.js +2 -0
- package/dist/api/types/PolymarketPositionsResponse.d.ts +7 -0
- package/dist/api/types/PolymarketPositionsResponse.js +2 -0
- package/dist/api/types/index.d.ts +12 -0
- package/dist/api/types/index.js +12 -0
- package/dist/serialization/types/EventFanout.d.ts +11 -0
- package/dist/serialization/types/EventFanout.js +7 -0
- package/dist/serialization/types/EventMarket.d.ts +10 -0
- package/dist/serialization/types/EventMarket.js +6 -0
- package/dist/serialization/types/EventResponse.d.ts +16 -0
- package/dist/serialization/types/EventResponse.js +12 -0
- package/dist/serialization/types/EventResponsePlatform.d.ts +7 -0
- package/dist/serialization/types/EventResponsePlatform.js +3 -0
- package/dist/serialization/types/GetEventRequestPlatform.d.ts +7 -0
- package/dist/serialization/types/GetEventRequestPlatform.js +3 -0
- package/dist/serialization/types/GetMarketRequestPlatform.d.ts +7 -0
- package/dist/serialization/types/GetMarketRequestPlatform.js +3 -0
- package/dist/serialization/types/MarketDetailOutcome.d.ts +9 -0
- package/dist/serialization/types/MarketDetailOutcome.js +5 -0
- package/dist/serialization/types/MarketDetailResponse.d.ts +17 -0
- package/dist/serialization/types/MarketDetailResponse.js +13 -0
- package/dist/serialization/types/MarketDetailResponseProvider.d.ts +7 -0
- package/dist/serialization/types/MarketDetailResponseProvider.js +3 -0
- package/dist/serialization/types/MarketDetailResponseStatus.d.ts +7 -0
- package/dist/serialization/types/MarketDetailResponseStatus.js +3 -0
- package/dist/serialization/types/PolymarketPosition.d.ts +11 -0
- package/dist/serialization/types/PolymarketPosition.js +7 -0
- package/dist/serialization/types/PolymarketPositionsResponse.d.ts +13 -0
- package/dist/serialization/types/PolymarketPositionsResponse.js +9 -0
- package/dist/serialization/types/index.d.ts +12 -0
- package/dist/serialization/types/index.js +12 -0
- package/package.json +1 -1
package/dist/Client.d.ts
CHANGED
|
@@ -46,6 +46,30 @@ export declare class PredictorSDKClient {
|
|
|
46
46
|
*/
|
|
47
47
|
getMarkets(request?: PredictorSDK.GetMarketsRequest, requestOptions?: PredictorSDKClient.RequestOptions): core.HttpResponsePromise<PredictorSDK.MarketsListResponse>;
|
|
48
48
|
private __getMarkets;
|
|
49
|
+
/**
|
|
50
|
+
* Returns a single market across the four supported platforms. The `market_id` is either the composite form returned by `GET /v1/markets` (`{provider}:{native_id}`, e.g. `kalshi:KXMLBGAME-26MAY262005HOUTEX-TEX`) or the platform-native identifier. Composite IDs dispatch unambiguously by prefix. Native IDs are routed by format inference: Kalshi tickers match the all-caps-with-hyphens shape (`KX…-…`); SX Bet hashes match `0x` + 64 hex characters; numeric ids and kebab-case slugs are shared shape between Polymarket and Predict and probe Polymarket first, falling back to Predict on 404. Pass `?platform=` explicitly to skip the probe.
|
|
51
|
+
*
|
|
52
|
+
* Response shape is intentionally strict-universal: only fields every platform's single-market endpoint exposes natively without a second fetch. Pricing lives in SX Bet's order book, Predict's market record has no close timestamp (that lives on the parent category), and SX Bet/Predict don't expose volume or liquidity on the market record in any reliable form — those fields are deliberately omitted from v0 to avoid asymmetric nullable shapes. Additions are additive when the underlying coverage improves.
|
|
53
|
+
*
|
|
54
|
+
* @param {PredictorSDK.GetMarketRequest} request
|
|
55
|
+
* @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
56
|
+
*
|
|
57
|
+
* @throws {@link PredictorSDK.BadRequestError}
|
|
58
|
+
* @throws {@link PredictorSDK.UnauthorizedError}
|
|
59
|
+
* @throws {@link PredictorSDK.PaymentRequiredError}
|
|
60
|
+
* @throws {@link PredictorSDK.ForbiddenError}
|
|
61
|
+
* @throws {@link PredictorSDK.NotFoundError}
|
|
62
|
+
* @throws {@link PredictorSDK.TooManyRequestsError}
|
|
63
|
+
* @throws {@link PredictorSDK.BadGatewayError}
|
|
64
|
+
* @throws {@link PredictorSDK.ServiceUnavailableError}
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* await client.getMarket({
|
|
68
|
+
* marketId: "kalshi:KXMLBGAME-26MAY262005HOUTEX-TEX"
|
|
69
|
+
* })
|
|
70
|
+
*/
|
|
71
|
+
getMarket(request: PredictorSDK.GetMarketRequest, requestOptions?: PredictorSDKClient.RequestOptions): core.HttpResponsePromise<PredictorSDK.MarketDetailResponse>;
|
|
72
|
+
private __getMarket;
|
|
49
73
|
/**
|
|
50
74
|
* Returns per-second price data for a Binance trading pair. When called without a time range, returns the latest price. With `start_time` and `end_time`, returns historical per-second prices in newest-first order. Supports cursor-based pagination for large result sets. Unknown or invalid symbols return `200` with `{"prices":[]}` and omit `total`.
|
|
51
75
|
*
|
|
@@ -93,6 +117,62 @@ export declare class PredictorSDKClient {
|
|
|
93
117
|
*/
|
|
94
118
|
getPolymarketWallet(request?: PredictorSDK.GetPolymarketWalletRequest, requestOptions?: PredictorSDKClient.RequestOptions): core.HttpResponsePromise<PredictorSDK.PolymarketWalletResponse>;
|
|
95
119
|
private __getPolymarketWallet;
|
|
120
|
+
/**
|
|
121
|
+
* Returns the current Polymarket positions for a wallet. Accepts either a wallet `address` (proxy address only — see note below) or a Polymarket `username`. Exactly one of the two must be supplied — passing both returns `400`.
|
|
122
|
+
*
|
|
123
|
+
* v1 surfaces a minimal field set so the endpoint scaffolding can be verified end-to-end: `condition_id` (which market), `outcome` (which side), and `shares` (how much). Title/slug, avg/current price, PnL (`cash_pnl`, `realized_pnl`), `redeemable`/`mergeable` flags, and event metadata will be added in follow-ups.
|
|
124
|
+
*
|
|
125
|
+
* `total` in the pagination block is always `0` because the upstream Data API does not return a total count; rely on `has_more` + `next_cursor` to paginate.
|
|
126
|
+
*
|
|
127
|
+
* **EOA inputs are not auto-resolved on this endpoint.** Unlike `/v1/polymarket/wallet`, this endpoint does not perform the EOA→proxy CREATE2 resolution. Callers with a signer EOA should call `/v1/polymarket/wallet` first to resolve the proxy, then pass the returned `address`. Passing an EOA directly will return an empty `data` array.
|
|
128
|
+
*
|
|
129
|
+
* @param {PredictorSDK.ListPolymarketWalletPositionsRequest} request
|
|
130
|
+
* @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
131
|
+
*
|
|
132
|
+
* @throws {@link PredictorSDK.BadRequestError}
|
|
133
|
+
* @throws {@link PredictorSDK.UnauthorizedError}
|
|
134
|
+
* @throws {@link PredictorSDK.PaymentRequiredError}
|
|
135
|
+
* @throws {@link PredictorSDK.ForbiddenError}
|
|
136
|
+
* @throws {@link PredictorSDK.NotFoundError}
|
|
137
|
+
* @throws {@link PredictorSDK.TooManyRequestsError}
|
|
138
|
+
* @throws {@link PredictorSDK.BadGatewayError}
|
|
139
|
+
* @throws {@link PredictorSDK.ServiceUnavailableError}
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* await client.listPolymarketWalletPositions({
|
|
143
|
+
* address: "0x7c3db723f1d4d8cb9c550095203b686cb11e5c6b"
|
|
144
|
+
* })
|
|
145
|
+
*/
|
|
146
|
+
listPolymarketWalletPositions(request?: PredictorSDK.ListPolymarketWalletPositionsRequest, requestOptions?: PredictorSDKClient.RequestOptions): core.HttpResponsePromise<PredictorSDK.PolymarketPositionsResponse>;
|
|
147
|
+
private __listPolymarketWalletPositions;
|
|
148
|
+
/**
|
|
149
|
+
* Returns a single event and the markets nested under it on the identified platform. The `event_id` is the platform's native identifier — a Kalshi `event_ticker`, a Polymarket event slug, an SX Bet `eventId`, or a Predict market identifier. The `platform` is inferred from the ID format when unambiguous (`KX…` → Kalshi, `L\d+` → SX Bet). Numeric IDs and kebab-case slugs are shared shape between Polymarket and Predict; if `?platform=` is omitted in that case, the service probes Polymarket first and falls back to Predict when Polymarket returns 404. Pass `?platform=` explicitly to skip the probe.
|
|
150
|
+
*
|
|
151
|
+
* Response is minimal in v0: each market is returned with its platform-native `market_id` and a human-readable `title`. Pricing, volume, status, and timestamps are intentionally deferred — they'll be added as additive fields to `EventMarket` in a later release. The endpoint mirrors the `/v1/markets` rollout pattern (titles first, fields later).
|
|
152
|
+
*
|
|
153
|
+
* **Kalshi sibling fanout.** A single Kalshi sports game lives across multiple event tickers that share a game suffix — e.g. `KXMLBGAME-26MAY221840CLEPHI` holds the moneyline, `KXMLBF5TOTAL-26MAY221840CLEPHI` holds the totals, and so on. When the supplied event_ticker belongs to a sport in the sibling registry (MLB, NBA, NFL, NHL, WNBA today), this endpoint fans out across known sibling series in parallel and merges their markets into one response. Siblings that don't exist for a particular game silently drop. Siblings that error are reported under `fanout.siblings_missing`; the primary event still returns 200 in that case. Only the primary fetch failing produces a 4xx/5xx — partial fanouts never fail the request.
|
|
154
|
+
*
|
|
155
|
+
* **Polymarket** events already nest the moneyline plus all spread/totals/game-level prop markets under a single event slug, so no fanout is performed. **SX Bet** fixtures similarly bundle game lines per `eventId`. **Predict** currently treats `event_id` as a market identifier and wraps the single market as a 1-element event response, since the upstream `event` concept on Predict is closer to a category than to a multi-market container.
|
|
156
|
+
*
|
|
157
|
+
* @param {PredictorSDK.GetEventRequest} request
|
|
158
|
+
* @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
159
|
+
*
|
|
160
|
+
* @throws {@link PredictorSDK.BadRequestError}
|
|
161
|
+
* @throws {@link PredictorSDK.UnauthorizedError}
|
|
162
|
+
* @throws {@link PredictorSDK.PaymentRequiredError}
|
|
163
|
+
* @throws {@link PredictorSDK.ForbiddenError}
|
|
164
|
+
* @throws {@link PredictorSDK.NotFoundError}
|
|
165
|
+
* @throws {@link PredictorSDK.TooManyRequestsError}
|
|
166
|
+
* @throws {@link PredictorSDK.BadGatewayError}
|
|
167
|
+
* @throws {@link PredictorSDK.ServiceUnavailableError}
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* await client.getEvent({
|
|
171
|
+
* eventId: "KXMLBGAME-26MAY221840CLEPHI"
|
|
172
|
+
* })
|
|
173
|
+
*/
|
|
174
|
+
getEvent(request: PredictorSDK.GetEventRequest, requestOptions?: PredictorSDKClient.RequestOptions): core.HttpResponsePromise<PredictorSDK.EventResponse>;
|
|
175
|
+
private __getEvent;
|
|
96
176
|
/**
|
|
97
177
|
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
98
178
|
* This is useful for making requests to endpoints not yet supported in the SDK.
|
package/dist/Client.js
CHANGED
|
@@ -249,6 +249,148 @@ export class PredictorSDKClient {
|
|
|
249
249
|
}
|
|
250
250
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/markets");
|
|
251
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Returns a single market across the four supported platforms. The `market_id` is either the composite form returned by `GET /v1/markets` (`{provider}:{native_id}`, e.g. `kalshi:KXMLBGAME-26MAY262005HOUTEX-TEX`) or the platform-native identifier. Composite IDs dispatch unambiguously by prefix. Native IDs are routed by format inference: Kalshi tickers match the all-caps-with-hyphens shape (`KX…-…`); SX Bet hashes match `0x` + 64 hex characters; numeric ids and kebab-case slugs are shared shape between Polymarket and Predict and probe Polymarket first, falling back to Predict on 404. Pass `?platform=` explicitly to skip the probe.
|
|
254
|
+
*
|
|
255
|
+
* Response shape is intentionally strict-universal: only fields every platform's single-market endpoint exposes natively without a second fetch. Pricing lives in SX Bet's order book, Predict's market record has no close timestamp (that lives on the parent category), and SX Bet/Predict don't expose volume or liquidity on the market record in any reliable form — those fields are deliberately omitted from v0 to avoid asymmetric nullable shapes. Additions are additive when the underlying coverage improves.
|
|
256
|
+
*
|
|
257
|
+
* @param {PredictorSDK.GetMarketRequest} request
|
|
258
|
+
* @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
259
|
+
*
|
|
260
|
+
* @throws {@link PredictorSDK.BadRequestError}
|
|
261
|
+
* @throws {@link PredictorSDK.UnauthorizedError}
|
|
262
|
+
* @throws {@link PredictorSDK.PaymentRequiredError}
|
|
263
|
+
* @throws {@link PredictorSDK.ForbiddenError}
|
|
264
|
+
* @throws {@link PredictorSDK.NotFoundError}
|
|
265
|
+
* @throws {@link PredictorSDK.TooManyRequestsError}
|
|
266
|
+
* @throws {@link PredictorSDK.BadGatewayError}
|
|
267
|
+
* @throws {@link PredictorSDK.ServiceUnavailableError}
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* await client.getMarket({
|
|
271
|
+
* marketId: "kalshi:KXMLBGAME-26MAY262005HOUTEX-TEX"
|
|
272
|
+
* })
|
|
273
|
+
*/
|
|
274
|
+
getMarket(request, requestOptions) {
|
|
275
|
+
return core.HttpResponsePromise.fromPromise(this.__getMarket(request, requestOptions));
|
|
276
|
+
}
|
|
277
|
+
async __getMarket(request, requestOptions) {
|
|
278
|
+
const { marketId, platform } = request;
|
|
279
|
+
const _queryParams = {
|
|
280
|
+
platform: platform != null
|
|
281
|
+
? serializers.GetMarketRequestPlatform.jsonOrThrow(platform, {
|
|
282
|
+
unrecognizedObjectKeys: "strip",
|
|
283
|
+
omitUndefined: true,
|
|
284
|
+
})
|
|
285
|
+
: undefined,
|
|
286
|
+
};
|
|
287
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
288
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
289
|
+
const _response = await core.fetcher({
|
|
290
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
291
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
292
|
+
environments.PredictorSDKEnvironment.Production, `v1/markets/${core.url.encodePathParam(marketId)}`),
|
|
293
|
+
method: "GET",
|
|
294
|
+
headers: _headers,
|
|
295
|
+
queryString: core.url
|
|
296
|
+
.queryBuilder()
|
|
297
|
+
.addMany(_queryParams)
|
|
298
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
299
|
+
.build(),
|
|
300
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
301
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
302
|
+
abortSignal: requestOptions?.abortSignal,
|
|
303
|
+
fetchFn: this._options?.fetch,
|
|
304
|
+
logging: this._options.logging,
|
|
305
|
+
});
|
|
306
|
+
if (_response.ok) {
|
|
307
|
+
return {
|
|
308
|
+
data: serializers.MarketDetailResponse.parseOrThrow(_response.body, {
|
|
309
|
+
unrecognizedObjectKeys: "passthrough",
|
|
310
|
+
allowUnrecognizedUnionMembers: true,
|
|
311
|
+
allowUnrecognizedEnumValues: true,
|
|
312
|
+
skipValidation: true,
|
|
313
|
+
breadcrumbsPrefix: ["response"],
|
|
314
|
+
}),
|
|
315
|
+
rawResponse: _response.rawResponse,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
if (_response.error.reason === "status-code") {
|
|
319
|
+
switch (_response.error.statusCode) {
|
|
320
|
+
case 400:
|
|
321
|
+
throw new PredictorSDK.BadRequestError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
322
|
+
unrecognizedObjectKeys: "passthrough",
|
|
323
|
+
allowUnrecognizedUnionMembers: true,
|
|
324
|
+
allowUnrecognizedEnumValues: true,
|
|
325
|
+
skipValidation: true,
|
|
326
|
+
breadcrumbsPrefix: ["response"],
|
|
327
|
+
}), _response.rawResponse);
|
|
328
|
+
case 401:
|
|
329
|
+
throw new PredictorSDK.UnauthorizedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
330
|
+
unrecognizedObjectKeys: "passthrough",
|
|
331
|
+
allowUnrecognizedUnionMembers: true,
|
|
332
|
+
allowUnrecognizedEnumValues: true,
|
|
333
|
+
skipValidation: true,
|
|
334
|
+
breadcrumbsPrefix: ["response"],
|
|
335
|
+
}), _response.rawResponse);
|
|
336
|
+
case 402:
|
|
337
|
+
throw new PredictorSDK.PaymentRequiredError(serializers.PaymentRequiredErrorBody.parseOrThrow(_response.error.body, {
|
|
338
|
+
unrecognizedObjectKeys: "passthrough",
|
|
339
|
+
allowUnrecognizedUnionMembers: true,
|
|
340
|
+
allowUnrecognizedEnumValues: true,
|
|
341
|
+
skipValidation: true,
|
|
342
|
+
breadcrumbsPrefix: ["response"],
|
|
343
|
+
}), _response.rawResponse);
|
|
344
|
+
case 403:
|
|
345
|
+
throw new PredictorSDK.ForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
346
|
+
unrecognizedObjectKeys: "passthrough",
|
|
347
|
+
allowUnrecognizedUnionMembers: true,
|
|
348
|
+
allowUnrecognizedEnumValues: true,
|
|
349
|
+
skipValidation: true,
|
|
350
|
+
breadcrumbsPrefix: ["response"],
|
|
351
|
+
}), _response.rawResponse);
|
|
352
|
+
case 404:
|
|
353
|
+
throw new PredictorSDK.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
354
|
+
unrecognizedObjectKeys: "passthrough",
|
|
355
|
+
allowUnrecognizedUnionMembers: true,
|
|
356
|
+
allowUnrecognizedEnumValues: true,
|
|
357
|
+
skipValidation: true,
|
|
358
|
+
breadcrumbsPrefix: ["response"],
|
|
359
|
+
}), _response.rawResponse);
|
|
360
|
+
case 429:
|
|
361
|
+
throw new PredictorSDK.TooManyRequestsError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
362
|
+
unrecognizedObjectKeys: "passthrough",
|
|
363
|
+
allowUnrecognizedUnionMembers: true,
|
|
364
|
+
allowUnrecognizedEnumValues: true,
|
|
365
|
+
skipValidation: true,
|
|
366
|
+
breadcrumbsPrefix: ["response"],
|
|
367
|
+
}), _response.rawResponse);
|
|
368
|
+
case 502:
|
|
369
|
+
throw new PredictorSDK.BadGatewayError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
370
|
+
unrecognizedObjectKeys: "passthrough",
|
|
371
|
+
allowUnrecognizedUnionMembers: true,
|
|
372
|
+
allowUnrecognizedEnumValues: true,
|
|
373
|
+
skipValidation: true,
|
|
374
|
+
breadcrumbsPrefix: ["response"],
|
|
375
|
+
}), _response.rawResponse);
|
|
376
|
+
case 503:
|
|
377
|
+
throw new PredictorSDK.ServiceUnavailableError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
378
|
+
unrecognizedObjectKeys: "passthrough",
|
|
379
|
+
allowUnrecognizedUnionMembers: true,
|
|
380
|
+
allowUnrecognizedEnumValues: true,
|
|
381
|
+
skipValidation: true,
|
|
382
|
+
breadcrumbsPrefix: ["response"],
|
|
383
|
+
}), _response.rawResponse);
|
|
384
|
+
default:
|
|
385
|
+
throw new errors.PredictorSDKError({
|
|
386
|
+
statusCode: _response.error.statusCode,
|
|
387
|
+
body: _response.error.body,
|
|
388
|
+
rawResponse: _response.rawResponse,
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/markets/{market_id}");
|
|
393
|
+
}
|
|
252
394
|
/**
|
|
253
395
|
* Returns per-second price data for a Binance trading pair. When called without a time range, returns the latest price. With `start_time` and `end_time`, returns historical per-second prices in newest-first order. Supports cursor-based pagination for large result sets. Unknown or invalid symbols return `200` with `{"prices":[]}` and omit `total`.
|
|
254
396
|
*
|
|
@@ -519,6 +661,296 @@ export class PredictorSDKClient {
|
|
|
519
661
|
}
|
|
520
662
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/polymarket/wallet");
|
|
521
663
|
}
|
|
664
|
+
/**
|
|
665
|
+
* Returns the current Polymarket positions for a wallet. Accepts either a wallet `address` (proxy address only — see note below) or a Polymarket `username`. Exactly one of the two must be supplied — passing both returns `400`.
|
|
666
|
+
*
|
|
667
|
+
* v1 surfaces a minimal field set so the endpoint scaffolding can be verified end-to-end: `condition_id` (which market), `outcome` (which side), and `shares` (how much). Title/slug, avg/current price, PnL (`cash_pnl`, `realized_pnl`), `redeemable`/`mergeable` flags, and event metadata will be added in follow-ups.
|
|
668
|
+
*
|
|
669
|
+
* `total` in the pagination block is always `0` because the upstream Data API does not return a total count; rely on `has_more` + `next_cursor` to paginate.
|
|
670
|
+
*
|
|
671
|
+
* **EOA inputs are not auto-resolved on this endpoint.** Unlike `/v1/polymarket/wallet`, this endpoint does not perform the EOA→proxy CREATE2 resolution. Callers with a signer EOA should call `/v1/polymarket/wallet` first to resolve the proxy, then pass the returned `address`. Passing an EOA directly will return an empty `data` array.
|
|
672
|
+
*
|
|
673
|
+
* @param {PredictorSDK.ListPolymarketWalletPositionsRequest} request
|
|
674
|
+
* @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
675
|
+
*
|
|
676
|
+
* @throws {@link PredictorSDK.BadRequestError}
|
|
677
|
+
* @throws {@link PredictorSDK.UnauthorizedError}
|
|
678
|
+
* @throws {@link PredictorSDK.PaymentRequiredError}
|
|
679
|
+
* @throws {@link PredictorSDK.ForbiddenError}
|
|
680
|
+
* @throws {@link PredictorSDK.NotFoundError}
|
|
681
|
+
* @throws {@link PredictorSDK.TooManyRequestsError}
|
|
682
|
+
* @throws {@link PredictorSDK.BadGatewayError}
|
|
683
|
+
* @throws {@link PredictorSDK.ServiceUnavailableError}
|
|
684
|
+
*
|
|
685
|
+
* @example
|
|
686
|
+
* await client.listPolymarketWalletPositions({
|
|
687
|
+
* address: "0x7c3db723f1d4d8cb9c550095203b686cb11e5c6b"
|
|
688
|
+
* })
|
|
689
|
+
*/
|
|
690
|
+
listPolymarketWalletPositions(request = {}, requestOptions) {
|
|
691
|
+
return core.HttpResponsePromise.fromPromise(this.__listPolymarketWalletPositions(request, requestOptions));
|
|
692
|
+
}
|
|
693
|
+
async __listPolymarketWalletPositions(request = {}, requestOptions) {
|
|
694
|
+
const { address, username, limit, cursor } = request;
|
|
695
|
+
const _queryParams = {
|
|
696
|
+
address,
|
|
697
|
+
username,
|
|
698
|
+
limit,
|
|
699
|
+
cursor,
|
|
700
|
+
};
|
|
701
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
702
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
703
|
+
const _response = await core.fetcher({
|
|
704
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
705
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
706
|
+
environments.PredictorSDKEnvironment.Production, "v1/polymarket/wallet/positions"),
|
|
707
|
+
method: "GET",
|
|
708
|
+
headers: _headers,
|
|
709
|
+
queryString: core.url
|
|
710
|
+
.queryBuilder()
|
|
711
|
+
.addMany(_queryParams)
|
|
712
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
713
|
+
.build(),
|
|
714
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
715
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
716
|
+
abortSignal: requestOptions?.abortSignal,
|
|
717
|
+
fetchFn: this._options?.fetch,
|
|
718
|
+
logging: this._options.logging,
|
|
719
|
+
});
|
|
720
|
+
if (_response.ok) {
|
|
721
|
+
return {
|
|
722
|
+
data: serializers.PolymarketPositionsResponse.parseOrThrow(_response.body, {
|
|
723
|
+
unrecognizedObjectKeys: "passthrough",
|
|
724
|
+
allowUnrecognizedUnionMembers: true,
|
|
725
|
+
allowUnrecognizedEnumValues: true,
|
|
726
|
+
skipValidation: true,
|
|
727
|
+
breadcrumbsPrefix: ["response"],
|
|
728
|
+
}),
|
|
729
|
+
rawResponse: _response.rawResponse,
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
if (_response.error.reason === "status-code") {
|
|
733
|
+
switch (_response.error.statusCode) {
|
|
734
|
+
case 400:
|
|
735
|
+
throw new PredictorSDK.BadRequestError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
736
|
+
unrecognizedObjectKeys: "passthrough",
|
|
737
|
+
allowUnrecognizedUnionMembers: true,
|
|
738
|
+
allowUnrecognizedEnumValues: true,
|
|
739
|
+
skipValidation: true,
|
|
740
|
+
breadcrumbsPrefix: ["response"],
|
|
741
|
+
}), _response.rawResponse);
|
|
742
|
+
case 401:
|
|
743
|
+
throw new PredictorSDK.UnauthorizedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
744
|
+
unrecognizedObjectKeys: "passthrough",
|
|
745
|
+
allowUnrecognizedUnionMembers: true,
|
|
746
|
+
allowUnrecognizedEnumValues: true,
|
|
747
|
+
skipValidation: true,
|
|
748
|
+
breadcrumbsPrefix: ["response"],
|
|
749
|
+
}), _response.rawResponse);
|
|
750
|
+
case 402:
|
|
751
|
+
throw new PredictorSDK.PaymentRequiredError(serializers.PaymentRequiredErrorBody.parseOrThrow(_response.error.body, {
|
|
752
|
+
unrecognizedObjectKeys: "passthrough",
|
|
753
|
+
allowUnrecognizedUnionMembers: true,
|
|
754
|
+
allowUnrecognizedEnumValues: true,
|
|
755
|
+
skipValidation: true,
|
|
756
|
+
breadcrumbsPrefix: ["response"],
|
|
757
|
+
}), _response.rawResponse);
|
|
758
|
+
case 403:
|
|
759
|
+
throw new PredictorSDK.ForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
760
|
+
unrecognizedObjectKeys: "passthrough",
|
|
761
|
+
allowUnrecognizedUnionMembers: true,
|
|
762
|
+
allowUnrecognizedEnumValues: true,
|
|
763
|
+
skipValidation: true,
|
|
764
|
+
breadcrumbsPrefix: ["response"],
|
|
765
|
+
}), _response.rawResponse);
|
|
766
|
+
case 404:
|
|
767
|
+
throw new PredictorSDK.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
768
|
+
unrecognizedObjectKeys: "passthrough",
|
|
769
|
+
allowUnrecognizedUnionMembers: true,
|
|
770
|
+
allowUnrecognizedEnumValues: true,
|
|
771
|
+
skipValidation: true,
|
|
772
|
+
breadcrumbsPrefix: ["response"],
|
|
773
|
+
}), _response.rawResponse);
|
|
774
|
+
case 429:
|
|
775
|
+
throw new PredictorSDK.TooManyRequestsError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
776
|
+
unrecognizedObjectKeys: "passthrough",
|
|
777
|
+
allowUnrecognizedUnionMembers: true,
|
|
778
|
+
allowUnrecognizedEnumValues: true,
|
|
779
|
+
skipValidation: true,
|
|
780
|
+
breadcrumbsPrefix: ["response"],
|
|
781
|
+
}), _response.rawResponse);
|
|
782
|
+
case 502:
|
|
783
|
+
throw new PredictorSDK.BadGatewayError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
784
|
+
unrecognizedObjectKeys: "passthrough",
|
|
785
|
+
allowUnrecognizedUnionMembers: true,
|
|
786
|
+
allowUnrecognizedEnumValues: true,
|
|
787
|
+
skipValidation: true,
|
|
788
|
+
breadcrumbsPrefix: ["response"],
|
|
789
|
+
}), _response.rawResponse);
|
|
790
|
+
case 503:
|
|
791
|
+
throw new PredictorSDK.ServiceUnavailableError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
792
|
+
unrecognizedObjectKeys: "passthrough",
|
|
793
|
+
allowUnrecognizedUnionMembers: true,
|
|
794
|
+
allowUnrecognizedEnumValues: true,
|
|
795
|
+
skipValidation: true,
|
|
796
|
+
breadcrumbsPrefix: ["response"],
|
|
797
|
+
}), _response.rawResponse);
|
|
798
|
+
default:
|
|
799
|
+
throw new errors.PredictorSDKError({
|
|
800
|
+
statusCode: _response.error.statusCode,
|
|
801
|
+
body: _response.error.body,
|
|
802
|
+
rawResponse: _response.rawResponse,
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/polymarket/wallet/positions");
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Returns a single event and the markets nested under it on the identified platform. The `event_id` is the platform's native identifier — a Kalshi `event_ticker`, a Polymarket event slug, an SX Bet `eventId`, or a Predict market identifier. The `platform` is inferred from the ID format when unambiguous (`KX…` → Kalshi, `L\d+` → SX Bet). Numeric IDs and kebab-case slugs are shared shape between Polymarket and Predict; if `?platform=` is omitted in that case, the service probes Polymarket first and falls back to Predict when Polymarket returns 404. Pass `?platform=` explicitly to skip the probe.
|
|
810
|
+
*
|
|
811
|
+
* Response is minimal in v0: each market is returned with its platform-native `market_id` and a human-readable `title`. Pricing, volume, status, and timestamps are intentionally deferred — they'll be added as additive fields to `EventMarket` in a later release. The endpoint mirrors the `/v1/markets` rollout pattern (titles first, fields later).
|
|
812
|
+
*
|
|
813
|
+
* **Kalshi sibling fanout.** A single Kalshi sports game lives across multiple event tickers that share a game suffix — e.g. `KXMLBGAME-26MAY221840CLEPHI` holds the moneyline, `KXMLBF5TOTAL-26MAY221840CLEPHI` holds the totals, and so on. When the supplied event_ticker belongs to a sport in the sibling registry (MLB, NBA, NFL, NHL, WNBA today), this endpoint fans out across known sibling series in parallel and merges their markets into one response. Siblings that don't exist for a particular game silently drop. Siblings that error are reported under `fanout.siblings_missing`; the primary event still returns 200 in that case. Only the primary fetch failing produces a 4xx/5xx — partial fanouts never fail the request.
|
|
814
|
+
*
|
|
815
|
+
* **Polymarket** events already nest the moneyline plus all spread/totals/game-level prop markets under a single event slug, so no fanout is performed. **SX Bet** fixtures similarly bundle game lines per `eventId`. **Predict** currently treats `event_id` as a market identifier and wraps the single market as a 1-element event response, since the upstream `event` concept on Predict is closer to a category than to a multi-market container.
|
|
816
|
+
*
|
|
817
|
+
* @param {PredictorSDK.GetEventRequest} request
|
|
818
|
+
* @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
819
|
+
*
|
|
820
|
+
* @throws {@link PredictorSDK.BadRequestError}
|
|
821
|
+
* @throws {@link PredictorSDK.UnauthorizedError}
|
|
822
|
+
* @throws {@link PredictorSDK.PaymentRequiredError}
|
|
823
|
+
* @throws {@link PredictorSDK.ForbiddenError}
|
|
824
|
+
* @throws {@link PredictorSDK.NotFoundError}
|
|
825
|
+
* @throws {@link PredictorSDK.TooManyRequestsError}
|
|
826
|
+
* @throws {@link PredictorSDK.BadGatewayError}
|
|
827
|
+
* @throws {@link PredictorSDK.ServiceUnavailableError}
|
|
828
|
+
*
|
|
829
|
+
* @example
|
|
830
|
+
* await client.getEvent({
|
|
831
|
+
* eventId: "KXMLBGAME-26MAY221840CLEPHI"
|
|
832
|
+
* })
|
|
833
|
+
*/
|
|
834
|
+
getEvent(request, requestOptions) {
|
|
835
|
+
return core.HttpResponsePromise.fromPromise(this.__getEvent(request, requestOptions));
|
|
836
|
+
}
|
|
837
|
+
async __getEvent(request, requestOptions) {
|
|
838
|
+
const { eventId, platform } = request;
|
|
839
|
+
const _queryParams = {
|
|
840
|
+
platform: platform != null
|
|
841
|
+
? serializers.GetEventRequestPlatform.jsonOrThrow(platform, {
|
|
842
|
+
unrecognizedObjectKeys: "strip",
|
|
843
|
+
omitUndefined: true,
|
|
844
|
+
})
|
|
845
|
+
: undefined,
|
|
846
|
+
};
|
|
847
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
848
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
849
|
+
const _response = await core.fetcher({
|
|
850
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
851
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
852
|
+
environments.PredictorSDKEnvironment.Production, `v1/events/${core.url.encodePathParam(eventId)}`),
|
|
853
|
+
method: "GET",
|
|
854
|
+
headers: _headers,
|
|
855
|
+
queryString: core.url
|
|
856
|
+
.queryBuilder()
|
|
857
|
+
.addMany(_queryParams)
|
|
858
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
859
|
+
.build(),
|
|
860
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
861
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
862
|
+
abortSignal: requestOptions?.abortSignal,
|
|
863
|
+
fetchFn: this._options?.fetch,
|
|
864
|
+
logging: this._options.logging,
|
|
865
|
+
});
|
|
866
|
+
if (_response.ok) {
|
|
867
|
+
return {
|
|
868
|
+
data: serializers.EventResponse.parseOrThrow(_response.body, {
|
|
869
|
+
unrecognizedObjectKeys: "passthrough",
|
|
870
|
+
allowUnrecognizedUnionMembers: true,
|
|
871
|
+
allowUnrecognizedEnumValues: true,
|
|
872
|
+
skipValidation: true,
|
|
873
|
+
breadcrumbsPrefix: ["response"],
|
|
874
|
+
}),
|
|
875
|
+
rawResponse: _response.rawResponse,
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
if (_response.error.reason === "status-code") {
|
|
879
|
+
switch (_response.error.statusCode) {
|
|
880
|
+
case 400:
|
|
881
|
+
throw new PredictorSDK.BadRequestError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
882
|
+
unrecognizedObjectKeys: "passthrough",
|
|
883
|
+
allowUnrecognizedUnionMembers: true,
|
|
884
|
+
allowUnrecognizedEnumValues: true,
|
|
885
|
+
skipValidation: true,
|
|
886
|
+
breadcrumbsPrefix: ["response"],
|
|
887
|
+
}), _response.rawResponse);
|
|
888
|
+
case 401:
|
|
889
|
+
throw new PredictorSDK.UnauthorizedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
890
|
+
unrecognizedObjectKeys: "passthrough",
|
|
891
|
+
allowUnrecognizedUnionMembers: true,
|
|
892
|
+
allowUnrecognizedEnumValues: true,
|
|
893
|
+
skipValidation: true,
|
|
894
|
+
breadcrumbsPrefix: ["response"],
|
|
895
|
+
}), _response.rawResponse);
|
|
896
|
+
case 402:
|
|
897
|
+
throw new PredictorSDK.PaymentRequiredError(serializers.PaymentRequiredErrorBody.parseOrThrow(_response.error.body, {
|
|
898
|
+
unrecognizedObjectKeys: "passthrough",
|
|
899
|
+
allowUnrecognizedUnionMembers: true,
|
|
900
|
+
allowUnrecognizedEnumValues: true,
|
|
901
|
+
skipValidation: true,
|
|
902
|
+
breadcrumbsPrefix: ["response"],
|
|
903
|
+
}), _response.rawResponse);
|
|
904
|
+
case 403:
|
|
905
|
+
throw new PredictorSDK.ForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
906
|
+
unrecognizedObjectKeys: "passthrough",
|
|
907
|
+
allowUnrecognizedUnionMembers: true,
|
|
908
|
+
allowUnrecognizedEnumValues: true,
|
|
909
|
+
skipValidation: true,
|
|
910
|
+
breadcrumbsPrefix: ["response"],
|
|
911
|
+
}), _response.rawResponse);
|
|
912
|
+
case 404:
|
|
913
|
+
throw new PredictorSDK.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
914
|
+
unrecognizedObjectKeys: "passthrough",
|
|
915
|
+
allowUnrecognizedUnionMembers: true,
|
|
916
|
+
allowUnrecognizedEnumValues: true,
|
|
917
|
+
skipValidation: true,
|
|
918
|
+
breadcrumbsPrefix: ["response"],
|
|
919
|
+
}), _response.rawResponse);
|
|
920
|
+
case 429:
|
|
921
|
+
throw new PredictorSDK.TooManyRequestsError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
922
|
+
unrecognizedObjectKeys: "passthrough",
|
|
923
|
+
allowUnrecognizedUnionMembers: true,
|
|
924
|
+
allowUnrecognizedEnumValues: true,
|
|
925
|
+
skipValidation: true,
|
|
926
|
+
breadcrumbsPrefix: ["response"],
|
|
927
|
+
}), _response.rawResponse);
|
|
928
|
+
case 502:
|
|
929
|
+
throw new PredictorSDK.BadGatewayError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
930
|
+
unrecognizedObjectKeys: "passthrough",
|
|
931
|
+
allowUnrecognizedUnionMembers: true,
|
|
932
|
+
allowUnrecognizedEnumValues: true,
|
|
933
|
+
skipValidation: true,
|
|
934
|
+
breadcrumbsPrefix: ["response"],
|
|
935
|
+
}), _response.rawResponse);
|
|
936
|
+
case 503:
|
|
937
|
+
throw new PredictorSDK.ServiceUnavailableError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
938
|
+
unrecognizedObjectKeys: "passthrough",
|
|
939
|
+
allowUnrecognizedUnionMembers: true,
|
|
940
|
+
allowUnrecognizedEnumValues: true,
|
|
941
|
+
skipValidation: true,
|
|
942
|
+
breadcrumbsPrefix: ["response"],
|
|
943
|
+
}), _response.rawResponse);
|
|
944
|
+
default:
|
|
945
|
+
throw new errors.PredictorSDKError({
|
|
946
|
+
statusCode: _response.error.statusCode,
|
|
947
|
+
body: _response.error.body,
|
|
948
|
+
rawResponse: _response.rawResponse,
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/events/{event_id}");
|
|
953
|
+
}
|
|
522
954
|
/**
|
|
523
955
|
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
524
956
|
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as PredictorSDK from "../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* eventId: "KXMLBGAME-26MAY221840CLEPHI"
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface GetEventRequest {
|
|
9
|
+
/** Platform-native event identifier. Examples per platform: Kalshi event ticker (`KXMLBGAME-26MAY221840CLEPHI`), Polymarket event slug (`mlb-cle-phi-2026-05-22`), SX Bet event id (`L10073358`), Predict market id (`110629`). */
|
|
10
|
+
eventId: string;
|
|
11
|
+
/** Optional platform override. When omitted, inferred from the `event_id` format: `KX…` → Kalshi, `L\d+` → SX Bet. Numeric IDs and kebab-case slugs are shared shape between Polymarket and Predict; in that case the service probes Polymarket first and falls back to Predict on 404. Pass `platform` explicitly to skip the probe. */
|
|
12
|
+
platform?: PredictorSDK.GetEventRequestPlatform;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as PredictorSDK from "../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* marketId: "kalshi:KXMLBGAME-26MAY262005HOUTEX-TEX"
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface GetMarketRequest {
|
|
9
|
+
/** Composite (`{provider}:{native_id}`) or platform-native market identifier. Examples per platform: Kalshi market ticker (`KXMLBGAME-26MAY262005HOUTEX-TEX`), Polymarket numeric id or slug (`540817` or `new-rhianna-album-before-gta-vi-926`), Predict market id (`356635`), SX Bet `marketHash` (`0x…64hex`). */
|
|
10
|
+
marketId: string;
|
|
11
|
+
/** Optional platform override. When omitted, inferred from the composite prefix or from the native ID format (`KX…` → Kalshi, `0x…64hex` → SX Bet). Numeric IDs and kebab-case slugs are shared shape between Polymarket and Predict; in that case the service probes Polymarket first and falls back to Predict on 404. Pass `platform` explicitly to skip the probe. When the override contradicts a composite prefix (e.g. `kalshi:X` with `?platform=polymarket`), the request returns 400. */
|
|
12
|
+
platform?: PredictorSDK.GetMarketRequestPlatform;
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* address: "0x7c3db723f1d4d8cb9c550095203b686cb11e5c6b"
|
|
5
|
+
* }
|
|
6
|
+
*/
|
|
7
|
+
export interface ListPolymarketWalletPositionsRequest {
|
|
8
|
+
/** Polymarket proxy wallet address. Must match `^0x[a-fA-F0-9]{40}$`. Mixed-case input is accepted and lowercased in the response. Mutually exclusive with `username`; exactly one of the two is required. */
|
|
9
|
+
address?: string;
|
|
10
|
+
/** Polymarket display name to resolve to a proxy wallet. Match is case-insensitive and exact against the user's stored `name`. A leading `@` is accepted and stripped. Mutually exclusive with `address`. */
|
|
11
|
+
username?: string;
|
|
12
|
+
/** Number of items per page. Defaults to 50. */
|
|
13
|
+
limit?: number;
|
|
14
|
+
/** Opaque cursor from a previous response's `pagination.next_cursor`. Bound to the resolved wallet address — replaying a cursor against a different identifier returns `400`. */
|
|
15
|
+
cursor?: string;
|
|
16
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export type { GetBinanceCryptoPricesRequest } from "./GetBinanceCryptoPricesRequest.js";
|
|
2
|
+
export type { GetEventRequest } from "./GetEventRequest.js";
|
|
3
|
+
export type { GetMarketRequest } from "./GetMarketRequest.js";
|
|
2
4
|
export type { GetMarketsRequest } from "./GetMarketsRequest.js";
|
|
3
5
|
export type { GetPolymarketWalletRequest } from "./GetPolymarketWalletRequest.js";
|
|
4
6
|
export type { GetSportsMatchingMarketsRequest } from "./GetSportsMatchingMarketsRequest.js";
|
|
7
|
+
export type { ListPolymarketWalletPositionsRequest } from "./ListPolymarketWalletPositionsRequest.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface EventFanout {
|
|
2
|
+
/** Sibling event tickers the server attempted to fetch alongside the primary event. Determined by the Kalshi sibling registry for the primary event's series. */
|
|
3
|
+
siblingsAttempted: string[];
|
|
4
|
+
/** Sibling event tickers that returned successfully and contributed markets to the merged response. */
|
|
5
|
+
siblingsReturned: string[];
|
|
6
|
+
/** Sibling event tickers that did not exist upstream (404) or errored. The primary event still returned 200 — these are reported for observability, not as request failures. */
|
|
7
|
+
siblingsMissing: string[];
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface EventMarket {
|
|
2
|
+
/** Platform-native market identifier. Kalshi ticker (`KXMLBGAME-26MAY221840CLEPHI-CLE`), Polymarket numeric market id, SX Bet `marketHash`, or Predict market id. */
|
|
3
|
+
marketId: string;
|
|
4
|
+
/** Human-readable market title/question. */
|
|
5
|
+
title: string;
|
|
6
|
+
}
|