@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.
@@ -142,6 +142,11 @@ interface ListEventsParams {
142
142
  * (i.e. the event closes within the specified window).
143
143
  */
144
144
  end_before?: string;
145
+ /**
146
+ * Max number of markets per event (sorted by volume DESC).
147
+ * `0` means no limit. Defaults to `3` when set via `resolveEventsParams`.
148
+ */
149
+ markets_limit?: number;
145
150
  }
146
151
  /** Single price level in an order book. */
147
152
  interface OrderbookLevel {
@@ -685,6 +690,16 @@ interface EventStats {
685
690
  avg_liquidity: number;
686
691
  active_sources: number;
687
692
  }
693
+ /** Response from the available-shares endpoint. */
694
+ interface AvailableSharesResponse {
695
+ source: ProviderSource;
696
+ market: string;
697
+ side: string;
698
+ total_shares: number;
699
+ active_order_shares: number;
700
+ available_shares: number;
701
+ precision: number;
702
+ }
688
703
 
689
704
  /**
690
705
  * HTTP client for the prediction-server REST API.
@@ -765,6 +780,18 @@ declare class PredictClient {
765
780
  kalshi_user?: string;
766
781
  polymarket_user?: string;
767
782
  }, source?: ProviderSource): Promise<PositionsResponse>;
783
+ /**
784
+ * Get the number of shares available for selling, accounting for active orders.
785
+ *
786
+ * Maps to `GET /api/v1/available-shares?source=...&user=...&market=...&side=...`.
787
+ *
788
+ * @param source - Provider source.
789
+ * @param user - Wallet address.
790
+ * @param market - Market slug.
791
+ * @param side - Position side ("yes" or "no").
792
+ * @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
793
+ */
794
+ getAvailableShares(source: ProviderSource, user: string, market: string, side: string, headers?: Record<string, string>): Promise<AvailableSharesResponse>;
768
795
  /**
769
796
  * Get the on-chain USDC balance for a wallet.
770
797
  *
@@ -1082,6 +1109,11 @@ interface ResolveEventsParamsInput {
1082
1109
  * "1d" = events closing within 24 h, "7d" = 7 days, "30d" = 30 days.
1083
1110
  */
1084
1111
  timeRemaining?: string;
1112
+ /**
1113
+ * Max number of markets per event (sorted by volume DESC).
1114
+ * Defaults to `3` in `resolveEventsParams`.
1115
+ */
1116
+ markets_limit?: number;
1085
1117
  }
1086
1118
  /**
1087
1119
  * Build a clean `ListEventsParams` from loose user inputs.
@@ -1423,4 +1455,4 @@ interface ClobOrderPayload {
1423
1455
  */
1424
1456
  declare function buildClobPayload(signedOrder: SignedOrder, owner: string): ClobOrderPayload;
1425
1457
 
