@liberfi.io/ui-predict 0.1.63 → 0.1.64

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.
@@ -1 +1,2 @@
1
- export { aR as BasePredictClient, aU as DflowPredictClient, aV as DflowPredictWsClient, aU as PredictClient, P as PredictClientV2, aV as PredictWsClient, c as V2Event, V as V2EventSortField, e as V2EventStatus, l as V2ListEventsParams, d as V2Market, aZ as V2MarketResult, a_ as V2MarketStatus, a$ as V2Outcome, j as V2Page, b0 as V2ProviderMeta, b as V2ProviderSource, b1 as V2SettlementSource, b2 as V2Tag, aX as WsClientConfig, aS as buildQuery, aW as createDflowPredictWsClient, aY as createPredictClientV2, aW as createPredictWsClient, aT as toRecord } from '../index-DEqlfEAn.mjs';
1
+ export { aJ as BasePredictClient, aM as DflowPredictClient, aN as DflowPredictWsClient, aM as PredictClient, aN as PredictWsClient, aP as WsClientConfig, aK as buildQuery, aO as createDflowPredictWsClient, aO as createPredictWsClient, aL as toRecord } from '../index-BCkesJZQ.mjs';
2
+ export { P as PredictClientV2, b as V2Event, V as V2EventSortField, d as V2EventStatus, f as V2ListEventsParams, c as V2Market, h as V2MarketResult, i as V2MarketStatus, j as V2Outcome, e as V2Page, k as V2ProviderMeta, a as V2ProviderSource, l as V2SettlementSource, m as V2Tag, g as createPredictClientV2 } from '../client-DgC5flVr.mjs';
@@ -1 +1,2 @@
1
- export { aR as BasePredictClient, aU as DflowPredictClient, aV as DflowPredictWsClient, aU as PredictClient, P as PredictClientV2, aV as PredictWsClient, c as V2Event, V as V2EventSortField, e as V2EventStatus, l as V2ListEventsParams, d as V2Market, aZ as V2MarketResult, a_ as V2MarketStatus, a$ as V2Outcome, j as V2Page, b0 as V2ProviderMeta, b as V2ProviderSource, b1 as V2SettlementSource, b2 as V2Tag, aX as WsClientConfig, aS as buildQuery, aW as createDflowPredictWsClient, aY as createPredictClientV2, aW as createPredictWsClient, aT as toRecord } from '../index-DEqlfEAn.js';
1
+ export { aJ as BasePredictClient, aM as DflowPredictClient, aN as DflowPredictWsClient, aM as PredictClient, aN as PredictWsClient, aP as WsClientConfig, aK as buildQuery, aO as createDflowPredictWsClient, aO as createPredictWsClient, aL as toRecord } from '../index-TBHCY2AW.js';
2
+ export { P as PredictClientV2, b as V2Event, V as V2EventSortField, d as V2EventStatus, f as V2ListEventsParams, c as V2Market, h as V2MarketResult, i as V2MarketStatus, j as V2Outcome, e as V2Page, k as V2ProviderMeta, a as V2ProviderSource, l as V2SettlementSource, m as V2Tag, g as createPredictClientV2 } from '../client-DgC5flVr.js';
@@ -0,0 +1,201 @@
1
+ /**
2
+ * V2 types for the prediction-server REST API (/api/v1/events).
3
+ *
4
+ * These types are intentionally isolated from the legacy client types so that
5
+ * the v1 (DFlow) and v2 (prediction-server) clients can coexist and be migrated
6
+ * incrementally.
7
+ *
8
+ * Mirrors: github.com/liberfi-io/prediction-server/internal/domain
9
+ */
10
+ /** Upstream data provider that produced a domain object. */
11
+ type V2ProviderSource = "dflow" | "polymarket";
12
+ /**
13
+ * Provider-specific metadata attached to every domain aggregate.
14
+ * Keys are namespaced field paths, e.g. "polymarket.conditionId" or "dflow.yesMint".
15
+ * Values are raw JSON-decoded values.
16
+ */
17
+ type V2ProviderMeta = Record<string, unknown>;
18
+ /** Provider-sourced label attached to an Event. */
19
+ interface V2Tag {
20
+ slug: string;
21
+ label: string;
22
+ source: V2ProviderSource;
23
+ provider_meta?: V2ProviderMeta;
24
+ }
25
+ /** Lifecycle status of a prediction event (normalised across all providers). */
26
+ type V2EventStatus = "pending" | "open" | "closed" | "voided";
27
+ /** Settlement / resolution data source for an event. */
28
+ interface V2SettlementSource {
29
+ url: string;
30
+ name?: string;
31
+ }
32
+ /** Root aggregate for a prediction event from the prediction-server API. */
33
+ interface V2Event {
34
+ /** Internal database surrogate key (absent when not yet persisted). */
35
+ id?: number;
36
+ /**
37
+ * Canonical business key shared across all providers.
38
+ * - DFlow: ticker (e.g. "KXBTCD-25FEB-T68000")
39
+ * - Polymarket: slug (e.g. "will-trump-win-2024")
40
+ */
41
+ slug: string;
42
+ title: string;
43
+ subtitle?: string;
44
+ description?: string;
45
+ image_url?: string;
46
+ status: V2EventStatus;
47
+ /** ISO 8601 timestamp; absent if the provider does not supply it. */
48
+ start_at?: string;
49
+ end_at?: string;
50
+ created_at?: string;
51
+ updated_at?: string;
52
+ /** Provider-sourced labels for display only. */
53
+ tags?: V2Tag[];
54
+ /** All values are USD amounts. */
55
+ volume?: number;
56
+ volume_24h?: number;
57
+ liquidity?: number;
58
+ open_interest?: number;
59
+ settlement_sources?: V2SettlementSource[];
60
+ /** Nested markets; omitted when the request used `with_markets=false`. */
61
+ markets?: V2Market[];
62
+ source: V2ProviderSource;
63
+ provider_meta?: V2ProviderMeta;
64
+ }
65
+ /** Lifecycle status of a prediction market (normalised across all providers). */
66
+ type V2MarketStatus = "pending" | "open" | "closed" | "voided";
67
+ /** Final resolution of a closed market. Empty string means unresolved. */
68
+ type V2MarketResult = "yes" | "no" | "voided" | "";
69
+ /** One possible outcome in a binary (or multi-outcome) prediction market. */
70
+ interface V2Outcome {
71
+ /** Display name, e.g. "Yes" or "No". */
72
+ label: string;
73
+ /** Current implied probability [0, 1]. */
74
+ price?: number;
75
+ best_bid?: number;
76
+ best_ask?: number;
77
+ }
78
+ /** Tradeable prediction outcome within an Event. */
79
+ interface V2Market {
80
+ id?: number;
81
+ event_id?: number;
82
+ slug: string;
83
+ event_slug: string;
84
+ question: string;
85
+ description?: string;
86
+ /** Resolution/settlement rules in order. */
87
+ rules?: string[];
88
+ status: V2MarketStatus;
89
+ result?: V2MarketResult;
90
+ start_at?: string;
91
+ end_at?: string;
92
+ expires_at?: string;
93
+ created_at?: string;
94
+ updated_at?: string;
95
+ /** Always present; binary markets have exactly 2 outcomes (YES at [0], NO at [1]). */
96
+ outcomes: V2Outcome[];
97
+ volume?: number;
98
+ volume_24h?: number;
99
+ liquidity?: number;
100
+ open_interest?: number;
101
+ source: V2ProviderSource;
102
+ provider_meta?: V2ProviderMeta;
103
+ }
104
+ /** Generic paginated result set returned by the prediction-server list endpoints. */
105
+ interface V2Page<T> {
106
+ items: T[];
107
+ next_cursor?: string;
108
+ has_more?: boolean;
109
+ limit?: number;
110
+ /** Not all backends support total count. */
111
+ total?: number;
112
+ }
113
+ /** Valid sort fields accepted by `GET /api/v1/events`. */
114
+ type V2EventSortField = "volume" | "volume_24h" | "liquidity" | "open_interest" | "end_at" | "start_at" | "created_at";
115
+ /** Query parameters for `listEvents`. All fields are optional. */
116
+ interface V2ListEventsParams {
117
+ /** Page size. Server default: 20. */
118
+ limit?: number;
119
+ /** Opaque pagination cursor returned by the previous page's `next_cursor`. */
120
+ cursor?: string;
121
+ /** Filter by event lifecycle status. */
122
+ status?: V2EventStatus;
123
+ /** Filter by upstream provider. */
124
+ source?: V2ProviderSource;
125
+ /** Unified navigation tag slug (e.g. "politics", "sports"). */
126
+ tag_slug?: string;
127
+ /** Full-text search query. */
128
+ search?: string;
129
+ /** Field to sort by. */
130
+ sort_by?: V2EventSortField;
131
+ /** When `true`, sort ascending. Defaults to descending. */
132
+ sort_asc?: boolean;
133
+ /**
134
+ * When `false`, markets are omitted from each event for lighter payloads.
135
+ * Defaults to `true` on the server.
136
+ */
137
+ with_markets?: boolean;
138
+ }
139
+
140
+ /**
141
+ * HTTP client for the prediction-server REST API (v2 / prediction-server backend).
142
+ *
143
+ * Covers `GET /api/v1/events` (listEvents), `GET /api/v1/events/:slug` (getEvent),
144
+ * and `GET /api/v1/markets/:slug` (getMarket).
145
+ *
146
+ * This client is intentionally decoupled from the legacy `DflowPredictClient` so
147
+ * that both can be used in parallel during the incremental migration from the old
148
+ * DFlow-direct integration to the unified prediction-server backend.
149
+ *
150
+ * @example
151
+ * ```ts
152
+ * const client = new PredictClientV2("https://api.example.com");
153
+ * const page = await client.listEvents({ status: "open", limit: 20 });
154
+ * const event = await client.getEvent("will-trump-win-2024");
155
+ * const market = await client.getMarket("will-trump-win-2024-yes");
156
+ * ```
157
+ */
158
+ declare class PredictClientV2 {
159
+ private readonly endpoint;
160
+ constructor(endpoint: string);
161
+ /**
162
+ * List prediction events with optional filtering, sorting, and pagination.
163
+ *
164
+ * Maps to `GET /api/v1/events`.
165
+ *
166
+ * @param params - Optional query parameters (filter, sort, pagination).
167
+ * @returns A paginated page of events.
168
+ */
169
+ listEvents(params?: V2ListEventsParams): Promise<V2Page<V2Event>>;
170
+ /**
171
+ * Fetch a single prediction event by its slug.
172
+ *
173
+ * Maps to `GET /api/v1/events/:slug?source=...`.
174
+ *
175
+ * @param slug - Canonical event slug (e.g. "will-trump-win-2024" for Polymarket
176
+ * or "KXBTCD-25FEB-T68000" for DFlow).
177
+ * @param source - Upstream provider (`"dflow"` or `"polymarket"`).
178
+ * @returns The matching event.
179
+ * @throws When the server responds with 404 or any other non-2xx status.
180
+ */
181
+ getEvent(slug: string, source?: V2ProviderSource): Promise<V2Event>;
182
+ /**
183
+ * Fetch a single prediction market by its slug.
184
+ *
185
+ * Maps to `GET /api/v1/markets/:slug?source=...`.
186
+ *
187
+ * @param slug - Canonical market slug.
188
+ * @param source - Upstream provider (`"dflow"` or `"polymarket"`).
189
+ * @returns The matching market.
190
+ * @throws When the server responds with 404 or any other non-2xx status.
191
+ */
192
+ getMarket(slug: string, source?: V2ProviderSource): Promise<V2Market>;
193
+ }
194
+ /**
195
+ * Factory function for `PredictClientV2`.
196
+ *
197
+ * @param endpoint - Base URL of the prediction-server, without a trailing slash.
198
+ */
199
+ declare function createPredictClientV2(endpoint: string): PredictClientV2;
200
+
201
+ export { PredictClientV2 as P, type V2EventSortField as V, type V2ProviderSource as a, type V2Event as b, type V2Market as c, type V2EventStatus as d, type V2Page as e, type V2ListEventsParams as f, createPredictClientV2 as g, type V2MarketResult as h, type V2MarketStatus as i, type V2Outcome as j, type V2ProviderMeta as k, type V2SettlementSource as l, type V2Tag as m };
@@ -0,0 +1,201 @@
1
+ /**
2
+ * V2 types for the prediction-server REST API (/api/v1/events).
3
+ *
4
+ * These types are intentionally isolated from the legacy client types so that
5
+ * the v1 (DFlow) and v2 (prediction-server) clients can coexist and be migrated
6
+ * incrementally.
7
+ *
8
+ * Mirrors: github.com/liberfi-io/prediction-server/internal/domain
9
+ */
10
+ /** Upstream data provider that produced a domain object. */
11
+ type V2ProviderSource = "dflow" | "polymarket";
12
+ /**
13
+ * Provider-specific metadata attached to every domain aggregate.
14
+ * Keys are namespaced field paths, e.g. "polymarket.conditionId" or "dflow.yesMint".
15
+ * Values are raw JSON-decoded values.
16
+ */
17
+ type V2ProviderMeta = Record<string, unknown>;
18
+ /** Provider-sourced label attached to an Event. */
19
+ interface V2Tag {
20
+ slug: string;
21
+ label: string;
22
+ source: V2ProviderSource;
23
+ provider_meta?: V2ProviderMeta;
24
+ }
25
+ /** Lifecycle status of a prediction event (normalised across all providers). */
26
+ type V2EventStatus = "pending" | "open" | "closed" | "voided";
27
+ /** Settlement / resolution data source for an event. */
28
+ interface V2SettlementSource {
29
+ url: string;
30
+ name?: string;
31
+ }
32
+ /** Root aggregate for a prediction event from the prediction-server API. */
33
+ interface V2Event {
34
+ /** Internal database surrogate key (absent when not yet persisted). */
35
+ id?: number;
36
+ /**
37
+ * Canonical business key shared across all providers.
38
+ * - DFlow: ticker (e.g. "KXBTCD-25FEB-T68000")
39
+ * - Polymarket: slug (e.g. "will-trump-win-2024")
40
+ */
41
+ slug: string;
42
+ title: string;
43
+ subtitle?: string;
44
+ description?: string;
45
+ image_url?: string;
46
+ status: V2EventStatus;
47
+ /** ISO 8601 timestamp; absent if the provider does not supply it. */
48
+ start_at?: string;
49
+ end_at?: string;
50
+ created_at?: string;
51
+ updated_at?: string;
52
+ /** Provider-sourced labels for display only. */
53
+ tags?: V2Tag[];
54
+ /** All values are USD amounts. */
55
+ volume?: number;
56
+ volume_24h?: number;
57
+ liquidity?: number;
58
+ open_interest?: number;
59
+ settlement_sources?: V2SettlementSource[];
60
+ /** Nested markets; omitted when the request used `with_markets=false`. */
61
+ markets?: V2Market[];
62
+ source: V2ProviderSource;
63
+ provider_meta?: V2ProviderMeta;
64
+ }
65
+ /** Lifecycle status of a prediction market (normalised across all providers). */
66
+ type V2MarketStatus = "pending" | "open" | "closed" | "voided";
67
+ /** Final resolution of a closed market. Empty string means unresolved. */
68
+ type V2MarketResult = "yes" | "no" | "voided" | "";
69
+ /** One possible outcome in a binary (or multi-outcome) prediction market. */
70
+ interface V2Outcome {
71
+ /** Display name, e.g. "Yes" or "No". */
72
+ label: string;
73
+ /** Current implied probability [0, 1]. */
74
+ price?: number;
75
+ best_bid?: number;
76
+ best_ask?: number;
77
+ }
78
+ /** Tradeable prediction outcome within an Event. */
79
+ interface V2Market {
80
+ id?: number;
81
+ event_id?: number;
82
+ slug: string;
83
+ event_slug: string;
84
+ question: string;
85
+ description?: string;
86
+ /** Resolution/settlement rules in order. */
87
+ rules?: string[];
88
+ status: V2MarketStatus;
89
+ result?: V2MarketResult;
90
+ start_at?: string;
91
+ end_at?: string;
92
+ expires_at?: string;
93
+ created_at?: string;
94
+ updated_at?: string;
95
+ /** Always present; binary markets have exactly 2 outcomes (YES at [0], NO at [1]). */
96
+ outcomes: V2Outcome[];
97
+ volume?: number;
98
+ volume_24h?: number;
99
+ liquidity?: number;
100
+ open_interest?: number;
101
+ source: V2ProviderSource;
102
+ provider_meta?: V2ProviderMeta;
103
+ }
104
+ /** Generic paginated result set returned by the prediction-server list endpoints. */
105
+ interface V2Page<T> {
106
+ items: T[];
107
+ next_cursor?: string;
108
+ has_more?: boolean;
109
+ limit?: number;
110
+ /** Not all backends support total count. */
111
+ total?: number;
112
+ }
113
+ /** Valid sort fields accepted by `GET /api/v1/events`. */
114
+ type V2EventSortField = "volume" | "volume_24h" | "liquidity" | "open_interest" | "end_at" | "start_at" | "created_at";
115
+ /** Query parameters for `listEvents`. All fields are optional. */
116
+ interface V2ListEventsParams {
117
+ /** Page size. Server default: 20. */
118
+ limit?: number;
119
+ /** Opaque pagination cursor returned by the previous page's `next_cursor`. */
120
+ cursor?: string;
121
+ /** Filter by event lifecycle status. */
122
+ status?: V2EventStatus;
123
+ /** Filter by upstream provider. */
124
+ source?: V2ProviderSource;
125
+ /** Unified navigation tag slug (e.g. "politics", "sports"). */
126
+ tag_slug?: string;
127
+ /** Full-text search query. */
128
+ search?: string;
129
+ /** Field to sort by. */
130
+ sort_by?: V2EventSortField;
131
+ /** When `true`, sort ascending. Defaults to descending. */
132
+ sort_asc?: boolean;
133
+ /**
134
+ * When `false`, markets are omitted from each event for lighter payloads.
135
+ * Defaults to `true` on the server.
136
+ */
137
+ with_markets?: boolean;
138
+ }
139
+
140
+ /**
141
+ * HTTP client for the prediction-server REST API (v2 / prediction-server backend).
142
+ *
143
+ * Covers `GET /api/v1/events` (listEvents), `GET /api/v1/events/:slug` (getEvent),
144
+ * and `GET /api/v1/markets/:slug` (getMarket).
145
+ *
146
+ * This client is intentionally decoupled from the legacy `DflowPredictClient` so
147
+ * that both can be used in parallel during the incremental migration from the old
148
+ * DFlow-direct integration to the unified prediction-server backend.
149
+ *
150
+ * @example
151
+ * ```ts
152
+ * const client = new PredictClientV2("https://api.example.com");
153
+ * const page = await client.listEvents({ status: "open", limit: 20 });
154
+ * const event = await client.getEvent("will-trump-win-2024");
155
+ * const market = await client.getMarket("will-trump-win-2024-yes");
156
+ * ```
157
+ */
158
+ declare class PredictClientV2 {
159
+ private readonly endpoint;
160
+ constructor(endpoint: string);
161
+ /**
162
+ * List prediction events with optional filtering, sorting, and pagination.
163
+ *
164
+ * Maps to `GET /api/v1/events`.
165
+ *
166
+ * @param params - Optional query parameters (filter, sort, pagination).
167
+ * @returns A paginated page of events.
168
+ */
169
+ listEvents(params?: V2ListEventsParams): Promise<V2Page<V2Event>>;
170
+ /**
171
+ * Fetch a single prediction event by its slug.
172
+ *
173
+ * Maps to `GET /api/v1/events/:slug?source=...`.
174
+ *
175
+ * @param slug - Canonical event slug (e.g. "will-trump-win-2024" for Polymarket
176
+ * or "KXBTCD-25FEB-T68000" for DFlow).
177
+ * @param source - Upstream provider (`"dflow"` or `"polymarket"`).
178
+ * @returns The matching event.
179
+ * @throws When the server responds with 404 or any other non-2xx status.
180
+ */
181
+ getEvent(slug: string, source?: V2ProviderSource): Promise<V2Event>;
182
+ /**
183
+ * Fetch a single prediction market by its slug.
184
+ *
185
+ * Maps to `GET /api/v1/markets/:slug?source=...`.
186
+ *
187
+ * @param slug - Canonical market slug.
188
+ * @param source - Upstream provider (`"dflow"` or `"polymarket"`).
189
+ * @returns The matching market.
190
+ * @throws When the server responds with 404 or any other non-2xx status.
191
+ */
192
+ getMarket(slug: string, source?: V2ProviderSource): Promise<V2Market>;
193
+ }
194
+ /**
195
+ * Factory function for `PredictClientV2`.
196
+ *
197
+ * @param endpoint - Base URL of the prediction-server, without a trailing slash.
198
+ */
199
+ declare function createPredictClientV2(endpoint: string): PredictClientV2;
200
+
201
+ export { PredictClientV2 as P, type V2EventSortField as V, type V2ProviderSource as a, type V2Event as b, type V2Market as c, type V2EventStatus as d, type V2Page as e, type V2ListEventsParams as f, createPredictClientV2 as g, type V2MarketResult as h, type V2MarketStatus as i, type V2Outcome as j, type V2ProviderMeta as k, type V2SettlementSource as l, type V2Tag as m };
@@ -1,3 +1,5 @@
1
+ import './client-DgC5flVr.mjs';
2
+
1
3
  /** Supported prediction market providers */
