@liberfi.io/react-predict 0.3.56 → 0.3.57
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +21 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -7
- package/dist/index.mjs.map +1 -1
- package/dist/{server-DoNRmZzs.d.mts → server-h41hs9SR.d.mts} +18 -3
- package/dist/{server-DoNRmZzs.d.ts → server-h41hs9SR.d.ts} +18 -3
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +21 -7
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +21 -7
- package/dist/server.mjs.map +1 -1
- package/package.json +3 -3
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 PolymarketTypedData, a9 as TickSizeResponse, aa as FeeRateResponse, ab as RebateConfig, ac as WsConnectionStatus, ad as WsDataMessage, ae as WsPriceEvent, af as WsOrderbookEvent, ag as WsTradeEvent, ah as CreateOrderInput } from './server-
|
|
2
|
-
export {
|
|
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 PolymarketTypedData, a9 as TickSizeResponse, aa as FeeRateResponse, ab as RebateConfig, ac as WsConnectionStatus, ad as WsDataMessage, ae as WsPriceEvent, af as WsOrderbookEvent, ag as WsTradeEvent, ah as CreateOrderInput } from './server-h41hs9SR.mjs';
|
|
2
|
+
export { bA as BuildClobAuthMessageInput, bO as BuildOrderMessageInput, br as CLOB_AUTH_DOMAIN, bs as CLOB_AUTH_TYPES, bB as CTF_EXCHANGE_ADDRESS, bG as CTF_ORDER_TYPES, bN as ClobOrderPayload, aF as DFlowOrderContext, aJ as DepositBuildRequest, aK as DepositBuildResponse, aN as DepositStatusResponse, aL as DepositSubmitRequest, aM as DepositSubmitResponse, ay as EventSummary, bx as HttpMethod, ar as MarketOutcome, aq as MarketResult, ap as MarketStatus, az as MarketSummary, aX as MatchConfidenceTier, aT as MatchGroupEntry, aU as MatchGroupMarket, aZ as MatchLeg, a_ as MatchMarketFlat, aV as MatchSortField, aS as MatchStatus, aW as MatchesStats, bC as NEG_RISK_CTF_EXCHANGE_ADDRESS, bH as ORDER_TYPE, bP as OrderMessage, aE as OrderSide, aD as OrderStatus, at as OrderbookBatchItem, au as OrderbookBatchResult, as as OrderbookLevel, av as OrderbooksBatchRequest, aw as OrderbooksBatchResponse, bE as POLYGON_CHAIN_ID, aP as PolymarketBridgeToken, aI as PolymarketDepositWalletDeployRequest, bz as PolymarketL2Headers, by as PolymarketL2HeadersInput, aG as PolymarketOrderType, bb as PolymarketRedeemInput, b9 as PolymarketRedeemPrepareInput, ba as PolymarketRedeemPrepareResponse, aQ as PolymarketSupportedAssetsResponse, aR as PolymarketTypedDataArg, aH as PolymarketWalletKind, aj as PredictClientOptions, aA as PredictCommentProfile, aC as PredictPosition, an as PredictTag, al as PredictWsClientConfig, aB as PricePoint, am as ProviderMeta, bi as ResolveEventsParamsInput, bI as SIDE, ao as SettlementSource, aY as SignalTag, bQ as SignedOrder, bj as TagSlugSelection, ax as TradeType, bD as USDC_ADDRESS, aO as UnsignedTx, a$ as WsChannel, b0 as WsChannelEvent, b1 as WsClientMessage, b7 as WsErrorCode, b8 as WsErrorMessage, b3 as WsPingMessage, b5 as WsPongMessage, b4 as WsServerMessage, b2 as WsSubscribeMessage, b6 as WsSubscribedMessage, bt as buildClobAuthMessage, bL as buildClobPayload, bF as buildCtfExchangeDomain, bJ as buildOrderMessage, bv as buildPolymarketL2Headers, bK as buildSignedOrder, ai as createPredictClient, ak as createPredictWsClient, bw as derivePolymarketApiKey, bc as eventQueryKey, bd as fetchEvent, bh as fetchEventsPage, bl as fetchMarket, bq as fetchMatchMarketsPage, bo as fetchMatchesPage, bM as getPolymarketSharesPrecision, bu as hmacSha256Base64, bg as infiniteEventsQueryKey, bk as marketQueryKey, bp as matchMarketsQueryKey, bn as matchQueryKey, bm as matchesQueryKey, bf as resolveEventsParams, be as resolveTagSlug } from './server-h41hs9SR.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 PolymarketTypedData, a9 as TickSizeResponse, aa as FeeRateResponse, ab as RebateConfig, ac as WsConnectionStatus, ad as WsDataMessage, ae as WsPriceEvent, af as WsOrderbookEvent, ag as WsTradeEvent, ah as CreateOrderInput } from './server-
|
|
2
|
-
export {
|
|
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 PolymarketTypedData, a9 as TickSizeResponse, aa as FeeRateResponse, ab as RebateConfig, ac as WsConnectionStatus, ad as WsDataMessage, ae as WsPriceEvent, af as WsOrderbookEvent, ag as WsTradeEvent, ah as CreateOrderInput } from './server-h41hs9SR.js';
|
|
2
|
+
export { bA as BuildClobAuthMessageInput, bO as BuildOrderMessageInput, br as CLOB_AUTH_DOMAIN, bs as CLOB_AUTH_TYPES, bB as CTF_EXCHANGE_ADDRESS, bG as CTF_ORDER_TYPES, bN as ClobOrderPayload, aF as DFlowOrderContext, aJ as DepositBuildRequest, aK as DepositBuildResponse, aN as DepositStatusResponse, aL as DepositSubmitRequest, aM as DepositSubmitResponse, ay as EventSummary, bx as HttpMethod, ar as MarketOutcome, aq as MarketResult, ap as MarketStatus, az as MarketSummary, aX as MatchConfidenceTier, aT as MatchGroupEntry, aU as MatchGroupMarket, aZ as MatchLeg, a_ as MatchMarketFlat, aV as MatchSortField, aS as MatchStatus, aW as MatchesStats, bC as NEG_RISK_CTF_EXCHANGE_ADDRESS, bH as ORDER_TYPE, bP as OrderMessage, aE as OrderSide, aD as OrderStatus, at as OrderbookBatchItem, au as OrderbookBatchResult, as as OrderbookLevel, av as OrderbooksBatchRequest, aw as OrderbooksBatchResponse, bE as POLYGON_CHAIN_ID, aP as PolymarketBridgeToken, aI as PolymarketDepositWalletDeployRequest, bz as PolymarketL2Headers, by as PolymarketL2HeadersInput, aG as PolymarketOrderType, bb as PolymarketRedeemInput, b9 as PolymarketRedeemPrepareInput, ba as PolymarketRedeemPrepareResponse, aQ as PolymarketSupportedAssetsResponse, aR as PolymarketTypedDataArg, aH as PolymarketWalletKind, aj as PredictClientOptions, aA as PredictCommentProfile, aC as PredictPosition, an as PredictTag, al as PredictWsClientConfig, aB as PricePoint, am as ProviderMeta, bi as ResolveEventsParamsInput, bI as SIDE, ao as SettlementSource, aY as SignalTag, bQ as SignedOrder, bj as TagSlugSelection, ax as TradeType, bD as USDC_ADDRESS, aO as UnsignedTx, a$ as WsChannel, b0 as WsChannelEvent, b1 as WsClientMessage, b7 as WsErrorCode, b8 as WsErrorMessage, b3 as WsPingMessage, b5 as WsPongMessage, b4 as WsServerMessage, b2 as WsSubscribeMessage, b6 as WsSubscribedMessage, bt as buildClobAuthMessage, bL as buildClobPayload, bF as buildCtfExchangeDomain, bJ as buildOrderMessage, bv as buildPolymarketL2Headers, bK as buildSignedOrder, ai as createPredictClient, ak as createPredictWsClient, bw as derivePolymarketApiKey, bc as eventQueryKey, bd as fetchEvent, bh as fetchEventsPage, bl as fetchMarket, bq as fetchMatchMarketsPage, bo as fetchMatchesPage, bM as getPolymarketSharesPrecision, bu as hmacSha256Base64, bg as infiniteEventsQueryKey, bk as marketQueryKey, bp as matchMarketsQueryKey, bn as matchQueryKey, bm as matchesQueryKey, bf as resolveEventsParams, be as resolveTagSlug } from './server-h41hs9SR.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
|
@@ -18,8 +18,20 @@ function buildQuery(params) {
|
|
|
18
18
|
return str ? `?${str}` : "";
|
|
19
19
|
}
|
|
20
20
|
var PredictClient = class {
|
|
21
|
-
constructor(endpoint) {
|
|
21
|
+
constructor(endpoint, options = {}) {
|
|
22
22
|
this.endpoint = endpoint;
|
|
23
|
+
this.options = options;
|
|
24
|
+
}
|
|
25
|
+
requestOptions(options) {
|
|
26
|
+
const baseHeaders = typeof this.options.headers === "function" ? this.options.headers() : this.options.headers;
|
|
27
|
+
if (!baseHeaders && !options) return void 0;
|
|
28
|
+
return {
|
|
29
|
+
...options,
|
|
30
|
+
headers: {
|
|
31
|
+
...baseHeaders ? Object.fromEntries(new Headers(baseHeaders)) : {},
|
|
32
|
+
...options?.headers ? Object.fromEntries(new Headers(options.headers)) : {}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
23
35
|
}
|
|
24
36
|
// -------------------------------------------------------------------------
|
|
25
37
|
// Events
|
|
@@ -35,7 +47,7 @@ var PredictClient = class {
|
|
|
35
47
|
async listEvents(params) {
|
|
36
48
|
const query = buildQuery(params ?? {});
|
|
37
49
|
const url = `${this.endpoint}/api/v1/events${query}`;
|
|
38
|
-
return await utils.httpGet(url);
|
|
50
|
+
return await utils.httpGet(url, this.requestOptions());
|
|
39
51
|
}
|
|
40
52
|
/**
|
|
41
53
|
* Fetch a single prediction event by its slug.
|
|
@@ -51,7 +63,7 @@ var PredictClient = class {
|
|
|
51
63
|
async getEvent(slug, source) {
|
|
52
64
|
const query = source ? buildQuery({ source }) : "";
|
|
53
65
|
const url = `${this.endpoint}/api/v1/events/${encodeURIComponent(slug)}${query}`;
|
|
54
|
-
return await utils.httpGet(url);
|
|
66
|
+
return await utils.httpGet(url, this.requestOptions());
|
|
55
67
|
}
|
|
56
68
|
/**
|
|
57
69
|
* Fetch aggregate statistics for all open events.
|
|
@@ -542,8 +554,8 @@ var PredictClient = class {
|
|
|
542
554
|
return await utils.httpPost(url, body);
|
|
543
555
|
}
|
|
544
556
|
};
|
|
545
|
-
function createPredictClient(endpoint) {
|
|
546
|
-
return new PredictClient(endpoint);
|
|
557
|
+
function createPredictClient(endpoint, options) {
|
|
558
|
+
return new PredictClient(endpoint, options);
|
|
547
559
|
}
|
|
548
560
|
|
|
549
561
|
// src/client/ws.ts
|
|
@@ -1147,7 +1159,8 @@ function resolveEventsParams(input = {}) {
|
|
|
1147
1159
|
minVolume,
|
|
1148
1160
|
minLiquidity,
|
|
1149
1161
|
timeRemaining,
|
|
1150
|
-
markets_limit = 3
|
|
1162
|
+
markets_limit = 3,
|
|
1163
|
+
lang
|
|
1151
1164
|
} = input;
|
|
1152
1165
|
const tag_slug = resolveTagSlug(tagSlugSelection);
|
|
1153
1166
|
const min_volume = minVolume !== void 0 && minVolume !== "" ? Number(minVolume) : void 0;
|
|
@@ -1164,7 +1177,8 @@ function resolveEventsParams(input = {}) {
|
|
|
1164
1177
|
...min_volume !== void 0 && !isNaN(min_volume) ? { min_volume } : {},
|
|
1165
1178
|
...min_liquidity !== void 0 && !isNaN(min_liquidity) ? { min_liquidity } : {},
|
|
1166
1179
|
...end_before ? { end_before } : {},
|
|
1167
|
-
...markets_limit ? { markets_limit } : {}
|
|
1180
|
+
...markets_limit ? { markets_limit } : {},
|
|
1181
|
+
...lang ? { lang } : {}
|
|
1168
1182
|
};
|
|
1169
1183
|
}
|
|
1170
1184
|
function infiniteEventsQueryKey(params) {
|