@liberfi.io/react-predict 0.3.70 → 0.3.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/index.d.mts +325 -3
- package/dist/index.d.ts +325 -3
- package/dist/index.js +1621 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1601 -16
- package/dist/index.mjs.map +1 -1
- package/dist/{server-B8IpkdJf.d.mts → server-CzifZBb_.d.mts} +141 -2
- package/dist/{server-B8IpkdJf.d.ts → server-CzifZBb_.d.ts} +141 -2
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +126 -0
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +126 -0
- package/dist/server.mjs.map +1 -1
- package/package.json +6 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { M as MarketDataBBAComponent, a as MarketDataValueComponent, P as ProviderSource, b as MarketDataInitialQuotes, c as MarketDataBookLevel, d as MarketStatus, e as MarketDataWatchRequest, f as MarketDataWatchResponse, g as MarketDataMarketKey, h as MarketDataQuotesResponse, i as MarketDataOrderbooksResponse, j as MarketStructureHttpResponse, k as MarketStructureResponse, l as PredictClient, m as PredictWsClient, L as ListEventsParams, n as PredictPage, o as PredictEvent, p as PredictSearchParams, q as PredictSearchResponse, S as SportsTaxonomyParams, r as SportsTaxonomyResponse, s as SportsMatchesParams, t as SportsMatchesResponse, u as SportsPropsParams, v as SportsPropsResponse, E as EsportsTaxonomyParams, w as EsportsMatchesParams, x as EsportsPropsParams, y as SportsRoutingParams, z as SportsRoutingResponse, A as SportsSection, B as SportsMatchDetailParams, C as SportsMatchDetail, D as SportsOrderbookKey, O as Orderbook, F as EventStats, G as EventStatus, H as EventSortField, I as SimilarEventsParams, J as PredictMarket, K as OrderbookOutcome, N as ListMarketTradesParams, Q as PredictTrade, R as PriceHistoryRange, T as PriceHistoryParams, U as PriceHistoryResponse, V as ListCandlesticksParams, W as Candlestick, X as ListCommentsParams, Y as PredictComment, Z as PositionsResponse, _ as PositionValueResponse, $ as AvailableSharesResponse, a0 as BalanceResponse, a1 as ListOrdersParams, a2 as PredictOrder, a3 as ListOrdersMultiParams, a4 as PredictOrdersResponse, a5 as CancelOrderResult, a6 as MatchesParams, a7 as MatchGroupPage, a8 as MatchGroup, a9 as MatchMarketParams, aa as MatchMarketPage, ab as ListTradesParams, ac as ListTradesMultiParams, ad as DFlowQuoteRequest, ae as DFlowQuoteResponse, af as DFlowSubmitResponse, ag as DFlowSubmitRequest, ah as DFlowKYCStatus, ai as PolymarketSetupStatus, aj as PolymarketDepositWalletDeployResponse, ak as WithdrawBuildResponse, al as WithdrawBuildRequest, am as WithdrawSubmitResponse, an as WithdrawSubmitRequest, ao as WithdrawStatusResponse, ap as PolymarketDepositAddresses, aq as PolymarketSupportedAsset, ar as PolymarketWithdrawResponse, as as PolymarketWithdrawRequest, at as PolymarketWithdrawPrepareResponse, au as PolymarketWithdrawPrepareRequest, av as PolymarketWithdrawQuoteResponse, aw as PolymarketWithdrawQuoteRequest, ax as PolymarketWithdrawRelayBuildResponse, ay as PolymarketWithdrawRelayBuildRequest, az as PolymarketWithdrawRelaySubmitResponse, aA as PolymarketWithdrawRelaySubmitRequest, aB as PolymarketWithdrawBridgeStatusResponse, aC as PolymarketRedeemResponse, aD as PolymarketTypedData, aE as TickSizeResponse, aF as FeeRateResponse, aG as RebateConfig, aH as WsConnectionStatus, aI as WsDataMessage, aJ as WsPriceEvent, aK as WsOrderbookEvent, aL as WsTradeEvent, aM as CreateOrderInput } from './server-CzifZBb_.js';
|
|
2
|
+
export { cT as BuildClobAuthMessageInput, d6 as BuildOrderMessageInput, cK as CLOB_AUTH_DOMAIN, cL as CLOB_AUTH_TYPES, cU as CTF_EXCHANGE_ADDRESS, cZ as CTF_ORDER_TYPES, d5 as ClobOrderPayload, bF as DFlowOrderContext, bK as DepositBuildRequest, bL as DepositBuildResponse, bO as DepositStatusResponse, bM as DepositSubmitRequest, bN as DepositSubmitResponse, br as EsportsMatchDetailParams, bw as EventSummary, cQ as HttpMethod, aQ as MARKET_STRUCTURE_MEDIA_TYPE_V1, a_ as MarketDataEventWatch, aN as MarketDataHttpError, b1 as MarketDataMarketQuoteResult, aZ as MarketDataMarketView, b2 as MarketDataOutcomeOrderbook, b0 as MarketDataOutcomeQuote, a$ as MarketDataQuotesRequest, aY as MarketDataSchemaVersion, aX as MarketOutcome, aW as MarketResult, b6 as MarketStructureItem, b5 as MarketStructureMarket, b4 as MarketStructureOutcome, b3 as MarketStructureResourceType, bx as MarketSummary, bY as MatchConfidenceTier, bU as MatchGroupEntry, bV as MatchGroupMarket, b_ as MatchLeg, b$ as MatchMarketFlat, bW as MatchSortField, bT as MatchStatus, bX as MatchesStats, cV as NEG_RISK_CTF_EXCHANGE_ADDRESS, c_ as ORDER_TYPE, d7 as OrderMessage, bE as OrderSide, bD as OrderStatus, b8 as OrderbookBatchItem, b9 as OrderbookBatchResult, b7 as OrderbookLevel, ba as OrderbooksBatchRequest, bb as OrderbooksBatchResponse, cX as POLYGON_CHAIN_ID, bQ as PolymarketBridgeToken, bJ as PolymarketDepositWalletDeployRequest, cS as PolymarketL2Headers, cR as PolymarketL2HeadersInput, bG as PolymarketOrderType, cc as PolymarketRedeemInput, ca as PolymarketRedeemPrepareInput, cb as PolymarketRedeemPrepareResponse, bR as PolymarketSupportedAssetsResponse, bH as PolymarketTickSize, bS as PolymarketTypedDataArg, bI as PolymarketWalletKind, bB as PositionValue, bC as PositionValueError, aP as PredictClientOptions, by as PredictCommentProfile, bA as PredictPosition, bu as PredictSearchResult, bs as PredictSearchResultType, bt as PredictSearchSortField, aU as PredictTag, aS as PredictWsClientConfig, bz as PricePoint, aT as ProviderMeta, cB as ResolveEventsParamsInput, c$ as SIDE, aV as SettlementSource, bZ as SignalTag, d8 as SignedOrder, bg as SportsBinaryOutcome, bd as SportsEventType, bm as SportsInlineMarket, bk as SportsLiveState, bn as SportsMarket, bo as SportsMarketGroup, bl as SportsMarketOutcome, bp as SportsMatchCard, bj as SportsParticipant, bq as SportsPropEventCard, bc as SportsProviderSource, be as SportsRouteType, bh as SportsTaxonomyNode, bf as SportsTaxonomyNodeType, bi as SportsTaxonomySection, cC as TagSlugSelection, bv as TradeType, cW as USDC_ADDRESS, bP as UnsignedTx, c0 as WsChannel, c1 as WsChannelEvent, c2 as WsClientMessage, c8 as WsErrorCode, c9 as WsErrorMessage, c4 as WsPingMessage, c6 as WsPongMessage, c5 as WsServerMessage, c3 as WsSubscribeMessage, c7 as WsSubscribedMessage, cM as buildClobAuthMessage, d2 as buildClobPayload, cY as buildCtfExchangeDomain, d0 as buildOrderMessage, cO as buildPolymarketL2Headers, d1 as buildSignedOrder, aO as createPredictClient, aR as createPredictWsClient, cP as derivePolymarketApiKey, cp as esportsMatchesQueryKey, cr as esportsPropsQueryKey, cn as esportsTaxonomyQueryKey, cd as eventQueryKey, cq as fetchEsportsMatches, cs as fetchEsportsProps, co as fetchEsportsTaxonomy, ce as fetchEvent, cA as fetchEventsPage, cE as fetchMarket, cJ as fetchMatchMarketsPage, cH as fetchMatchesPage, cg as fetchPredictSearch, cw as fetchSportsMatchDetail, ck as fetchSportsMatches, cm as fetchSportsProps, cu as fetchSportsRouting, ci as fetchSportsTaxonomy, d3 as getPolymarketSharesPrecision, cN as hmacSha256Base64, cz as infiniteEventsQueryKey, cD as marketQueryKey, cI as matchMarketsQueryKey, cG as matchQueryKey, cF as matchesQueryKey, d4 as normalizePolymarketTickSize, cf as predictSearchQueryKey, cy as resolveEventsParams, cx as resolveTagSlug, cv as sportsMatchDetailQueryKey, cj as sportsMatchesQueryKey, cl as sportsPropsQueryKey, ct as sportsRoutingQueryKey, ch as sportsTaxonomyQueryKey } from './server-CzifZBb_.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { PropsWithChildren } from 'react';
|
|
@@ -7,6 +7,242 @@ import * as _tanstack_react_query from '@tanstack/react-query';
|
|
|
7
7
|
import { UseQueryOptions, UseInfiniteQueryOptions, InfiniteData, UseMutationOptions } from '@tanstack/react-query';
|
|
8
8
|
import { orderToJsonV2 } from '@polymarket/clob-client-v2';
|
|
9
9
|
|
|
10
|
+
declare const MARKET_DATA_BACKEND_CONTRACT_COMMIT = "0d0bab5c38dda76658890395bd992de84477267a";
|
|
11
|
+
declare const MARKET_DATA_CONTRACT_MANIFEST_SHA256 = "81c503ed6f1bb5b6f8f20ff9f448549d0b89553b36dbc422d09c3e4a898e4aaf";
|
|
12
|
+
|
|
13
|
+
interface MarketDataStructuralMarket {
|
|
14
|
+
source: ProviderSource;
|
|
15
|
+
market_slug: string;
|
|
16
|
+
outcomes: string[];
|
|
17
|
+
}
|
|
18
|
+
type InitialQuotesParseResult = {
|
|
19
|
+
kind: "missing";
|
|
20
|
+
} | {
|
|
21
|
+
kind: "malformed";
|
|
22
|
+
reason: string;
|
|
23
|
+
} | {
|
|
24
|
+
kind: "valid";
|
|
25
|
+
value: MarketDataInitialQuotes;
|
|
26
|
+
};
|
|
27
|
+
declare function parseInitialQuotes(input: unknown, structure: readonly MarketDataStructuralMarket[]): InitialQuotesParseResult;
|
|
28
|
+
declare function assertMarketDataBBAComponent(input: unknown, name: string): asserts input is MarketDataBBAComponent;
|
|
29
|
+
declare function assertMarketDataValueComponent(input: unknown, name: string, positive: boolean): asserts input is MarketDataValueComponent;
|
|
30
|
+
|
|
31
|
+
interface MarketDataStatusComponent {
|
|
32
|
+
value: MarketStatus;
|
|
33
|
+
observed_at: string;
|
|
34
|
+
}
|
|
35
|
+
interface MarketDataItemChange {
|
|
36
|
+
source: ProviderSource;
|
|
37
|
+
market_slug: string;
|
|
38
|
+
outcome: string;
|
|
39
|
+
bba?: MarketDataBBAComponent;
|
|
40
|
+
last_trade?: MarketDataValueComponent;
|
|
41
|
+
tick_size?: MarketDataValueComponent;
|
|
42
|
+
market_status?: MarketDataStatusComponent;
|
|
43
|
+
}
|
|
44
|
+
interface MarketDataResourceInvalidation {
|
|
45
|
+
observed_at: string;
|
|
46
|
+
reason: "market_membership_changed";
|
|
47
|
+
}
|
|
48
|
+
interface MarketDataItemEnvelope {
|
|
49
|
+
schema_version: 1;
|
|
50
|
+
changes?: MarketDataItemChange[];
|
|
51
|
+
resource_invalidated?: MarketDataResourceInvalidation;
|
|
52
|
+
}
|
|
53
|
+
interface MarketDataBookEnvelope {
|
|
54
|
+
schema_version: 1;
|
|
55
|
+
available: boolean;
|
|
56
|
+
source: ProviderSource;
|
|
57
|
+
market_slug: string;
|
|
58
|
+
outcome: string;
|
|
59
|
+
provider_timestamp?: string;
|
|
60
|
+
observed_at: string;
|
|
61
|
+
bids?: MarketDataBookLevel[];
|
|
62
|
+
asks?: MarketDataBookLevel[];
|
|
63
|
+
}
|
|
64
|
+
type ProtocolDecodeResult<T> = {
|
|
65
|
+
ok: true;
|
|
66
|
+
value: T;
|
|
67
|
+
} | {
|
|
68
|
+
ok: false;
|
|
69
|
+
reason: "incompatible_schema" | "malformed";
|
|
70
|
+
message: string;
|
|
71
|
+
};
|
|
72
|
+
interface PublicationCursor {
|
|
73
|
+
generation: number;
|
|
74
|
+
epoch: string;
|
|
75
|
+
offset: number;
|
|
76
|
+
}
|
|
77
|
+
type PublicationCursorOrder = "older" | "same" | "newer" | "epoch_changed" | "newer_generation";
|
|
78
|
+
declare function comparePublicationCursor(candidate: PublicationCursor, current: PublicationCursor): PublicationCursorOrder;
|
|
79
|
+
declare function decodeItemEnvelope(input: unknown): ProtocolDecodeResult<MarketDataItemEnvelope>;
|
|
80
|
+
declare function decodeBookEnvelope(input: unknown): ProtocolDecodeResult<MarketDataBookEnvelope>;
|
|
81
|
+
|
|
82
|
+
type RecoveryBarrierState = "buffering" | "catching_up" | "live" | "recovery_required" | "invalidated";
|
|
83
|
+
type RecoveryBarrierPushResult = "buffered" | "committed" | "ignored" | "recovery_required";
|
|
84
|
+
interface RecoveryBarrierOptions<T> {
|
|
85
|
+
generation: number;
|
|
86
|
+
maxBufferedPublications: number;
|
|
87
|
+
commit: (value: T, cursor: PublicationCursor) => void;
|
|
88
|
+
}
|
|
89
|
+
declare class RecoveryBarrier<T> {
|
|
90
|
+
private readonly generation;
|
|
91
|
+
private readonly maxBufferedPublications;
|
|
92
|
+
private readonly commitValue;
|
|
93
|
+
private buffered;
|
|
94
|
+
private currentCursor?;
|
|
95
|
+
private currentEpoch?;
|
|
96
|
+
state: RecoveryBarrierState;
|
|
97
|
+
constructor(options: RecoveryBarrierOptions<T>);
|
|
98
|
+
acknowledge(input: {
|
|
99
|
+
epoch: string;
|
|
100
|
+
recovered: boolean;
|
|
101
|
+
}): RecoveryBarrierState;
|
|
102
|
+
completeCatchUp(cursor: PublicationCursor): RecoveryBarrierState;
|
|
103
|
+
push(value: T, cursor: PublicationCursor): RecoveryBarrierPushResult;
|
|
104
|
+
invalidate(): void;
|
|
105
|
+
private commitIfNewer;
|
|
106
|
+
private requireRecovery;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare function chunkWatchRequest(request: MarketDataWatchRequest, maxRawQuoteSelectors: number): MarketDataWatchRequest[];
|
|
110
|
+
interface MarketDataWatchSchedulerOptions {
|
|
111
|
+
touch: (request: MarketDataWatchRequest) => Promise<MarketDataWatchResponse>;
|
|
112
|
+
maxRawQuoteSelectors: number;
|
|
113
|
+
onTouchSuccess?: () => void;
|
|
114
|
+
onTouchError?: (error: unknown) => void;
|
|
115
|
+
}
|
|
116
|
+
declare class MarketDataWatchScheduler {
|
|
117
|
+
private readonly touch;
|
|
118
|
+
private readonly maxRawQuoteSelectors;
|
|
119
|
+
private readonly onTouchSuccess?;
|
|
120
|
+
private readonly onTouchError?;
|
|
121
|
+
private timer?;
|
|
122
|
+
private revision;
|
|
123
|
+
private retryAttempt;
|
|
124
|
+
private current?;
|
|
125
|
+
private disposed;
|
|
126
|
+
constructor(options: MarketDataWatchSchedulerOptions);
|
|
127
|
+
replace(request: MarketDataWatchRequest): Promise<void>;
|
|
128
|
+
dispose(): void;
|
|
129
|
+
clear(): void;
|
|
130
|
+
private touchCurrent;
|
|
131
|
+
private scheduleRetry;
|
|
132
|
+
private clearTimer;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Narrow market-data port used by {@link MarketDataRuntime}.
|
|
137
|
+
* Venue-specific auth/DTO/error mapping stays behind this seam.
|
|
138
|
+
*/
|
|
139
|
+
interface MarketDataVenuePort {
|
|
140
|
+
watchMarketData(request: MarketDataWatchRequest): Promise<MarketDataWatchResponse>;
|
|
141
|
+
getMarketDataQuotes(markets: MarketDataMarketKey[]): Promise<MarketDataQuotesResponse>;
|
|
142
|
+
getMarketDataOrderbooks(slug: string, source: ProviderSource): Promise<MarketDataOrderbooksResponse>;
|
|
143
|
+
getMarketStructure(path: string, ifNoneMatch?: string): Promise<MarketStructureHttpResponse>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface MarketDataCapability {
|
|
147
|
+
enabled: boolean;
|
|
148
|
+
}
|
|
149
|
+
type MarketDataResourcePhase = "legacy" | "initializing" | "buffering" | "catching_up" | "live" | "degraded_quote" | "degraded_book" | "terminal";
|
|
150
|
+
interface MarketDataResourceInput {
|
|
151
|
+
key: string;
|
|
152
|
+
structurePath: string;
|
|
153
|
+
structureETag: string;
|
|
154
|
+
structure: MarketStructureResponse;
|
|
155
|
+
initialQuotes?: MarketDataInitialQuotes;
|
|
156
|
+
watch: MarketDataWatchRequest;
|
|
157
|
+
/** Optional current outcome book channel for detail views. */
|
|
158
|
+
bookChannel?: string;
|
|
159
|
+
}
|
|
160
|
+
interface MarketDataResourceState {
|
|
161
|
+
key: string;
|
|
162
|
+
generation: number;
|
|
163
|
+
phase: MarketDataResourcePhase;
|
|
164
|
+
structureETag?: string;
|
|
165
|
+
initialQuotes?: MarketDataInitialQuotes;
|
|
166
|
+
orderbooks?: MarketDataOrderbooksResponse;
|
|
167
|
+
liveBook?: MarketDataBookEnvelope;
|
|
168
|
+
/** Signals that the owning route must revalidate its structural composite. */
|
|
169
|
+
structureInvalidated?: boolean;
|
|
170
|
+
quoteError?: unknown;
|
|
171
|
+
bookError?: unknown;
|
|
172
|
+
}
|
|
173
|
+
interface MarketDataTransportPublication {
|
|
174
|
+
data: unknown;
|
|
175
|
+
epoch: string;
|
|
176
|
+
offset: number;
|
|
177
|
+
}
|
|
178
|
+
interface MarketDataTransportAck {
|
|
179
|
+
epoch: string;
|
|
180
|
+
offset: number;
|
|
181
|
+
recovered: boolean;
|
|
182
|
+
}
|
|
183
|
+
interface MarketDataTransportSubscription {
|
|
184
|
+
unsubscribe(): void;
|
|
185
|
+
}
|
|
186
|
+
interface MarketDataTransport {
|
|
187
|
+
subscribe(channel: string, callbacks: {
|
|
188
|
+
onPublication(publication: MarketDataTransportPublication): void;
|
|
189
|
+
onSubscribed(ack: MarketDataTransportAck): void;
|
|
190
|
+
onError(error: unknown): void;
|
|
191
|
+
}): MarketDataTransportSubscription;
|
|
192
|
+
close?(): void;
|
|
193
|
+
}
|
|
194
|
+
type MarketDataTransportFactory = () => MarketDataTransport;
|
|
195
|
+
|
|
196
|
+
declare class MarketDataStore {
|
|
197
|
+
private readonly resources;
|
|
198
|
+
private readonly generations;
|
|
199
|
+
private readonly legacyStates;
|
|
200
|
+
private readonly listeners;
|
|
201
|
+
get(key: string): MarketDataResourceState;
|
|
202
|
+
begin(key: string, structureETag: string): MarketDataResourceState;
|
|
203
|
+
update(key: string, generation: number, patch: Partial<Omit<MarketDataResourceState, "key" | "generation">>): boolean;
|
|
204
|
+
remove(key: string, generation: number): boolean;
|
|
205
|
+
subscribe(key: string, listener: () => void): () => void;
|
|
206
|
+
private emit;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
interface RuntimeOptions {
|
|
210
|
+
enabled: boolean;
|
|
211
|
+
client: MarketDataVenuePort;
|
|
212
|
+
store: MarketDataStore;
|
|
213
|
+
transportFactory?: MarketDataTransportFactory;
|
|
214
|
+
}
|
|
215
|
+
declare class MarketDataRuntime {
|
|
216
|
+
private readonly enabled;
|
|
217
|
+
private readonly client;
|
|
218
|
+
private readonly store;
|
|
219
|
+
private readonly transportFactory?;
|
|
220
|
+
private readonly resources;
|
|
221
|
+
private transport?;
|
|
222
|
+
private watchScheduler?;
|
|
223
|
+
private disposing;
|
|
224
|
+
constructor(options: RuntimeOptions);
|
|
225
|
+
mount(input: MarketDataResourceInput): () => void;
|
|
226
|
+
dispose(): void;
|
|
227
|
+
private subscribe;
|
|
228
|
+
private onPublication;
|
|
229
|
+
private onSubscribed;
|
|
230
|
+
private bootstrap;
|
|
231
|
+
private restartCatchUp;
|
|
232
|
+
private commitPublication;
|
|
233
|
+
private getTransport;
|
|
234
|
+
private getWatchScheduler;
|
|
235
|
+
private onWatchTouchSuccess;
|
|
236
|
+
private onWatchTouchError;
|
|
237
|
+
private handleBookError;
|
|
238
|
+
private retryBookCatchUp;
|
|
239
|
+
private combinedWatchRequest;
|
|
240
|
+
private fail;
|
|
241
|
+
private release;
|
|
242
|
+
private releaseGeneration;
|
|
243
|
+
private refreshWatchDemand;
|
|
244
|
+
}
|
|
245
|
+
|
|
10
246
|
type PredictProviderProps = PropsWithChildren<{
|
|
11
247
|
/**
|
|
12
248
|
* A `PredictClient` instance pointed at the prediction-server endpoint.
|
|
@@ -53,6 +289,13 @@ type PredictProviderProps = PropsWithChildren<{
|
|
|
53
289
|
*/
|
|
54
290
|
declare function PredictProvider({ client, wsClient, children, }: PredictProviderProps): react_jsx_runtime.JSX.Element;
|
|
55
291
|
|
|
292
|
+
type MarketDataProviderProps = PropsWithChildren<{
|
|
293
|
+
capability: MarketDataCapability;
|
|
294
|
+
client: PredictClient;
|
|
295
|
+
transportFactory?: MarketDataTransportFactory;
|
|
296
|
+
}>;
|
|
297
|
+
declare function MarketDataProvider({ capability, client, transportFactory, children, }: MarketDataProviderProps): react_jsx_runtime.JSX.Element;
|
|
298
|
+
|
|
56
299
|
interface PredictContextValue {
|
|
57
300
|
/** The prediction-server HTTP client instance. */
|
|
58
301
|
client: PredictClient;
|
|
@@ -189,6 +432,17 @@ declare const PolymarketContext: react.Context<PolymarketContextValue | null>;
|
|
|
189
432
|
*/
|
|
190
433
|
declare function usePredictClient(): PredictClient;
|
|
191
434
|
|
|
435
|
+
declare function useMarketDataCapability(): MarketDataCapability;
|
|
436
|
+
|
|
437
|
+
declare function useMarketDataResource(input: string | MarketDataResourceInput): MarketDataResourceState;
|
|
438
|
+
|
|
439
|
+
interface MarketDataOrderbooksState {
|
|
440
|
+
snapshot?: MarketDataOrderbooksResponse;
|
|
441
|
+
live?: MarketDataBookEnvelope;
|
|
442
|
+
error?: unknown;
|
|
443
|
+
}
|
|
444
|
+
declare function useMarketDataOrderbooks(resourceKey: string): MarketDataOrderbooksState;
|
|
445
|
+
|
|
192
446
|
/** Stable TanStack Query key for the events list. */
|
|
193
447
|
declare function eventsQueryKey(params?: ListEventsParams): unknown[];
|
|
194
448
|
/**
|
|
@@ -1211,4 +1465,72 @@ interface WalkOrderbookParams {
|
|
|
1211
1465
|
*/
|
|
1212
1466
|
declare function walkOrderbook({ orderbook, outcome, side, sharesNeeded, slippageBps, }: WalkOrderbookParams): WalkResult;
|
|
1213
1467
|
|
|
1214
|
-
|
|
1468
|
+
type PredictionOrderIntentStatus = "idle" | "validating" | "needs-kyc" | "needs-setup" | "signing" | "submitting" | "confirming" | "succeeded" | "failed" | "timed-out" | "cancelled";
|
|
1469
|
+
type PredictionOrderSide = "buy" | "sell";
|
|
1470
|
+
type PredictionOrderType = "market" | "limit";
|
|
1471
|
+
interface PredictionOrderIntent {
|
|
1472
|
+
id: string;
|
|
1473
|
+
venue: ProviderSource;
|
|
1474
|
+
side: PredictionOrderSide;
|
|
1475
|
+
orderType: PredictionOrderType;
|
|
1476
|
+
}
|
|
1477
|
+
interface PredictionOrderSnapshot {
|
|
1478
|
+
status: PredictionOrderIntentStatus;
|
|
1479
|
+
intent?: PredictionOrderIntent;
|
|
1480
|
+
acceptedId?: string;
|
|
1481
|
+
error?: Error;
|
|
1482
|
+
}
|
|
1483
|
+
interface PredictionKycPort {
|
|
1484
|
+
verified(): Promise<boolean>;
|
|
1485
|
+
}
|
|
1486
|
+
interface PredictionSetupPort {
|
|
1487
|
+
verified(): Promise<boolean>;
|
|
1488
|
+
}
|
|
1489
|
+
interface PredictionSignerPort {
|
|
1490
|
+
sign(intent: PredictionOrderIntent): Promise<unknown>;
|
|
1491
|
+
}
|
|
1492
|
+
interface PredictionOrderExecutionPort {
|
|
1493
|
+
submit(intent: PredictionOrderIntent, signed: unknown): Promise<{
|
|
1494
|
+
accepted: boolean;
|
|
1495
|
+
id?: string;
|
|
1496
|
+
}>;
|
|
1497
|
+
}
|
|
1498
|
+
interface PredictionOrderConfirmationPort {
|
|
1499
|
+
wait(acceptedId: string, signal: {
|
|
1500
|
+
timedOut(): boolean;
|
|
1501
|
+
}): Promise<"confirmed" | "timed-out">;
|
|
1502
|
+
}
|
|
1503
|
+
interface PredictionOrderClock {
|
|
1504
|
+
now(): number;
|
|
1505
|
+
}
|
|
1506
|
+
interface PredictionOrderRuntime {
|
|
1507
|
+
snapshot(): PredictionOrderSnapshot;
|
|
1508
|
+
submit(intent: PredictionOrderIntent): Promise<PredictionOrderSnapshot>;
|
|
1509
|
+
cancel(): PredictionOrderSnapshot;
|
|
1510
|
+
}
|
|
1511
|
+
declare class PredictionOrderRejectedError extends Error {
|
|
1512
|
+
constructor(message?: string);
|
|
1513
|
+
}
|
|
1514
|
+
declare function createPredictionOrderRuntime(options: {
|
|
1515
|
+
kyc?: PredictionKycPort;
|
|
1516
|
+
setup?: PredictionSetupPort;
|
|
1517
|
+
signer?: PredictionSignerPort;
|
|
1518
|
+
execution: PredictionOrderExecutionPort;
|
|
1519
|
+
confirmation?: PredictionOrderConfirmationPort;
|
|
1520
|
+
clock?: PredictionOrderClock;
|
|
1521
|
+
confirmTimeoutMs?: number;
|
|
1522
|
+
onChange?: (snapshot: PredictionOrderSnapshot) => void;
|
|
1523
|
+
}): PredictionOrderRuntime;
|
|
1524
|
+
|
|
1525
|
+
declare function createInMemoryOrderPorts(options?: {
|
|
1526
|
+
accept?: boolean;
|
|
1527
|
+
confirm?: "confirmed" | "timed-out";
|
|
1528
|
+
signError?: Error;
|
|
1529
|
+
}): {
|
|
1530
|
+
signer: PredictionSignerPort;
|
|
1531
|
+
execution: PredictionOrderExecutionPort;
|
|
1532
|
+
confirmation: PredictionOrderConfirmationPort;
|
|
1533
|
+
submitCount: () => number;
|
|
1534
|
+
};
|
|
1535
|
+
|
|
1536
|
+
export { AvailableSharesResponse, BalanceResponse, type BuildV2OrderParams, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, type ClobOrderV2Payload, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EsportsMatchesParams, EsportsPropsParams, EsportsTaxonomyParams, EventSortField, EventStats, EventStatus, FeeRateResponse, type InitialQuotesParseResult, ListCandlesticksParams, ListCommentsParams, ListEventsParams, ListMarketTradesParams, ListOrdersMultiParams, ListOrdersParams, ListTradesMultiParams, ListTradesParams, MARKET_DATA_BACKEND_CONTRACT_COMMIT, MARKET_DATA_CONTRACT_MANIFEST_SHA256, MarketDataBBAComponent, type MarketDataBookEnvelope, MarketDataBookLevel, type MarketDataCapability, MarketDataInitialQuotes, type MarketDataItemChange, type MarketDataItemEnvelope, MarketDataMarketKey, MarketDataOrderbooksResponse, MarketDataProvider, type MarketDataProviderProps, MarketDataQuotesResponse, type MarketDataResourceInput, type MarketDataResourceInvalidation, type MarketDataResourcePhase, type MarketDataResourceState, MarketDataRuntime, type MarketDataStatusComponent, MarketDataStore, type MarketDataStructuralMarket, type MarketDataTransport, type MarketDataTransportAck, type MarketDataTransportFactory, type MarketDataTransportPublication, type MarketDataTransportSubscription, MarketDataValueComponent, MarketDataWatchRequest, MarketDataWatchResponse, MarketDataWatchScheduler, type MarketDataWatchSchedulerOptions, type MarketHistoryPoint, type MarketHistorySeries, MarketStatus, MarketStructureHttpResponse, MarketStructureResponse, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, OrderbookOutcome, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketDepositWalletDeployResponse, PolymarketProvider, type PolymarketProviderProps, PolymarketRedeemResponse, PolymarketSetupStatus, type PolymarketSigner, PolymarketSupportedAsset, PolymarketTypedData, PolymarketWithdrawBridgeStatusResponse, PolymarketWithdrawPrepareRequest, PolymarketWithdrawPrepareResponse, PolymarketWithdrawQuoteRequest, PolymarketWithdrawQuoteResponse, PolymarketWithdrawRelayBuildRequest, PolymarketWithdrawRelayBuildResponse, PolymarketWithdrawRelaySubmitRequest, PolymarketWithdrawRelaySubmitResponse, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionValueResponse, PositionsResponse, PredictClient, PredictComment, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictOrdersResponse, PredictPage, PredictProvider, type PredictProviderProps, PredictSearchParams, PredictSearchResponse, PredictTrade, PredictWsClient, type PredictionKycPort, type PredictionOrderClock, type PredictionOrderConfirmationPort, type PredictionOrderExecutionPort, type PredictionOrderIntent, type PredictionOrderIntentStatus, PredictionOrderRejectedError, type PredictionOrderRuntime, type PredictionOrderSide, type PredictionOrderSnapshot, type PredictionOrderType, type PredictionSetupPort, type PredictionSignerPort, PriceHistoryParams, PriceHistoryRange, PriceHistoryResponse, type ProtocolDecodeResult, ProviderSource, type PublicationCursor, type PublicationCursorOrder, RebateConfig, RecoveryBarrier, type RecoveryBarrierOptions, type RecoveryBarrierPushResult, type RecoveryBarrierState, type RedeemPositionVariables, SimilarEventsParams, SportsMatchDetail, SportsMatchDetailParams, SportsMatchesParams, SportsMatchesResponse, SportsOrderbookKey, SportsPropsParams, SportsPropsResponse, SportsRoutingParams, SportsRoutingResponse, SportsSection, SportsTaxonomyParams, SportsTaxonomyResponse, type StartTradeResultConfirmationInput, type SyncBalanceAllowanceParams, TickSizeResponse, type TradeResultConfirmationState, type TradeResultExpectation, type UseAvailableSharesOptions, type UseAvailableSharesParams, type UseBalanceParams, type UseCancelOrderOptions, type UseCandlesticksParams, type UseEsportsMatchesParams, type UseEsportsPropsParams, type UseEventParams, type UseInfiniteCommentsParams, type UseInfiniteMatchMarketsParams, type UseInfiniteMatchesParams, type UseInfiniteOrdersOptions, type UseInfiniteOrdersParams, type UseInfiniteTradesMultiParams, type UseInfiniteTradesParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UseOrdersMultiOptions, type UseOrdersOptions, type UsePositionValueMultiParams, type UsePositionValueParams, type UsePositionsMultiParams, type UsePositionsParams, type UsePredictWsClientResult, type UsePriceHistoryParams, type UsePricesSubscriptionParams, type UsePricesSubscriptionResult, type UseRealtimeOrderbookParams, type UseRealtimePricesParams, type UseRealtimeTradesParams, type UseRealtimeTradesResult, type UseSearchEventsParams, type UseSimilarEventsParams, type UseSportsMatchesParams, type UseSportsPropsParams, type UseTradesSubscriptionParams, type UseTradesSubscriptionResult, type UseWithdrawStatusQueryParams, type WalkOrderbookParams, type WalkOutcome, type WalkResult, type WalkSide, type WalkStatus, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, assertMarketDataBBAComponent, assertMarketDataValueComponent, availableSharesQueryKey, balanceQueryKey, buildSignedV2OrderPayload, candlesticksQueryKey, chunkWatchRequest, comparePublicationCursor, createInMemoryOrderPorts, createPredictionOrderRuntime, decodeBookEnvelope, decodeItemEnvelope, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, feeRateQueryKey, fetchEvents, infiniteCommentsQueryKey, infiniteOrdersQueryKey, infiniteTradesMultiQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersMultiQueryKey, ordersQueryKey, parseInitialQuotes, pickBestAsk, pickBestBid, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, polymarketSupportedAssetsQueryKey, polymarketWithdrawStatusQueryKey, positionValueMultiQueryKey, positionValueQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, rebateConfigQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, updatePolymarketBalanceAllowance, useAvailableShares, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useDeployPolymarketDepositWallet, useEsportsMatches, useEsportsProps, useEsportsTaxonomy, useEvent, useEventStats, useEvents, useFeeRate, useInfiniteComments, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfinitePredictSearch, useInfiniteTrades, useInfiniteTradesMulti, useMarket, useMarketDataCapability, useMarketDataOrderbooks, useMarketDataResource, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, useOrdersMulti, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketSupportedAssets, usePolymarketWithdraw, usePolymarketWithdrawPrepareMutation, usePolymarketWithdrawQuoteMutation, usePolymarketWithdrawRelayBuildMutation, usePolymarketWithdrawRelaySubmitMutation, usePolymarketWithdrawStatusQuery, usePositionValue, usePositionValueMulti, usePositions, usePositionsMulti, usePredictClient, usePredictSearch, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRebateConfig, useRedeemPosition, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useSportsMatchDetail, useSportsMatches, useSportsOrderbook, useSportsProps, useSportsRouting, useSportsTaxonomy, useTickSize, useTradeResultConfirmation, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, walkOrderbook, withdrawStatusQueryKey };
|