1426
- export { type ProviderMeta as $, type WithdrawBuildRequest as A, type BalanceResponse as B, type Candlestick as C, type DFlowQuoteRequest as D, type EventStats as E, type WithdrawSubmitResponse as F, type WithdrawSubmitRequest as G, type WithdrawStatusResponse as H, type PolymarketDepositAddresses as I, type PolymarketWithdrawResponse as J, type PolymarketWithdrawRequest as K, type ListEventsParams as L, type MatchesParams as M, type WsConnectionStatus as N, type Orderbook as O, PredictClient as P, type WsDataMessage as Q, type WsPriceEvent as R, type SimilarEventsParams as S, type TickSizeResponse as T, type WsOrderbookEvent as U, type WsTradeEvent as V, type WithdrawBuildResponse as W, type CreateOrderInput as X, createPredictClient as Y, createPredictWsClient as Z, type PredictWsClientConfig as _, PredictWsClient as a, CTF_EXCHANGE_ADDRESS as a$, type PredictTag as a0, type SettlementSource as a1, type MarketStatus as a2, type MarketResult as a3, type MarketOutcome as a4, type OrderbookLevel as a5, type TradeType as a6, type EventSummary as a7, type MarketSummary as a8, type PricePoint as a9, type WsErrorCode as aA, type WsErrorMessage as aB, eventQueryKey as aC, fetchEvent as aD, resolveTagSlug as aE, resolveEventsParams as aF, infiniteEventsQueryKey as aG, fetchEventsPage as aH, type ResolveEventsParamsInput as aI, type TagSlugSelection as aJ, marketQueryKey as aK, fetchMarket as aL, matchesQueryKey as aM, matchQueryKey as aN, fetchMatchesPage as aO, matchMarketsQueryKey as aP, fetchMatchMarketsPage as aQ, CLOB_AUTH_DOMAIN as aR, CLOB_AUTH_TYPES as aS, buildClobAuthMessage as aT, hmacSha256Base64 as aU, buildPolymarketL2Headers as aV, derivePolymarketApiKey as aW, type HttpMethod as aX, type PolymarketL2HeadersInput as aY, type PolymarketL2Headers as aZ, type BuildClobAuthMessageInput as a_, type PredictPosition as aa, type OrderStatus as ab, type OrderSide as ac, type DFlowOrderContext as ad, type PolymarketOrderType as ae, type DepositBuildRequest as af, type DepositBuildResponse as ag, type DepositSubmitRequest as ah, type DepositSubmitResponse as ai, type DepositStatusResponse as aj, type UnsignedTx as ak, type MatchStatus as al, type MatchGroupEntry as am, type MatchGroupMarket as an, type MatchSortField as ao, type MatchesStats as ap, type MatchConfidenceTier as aq, type MatchMarketFlat as ar, type WsChannel as as, type WsChannelEvent as at, type WsClientMessage as au, type WsSubscribeMessage as av, type WsPingMessage as aw, type WsServerMessage as ax, type WsPongMessage as ay, type WsSubscribedMessage as az, type PredictPage as b, NEG_RISK_CTF_EXCHANGE_ADDRESS as b0, USDC_ADDRESS as b1, POLYGON_CHAIN_ID as b2, buildCtfExchangeDomain as b3, CTF_ORDER_TYPES as b4, ORDER_TYPE as b5, SIDE as b6, buildOrderMessage as b7, buildSignedOrder as b8, buildClobPayload as b9, type ClobOrderPayload as ba, type BuildOrderMessageInput as bb, type OrderMessage as bc, type SignedOrder as bd, DEFAULT_PAGE_SIZE as be, type PredictEvent as c, type ProviderSource as d, type EventStatus as e, type EventSortField as f, type PredictMarket as g, type ListMarketTradesParams as h, type PredictTrade as i, type PriceHistoryRange as j, type PriceHistoryResponse as k, type ListCandlesticksParams as l, type PositionsResponse as m, type ListOrdersParams as n, type PredictOrder as o, type CancelOrderResult as p, type MatchGroupPage as q, type MatchGroup as r, type MatchMarketParams as s, type MatchMarketPage as t, type ListTradesParams as u, type DFlowQuoteResponse as v, type DFlowSubmitResponse as w, type DFlowSubmitRequest as x, type DFlowKYCStatus as y, type PolymarketSetupStatus as z };
1458
+ export { type PredictWsClientConfig as $, type AvailableSharesResponse as A, type BalanceResponse as B, type Candlestick as C, type DFlowQuoteRequest as D, type EventStats as E, type WithdrawBuildRequest as F, type WithdrawSubmitResponse as G, type WithdrawSubmitRequest as H, type WithdrawStatusResponse as I, type PolymarketDepositAddresses as J, type PolymarketWithdrawResponse as K, type ListEventsParams as L, type MatchesParams as M, type PolymarketWithdrawRequest as N, type Orderbook as O, PredictClient as P, type WsConnectionStatus as Q, type WsDataMessage as R, type SimilarEventsParams as S, type TickSizeResponse as T, type WsPriceEvent as U, type WsOrderbookEvent as V, type WithdrawBuildResponse as W, type WsTradeEvent as X, type CreateOrderInput as Y, createPredictClient as Z, createPredictWsClient as _, PredictWsClient as a, type BuildClobAuthMessageInput as a$, type ProviderMeta as a0, type PredictTag as a1, type SettlementSource as a2, type MarketStatus as a3, type MarketResult as a4, type MarketOutcome as a5, type OrderbookLevel as a6, type TradeType as a7, type EventSummary as a8, type MarketSummary as a9, type WsSubscribedMessage as aA, type WsErrorCode as aB, type WsErrorMessage as aC, eventQueryKey as aD, fetchEvent as aE, resolveTagSlug as aF, resolveEventsParams as aG, infiniteEventsQueryKey as aH, fetchEventsPage as aI, type ResolveEventsParamsInput as aJ, type TagSlugSelection as aK, marketQueryKey as aL, fetchMarket as aM, matchesQueryKey as aN, matchQueryKey as aO, fetchMatchesPage as aP, matchMarketsQueryKey as aQ, fetchMatchMarketsPage as aR, CLOB_AUTH_DOMAIN as aS, CLOB_AUTH_TYPES as aT, buildClobAuthMessage as aU, hmacSha256Base64 as aV, buildPolymarketL2Headers as aW, derivePolymarketApiKey as aX, type HttpMethod as aY, type PolymarketL2HeadersInput as aZ, type PolymarketL2Headers as a_, type PricePoint as aa, type PredictPosition as ab, type OrderStatus as ac, type OrderSide as ad, type DFlowOrderContext as ae, type PolymarketOrderType as af, type DepositBuildRequest as ag, type DepositBuildResponse as ah, type DepositSubmitRequest as ai, type DepositSubmitResponse as aj, type DepositStatusResponse as ak, type UnsignedTx as al, type MatchStatus as am, type MatchGroupEntry as an, type MatchGroupMarket as ao, type MatchSortField as ap, type MatchesStats as aq, type MatchConfidenceTier as ar, type MatchMarketFlat as as, type WsChannel as at, type WsChannelEvent as au, type WsClientMessage as av, type WsSubscribeMessage as aw, type WsPingMessage as ax, type WsServerMessage as ay, type WsPongMessage as az, type PredictPage as b, CTF_EXCHANGE_ADDRESS as b0, NEG_RISK_CTF_EXCHANGE_ADDRESS as b1, USDC_ADDRESS as b2, POLYGON_CHAIN_ID as b3, buildCtfExchangeDomain as b4, CTF_ORDER_TYPES as b5, ORDER_TYPE as b6, SIDE as b7, buildOrderMessage as b8, buildSignedOrder as b9, buildClobPayload as ba, type ClobOrderPayload as bb, type BuildOrderMessageInput as bc, type OrderMessage as bd, type SignedOrder as be, DEFAULT_PAGE_SIZE as bf, type PredictEvent as c, type ProviderSource as d, type EventStatus as e, type EventSortField as f, type PredictMarket as g, type ListMarketTradesParams as h, type PredictTrade as i, type PriceHistoryRange as j, type PriceHistoryResponse as k, type ListCandlesticksParams as l, type PositionsResponse as m, type ListOrdersParams as n, type PredictOrder as o, type CancelOrderResult as p, type MatchGroupPage as q, type MatchGroup as r, type MatchMarketParams as s, type MatchMarketPage as t, type ListTradesParams as u, type DFlowQuoteResponse as v, type DFlowSubmitResponse as w, type DFlowSubmitRequest as x, type DFlowKYCStatus as y, type PolymarketSetupStatus as z };
@@ -142,6 +142,11 @@ interface ListEventsParams {
142
142
  * (i.e. the event closes within the specified window).
143
143
  */
144
144
  end_before?: string;
145
+ /**
146
+ * Max number of markets per event (sorted by volume DESC).
147
+ * `0` means no limit. Defaults to `3` when set via `resolveEventsParams`.
148
+ */
149
+ markets_limit?: number;
145
150
  }
