@liberfi.io/react-predict 0.3.71 → 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 +83 -4
- package/dist/index.d.ts +83 -4
- package/dist/index.js +151 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +149 -10
- package/dist/index.mjs.map +1 -1
- package/dist/{server-1_Lm8FLS.d.mts → server-CzifZBb_.d.mts} +1 -1
- package/dist/{server-1_Lm8FLS.d.ts → server-CzifZBb_.d.ts} +1 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +6 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
|
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,
|
|
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_.mjs';
|
|
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_.mjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { PropsWithChildren } from 'react';
|
|
@@ -132,6 +132,17 @@ declare class MarketDataWatchScheduler {
|
|
|
132
132
|
private clearTimer;
|
|
133
133
|
}
|
|
134
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
|
+
|
|
135
146
|
interface MarketDataCapability {
|
|
136
147
|
enabled: boolean;
|
|
137
148
|
}
|
|
@@ -197,7 +208,7 @@ declare class MarketDataStore {
|
|
|
197
208
|
|
|
198
209
|
interface RuntimeOptions {
|
|
199
210
|
enabled: boolean;
|
|
200
|
-
client:
|
|
211
|
+
client: MarketDataVenuePort;
|
|
201
212
|
store: MarketDataStore;
|
|
202
213
|
transportFactory?: MarketDataTransportFactory;
|
|
203
214
|
}
|
|
@@ -1454,4 +1465,72 @@ interface WalkOrderbookParams {
|
|
|
1454
1465
|
*/
|
|
1455
1466
|
declare function walkOrderbook({ orderbook, outcome, side, sharesNeeded, slippageBps, }: WalkOrderbookParams): WalkResult;
|
|
1456
1467
|
|
|
1457
|
-
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
|
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,
|
|
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';
|
|
@@ -132,6 +132,17 @@ declare class MarketDataWatchScheduler {
|
|
|
132
132
|
private clearTimer;
|
|
133
133
|
}
|
|
134
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
|
+
|
|
135
146
|
interface MarketDataCapability {
|
|
136
147
|
enabled: boolean;
|
|
137
148
|
}
|
|
@@ -197,7 +208,7 @@ declare class MarketDataStore {
|
|
|
197
208
|
|
|
198
209
|
interface RuntimeOptions {
|
|
199
210
|
enabled: boolean;
|
|
200
|
-
client:
|
|
211
|
+
client: MarketDataVenuePort;
|
|
201
212
|
store: MarketDataStore;
|
|
202
213
|
transportFactory?: MarketDataTransportFactory;
|
|
203
214
|
}
|
|
@@ -1454,4 +1465,72 @@ interface WalkOrderbookParams {
|
|
|
1454
1465
|
*/
|
|
1455
1466
|
declare function walkOrderbook({ orderbook, outcome, side, sharesNeeded, slippageBps, }: WalkOrderbookParams): WalkResult;
|
|
1456
1467
|
|
|
1457
|
-
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -2392,6 +2392,16 @@ function PredictProvider({
|
|
|
2392
2392
|
const value = react.useMemo(() => ({ client, wsClient: ws }), [client, ws]);
|
|
2393
2393
|
return /* @__PURE__ */ jsxRuntime.jsx(PredictContext.Provider, { value, children });
|
|
2394
2394
|
}
|
|
2395
|
+
|
|
2396
|
+
// src/market-data/adapters/create-client-market-venue-adapter.ts
|
|
2397
|
+
function createClientMarketVenueAdapter(client) {
|
|
2398
|
+
return {
|
|
2399
|
+
watchMarketData: (request) => client.watchMarketData(request),
|
|
2400
|
+
getMarketDataQuotes: (markets) => client.getMarketDataQuotes(markets),
|
|
2401
|
+
getMarketDataOrderbooks: (slug, source) => client.getMarketDataOrderbooks(slug, source),
|
|
2402
|
+
getMarketStructure: (path, ifNoneMatch) => client.getMarketStructure(path, ifNoneMatch)
|
|
2403
|
+
};
|
|
2404
|
+
}
|
|
2395
2405
|
var MarketDataContext = react.createContext(
|
|
2396
2406
|
null
|
|
2397
2407
|
);
|
|
@@ -2402,14 +2412,15 @@ function MarketDataProvider({
|
|
|
2402
2412
|
children
|
|
2403
2413
|
}) {
|
|
2404
2414
|
const store = react.useMemo(() => new MarketDataStore(), []);
|
|
2415
|
+
const venue = react.useMemo(() => createClientMarketVenueAdapter(client), [client]);
|
|
2405
2416
|
const runtime = react.useMemo(
|
|
2406
2417
|
() => new MarketDataRuntime({
|
|
2407
2418
|
enabled: capability.enabled,
|
|
2408
|
-
client,
|
|
2419
|
+
client: venue,
|
|
2409
2420
|
store,
|
|
2410
2421
|
transportFactory
|
|
2411
2422
|
}),
|
|
2412
|
-
[capability.enabled,
|
|
2423
|
+
[capability.enabled, venue, store, transportFactory]
|
|
2413
2424
|
);
|
|
2414
2425
|
react.useEffect(() => () => runtime.dispose(), [runtime]);
|
|
2415
2426
|
const value = react.useMemo(
|
|
@@ -4243,7 +4254,7 @@ function useRunPolymarketSetup(walletAddress) {
|
|
|
4243
4254
|
mutationFn: (address) => client.runPolymarketSetup(address),
|
|
4244
4255
|
onSuccess: () => {
|
|
4245
4256
|
if (walletAddress) {
|
|
4246
|
-
queryClient.invalidateQueries({
|
|
4257
|
+
void queryClient.invalidateQueries({
|
|
4247
4258
|
queryKey: polymarketSetupQueryKey(walletAddress)
|
|
4248
4259
|
});
|
|
4249
4260
|
}
|
|
@@ -4257,7 +4268,7 @@ function useDeployPolymarketDepositWallet(walletAddress) {
|
|
|
4257
4268
|
mutationFn: (address) => client.deployPolymarketDepositWallet(address),
|
|
4258
4269
|
onSuccess: () => {
|
|
4259
4270
|
if (walletAddress) {
|
|
4260
|
-
queryClient.invalidateQueries({
|
|
4271
|
+
void queryClient.invalidateQueries({
|
|
4261
4272
|
queryKey: polymarketSetupQueryKey(walletAddress)
|
|
4262
4273
|
});
|
|
4263
4274
|
}
|
|
@@ -4277,8 +4288,8 @@ function useWithdrawSubmitMutation(mutationOptions = {}) {
|
|
|
4277
4288
|
return reactQuery.useMutation({
|
|
4278
4289
|
mutationFn: (body) => client.withdrawSubmit(body),
|
|
4279
4290
|
onSuccess: () => {
|
|
4280
|
-
queryClient.invalidateQueries({ queryKey: ["predict", "balance"] });
|
|
4281
|
-
queryClient.invalidateQueries({ queryKey: ["predict", "positions"] });
|
|
4291
|
+
void queryClient.invalidateQueries({ queryKey: ["predict", "balance"] });
|
|
4292
|
+
void queryClient.invalidateQueries({ queryKey: ["predict", "positions"] });
|
|
4282
4293
|
},
|
|
4283
4294
|
...mutationOptions
|
|
4284
4295
|
});
|
|
@@ -4343,7 +4354,7 @@ function usePolymarketDeposit(mutationOptions = {}) {
|
|
|
4343
4354
|
};
|
|
4344
4355
|
},
|
|
4345
4356
|
onSuccess: () => {
|
|
4346
|
-
queryClient.invalidateQueries({ queryKey: ["predict", "balance"] });
|
|
4357
|
+
void queryClient.invalidateQueries({ queryKey: ["predict", "balance"] });
|
|
4347
4358
|
},
|
|
4348
4359
|
...mutationOptions
|
|
4349
4360
|
});
|
|
@@ -4548,11 +4559,12 @@ function usePricesSubscription({
|
|
|
4548
4559
|
onUpdateRef.current?.(msg);
|
|
4549
4560
|
}, []);
|
|
4550
4561
|
react.useEffect(() => {
|
|
4551
|
-
|
|
4562
|
+
const slugList = slugsKey.length === 0 ? [] : slugsKey.split(",");
|
|
4563
|
+
if (!wsClient || !enabled || slugList.length === 0) {
|
|
4552
4564
|
setIsSubscribed(false);
|
|
4553
4565
|
return;
|
|
4554
4566
|
}
|
|
4555
|
-
const unsub = wsClient.subscribePrices(
|
|
4567
|
+
const unsub = wsClient.subscribePrices(slugList, handleUpdate);
|
|
4556
4568
|
setIsSubscribed(true);
|
|
4557
4569
|
return () => {
|
|
4558
4570
|
unsub();
|
|
@@ -5122,6 +5134,133 @@ function walkOrderbook({
|
|
|
5122
5134
|
};
|
|
5123
5135
|
}
|
|
5124
5136
|
|
|
5137
|
+
// src/utils/order-intent-runtime.ts
|
|
5138
|
+
var PredictionOrderRejectedError = class extends Error {
|
|
5139
|
+
constructor(message = "prediction order rejected") {
|
|
5140
|
+
super(message);
|
|
5141
|
+
this.name = "PredictionOrderRejectedError";
|
|
5142
|
+
}
|
|
5143
|
+
};
|
|
5144
|
+
function createPredictionOrderRuntime(options) {
|
|
5145
|
+
let current = { status: "idle" };
|
|
5146
|
+
const accepted = /* @__PURE__ */ new Set();
|
|
5147
|
+
const confirmTimeoutMs = options.confirmTimeoutMs ?? 3e4;
|
|
5148
|
+
const clock = options.clock ?? { now: () => Date.now() };
|
|
5149
|
+
const set = (next) => {
|
|
5150
|
+
current = next;
|
|
5151
|
+
options.onChange?.(next);
|
|
5152
|
+
return next;
|
|
5153
|
+
};
|
|
5154
|
+
return {
|
|
5155
|
+
snapshot() {
|
|
5156
|
+
return current;
|
|
5157
|
+
},
|
|
5158
|
+
cancel() {
|
|
5159
|
+
if (current.status === "succeeded" || current.status === "confirming" || current.status === "submitting") {
|
|
5160
|
+
return current;
|
|
5161
|
+
}
|
|
5162
|
+
return set({ status: "cancelled", intent: current.intent });
|
|
5163
|
+
},
|
|
5164
|
+
async submit(intent) {
|
|
5165
|
+
if (accepted.has(intent.id)) {
|
|
5166
|
+
return current.status === "idle" ? set({ status: "succeeded", intent, acceptedId: intent.id }) : current;
|
|
5167
|
+
}
|
|
5168
|
+
if (current.intent?.id === intent.id && (current.status === "submitting" || current.status === "confirming" || current.status === "succeeded")) {
|
|
5169
|
+
return current;
|
|
5170
|
+
}
|
|
5171
|
+
set({ status: "validating", intent });
|
|
5172
|
+
if (intent.venue === "kalshi") {
|
|
5173
|
+
const verified = options.kyc ? await options.kyc.verified() : false;
|
|
5174
|
+
if (!verified) {
|
|
5175
|
+
return set({ status: "needs-kyc", intent });
|
|
5176
|
+
}
|
|
5177
|
+
}
|
|
5178
|
+
if (intent.venue === "polymarket") {
|
|
5179
|
+
const verified = options.setup ? await options.setup.verified() : false;
|
|
5180
|
+
if (!verified) {
|
|
5181
|
+
return set({ status: "needs-setup", intent });
|
|
5182
|
+
}
|
|
5183
|
+
}
|
|
5184
|
+
if (!options.signer) {
|
|
5185
|
+
return set({
|
|
5186
|
+
status: "failed",
|
|
5187
|
+
intent,
|
|
5188
|
+
error: new PredictionOrderRejectedError("missing signer")
|
|
5189
|
+
});
|
|
5190
|
+
}
|
|
5191
|
+
set({ status: "signing", intent });
|
|
5192
|
+
let signed;
|
|
5193
|
+
try {
|
|
5194
|
+
signed = await options.signer.sign(intent);
|
|
5195
|
+
} catch (error) {
|
|
5196
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
5197
|
+
return set({ status: "failed", intent, error: err });
|
|
5198
|
+
}
|
|
5199
|
+
set({ status: "submitting", intent });
|
|
5200
|
+
let acceptedId;
|
|
5201
|
+
try {
|
|
5202
|
+
const result = await options.execution.submit(intent, signed);
|
|
5203
|
+
if (!result.accepted) {
|
|
5204
|
+
return set({
|
|
5205
|
+
status: "failed",
|
|
5206
|
+
intent,
|
|
5207
|
+
error: new PredictionOrderRejectedError()
|
|
5208
|
+
});
|
|
5209
|
+
}
|
|
5210
|
+
acceptedId = result.id ?? intent.id;
|
|
5211
|
+
accepted.add(intent.id);
|
|
5212
|
+
accepted.add(acceptedId);
|
|
5213
|
+
} catch (error) {
|
|
5214
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
5215
|
+
return set({ status: "failed", intent, error: err });
|
|
5216
|
+
}
|
|
5217
|
+
set({ status: "confirming", intent, acceptedId });
|
|
5218
|
+
if (!options.confirmation) {
|
|
5219
|
+
return set({ status: "succeeded", intent, acceptedId });
|
|
5220
|
+
}
|
|
5221
|
+
const deadline = clock.now() + confirmTimeoutMs;
|
|
5222
|
+
const outcome = await options.confirmation.wait(acceptedId, {
|
|
5223
|
+
timedOut: () => clock.now() >= deadline
|
|
5224
|
+
});
|
|
5225
|
+
if (outcome === "timed-out") {
|
|
5226
|
+
return set({ status: "timed-out", intent, acceptedId });
|
|
5227
|
+
}
|
|
5228
|
+
return set({ status: "succeeded", intent, acceptedId });
|
|
5229
|
+
}
|
|
5230
|
+
};
|
|
5231
|
+
}
|
|
5232
|
+
|
|
5233
|
+
// src/utils/in-memory-order-ports.ts
|
|
5234
|
+
function createInMemoryOrderPorts(options = {}) {
|
|
5235
|
+
let submits = 0;
|
|
5236
|
+
return {
|
|
5237
|
+
signer: {
|
|
5238
|
+
async sign(intent) {
|
|
5239
|
+
if (options.signError) throw options.signError;
|
|
5240
|
+
return { signed: intent.id };
|
|
5241
|
+
}
|
|
5242
|
+
},
|
|
5243
|
+
execution: {
|
|
5244
|
+
async submit(intent) {
|
|
5245
|
+
submits += 1;
|
|
5246
|
+
return {
|
|
5247
|
+
accepted: options.accept !== false,
|
|
5248
|
+
id: intent.id
|
|
5249
|
+
};
|
|
5250
|
+
}
|
|
5251
|
+
},
|
|
5252
|
+
confirmation: {
|
|
5253
|
+
async wait(_acceptedId, signal) {
|
|
5254
|
+
if (signal.timedOut() || options.confirm === "timed-out") {
|
|
5255
|
+
return "timed-out";
|
|
5256
|
+
}
|
|
5257
|
+
return "confirmed";
|
|
5258
|
+
}
|
|
5259
|
+
},
|
|
5260
|
+
submitCount: () => submits
|
|
5261
|
+
};
|
|
5262
|
+
}
|
|
5263
|
+
|
|
5125
5264
|
exports.CLOB_AUTH_DOMAIN = CLOB_AUTH_DOMAIN;
|
|
5126
5265
|
exports.CLOB_AUTH_TYPES = CLOB_AUTH_TYPES;
|
|
5127
5266
|
exports.CTF_EXCHANGE_ADDRESS = CTF_EXCHANGE_ADDRESS;
|
|
@@ -5144,6 +5283,7 @@ exports.PredictClient = PredictClient;
|
|
|
5144
5283
|
exports.PredictContext = PredictContext;
|
|
5145
5284
|
exports.PredictProvider = PredictProvider;
|
|
5146
5285
|
exports.PredictWsClient = PredictWsClient;
|
|
5286
|
+
exports.PredictionOrderRejectedError = PredictionOrderRejectedError;
|
|
5147
5287
|
exports.RecoveryBarrier = RecoveryBarrier;
|
|
5148
5288
|
exports.SIDE = SIDE;
|
|
5149
5289
|
exports.USDC_ADDRESS = USDC_ADDRESS;
|
|
@@ -5161,8 +5301,10 @@ exports.buildSignedV2OrderPayload = buildSignedV2OrderPayload;
|
|
|
5161
5301
|
exports.candlesticksQueryKey = candlesticksQueryKey;
|
|
5162
5302
|
exports.chunkWatchRequest = chunkWatchRequest;
|
|
5163
5303
|
exports.comparePublicationCursor = comparePublicationCursor;
|
|
5304
|
+
exports.createInMemoryOrderPorts = createInMemoryOrderPorts;
|
|
5164
5305
|
exports.createPredictClient = createPredictClient;
|
|
5165
5306
|
exports.createPredictWsClient = createPredictWsClient;
|
|
5307
|
+
exports.createPredictionOrderRuntime = createPredictionOrderRuntime;
|
|
5166
5308
|
exports.decodeBookEnvelope = decodeBookEnvelope;
|
|
5167
5309
|
exports.decodeItemEnvelope = decodeItemEnvelope;
|
|
5168
5310
|
exports.derivePolymarketApiKey = derivePolymarketApiKey;
|