@liberfi.io/react-predict 0.1.36 → 0.1.38
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 +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +36 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -15
- package/dist/index.mjs.map +1 -1
- package/dist/{server-BOEaPGc-.d.mts → server-CYqs2N2z.d.mts} +13 -1
- package/dist/{server-BOEaPGc-.d.ts → server-CYqs2N2z.d.ts} +13 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +21 -14
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +21 -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 EventStatus, e as EventSortField, S as SimilarEventsParams, f as PredictMarket, O as Orderbook, g as ListMarketTradesParams, h as PredictTrade, i as PriceHistoryRange, j as PriceHistoryResponse, k as ListCandlesticksParams, C as Candlestick, l as PositionsResponse, B as BalanceResponse, m as ListOrdersParams, n as PredictOrder, o as CancelOrderResult, M as MatchesParams, p as MatchGroupPage, q as MatchGroup, r as MatchMarketParams, s as MatchMarketPage, t as ListTradesParams, D as DFlowQuoteRequest, u as DFlowQuoteResponse, v as DFlowSubmitResponse, w as DFlowSubmitRequest, x as DFlowKYCStatus, y as PolymarketSetupStatus, W as WithdrawBuildResponse, z as WithdrawBuildRequest, A as WithdrawSubmitResponse, F as WithdrawSubmitRequest, G as WithdrawStatusResponse, H as PolymarketDepositAddresses, I as PolymarketWithdrawResponse, J as PolymarketWithdrawRequest, K as WsConnectionStatus, N as WsDataMessage, Q as WsPriceEvent, R as WsOrderbookEvent,
|
|
2
|
-
export {
|
|
1
|
+
import { P as PredictClient, a as PredictWsClient, L as ListEventsParams, b as PredictPage, c as PredictEvent, d as ProviderSource, E as EventStatus, e as EventSortField, S as SimilarEventsParams, f as PredictMarket, O as Orderbook, g as ListMarketTradesParams, h as PredictTrade, i as PriceHistoryRange, j as PriceHistoryResponse, k as ListCandlesticksParams, C as Candlestick, l as PositionsResponse, B as BalanceResponse, m as ListOrdersParams, n as PredictOrder, o as CancelOrderResult, M as MatchesParams, p as MatchGroupPage, q as MatchGroup, r as MatchMarketParams, s as MatchMarketPage, t as ListTradesParams, D as DFlowQuoteRequest, u as DFlowQuoteResponse, v as DFlowSubmitResponse, w as DFlowSubmitRequest, x as DFlowKYCStatus, y as PolymarketSetupStatus, W as WithdrawBuildResponse, z as WithdrawBuildRequest, A as WithdrawSubmitResponse, F as WithdrawSubmitRequest, G as WithdrawStatusResponse, H as PolymarketDepositAddresses, I as PolymarketWithdrawResponse, J as PolymarketWithdrawRequest, T as TickSizeResponse, K as WsConnectionStatus, N as WsDataMessage, Q as WsPriceEvent, R as WsOrderbookEvent, U as WsTradeEvent, V as CreateOrderInput } from './server-CYqs2N2z.mjs';
|
|
2
|
+
export { aZ as BuildClobAuthMessageInput, ba as BuildOrderMessageInput, aQ as CLOB_AUTH_DOMAIN, aR as CLOB_AUTH_TYPES, a_ as CTF_EXCHANGE_ADDRESS, b3 as CTF_ORDER_TYPES, b9 as ClobOrderPayload, ac as DFlowOrderContext, ae as DepositBuildRequest, af as DepositBuildResponse, ai as DepositStatusResponse, ag as DepositSubmitRequest, ah as DepositSubmitResponse, a6 as EventSummary, aW as HttpMethod, a3 as MarketOutcome, a2 as MarketResult, a1 as MarketStatus, a7 as MarketSummary, ap as MatchConfidenceTier, al as MatchGroupEntry, am as MatchGroupMarket, aq as MatchMarketFlat, an as MatchSortField, ak as MatchStatus, ao as MatchesStats, a$ as NEG_RISK_CTF_EXCHANGE_ADDRESS, b4 as ORDER_TYPE, bb as OrderMessage, ab as OrderSide, aa as OrderStatus, a4 as OrderbookLevel, b1 as POLYGON_CHAIN_ID, aY as PolymarketL2Headers, aX as PolymarketL2HeadersInput, ad as PolymarketOrderType, a9 as PredictPosition, $ as PredictTag, Z as PredictWsClientConfig, a8 as PricePoint, _ as ProviderMeta, aH as ResolveEventsParamsInput, b5 as SIDE, a0 as SettlementSource, bc as SignedOrder, aI as TagSlugSelection, a5 as TradeType, b0 as USDC_ADDRESS, aj as UnsignedTx, ar as WsChannel, as as WsChannelEvent, at as WsClientMessage, az as WsErrorCode, aA as WsErrorMessage, av as WsPingMessage, ax as WsPongMessage, aw as WsServerMessage, au as WsSubscribeMessage, ay as WsSubscribedMessage, aS as buildClobAuthMessage, b8 as buildClobPayload, b2 as buildCtfExchangeDomain, b6 as buildOrderMessage, aU as buildPolymarketL2Headers, b7 as buildSignedOrder, X as createPredictClient, Y as createPredictWsClient, aV as derivePolymarketApiKey, aB as eventQueryKey, aC as fetchEvent, aG as fetchEventsPage, aK as fetchMarket, aP as fetchMatchMarketsPage, aN as fetchMatchesPage, aT as hmacSha256Base64, aF as infiniteEventsQueryKey, aJ as marketQueryKey, aO as matchMarketsQueryKey, aM as matchQueryKey, aL as matchesQueryKey, aE as resolveEventsParams, aD as resolveTagSlug } from './server-CYqs2N2z.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';
|
|
@@ -553,6 +553,15 @@ declare function usePolymarketDepositAddresses(safeAddress: string | undefined):
|
|
|
553
553
|
*/
|
|
554
554
|
declare function usePolymarketWithdraw(): _tanstack_react_query.UseMutationResult<PolymarketWithdrawResponse, Error, PolymarketWithdrawRequest, unknown>;
|
|
555
555
|
|
|
556
|
+
declare function tickSizeQueryKey(tokenId: string): unknown[];
|
|
557
|
+
/**
|
|
558
|
+
* Query hook that fetches the minimum tick size for a Polymarket token.
|
|
559
|
+
*
|
|
560
|
+
* @param tokenId - Polymarket CLOB token ID (asset ID).
|
|
561
|
+
* @param queryOptions - React Query options (pass `enabled` to control when the query runs).
|
|
562
|
+
*/
|
|
563
|
+
declare function useTickSize(tokenId?: string, queryOptions?: Omit<UseQueryOptions<TickSizeResponse, Error, TickSizeResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<TickSizeResponse, Error>;
|
|
564
|
+
|
|
556
565
|
interface UsePredictWsClientResult {
|
|
557
566
|
/** The WebSocket client instance, or `null` if not provided via `PredictProvider`. */
|
|
558
567
|
wsClient: PredictWsClient | null;
|
|
@@ -786,4 +795,4 @@ interface CreatePolymarketOrderVariables {
|
|
|
786
795
|
*/
|
|
787
796
|
declare function useCreatePolymarketOrder(mutationOptions?: Omit<UseMutationOptions<PredictOrder, Error, CreatePolymarketOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<PredictOrder, Error, CreatePolymarketOrderVariables, unknown>;
|
|
788
797
|
|
|
789
|
-
export { BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, 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, 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, eventsQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tradesQueryKey, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, 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, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, withdrawStatusQueryKey };
|
|
798
|
+
export { BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, 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, eventsQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, 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 EventStatus, e as EventSortField, S as SimilarEventsParams, f as PredictMarket, O as Orderbook, g as ListMarketTradesParams, h as PredictTrade, i as PriceHistoryRange, j as PriceHistoryResponse, k as ListCandlesticksParams, C as Candlestick, l as PositionsResponse, B as BalanceResponse, m as ListOrdersParams, n as PredictOrder, o as CancelOrderResult, M as MatchesParams, p as MatchGroupPage, q as MatchGroup, r as MatchMarketParams, s as MatchMarketPage, t as ListTradesParams, D as DFlowQuoteRequest, u as DFlowQuoteResponse, v as DFlowSubmitResponse, w as DFlowSubmitRequest, x as DFlowKYCStatus, y as PolymarketSetupStatus, W as WithdrawBuildResponse, z as WithdrawBuildRequest, A as WithdrawSubmitResponse, F as WithdrawSubmitRequest, G as WithdrawStatusResponse, H as PolymarketDepositAddresses, I as PolymarketWithdrawResponse, J as PolymarketWithdrawRequest, K as WsConnectionStatus, N as WsDataMessage, Q as WsPriceEvent, R as WsOrderbookEvent,
|
|
2
|
-
export {
|
|
1
|
+
import { P as PredictClient, a as PredictWsClient, L as ListEventsParams, b as PredictPage, c as PredictEvent, d as ProviderSource, E as EventStatus, e as EventSortField, S as SimilarEventsParams, f as PredictMarket, O as Orderbook, g as ListMarketTradesParams, h as PredictTrade, i as PriceHistoryRange, j as PriceHistoryResponse, k as ListCandlesticksParams, C as Candlestick, l as PositionsResponse, B as BalanceResponse, m as ListOrdersParams, n as PredictOrder, o as CancelOrderResult, M as MatchesParams, p as MatchGroupPage, q as MatchGroup, r as MatchMarketParams, s as MatchMarketPage, t as ListTradesParams, D as DFlowQuoteRequest, u as DFlowQuoteResponse, v as DFlowSubmitResponse, w as DFlowSubmitRequest, x as DFlowKYCStatus, y as PolymarketSetupStatus, W as WithdrawBuildResponse, z as WithdrawBuildRequest, A as WithdrawSubmitResponse, F as WithdrawSubmitRequest, G as WithdrawStatusResponse, H as PolymarketDepositAddresses, I as PolymarketWithdrawResponse, J as PolymarketWithdrawRequest, T as TickSizeResponse, K as WsConnectionStatus, N as WsDataMessage, Q as WsPriceEvent, R as WsOrderbookEvent, U as WsTradeEvent, V as CreateOrderInput } from './server-CYqs2N2z.js';
|
|
2
|
+
export { aZ as BuildClobAuthMessageInput, ba as BuildOrderMessageInput, aQ as CLOB_AUTH_DOMAIN, aR as CLOB_AUTH_TYPES, a_ as CTF_EXCHANGE_ADDRESS, b3 as CTF_ORDER_TYPES, b9 as ClobOrderPayload, ac as DFlowOrderContext, ae as DepositBuildRequest, af as DepositBuildResponse, ai as DepositStatusResponse, ag as DepositSubmitRequest, ah as DepositSubmitResponse, a6 as EventSummary, aW as HttpMethod, a3 as MarketOutcome, a2 as MarketResult, a1 as MarketStatus, a7 as MarketSummary, ap as MatchConfidenceTier, al as MatchGroupEntry, am as MatchGroupMarket, aq as MatchMarketFlat, an as MatchSortField, ak as MatchStatus, ao as MatchesStats, a$ as NEG_RISK_CTF_EXCHANGE_ADDRESS, b4 as ORDER_TYPE, bb as OrderMessage, ab as OrderSide, aa as OrderStatus, a4 as OrderbookLevel, b1 as POLYGON_CHAIN_ID, aY as PolymarketL2Headers, aX as PolymarketL2HeadersInput, ad as PolymarketOrderType, a9 as PredictPosition, $ as PredictTag, Z as PredictWsClientConfig, a8 as PricePoint, _ as ProviderMeta, aH as ResolveEventsParamsInput, b5 as SIDE, a0 as SettlementSource, bc as SignedOrder, aI as TagSlugSelection, a5 as TradeType, b0 as USDC_ADDRESS, aj as UnsignedTx, ar as WsChannel, as as WsChannelEvent, at as WsClientMessage, az as WsErrorCode, aA as WsErrorMessage, av as WsPingMessage, ax as WsPongMessage, aw as WsServerMessage, au as WsSubscribeMessage, ay as WsSubscribedMessage, aS as buildClobAuthMessage, b8 as buildClobPayload, b2 as buildCtfExchangeDomain, b6 as buildOrderMessage, aU as buildPolymarketL2Headers, b7 as buildSignedOrder, X as createPredictClient, Y as createPredictWsClient, aV as derivePolymarketApiKey, aB as eventQueryKey, aC as fetchEvent, aG as fetchEventsPage, aK as fetchMarket, aP as fetchMatchMarketsPage, aN as fetchMatchesPage, aT as hmacSha256Base64, aF as infiniteEventsQueryKey, aJ as marketQueryKey, aO as matchMarketsQueryKey, aM as matchQueryKey, aL as matchesQueryKey, aE as resolveEventsParams, aD as resolveTagSlug } from './server-CYqs2N2z.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';
|
|
@@ -553,6 +553,15 @@ declare function usePolymarketDepositAddresses(safeAddress: string | undefined):
|
|
|
553
553
|
*/
|
|
554
554
|
declare function usePolymarketWithdraw(): _tanstack_react_query.UseMutationResult<PolymarketWithdrawResponse, Error, PolymarketWithdrawRequest, unknown>;
|
|
555
555
|
|
|
556
|
+
declare function tickSizeQueryKey(tokenId: string): unknown[];
|
|
557
|
+
/**
|
|
558
|
+
* Query hook that fetches the minimum tick size for a Polymarket token.
|
|
559
|
+
*
|
|
560
|
+
* @param tokenId - Polymarket CLOB token ID (asset ID).
|
|
561
|
+
* @param queryOptions - React Query options (pass `enabled` to control when the query runs).
|
|
562
|
+
*/
|
|
563
|
+
declare function useTickSize(tokenId?: string, queryOptions?: Omit<UseQueryOptions<TickSizeResponse, Error, TickSizeResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<TickSizeResponse, Error>;
|
|
564
|
+
|
|
556
565
|
interface UsePredictWsClientResult {
|
|
557
566
|
/** The WebSocket client instance, or `null` if not provided via `PredictProvider`. */
|
|
558
567
|
wsClient: PredictWsClient | null;
|
|
@@ -786,4 +795,4 @@ interface CreatePolymarketOrderVariables {
|
|
|
786
795
|
*/
|
|
787
796
|
declare function useCreatePolymarketOrder(mutationOptions?: Omit<UseMutationOptions<PredictOrder, Error, CreatePolymarketOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<PredictOrder, Error, CreatePolymarketOrderVariables, unknown>;
|
|
788
797
|
|
|
789
|
-
export { BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, 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, 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, eventsQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tradesQueryKey, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, 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, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, withdrawStatusQueryKey };
|
|
798
|
+
export { BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, 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, eventsQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, 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
|
@@ -205,6 +205,11 @@ var PredictClient = class {
|
|
|
205
205
|
const url = `${this.endpoint}/api/v1/orders/polymarket`;
|
|
206
206
|
return await utils.httpPost(url, input, { headers });
|
|
207
207
|
}
|
|
208
|
+
/** Maps to `GET /api/v1/polymarket/tick-size?token_id=xxx`. */
|
|
209
|
+
async getPolymarketTickSize(tokenId) {
|
|
210
|
+
const url = `${this.endpoint}/api/v1/polymarket/tick-size?token_id=${encodeURIComponent(tokenId)}`;
|
|
211
|
+
return await utils.httpGet(url);
|
|
212
|
+
}
|
|
208
213
|
// -------------------------------------------------------------------------
|
|
209
214
|
// DFlow trading
|
|
210
215
|
// -------------------------------------------------------------------------
|
|
@@ -1550,6 +1555,19 @@ function usePolymarketWithdraw() {
|
|
|
1550
1555
|
mutationFn: (req) => client.executePolymarketWithdraw(req)
|
|
1551
1556
|
});
|
|
1552
1557
|
}
|
|
1558
|
+
function tickSizeQueryKey(tokenId) {
|
|
1559
|
+
return ["predict", "polymarket", "tick-size", tokenId];
|
|
1560
|
+
}
|
|
1561
|
+
function useTickSize(tokenId, queryOptions = {}) {
|
|
1562
|
+
const client = usePredictClient();
|
|
1563
|
+
return reactQuery.useQuery({
|
|
1564
|
+
queryKey: tickSizeQueryKey(tokenId ?? ""),
|
|
1565
|
+
queryFn: () => client.getPolymarketTickSize(tokenId),
|
|
1566
|
+
enabled: !!tokenId,
|
|
1567
|
+
staleTime: 5 * 6e4,
|
|
1568
|
+
...queryOptions
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1553
1571
|
function usePredictWsClient() {
|
|
1554
1572
|
const context = react.useContext(PredictContext);
|
|
1555
1573
|
if (!context) {
|
|
@@ -1831,15 +1849,15 @@ var ORDER_TYPE = {
|
|
|
1831
1849
|
// Fill-And-Kill
|
|
1832
1850
|
};
|
|
1833
1851
|
var SIDE = { BUY: 0, SELL: 1 };
|
|
1834
|
-
var
|
|
1835
|
-
"0.1": 1,
|
|
1836
|
-
"0.01": 2,
|
|
1837
|
-
"0.001": 3,
|
|
1838
|
-
"0.0001": 4
|
|
1852
|
+
var ROUNDING_CONFIG = {
|
|
1853
|
+
"0.1": { size: 2, price: 1, amount: 3 },
|
|
1854
|
+
"0.01": { size: 2, price: 2, amount: 4 },
|
|
1855
|
+
"0.001": { size: 3, price: 3, amount: 6 },
|
|
1856
|
+
"0.0001": { size: 4, price: 4, amount: 8 }
|
|
1839
1857
|
};
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
return
|
|
1858
|
+
var DEFAULT_ROUNDING = { size: 2, price: 2, amount: 4 };
|
|
1859
|
+
function decimalPlaces(n, d) {
|
|
1860
|
+
return parseFloat(n.toFixed(d));
|
|
1843
1861
|
}
|
|
1844
1862
|
function toMicroUsdc(amount) {
|
|
1845
1863
|
return BigInt(Math.round(amount * 1e6));
|
|
@@ -1852,12 +1870,14 @@ function normalizeTokenId(tokenId) {
|
|
|
1852
1870
|
}
|
|
1853
1871
|
function buildOrderMessage(input) {
|
|
1854
1872
|
const side = input.side === "BUY" ? SIDE.BUY : SIDE.SELL;
|
|
1855
|
-
const
|
|
1856
|
-
const
|
|
1857
|
-
const
|
|
1858
|
-
const
|
|
1859
|
-
const
|
|
1860
|
-
const
|
|
1873
|
+
const rc = ROUNDING_CONFIG[input.tickSize] ?? DEFAULT_ROUNDING;
|
|
1874
|
+
const rawPrice = decimalPlaces(input.price, rc.price);
|
|
1875
|
+
const rawSize = decimalPlaces(input.size, rc.size);
|
|
1876
|
+
const rawAmount = decimalPlaces(rawSize * rawPrice, rc.amount);
|
|
1877
|
+
const sizeInMicro = toMicroUsdc(rawSize);
|
|
1878
|
+
const amountInMicro = toMicroUsdc(rawAmount);
|
|
1879
|
+
const makerAmount = side === SIDE.BUY ? amountInMicro.toString() : sizeInMicro.toString();
|
|
1880
|
+
const takerAmount = side === SIDE.BUY ? sizeInMicro.toString() : amountInMicro.toString();
|
|
1861
1881
|
const maker = input.funderAddress ?? input.signerAddress;
|
|
1862
1882
|
return {
|
|
1863
1883
|
salt: Math.floor(Math.random() * 1e15).toString(),
|
|
@@ -2045,6 +2065,7 @@ exports.priceHistoryQueryKey = priceHistoryQueryKey;
|
|
|
2045
2065
|
exports.resolveEventsParams = resolveEventsParams;
|
|
2046
2066
|
exports.resolveTagSlug = resolveTagSlug;
|
|
2047
2067
|
exports.similarEventsQueryKey = similarEventsQueryKey;
|
|
2068
|
+
exports.tickSizeQueryKey = tickSizeQueryKey;
|
|
2048
2069
|
exports.tradesQueryKey = tradesQueryKey;
|
|
2049
2070
|
exports.useBalance = useBalance;
|
|
2050
2071
|
exports.useCancelOrder = useCancelOrder;
|
|
@@ -2085,6 +2106,7 @@ exports.useRealtimeTrades = useRealtimeTrades;
|
|
|
2085
2106
|
exports.useRunPolymarketSetup = useRunPolymarketSetup;
|
|
2086
2107
|
exports.useSearchEvents = useSearchEvents;
|
|
2087
2108
|
exports.useSimilarEvents = useSimilarEvents;
|
|
2109
|
+
exports.useTickSize = useTickSize;
|
|
2088
2110
|
exports.useTrades = useTrades;
|
|
2089
2111
|
exports.useTradesSubscription = useTradesSubscription;
|
|
2090
2112
|
exports.useWithdrawBuildMutation = useWithdrawBuildMutation;
|