@liberfi.io/react-predict 0.1.37 → 0.1.39
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 +39 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -16
- 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 +24 -15
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +24 -15
- 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,20 +1849,20 @@ 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));
|
|
1846
1864
|
}
|
|
1847
|
-
function
|
|
1865
|
+
function truncateMicro(raw, maxDecimals) {
|
|
1848
1866
|
const factor = BigInt(10 ** (6 - maxDecimals));
|
|
1849
1867
|
return raw / factor * factor;
|
|
1850
1868
|
}
|
|
@@ -1856,12 +1874,16 @@ function normalizeTokenId(tokenId) {
|
|
|
1856
1874
|
}
|
|
1857
1875
|
function buildOrderMessage(input) {
|
|
1858
1876
|
const side = input.side === "BUY" ? SIDE.BUY : SIDE.SELL;
|
|
1859
|
-
const
|
|
1860
|
-
const
|
|
1861
|
-
const
|
|
1862
|
-
const
|
|
1863
|
-
const
|
|
1864
|
-
const
|
|
1877
|
+
const rc = ROUNDING_CONFIG[input.tickSize] ?? DEFAULT_ROUNDING;
|
|
1878
|
+
const rawPrice = decimalPlaces(input.price, rc.price);
|
|
1879
|
+
const rawSize = decimalPlaces(input.size, rc.size);
|
|
1880
|
+
const rawAmount = decimalPlaces(rawSize * rawPrice, rc.amount);
|
|
1881
|
+
const sizeInMicro = toMicroUsdc(rawSize);
|
|
1882
|
+
const amountInMicro = toMicroUsdc(rawAmount);
|
|
1883
|
+
const usdcMicro = truncateMicro(amountInMicro, 2);
|
|
1884
|
+
const sharesMicro = truncateMicro(sizeInMicro, 4);
|
|
1885
|
+
const makerAmount = side === SIDE.BUY ? usdcMicro.toString() : sharesMicro.toString();
|
|
1886
|
+
const takerAmount = side === SIDE.BUY ? sharesMicro.toString() : usdcMicro.toString();
|
|
1865
1887
|
const maker = input.funderAddress ?? input.signerAddress;
|
|
1866
1888
|
return {
|
|
1867
1889
|
salt: Math.floor(Math.random() * 1e15).toString(),
|
|
@@ -2049,6 +2071,7 @@ exports.priceHistoryQueryKey = priceHistoryQueryKey;
|
|
|
2049
2071
|
exports.resolveEventsParams = resolveEventsParams;
|
|
2050
2072
|
exports.resolveTagSlug = resolveTagSlug;
|
|
2051
2073
|
exports.similarEventsQueryKey = similarEventsQueryKey;
|
|
2074
|
+
exports.tickSizeQueryKey = tickSizeQueryKey;
|
|
2052
2075
|
exports.tradesQueryKey = tradesQueryKey;
|
|
2053
2076
|
exports.useBalance = useBalance;
|
|
2054
2077
|
exports.useCancelOrder = useCancelOrder;
|
|
@@ -2089,6 +2112,7 @@ exports.useRealtimeTrades = useRealtimeTrades;
|
|
|
2089
2112
|
exports.useRunPolymarketSetup = useRunPolymarketSetup;
|
|
2090
2113
|
exports.useSearchEvents = useSearchEvents;
|
|
2091
2114
|
exports.useSimilarEvents = useSimilarEvents;
|
|
2115
|
+
exports.useTickSize = useTickSize;
|
|
2092
2116
|
exports.useTrades = useTrades;
|
|
2093
2117
|
exports.useTradesSubscription = useTradesSubscription;
|
|
2094
2118
|
exports.useWithdrawBuildMutation = useWithdrawBuildMutation;
|