@liberfi.io/react-predict 0.1.48 → 0.1.50

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-Curi-jN1.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-Curi-jN1.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 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, F as WithdrawBuildRequest, G as WithdrawSubmitResponse, H as WithdrawSubmitRequest, I as WithdrawStatusResponse, J as PolymarketDepositAddresses, K as PolymarketWithdrawResponse, N as PolymarketWithdrawRequest, T as TickSizeResponse, Q as WsConnectionStatus, R as WsDataMessage, U as WsPriceEvent, V as WsOrderbookEvent, X as WsTradeEvent, Y as CreateOrderInput } from './server-CaB0XJAa.mjs';
2
+ export { a$ as BuildClobAuthMessageInput, bc as BuildOrderMessageInput, aS as CLOB_AUTH_DOMAIN, aT as CLOB_AUTH_TYPES, b0 as CTF_EXCHANGE_ADDRESS, b5 as CTF_ORDER_TYPES, bb as ClobOrderPayload, ae as DFlowOrderContext, ag as DepositBuildRequest, ah as DepositBuildResponse, ak as DepositStatusResponse, ai as DepositSubmitRequest, aj as DepositSubmitResponse, a8 as EventSummary, aY as HttpMethod, a5 as MarketOutcome, a4 as MarketResult, a3 as MarketStatus, a9 as MarketSummary, ar as MatchConfidenceTier, an as MatchGroupEntry, ao as MatchGroupMarket, as as MatchMarketFlat, ap as MatchSortField, am as MatchStatus, aq as MatchesStats, b1 as NEG_RISK_CTF_EXCHANGE_ADDRESS, b6 as ORDER_TYPE, bd as OrderMessage, ad as OrderSide, ac as OrderStatus, a6 as OrderbookLevel, b3 as POLYGON_CHAIN_ID, a_ as PolymarketL2Headers, aZ as PolymarketL2HeadersInput, af as PolymarketOrderType, ab as PredictPosition, a1 as PredictTag, $ as PredictWsClientConfig, aa as PricePoint, a0 as ProviderMeta, aJ as ResolveEventsParamsInput, b7 as SIDE, a2 as SettlementSource, be as SignedOrder, aK as TagSlugSelection, a7 as TradeType, b2 as USDC_ADDRESS, al as UnsignedTx, at as WsChannel, au as WsChannelEvent, av as WsClientMessage, aB as WsErrorCode, aC as WsErrorMessage, ax as WsPingMessage, az as WsPongMessage, ay as WsServerMessage, aw as WsSubscribeMessage, aA as WsSubscribedMessage, aU as buildClobAuthMessage, ba as buildClobPayload, b4 as buildCtfExchangeDomain, b8 as buildOrderMessage, aW as buildPolymarketL2Headers, b9 as buildSignedOrder, Z as createPredictClient, _ as createPredictWsClient, aX as derivePolymarketApiKey, aD as eventQueryKey, aE as fetchEvent, aI as fetchEventsPage, aM as fetchMarket, aR as fetchMatchMarketsPage, aP as fetchMatchesPage, aV as hmacSha256Base64, aH as infiniteEventsQueryKey, aL as marketQueryKey, aQ as matchMarketsQueryKey, aO as matchQueryKey, aN as matchesQueryKey, aG as resolveEventsParams, aF as resolveTagSlug } from './server-CaB0XJAa.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;
@@ -808,4 +824,4 @@ interface CreatePolymarketOrderVariables {
808
824
  */
809
825
  declare function useCreatePolymarketOrder(mutationOptions?: Omit<UseMutationOptions<PredictOrder, Error, CreatePolymarketOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<PredictOrder, Error, CreatePolymarketOrderVariables, unknown>;
810
826
 
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 };
827
+ export { AvailableSharesResponse, 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 UseAvailableSharesOptions, type UseAvailableSharesParams, 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, availableSharesQueryKey, balanceQueryKey, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, 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, 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-Curi-jN1.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-Curi-jN1.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 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, F as WithdrawBuildRequest, G as WithdrawSubmitResponse, H as WithdrawSubmitRequest, I as WithdrawStatusResponse, J as PolymarketDepositAddresses, K as PolymarketWithdrawResponse, N as PolymarketWithdrawRequest, T as TickSizeResponse, Q as WsConnectionStatus, R as WsDataMessage, U as WsPriceEvent, V as WsOrderbookEvent, X as WsTradeEvent, Y as CreateOrderInput } from './server-CaB0XJAa.js';
2
+ export { a$ as BuildClobAuthMessageInput, bc as BuildOrderMessageInput, aS as CLOB_AUTH_DOMAIN, aT as CLOB_AUTH_TYPES, b0 as CTF_EXCHANGE_ADDRESS, b5 as CTF_ORDER_TYPES, bb as ClobOrderPayload, ae as DFlowOrderContext, ag as DepositBuildRequest, ah as DepositBuildResponse, ak as DepositStatusResponse, ai as DepositSubmitRequest, aj as DepositSubmitResponse, a8 as EventSummary, aY as HttpMethod, a5 as MarketOutcome, a4 as MarketResult, a3 as MarketStatus, a9 as MarketSummary, ar as MatchConfidenceTier, an as MatchGroupEntry, ao as MatchGroupMarket, as as MatchMarketFlat, ap as MatchSortField, am as MatchStatus, aq as MatchesStats, b1 as NEG_RISK_CTF_EXCHANGE_ADDRESS, b6 as ORDER_TYPE, bd as OrderMessage, ad as OrderSide, ac as OrderStatus, a6 as OrderbookLevel, b3 as POLYGON_CHAIN_ID, a_ as PolymarketL2Headers, aZ as PolymarketL2HeadersInput, af as PolymarketOrderType, ab as PredictPosition, a1 as PredictTag, $ as PredictWsClientConfig, aa as PricePoint, a0 as ProviderMeta, aJ as ResolveEventsParamsInput, b7 as SIDE, a2 as SettlementSource, be as SignedOrder, aK as TagSlugSelection, a7 as TradeType, b2 as USDC_ADDRESS, al as UnsignedTx, at as WsChannel, au as WsChannelEvent, av as WsClientMessage, aB as WsErrorCode, aC as WsErrorMessage, ax as WsPingMessage, az as WsPongMessage, ay as WsServerMessage, aw as WsSubscribeMessage, aA as WsSubscribedMessage, aU as buildClobAuthMessage, ba as buildClobPayload, b4 as buildCtfExchangeDomain, b8 as buildOrderMessage, aW as buildPolymarketL2Headers, b9 as buildSignedOrder, Z as createPredictClient, _ as createPredictWsClient, aX as derivePolymarketApiKey, aD as eventQueryKey, aE as fetchEvent, aI as fetchEventsPage, aM as fetchMarket, aR as fetchMatchMarketsPage, aP as fetchMatchesPage, aV as hmacSha256Base64, aH as infiniteEventsQueryKey, aL as marketQueryKey, aQ as matchMarketsQueryKey, aO as matchQueryKey, aN as matchesQueryKey, aG as resolveEventsParams, aF as resolveTagSlug } from './server-CaB0XJAa.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;
@@ -808,4 +824,4 @@ interface CreatePolymarketOrderVariables {
808
824
  */
809
825
  declare function useCreatePolymarketOrder(mutationOptions?: Omit<UseMutationOptions<PredictOrder, Error, CreatePolymarketOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<PredictOrder, Error, CreatePolymarketOrderVariables, unknown>;
810
826
 
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 };
827
+ export { AvailableSharesResponse, 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 UseAvailableSharesOptions, type UseAvailableSharesParams, 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, availableSharesQueryKey, balanceQueryKey, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, 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, 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
  /**
@@ -948,7 +970,8 @@ function resolveEventsParams(input = {}) {
948
970
  sort_asc,
949
971
  minVolume,
950
972
  minLiquidity,
951
- timeRemaining
973
+ timeRemaining,
974
+ markets_limit = 3
952
975
  } = input;
953
976
  const tag_slug = resolveTagSlug(tagSlugSelection);
954
977
  const min_volume = minVolume !== void 0 && minVolume !== "" ? Number(minVolume) : void 0;
@@ -964,7 +987,8 @@ function resolveEventsParams(input = {}) {
964
987
  ...sort_asc !== void 0 ? { sort_asc } : {},
965
988
  ...min_volume !== void 0 && !isNaN(min_volume) ? { min_volume } : {},
966
989
  ...min_liquidity !== void 0 && !isNaN(min_liquidity) ? { min_liquidity } : {},
967
- ...end_before ? { end_before } : {}
990
+ ...end_before ? { end_before } : {},
991
+ ...markets_limit ? { markets_limit } : {}
968
992
  };
969
993
  }
970
994
  function infiniteEventsQueryKey(params) {
@@ -1223,6 +1247,7 @@ function usePositions(params, queryOptions = {}) {
1223
1247
  queryFn: () => client.getPositions(params.user, params.source),
1224
1248
  enabled: Boolean(params.user),
1225
1249
  staleTime: 1e4,
1250
+ refetchInterval: 3e4,
1226
1251
  ...queryOptions
1227
1252
  });
1228
1253
  }
@@ -1234,6 +1259,37 @@ function usePositionsMulti(params, queryOptions = {}) {
1234
1259
  queryFn: () => client.getPositions(params),
1235
1260
  enabled: hasAnyWallet,
1236
1261
  staleTime: 1e4,
1262
+ refetchInterval: 3e4,
1263
+ ...queryOptions
1264
+ });
1265
+ }
1266
+ function availableSharesQueryKey(params) {
1267
+ return [
1268
+ "predict",
1269
+ "available-shares",
1270
+ params.source,
1271
+ params.user,
1272
+ params.market,
1273
+ params.side
1274
+ ];
1275
+ }
1276
+ function useAvailableShares(params, options, queryOptions = {}) {
1277
+ const client = usePredictClient();
1278
+ return reactQuery.useQuery({
1279
+ queryKey: availableSharesQueryKey(params),
1280
+ queryFn: async () => {
1281
+ const headers = await options?.getHeaders?.();
1282
+ return client.getAvailableShares(
1283
+ params.source,
1284
+ params.user,
1285
+ params.market,
1286
+ params.side,
1287
+ headers
1288
+ );
1289
+ },
1290
+ enabled: Boolean(params.user && params.market && params.side),
1291
+ staleTime: 5e3,
1292
+ refetchInterval: 1e4,
1237
1293
  ...queryOptions
1238
1294
  });
1239
1295
  }
@@ -1881,17 +1937,13 @@ var DEFAULT_ROUNDING = { size: 2, price: 2, amount: 4 };
1881
1937
  function decimalPlaces(n, d) {
1882
1938
  return parseFloat(n.toFixed(d));
1883
1939
  }
1940
+ function floorDecimalPlaces(n, d) {
1941
+ const factor = 10 ** d;
1942
+ return Math.floor(n * factor) / factor;
1943
+ }
1884
1944
  function toMicroUsdc(amount) {
1885
1945
  return BigInt(Math.round(amount * 1e6));
1886
1946
  }
1887
- function ceilMicro(raw, maxDecimals) {
1888
- const factor = BigInt(10 ** (6 - maxDecimals));
1889
- return (raw + factor - 1n) / factor * factor;
1890
- }
1891
- function floorMicro(raw, maxDecimals) {
1892
- const factor = BigInt(10 ** (6 - maxDecimals));
1893
- return raw / factor * factor;
1894
- }
1895
1947
  function normalizeTokenId(tokenId) {
1896
1948
  if (tokenId.startsWith("0x") || tokenId.startsWith("0X")) {
1897
1949
  return BigInt(tokenId).toString(10);
@@ -1902,14 +1954,12 @@ function buildOrderMessage(input) {
1902
1954
  const side = input.side === "BUY" ? SIDE.BUY : SIDE.SELL;
1903
1955
  const rc = ROUNDING_CONFIG[input.tickSize] ?? DEFAULT_ROUNDING;
1904
1956
  const rawPrice = decimalPlaces(input.price, rc.price);
1905
- const rawSize = decimalPlaces(input.size, rc.size);
1906
- const rawAmount = decimalPlaces(rawSize * rawPrice, rc.amount);
1957
+ const rawSize = side === SIDE.SELL ? floorDecimalPlaces(input.size, rc.size) : decimalPlaces(input.size, rc.size);
1907
1958
  const sizeInMicro = toMicroUsdc(rawSize);
1959
+ const rawAmount = decimalPlaces(rawSize * rawPrice, rc.amount);
1908
1960
  const amountInMicro = toMicroUsdc(rawAmount);
1909
- const usdcMicro = side === SIDE.BUY ? ceilMicro(amountInMicro, 2) : floorMicro(amountInMicro, 2);
1910
- const sharesMicro = floorMicro(sizeInMicro, 4);
1911
- const makerAmount = side === SIDE.BUY ? usdcMicro.toString() : sharesMicro.toString();
1912
- const takerAmount = side === SIDE.BUY ? sharesMicro.toString() : usdcMicro.toString();
1961
+ const makerAmount = side === SIDE.BUY ? amountInMicro.toString() : sizeInMicro.toString();
1962
+ const takerAmount = side === SIDE.BUY ? sizeInMicro.toString() : amountInMicro.toString();
1913
1963
  const maker = input.funderAddress ?? input.signerAddress;
1914
1964
  return {
1915
1965
  salt: Math.floor(Math.random() * 1e15).toString(),
@@ -2056,6 +2106,7 @@ exports.PredictProvider = PredictProvider;
2056
2106
  exports.PredictWsClient = PredictWsClient;
2057
2107
  exports.SIDE = SIDE;
2058
2108
  exports.USDC_ADDRESS = USDC_ADDRESS;
2109
+ exports.availableSharesQueryKey = availableSharesQueryKey;
2059
2110
  exports.balanceQueryKey = balanceQueryKey;
2060
2111
  exports.buildClobAuthMessage = buildClobAuthMessage;
2061
2112
  exports.buildClobPayload = buildClobPayload;
@@ -2100,6 +2151,7 @@ exports.resolveTagSlug = resolveTagSlug;
2100
2151
  exports.similarEventsQueryKey = similarEventsQueryKey;
2101
2152
  exports.tickSizeQueryKey = tickSizeQueryKey;
2102
2153
  exports.tradesQueryKey = tradesQueryKey;
2154
+ exports.useAvailableShares = useAvailableShares;
2103
2155
  exports.useBalance = useBalance;
2104
2156
  exports.useCancelOrder = useCancelOrder;
2105
2157
  exports.useCandlesticks = useCandlesticks;