@liberfi.io/ui-predict 0.1.70 → 0.1.72
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/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +1 -1
- package/dist/client/index.mjs.map +1 -1
- package/dist/client-Doli88ls.d.mts +420 -0
- package/dist/client-Doli88ls.d.ts +420 -0
- package/dist/{index-BCkesJZQ.d.mts → index-BphwuECY.d.mts} +1 -1
- package/dist/{index-TBHCY2AW.d.ts → index-NXmKF-C9.d.ts} +1 -1
- package/dist/index.d.mts +161 -50
- package/dist/index.d.ts +161 -50
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/dist/{server-CUXRrxGG.d.ts → server-CeHdJzO-.d.ts} +1 -1
- package/dist/{server-Cb45Eqd0.d.mts → server-f1B7ItWZ.d.mts} +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +1 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +11 -11
- package/dist/client-DgC5flVr.d.mts +0 -201
- package/dist/client-DgC5flVr.d.ts +0 -201
|
@@ -1,201 +0,0 @@
|
|
|
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 };
|