@liberfi.io/react-predict 0.1.1 → 0.1.2
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 +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +997 -2
- package/dist/server.d.ts +997 -2
- package/dist/server.js +1 -4
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +1 -4
- package/dist/server.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/server-DlSG7h_v.d.mts +0 -1008
- package/dist/server-DlSG7h_v.d.ts +0 -1008
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { PredictClient, PredictWsClient, ListEventsParams, PredictPage, PredictEvent, ProviderSource, EventStatus, SimilarEventsParams, PredictMarket, Orderbook, ListMarketTradesParams, PredictTrade, PriceHistoryRange, PriceHistoryResponse, ListCandlesticksParams, Candlestick, PositionsResponse, BalanceResponse, ListOrdersParams, PredictOrder, CancelOrderResult, ListTradesParams, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitResponse, DFlowSubmitRequest, WsConnectionStatus, WsDataMessage, WsPriceEvent, WsOrderbookEvent, WsTradeEvent, CreateOrderInput } from './server.mjs';
|
|
2
|
+
export { BuildClobAuthMessageInput, BuildOrderMessageInput, BuildSignedOrderInput, CLOB_AUTH_DOMAIN, CLOB_AUTH_TYPES, CTF_EXCHANGE_ADDRESS, CTF_ORDER_TYPES, DFlowOrderContext, EventSortField, EventSummary, HttpMethod, MarketOutcome, MarketResult, MarketStatus, MarketSummary, NEG_RISK_CTF_EXCHANGE_ADDRESS, ORDER_TYPE, OrderMessage, OrderSide, OrderStatus, OrderbookLevel, POLYGON_CHAIN_ID, PolymarketL2Headers, PolymarketL2HeadersInput, PolymarketOrderType, PredictPosition, PredictTag, PredictWsClientConfig, PricePoint, ProviderMeta, ResolveEventsParamsInput, SIDE, SettlementSource, SignedOrder, TagSlugSelection, TradeType, USDC_ADDRESS, WsChannel, WsChannelEvent, WsClientMessage, WsErrorCode, WsErrorMessage, WsPingMessage, WsPongMessage, WsServerMessage, WsSubscribeMessage, WsSubscribedMessage, buildClobAuthMessage, buildCtfExchangeDomain, buildOrderMessage, buildPolymarketL2Headers, buildSignedOrder, createPredictClient, createPredictWsClient, derivePolymarketApiKey, eventQueryKey, fetchEvent, fetchEventsPage, fetchMarket, hmacSha256Base64, infiniteEventsQueryKey, marketQueryKey, resolveEventsParams, resolveTagSlug } from './server.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';
|
|
@@ -258,6 +258,22 @@ interface UseSimilarEventsParams {
|
|
|
258
258
|
}
|
|
259
259
|
declare function useSimilarEvents(params: UseSimilarEventsParams, queryOptions?: Omit<UseQueryOptions<PredictEvent[], Error, PredictEvent[], unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PredictEvent[], Error>;
|
|
260
260
|
|
|
261
|
+
interface UseMarketParams {
|
|
262
|
+
/** Canonical market slug. */
|
|
263
|
+
slug: string;
|
|
264
|
+
/** Upstream provider. Required by prediction-server for single-market fetch. */
|
|
265
|
+
source?: ProviderSource;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* React Query hook for `GET /api/v1/markets/:slug` via the prediction-server client.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```tsx
|
|
272
|
+
* const { data, isLoading } = useMarket({ slug: "KXBTCD-25FEB-T68000-yes", source: "dflow" });
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
declare function useMarket(params: UseMarketParams, queryOptions?: Omit<UseQueryOptions<PredictMarket, Error, PredictMarket, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PredictMarket, Error>;
|
|
276
|
+
|
|
261
277
|
declare const ChartRange: {
|
|
262
278
|
readonly ONE_DAY: "1d";
|
|
263
279
|
readonly ONE_WEEK: "1w";
|
|
@@ -586,4 +602,4 @@ interface CreatePolymarketOrderVariables {
|
|
|
586
602
|
*/
|
|
587
603
|
declare function useCreatePolymarketOrder(mutationOptions?: Omit<UseMutationOptions<PredictOrder, Error, CreatePolymarketOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<PredictOrder, Error, CreatePolymarketOrderVariables, unknown>;
|
|
588
604
|
|
|
589
|
-
export { BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventStatus, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, Orderbook, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketProvider, type PolymarketProviderProps, type PolymarketSigner, PositionsResponse, PredictClient, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, SimilarEventsParams, type UseBalanceParams, type UseCandlesticksParams, type UseEventParams, type UseMarketHistoryResult, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UsePositionsParams, type UsePredictWsClientResult, type UsePriceHistoryParams, type UsePricesSubscriptionParams, type UsePricesSubscriptionResult, type UseRealtimeOrderbookParams, type UseRealtimePricesParams, type UseRealtimeTradesParams, type UseRealtimeTradesResult, type UseSearchEventsParams, type UseSimilarEventsParams, type UseTradesSubscriptionParams, type UseTradesSubscriptionResult, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, balanceQueryKey, candlesticksQueryKey, dflowQuoteQueryKey, eventsQueryKey, fetchEvents, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tradesQueryKey, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowQuote, useDFlowSubmit, useEvent, useEvents, useInfiniteEvents, useMarketHistory, useMarketTrades, useOrder, useOrderbook, useOrderbookSubscription, useOrders, usePolymarket, usePositions, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useSearchEvents, useSimilarEvents, useTrades, useTradesSubscription };
|
|
605
|
+
export { BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventStatus, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, Orderbook, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketProvider, type PolymarketProviderProps, type PolymarketSigner, PositionsResponse, PredictClient, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, SimilarEventsParams, type UseBalanceParams, type UseCandlesticksParams, type UseEventParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UsePositionsParams, type UsePredictWsClientResult, type UsePriceHistoryParams, type UsePricesSubscriptionParams, type UsePricesSubscriptionResult, type UseRealtimeOrderbookParams, type UseRealtimePricesParams, type UseRealtimeTradesParams, type UseRealtimeTradesResult, type UseSearchEventsParams, type UseSimilarEventsParams, type UseTradesSubscriptionParams, type UseTradesSubscriptionResult, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, balanceQueryKey, candlesticksQueryKey, dflowQuoteQueryKey, eventsQueryKey, fetchEvents, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tradesQueryKey, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowQuote, useDFlowSubmit, useEvent, useEvents, useInfiniteEvents, useMarket, useMarketHistory, useMarketTrades, useOrder, useOrderbook, useOrderbookSubscription, useOrders, usePolymarket, usePositions, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useSearchEvents, useSimilarEvents, useTrades, useTradesSubscription };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { PredictClient, PredictWsClient, ListEventsParams, PredictPage, PredictEvent, ProviderSource, EventStatus, SimilarEventsParams, PredictMarket, Orderbook, ListMarketTradesParams, PredictTrade, PriceHistoryRange, PriceHistoryResponse, ListCandlesticksParams, Candlestick, PositionsResponse, BalanceResponse, ListOrdersParams, PredictOrder, CancelOrderResult, ListTradesParams, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitResponse, DFlowSubmitRequest, WsConnectionStatus, WsDataMessage, WsPriceEvent, WsOrderbookEvent, WsTradeEvent, CreateOrderInput } from './server.js';
|
|
2
|
+
export { BuildClobAuthMessageInput, BuildOrderMessageInput, BuildSignedOrderInput, CLOB_AUTH_DOMAIN, CLOB_AUTH_TYPES, CTF_EXCHANGE_ADDRESS, CTF_ORDER_TYPES, DFlowOrderContext, EventSortField, EventSummary, HttpMethod, MarketOutcome, MarketResult, MarketStatus, MarketSummary, NEG_RISK_CTF_EXCHANGE_ADDRESS, ORDER_TYPE, OrderMessage, OrderSide, OrderStatus, OrderbookLevel, POLYGON_CHAIN_ID, PolymarketL2Headers, PolymarketL2HeadersInput, PolymarketOrderType, PredictPosition, PredictTag, PredictWsClientConfig, PricePoint, ProviderMeta, ResolveEventsParamsInput, SIDE, SettlementSource, SignedOrder, TagSlugSelection, TradeType, USDC_ADDRESS, WsChannel, WsChannelEvent, WsClientMessage, WsErrorCode, WsErrorMessage, WsPingMessage, WsPongMessage, WsServerMessage, WsSubscribeMessage, WsSubscribedMessage, buildClobAuthMessage, buildCtfExchangeDomain, buildOrderMessage, buildPolymarketL2Headers, buildSignedOrder, createPredictClient, createPredictWsClient, derivePolymarketApiKey, eventQueryKey, fetchEvent, fetchEventsPage, fetchMarket, hmacSha256Base64, infiniteEventsQueryKey, marketQueryKey, resolveEventsParams, resolveTagSlug } from './server.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';
|
|
@@ -258,6 +258,22 @@ interface UseSimilarEventsParams {
|
|
|
258
258
|
}
|
|
259
259
|
declare function useSimilarEvents(params: UseSimilarEventsParams, queryOptions?: Omit<UseQueryOptions<PredictEvent[], Error, PredictEvent[], unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PredictEvent[], Error>;
|
|
260
260
|
|
|
261
|
+
interface UseMarketParams {
|
|
262
|
+
/** Canonical market slug. */
|
|
263
|
+
slug: string;
|
|
264
|
+
/** Upstream provider. Required by prediction-server for single-market fetch. */
|
|
265
|
+
source?: ProviderSource;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* React Query hook for `GET /api/v1/markets/:slug` via the prediction-server client.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```tsx
|
|
272
|
+
* const { data, isLoading } = useMarket({ slug: "KXBTCD-25FEB-T68000-yes", source: "dflow" });
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
declare function useMarket(params: UseMarketParams, queryOptions?: Omit<UseQueryOptions<PredictMarket, Error, PredictMarket, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PredictMarket, Error>;
|
|
276
|
+
|
|
261
277
|
declare const ChartRange: {
|
|
262
278
|
readonly ONE_DAY: "1d";
|
|
263
279
|
readonly ONE_WEEK: "1w";
|
|
@@ -586,4 +602,4 @@ interface CreatePolymarketOrderVariables {
|
|
|
586
602
|
*/
|
|
587
603
|
declare function useCreatePolymarketOrder(mutationOptions?: Omit<UseMutationOptions<PredictOrder, Error, CreatePolymarketOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<PredictOrder, Error, CreatePolymarketOrderVariables, unknown>;
|
|
588
604
|
|
|
589
|
-
export { BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventStatus, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, Orderbook, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketProvider, type PolymarketProviderProps, type PolymarketSigner, PositionsResponse, PredictClient, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, SimilarEventsParams, type UseBalanceParams, type UseCandlesticksParams, type UseEventParams, type UseMarketHistoryResult, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UsePositionsParams, type UsePredictWsClientResult, type UsePriceHistoryParams, type UsePricesSubscriptionParams, type UsePricesSubscriptionResult, type UseRealtimeOrderbookParams, type UseRealtimePricesParams, type UseRealtimeTradesParams, type UseRealtimeTradesResult, type UseSearchEventsParams, type UseSimilarEventsParams, type UseTradesSubscriptionParams, type UseTradesSubscriptionResult, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, balanceQueryKey, candlesticksQueryKey, dflowQuoteQueryKey, eventsQueryKey, fetchEvents, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tradesQueryKey, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowQuote, useDFlowSubmit, useEvent, useEvents, useInfiniteEvents, useMarketHistory, useMarketTrades, useOrder, useOrderbook, useOrderbookSubscription, useOrders, usePolymarket, usePositions, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useSearchEvents, useSimilarEvents, useTrades, useTradesSubscription };
|
|
605
|
+
export { BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventStatus, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, Orderbook, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketProvider, type PolymarketProviderProps, type PolymarketSigner, PositionsResponse, PredictClient, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, SimilarEventsParams, type UseBalanceParams, type UseCandlesticksParams, type UseEventParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UsePositionsParams, type UsePredictWsClientResult, type UsePriceHistoryParams, type UsePricesSubscriptionParams, type UsePricesSubscriptionResult, type UseRealtimeOrderbookParams, type UseRealtimePricesParams, type UseRealtimeTradesParams, type UseRealtimeTradesResult, type UseSearchEventsParams, type UseSimilarEventsParams, type UseTradesSubscriptionParams, type UseTradesSubscriptionResult, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, balanceQueryKey, candlesticksQueryKey, dflowQuoteQueryKey, eventsQueryKey, fetchEvents, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tradesQueryKey, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowQuote, useDFlowSubmit, useEvent, useEvents, useInfiniteEvents, useMarket, useMarketHistory, useMarketTrades, useOrder, useOrderbook, useOrderbookSubscription, useOrders, usePolymarket, usePositions, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useSearchEvents, useSimilarEvents, useTrades, useTradesSubscription };
|
package/dist/index.js
CHANGED
|
@@ -840,12 +840,16 @@ function useSimilarEvents(params, queryOptions = {}) {
|
|
|
840
840
|
...queryOptions
|
|
841
841
|
});
|
|
842
842
|
}
|
|
843
|
+
|
|
844
|
+
// src/hooks/predict/market.params.ts
|
|
843
845
|
function marketQueryKey(slug, source) {
|
|
844
846
|
return ["predict", "market", slug, source];
|
|
845
847
|
}
|
|
846
848
|
async function fetchMarket(client, slug, source) {
|
|
847
849
|
return client.getMarket(slug, source);
|
|
848
850
|
}
|
|
851
|
+
|
|
852
|
+
// src/hooks/predict/useMarket.ts
|
|
849
853
|
function useMarket(params, queryOptions = {}) {
|
|
850
854
|
const client = usePredictClient();
|
|
851
855
|
return reactQuery.useQuery({
|