@liberfi.io/react-predict 0.3.63 → 0.3.65

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.
@@ -356,6 +356,11 @@ interface SimilarEventsParams {
356
356
  limit?: number;
357
357
  /** When true, only return events from the same provider. */
358
358
  same_source?: boolean;
359
+ /**
360
+ * Resolved UI language. Sent as `?lang=` so localized event/market fields are
361
+ * returned.
362
+ */
363
+ lang?: string;
359
364
  }
360
365
  /** Match group lifecycle status. */
361
366
  type MatchStatus = "active" | "expired";
@@ -1223,7 +1228,9 @@ declare class PredictClient {
1223
1228
  * @returns The matching event.
1224
1229
  * @throws When the server responds with 404 or any other non-2xx status.
1225
1230
  */
1226
- getEvent(slug: string, source?: ProviderSource): Promise<PredictEvent>;
1231
+ getEvent(slug: string, source?: ProviderSource, params?: {
1232
+ lang?: string;
1233
+ }): Promise<PredictEvent>;
1227
1234
  /**
1228
1235
  * Fetch aggregate statistics for all open events.
1229
1236
  *
@@ -1722,12 +1729,12 @@ declare function infiniteEventsQueryKey(params: ListEventsParams): unknown[];
1722
1729
  */
1723
1730
  declare function fetchEventsPage(client: PredictClient, params: ListEventsParams): Promise<PredictPage<PredictEvent>>;
1724
1731
  /** Stable TanStack Query key for a single event. */
1725
- declare function eventQueryKey(slug: string, source?: ProviderSource): unknown[];
1732
+ declare function eventQueryKey(slug: string, source?: ProviderSource, lang?: string): unknown[];
1726
1733
  /**
1727
1734
  * Fetch a single event. Can be used outside of React
1728
1735
  * (e.g. in Server Components, loaders, or tests).
1729
1736
  */
1730
- declare function fetchEvent(client: PredictClient, slug: string, source?: ProviderSource): Promise<PredictEvent>;
1737
+ declare function fetchEvent(client: PredictClient, slug: string, source?: ProviderSource, lang?: string): Promise<PredictEvent>;
1731
1738
 
1732
1739
  /**
1733
1740
  * Server-safe pure functions for market query helpers.
@@ -356,6 +356,11 @@ interface SimilarEventsParams {
356
356
  limit?: number;
357
357
  /** When true, only return events from the same provider. */
358
358
  same_source?: boolean;
359
+ /**
360
+ * Resolved UI language. Sent as `?lang=` so localized event/market fields are
361
+ * returned.
362
+ */
363
+ lang?: string;
359
364
  }
360
365
  /** Match group lifecycle status. */
361
366
  type MatchStatus = "active" | "expired";
