@liberfi.io/react-predict 0.1.50 → 0.1.51

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
@@ -186,6 +186,22 @@ var PredictClient = class {
186
186
  headers ? { headers } : void 0
187
187
  );
188
188
  }
189
+ /**
190
+ * Multi-wallet order listing with enriched market/event context.
191
+ *
192
+ * Maps to `GET /api/v1/orders?kalshi_user=...&polymarket_user=...`.
193
+ *
194
+ * @param params - Per-provider wallet addresses.
195
+ * @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
196
+ */
197
+ async listOrdersMulti(params, headers) {
198
+ const query = buildQuery(params);
199
+ const url = `${this.endpoint}/api/v1/orders${query}`;
200
+ return await httpGet(
201
+ url,
202
+ headers ? { headers } : void 0
203
+ );
204
+ }
189
205
  /**
190
206
  * Maps to `GET /api/v1/orders/:id?source=...`.
191
207
  *
@@ -1335,6 +1351,30 @@ function useInfiniteOrders(params, options) {
1335
1351
  enabled: Boolean(params.wallet_address)
1336
1352
  });
1337
1353
  }
1354
+ function ordersMultiQueryKey(params) {
1355
+ return [
1356
+ "predict",
1357
+ "orders",
1358
+ "multi",
1359
+ params.kalshi_user ?? "",
1360
+ params.polymarket_user ?? ""
1361
+ ];
1362
+ }
1363
+ function useOrdersMulti(params, options, queryOptions = {}) {
1364
+ const client = usePredictClient();
1365
+ const hasAnyWallet = Boolean(params.kalshi_user || params.polymarket_user);
1366
+ return useQuery({
1367
+ queryKey: [...ordersMultiQueryKey(params), ...options?.keyExtra ?? []],
1368
+ queryFn: async () => {
1369
+ const headers = await options?.getHeaders?.();
1370
+ return client.listOrdersMulti(params, headers);
1371
+ },
1372
+ enabled: hasAnyWallet,
1373
+ staleTime: 1e4,
1374
+ refetchInterval: 3e4,
1375
+ ...queryOptions
1376
+ });
1377
+ }
1338
1378
  function orderQueryKey(id, source) {
1339
1379
  return ["predict", "order", id, source];
1340
1380
  }
@@ -1348,15 +1388,23 @@ function useOrder(params, queryOptions = {}) {
1348
1388
  ...queryOptions
1349
1389
  });
1350
1390
  }
1351
- function useCancelOrder(mutationOptions = {}) {
1391
+ function useCancelOrder(options, mutationOptions = {}) {
1352
1392
  const client = usePredictClient();
1353
1393
  const queryClient = useQueryClient();
1394
+ const { onSuccess, onError, ...restMutationOptions } = mutationOptions;
1354
1395
  return useMutation({
1355
- mutationFn: (vars) => client.cancelOrder(vars.id, vars.source),
1356
- onSuccess: () => {
1396
+ mutationFn: async (vars) => {
1397
+ const headers = await options?.getHeaders?.(vars);
1398
+ return client.cancelOrder(vars.id, vars.source, headers);
1399
+ },
1400
+ onSuccess: (...args) => {
1357
1401
  queryClient.invalidateQueries({ queryKey: ["predict", "orders"] });
1402
+ onSuccess?.(...args);
1358
1403
  },
1359
- ...mutationOptions
1404
+ onError: (...args) => {
1405
+ onError?.(...args);
1406
+ },
1407
+ ...restMutationOptions
1360
1408
  });
1361
1409
  }
1362
1410
 
@@ -2088,6 +2136,6 @@ async function pollTxConfirmed(fetchStatus, txHash) {
2088
2136
  );
2089
2137
  }
2090
2138
 
2091
- 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, availableSharesQueryKey, balanceQueryKey, buildClobAuthMessage, buildClobPayload, buildCtfExchangeDomain, buildOrderMessage, buildPolymarketL2Headers, buildSignedOrder, candlesticksQueryKey, createPredictClient, createPredictWsClient, derivePolymarketApiKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventQueryKey, eventStatsQueryKey, eventsQueryKey, fetchEvent, fetchEvents, fetchEventsPage, fetchMarket, fetchMatchMarketsPage, fetchMatchesPage, hmacSha256Base64, infiniteEventsQueryKey, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketQueryKey, marketTradesQueryKey, matchMarketsQueryKey, matchQueryKey, matchesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, resolveEventsParams, resolveTagSlug, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, useAvailableShares, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, useEventStats, useEvents, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketWithdraw, usePositions, usePositionsMulti, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useTickSize, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, withdrawStatusQueryKey };
2139
+ 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, availableSharesQueryKey, balanceQueryKey, buildClobAuthMessage, buildClobPayload, buildCtfExchangeDomain, buildOrderMessage, buildPolymarketL2Headers, buildSignedOrder, candlesticksQueryKey, createPredictClient, createPredictWsClient, derivePolymarketApiKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventQueryKey, eventStatsQueryKey, eventsQueryKey, fetchEvent, fetchEvents, fetchEventsPage, fetchMarket, fetchMatchMarketsPage, fetchMatchesPage, hmacSha256Base64, infiniteEventsQueryKey, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketQueryKey, marketTradesQueryKey, matchMarketsQueryKey, matchQueryKey, matchesQueryKey, orderQueryKey, orderbookQueryKey, ordersMultiQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, resolveEventsParams, resolveTagSlug, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, useAvailableShares, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, useEventStats, useEvents, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, useOrdersMulti, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketWithdraw, usePositions, usePositionsMulti, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useTickSize, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, withdrawStatusQueryKey };
2092
2140
  //# sourceMappingURL=index.mjs.map
2093
2141
  //# sourceMappingURL=index.mjs.map