2
4
  type ProviderType = "dflow" | "kalshi" | "polymarket";
3
5
  /** Market lifecycle status */
@@ -1214,206 +1216,6 @@ interface IPredictWsClient {
1214
1216
  subscribeOrderbook(options: WsSubscribeOptions, onUpdate: (update: WsOrderbookUpdate) => void): () => void;
1215
1217
  }
1216
1218
 
1217
- /**
1218
- * V2 types for the prediction-server REST API (/api/v1/events).
1219
- *
1220
- * These types are intentionally isolated from the legacy client types so that
1221
- * the v1 (DFlow) and v2 (prediction-server) clients can coexist and be migrated
1222
- * incrementally.
1223
- *
1224
- * Mirrors: github.com/liberfi-io/prediction-server/internal/domain
1225
- */
1226
- /** Upstream data provider that produced a domain object. */
1227
- type V2ProviderSource = "dflow" | "polymarket";
1228
- /**
1229
- * Provider-specific metadata attached to every domain aggregate.
1230
- * Keys are namespaced field paths, e.g. "polymarket.conditionId" or "dflow.yesMint".
1231
- * Values are raw JSON-decoded values.
1232
- */
1233
- type V2ProviderMeta = Record<string, unknown>;
1234
- /** Provider-sourced label attached to an Event. */
1235
- interface V2Tag {
1236
- slug: string;
1237
- label: string;
1238
- source: V2ProviderSource;
1239
- provider_meta?: V2ProviderMeta;
1240
- }
1241
- /** Lifecycle status of a prediction event (normalised across all providers). */
1242
- type V2EventStatus = "pending" | "open" | "closed" | "voided";
1243
- /** Settlement / resolution data source for an event. */
1244
- interface V2SettlementSource {
1245
- url: string;
1246
- name?: string;
1247
- }
1248
- /** Root aggregate for a prediction event from the prediction-server API. */
1249
- interface V2Event {
1250
- /** Internal database surrogate key (absent when not yet persisted). */
1251
- id?: number;
1252
- /**
1253
- * Canonical business key shared across all providers.
1254
- * - DFlow: ticker (e.g. "KXBTCD-25FEB-T68000")
1255
- * - Polymarket: slug (e.g. "will-trump-win-2024")
1256
- */
1257
- slug: string;
1258
- title: string;
1259
- subtitle?: string;
1260
- description?: string;
1261
- image_url?: string;
1262
- status: V2EventStatus;
1263
- /** ISO 8601 timestamp; absent if the provider does not supply it. */
1264
- start_at?: string;
1265
- end_at?: string;
1266
- created_at?: string;
1267
- updated_at?: string;
1268
- /** Provider-sourced labels for display only. */
1269
- tags?: V2Tag[];
1270
- /** All values are USD amounts. */
1271
- volume?: number;
1272
- volume_24h?: number;
1273
- liquidity?: number;
1274
- open_interest?: number;
1275
- settlement_sources?: V2SettlementSource[];
1276
- /** Nested markets; omitted when the request used `with_markets=false`. */
1277
- markets?: V2Market[];
1278
- source: V2ProviderSource;
1279
- provider_meta?: V2ProviderMeta;
1280
- }
1281
- /** Lifecycle status of a prediction market (normalised across all providers). */
1282
- type V2MarketStatus = "pending" | "open" | "closed" | "voided";
1283
- /** Final resolution of a closed market. Empty string means unresolved. */
1284
- type V2MarketResult = "yes" | "no" | "voided" | "";
1285
- /** One possible outcome in a binary (or multi-outcome) prediction market. */
1286
- interface V2Outcome {
1287
- /** Display name, e.g. "Yes" or "No". */
1288
- label: string;
1289
- /** Current implied probability [0, 1]. */
1290
- price?: number;
1291
- best_bid?: number;
1292
- best_ask?: number;
1293
- }
1294
- /** Tradeable prediction outcome within an Event. */
1295
- interface V2Market {
1296
- id?: number;
1297
- event_id?: number;
1298
- slug: string;
1299
- event_slug: string;
1300
- question: string;
1301
- description?: string;
1302
- /** Resolution/settlement rules in order. */
1303
- rules?: string[];
1304
- status: V2MarketStatus;
1305
- result?: V2MarketResult;
1306
- start_at?: string;
1307
- end_at?: string;
1308
- expires_at?: string;
1309
- created_at?: string;
1310
- updated_at?: string;
1311
- /** Always present; binary markets have exactly 2 outcomes (YES at [0], NO at [1]). */
1312
- outcomes: V2Outcome[];
1313
- volume?: number;
1314
- volume_24h?: number;
1315
- liquidity?: number;
1316
- open_interest?: number;
1317
- source: V2ProviderSource;
1318
- provider_meta?: V2ProviderMeta;
1319
- }
1320
- /** Generic paginated result set returned by the prediction-server list endpoints. */
1321
- interface V2Page<T> {
1322
- items: T[];
1323
- next_cursor?: string;
1324
- has_more?: boolean;
1325
- limit?: number;
1326
- /** Not all backends support total count. */
1327
- total?: number;
1328
- }
1329
- /** Valid sort fields accepted by `GET /api/v1/events`. */
1330
- type V2EventSortField = "volume" | "volume_24h" | "liquidity" | "open_interest" | "end_at" | "start_at" | "created_at";
1331
- /** Query parameters for `listEvents`. All fields are optional. */
1332
- interface V2ListEventsParams {
1333
- /** Page size. Server default: 20. */
1334
- limit?: number;
1335
- /** Opaque pagination cursor returned by the previous page's `next_cursor`. */
1336
- cursor?: string;
1337
- /** Filter by event lifecycle status. */
1338
- status?: V2EventStatus;
1339
- /** Filter by upstream provider. */
1340
- source?: V2ProviderSource;
1341
- /** Unified navigation tag slug (e.g. "politics", "sports"). */
1342
- tag_slug?: string;
1343
- /** Full-text search query. */
1344
- search?: string;
1345
- /** Field to sort by. */
1346
- sort_by?: V2EventSortField;
1347
- /** When `true`, sort ascending. Defaults to descending. */
1348
- sort_asc?: boolean;
1349
- /**
1350
- * When `false`, markets are omitted from each event for lighter payloads.
1351
- * Defaults to `true` on the server.
1352
- */
1353
- with_markets?: boolean;
1354
- }
1355
-
1356
- /**
1357
- * HTTP client for the prediction-server REST API (v2 / prediction-server backend).
1358
- *
1359
- * Covers `GET /api/v1/events` (listEvents), `GET /api/v1/events/:slug` (getEvent),
1360
- * and `GET /api/v1/markets/:slug` (getMarket).
1361
- *
1362
- * This client is intentionally decoupled from the legacy `DflowPredictClient` so
1363
- * that both can be used in parallel during the incremental migration from the old
1364
- * DFlow-direct integration to the unified prediction-server backend.
1365
- *
1366
- * @example
1367
- * ```ts
1368
- * const client = new PredictClientV2("https://api.example.com");
1369
- * const page = await client.listEvents({ status: "open", limit: 20 });
1370
- * const event = await client.getEvent("will-trump-win-2024");
1371
- * const market = await client.getMarket("will-trump-win-2024-yes");
1372
- * ```
1373
- */
1374
- declare class PredictClientV2 {
1375
- private readonly endpoint;
1376
- constructor(endpoint: string);
1377
- /**
1378
- * List prediction events with optional filtering, sorting, and pagination.
1379
- *
1380
- * Maps to `GET /api/v1/events`.
1381
- *
1382
- * @param params - Optional query parameters (filter, sort, pagination).
1383
- * @returns A paginated page of events.
1384
- */
1385
- listEvents(params?: V2ListEventsParams): Promise<V2Page<V2Event>>;
1386
- /**
1387
- * Fetch a single prediction event by its slug.
1388
- *
1389
- * Maps to `GET /api/v1/events/:slug?source=...`.
1390
- *
1391
- * @param slug - Canonical event slug (e.g. "will-trump-win-2024" for Polymarket
1392
- * or "KXBTCD-25FEB-T68000" for DFlow).
1393
- * @param source - Upstream provider (`"dflow"` or `"polymarket"`).
1394
- * @returns The matching event.
1395
- * @throws When the server responds with 404 or any other non-2xx status.
1396
- */
1397
- getEvent(slug: string, source?: V2ProviderSource): Promise<V2Event>;
1398
- /**
1399
- * Fetch a single prediction market by its slug.
1400
- *
1401
- * Maps to `GET /api/v1/markets/:slug?source=...`.
1402
- *
1403
- * @param slug - Canonical market slug.
1404
- * @param source - Upstream provider (`"dflow"` or `"polymarket"`).
1405
- * @returns The matching market.
1406
- * @throws When the server responds with 404 or any other non-2xx status.
1407
- */
1408
- getMarket(slug: string, source?: V2ProviderSource): Promise<V2Market>;
1409
- }
1410
- /**
1411
- * Factory function for `PredictClientV2`.
1412
- *
1413
- * @param endpoint - Base URL of the prediction-server, without a trailing slash.
1414
- */
1415
- declare function createPredictClientV2(endpoint: string): PredictClientV2;
1416
-
1417
1219
  /**
1418
1220
  * Build a query string from a params object.
1419
1221
  * Skips `undefined` and `null` values.
@@ -1615,4 +1417,4 @@ declare class DflowPredictWsClient implements IPredictWsClient {
1615
1417
  */