146
151
  /** Single price level in an order book. */
147
152
  interface OrderbookLevel {
@@ -685,6 +690,16 @@ interface EventStats {
685
690
  avg_liquidity: number;
686
691
  active_sources: number;
687
692
  }
693
+ /** Response from the available-shares endpoint. */
694
+ interface AvailableSharesResponse {
695
+ source: ProviderSource;
696
+ market: string;
697
+ side: string;
698
+ total_shares: number;
699
+ active_order_shares: number;
700
+ available_shares: number;
701
+ precision: number;
702
+ }
688
703
 
689
704
  /**
690
705
  * HTTP client for the prediction-server REST API.
@@ -765,6 +780,18 @@ declare class PredictClient {
765
780
  kalshi_user?: string;
766
781
  polymarket_user?: string;
767
782
  }, source?: ProviderSource): Promise<PositionsResponse>;
783
+ /**
784
+ * Get the number of shares available for selling, accounting for active orders.
785
+ *
786
+ * Maps to `GET /api/v1/available-shares?source=...&user=...&market=...&side=...`.
787
+ *
788
+ * @param source - Provider source.
789
+ * @param user - Wallet address.
790
+ * @param market - Market slug.
791
+ * @param side - Position side ("yes" or "no").
792
+ * @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
793
+ */
794
+ getAvailableShares(source: ProviderSource, user: string, market: string, side: string, headers?: Record<string, string>): Promise<AvailableSharesResponse>;
768
795
  /**
769
796
  * Get the on-chain USDC balance for a wallet.
770
797
  *
@@ -1082,6 +1109,11 @@ interface ResolveEventsParamsInput {
1082
1109
  * "1d" = events closing within 24 h, "7d" = 7 days, "30d" = 30 days.
1083
1110
  */
1084
1111
  timeRemaining?: string;
1112
+ /**
1113
+ * Max number of markets per event (sorted by volume DESC).
1114
+ * Defaults to `3` in `resolveEventsParams`.
1115
+ */
1116
+ markets_limit?: number;
1085
1117
  }
1086
1118
  /**
1087
1119
  * Build a clean `ListEventsParams` from loose user inputs.
@@ -1423,4 +1455,4 @@ interface ClobOrderPayload {
1423
1455
  */
1424
1456
  declare function buildClobPayload(signedOrder: SignedOrder, owner: string): ClobOrderPayload;
1425
1457
 
