@liberfi.io/react-predict 0.1.18 → 0.1.20

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.mjs CHANGED
@@ -201,6 +201,28 @@ var PredictClient = class {
201
201
  return await httpGet(url);
202
202
  }
203
203
  // -------------------------------------------------------------------------
204
+ // Cross-platform matches
205
+ // -------------------------------------------------------------------------
206
+ /**
207
+ * List cross-platform matched event groups with inline aggregate stats.
208
+ *
209
+ * Maps to `GET /api/v1/matches`.
210
+ */
211
+ async listMatches(params) {
212
+ const query = buildQuery(params ?? {});
213
+ const url = `${this.endpoint}/api/v1/matches${query}`;
214
+ return await httpGet(url);
215
+ }
216
+ /**
217
+ * Fetch a single match group by ID.
218
+ *
219
+ * Maps to `GET /api/v1/matches/:id`.
220
+ */
221
+ async getMatch(id) {
222
+ const url = `${this.endpoint}/api/v1/matches/${id}`;
223
+ return await httpGet(url);
224
+ }
225
+ // -------------------------------------------------------------------------
204
226
  // Trades by wallet
205
227
  // -------------------------------------------------------------------------
206
228
  /** Maps to `GET /api/v1/trades?source=...&wallet=...`. */
@@ -1076,6 +1098,42 @@ function useCancelOrder(mutationOptions = {}) {
1076
1098
  ...mutationOptions
1077
1099
  });
1078
1100
  }
1101
+
1102
+ // src/hooks/predict/matches.params.ts
1103
+ function matchesQueryKey(params) {
1104
+ return ["predict", "matches", params];
1105
+ }
1106
+ function matchQueryKey(id) {
1107
+ return ["predict", "match", id];
1108
+ }
1109
+ async function fetchMatchesPage(client, params) {
1110
+ return client.listMatches(params);
1111
+ }
1112
+
1113
+ // src/hooks/predict/useMatches.ts
1114
+ function useInfiniteMatches(params, queryOptions = {}) {
1115
+ const client = usePredictClient();
1116
+ return useInfiniteQuery({
1117
+ queryKey: matchesQueryKey(params),
1118
+ queryFn: ({ pageParam }) => fetchMatchesPage(client, {
1119
+ ...params,
1120
+ ...pageParam !== void 0 ? { cursor: pageParam } : {}
1121
+ }),
1122
+ initialPageParam: void 0,
1123
+ getNextPageParam: (lastPage) => lastPage.has_more && lastPage.next_cursor ? lastPage.next_cursor : void 0,
1124
+ ...queryOptions
1125
+ });
1126
+ }
1127
+ function useMatch(id, queryOptions = {}) {
1128
+ const client = usePredictClient();
1129
+ return useQuery({
1130
+ queryKey: matchQueryKey(id),
1131
+ queryFn: () => client.getMatch(id),
1132
+ enabled: id > 0,
1133
+ staleTime: 2 * 6e4,
1134
+ ...queryOptions
1135
+ });
1136
+ }
1079
1137
  function tradesQueryKey(params) {
1080
1138
  return ["predict", "trades-by-wallet", params];
1081
1139
  }
@@ -1525,6 +1583,6 @@ function useCreatePolymarketOrder(mutationOptions = {}) {
1525
1583
  });
1526
1584
  }
1527
1585
 
1528
- export { CLOB_AUTH_DOMAIN, CLOB_AUTH_TYPES, CTF_EXCHANGE_ADDRESS, CTF_ORDER_TYPES, ChartRange, NEG_RISK_CTF_EXCHANGE_ADDRESS, ORDER_TYPE, POLYGON_CHAIN_ID, PolymarketContext, PolymarketProvider, PredictClient, PredictContext, PredictProvider, PredictWsClient, SIDE, USDC_ADDRESS, balanceQueryKey, buildClobAuthMessage, buildCtfExchangeDomain, buildOrderMessage, buildPolymarketL2Headers, buildSignedOrder, candlesticksQueryKey, createPredictClient, createPredictWsClient, derivePolymarketApiKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventQueryKey, eventsQueryKey, fetchEvent, fetchEvents, fetchEventsPage, fetchMarket, hmacSha256Base64, infiniteEventsQueryKey, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, positionsQueryKey, priceHistoryQueryKey, resolveEventsParams, resolveTagSlug, similarEventsQueryKey, tradesQueryKey, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, 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 };
1586
+ export { CLOB_AUTH_DOMAIN, CLOB_AUTH_TYPES, CTF_EXCHANGE_ADDRESS, CTF_ORDER_TYPES, ChartRange, NEG_RISK_CTF_EXCHANGE_ADDRESS, ORDER_TYPE, POLYGON_CHAIN_ID, PolymarketContext, PolymarketProvider, PredictClient, PredictContext, PredictProvider, PredictWsClient, SIDE, USDC_ADDRESS, balanceQueryKey, buildClobAuthMessage, buildCtfExchangeDomain, buildOrderMessage, buildPolymarketL2Headers, buildSignedOrder, candlesticksQueryKey, createPredictClient, createPredictWsClient, derivePolymarketApiKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventQueryKey, eventsQueryKey, fetchEvent, fetchEvents, fetchEventsPage, fetchMarket, fetchMatchesPage, hmacSha256Base64, infiniteEventsQueryKey, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketQueryKey, marketTradesQueryKey, matchQueryKey, matchesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, positionsQueryKey, priceHistoryQueryKey, resolveEventsParams, resolveTagSlug, similarEventsQueryKey, tradesQueryKey, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, useEvents, useInfiniteEvents, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, usePolymarket, usePositions, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useSearchEvents, useSimilarEvents, useTrades, useTradesSubscription };
1529
1587
  //# sourceMappingURL=index.mjs.map
1530
1588
  //# sourceMappingURL=index.mjs.map