@liberfi.io/react-predict 0.3.46 → 0.3.48

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 OrderbookOutcome, h as Orderbook, i as ListMarketTradesParams, j as PredictTrade, k as PriceHistoryRange, l as PriceHistoryResponse, m as ListCandlesticksParams, C as Candlestick, n as ListCommentsParams, o as PredictComment, p as PositionsResponse, A as AvailableSharesResponse, B as BalanceResponse, q as ListOrdersParams, r as PredictOrder, s as ListOrdersMultiParams, t as PredictOrdersResponse, u as CancelOrderResult, M as MatchesParams, v as MatchGroupPage, w as MatchGroup, x as MatchMarketParams, y as MatchMarketPage, z as ListTradesParams, D as ListTradesMultiParams, F as DFlowQuoteRequest, G as DFlowQuoteResponse, H as DFlowSubmitResponse, I as DFlowSubmitRequest, J as DFlowKYCStatus, K as PolymarketSetupStatus, N as PolymarketDepositWalletDeployResponse, W as WithdrawBuildResponse, Q as WithdrawBuildRequest, R as WithdrawSubmitResponse, T as WithdrawSubmitRequest, U as WithdrawStatusResponse, V as PolymarketDepositAddresses, X as PolymarketSupportedAsset, Y as PolymarketWithdrawResponse, Z as PolymarketWithdrawRequest, _ as PolymarketWithdrawPrepareResponse, $ as PolymarketWithdrawPrepareRequest, a0 as PolymarketWithdrawQuoteResponse, a1 as PolymarketWithdrawQuoteRequest, a2 as PolymarketWithdrawRelayBuildResponse, a3 as PolymarketWithdrawRelayBuildRequest, a4 as PolymarketWithdrawRelaySubmitResponse, a5 as PolymarketWithdrawRelaySubmitRequest, a6 as PolymarketWithdrawBridgeStatusResponse, a7 as PolymarketRedeemResponse, a8 as TickSizeResponse, a9 as FeeRateResponse, aa as RebateConfig, ab as WsConnectionStatus, ac as WsDataMessage, ad as WsPriceEvent, ae as WsOrderbookEvent, af as WsTradeEvent, ag as CreateOrderInput } from './server-BYvRRFCr.mjs';
2
- export { bv as BuildClobAuthMessageInput, bJ as BuildOrderMessageInput, bm as CLOB_AUTH_DOMAIN, bn as CLOB_AUTH_TYPES, bw as CTF_EXCHANGE_ADDRESS, bB as CTF_ORDER_TYPES, bI as ClobOrderPayload, az as DFlowOrderContext, aD as DepositBuildRequest, aE as DepositBuildResponse, aH as DepositStatusResponse, aF as DepositSubmitRequest, aG as DepositSubmitResponse, as as EventSummary, bs as HttpMethod, ap as MarketOutcome, ao as MarketResult, an as MarketStatus, at as MarketSummary, aS as MatchConfidenceTier, aO as MatchGroupEntry, aP as MatchGroupMarket, aU as MatchLeg, aV as MatchMarketFlat, aQ as MatchSortField, aN as MatchStatus, aR as MatchesStats, bx as NEG_RISK_CTF_EXCHANGE_ADDRESS, bC as ORDER_TYPE, bK as OrderMessage, ay as OrderSide, ax as OrderStatus, aq as OrderbookLevel, bz as POLYGON_CHAIN_ID, aJ as PolymarketBridgeToken, aC as PolymarketDepositWalletDeployRequest, bu as PolymarketL2Headers, bt as PolymarketL2HeadersInput, aA as PolymarketOrderType, b6 as PolymarketRedeemInput, b4 as PolymarketRedeemPrepareInput, b5 as PolymarketRedeemPrepareResponse, aK as PolymarketSupportedAssetsResponse, aL as PolymarketTypedData, aM as PolymarketTypedDataArg, aB as PolymarketWalletKind, au as PredictCommentProfile, aw as PredictPosition, al as PredictTag, aj as PredictWsClientConfig, av as PricePoint, ak as ProviderMeta, bd as ResolveEventsParamsInput, bD as SIDE, am as SettlementSource, aT as SignalTag, bL as SignedOrder, be as TagSlugSelection, ar as TradeType, by as USDC_ADDRESS, aI as UnsignedTx, aW as WsChannel, aX as WsChannelEvent, aY as WsClientMessage, b2 as WsErrorCode, b3 as WsErrorMessage, a_ as WsPingMessage, b0 as WsPongMessage, a$ as WsServerMessage, aZ as WsSubscribeMessage, b1 as WsSubscribedMessage, bo as buildClobAuthMessage, bG as buildClobPayload, bA as buildCtfExchangeDomain, bE as buildOrderMessage, bq as buildPolymarketL2Headers, bF as buildSignedOrder, ah as createPredictClient, ai as createPredictWsClient, br as derivePolymarketApiKey, b7 as eventQueryKey, b8 as fetchEvent, bc as fetchEventsPage, bg as fetchMarket, bl as fetchMatchMarketsPage, bj as fetchMatchesPage, bH as getPolymarketSharesPrecision, bp as hmacSha256Base64, bb as infiniteEventsQueryKey, bf as marketQueryKey, bk as matchMarketsQueryKey, bi as matchQueryKey, bh as matchesQueryKey, ba as resolveEventsParams, b9 as resolveTagSlug } from './server-BYvRRFCr.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 OrderbookOutcome, h as Orderbook, i as ListMarketTradesParams, j as PredictTrade, k as PriceHistoryRange, l as PriceHistoryResponse, m as ListCandlesticksParams, C as Candlestick, n as ListCommentsParams, o as PredictComment, p as PositionsResponse, A as AvailableSharesResponse, B as BalanceResponse, q as ListOrdersParams, r as PredictOrder, s as ListOrdersMultiParams, t as PredictOrdersResponse, u as CancelOrderResult, M as MatchesParams, v as MatchGroupPage, w as MatchGroup, x as MatchMarketParams, y as MatchMarketPage, z as ListTradesParams, D as ListTradesMultiParams, F as DFlowQuoteRequest, G as DFlowQuoteResponse, H as DFlowSubmitResponse, I as DFlowSubmitRequest, J as DFlowKYCStatus, K as PolymarketSetupStatus, N as PolymarketDepositWalletDeployResponse, W as WithdrawBuildResponse, Q as WithdrawBuildRequest, R as WithdrawSubmitResponse, T as WithdrawSubmitRequest, U as WithdrawStatusResponse, V as PolymarketDepositAddresses, X as PolymarketSupportedAsset, Y as PolymarketWithdrawResponse, Z as PolymarketWithdrawRequest, _ as PolymarketWithdrawPrepareResponse, $ as PolymarketWithdrawPrepareRequest, a0 as PolymarketWithdrawQuoteResponse, a1 as PolymarketWithdrawQuoteRequest, a2 as PolymarketWithdrawRelayBuildResponse, a3 as PolymarketWithdrawRelayBuildRequest, a4 as PolymarketWithdrawRelaySubmitResponse, a5 as PolymarketWithdrawRelaySubmitRequest, a6 as PolymarketWithdrawBridgeStatusResponse, a7 as PolymarketRedeemResponse, a8 as TickSizeResponse, a9 as FeeRateResponse, aa as RebateConfig, ab as WsConnectionStatus, ac as WsDataMessage, ad as WsPriceEvent, ae as WsOrderbookEvent, af as WsTradeEvent, ag as CreateOrderInput } from './server-DcZETqAE.mjs';
2
+ export { bz as BuildClobAuthMessageInput, bN as BuildOrderMessageInput, bq as CLOB_AUTH_DOMAIN, br as CLOB_AUTH_TYPES, bA as CTF_EXCHANGE_ADDRESS, bF as CTF_ORDER_TYPES, bM as ClobOrderPayload, aD as DFlowOrderContext, aH as DepositBuildRequest, aI as DepositBuildResponse, aL as DepositStatusResponse, aJ as DepositSubmitRequest, aK as DepositSubmitResponse, aw as EventSummary, bw as HttpMethod, ap as MarketOutcome, ao as MarketResult, an as MarketStatus, ax as MarketSummary, aW as MatchConfidenceTier, aS as MatchGroupEntry, aT as MatchGroupMarket, aY as MatchLeg, aZ as MatchMarketFlat, aU as MatchSortField, aR as MatchStatus, aV as MatchesStats, bB as NEG_RISK_CTF_EXCHANGE_ADDRESS, bG as ORDER_TYPE, bO as OrderMessage, aC as OrderSide, aB as OrderStatus, ar as OrderbookBatchItem, as as OrderbookBatchResult, aq as OrderbookLevel, at as OrderbooksBatchRequest, au as OrderbooksBatchResponse, bD as POLYGON_CHAIN_ID, aN as PolymarketBridgeToken, aG as PolymarketDepositWalletDeployRequest, by as PolymarketL2Headers, bx as PolymarketL2HeadersInput, aE as PolymarketOrderType, ba as PolymarketRedeemInput, b8 as PolymarketRedeemPrepareInput, b9 as PolymarketRedeemPrepareResponse, aO as PolymarketSupportedAssetsResponse, aP as PolymarketTypedData, aQ as PolymarketTypedDataArg, aF as PolymarketWalletKind, ay as PredictCommentProfile, aA as PredictPosition, al as PredictTag, aj as PredictWsClientConfig, az as PricePoint, ak as ProviderMeta, bh as ResolveEventsParamsInput, bH as SIDE, am as SettlementSource, aX as SignalTag, bP as SignedOrder, bi as TagSlugSelection, av as TradeType, bC as USDC_ADDRESS, aM as UnsignedTx, a_ as WsChannel, a$ as WsChannelEvent, b0 as WsClientMessage, b6 as WsErrorCode, b7 as WsErrorMessage, b2 as WsPingMessage, b4 as WsPongMessage, b3 as WsServerMessage, b1 as WsSubscribeMessage, b5 as WsSubscribedMessage, bs as buildClobAuthMessage, bK as buildClobPayload, bE as buildCtfExchangeDomain, bI as buildOrderMessage, bu as buildPolymarketL2Headers, bJ as buildSignedOrder, ah as createPredictClient, ai as createPredictWsClient, bv as derivePolymarketApiKey, bb as eventQueryKey, bc as fetchEvent, bg as fetchEventsPage, bk as fetchMarket, bp as fetchMatchMarketsPage, bn as fetchMatchesPage, bL as getPolymarketSharesPrecision, bt as hmacSha256Base64, bf as infiniteEventsQueryKey, bj as marketQueryKey, bo as matchMarketsQueryKey, bm as matchQueryKey, bl as matchesQueryKey, be as resolveEventsParams, bd as resolveTagSlug } from './server-DcZETqAE.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';
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 OrderbookOutcome, h as Orderbook, i as ListMarketTradesParams, j as PredictTrade, k as PriceHistoryRange, l as PriceHistoryResponse, m as ListCandlesticksParams, C as Candlestick, n as ListCommentsParams, o as PredictComment, p as PositionsResponse, A as AvailableSharesResponse, B as BalanceResponse, q as ListOrdersParams, r as PredictOrder, s as ListOrdersMultiParams, t as PredictOrdersResponse, u as CancelOrderResult, M as MatchesParams, v as MatchGroupPage, w as MatchGroup, x as MatchMarketParams, y as MatchMarketPage, z as ListTradesParams, D as ListTradesMultiParams, F as DFlowQuoteRequest, G as DFlowQuoteResponse, H as DFlowSubmitResponse, I as DFlowSubmitRequest, J as DFlowKYCStatus, K as PolymarketSetupStatus, N as PolymarketDepositWalletDeployResponse, W as WithdrawBuildResponse, Q as WithdrawBuildRequest, R as WithdrawSubmitResponse, T as WithdrawSubmitRequest, U as WithdrawStatusResponse, V as PolymarketDepositAddresses, X as PolymarketSupportedAsset, Y as PolymarketWithdrawResponse, Z as PolymarketWithdrawRequest, _ as PolymarketWithdrawPrepareResponse, $ as PolymarketWithdrawPrepareRequest, a0 as PolymarketWithdrawQuoteResponse, a1 as PolymarketWithdrawQuoteRequest, a2 as PolymarketWithdrawRelayBuildResponse, a3 as PolymarketWithdrawRelayBuildRequest, a4 as PolymarketWithdrawRelaySubmitResponse, a5 as PolymarketWithdrawRelaySubmitRequest, a6 as PolymarketWithdrawBridgeStatusResponse, a7 as PolymarketRedeemResponse, a8 as TickSizeResponse, a9 as FeeRateResponse, aa as RebateConfig, ab as WsConnectionStatus, ac as WsDataMessage, ad as WsPriceEvent, ae as WsOrderbookEvent, af as WsTradeEvent, ag as CreateOrderInput } from './server-BYvRRFCr.js';
2
- export { bv as BuildClobAuthMessageInput, bJ as BuildOrderMessageInput, bm as CLOB_AUTH_DOMAIN, bn as CLOB_AUTH_TYPES, bw as CTF_EXCHANGE_ADDRESS, bB as CTF_ORDER_TYPES, bI as ClobOrderPayload, az as DFlowOrderContext, aD as DepositBuildRequest, aE as DepositBuildResponse, aH as DepositStatusResponse, aF as DepositSubmitRequest, aG as DepositSubmitResponse, as as EventSummary, bs as HttpMethod, ap as MarketOutcome, ao as MarketResult, an as MarketStatus, at as MarketSummary, aS as MatchConfidenceTier, aO as MatchGroupEntry, aP as MatchGroupMarket, aU as MatchLeg, aV as MatchMarketFlat, aQ as MatchSortField, aN as MatchStatus, aR as MatchesStats, bx as NEG_RISK_CTF_EXCHANGE_ADDRESS, bC as ORDER_TYPE, bK as OrderMessage, ay as OrderSide, ax as OrderStatus, aq as OrderbookLevel, bz as POLYGON_CHAIN_ID, aJ as PolymarketBridgeToken, aC as PolymarketDepositWalletDeployRequest, bu as PolymarketL2Headers, bt as PolymarketL2HeadersInput, aA as PolymarketOrderType, b6 as PolymarketRedeemInput, b4 as PolymarketRedeemPrepareInput, b5 as PolymarketRedeemPrepareResponse, aK as PolymarketSupportedAssetsResponse, aL as PolymarketTypedData, aM as PolymarketTypedDataArg, aB as PolymarketWalletKind, au as PredictCommentProfile, aw as PredictPosition, al as PredictTag, aj as PredictWsClientConfig, av as PricePoint, ak as ProviderMeta, bd as ResolveEventsParamsInput, bD as SIDE, am as SettlementSource, aT as SignalTag, bL as SignedOrder, be as TagSlugSelection, ar as TradeType, by as USDC_ADDRESS, aI as UnsignedTx, aW as WsChannel, aX as WsChannelEvent, aY as WsClientMessage, b2 as WsErrorCode, b3 as WsErrorMessage, a_ as WsPingMessage, b0 as WsPongMessage, a$ as WsServerMessage, aZ as WsSubscribeMessage, b1 as WsSubscribedMessage, bo as buildClobAuthMessage, bG as buildClobPayload, bA as buildCtfExchangeDomain, bE as buildOrderMessage, bq as buildPolymarketL2Headers, bF as buildSignedOrder, ah as createPredictClient, ai as createPredictWsClient, br as derivePolymarketApiKey, b7 as eventQueryKey, b8 as fetchEvent, bc as fetchEventsPage, bg as fetchMarket, bl as fetchMatchMarketsPage, bj as fetchMatchesPage, bH as getPolymarketSharesPrecision, bp as hmacSha256Base64, bb as infiniteEventsQueryKey, bf as marketQueryKey, bk as matchMarketsQueryKey, bi as matchQueryKey, bh as matchesQueryKey, ba as resolveEventsParams, b9 as resolveTagSlug } from './server-BYvRRFCr.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 OrderbookOutcome, h as Orderbook, i as ListMarketTradesParams, j as PredictTrade, k as PriceHistoryRange, l as PriceHistoryResponse, m as ListCandlesticksParams, C as Candlestick, n as ListCommentsParams, o as PredictComment, p as PositionsResponse, A as AvailableSharesResponse, B as BalanceResponse, q as ListOrdersParams, r as PredictOrder, s as ListOrdersMultiParams, t as PredictOrdersResponse, u as CancelOrderResult, M as MatchesParams, v as MatchGroupPage, w as MatchGroup, x as MatchMarketParams, y as MatchMarketPage, z as ListTradesParams, D as ListTradesMultiParams, F as DFlowQuoteRequest, G as DFlowQuoteResponse, H as DFlowSubmitResponse, I as DFlowSubmitRequest, J as DFlowKYCStatus, K as PolymarketSetupStatus, N as PolymarketDepositWalletDeployResponse, W as WithdrawBuildResponse, Q as WithdrawBuildRequest, R as WithdrawSubmitResponse, T as WithdrawSubmitRequest, U as WithdrawStatusResponse, V as PolymarketDepositAddresses, X as PolymarketSupportedAsset, Y as PolymarketWithdrawResponse, Z as PolymarketWithdrawRequest, _ as PolymarketWithdrawPrepareResponse, $ as PolymarketWithdrawPrepareRequest, a0 as PolymarketWithdrawQuoteResponse, a1 as PolymarketWithdrawQuoteRequest, a2 as PolymarketWithdrawRelayBuildResponse, a3 as PolymarketWithdrawRelayBuildRequest, a4 as PolymarketWithdrawRelaySubmitResponse, a5 as PolymarketWithdrawRelaySubmitRequest, a6 as PolymarketWithdrawBridgeStatusResponse, a7 as PolymarketRedeemResponse, a8 as TickSizeResponse, a9 as FeeRateResponse, aa as RebateConfig, ab as WsConnectionStatus, ac as WsDataMessage, ad as WsPriceEvent, ae as WsOrderbookEvent, af as WsTradeEvent, ag as CreateOrderInput } from './server-DcZETqAE.js';
2
+ export { bz as BuildClobAuthMessageInput, bN as BuildOrderMessageInput, bq as CLOB_AUTH_DOMAIN, br as CLOB_AUTH_TYPES, bA as CTF_EXCHANGE_ADDRESS, bF as CTF_ORDER_TYPES, bM as ClobOrderPayload, aD as DFlowOrderContext, aH as DepositBuildRequest, aI as DepositBuildResponse, aL as DepositStatusResponse, aJ as DepositSubmitRequest, aK as DepositSubmitResponse, aw as EventSummary, bw as HttpMethod, ap as MarketOutcome, ao as MarketResult, an as MarketStatus, ax as MarketSummary, aW as MatchConfidenceTier, aS as MatchGroupEntry, aT as MatchGroupMarket, aY as MatchLeg, aZ as MatchMarketFlat, aU as MatchSortField, aR as MatchStatus, aV as MatchesStats, bB as NEG_RISK_CTF_EXCHANGE_ADDRESS, bG as ORDER_TYPE, bO as OrderMessage, aC as OrderSide, aB as OrderStatus, ar as OrderbookBatchItem, as as OrderbookBatchResult, aq as OrderbookLevel, at as OrderbooksBatchRequest, au as OrderbooksBatchResponse, bD as POLYGON_CHAIN_ID, aN as PolymarketBridgeToken, aG as PolymarketDepositWalletDeployRequest, by as PolymarketL2Headers, bx as PolymarketL2HeadersInput, aE as PolymarketOrderType, ba as PolymarketRedeemInput, b8 as PolymarketRedeemPrepareInput, b9 as PolymarketRedeemPrepareResponse, aO as PolymarketSupportedAssetsResponse, aP as PolymarketTypedData, aQ as PolymarketTypedDataArg, aF as PolymarketWalletKind, ay as PredictCommentProfile, aA as PredictPosition, al as PredictTag, aj as PredictWsClientConfig, az as PricePoint, ak as ProviderMeta, bh as ResolveEventsParamsInput, bH as SIDE, am as SettlementSource, aX as SignalTag, bP as SignedOrder, bi as TagSlugSelection, av as TradeType, bC as USDC_ADDRESS, aM as UnsignedTx, a_ as WsChannel, a$ as WsChannelEvent, b0 as WsClientMessage, b6 as WsErrorCode, b7 as WsErrorMessage, b2 as WsPingMessage, b4 as WsPongMessage, b3 as WsServerMessage, b1 as WsSubscribeMessage, b5 as WsSubscribedMessage, bs as buildClobAuthMessage, bK as buildClobPayload, bE as buildCtfExchangeDomain, bI as buildOrderMessage, bu as buildPolymarketL2Headers, bJ as buildSignedOrder, ah as createPredictClient, ai as createPredictWsClient, bv as derivePolymarketApiKey, bb as eventQueryKey, bc as fetchEvent, bg as fetchEventsPage, bk as fetchMarket, bp as fetchMatchMarketsPage, bn as fetchMatchesPage, bL as getPolymarketSharesPrecision, bt as hmacSha256Base64, bf as infiniteEventsQueryKey, bj as marketQueryKey, bo as matchMarketsQueryKey, bm as matchQueryKey, bl as matchesQueryKey, be as resolveEventsParams, bd as resolveTagSlug } from './server-DcZETqAE.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';
package/dist/index.js CHANGED
@@ -115,6 +115,17 @@ var PredictClient = class {
115
115
  const url = `${this.endpoint}/api/v1/markets/${encodeURIComponent(slug)}/orderbook${query}`;
116
116
  return await utils.httpGet(url);
117
117
  }
