@liberfi.io/react-predict 0.1.49 → 0.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +64 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -15
- package/dist/index.mjs.map +1 -1
- package/dist/{server-rYuNULuJ.d.mts → server-CaB0XJAa.d.mts} +23 -1
- package/dist/{server-rYuNULuJ.d.ts → server-CaB0XJAa.d.ts} +23 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +30 -14
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +30 -14
- 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 Orderbook, h as ListMarketTradesParams, i as PredictTrade, j as PriceHistoryRange, k as PriceHistoryResponse, l as ListCandlesticksParams, C as Candlestick, m as PositionsResponse, B as BalanceResponse, n as ListOrdersParams, o as PredictOrder, p as CancelOrderResult, M as MatchesParams, q as MatchGroupPage, r as MatchGroup, s as MatchMarketParams, t as MatchMarketPage, u as ListTradesParams, D as DFlowQuoteRequest, v as DFlowQuoteResponse, w as DFlowSubmitResponse, x as DFlowSubmitRequest, y as DFlowKYCStatus, z as PolymarketSetupStatus, W as WithdrawBuildResponse,
|
|
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 Orderbook, h as ListMarketTradesParams, i as PredictTrade, j as PriceHistoryRange, k as PriceHistoryResponse, l as ListCandlesticksParams, C as Candlestick, m as PositionsResponse, A as AvailableSharesResponse, B as BalanceResponse, n as ListOrdersParams, o as PredictOrder, p as CancelOrderResult, M as MatchesParams, q as MatchGroupPage, r as MatchGroup, s as MatchMarketParams, t as MatchMarketPage, u as ListTradesParams, D as DFlowQuoteRequest, v as DFlowQuoteResponse, w as DFlowSubmitResponse, x as DFlowSubmitRequest, y as DFlowKYCStatus, z as PolymarketSetupStatus, W as WithdrawBuildResponse, F as WithdrawBuildRequest, G as WithdrawSubmitResponse, H as WithdrawSubmitRequest, I as WithdrawStatusResponse, J as PolymarketDepositAddresses, K as PolymarketWithdrawResponse, N as PolymarketWithdrawRequest, T as TickSizeResponse, Q as WsConnectionStatus, R as WsDataMessage, U as WsPriceEvent, V as WsOrderbookEvent, X as WsTradeEvent, Y as CreateOrderInput } from './server-CaB0XJAa.mjs';
|
|
2
|
+
export { a$ as BuildClobAuthMessageInput, bc as BuildOrderMessageInput, aS as CLOB_AUTH_DOMAIN, aT as CLOB_AUTH_TYPES, b0 as CTF_EXCHANGE_ADDRESS, b5 as CTF_ORDER_TYPES, bb as ClobOrderPayload, ae as DFlowOrderContext, ag as DepositBuildRequest, ah as DepositBuildResponse, ak as DepositStatusResponse, ai as DepositSubmitRequest, aj as DepositSubmitResponse, a8 as EventSummary, aY as HttpMethod, a5 as MarketOutcome, a4 as MarketResult, a3 as MarketStatus, a9 as MarketSummary, ar as MatchConfidenceTier, an as MatchGroupEntry, ao as MatchGroupMarket, as as MatchMarketFlat, ap as MatchSortField, am as MatchStatus, aq as MatchesStats, b1 as NEG_RISK_CTF_EXCHANGE_ADDRESS, b6 as ORDER_TYPE, bd as OrderMessage, ad as OrderSide, ac as OrderStatus, a6 as OrderbookLevel, b3 as POLYGON_CHAIN_ID, a_ as PolymarketL2Headers, aZ as PolymarketL2HeadersInput, af as PolymarketOrderType, ab as PredictPosition, a1 as PredictTag, $ as PredictWsClientConfig, aa as PricePoint, a0 as ProviderMeta, aJ as ResolveEventsParamsInput, b7 as SIDE, a2 as SettlementSource, be as SignedOrder, aK as TagSlugSelection, a7 as TradeType, b2 as USDC_ADDRESS, al as UnsignedTx, at as WsChannel, au as WsChannelEvent, av as WsClientMessage, aB as WsErrorCode, aC as WsErrorMessage, ax as WsPingMessage, az as WsPongMessage, ay as WsServerMessage, aw as WsSubscribeMessage, aA as WsSubscribedMessage, aU as buildClobAuthMessage, ba as buildClobPayload, b4 as buildCtfExchangeDomain, b8 as buildOrderMessage, aW as buildPolymarketL2Headers, b9 as buildSignedOrder, Z as createPredictClient, _ as createPredictWsClient, aX as derivePolymarketApiKey, aD as eventQueryKey, aE as fetchEvent, aI as fetchEventsPage, aM as fetchMarket, aR as fetchMatchMarketsPage, aP as fetchMatchesPage, aV as hmacSha256Base64, aH as infiniteEventsQueryKey, aL as marketQueryKey, aQ as matchMarketsQueryKey, aO as matchQueryKey, aN as matchesQueryKey, aG as resolveEventsParams, aF as resolveTagSlug } from './server-CaB0XJAa.mjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { PropsWithChildren } from 'react';
|
|
@@ -392,6 +392,22 @@ declare function usePositions(params: UsePositionsParams, queryOptions?: Omit<Us
|
|
|
392
392
|
*/
|
|
393
393
|
declare function usePositionsMulti(params: UsePositionsMultiParams, queryOptions?: Omit<UseQueryOptions<PositionsResponse, Error, PositionsResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PositionsResponse, Error>;
|
|
394
394
|
|
|
395
|
+
interface UseAvailableSharesParams {
|
|
396
|
+
source: ProviderSource;
|
|
397
|
+
user: string;
|
|
398
|
+
market: string;
|
|
399
|
+
side: string;
|
|
400
|
+
}
|
|
401
|
+
declare function availableSharesQueryKey(params: UseAvailableSharesParams): unknown[];
|
|
402
|
+
interface UseAvailableSharesOptions {
|
|
403
|
+
/**
|
|
404
|
+
* Async callback invoked before each request to obtain extra headers.
|
|
405
|
+
* Used by Polymarket to attach POLY_* HMAC authentication headers.
|
|
406
|
+
*/
|
|
407
|
+
getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
|
|
408
|
+
}
|
|
409
|
+
declare function useAvailableShares(params: UseAvailableSharesParams, options?: UseAvailableSharesOptions, queryOptions?: Omit<UseQueryOptions<AvailableSharesResponse, Error, AvailableSharesResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<AvailableSharesResponse, Error>;
|
|
410
|
+
|
|
395
411
|
declare function balanceQueryKey(source: ProviderSource, user: string): unknown[];
|
|
396
412
|
interface UseBalanceParams {
|
|
397
413
|
source: ProviderSource;
|
|
@@ -808,4 +824,4 @@ interface CreatePolymarketOrderVariables {
|
|
|
808
824
|
*/
|
|
809
825
|
declare function useCreatePolymarketOrder(mutationOptions?: Omit<UseMutationOptions<PredictOrder, Error, CreatePolymarketOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<PredictOrder, Error, CreatePolymarketOrderVariables, unknown>;
|
|
810
826
|
|
|
811
|
-
export { BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketProvider, type PolymarketProviderProps, type PolymarketSigner, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionsResponse, PredictClient, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, SimilarEventsParams, TickSizeResponse, type UseBalanceParams, type UseCandlesticksParams, type UseEventParams, type UseInfiniteMatchMarketsParams, type UseInfiniteMatchesParams, type UseInfiniteOrdersOptions, type UseInfiniteOrdersParams, type UseInfiniteTradesParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UseOrdersOptions, type UsePositionsMultiParams, type UsePositionsParams, type UsePredictWsClientResult, type UsePriceHistoryParams, type UsePricesSubscriptionParams, type UsePricesSubscriptionResult, type UseRealtimeOrderbookParams, type UseRealtimePricesParams, type UseRealtimeTradesParams, type UseRealtimeTradesResult, type UseSearchEventsParams, type UseSimilarEventsParams, type UseTradesSubscriptionParams, type UseTradesSubscriptionResult, type UseWithdrawStatusQueryParams, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, balanceQueryKey, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, useEventStats, useEvents, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketWithdraw, usePositions, usePositionsMulti, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useTickSize, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, withdrawStatusQueryKey };
|
|
827
|
+
export { AvailableSharesResponse, BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketProvider, type PolymarketProviderProps, type PolymarketSigner, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionsResponse, PredictClient, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, SimilarEventsParams, TickSizeResponse, type UseAvailableSharesOptions, type UseAvailableSharesParams, type UseBalanceParams, type UseCandlesticksParams, type UseEventParams, type UseInfiniteMatchMarketsParams, type UseInfiniteMatchesParams, type UseInfiniteOrdersOptions, type UseInfiniteOrdersParams, type UseInfiniteTradesParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UseOrdersOptions, type UsePositionsMultiParams, type UsePositionsParams, type UsePredictWsClientResult, type UsePriceHistoryParams, type UsePricesSubscriptionParams, type UsePricesSubscriptionResult, type UseRealtimeOrderbookParams, type UseRealtimePricesParams, type UseRealtimeTradesParams, type UseRealtimeTradesResult, type UseSearchEventsParams, type UseSimilarEventsParams, type UseTradesSubscriptionParams, type UseTradesSubscriptionResult, type UseWithdrawStatusQueryParams, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, availableSharesQueryKey, balanceQueryKey, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, useAvailableShares, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, useEventStats, useEvents, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketWithdraw, usePositions, usePositionsMulti, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useTickSize, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, withdrawStatusQueryKey };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PredictClient, a as PredictWsClient, L as ListEventsParams, b as PredictPage, c as PredictEvent, d as ProviderSource, E as EventStats, e as EventStatus, f as EventSortField, S as SimilarEventsParams, g as PredictMarket, O as Orderbook, h as ListMarketTradesParams, i as PredictTrade, j as PriceHistoryRange, k as PriceHistoryResponse, l as ListCandlesticksParams, C as Candlestick, m as PositionsResponse, B as BalanceResponse, n as ListOrdersParams, o as PredictOrder, p as CancelOrderResult, M as MatchesParams, q as MatchGroupPage, r as MatchGroup, s as MatchMarketParams, t as MatchMarketPage, u as ListTradesParams, D as DFlowQuoteRequest, v as DFlowQuoteResponse, w as DFlowSubmitResponse, x as DFlowSubmitRequest, y as DFlowKYCStatus, z as PolymarketSetupStatus, W as WithdrawBuildResponse,
|
|
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 Orderbook, h as ListMarketTradesParams, i as PredictTrade, j as PriceHistoryRange, k as PriceHistoryResponse, l as ListCandlesticksParams, C as Candlestick, m as PositionsResponse, A as AvailableSharesResponse, B as BalanceResponse, n as ListOrdersParams, o as PredictOrder, p as CancelOrderResult, M as MatchesParams, q as MatchGroupPage, r as MatchGroup, s as MatchMarketParams, t as MatchMarketPage, u as ListTradesParams, D as DFlowQuoteRequest, v as DFlowQuoteResponse, w as DFlowSubmitResponse, x as DFlowSubmitRequest, y as DFlowKYCStatus, z as PolymarketSetupStatus, W as WithdrawBuildResponse, F as WithdrawBuildRequest, G as WithdrawSubmitResponse, H as WithdrawSubmitRequest, I as WithdrawStatusResponse, J as PolymarketDepositAddresses, K as PolymarketWithdrawResponse, N as PolymarketWithdrawRequest, T as TickSizeResponse, Q as WsConnectionStatus, R as WsDataMessage, U as WsPriceEvent, V as WsOrderbookEvent, X as WsTradeEvent, Y as CreateOrderInput } from './server-CaB0XJAa.js';
|
|
2
|
+
export { a$ as BuildClobAuthMessageInput, bc as BuildOrderMessageInput, aS as CLOB_AUTH_DOMAIN, aT as CLOB_AUTH_TYPES, b0 as CTF_EXCHANGE_ADDRESS, b5 as CTF_ORDER_TYPES, bb as ClobOrderPayload, ae as DFlowOrderContext, ag as DepositBuildRequest, ah as DepositBuildResponse, ak as DepositStatusResponse, ai as DepositSubmitRequest, aj as DepositSubmitResponse, a8 as EventSummary, aY as HttpMethod, a5 as MarketOutcome, a4 as MarketResult, a3 as MarketStatus, a9 as MarketSummary, ar as MatchConfidenceTier, an as MatchGroupEntry, ao as MatchGroupMarket, as as MatchMarketFlat, ap as MatchSortField, am as MatchStatus, aq as MatchesStats, b1 as NEG_RISK_CTF_EXCHANGE_ADDRESS, b6 as ORDER_TYPE, bd as OrderMessage, ad as OrderSide, ac as OrderStatus, a6 as OrderbookLevel, b3 as POLYGON_CHAIN_ID, a_ as PolymarketL2Headers, aZ as PolymarketL2HeadersInput, af as PolymarketOrderType, ab as PredictPosition, a1 as PredictTag, $ as PredictWsClientConfig, aa as PricePoint, a0 as ProviderMeta, aJ as ResolveEventsParamsInput, b7 as SIDE, a2 as SettlementSource, be as SignedOrder, aK as TagSlugSelection, a7 as TradeType, b2 as USDC_ADDRESS, al as UnsignedTx, at as WsChannel, au as WsChannelEvent, av as WsClientMessage, aB as WsErrorCode, aC as WsErrorMessage, ax as WsPingMessage, az as WsPongMessage, ay as WsServerMessage, aw as WsSubscribeMessage, aA as WsSubscribedMessage, aU as buildClobAuthMessage, ba as buildClobPayload, b4 as buildCtfExchangeDomain, b8 as buildOrderMessage, aW as buildPolymarketL2Headers, b9 as buildSignedOrder, Z as createPredictClient, _ as createPredictWsClient, aX as derivePolymarketApiKey, aD as eventQueryKey, aE as fetchEvent, aI as fetchEventsPage, aM as fetchMarket, aR as fetchMatchMarketsPage, aP as fetchMatchesPage, aV as hmacSha256Base64, aH as infiniteEventsQueryKey, aL as marketQueryKey, aQ as matchMarketsQueryKey, aO as matchQueryKey, aN as matchesQueryKey, aG as resolveEventsParams, aF as resolveTagSlug } from './server-CaB0XJAa.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { PropsWithChildren } from 'react';
|
|
@@ -392,6 +392,22 @@ declare function usePositions(params: UsePositionsParams, queryOptions?: Omit<Us
|
|
|
392
392
|
*/
|
|
393
393
|
declare function usePositionsMulti(params: UsePositionsMultiParams, queryOptions?: Omit<UseQueryOptions<PositionsResponse, Error, PositionsResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PositionsResponse, Error>;
|
|
394
394
|
|
|
395
|
+
interface UseAvailableSharesParams {
|
|
396
|
+
source: ProviderSource;
|
|
397
|
+
user: string;
|
|
398
|
+
market: string;
|
|
399
|
+
side: string;
|
|
400
|
+
}
|
|
401
|
+
declare function availableSharesQueryKey(params: UseAvailableSharesParams): unknown[];
|
|
402
|
+
interface UseAvailableSharesOptions {
|
|
403
|
+
/**
|
|
404
|
+
* Async callback invoked before each request to obtain extra headers.
|
|
405
|
+
* Used by Polymarket to attach POLY_* HMAC authentication headers.
|
|
406
|
+
*/
|
|
407
|
+
getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
|
|
408
|
+
}
|
|
409
|
+
declare function useAvailableShares(params: UseAvailableSharesParams, options?: UseAvailableSharesOptions, queryOptions?: Omit<UseQueryOptions<AvailableSharesResponse, Error, AvailableSharesResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<AvailableSharesResponse, Error>;
|
|
410
|
+
|
|
395
411
|
declare function balanceQueryKey(source: ProviderSource, user: string): unknown[];
|
|
396
412
|
interface UseBalanceParams {
|
|
397
413
|
source: ProviderSource;
|
|
@@ -808,4 +824,4 @@ interface CreatePolymarketOrderVariables {
|
|
|
808
824
|
*/
|
|
809
825
|
declare function useCreatePolymarketOrder(mutationOptions?: Omit<UseMutationOptions<PredictOrder, Error, CreatePolymarketOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<PredictOrder, Error, CreatePolymarketOrderVariables, unknown>;
|
|
810
826
|
|
|
811
|
-
export { BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketProvider, type PolymarketProviderProps, type PolymarketSigner, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionsResponse, PredictClient, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, SimilarEventsParams, TickSizeResponse, type UseBalanceParams, type UseCandlesticksParams, type UseEventParams, type UseInfiniteMatchMarketsParams, type UseInfiniteMatchesParams, type UseInfiniteOrdersOptions, type UseInfiniteOrdersParams, type UseInfiniteTradesParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UseOrdersOptions, type UsePositionsMultiParams, type UsePositionsParams, type UsePredictWsClientResult, type UsePriceHistoryParams, type UsePricesSubscriptionParams, type UsePricesSubscriptionResult, type UseRealtimeOrderbookParams, type UseRealtimePricesParams, type UseRealtimeTradesParams, type UseRealtimeTradesResult, type UseSearchEventsParams, type UseSimilarEventsParams, type UseTradesSubscriptionParams, type UseTradesSubscriptionResult, type UseWithdrawStatusQueryParams, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, balanceQueryKey, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, useEventStats, useEvents, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketWithdraw, usePositions, usePositionsMulti, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useTickSize, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, withdrawStatusQueryKey };
|
|
827
|
+
export { AvailableSharesResponse, BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketProvider, type PolymarketProviderProps, type PolymarketSigner, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionsResponse, PredictClient, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, SimilarEventsParams, TickSizeResponse, type UseAvailableSharesOptions, type UseAvailableSharesParams, type UseBalanceParams, type UseCandlesticksParams, type UseEventParams, type UseInfiniteMatchMarketsParams, type UseInfiniteMatchesParams, type UseInfiniteOrdersOptions, type UseInfiniteOrdersParams, type UseInfiniteTradesParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UseOrdersOptions, type UsePositionsMultiParams, type UsePositionsParams, type UsePredictWsClientResult, type UsePriceHistoryParams, type UsePricesSubscriptionParams, type UsePricesSubscriptionResult, type UseRealtimeOrderbookParams, type UseRealtimePricesParams, type UseRealtimeTradesParams, type UseRealtimeTradesResult, type UseSearchEventsParams, type UseSimilarEventsParams, type UseTradesSubscriptionParams, type UseTradesSubscriptionResult, type UseWithdrawStatusQueryParams, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, availableSharesQueryKey, balanceQueryKey, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, useAvailableShares, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, useEventStats, useEvents, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketWithdraw, usePositions, usePositionsMulti, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useTickSize, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, withdrawStatusQueryKey };
|
package/dist/index.js
CHANGED
|
@@ -134,6 +134,28 @@ var PredictClient = class {
|
|
|
134
134
|
return await utils.httpGet(url);
|
|
135
135
|
}
|
|
136
136
|
// -------------------------------------------------------------------------
|
|
137
|
+
// Available shares (for sell flow)
|
|
138
|
+
// -------------------------------------------------------------------------
|
|
139
|
+
/**
|
|
140
|
+
* Get the number of shares available for selling, accounting for active orders.
|
|
141
|
+
*
|
|
142
|
+
* Maps to `GET /api/v1/available-shares?source=...&user=...&market=...&side=...`.
|
|
143
|
+
*
|
|
144
|
+
* @param source - Provider source.
|
|
145
|
+
* @param user - Wallet address.
|
|
146
|
+
* @param market - Market slug.
|
|
147
|
+
* @param side - Position side ("yes" or "no").
|
|
148
|
+
* @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
|
|
149
|
+
*/
|
|
150
|
+
async getAvailableShares(source, user, market, side, headers) {
|
|
151
|
+
const query = buildQuery({ source, user, market, side });
|
|
152
|
+
const url = `${this.endpoint}/api/v1/available-shares${query}`;
|
|
153
|
+
return await utils.httpGet(
|
|
154
|
+
url,
|
|
155
|
+
headers ? { headers } : void 0
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
// -------------------------------------------------------------------------
|
|
137
159
|
// Balance
|
|
138
160
|
// -------------------------------------------------------------------------
|
|
139
161
|
/**
|
|
@@ -1225,6 +1247,7 @@ function usePositions(params, queryOptions = {}) {
|
|
|
1225
1247
|
queryFn: () => client.getPositions(params.user, params.source),
|
|
1226
1248
|
enabled: Boolean(params.user),
|
|
1227
1249
|
staleTime: 1e4,
|
|
1250
|
+
refetchInterval: 3e4,
|
|
1228
1251
|
...queryOptions
|
|
1229
1252
|
});
|
|
1230
1253
|
}
|
|
@@ -1236,6 +1259,37 @@ function usePositionsMulti(params, queryOptions = {}) {
|
|
|
1236
1259
|
queryFn: () => client.getPositions(params),
|
|
1237
1260
|
enabled: hasAnyWallet,
|
|
1238
1261
|
staleTime: 1e4,
|
|
1262
|
+
refetchInterval: 3e4,
|
|
1263
|
+
...queryOptions
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
function availableSharesQueryKey(params) {
|
|
1267
|
+
return [
|
|
1268
|
+
"predict",
|
|
1269
|
+
"available-shares",
|
|
1270
|
+
params.source,
|
|
1271
|
+
params.user,
|
|
1272
|
+
params.market,
|
|
1273
|
+
params.side
|
|
1274
|
+
];
|
|
1275
|
+
}
|
|
1276
|
+
function useAvailableShares(params, options, queryOptions = {}) {
|
|
1277
|
+
const client = usePredictClient();
|
|
1278
|
+
return reactQuery.useQuery({
|
|
1279
|
+
queryKey: availableSharesQueryKey(params),
|
|
1280
|
+
queryFn: async () => {
|
|
1281
|
+
const headers = await options?.getHeaders?.();
|
|
1282
|
+
return client.getAvailableShares(
|
|
1283
|
+
params.source,
|
|
1284
|
+
params.user,
|
|
1285
|
+
params.market,
|
|
1286
|
+
params.side,
|
|
1287
|
+
headers
|
|
1288
|
+
);
|
|
1289
|
+
},
|
|
1290
|
+
enabled: Boolean(params.user && params.market && params.side),
|
|
1291
|
+
staleTime: 5e3,
|
|
1292
|
+
refetchInterval: 1e4,
|
|
1239
1293
|
...queryOptions
|
|
1240
1294
|
});
|
|
1241
1295
|
}
|
|
@@ -1883,17 +1937,13 @@ var DEFAULT_ROUNDING = { size: 2, price: 2, amount: 4 };
|
|
|
1883
1937
|
function decimalPlaces(n, d) {
|
|
1884
1938
|
return parseFloat(n.toFixed(d));
|
|
1885
1939
|
}
|
|
1940
|
+
function floorDecimalPlaces(n, d) {
|
|
1941
|
+
const factor = 10 ** d;
|
|
1942
|
+
return Math.floor(n * factor) / factor;
|
|
1943
|
+
}
|
|
1886
1944
|
function toMicroUsdc(amount) {
|
|
1887
1945
|
return BigInt(Math.round(amount * 1e6));
|
|
1888
1946
|
}
|
|
1889
|
-
function ceilMicro(raw, maxDecimals) {
|
|
1890
|
-
const factor = BigInt(10 ** (6 - maxDecimals));
|
|
1891
|
-
return (raw + factor - 1n) / factor * factor;
|
|
1892
|
-
}
|
|
1893
|
-
function floorMicro(raw, maxDecimals) {
|
|
1894
|
-
const factor = BigInt(10 ** (6 - maxDecimals));
|
|
1895
|
-
return raw / factor * factor;
|
|
1896
|
-
}
|
|
1897
1947
|
function normalizeTokenId(tokenId) {
|
|
1898
1948
|
if (tokenId.startsWith("0x") || tokenId.startsWith("0X")) {
|
|
1899
1949
|
return BigInt(tokenId).toString(10);
|
|
@@ -1904,14 +1954,12 @@ function buildOrderMessage(input) {
|
|
|
1904
1954
|
const side = input.side === "BUY" ? SIDE.BUY : SIDE.SELL;
|
|
1905
1955
|
const rc = ROUNDING_CONFIG[input.tickSize] ?? DEFAULT_ROUNDING;
|
|
1906
1956
|
const rawPrice = decimalPlaces(input.price, rc.price);
|
|
1907
|
-
const rawSize = decimalPlaces(input.size, rc.size);
|
|
1908
|
-
const rawAmount = decimalPlaces(rawSize * rawPrice, rc.amount);
|
|
1957
|
+
const rawSize = side === SIDE.SELL ? floorDecimalPlaces(input.size, rc.size) : decimalPlaces(input.size, rc.size);
|
|
1909
1958
|
const sizeInMicro = toMicroUsdc(rawSize);
|
|
1959
|
+
const rawAmount = decimalPlaces(rawSize * rawPrice, rc.amount);
|
|
1910
1960
|
const amountInMicro = toMicroUsdc(rawAmount);
|
|
1911
|
-
const
|
|
1912
|
-
const
|
|
1913
|
-
const makerAmount = side === SIDE.BUY ? usdcMicro.toString() : sharesMicro.toString();
|
|
1914
|
-
const takerAmount = side === SIDE.BUY ? sharesMicro.toString() : usdcMicro.toString();
|
|
1961
|
+
const makerAmount = side === SIDE.BUY ? amountInMicro.toString() : sizeInMicro.toString();
|
|
1962
|
+
const takerAmount = side === SIDE.BUY ? sizeInMicro.toString() : amountInMicro.toString();
|
|
1915
1963
|
const maker = input.funderAddress ?? input.signerAddress;
|
|
1916
1964
|
return {
|
|
1917
1965
|
salt: Math.floor(Math.random() * 1e15).toString(),
|
|
@@ -2058,6 +2106,7 @@ exports.PredictProvider = PredictProvider;
|
|
|
2058
2106
|
exports.PredictWsClient = PredictWsClient;
|
|
2059
2107
|
exports.SIDE = SIDE;
|
|
2060
2108
|
exports.USDC_ADDRESS = USDC_ADDRESS;
|
|
2109
|
+
exports.availableSharesQueryKey = availableSharesQueryKey;
|
|
2061
2110
|
exports.balanceQueryKey = balanceQueryKey;
|
|
2062
2111
|
exports.buildClobAuthMessage = buildClobAuthMessage;
|
|
2063
2112
|
exports.buildClobPayload = buildClobPayload;
|
|
@@ -2102,6 +2151,7 @@ exports.resolveTagSlug = resolveTagSlug;
|
|
|
2102
2151
|
exports.similarEventsQueryKey = similarEventsQueryKey;
|
|
2103
2152
|
exports.tickSizeQueryKey = tickSizeQueryKey;
|
|
2104
2153
|
exports.tradesQueryKey = tradesQueryKey;
|
|
2154
|
+
exports.useAvailableShares = useAvailableShares;
|
|
2105
2155
|
exports.useBalance = useBalance;
|
|
2106
2156
|
exports.useCancelOrder = useCancelOrder;
|
|
2107
2157
|
exports.useCandlesticks = useCandlesticks;
|