@liberfi.io/react-predict 0.1.5 → 0.1.7

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 CHANGED
@@ -354,6 +354,10 @@ declare function useBalance(params: UseBalanceParams, queryOptions?: Omit<UseQue
354
354
  declare function ordersQueryKey(params: ListOrdersParams): unknown[];
355
355
  declare function useOrders(params: ListOrdersParams, queryOptions?: Omit<UseQueryOptions<PredictPage<PredictOrder>, Error, PredictPage<PredictOrder>, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PredictPage<PredictOrder>, Error>;
356
356
 
357
+ type UseInfiniteOrdersParams = Omit<ListOrdersParams, "next_cursor">;
358
+ declare function infiniteOrdersQueryKey(params: UseInfiniteOrdersParams): unknown[];
359
+ declare function useInfiniteOrders(params: UseInfiniteOrdersParams): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PredictPage<PredictOrder>, unknown>, Error>;
360
+
357
361
  declare function orderQueryKey(id: string, source: ProviderSource): unknown[];
358
362
  interface UseOrderParams {
359
363
  id: string;
@@ -373,6 +377,10 @@ declare function useCancelOrder(mutationOptions?: Omit<UseMutationOptions<Cancel
373
377
  declare function tradesQueryKey(params: ListTradesParams): unknown[];
374
378
  declare function useTrades(params: ListTradesParams, queryOptions?: Omit<UseQueryOptions<PredictPage<PredictTrade>, Error, PredictPage<PredictTrade>, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PredictPage<PredictTrade>, Error>;
375
379
 
380
+ type UseInfiniteTradesParams = Omit<ListTradesParams, "cursor">;
381
+ declare function infiniteTradesQueryKey(params: UseInfiniteTradesParams): unknown[];
382
+ declare function useInfiniteTrades(params: UseInfiniteTradesParams): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PredictPage<PredictTrade>, unknown>, Error>;
383
+
376
384
  declare function dflowQuoteQueryKey(params: DFlowQuoteRequest): unknown[];
377
385
  /**
378
386
  * Fetch a DFlow quote. The query is only enabled when all required
@@ -602,4 +610,4 @@ interface CreatePolymarketOrderVariables {
602
610
  */
603
611
  declare function useCreatePolymarketOrder(mutationOptions?: Omit<UseMutationOptions<PredictOrder, Error, CreatePolymarketOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<PredictOrder, Error, CreatePolymarketOrderVariables, unknown>;
604
612
 
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 };
613
+ 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 UseInfiniteOrdersParams, type UseInfiniteTradesParams, 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, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tradesQueryKey, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowQuote, useDFlowSubmit, useEvent, useEvents, useInfiniteEvents, useInfiniteOrders, useInfiniteTrades, 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
@@ -354,6 +354,10 @@ declare function useBalance(params: UseBalanceParams, queryOptions?: Omit<UseQue
354
354
  declare function ordersQueryKey(params: ListOrdersParams): unknown[];
355
355
  declare function useOrders(params: ListOrdersParams, queryOptions?: Omit<UseQueryOptions<PredictPage<PredictOrder>, Error, PredictPage<PredictOrder>, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PredictPage<PredictOrder>, Error>;
356
356
 
357
+ type UseInfiniteOrdersParams = Omit<ListOrdersParams, "next_cursor">;
358
+ declare function infiniteOrdersQueryKey(params: UseInfiniteOrdersParams): unknown[];
359
+ declare function useInfiniteOrders(params: UseInfiniteOrdersParams): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PredictPage<PredictOrder>, unknown>, Error>;
360
+
357
361
  declare function orderQueryKey(id: string, source: ProviderSource): unknown[];
358
362
  interface UseOrderParams {
359
363
  id: string;
@@ -373,6 +377,10 @@ declare function useCancelOrder(mutationOptions?: Omit<UseMutationOptions<Cancel
373
377
  declare function tradesQueryKey(params: ListTradesParams): unknown[];
374
378
  declare function useTrades(params: ListTradesParams, queryOptions?: Omit<UseQueryOptions<PredictPage<PredictTrade>, Error, PredictPage<PredictTrade>, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PredictPage<PredictTrade>, Error>;
375
379
 
380
+ type UseInfiniteTradesParams = Omit<ListTradesParams, "cursor">;
381
+ declare function infiniteTradesQueryKey(params: UseInfiniteTradesParams): unknown[];
382
+ declare function useInfiniteTrades(params: UseInfiniteTradesParams): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PredictPage<PredictTrade>, unknown>, Error>;
383
+
376
384
  declare function dflowQuoteQueryKey(params: DFlowQuoteRequest): unknown[];
377
385
  /**
378
386
  * Fetch a DFlow quote. The query is only enabled when all required
@@ -602,4 +610,4 @@ interface CreatePolymarketOrderVariables {
602
610
  */
603
611
  declare function useCreatePolymarketOrder(mutationOptions?: Omit<UseMutationOptions<PredictOrder, Error, CreatePolymarketOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<PredictOrder, Error, CreatePolymarketOrderVariables, unknown>;
604
612
 
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 };
613
+ 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 UseInfiniteOrdersParams, type UseInfiniteTradesParams, 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, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tradesQueryKey, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowQuote, useDFlowSubmit, useEvent, useEvents, useInfiniteEvents, useInfiniteOrders, useInfiniteTrades, 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
@@ -1014,6 +1014,19 @@ function useOrders(params, queryOptions = {}) {
1014
1014
  ...queryOptions
1015
1015
  });
1016
1016
  }
1017
+ function infiniteOrdersQueryKey(params) {
1018
+ return ["predict", "orders", "infinite", params];
1019
+ }
1020
+ function useInfiniteOrders(params) {
1021
+ const client = usePredictClient();
1022
+ return reactQuery.useInfiniteQuery({
1023
+ queryKey: infiniteOrdersQueryKey(params),
1024
+ queryFn: ({ pageParam }) => client.listOrders({ ...params, next_cursor: pageParam }),
1025
+ initialPageParam: void 0,
1026
+ getNextPageParam: (lastPage) => lastPage.has_more ? lastPage.next_cursor : void 0,
1027
+ enabled: Boolean(params.wallet_address)
1028
+ });
1029
+ }
1017
1030
  function orderQueryKey(id, source) {
1018
1031
  return ["predict", "order", id, source];
1019
1032
  }
@@ -1050,6 +1063,19 @@ function useTrades(params, queryOptions = {}) {
1050
1063
  ...queryOptions
1051
1064
  });
1052
1065
  }
1066
+ function infiniteTradesQueryKey(params) {
1067
+ return ["predict", "trades-by-wallet", "infinite", params];
1068
+ }
1069
+ function useInfiniteTrades(params) {
1070
+ const client = usePredictClient();
1071
+ return reactQuery.useInfiniteQuery({
1072
+ queryKey: infiniteTradesQueryKey(params),
1073
+ queryFn: ({ pageParam }) => client.listTrades({ ...params, cursor: pageParam }),
1074
+ initialPageParam: void 0,
1075
+ getNextPageParam: (lastPage) => lastPage.has_more ? lastPage.next_cursor : void 0,
1076
+ enabled: Boolean(params.wallet)
1077
+ });
1078
+ }
1053
1079
  function dflowQuoteQueryKey(params) {
1054
1080
  return ["predict", "dflow-quote", params];
1055
1081
  }
@@ -1496,6 +1522,8 @@ exports.fetchEventsPage = fetchEventsPage;
1496
1522
  exports.fetchMarket = fetchMarket;
1497
1523
  exports.hmacSha256Base64 = hmacSha256Base64;
1498
1524
  exports.infiniteEventsQueryKey = infiniteEventsQueryKey;
1525
+ exports.infiniteOrdersQueryKey = infiniteOrdersQueryKey;
1526
+ exports.infiniteTradesQueryKey = infiniteTradesQueryKey;
1499
1527
  exports.marketQueryKey = marketQueryKey;
1500
1528
  exports.marketTradesQueryKey = marketTradesQueryKey;
1501
1529
  exports.orderQueryKey = orderQueryKey;
@@ -1516,6 +1544,8 @@ exports.useDFlowSubmit = useDFlowSubmit;
1516
1544
  exports.useEvent = useEvent;
1517
1545
  exports.useEvents = useEvents;
1518
1546
  exports.useInfiniteEvents = useInfiniteEvents;
1547
+ exports.useInfiniteOrders = useInfiniteOrders;
1548
+ exports.useInfiniteTrades = useInfiniteTrades;
1519
1549
  exports.useMarket = useMarket;
1520
1550
  exports.useMarketHistory = useMarketHistory;
1521
1551
  exports.useMarketTrades = useMarketTrades;