1616
1418
  declare function createDflowPredictWsClient(config: WsClientConfig): DflowPredictWsClient;
1617
1419
 
1618
- export { type QuoteResponse as $, type LiveDataByEventQueryParams as A, type LiveDataByMintQueryParams as B, type CandlesticksResponse as C, type SeriesQueryParams as D, type EventQueryParams as E, type ForecastPercentileHistoryQueryParams as F, type SeriesListResponse as G, type TagsByCategoriesResponse as H, type IPredictClient as I, type FiltersBySportsResponse as J, type SearchQueryParams as K, type LiveDataQueryParams as L, type MarketQueryParams as M, type SearchResponse as N, type OrderResponse as O, PredictClientV2 as P, type PositionsByWalletQueryParams as Q, type WalletPositionsResponse as R, type StandardEvent as S, type TradesQueryParams as T, type OutcomeMintsQueryParams as U, type V2EventSortField as V, type WalletPositionItem as W, type OutcomeMintsResponse as X, type FilterOutcomeMintsRequest as Y, type FilterOutcomeMintsResponse as Z, type QuoteQueryParams as _, type StandardMarket as a, type V2Outcome as a$, type SwapRequestBody as a0, type SwapResponse as a1, type SwapInstructionsResponse as a2, type OrderQueryParams as a3, type OrderStatusQueryParams as a4, type IntentQuoteQueryParams as a5, type IntentQuoteResponse as a6, type IntentSwapRequestBody as a7, type IntentSwapResponse as a8, type PredictionMarketInitQueryParams as a9, type RoutePlanLeg as aA, type PlatformFee as aB, type ComputeBudgetInfo as aC, type PrioritizationType as aD, type AccountMetaResponse as aE, type InstructionResponse as aF, type BlockhashWithMetadata as aG, type OrderFill as aH, type OrderRevert as aI, type IntentExpiry as aJ, type TokenWithDecimals as aK, type OrderbookQueryParams as aL, type PrioritizationFeeLamports as aM, type DestinationTokenAccountParam as aN, type CreateFeeAccountParams as aO, type PositiveSlippageParams as aP, type WsSubscribeOptions as aQ, BasePredictClient as aR, buildQuery as aS, toRecord as aT, DflowPredictClient as aU, DflowPredictWsClient as aV, createDflowPredictWsClient as aW, type WsClientConfig as aX, createPredictClientV2 as aY, type V2MarketResult as aZ, type V2MarketStatus as a_, type PredictionMarketInitResponse as aa, type TokenListResponse as ab, type TokenListWithDecimalsResponse as ac, type VenueListResponse as ad, type WsConnectionStatus as ae, type WsPriceUpdate as af, type WsTradeUpdate as ag, type WsOrderbookUpdate as ah, type ProviderType as ai, type MarketStatus as aj, type SortField as ak, type SortOrder as al, type OrderStatus as am, type PlatformFeeMode as an, type SlippageTolerance as ao, type PriorityLevel as ap, type ExecutionMode as aq, type SettlementSource as ar, type MarketAccountInfo as as, type OnchainTrade as at, type OnchainTradeSortBy as au, type OnchainTradesBaseQueryParams as av, type CandlestickOHLC as aw, type CandlestickDataPoint as ax, type ForecastPercentileDataPoint as ay, type SeriesSettlementSource as az, type V2ProviderSource as b, type V2ProviderMeta as b0, type V2SettlementSource as b1, type V2Tag as b2, type V2Event as c, type V2Market as d, type V2EventStatus as e, type OrderStatusResponse as f, type SeriesResponse as g, type OrderbookLevel as h, type SingleTradeResponse as i, type V2Page as j, type IPredictWsClient as k, type V2ListEventsParams as l, type StandardEventsResponse as m, type StandardMarketsResponse as n, type MarketsBatchRequest as o, type OrderbookResponse as p, type MultiTradeResponse as q, type TradesByMintQueryParams as r, type OnchainTradesByWalletQueryParams as s, type MultiOnchainTradeResponse as t, type OnchainTradesByEventQueryParams as u, type OnchainTradesByMarketQueryParams as v, type CandlesticksQueryParams as w, type ForecastPercentileHistoryResponse as x, type ForecastPercentileHistoryByMintQueryParams as y, type LiveDataResponse as z };
1420
+ export { type IntentSwapRequestBody as $, type SearchQueryParams as A, type SearchResponse as B, type CandlesticksResponse as C, type WalletPositionsResponse as D, type EventQueryParams as E, type ForecastPercentileHistoryQueryParams as F, type OutcomeMintsQueryParams as G, type OutcomeMintsResponse as H, type IPredictClient as I, type FilterOutcomeMintsRequest as J, type FilterOutcomeMintsResponse as K, type LiveDataQueryParams as L, type MarketQueryParams as M, type QuoteResponse as N, type OrderResponse as O, type PositionsByWalletQueryParams as P, type QuoteQueryParams as Q, type SwapRequestBody as R, type StandardEvent as S, type TradesQueryParams as T, type SwapResponse as U, type SwapInstructionsResponse as V, type WalletPositionItem as W, type OrderQueryParams as X, type OrderStatusQueryParams as Y, type IntentQuoteQueryParams as Z, type IntentQuoteResponse as _, type StandardMarket as a, type IntentSwapResponse as a0, type PredictionMarketInitQueryParams as a1, type PredictionMarketInitResponse as a2, type TokenListResponse as a3, type TokenListWithDecimalsResponse as a4, type VenueListResponse as a5, type WsConnectionStatus as a6, type WsPriceUpdate as a7, type WsTradeUpdate as a8, type WsOrderbookUpdate as a9, type OrderRevert as aA, type IntentExpiry as aB, type TokenWithDecimals as aC, type OrderbookQueryParams as aD, type PrioritizationFeeLamports as aE, type DestinationTokenAccountParam as aF, type CreateFeeAccountParams as aG, type PositiveSlippageParams as aH, type WsSubscribeOptions as aI, BasePredictClient as aJ, buildQuery as aK, toRecord as aL, DflowPredictClient as aM, DflowPredictWsClient as aN, createDflowPredictWsClient as aO, type WsClientConfig as aP, type ProviderType as aa, type MarketStatus as ab, type SortField as ac, type SortOrder as ad, type OrderStatus as ae, type PlatformFeeMode as af, type SlippageTolerance as ag, type PriorityLevel as ah, type ExecutionMode as ai, type SettlementSource as aj, type MarketAccountInfo as ak, type OnchainTrade as al, type OnchainTradeSortBy as am, type OnchainTradesBaseQueryParams as an, type CandlestickOHLC as ao, type CandlestickDataPoint as ap, type ForecastPercentileDataPoint as aq, type SeriesSettlementSource as ar, type RoutePlanLeg as as, type PlatformFee as at, type ComputeBudgetInfo as au, type PrioritizationType as av, type AccountMetaResponse as aw, type InstructionResponse as ax, type BlockhashWithMetadata as ay, type OrderFill as az, type OrderStatusResponse as b, type SeriesResponse as c, type OrderbookLevel as d, type SingleTradeResponse as e, type IPredictWsClient as f, type StandardEventsResponse as g, type StandardMarketsResponse as h, type MarketsBatchRequest as i, type OrderbookResponse as j, type MultiTradeResponse as k, type TradesByMintQueryParams as l, type OnchainTradesByWalletQueryParams as m, type MultiOnchainTradeResponse as n, type OnchainTradesByEventQueryParams as o, type OnchainTradesByMarketQueryParams as p, type CandlesticksQueryParams as q, type ForecastPercentileHistoryResponse as r, type ForecastPercentileHistoryByMintQueryParams as s, type LiveDataResponse as t, type LiveDataByEventQueryParams as u, type LiveDataByMintQueryParams as v, type SeriesQueryParams as w, type SeriesListResponse as x, type TagsByCategoriesResponse as y, type FiltersBySportsResponse as z };