@@ -1223,7 +1228,9 @@ declare class PredictClient {
1223
1228
  * @returns The matching event.
1224
1229
  * @throws When the server responds with 404 or any other non-2xx status.
1225
1230
  */
1226
- getEvent(slug: string, source?: ProviderSource): Promise<PredictEvent>;
1231
+ getEvent(slug: string, source?: ProviderSource, params?: {
1232
+ lang?: string;
1233
+ }): Promise<PredictEvent>;
1227
1234
  /**
1228
1235
  * Fetch aggregate statistics for all open events.
1229
1236
  *
@@ -1722,12 +1729,12 @@ declare function infiniteEventsQueryKey(params: ListEventsParams): unknown[];
1722
1729
  */
1723
1730
  declare function fetchEventsPage(client: PredictClient, params: ListEventsParams): Promise<PredictPage<PredictEvent>>;
1724
1731
  /** Stable TanStack Query key for a single event. */
1725
- declare function eventQueryKey(slug: string, source?: ProviderSource): unknown[];
1732
+ declare function eventQueryKey(slug: string, source?: ProviderSource, lang?: string): unknown[];
1726
1733
  /**
1727
1734
  * Fetch a single event. Can be used outside of React
1728
1735
  * (e.g. in Server Components, loaders, or tests).
1729
1736
  */
1730
- declare function fetchEvent(client: PredictClient, slug: string, source?: ProviderSource): Promise<PredictEvent>;
1737
+ declare function fetchEvent(client: PredictClient, slug: string, source?: ProviderSource, lang?: string): Promise<PredictEvent>;
1731
1738
 
1732
1739
  /**
1733
1740
  * Server-safe pure functions for market query helpers.
package/dist/server.d.mts CHANGED
@@ -1 +1 @@
1
- export { B as BalanceResponse, bE as BuildClobAuthMessageInput, bT as BuildOrderMessageInput, bv as CLOB_AUTH_DOMAIN, bw as CLOB_AUTH_TYPES, bF as CTF_EXCHANGE_ADDRESS, bK as CTF_ORDER_TYPES, v as CancelOrderResult, C as Candlestick, bS as ClobOrderPayload, ai as CreateOrderInput, bW as DEFAULT_PAGE_SIZE, aI as DFlowOrderContext, G as DFlowQuoteRequest, H as DFlowQuoteResponse, J as DFlowSubmitRequest, I as DFlowSubmitResponse, aN as DepositBuildRequest, aO as DepositBuildResponse, aR as DepositStatusResponse, aP as DepositSubmitRequest, aQ as DepositSubmitResponse, f as EventSortField, e as EventStatus, az as EventSummary, bB as HttpMethod, m as ListCandlesticksParams, L as ListEventsParams, i as ListMarketTradesParams, r as ListOrdersParams, D as ListTradesParams, as as MarketOutcome, ar as MarketResult, aq as MarketStatus, aA as MarketSummary, a$ as MatchConfidenceTier, x as MatchGroup, aX as MatchGroupEntry, aY as MatchGroupMarket, w as MatchGroupPage, b1 as MatchLeg, b2 as MatchMarketFlat, z as MatchMarketPage, y as MatchMarketParams, aZ as MatchSortField, aW as MatchStatus, M as MatchesParams, a_ as MatchesStats, bG as NEG_RISK_CTF_EXCHANGE_ADDRESS, bL as ORDER_TYPE, bU as OrderMessage, aH as OrderSide, aG as OrderStatus, h as Orderbook, at as OrderbookLevel, bI as POLYGON_CHAIN_ID, bD as PolymarketL2Headers, bC as PolymarketL2HeadersInput, aJ as PolymarketOrderType, aE as PositionValue, aF as PositionValueError, q as PositionValueResponse, p as PositionsResponse, P as PredictClient, ak as PredictClientOptions, c as PredictEvent, g as PredictMarket, s as PredictOrder, b as PredictPage, aD as PredictPosition, ao as PredictTag, j as PredictTrade, a as PredictWsClient, am as PredictWsClientConfig, k as PriceHistoryRange, l as PriceHistoryResponse, aC as PricePoint, an as ProviderMeta, d as ProviderSource, bm as ResolveEventsParamsInput, bM as SIDE, ap as SettlementSource, b0 as SignalTag, bV as SignedOrder, S as SimilarEventsParams, bn as TagSlugSelection, ay as TradeType, bH as USDC_ADDRESS, aS as UnsignedTx, b3 as WsChannel, b4 as WsChannelEvent, b5 as WsClientMessage, ad as WsConnectionStatus, ae as WsDataMessage, bb as WsErrorCode, bc as WsErrorMessage, ag as WsOrderbookEvent, b7 as WsPingMessage, b9 as WsPongMessage, af as WsPriceEvent, b8 as WsServerMessage, b6 as WsSubscribeMessage, ba as WsSubscribedMessage, ah as WsTradeEvent, bx as buildClobAuthMessage, bP as buildClobPayload, bJ as buildCtfExchangeDomain, bN as buildOrderMessage, bz as buildPolymarketL2Headers, bO as buildSignedOrder, aj as createPredictClient, al as createPredictWsClient, bA as derivePolymarketApiKey, bg as eventQueryKey, bh as fetchEvent, bl as fetchEventsPage, bp as fetchMarket, bu as fetchMatchMarketsPage, bs as fetchMatchesPage, by as hmacSha256Base64, bk as infiniteEventsQueryKey, bo as marketQueryKey, bt as matchMarketsQueryKey, br as matchQueryKey, bq as matchesQueryKey, bj as resolveEventsParams, bi as resolveTagSlug } from './server-Dk8PqvnI.mjs';
1
+ export { B as BalanceResponse, bE as BuildClobAuthMessageInput, bT as BuildOrderMessageInput, bv as CLOB_AUTH_DOMAIN, bw as CLOB_AUTH_TYPES, bF as CTF_EXCHANGE_ADDRESS, bK as CTF_ORDER_TYPES, v as CancelOrderResult, C as Candlestick, bS as ClobOrderPayload, ai as CreateOrderInput, bW as DEFAULT_PAGE_SIZE, aI as DFlowOrderContext, G as DFlowQuoteRequest, H as DFlowQuoteResponse, J as DFlowSubmitRequest, I as DFlowSubmitResponse, aN as DepositBuildRequest, aO as DepositBuildResponse, aR as DepositStatusResponse, aP as DepositSubmitRequest, aQ as DepositSubmitResponse, f as EventSortField, e as EventStatus, az as EventSummary, bB as HttpMethod, m as ListCandlesticksParams, L as ListEventsParams, i as ListMarketTradesParams, r as ListOrdersParams, D as ListTradesParams, as as MarketOutcome, ar as MarketResult, aq as MarketStatus, aA as MarketSummary, a$ as MatchConfidenceTier, x as MatchGroup, aX as MatchGroupEntry, aY as MatchGroupMarket, w as MatchGroupPage, b1 as MatchLeg, b2 as MatchMarketFlat, z as MatchMarketPage, y as MatchMarketParams, aZ as MatchSortField, aW as MatchStatus, M as MatchesParams, a_ as MatchesStats, bG as NEG_RISK_CTF_EXCHANGE_ADDRESS, bL as ORDER_TYPE, bU as OrderMessage, aH as OrderSide, aG as OrderStatus, h as Orderbook, at as OrderbookLevel, bI as POLYGON_CHAIN_ID, bD as PolymarketL2Headers, bC as PolymarketL2HeadersInput, aJ as PolymarketOrderType, aE as PositionValue, aF as PositionValueError, q as PositionValueResponse, p as PositionsResponse, P as PredictClient, ak as PredictClientOptions, c as PredictEvent, g as PredictMarket, s as PredictOrder, b as PredictPage, aD as PredictPosition, ao as PredictTag, j as PredictTrade, a as PredictWsClient, am as PredictWsClientConfig, k as PriceHistoryRange, l as PriceHistoryResponse, aC as PricePoint, an as ProviderMeta, d as ProviderSource, bm as ResolveEventsParamsInput, bM as SIDE, ap as SettlementSource, b0 as SignalTag, bV as SignedOrder, S as SimilarEventsParams, bn as TagSlugSelection, ay as TradeType, bH as USDC_ADDRESS, aS as UnsignedTx, b3 as WsChannel, b4 as WsChannelEvent, b5 as WsClientMessage, ad as WsConnectionStatus, ae as WsDataMessage, bb as WsErrorCode, bc as WsErrorMessage, ag as WsOrderbookEvent, b7 as WsPingMessage, b9 as WsPongMessage, af as WsPriceEvent, b8 as WsServerMessage, b6 as WsSubscribeMessage, ba as WsSubscribedMessage, ah as WsTradeEvent, bx as buildClobAuthMessage, bP as buildClobPayload, bJ as buildCtfExchangeDomain, bN as buildOrderMessage, bz as buildPolymarketL2Headers, bO as buildSignedOrder, aj as createPredictClient, al as createPredictWsClient, bA as derivePolymarketApiKey, bg as eventQueryKey, bh as fetchEvent, bl as fetchEventsPage, bp as fetchMarket, bu as fetchMatchMarketsPage, bs as fetchMatchesPage, by as hmacSha256Base64, bk as infiniteEventsQueryKey, bo as marketQueryKey, bt as matchMarketsQueryKey, br as matchQueryKey, bq as matchesQueryKey, bj as resolveEventsParams, bi as resolveTagSlug } from './server-pS5Vlydo.mjs';
package/dist/server.d.ts CHANGED
@@ -1 +1 @@
1
- export { B as BalanceResponse, bE as BuildClobAuthMessageInput, bT as BuildOrderMessageInput, bv as CLOB_AUTH_DOMAIN, bw as CLOB_AUTH_TYPES, bF as CTF_EXCHANGE_ADDRESS, bK as CTF_ORDER_TYPES, v as CancelOrderResult, C as Candlestick, bS as ClobOrderPayload, ai as CreateOrderInput, bW as DEFAULT_PAGE_SIZE, aI as DFlowOrderContext, G as DFlowQuoteRequest, H as DFlowQuoteResponse, J as DFlowSubmitRequest, I as DFlowSubmitResponse, aN as DepositBuildRequest, aO as DepositBuildResponse, aR as DepositStatusResponse, aP as DepositSubmitRequest, aQ as DepositSubmitResponse, f as EventSortField, e as EventStatus, az as EventSummary, bB as HttpMethod, m as ListCandlesticksParams, L as ListEventsParams, i as ListMarketTradesParams, r as ListOrdersParams, D as ListTradesParams, as as MarketOutcome, ar as MarketResult, aq as MarketStatus, aA as MarketSummary, a$ as MatchConfidenceTier, x as MatchGroup, aX as MatchGroupEntry, aY as MatchGroupMarket, w as MatchGroupPage, b1 as MatchLeg, b2 as MatchMarketFlat, z as MatchMarketPage, y as MatchMarketParams, aZ as MatchSortField, aW as MatchStatus, M as MatchesParams, a_ as MatchesStats, bG as NEG_RISK_CTF_EXCHANGE_ADDRESS, bL as ORDER_TYPE, bU as OrderMessage, aH as OrderSide, aG as OrderStatus, h as Orderbook, at as OrderbookLevel, bI as POLYGON_CHAIN_ID, bD as PolymarketL2Headers, bC as PolymarketL2HeadersInput, aJ as PolymarketOrderType, aE as PositionValue, aF as PositionValueError, q as PositionValueResponse, p as PositionsResponse, P as PredictClient, ak as PredictClientOptions, c as PredictEvent, g as PredictMarket, s as PredictOrder, b as PredictPage, aD as PredictPosition, ao as PredictTag, j as PredictTrade, a as PredictWsClient, am as PredictWsClientConfig, k as PriceHistoryRange, l as PriceHistoryResponse, aC as PricePoint, an as ProviderMeta, d as ProviderSource, bm as ResolveEventsParamsInput, bM as SIDE, ap as SettlementSource, b0 as SignalTag, bV as SignedOrder, S as SimilarEventsParams, bn as TagSlugSelection, ay as TradeType, bH as USDC_ADDRESS, aS as UnsignedTx, b3 as WsChannel, b4 as WsChannelEvent, b5 as WsClientMessage, ad as WsConnectionStatus, ae as WsDataMessage, bb as WsErrorCode, bc as WsErrorMessage, ag as WsOrderbookEvent, b7 as WsPingMessage, b9 as WsPongMessage, af as WsPriceEvent, b8 as WsServerMessage, b6 as WsSubscribeMessage, ba as WsSubscribedMessage, ah as WsTradeEvent, bx as buildClobAuthMessage, bP as buildClobPayload, bJ as buildCtfExchangeDomain, bN as buildOrderMessage, bz as buildPolymarketL2Headers, bO as buildSignedOrder, aj as createPredictClient, al as createPredictWsClient, bA as derivePolymarketApiKey, bg as eventQueryKey, bh as fetchEvent, bl as fetchEventsPage, bp as fetchMarket, bu as fetchMatchMarketsPage, bs as fetchMatchesPage, by as hmacSha256Base64, bk as infiniteEventsQueryKey, bo as marketQueryKey, bt as matchMarketsQueryKey, br as matchQueryKey, bq as matchesQueryKey, bj as resolveEventsParams, bi as resolveTagSlug } from './server-Dk8PqvnI.js';
1
+ export { B as BalanceResponse, bE as BuildClobAuthMessageInput, bT as BuildOrderMessageInput, bv as CLOB_AUTH_DOMAIN, bw as CLOB_AUTH_TYPES, bF as CTF_EXCHANGE_ADDRESS, bK as CTF_ORDER_TYPES, v as CancelOrderResult, C as Candlestick, bS as ClobOrderPayload, ai as CreateOrderInput, bW as DEFAULT_PAGE_SIZE, aI as DFlowOrderContext, G as DFlowQuoteRequest, H as DFlowQuoteResponse, J as DFlowSubmitRequest, I as DFlowSubmitResponse, aN as DepositBuildRequest, aO as DepositBuildResponse, aR as DepositStatusResponse, aP as DepositSubmitRequest, aQ as DepositSubmitResponse, f as EventSortField, e as EventStatus, az as EventSummary, bB as HttpMethod, m as ListCandlesticksParams, L as ListEventsParams, i as ListMarketTradesParams, r as ListOrdersParams, D as ListTradesParams, as as MarketOutcome, ar as MarketResult, aq as MarketStatus, aA as MarketSummary, a$ as MatchConfidenceTier, x as MatchGroup, aX as MatchGroupEntry, aY as MatchGroupMarket, w as MatchGroupPage, b1 as MatchLeg, b2 as MatchMarketFlat, z as MatchMarketPage, y as MatchMarketParams, aZ as MatchSortField, aW as MatchStatus, M as MatchesParams, a_ as MatchesStats, bG as NEG_RISK_CTF_EXCHANGE_ADDRESS, bL as ORDER_TYPE, bU as OrderMessage, aH as OrderSide, aG as OrderStatus, h as Orderbook, at as OrderbookLevel, bI as POLYGON_CHAIN_ID, bD as PolymarketL2Headers, bC as PolymarketL2HeadersInput, aJ as PolymarketOrderType, aE as PositionValue, aF as PositionValueError, q as PositionValueResponse, p as PositionsResponse, P as PredictClient, ak as PredictClientOptions, c as PredictEvent, g as PredictMarket, s as PredictOrder, b as PredictPage, aD as PredictPosition, ao as PredictTag, j as PredictTrade, a as PredictWsClient, am as PredictWsClientConfig, k as PriceHistoryRange, l as PriceHistoryResponse, aC as PricePoint, an as ProviderMeta, d as ProviderSource, bm as ResolveEventsParamsInput, bM as SIDE, ap as SettlementSource, b0 as SignalTag, bV as SignedOrder, S as SimilarEventsParams, bn as TagSlugSelection, ay as TradeType, bH as USDC_ADDRESS, aS as UnsignedTx, b3 as WsChannel, b4 as WsChannelEvent, b5 as WsClientMessage, ad as WsConnectionStatus, ae as WsDataMessage, bb as WsErrorCode, bc as WsErrorMessage, ag as WsOrderbookEvent, b7 as WsPingMessage, b9 as WsPongMessage, af as WsPriceEvent, b8 as WsServerMessage, b6 as WsSubscribeMessage, ba as WsSubscribedMessage, ah as WsTradeEvent, bx as buildClobAuthMessage, bP as buildClobPayload, bJ as buildCtfExchangeDomain, bN as buildOrderMessage, bz as buildPolymarketL2Headers, bO as buildSignedOrder, aj as createPredictClient, al as createPredictWsClient, bA as derivePolymarketApiKey, bg as eventQueryKey, bh as fetchEvent, bl as fetchEventsPage, bp as fetchMarket, bu as fetchMatchMarketsPage, bs as fetchMatchesPage, by as hmacSha256Base64, bk as infiniteEventsQueryKey, bo as marketQueryKey, bt as matchMarketsQueryKey, br as matchQueryKey, bq as matchesQueryKey, bj as resolveEventsParams, bi as resolveTagSlug } from './server-pS5Vlydo.js';
package/dist/server.js CHANGED
@@ -53,11 +53,11 @@ function infiniteEventsQueryKey(params) {
53
53
  async function fetchEventsPage(client, params) {
54
54
  return client.listEvents(params);
55
55
  }
56
- function eventQueryKey(slug, source) {
57
- return ["predict", "event", slug, source];
56
+ function eventQueryKey(slug, source, lang) {
57
+ return ["predict", "event", slug, source, lang];
58
58
  }
59
- async function fetchEvent(client, slug, source) {
60
- return client.getEvent(slug, source);
59
+ async function fetchEvent(client, slug, source, lang) {
60
+ return client.getEvent(slug, source, { lang });
61
61
  }
62
62
 
63
63
  // src/hooks/predict/market.params.ts
@@ -139,8 +139,8 @@ var PredictClient = class {
139
139
  * @returns The matching event.
140
140
  * @throws When the server responds with 404 or any other non-2xx status.
141
141
  */
142
- async getEvent(slug, source) {
143
- const query = source ? buildQuery({ source }) : "";
142
+ async getEvent(slug, source, params) {
143
+ const query = buildQuery({ source, ...params });
144
144
  const url = `${this.endpoint}/api/v1/events/${encodeURIComponent(slug)}${query}`;
145
145
  return await utils.httpGet(url, this.requestOptions());
146
146
  }