@liberfi.io/react-predict 0.1.49 → 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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PredictClient, a as PredictWsClient, L as ListEventsParams, b as PredictPage, c as PredictEvent, d as ProviderSource, E as EventStats, e as EventStatus, f as EventSortField, S as SimilarEventsParams, g as PredictMarket, O as Orderbook, h as ListMarketTradesParams, i as PredictTrade, j as PriceHistoryRange, k as PriceHistoryResponse, l as ListCandlesticksParams, C as Candlestick, m as PositionsResponse, B as BalanceResponse, n as ListOrdersParams, o as PredictOrder, p as CancelOrderResult, M as MatchesParams, q as MatchGroupPage, r as MatchGroup, s as MatchMarketParams, t as MatchMarketPage, u as ListTradesParams, D as DFlowQuoteRequest, v as DFlowQuoteResponse, w as DFlowSubmitResponse, x as DFlowSubmitRequest, y as DFlowKYCStatus, z as PolymarketSetupStatus, W as WithdrawBuildResponse, A as WithdrawBuildRequest, F as WithdrawSubmitResponse, G as WithdrawSubmitRequest, H as WithdrawStatusResponse, I as PolymarketDepositAddresses, J as PolymarketWithdrawResponse, K as PolymarketWithdrawRequest, T as TickSizeResponse, N as WsConnectionStatus, Q as WsDataMessage, R as WsPriceEvent, U as WsOrderbookEvent, V as WsTradeEvent, X as CreateOrderInput } from './server-rYuNULuJ.mjs';
2
- export { a_ as BuildClobAuthMessageInput, bb as BuildOrderMessageInput, aR as CLOB_AUTH_DOMAIN, aS as CLOB_AUTH_TYPES, a$ as CTF_EXCHANGE_ADDRESS, b4 as CTF_ORDER_TYPES, ba as ClobOrderPayload, ad as DFlowOrderContext, af as DepositBuildRequest, ag as DepositBuildResponse, aj as DepositStatusResponse, ah as DepositSubmitRequest, ai as DepositSubmitResponse, a7 as EventSummary, aX as HttpMethod, a4 as MarketOutcome, a3 as MarketResult, a2 as MarketStatus, a8 as MarketSummary, aq as MatchConfidenceTier, am as MatchGroupEntry, an as MatchGroupMarket, ar as MatchMarketFlat, ao as MatchSortField, al as MatchStatus, ap as MatchesStats, b0 as NEG_RISK_CTF_EXCHANGE_ADDRESS, b5 as ORDER_TYPE, bc as OrderMessage, ac as OrderSide, ab as OrderStatus, a5 as OrderbookLevel, b2 as POLYGON_CHAIN_ID, aZ as PolymarketL2Headers, aY as PolymarketL2HeadersInput, ae as PolymarketOrderType, aa as PredictPosition, a0 as PredictTag, _ as PredictWsClientConfig, a9 as PricePoint, $ as ProviderMeta, aI as ResolveEventsParamsInput, b6 as SIDE, a1 as SettlementSource, bd as SignedOrder, aJ as TagSlugSelection, a6 as TradeType, b1 as USDC_ADDRESS, ak as UnsignedTx, as as WsChannel, at as WsChannelEvent, au as WsClientMessage, aA as WsErrorCode, aB as WsErrorMessage, aw as WsPingMessage, ay as WsPongMessage, ax as WsServerMessage, av as WsSubscribeMessage, az as WsSubscribedMessage, aT as buildClobAuthMessage, b9 as buildClobPayload, b3 as buildCtfExchangeDomain, b7 as buildOrderMessage, aV as buildPolymarketL2Headers, b8 as buildSignedOrder, Y as createPredictClient, Z as createPredictWsClient, aW as derivePolymarketApiKey, aC as eventQueryKey, aD as fetchEvent, aH as fetchEventsPage, aL as fetchMarket, aQ as fetchMatchMarketsPage, aO as fetchMatchesPage, aU as hmacSha256Base64, aG as infiniteEventsQueryKey, aK as marketQueryKey, aP as matchMarketsQueryKey, aN as matchQueryKey, aM as matchesQueryKey, aF as resolveEventsParams, aE as resolveTagSlug } from './server-rYuNULuJ.mjs';
1
+ import { P as PredictClient, a as PredictWsClient, L as ListEventsParams, b as PredictPage, c as PredictEvent, d as ProviderSource, E as EventStats, e as EventStatus, f as EventSortField, S as SimilarEventsParams, g as PredictMarket, O as Orderbook, h as ListMarketTradesParams, i as PredictTrade, j as PriceHistoryRange, k as PriceHistoryResponse, l as ListCandlesticksParams, C as Candlestick, m as PositionsResponse, A as AvailableSharesResponse, B as BalanceResponse, n as ListOrdersParams, o as PredictOrder, p as ListOrdersMultiParams, q as PredictOrdersResponse, r as CancelOrderResult, M as MatchesParams, s as MatchGroupPage, t as MatchGroup, u as MatchMarketParams, v as MatchMarketPage, w as ListTradesParams, D as DFlowQuoteRequest, x as DFlowQuoteResponse, y as DFlowSubmitResponse, z as DFlowSubmitRequest, F as DFlowKYCStatus, G as PolymarketSetupStatus, W as WithdrawBuildResponse, H as WithdrawBuildRequest, I as WithdrawSubmitResponse, J as WithdrawSubmitRequest, K as WithdrawStatusResponse, N as PolymarketDepositAddresses, Q as PolymarketWithdrawResponse, R as PolymarketWithdrawRequest, T as TickSizeResponse, U as WsConnectionStatus, V as WsDataMessage, X as WsPriceEvent, Y as WsOrderbookEvent, Z as WsTradeEvent, _ as CreateOrderInput } from './server-eKqIns8z.mjs';
2
+ export { b1 as BuildClobAuthMessageInput, be as BuildOrderMessageInput, aU as CLOB_AUTH_DOMAIN, aV as CLOB_AUTH_TYPES, b2 as CTF_EXCHANGE_ADDRESS, b7 as CTF_ORDER_TYPES, bd as ClobOrderPayload, ag as DFlowOrderContext, ai as DepositBuildRequest, aj as DepositBuildResponse, am as DepositStatusResponse, ak as DepositSubmitRequest, al as DepositSubmitResponse, aa as EventSummary, a_ as HttpMethod, a7 as MarketOutcome, a6 as MarketResult, a5 as MarketStatus, ab as MarketSummary, at as MatchConfidenceTier, ap as MatchGroupEntry, aq as MatchGroupMarket, au as MatchMarketFlat, ar as MatchSortField, ao as MatchStatus, as as MatchesStats, b3 as NEG_RISK_CTF_EXCHANGE_ADDRESS, b8 as ORDER_TYPE, bf as OrderMessage, af as OrderSide, ae as OrderStatus, a8 as OrderbookLevel, b5 as POLYGON_CHAIN_ID, b0 as PolymarketL2Headers, a$ as PolymarketL2HeadersInput, ah as PolymarketOrderType, ad as PredictPosition, a3 as PredictTag, a1 as PredictWsClientConfig, ac as PricePoint, a2 as ProviderMeta, aL as ResolveEventsParamsInput, b9 as SIDE, a4 as SettlementSource, bg as SignedOrder, aM as TagSlugSelection, a9 as TradeType, b4 as USDC_ADDRESS, an as UnsignedTx, av as WsChannel, aw as WsChannelEvent, ax as WsClientMessage, aD as WsErrorCode, aE as WsErrorMessage, az as WsPingMessage, aB as WsPongMessage, aA as WsServerMessage, ay as WsSubscribeMessage, aC as WsSubscribedMessage, aW as buildClobAuthMessage, bc as buildClobPayload, b6 as buildCtfExchangeDomain, ba as buildOrderMessage, aY as buildPolymarketL2Headers, bb as buildSignedOrder, $ as createPredictClient, a0 as createPredictWsClient, aZ as derivePolymarketApiKey, aF as eventQueryKey, aG as fetchEvent, aK as fetchEventsPage, aO as fetchMarket, aT as fetchMatchMarketsPage, aR as fetchMatchesPage, aX as hmacSha256Base64, aJ as infiniteEventsQueryKey, aN as marketQueryKey, aS as matchMarketsQueryKey, aQ as matchQueryKey, aP as matchesQueryKey, aI as resolveEventsParams, aH as resolveTagSlug } from './server-eKqIns8z.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';
@@ -392,6 +392,22 @@ declare function usePositions(params: UsePositionsParams, queryOptions?: Omit<Us
392
392
  */
393
393
  declare function usePositionsMulti(params: UsePositionsMultiParams, queryOptions?: Omit<UseQueryOptions<PositionsResponse, Error, PositionsResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PositionsResponse, Error>;
394
394
 
395
+ interface UseAvailableSharesParams {
396
+ source: ProviderSource;
397
+ user: string;
398
+ market: string;
399
+ side: string;
400
+ }
401
+ declare function availableSharesQueryKey(params: UseAvailableSharesParams): unknown[];
402
+ interface UseAvailableSharesOptions {
403
+ /**
404
+ * Async callback invoked before each request to obtain extra headers.
405
+ * Used by Polymarket to attach POLY_* HMAC authentication headers.
406
+ */
407
+ getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
408
+ }
409
+ declare function useAvailableShares(params: UseAvailableSharesParams, options?: UseAvailableSharesOptions, queryOptions?: Omit<UseQueryOptions<AvailableSharesResponse, Error, AvailableSharesResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<AvailableSharesResponse, Error>;
410
+
395
411
  declare function balanceQueryKey(source: ProviderSource, user: string): unknown[];
396
412
  interface UseBalanceParams {
397
413
  source: ProviderSource;
@@ -420,6 +436,27 @@ interface UseInfiniteOrdersOptions {
420
436
  declare function infiniteOrdersQueryKey(params: UseInfiniteOrdersParams): unknown[];
421
437
  declare function useInfiniteOrders(params: UseInfiniteOrdersParams, options?: UseInfiniteOrdersOptions): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PredictPage<PredictOrder>, unknown>, Error>;
422
438
 
439
+ declare function ordersMultiQueryKey(params: ListOrdersMultiParams): unknown[];
440
+ interface UseOrdersMultiOptions {
441
+ /**
442
+ * Async callback invoked before each request to obtain extra headers.
443
+ * Used by Polymarket orders to attach POLY_* HMAC authentication headers.
444
+ */
445
+ getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
446
+ /**
447
+ * Extra values appended to the query key for cache invalidation.
448
+ * Use this to force a refetch when external state changes
449
+ * (e.g. `[!!credentials]` so the query re-runs once HMAC credentials load).
450
+ */
451
+ keyExtra?: unknown[];
452
+ }
453
+ /**
454
+ * Fetch enriched orders for multiple wallets in a single request.
455
+ * Each provider is queried with its own address. Orders include
456
+ * market and event summary data from the backend.
457
+ */
458
+ declare function useOrdersMulti(params: ListOrdersMultiParams, options?: UseOrdersMultiOptions, queryOptions?: Omit<UseQueryOptions<PredictOrdersResponse, Error, PredictOrdersResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PredictOrdersResponse, Error>;
459
+
423
460
  declare function orderQueryKey(id: string, source: ProviderSource): unknown[];
424
461
  interface UseOrderParams {
425
462
  id: string;
@@ -434,7 +471,14 @@ interface CancelOrderVariables {
434
471
  id: string;
435
472
  source: ProviderSource;
436
473
  }
437
- declare function useCancelOrder(mutationOptions?: Omit<UseMutationOptions<CancelOrderResult, Error, CancelOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<CancelOrderResult, Error, CancelOrderVariables, unknown>;
474
+ interface UseCancelOrderOptions {
475
+ /**
476
+ * Async callback invoked before the cancel request to obtain extra headers.
477
+ * Required for Polymarket orders (POLY_* HMAC authentication headers).
478
+ */
479
+ getHeaders?: (vars: CancelOrderVariables) => Record<string, string> | Promise<Record<string, string>>;
480
+ }
481
+ declare function useCancelOrder(options?: UseCancelOrderOptions, mutationOptions?: Omit<UseMutationOptions<CancelOrderResult, Error, CancelOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<CancelOrderResult, Error, CancelOrderVariables, unknown>;
438
482
 
439
483
  type UseInfiniteMatchesParams = Omit<MatchesParams, "cursor">;
440
484
  type InfiniteQueryOptions$1 = Omit<UseInfiniteQueryOptions<MatchGroupPage, Error, InfiniteData<MatchGroupPage>, unknown[], string | undefined>, "queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam">;
@@ -808,4 +852,4 @@ interface CreatePolymarketOrderVariables {
808
852
  */
809
853
  declare function useCreatePolymarketOrder(mutationOptions?: Omit<UseMutationOptions<PredictOrder, Error, CreatePolymarketOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<PredictOrder, Error, CreatePolymarketOrderVariables, unknown>;
810
854
 
811
- export { BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketProvider, type PolymarketProviderProps, type PolymarketSigner, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionsResponse, PredictClient, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, SimilarEventsParams, TickSizeResponse, type UseBalanceParams, type UseCandlesticksParams, type UseEventParams, type UseInfiniteMatchMarketsParams, type UseInfiniteMatchesParams, type UseInfiniteOrdersOptions, type UseInfiniteOrdersParams, type UseInfiniteTradesParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UseOrdersOptions, 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 UseTradesSubscriptionParams, type UseTradesSubscriptionResult, type UseWithdrawStatusQueryParams, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, balanceQueryKey, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, 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 };
855
+ export { AvailableSharesResponse, BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersMultiParams, ListOrdersParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketProvider, type PolymarketProviderProps, type PolymarketSigner, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionsResponse, PredictClient, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictOrdersResponse, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, SimilarEventsParams, TickSizeResponse, type UseAvailableSharesOptions, type UseAvailableSharesParams, type UseBalanceParams, type UseCancelOrderOptions, type UseCandlesticksParams, type UseEventParams, type UseInfiniteMatchMarketsParams, type UseInfiniteMatchesParams, type UseInfiniteOrdersOptions, type UseInfiniteOrdersParams, type UseInfiniteTradesParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UseOrdersMultiOptions, type UseOrdersOptions, 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 UseTradesSubscriptionParams, type UseTradesSubscriptionResult, type UseWithdrawStatusQueryParams, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, availableSharesQueryKey, balanceQueryKey, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersMultiQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, 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 };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PredictClient, a as PredictWsClient, L as ListEventsParams, b as PredictPage, c as PredictEvent, d as ProviderSource, E as EventStats, e as EventStatus, f as EventSortField, S as SimilarEventsParams, g as PredictMarket, O as Orderbook, h as ListMarketTradesParams, i as PredictTrade, j as PriceHistoryRange, k as PriceHistoryResponse, l as ListCandlesticksParams, C as Candlestick, m as PositionsResponse, B as BalanceResponse, n as ListOrdersParams, o as PredictOrder, p as CancelOrderResult, M as MatchesParams, q as MatchGroupPage, r as MatchGroup, s as MatchMarketParams, t as MatchMarketPage, u as ListTradesParams, D as DFlowQuoteRequest, v as DFlowQuoteResponse, w as DFlowSubmitResponse, x as DFlowSubmitRequest, y as DFlowKYCStatus, z as PolymarketSetupStatus, W as WithdrawBuildResponse, A as WithdrawBuildRequest, F as WithdrawSubmitResponse, G as WithdrawSubmitRequest, H as WithdrawStatusResponse, I as PolymarketDepositAddresses, J as PolymarketWithdrawResponse, K as PolymarketWithdrawRequest, T as TickSizeResponse, N as WsConnectionStatus, Q as WsDataMessage, R as WsPriceEvent, U as WsOrderbookEvent, V as WsTradeEvent, X as CreateOrderInput } from './server-rYuNULuJ.js';
2
- export { a_ as BuildClobAuthMessageInput, bb as BuildOrderMessageInput, aR as CLOB_AUTH_DOMAIN, aS as CLOB_AUTH_TYPES, a$ as CTF_EXCHANGE_ADDRESS, b4 as CTF_ORDER_TYPES, ba as ClobOrderPayload, ad as DFlowOrderContext, af as DepositBuildRequest, ag as DepositBuildResponse, aj as DepositStatusResponse, ah as DepositSubmitRequest, ai as DepositSubmitResponse, a7 as EventSummary, aX as HttpMethod, a4 as MarketOutcome, a3 as MarketResult, a2 as MarketStatus, a8 as MarketSummary, aq as MatchConfidenceTier, am as MatchGroupEntry, an as MatchGroupMarket, ar as MatchMarketFlat, ao as MatchSortField, al as MatchStatus, ap as MatchesStats, b0 as NEG_RISK_CTF_EXCHANGE_ADDRESS, b5 as ORDER_TYPE, bc as OrderMessage, ac as OrderSide, ab as OrderStatus, a5 as OrderbookLevel, b2 as POLYGON_CHAIN_ID, aZ as PolymarketL2Headers, aY as PolymarketL2HeadersInput, ae as PolymarketOrderType, aa as PredictPosition, a0 as PredictTag, _ as PredictWsClientConfig, a9 as PricePoint, $ as ProviderMeta, aI as ResolveEventsParamsInput, b6 as SIDE, a1 as SettlementSource, bd as SignedOrder, aJ as TagSlugSelection, a6 as TradeType, b1 as USDC_ADDRESS, ak as UnsignedTx, as as WsChannel, at as WsChannelEvent, au as WsClientMessage, aA as WsErrorCode, aB as WsErrorMessage, aw as WsPingMessage, ay as WsPongMessage, ax as WsServerMessage, av as WsSubscribeMessage, az as WsSubscribedMessage, aT as buildClobAuthMessage, b9 as buildClobPayload, b3 as buildCtfExchangeDomain, b7 as buildOrderMessage, aV as buildPolymarketL2Headers, b8 as buildSignedOrder, Y as createPredictClient, Z as createPredictWsClient, aW as derivePolymarketApiKey, aC as eventQueryKey, aD as fetchEvent, aH as fetchEventsPage, aL as fetchMarket, aQ as fetchMatchMarketsPage, aO as fetchMatchesPage, aU as hmacSha256Base64, aG as infiniteEventsQueryKey, aK as marketQueryKey, aP as matchMarketsQueryKey, aN as matchQueryKey, aM as matchesQueryKey, aF as resolveEventsParams, aE as resolveTagSlug } from './server-rYuNULuJ.js';
1
+ import { P as PredictClient, a as PredictWsClient, L as ListEventsParams, b as PredictPage, c as PredictEvent, d as ProviderSource, E as EventStats, e as EventStatus, f as EventSortField, S as SimilarEventsParams, g as PredictMarket, O as Orderbook, h as ListMarketTradesParams, i as PredictTrade, j as PriceHistoryRange, k as PriceHistoryResponse, l as ListCandlesticksParams, C as Candlestick, m as PositionsResponse, A as AvailableSharesResponse, B as BalanceResponse, n as ListOrdersParams, o as PredictOrder, p as ListOrdersMultiParams, q as PredictOrdersResponse, r as CancelOrderResult, M as MatchesParams, s as MatchGroupPage, t as MatchGroup, u as MatchMarketParams, v as MatchMarketPage, w as ListTradesParams, D as DFlowQuoteRequest, x as DFlowQuoteResponse, y as DFlowSubmitResponse, z as DFlowSubmitRequest, F as DFlowKYCStatus, G as PolymarketSetupStatus, W as WithdrawBuildResponse, H as WithdrawBuildRequest, I as WithdrawSubmitResponse, J as WithdrawSubmitRequest, K as WithdrawStatusResponse, N as PolymarketDepositAddresses, Q as PolymarketWithdrawResponse, R as PolymarketWithdrawRequest, T as TickSizeResponse, U as WsConnectionStatus, V as WsDataMessage, X as WsPriceEvent, Y as WsOrderbookEvent, Z as WsTradeEvent, _ as CreateOrderInput } from './server-eKqIns8z.js';
2
+ export { b1 as BuildClobAuthMessageInput, be as BuildOrderMessageInput, aU as CLOB_AUTH_DOMAIN, aV as CLOB_AUTH_TYPES, b2 as CTF_EXCHANGE_ADDRESS, b7 as CTF_ORDER_TYPES, bd as ClobOrderPayload, ag as DFlowOrderContext, ai as DepositBuildRequest, aj as DepositBuildResponse, am as DepositStatusResponse, ak as DepositSubmitRequest, al as DepositSubmitResponse, aa as EventSummary, a_ as HttpMethod, a7 as MarketOutcome, a6 as MarketResult, a5 as MarketStatus, ab as MarketSummary, at as MatchConfidenceTier, ap as MatchGroupEntry, aq as MatchGroupMarket, au as MatchMarketFlat, ar as MatchSortField, ao as MatchStatus, as as MatchesStats, b3 as NEG_RISK_CTF_EXCHANGE_ADDRESS, b8 as ORDER_TYPE, bf as OrderMessage, af as OrderSide, ae as OrderStatus, a8 as OrderbookLevel, b5 as POLYGON_CHAIN_ID, b0 as PolymarketL2Headers, a$ as PolymarketL2HeadersInput, ah as PolymarketOrderType, ad as PredictPosition, a3 as PredictTag, a1 as PredictWsClientConfig, ac as PricePoint, a2 as ProviderMeta, aL as ResolveEventsParamsInput, b9 as SIDE, a4 as SettlementSource, bg as SignedOrder, aM as TagSlugSelection, a9 as TradeType, b4 as USDC_ADDRESS, an as UnsignedTx, av as WsChannel, aw as WsChannelEvent, ax as WsClientMessage, aD as WsErrorCode, aE as WsErrorMessage, az as WsPingMessage, aB as WsPongMessage, aA as WsServerMessage, ay as WsSubscribeMessage, aC as WsSubscribedMessage, aW as buildClobAuthMessage, bc as buildClobPayload, b6 as buildCtfExchangeDomain, ba as buildOrderMessage, aY as buildPolymarketL2Headers, bb as buildSignedOrder, $ as createPredictClient, a0 as createPredictWsClient, aZ as derivePolymarketApiKey, aF as eventQueryKey, aG as fetchEvent, aK as fetchEventsPage, aO as fetchMarket, aT as fetchMatchMarketsPage, aR as fetchMatchesPage, aX as hmacSha256Base64, aJ as infiniteEventsQueryKey, aN as marketQueryKey, aS as matchMarketsQueryKey, aQ as matchQueryKey, aP as matchesQueryKey, aI as resolveEventsParams, aH as resolveTagSlug } from './server-eKqIns8z.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';
@@ -392,6 +392,22 @@ declare function usePositions(params: UsePositionsParams, queryOptions?: Omit<Us
392
392
  */
393
393
  declare function usePositionsMulti(params: UsePositionsMultiParams, queryOptions?: Omit<UseQueryOptions<PositionsResponse, Error, PositionsResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PositionsResponse, Error>;
394
394
 
395
+ interface UseAvailableSharesParams {
396
+ source: ProviderSource;
397
+ user: string;
398
+ market: string;
399
+ side: string;
400
+ }
401
+ declare function availableSharesQueryKey(params: UseAvailableSharesParams): unknown[];
402
+ interface UseAvailableSharesOptions {
403
+ /**
404
+ * Async callback invoked before each request to obtain extra headers.
405
+ * Used by Polymarket to attach POLY_* HMAC authentication headers.
406
+ */
407
+ getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
408
+ }
409
+ declare function useAvailableShares(params: UseAvailableSharesParams, options?: UseAvailableSharesOptions, queryOptions?: Omit<UseQueryOptions<AvailableSharesResponse, Error, AvailableSharesResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<AvailableSharesResponse, Error>;
410
+
395
411
  declare function balanceQueryKey(source: ProviderSource, user: string): unknown[];
396
412
  interface UseBalanceParams {
397
413
  source: ProviderSource;
@@ -420,6 +436,27 @@ interface UseInfiniteOrdersOptions {
420
436
  declare function infiniteOrdersQueryKey(params: UseInfiniteOrdersParams): unknown[];
421
437
  declare function useInfiniteOrders(params: UseInfiniteOrdersParams, options?: UseInfiniteOrdersOptions): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PredictPage<PredictOrder>, unknown>, Error>;
422
438
 
439
+ declare function ordersMultiQueryKey(params: ListOrdersMultiParams): unknown[];
440
+ interface UseOrdersMultiOptions {
441
+ /**
442
+ * Async callback invoked before each request to obtain extra headers.
443
+ * Used by Polymarket orders to attach POLY_* HMAC authentication headers.
444
+ */
445
+ getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
446
+ /**
447
+ * Extra values appended to the query key for cache invalidation.
448
+ * Use this to force a refetch when external state changes
449
+ * (e.g. `[!!credentials]` so the query re-runs once HMAC credentials load).
450
+ */
451
+ keyExtra?: unknown[];
452
+ }
453
+ /**
454
+ * Fetch enriched orders for multiple wallets in a single request.
455
+ * Each provider is queried with its own address. Orders include
456
+ * market and event summary data from the backend.
457
+ */
458
+ declare function useOrdersMulti(params: ListOrdersMultiParams, options?: UseOrdersMultiOptions, queryOptions?: Omit<UseQueryOptions<PredictOrdersResponse, Error, PredictOrdersResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PredictOrdersResponse, Error>;
459
+
423
460
  declare function orderQueryKey(id: string, source: ProviderSource): unknown[];
424
461
  interface UseOrderParams {
425
462
  id: string;
@@ -434,7 +471,14 @@ interface CancelOrderVariables {
434
471
  id: string;
435
472
  source: ProviderSource;
436
473
  }
437
- declare function useCancelOrder(mutationOptions?: Omit<UseMutationOptions<CancelOrderResult, Error, CancelOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<CancelOrderResult, Error, CancelOrderVariables, unknown>;
474
+ interface UseCancelOrderOptions {
475
+ /**
476
+ * Async callback invoked before the cancel request to obtain extra headers.
477
+ * Required for Polymarket orders (POLY_* HMAC authentication headers).
478
+ */
479
+ getHeaders?: (vars: CancelOrderVariables) => Record<string, string> | Promise<Record<string, string>>;
480
+ }
481
+ declare function useCancelOrder(options?: UseCancelOrderOptions, mutationOptions?: Omit<UseMutationOptions<CancelOrderResult, Error, CancelOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<CancelOrderResult, Error, CancelOrderVariables, unknown>;
438
482
 
439
483
  type UseInfiniteMatchesParams = Omit<MatchesParams, "cursor">;
440
484
  type InfiniteQueryOptions$1 = Omit<UseInfiniteQueryOptions<MatchGroupPage, Error, InfiniteData<MatchGroupPage>, unknown[], string | undefined>, "queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam">;
@@ -808,4 +852,4 @@ interface CreatePolymarketOrderVariables {
808
852
  */
809
853
  declare function useCreatePolymarketOrder(mutationOptions?: Omit<UseMutationOptions<PredictOrder, Error, CreatePolymarketOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<PredictOrder, Error, CreatePolymarketOrderVariables, unknown>;
810
854
 
811
- export { BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketProvider, type PolymarketProviderProps, type PolymarketSigner, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionsResponse, PredictClient, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, SimilarEventsParams, TickSizeResponse, type UseBalanceParams, type UseCandlesticksParams, type UseEventParams, type UseInfiniteMatchMarketsParams, type UseInfiniteMatchesParams, type UseInfiniteOrdersOptions, type UseInfiniteOrdersParams, type UseInfiniteTradesParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UseOrdersOptions, 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 UseTradesSubscriptionParams, type UseTradesSubscriptionResult, type UseWithdrawStatusQueryParams, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, balanceQueryKey, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, 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 };
855
+ export { AvailableSharesResponse, BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersMultiParams, ListOrdersParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketProvider, type PolymarketProviderProps, type PolymarketSigner, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionsResponse, PredictClient, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictOrdersResponse, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, SimilarEventsParams, TickSizeResponse, type UseAvailableSharesOptions, type UseAvailableSharesParams, type UseBalanceParams, type UseCancelOrderOptions, type UseCandlesticksParams, type UseEventParams, type UseInfiniteMatchMarketsParams, type UseInfiniteMatchesParams, type UseInfiniteOrdersOptions, type UseInfiniteOrdersParams, type UseInfiniteTradesParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UseOrdersMultiOptions, type UseOrdersOptions, 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 UseTradesSubscriptionParams, type UseTradesSubscriptionResult, type UseWithdrawStatusQueryParams, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, availableSharesQueryKey, balanceQueryKey, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersMultiQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, 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 };
package/dist/index.js CHANGED
@@ -134,6 +134,28 @@ var PredictClient = class {
134
134
  return await utils.httpGet(url);
135
135
  }
136
136
  // -------------------------------------------------------------------------
137
+ // Available shares (for sell flow)
138
+ // -------------------------------------------------------------------------
139
+ /**
140
+ * Get the number of shares available for selling, accounting for active orders.
141
+ *
142
+ * Maps to `GET /api/v1/available-shares?source=...&user=...&market=...&side=...`.
143
+ *
144
+ * @param source - Provider source.
145
+ * @param user - Wallet address.
146
+ * @param market - Market slug.
147
+ * @param side - Position side ("yes" or "no").
148
+ * @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
149
+ */
150
+ async getAvailableShares(source, user, market, side, headers) {
151
+ const query = buildQuery({ source, user, market, side });
152
+ const url = `${this.endpoint}/api/v1/available-shares${query}`;
153
+ return await utils.httpGet(
154
+ url,
155
+ headers ? { headers } : void 0
156
+ );
157
+ }
158
+ // -------------------------------------------------------------------------
137
159
  // Balance
138
160
  // -------------------------------------------------------------------------
139
161
  /**
@@ -166,6 +188,22 @@ var PredictClient = class {
166
188
  headers ? { headers } : void 0
167
189
  );
168
190
  }
191
+ /**
192
+ * Multi-wallet order listing with enriched market/event context.
193
+ *
194
+ * Maps to `GET /api/v1/orders?kalshi_user=...&polymarket_user=...`.
195
+ *
196
+ * @param params - Per-provider wallet addresses.
197
+ * @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
198
+ */
199
+ async listOrdersMulti(params, headers) {
200
+ const query = buildQuery(params);
201
+ const url = `${this.endpoint}/api/v1/orders${query}`;
202
+ return await utils.httpGet(
203
+ url,
204
+ headers ? { headers } : void 0
205
+ );
206
+ }
169
207
  /**
170
208
  * Maps to `GET /api/v1/orders/:id?source=...`.
171
209
  *
@@ -1225,6 +1263,7 @@ function usePositions(params, queryOptions = {}) {
1225
1263
  queryFn: () => client.getPositions(params.user, params.source),
1226
1264
  enabled: Boolean(params.user),
1227
1265
  staleTime: 1e4,
1266
+ refetchInterval: 3e4,
1228
1267
  ...queryOptions
1229
1268
  });
1230
1269
  }
@@ -1236,6 +1275,37 @@ function usePositionsMulti(params, queryOptions = {}) {
1236
1275
  queryFn: () => client.getPositions(params),
1237
1276
  enabled: hasAnyWallet,
1238
1277
  staleTime: 1e4,
1278
+ refetchInterval: 3e4,
1279
+ ...queryOptions
1280
+ });
1281
+ }
1282
+ function availableSharesQueryKey(params) {
1283
+ return [
1284
+ "predict",
1285
+ "available-shares",
1286
+ params.source,
1287
+ params.user,
1288
+ params.market,
1289
+ params.side
1290
+ ];
1291
+ }
1292
+ function useAvailableShares(params, options, queryOptions = {}) {
1293
+ const client = usePredictClient();
1294
+ return reactQuery.useQuery({
1295
+ queryKey: availableSharesQueryKey(params),
1296
+ queryFn: async () => {
1297
+ const headers = await options?.getHeaders?.();
1298
+ return client.getAvailableShares(
1299
+ params.source,
1300
+ params.user,
1301
+ params.market,
1302
+ params.side,
1303
+ headers
1304
+ );
1305
+ },
1306
+ enabled: Boolean(params.user && params.market && params.side),
1307
+ staleTime: 5e3,
1308
+ refetchInterval: 1e4,
1239
1309
  ...queryOptions
1240
1310
  });
1241
1311
  }
@@ -1283,6 +1353,30 @@ function useInfiniteOrders(params, options) {
1283
1353
  enabled: Boolean(params.wallet_address)
1284
1354
  });
1285
1355
  }
1356
+ function ordersMultiQueryKey(params) {
1357
+ return [
1358
+ "predict",
1359
+ "orders",
1360
+ "multi",
1361
+ params.kalshi_user ?? "",
1362
+ params.polymarket_user ?? ""
1363
+ ];
1364
+ }
1365
+ function useOrdersMulti(params, options, queryOptions = {}) {
1366
+ const client = usePredictClient();
1367
+ const hasAnyWallet = Boolean(params.kalshi_user || params.polymarket_user);
1368
+ return reactQuery.useQuery({
1369
+ queryKey: [...ordersMultiQueryKey(params), ...options?.keyExtra ?? []],
1370
+ queryFn: async () => {
1371
+ const headers = await options?.getHeaders?.();
1372
+ return client.listOrdersMulti(params, headers);
1373
+ },
1374
+ enabled: hasAnyWallet,
1375
+ staleTime: 1e4,
1376
+ refetchInterval: 3e4,
1377
+ ...queryOptions
1378
+ });
1379
+ }
1286
1380
  function orderQueryKey(id, source) {
1287
1381
  return ["predict", "order", id, source];
1288
1382
  }
@@ -1296,15 +1390,23 @@ function useOrder(params, queryOptions = {}) {
1296
1390
  ...queryOptions
1297
1391
  });
1298
1392
  }
1299
- function useCancelOrder(mutationOptions = {}) {
1393
+ function useCancelOrder(options, mutationOptions = {}) {
1300
1394
  const client = usePredictClient();
1301
1395
  const queryClient = reactQuery.useQueryClient();
1396
+ const { onSuccess, onError, ...restMutationOptions } = mutationOptions;
1302
1397
  return reactQuery.useMutation({
1303
- mutationFn: (vars) => client.cancelOrder(vars.id, vars.source),
1304
- onSuccess: () => {
1398
+ mutationFn: async (vars) => {
1399
+ const headers = await options?.getHeaders?.(vars);
1400
+ return client.cancelOrder(vars.id, vars.source, headers);
1401
+ },
1402
+ onSuccess: (...args) => {
1305
1403
  queryClient.invalidateQueries({ queryKey: ["predict", "orders"] });
1404
+ onSuccess?.(...args);
1306
1405
  },
1307
- ...mutationOptions
1406
+ onError: (...args) => {
1407
+ onError?.(...args);
1408
+ },
1409
+ ...restMutationOptions
1308
1410
  });
1309
1411
  }
1310
1412
 
@@ -1883,17 +1985,13 @@ var DEFAULT_ROUNDING = { size: 2, price: 2, amount: 4 };
1883
1985
  function decimalPlaces(n, d) {
1884
1986
  return parseFloat(n.toFixed(d));
1885
1987
  }
1988
+ function floorDecimalPlaces(n, d) {
1989
+ const factor = 10 ** d;
1990
+ return Math.floor(n * factor) / factor;
1991
+ }
1886
1992
  function toMicroUsdc(amount) {
1887
1993
  return BigInt(Math.round(amount * 1e6));
1888
1994
  }
1889
- function ceilMicro(raw, maxDecimals) {
1890
- const factor = BigInt(10 ** (6 - maxDecimals));
1891
- return (raw + factor - 1n) / factor * factor;
1892
- }
1893
- function floorMicro(raw, maxDecimals) {
1894
- const factor = BigInt(10 ** (6 - maxDecimals));
1895
- return raw / factor * factor;
1896
- }
1897
1995
  function normalizeTokenId(tokenId) {
1898
1996
  if (tokenId.startsWith("0x") || tokenId.startsWith("0X")) {
1899
1997
  return BigInt(tokenId).toString(10);
@@ -1904,14 +2002,12 @@ function buildOrderMessage(input) {
1904
2002
  const side = input.side === "BUY" ? SIDE.BUY : SIDE.SELL;
1905
2003
  const rc = ROUNDING_CONFIG[input.tickSize] ?? DEFAULT_ROUNDING;
1906
2004
  const rawPrice = decimalPlaces(input.price, rc.price);
1907
- const rawSize = decimalPlaces(input.size, rc.size);
1908
- const rawAmount = decimalPlaces(rawSize * rawPrice, rc.amount);
2005
+ const rawSize = side === SIDE.SELL ? floorDecimalPlaces(input.size, rc.size) : decimalPlaces(input.size, rc.size);
1909
2006
  const sizeInMicro = toMicroUsdc(rawSize);
2007
+ const rawAmount = decimalPlaces(rawSize * rawPrice, rc.amount);
1910
2008
  const amountInMicro = toMicroUsdc(rawAmount);
1911
- const usdcMicro = side === SIDE.BUY ? ceilMicro(amountInMicro, 2) : floorMicro(amountInMicro, 2);
1912
- const sharesMicro = floorMicro(sizeInMicro, 4);
1913
- const makerAmount = side === SIDE.BUY ? usdcMicro.toString() : sharesMicro.toString();
1914
- const takerAmount = side === SIDE.BUY ? sharesMicro.toString() : usdcMicro.toString();
2009
+ const makerAmount = side === SIDE.BUY ? amountInMicro.toString() : sizeInMicro.toString();
2010
+ const takerAmount = side === SIDE.BUY ? sizeInMicro.toString() : amountInMicro.toString();
1915
2011
  const maker = input.funderAddress ?? input.signerAddress;
1916
2012
  return {
1917
2013
  salt: Math.floor(Math.random() * 1e15).toString(),
@@ -2058,6 +2154,7 @@ exports.PredictProvider = PredictProvider;
2058
2154
  exports.PredictWsClient = PredictWsClient;
2059
2155
  exports.SIDE = SIDE;
2060
2156
  exports.USDC_ADDRESS = USDC_ADDRESS;
2157
+ exports.availableSharesQueryKey = availableSharesQueryKey;
2061
2158
  exports.balanceQueryKey = balanceQueryKey;
2062
2159
  exports.buildClobAuthMessage = buildClobAuthMessage;
2063
2160
  exports.buildClobPayload = buildClobPayload;
@@ -2091,6 +2188,7 @@ exports.matchQueryKey = matchQueryKey;
2091
2188
  exports.matchesQueryKey = matchesQueryKey;
2092
2189
  exports.orderQueryKey = orderQueryKey;
2093
2190
  exports.orderbookQueryKey = orderbookQueryKey;
2191
+ exports.ordersMultiQueryKey = ordersMultiQueryKey;
2094
2192
  exports.ordersQueryKey = ordersQueryKey;
2095
2193
  exports.polymarketDepositAddressesQueryKey = polymarketDepositAddressesQueryKey;
2096
2194
  exports.polymarketSetupQueryKey = polymarketSetupQueryKey;
@@ -2102,6 +2200,7 @@ exports.resolveTagSlug = resolveTagSlug;
2102
2200
  exports.similarEventsQueryKey = similarEventsQueryKey;
2103
2201
  exports.tickSizeQueryKey = tickSizeQueryKey;
2104
2202
  exports.tradesQueryKey = tradesQueryKey;
2203
+ exports.useAvailableShares = useAvailableShares;
2105
2204
  exports.useBalance = useBalance;
2106
2205
  exports.useCancelOrder = useCancelOrder;
2107
2206
  exports.useCandlesticks = useCandlesticks;
@@ -2125,6 +2224,7 @@ exports.useOrder = useOrder;
2125
2224
  exports.useOrderbook = useOrderbook;
2126
2225
  exports.useOrderbookSubscription = useOrderbookSubscription;
2127
2226
  exports.useOrders = useOrders;
2227
+ exports.useOrdersMulti = useOrdersMulti;
2128
2228
  exports.usePolymarket = usePolymarket;
2129
2229
  exports.usePolymarketDeposit = usePolymarketDeposit;
2130
2230
  exports.usePolymarketDepositAddresses = usePolymarketDepositAddresses;