1426
- export { type ProviderMeta as $, type WithdrawBuildRequest as A, type BalanceResponse as B, type Candlestick as C, type DFlowQuoteRequest as D, type EventStats as E, type WithdrawSubmitResponse as F, type WithdrawSubmitRequest as G, type WithdrawStatusResponse as H, type PolymarketDepositAddresses as I, type PolymarketWithdrawResponse as J, type PolymarketWithdrawRequest as K, type ListEventsParams as L, type MatchesParams as M, type WsConnectionStatus as N, type Orderbook as O, PredictClient as P, type WsDataMessage as Q, type WsPriceEvent as R, type SimilarEventsParams as S, type TickSizeResponse as T, type WsOrderbookEvent as U, type WsTradeEvent as V, type WithdrawBuildResponse as W, type CreateOrderInput as X, createPredictClient as Y, createPredictWsClient as Z, type PredictWsClientConfig as _, PredictWsClient as a, CTF_EXCHANGE_ADDRESS as a$, type PredictTag as a0, type SettlementSource as a1, type MarketStatus as a2, type MarketResult as a3, type MarketOutcome as a4, type OrderbookLevel as a5, type TradeType as a6, type EventSummary as a7, type MarketSummary as a8, type PricePoint as a9, type WsErrorCode as aA, type WsErrorMessage as aB, eventQueryKey as aC, fetchEvent as aD, resolveTagSlug as aE, resolveEventsParams as aF, infiniteEventsQueryKey as aG, fetchEventsPage as aH, type ResolveEventsParamsInput as aI, type TagSlugSelection as aJ, marketQueryKey as aK, fetchMarket as aL, matchesQueryKey as aM, matchQueryKey as aN, fetchMatchesPage as aO, matchMarketsQueryKey as aP, fetchMatchMarketsPage as aQ, CLOB_AUTH_DOMAIN as aR, CLOB_AUTH_TYPES as aS, buildClobAuthMessage as aT, hmacSha256Base64 as aU, buildPolymarketL2Headers as aV, derivePolymarketApiKey as aW, type HttpMethod as aX, type PolymarketL2HeadersInput as aY, type PolymarketL2Headers as aZ, type BuildClobAuthMessageInput as a_, type PredictPosition as aa, type OrderStatus as ab, type OrderSide as ac, type DFlowOrderContext as ad, type PolymarketOrderType as ae, type DepositBuildRequest as af, type DepositBuildResponse as ag, type DepositSubmitRequest as ah, type DepositSubmitResponse as ai, type DepositStatusResponse as aj, type UnsignedTx as ak, type MatchStatus as al, type MatchGroupEntry as am, type MatchGroupMarket as an, type MatchSortField as ao, type MatchesStats as ap, type MatchConfidenceTier as aq, type MatchMarketFlat as ar, type WsChannel as as, type WsChannelEvent as at, type WsClientMessage as au, type WsSubscribeMessage as av, type WsPingMessage as aw, type WsServerMessage as ax, type WsPongMessage as ay, type WsSubscribedMessage as az, type PredictPage as b, NEG_RISK_CTF_EXCHANGE_ADDRESS as b0, USDC_ADDRESS as b1, POLYGON_CHAIN_ID as b2, buildCtfExchangeDomain as b3, CTF_ORDER_TYPES as b4, ORDER_TYPE as b5, SIDE as b6, buildOrderMessage as b7, buildSignedOrder as b8, buildClobPayload as b9, type ClobOrderPayload as ba, type BuildOrderMessageInput as bb, type OrderMessage as bc, type SignedOrder as bd, DEFAULT_PAGE_SIZE as be, type PredictEvent as c, type ProviderSource as d, type EventStatus as e, type EventSortField as f, type PredictMarket as g, type ListMarketTradesParams as h, type PredictTrade as i, type PriceHistoryRange as j, type PriceHistoryResponse as k, type ListCandlesticksParams as l, type PositionsResponse as m, type ListOrdersParams as n, type PredictOrder as o, type CancelOrderResult as p, type MatchGroupPage as q, type MatchGroup as r, type MatchMarketParams as s, type MatchMarketPage as t, type ListTradesParams as u, type DFlowQuoteResponse as v, type DFlowSubmitResponse as w, type DFlowSubmitRequest as x, type DFlowKYCStatus as y, type PolymarketSetupStatus as z };
1458
+ export { type PredictWsClientConfig as $, type AvailableSharesResponse as A, type BalanceResponse as B, type Candlestick as C, type DFlowQuoteRequest as D, type EventStats as E, type WithdrawBuildRequest as F, type WithdrawSubmitResponse as G, type WithdrawSubmitRequest as H, type WithdrawStatusResponse as I, type PolymarketDepositAddresses as J, type PolymarketWithdrawResponse as K, type ListEventsParams as L, type MatchesParams as M, type PolymarketWithdrawRequest as N, type Orderbook as O, PredictClient as P, type WsConnectionStatus as Q, type WsDataMessage as R, type SimilarEventsParams as S, type TickSizeResponse as T, type WsPriceEvent as U, type WsOrderbookEvent as V, type WithdrawBuildResponse as W, type WsTradeEvent as X, type CreateOrderInput as Y, createPredictClient as Z, createPredictWsClient as _, PredictWsClient as a, type BuildClobAuthMessageInput as a$, type ProviderMeta as a0, type PredictTag as a1, type SettlementSource as a2, type MarketStatus as a3, type MarketResult as a4, type MarketOutcome as a5, type OrderbookLevel as a6, type TradeType as a7, type EventSummary as a8, type MarketSummary as a9, type WsSubscribedMessage as aA, type WsErrorCode as aB, type WsErrorMessage as aC, eventQueryKey as aD, fetchEvent as aE, resolveTagSlug as aF, resolveEventsParams as aG, infiniteEventsQueryKey as aH, fetchEventsPage as aI, type ResolveEventsParamsInput as aJ, type TagSlugSelection as aK, marketQueryKey as aL, fetchMarket as aM, matchesQueryKey as aN, matchQueryKey as aO, fetchMatchesPage as aP, matchMarketsQueryKey as aQ, fetchMatchMarketsPage as aR, CLOB_AUTH_DOMAIN as aS, CLOB_AUTH_TYPES as aT, buildClobAuthMessage as aU, hmacSha256Base64 as aV, buildPolymarketL2Headers as aW, derivePolymarketApiKey as aX, type HttpMethod as aY, type PolymarketL2HeadersInput as aZ, type PolymarketL2Headers as a_, type PricePoint as aa, type PredictPosition as ab, type OrderStatus as ac, type OrderSide as ad, type DFlowOrderContext as ae, type PolymarketOrderType as af, type DepositBuildRequest as ag, type DepositBuildResponse as ah, type DepositSubmitRequest as ai, type DepositSubmitResponse as aj, type DepositStatusResponse as ak, type UnsignedTx as al, type MatchStatus as am, type MatchGroupEntry as an, type MatchGroupMarket as ao, type MatchSortField as ap, type MatchesStats as aq, type MatchConfidenceTier as ar, type MatchMarketFlat as as, type WsChannel as at, type WsChannelEvent as au, type WsClientMessage as av, type WsSubscribeMessage as aw, type WsPingMessage as ax, type WsServerMessage as ay, type WsPongMessage as az, type PredictPage as b, CTF_EXCHANGE_ADDRESS as b0, NEG_RISK_CTF_EXCHANGE_ADDRESS as b1, USDC_ADDRESS as b2, POLYGON_CHAIN_ID as b3, buildCtfExchangeDomain as b4, CTF_ORDER_TYPES as b5, ORDER_TYPE as b6, SIDE as b7, buildOrderMessage as b8, buildSignedOrder as b9, buildClobPayload as ba, type ClobOrderPayload as bb, type BuildOrderMessageInput as bc, type OrderMessage as bd, type SignedOrder as be, DEFAULT_PAGE_SIZE as bf, type PredictEvent as c, type ProviderSource as d, type EventStatus as e, type EventSortField as f, type PredictMarket as g, type ListMarketTradesParams as h, type PredictTrade as i, type PriceHistoryRange as j, type PriceHistoryResponse as k, type ListCandlesticksParams as l, type PositionsResponse as m, type ListOrdersParams as n, type PredictOrder as o, type CancelOrderResult as p, type MatchGroupPage as q, type MatchGroup as r, type MatchMarketParams as s, type MatchMarketPage as t, type ListTradesParams as u, type DFlowQuoteResponse as v, type DFlowSubmitResponse as w, type DFlowSubmitRequest as x, type DFlowKYCStatus as y, type PolymarketSetupStatus as z };
package/dist/server.d.mts CHANGED
@@ -1 +1 @@
1
- export { B as BalanceResponse, 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, p as CancelOrderResult, C as Candlestick, ba as ClobOrderPayload, X as CreateOrderInput, be as DEFAULT_PAGE_SIZE, ad as DFlowOrderContext, D as DFlowQuoteRequest, v as DFlowQuoteResponse, x as DFlowSubmitRequest, w as DFlowSubmitResponse, af as DepositBuildRequest, ag as DepositBuildResponse, aj as DepositStatusResponse, ah as DepositSubmitRequest, ai as DepositSubmitResponse, f as EventSortField, e as EventStatus, a7 as EventSummary, aX as HttpMethod, l as ListCandlesticksParams, L as ListEventsParams, h as ListMarketTradesParams, n as ListOrdersParams, u as ListTradesParams, a4 as MarketOutcome, a3 as MarketResult, a2 as MarketStatus, a8 as MarketSummary, aq as MatchConfidenceTier, r as MatchGroup, am as MatchGroupEntry, an as MatchGroupMarket, q as MatchGroupPage, ar as MatchMarketFlat, t as MatchMarketPage, s as MatchMarketParams, ao as MatchSortField, al as MatchStatus, M as MatchesParams, ap as MatchesStats, b0 as NEG_RISK_CTF_EXCHANGE_ADDRESS, b5 as ORDER_TYPE, bc as OrderMessage, ac as OrderSide, ab as OrderStatus, O as Orderbook, a5 as OrderbookLevel, b2 as POLYGON_CHAIN_ID, aZ as PolymarketL2Headers, aY as PolymarketL2HeadersInput, ae as PolymarketOrderType, m as PositionsResponse, P as PredictClient, c as PredictEvent, g as PredictMarket, o as PredictOrder, b as PredictPage, aa as PredictPosition, a0 as PredictTag, i as PredictTrade, a as PredictWsClient, _ as PredictWsClientConfig, j as PriceHistoryRange, k as PriceHistoryResponse, a9 as PricePoint, $ as ProviderMeta, d as ProviderSource, aI as ResolveEventsParamsInput, b6 as SIDE, a1 as SettlementSource, bd as SignedOrder, S as SimilarEventsParams, aJ as TagSlugSelection, a6 as TradeType, b1 as USDC_ADDRESS, ak as UnsignedTx, as as WsChannel, at as WsChannelEvent, au as WsClientMessage, N as WsConnectionStatus, Q as WsDataMessage, aA as WsErrorCode, aB as WsErrorMessage, U as WsOrderbookEvent, aw as WsPingMessage, ay as WsPongMessage, R as WsPriceEvent, ax as WsServerMessage, av as WsSubscribeMessage, az as WsSubscribedMessage, V as WsTradeEvent, 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
+ export { B as BalanceResponse, 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, p as CancelOrderResult, C as Candlestick, bb as ClobOrderPayload, Y as CreateOrderInput, bf as DEFAULT_PAGE_SIZE, ae as DFlowOrderContext, D as DFlowQuoteRequest, v as DFlowQuoteResponse, x as DFlowSubmitRequest, w as DFlowSubmitResponse, ag as DepositBuildRequest, ah as DepositBuildResponse, ak as DepositStatusResponse, ai as DepositSubmitRequest, aj as DepositSubmitResponse, f as EventSortField, e as EventStatus, a8 as EventSummary, aY as HttpMethod, l as ListCandlesticksParams, L as ListEventsParams, h as ListMarketTradesParams, n as ListOrdersParams, u as ListTradesParams, a5 as MarketOutcome, a4 as MarketResult, a3 as MarketStatus, a9 as MarketSummary, ar as MatchConfidenceTier, r as MatchGroup, an as MatchGroupEntry, ao as MatchGroupMarket, q as MatchGroupPage, as as MatchMarketFlat, t as MatchMarketPage, s as MatchMarketParams, ap as MatchSortField, am as MatchStatus, M as MatchesParams, aq as MatchesStats, b1 as NEG_RISK_CTF_EXCHANGE_ADDRESS, b6 as ORDER_TYPE, bd as OrderMessage, ad as OrderSide, ac as OrderStatus, O as Orderbook, a6 as OrderbookLevel, b3 as POLYGON_CHAIN_ID, a_ as PolymarketL2Headers, aZ as PolymarketL2HeadersInput, af as PolymarketOrderType, m as PositionsResponse, P as PredictClient, c as PredictEvent, g as PredictMarket, o as PredictOrder, b as PredictPage, ab as PredictPosition, a1 as PredictTag, i as PredictTrade, a as PredictWsClient, $ as PredictWsClientConfig, j as PriceHistoryRange, k as PriceHistoryResponse, aa as PricePoint, a0 as ProviderMeta, d as ProviderSource, aJ as ResolveEventsParamsInput, b7 as SIDE, a2 as SettlementSource, be as SignedOrder, S as SimilarEventsParams, aK as TagSlugSelection, a7 as TradeType, b2 as USDC_ADDRESS, al as UnsignedTx, at as WsChannel, au as WsChannelEvent, av as WsClientMessage, Q as WsConnectionStatus, R as WsDataMessage, aB as WsErrorCode, aC as WsErrorMessage, V as WsOrderbookEvent, ax as WsPingMessage, az as WsPongMessage, U as WsPriceEvent, ay as WsServerMessage, aw as WsSubscribeMessage, aA as WsSubscribedMessage, X as WsTradeEvent, 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';
package/dist/server.d.ts CHANGED
@@ -1 +1 @@
1
- export { B as BalanceResponse, 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, p as CancelOrderResult, C as Candlestick, ba as ClobOrderPayload, X as CreateOrderInput, be as DEFAULT_PAGE_SIZE, ad as DFlowOrderContext, D as DFlowQuoteRequest, v as DFlowQuoteResponse, x as DFlowSubmitRequest, w as DFlowSubmitResponse, af as DepositBuildRequest, ag as DepositBuildResponse, aj as DepositStatusResponse, ah as DepositSubmitRequest, ai as DepositSubmitResponse, f as EventSortField, e as EventStatus, a7 as EventSummary, aX as HttpMethod, l as ListCandlesticksParams, L as ListEventsParams, h as ListMarketTradesParams, n as ListOrdersParams, u as ListTradesParams, a4 as MarketOutcome, a3 as MarketResult, a2 as MarketStatus, a8 as MarketSummary, aq as MatchConfidenceTier, r as MatchGroup, am as MatchGroupEntry, an as MatchGroupMarket, q as MatchGroupPage, ar as MatchMarketFlat, t as MatchMarketPage, s as MatchMarketParams, ao as MatchSortField, al as MatchStatus, M as MatchesParams, ap as MatchesStats, b0 as NEG_RISK_CTF_EXCHANGE_ADDRESS, b5 as ORDER_TYPE, bc as OrderMessage, ac as OrderSide, ab as OrderStatus, O as Orderbook, a5 as OrderbookLevel, b2 as POLYGON_CHAIN_ID, aZ as PolymarketL2Headers, aY as PolymarketL2HeadersInput, ae as PolymarketOrderType, m as PositionsResponse, P as PredictClient, c as PredictEvent, g as PredictMarket, o as PredictOrder, b as PredictPage, aa as PredictPosition, a0 as PredictTag, i as PredictTrade, a as PredictWsClient, _ as PredictWsClientConfig, j as PriceHistoryRange, k as PriceHistoryResponse, a9 as PricePoint, $ as ProviderMeta, d as ProviderSource, aI as ResolveEventsParamsInput, b6 as SIDE, a1 as SettlementSource, bd as SignedOrder, S as SimilarEventsParams, aJ as TagSlugSelection, a6 as TradeType, b1 as USDC_ADDRESS, ak as UnsignedTx, as as WsChannel, at as WsChannelEvent, au as WsClientMessage, N as WsConnectionStatus, Q as WsDataMessage, aA as WsErrorCode, aB as WsErrorMessage, U as WsOrderbookEvent, aw as WsPingMessage, ay as WsPongMessage, R as WsPriceEvent, ax as WsServerMessage, av as WsSubscribeMessage, az as WsSubscribedMessage, V as WsTradeEvent, 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
+ export { B as BalanceResponse, 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, p as CancelOrderResult, C as Candlestick, bb as ClobOrderPayload, Y as CreateOrderInput, bf as DEFAULT_PAGE_SIZE, ae as DFlowOrderContext, D as DFlowQuoteRequest, v as DFlowQuoteResponse, x as DFlowSubmitRequest, w as DFlowSubmitResponse, ag as DepositBuildRequest, ah as DepositBuildResponse, ak as DepositStatusResponse, ai as DepositSubmitRequest, aj as DepositSubmitResponse, f as EventSortField, e as EventStatus, a8 as EventSummary, aY as HttpMethod, l as ListCandlesticksParams, L as ListEventsParams, h as ListMarketTradesParams, n as ListOrdersParams, u as ListTradesParams, a5 as MarketOutcome, a4 as MarketResult, a3 as MarketStatus, a9 as MarketSummary, ar as MatchConfidenceTier, r as MatchGroup, an as MatchGroupEntry, ao as MatchGroupMarket, q as MatchGroupPage, as as MatchMarketFlat, t as MatchMarketPage, s as MatchMarketParams, ap as MatchSortField, am as MatchStatus, M as MatchesParams, aq as MatchesStats, b1 as NEG_RISK_CTF_EXCHANGE_ADDRESS, b6 as ORDER_TYPE, bd as OrderMessage, ad as OrderSide, ac as OrderStatus, O as Orderbook, a6 as OrderbookLevel, b3 as POLYGON_CHAIN_ID, a_ as PolymarketL2Headers, aZ as PolymarketL2HeadersInput, af as PolymarketOrderType, m as PositionsResponse, P as PredictClient, c as PredictEvent, g as PredictMarket, o as PredictOrder, b as PredictPage, ab as PredictPosition, a1 as PredictTag, i as PredictTrade, a as PredictWsClient, $ as PredictWsClientConfig, j as PriceHistoryRange, k as PriceHistoryResponse, aa as PricePoint, a0 as ProviderMeta, d as ProviderSource, aJ as ResolveEventsParamsInput, b7 as SIDE, a2 as SettlementSource, be as SignedOrder, S as SimilarEventsParams, aK as TagSlugSelection, a7 as TradeType, b2 as USDC_ADDRESS, al as UnsignedTx, at as WsChannel, au as WsChannelEvent, av as WsClientMessage, Q as WsConnectionStatus, R as WsDataMessage, aB as WsErrorCode, aC as WsErrorMessage, V as WsOrderbookEvent, ax as WsPingMessage, az as WsPongMessage, U as WsPriceEvent, ay as WsServerMessage, aw as WsSubscribeMessage, aA as WsSubscribedMessage, X as WsTradeEvent, 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';
package/dist/server.js CHANGED
@@ -24,7 +24,8 @@ function resolveEventsParams(input = {}) {
24
24
  sort_asc,
25
25
  minVolume,
26
26
  minLiquidity,
27
- timeRemaining
27
+ timeRemaining,
28
+ markets_limit = 3
28
29
  } = input;
29
30
  const tag_slug = resolveTagSlug(tagSlugSelection);
30
31
  const min_volume = minVolume !== void 0 && minVolume !== "" ? Number(minVolume) : void 0;
@@ -40,7 +41,8 @@ function resolveEventsParams(input = {}) {
40
41
  ...sort_asc !== void 0 ? { sort_asc } : {},
41
42
  ...min_volume !== void 0 && !isNaN(min_volume) ? { min_volume } : {},
42
43
  ...min_liquidity !== void 0 && !isNaN(min_liquidity) ? { min_liquidity } : {},
43
- ...end_before ? { end_before } : {}
44
+ ...end_before ? { end_before } : {},
45
+ ...markets_limit ? { markets_limit } : {}
44
46
  };
45
47
  }
46
48
  function infiniteEventsQueryKey(params) {
@@ -210,6 +212,28 @@ var PredictClient = class {
210
212
  return await utils.httpGet(url);
211
213
  }
212
214
  // -------------------------------------------------------------------------
215
+ // Available shares (for sell flow)
216
+ // -------------------------------------------------------------------------
217
+ /**
218
+ * Get the number of shares available for selling, accounting for active orders.
219
+ *
220
+ * Maps to `GET /api/v1/available-shares?source=...&user=...&market=...&side=...`.
221
+ *
222
+ * @param source - Provider source.
223
+ * @param user - Wallet address.
224
+ * @param market - Market slug.
225
+ * @param side - Position side ("yes" or "no").
226
+ * @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
227
+ */
228
+ async getAvailableShares(source, user, market, side, headers) {
229
+ const query = buildQuery({ source, user, market, side });
230
+ const url = `${this.endpoint}/api/v1/available-shares${query}`;
231
+ return await utils.httpGet(
232
+ url,
233
+ headers ? { headers } : void 0
234
+ );
235
+ }
236
+ // -------------------------------------------------------------------------
213
237
  // Balance
214
238
  // -------------------------------------------------------------------------
215
239
  /**
@@ -945,17 +969,13 @@ var DEFAULT_ROUNDING = { size: 2, price: 2, amount: 4 };
945
969
  function decimalPlaces(n, d) {
946
970
  return parseFloat(n.toFixed(d));
947
971
  }
972
+ function floorDecimalPlaces(n, d) {
973
+ const factor = 10 ** d;
974
+ return Math.floor(n * factor) / factor;
975
+ }
948
976
  function toMicroUsdc(amount) {
949
977
  return BigInt(Math.round(amount * 1e6));
950
978
  }
951
- function ceilMicro(raw, maxDecimals) {
952
- const factor = BigInt(10 ** (6 - maxDecimals));
953
- return (raw + factor - 1n) / factor * factor;
954
- }
955
- function floorMicro(raw, maxDecimals) {
956
- const factor = BigInt(10 ** (6 - maxDecimals));
957
- return raw / factor * factor;
958
- }
959
979
  function normalizeTokenId(tokenId) {
960
980
  if (tokenId.startsWith("0x") || tokenId.startsWith("0X")) {
961
981
  return BigInt(tokenId).toString(10);
@@ -966,14 +986,12 @@ function buildOrderMessage(input) {
966
986
  const side = input.side === "BUY" ? SIDE.BUY : SIDE.SELL;
967
987
  const rc = ROUNDING_CONFIG[input.tickSize] ?? DEFAULT_ROUNDING;
968
988
  const rawPrice = decimalPlaces(input.price, rc.price);
969
- const rawSize = decimalPlaces(input.size, rc.size);
970
- const rawAmount = decimalPlaces(rawSize * rawPrice, rc.amount);
989
+ const rawSize = side === SIDE.SELL ? floorDecimalPlaces(input.size, rc.size) : decimalPlaces(input.size, rc.size);
971
990
  const sizeInMicro = toMicroUsdc(rawSize);
991
+ const rawAmount = decimalPlaces(rawSize * rawPrice, rc.amount);
972
992
  const amountInMicro = toMicroUsdc(rawAmount);
973
- const usdcMicro = side === SIDE.BUY ? ceilMicro(amountInMicro, 2) : floorMicro(amountInMicro, 2);
974
- const sharesMicro = floorMicro(sizeInMicro, 4);
975
- const makerAmount = side === SIDE.BUY ? usdcMicro.toString() : sharesMicro.toString();
976
- const takerAmount = side === SIDE.BUY ? sharesMicro.toString() : usdcMicro.toString();
993
+ const makerAmount = side === SIDE.BUY ? amountInMicro.toString() : sizeInMicro.toString();
994
+ const takerAmount = side === SIDE.BUY ? sizeInMicro.toString() : amountInMicro.toString();
977
995
  const maker = input.funderAddress ?? input.signerAddress;
978
996
  return {
979
997
  salt: Math.floor(Math.random() * 1e15).toString(),