118
+ /**
119
+ * Maps to `POST /api/v1/markets/orderbooks`.
120
+ * Fetches order books for many markets in a single request (max 100 items).
121
+ * Results are returned in the same order as `items`; per-item failures are
122
+ * reported via `OrderbookBatchResult.error` and never fail the whole batch.
123
+ */
124
+ async getOrderbooks(items) {
125
+ const url = `${this.endpoint}/api/v1/markets/orderbooks`;
126
+ const res = await utils.httpPost(url, { items });
127
+ return res.results;
128
+ }
118
129
  /** Maps to `GET /api/v1/markets/:slug/trades?source=...`. */
119
130
  async listMarketTrades(slug, params) {
120
131
  const query = buildQuery(params);
@@ -539,6 +550,13 @@ var DEFAULT_RECONNECT_BASE = 1e3;
539
550
  var DEFAULT_RECONNECT_MAX = 3e4;
540
551
  var DEFAULT_PING_INTERVAL = 2e4;
541
552
  var DEFAULT_PONG_TIMEOUT = 1e4;
553
+ var MAX_SUBSCRIPTION_FRAME_BYTES = 3500;
554
+ function byteLength(str) {
555
+ if (typeof TextEncoder !== "undefined") {
556
+ return new TextEncoder().encode(str).length;
557
+ }
558
+ return str.length;
559
+ }
542
560
  var PredictWsClient = class {
543
561
  ws = null;
544
562
  wsUrl;
@@ -656,7 +674,7 @@ var PredictWsClient = class {
656
674
  const set = this.subs.channels.get(ch);
657
675
  for (const slug of marketSlugs) set.add(slug);
658
676
  }
659
- this.send({ type: "subscribe", channels, market_slugs: marketSlugs });
677
+ this.sendChunkedSubscription("subscribe", channels, marketSlugs);
660
678
  }
661
679
  /**
662
680
  * Unsubscribe from one or more channels for the given market slugs.
@@ -666,7 +684,7 @@ var PredictWsClient = class {
666
684
  const set = this.subs.channels.get(ch);
667
685
  for (const slug of marketSlugs) set.delete(slug);
668
686
  }
669
- this.send({ type: "unsubscribe", channels, market_slugs: marketSlugs });
687
+ this.sendChunkedSubscription("unsubscribe", channels, marketSlugs);
670
688
  }
671
689
  // -------------------------------------------------------------------------
672
690
  // Subscription — convenience (single channel)
@@ -822,14 +840,40 @@ var PredictWsClient = class {
822
840
  restoreSubscriptions() {
823
841
  for (const [channel, slugs] of this.subs.channels.entries()) {
824
842
  if (slugs.size > 0) {
825
- this.send({
826
- type: "subscribe",
827
- channels: [channel],
828
- market_slugs: Array.from(slugs)
829
- });
843
+ this.sendChunkedSubscription("subscribe", [channel], Array.from(slugs));
830
844
  }
831
845
  }
832
846
  }
847
+ /**
848
+ * Send a subscribe/unsubscribe message, splitting `marketSlugs` across
849
+ * multiple frames so no single frame exceeds the server read limit.
850
+ */
851
+ sendChunkedSubscription(type, channels, marketSlugs) {
852
+ if (marketSlugs.length === 0) {
853
+ this.send({ type, channels, market_slugs: [] });
854
+ return;
855
+ }
856
+ const envelopeBytes = byteLength(
857
+ JSON.stringify({ type, channels, market_slugs: [] })
858
+ );
859
+ const budget = MAX_SUBSCRIPTION_FRAME_BYTES - envelopeBytes;
860
+ let chunk = [];
861
+ let chunkBytes = 0;
862
+ const flush = () => {
863
+ if (chunk.length > 0) {
864
+ this.send({ type, channels, market_slugs: chunk });
865
+ chunk = [];
866
+ chunkBytes = 0;
867
+ }
868
+ };
869
+ for (const slug of marketSlugs) {
870
+ const slugBytes = byteLength(JSON.stringify(slug)) + 1;
871
+ if (chunk.length > 0 && chunkBytes + slugBytes > budget) flush();
872
+ chunk.push(slug);
873
+ chunkBytes += slugBytes;
874
+ }
875
+ flush();
876
+ }
833
877
  startPing() {
834
878
  this.stopPing();
835
879
  this.pingTimer = setInterval(() => {