@liberfi.io/react-predict 0.3.60 → 0.3.62

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 CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PredictClient, a as PredictWsClient, L as ListEventsParams, b as PredictPage, c as PredictEvent, d as ProviderSource, E as EventStats, e as EventStatus, f as EventSortField, S as SimilarEventsParams, g as PredictMarket, O as OrderbookOutcome, h as Orderbook, i as ListMarketTradesParams, j as PredictTrade, k as PriceHistoryRange, l as PriceHistoryResponse, m as ListCandlesticksParams, C as Candlestick, n as ListCommentsParams, o as PredictComment, p as PositionsResponse, A as AvailableSharesResponse, B as BalanceResponse, q as ListOrdersParams, r as PredictOrder, s as ListOrdersMultiParams, t as PredictOrdersResponse, u as CancelOrderResult, M as MatchesParams, v as MatchGroupPage, w as MatchGroup, x as MatchMarketParams, y as MatchMarketPage, z as ListTradesParams, D as ListTradesMultiParams, F as DFlowQuoteRequest, G as DFlowQuoteResponse, H as DFlowSubmitResponse, I as DFlowSubmitRequest, J as DFlowKYCStatus, K as PolymarketSetupStatus, N as PolymarketDepositWalletDeployResponse, W as WithdrawBuildResponse, Q as WithdrawBuildRequest, R as WithdrawSubmitResponse, T as WithdrawSubmitRequest, U as WithdrawStatusResponse, V as PolymarketDepositAddresses, X as PolymarketSupportedAsset, Y as PolymarketWithdrawResponse, Z as PolymarketWithdrawRequest, _ as PolymarketWithdrawPrepareResponse, $ as PolymarketWithdrawPrepareRequest, a0 as PolymarketWithdrawQuoteResponse, a1 as PolymarketWithdrawQuoteRequest, a2 as PolymarketWithdrawRelayBuildResponse, a3 as PolymarketWithdrawRelayBuildRequest, a4 as PolymarketWithdrawRelaySubmitResponse, a5 as PolymarketWithdrawRelaySubmitRequest, a6 as PolymarketWithdrawBridgeStatusResponse, a7 as PolymarketRedeemResponse, a8 as PolymarketTypedData, a9 as TickSizeResponse, aa as FeeRateResponse, ab as RebateConfig, ac as WsConnectionStatus, ad as WsDataMessage, ae as WsPriceEvent, af as WsOrderbookEvent, ag as WsTradeEvent, ah as CreateOrderInput } from './server-h41hs9SR.mjs';
2
- export { bA as BuildClobAuthMessageInput, bO as BuildOrderMessageInput, br as CLOB_AUTH_DOMAIN, bs as CLOB_AUTH_TYPES, bB as CTF_EXCHANGE_ADDRESS, bG as CTF_ORDER_TYPES, bN as ClobOrderPayload, aF as DFlowOrderContext, aJ as DepositBuildRequest, aK as DepositBuildResponse, aN as DepositStatusResponse, aL as DepositSubmitRequest, aM as DepositSubmitResponse, ay as EventSummary, bx as HttpMethod, ar as MarketOutcome, aq as MarketResult, ap as MarketStatus, az as MarketSummary, aX as MatchConfidenceTier, aT as MatchGroupEntry, aU as MatchGroupMarket, aZ as MatchLeg, a_ as MatchMarketFlat, aV as MatchSortField, aS as MatchStatus, aW as MatchesStats, bC as NEG_RISK_CTF_EXCHANGE_ADDRESS, bH as ORDER_TYPE, bP as OrderMessage, aE as OrderSide, aD as OrderStatus, at as OrderbookBatchItem, au as OrderbookBatchResult, as as OrderbookLevel, av as OrderbooksBatchRequest, aw as OrderbooksBatchResponse, bE as POLYGON_CHAIN_ID, aP as PolymarketBridgeToken, aI as PolymarketDepositWalletDeployRequest, bz as PolymarketL2Headers, by as PolymarketL2HeadersInput, aG as PolymarketOrderType, bb as PolymarketRedeemInput, b9 as PolymarketRedeemPrepareInput, ba as PolymarketRedeemPrepareResponse, aQ as PolymarketSupportedAssetsResponse, aR as PolymarketTypedDataArg, aH as PolymarketWalletKind, aj as PredictClientOptions, aA as PredictCommentProfile, aC as PredictPosition, an as PredictTag, al as PredictWsClientConfig, aB as PricePoint, am as ProviderMeta, bi as ResolveEventsParamsInput, bI as SIDE, ao as SettlementSource, aY as SignalTag, bQ as SignedOrder, bj as TagSlugSelection, ax as TradeType, bD as USDC_ADDRESS, aO as UnsignedTx, a$ as WsChannel, b0 as WsChannelEvent, b1 as WsClientMessage, b7 as WsErrorCode, b8 as WsErrorMessage, b3 as WsPingMessage, b5 as WsPongMessage, b4 as WsServerMessage, b2 as WsSubscribeMessage, b6 as WsSubscribedMessage, bt as buildClobAuthMessage, bL as buildClobPayload, bF as buildCtfExchangeDomain, bJ as buildOrderMessage, bv as buildPolymarketL2Headers, bK as buildSignedOrder, ai as createPredictClient, ak as createPredictWsClient, bw as derivePolymarketApiKey, bc as eventQueryKey, bd as fetchEvent, bh as fetchEventsPage, bl as fetchMarket, bq as fetchMatchMarketsPage, bo as fetchMatchesPage, bM as getPolymarketSharesPrecision, bu as hmacSha256Base64, bg as infiniteEventsQueryKey, bk as marketQueryKey, bp as matchMarketsQueryKey, bn as matchQueryKey, bm as matchesQueryKey, bf as resolveEventsParams, be as resolveTagSlug } from './server-h41hs9SR.mjs';
1
+ import { P as PredictClient, a as PredictWsClient, L as ListEventsParams, b as PredictPage, c as PredictEvent, d as ProviderSource, E as EventStats, e as EventStatus, f as EventSortField, S as SimilarEventsParams, g as PredictMarket, O as OrderbookOutcome, h as Orderbook, i as ListMarketTradesParams, j as PredictTrade, k as PriceHistoryRange, l as PriceHistoryResponse, m as ListCandlesticksParams, C as Candlestick, n as ListCommentsParams, o as PredictComment, p as PositionsResponse, q as PositionValueResponse, A as AvailableSharesResponse, B as BalanceResponse, r as ListOrdersParams, s as PredictOrder, t as ListOrdersMultiParams, u as PredictOrdersResponse, v as CancelOrderResult, M as MatchesParams, w as MatchGroupPage, x as MatchGroup, y as MatchMarketParams, z as MatchMarketPage, D as ListTradesParams, F as ListTradesMultiParams, G as DFlowQuoteRequest, H as DFlowQuoteResponse, I as DFlowSubmitResponse, J as DFlowSubmitRequest, K as DFlowKYCStatus, N as PolymarketSetupStatus, Q as PolymarketDepositWalletDeployResponse, W as WithdrawBuildResponse, R as WithdrawBuildRequest, T as WithdrawSubmitResponse, U as WithdrawSubmitRequest, V as WithdrawStatusResponse, X as PolymarketDepositAddresses, Y as PolymarketSupportedAsset, Z as PolymarketWithdrawResponse, _ as PolymarketWithdrawRequest, $ as PolymarketWithdrawPrepareResponse, a0 as PolymarketWithdrawPrepareRequest, a1 as PolymarketWithdrawQuoteResponse, a2 as PolymarketWithdrawQuoteRequest, a3 as PolymarketWithdrawRelayBuildResponse, a4 as PolymarketWithdrawRelayBuildRequest, a5 as PolymarketWithdrawRelaySubmitResponse, a6 as PolymarketWithdrawRelaySubmitRequest, a7 as PolymarketWithdrawBridgeStatusResponse, a8 as PolymarketRedeemResponse, a9 as PolymarketTypedData, aa as TickSizeResponse, ab as FeeRateResponse, ac as RebateConfig, ad as WsConnectionStatus, ae as WsDataMessage, af as WsPriceEvent, ag as WsOrderbookEvent, ah as WsTradeEvent, ai as CreateOrderInput } from './server-BW_QhQos.mjs';
2
+ export { bD as BuildClobAuthMessageInput, bR as BuildOrderMessageInput, bu as CLOB_AUTH_DOMAIN, bv as CLOB_AUTH_TYPES, bE as CTF_EXCHANGE_ADDRESS, bJ as CTF_ORDER_TYPES, bQ as ClobOrderPayload, aI as DFlowOrderContext, aM as DepositBuildRequest, aN as DepositBuildResponse, aQ as DepositStatusResponse, aO as DepositSubmitRequest, aP as DepositSubmitResponse, az as EventSummary, bA as HttpMethod, as as MarketOutcome, ar as MarketResult, aq as MarketStatus, aA as MarketSummary, a_ as MatchConfidenceTier, aW as MatchGroupEntry, aX as MatchGroupMarket, b0 as MatchLeg, b1 as MatchMarketFlat, aY as MatchSortField, aV as MatchStatus, aZ as MatchesStats, bF as NEG_RISK_CTF_EXCHANGE_ADDRESS, bK as ORDER_TYPE, bS as OrderMessage, aH as OrderSide, aG as OrderStatus, au as OrderbookBatchItem, av as OrderbookBatchResult, at as OrderbookLevel, aw as OrderbooksBatchRequest, ax as OrderbooksBatchResponse, bH as POLYGON_CHAIN_ID, aS as PolymarketBridgeToken, aL as PolymarketDepositWalletDeployRequest, bC as PolymarketL2Headers, bB as PolymarketL2HeadersInput, aJ as PolymarketOrderType, be as PolymarketRedeemInput, bc as PolymarketRedeemPrepareInput, bd as PolymarketRedeemPrepareResponse, aT as PolymarketSupportedAssetsResponse, aU as PolymarketTypedDataArg, aK as PolymarketWalletKind, aE as PositionValue, aF as PositionValueError, ak as PredictClientOptions, aB as PredictCommentProfile, aD as PredictPosition, ao as PredictTag, am as PredictWsClientConfig, aC as PricePoint, an as ProviderMeta, bl as ResolveEventsParamsInput, bL as SIDE, ap as SettlementSource, a$ as SignalTag, bT as SignedOrder, bm as TagSlugSelection, ay as TradeType, bG as USDC_ADDRESS, aR as UnsignedTx, b2 as WsChannel, b3 as WsChannelEvent, b4 as WsClientMessage, ba as WsErrorCode, bb as WsErrorMessage, b6 as WsPingMessage, b8 as WsPongMessage, b7 as WsServerMessage, b5 as WsSubscribeMessage, b9 as WsSubscribedMessage, bw as buildClobAuthMessage, bO as buildClobPayload, bI as buildCtfExchangeDomain, bM as buildOrderMessage, by as buildPolymarketL2Headers, bN as buildSignedOrder, aj as createPredictClient, al as createPredictWsClient, bz as derivePolymarketApiKey, bf as eventQueryKey, bg as fetchEvent, bk as fetchEventsPage, bo as fetchMarket, bt as fetchMatchMarketsPage, br as fetchMatchesPage, bP as getPolymarketSharesPrecision, bx as hmacSha256Base64, bj as infiniteEventsQueryKey, bn as marketQueryKey, bs as matchMarketsQueryKey, bq as matchQueryKey, bp as matchesQueryKey, bi as resolveEventsParams, bh as resolveTagSlug } from './server-BW_QhQos.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';
@@ -414,6 +414,29 @@ declare function usePositions(params: UsePositionsParams, queryOptions?: Omit<Us
414
414
  */
415
415
  declare function usePositionsMulti(params: UsePositionsMultiParams, queryOptions?: Omit<UseQueryOptions<PositionsResponse, Error, PositionsResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PositionsResponse, Error>;
416
416
 
417
+ declare function positionValueQueryKey(user: string, source?: ProviderSource): unknown[];
418
+ declare function positionValueMultiQueryKey(wallets: {
419
+ kalshi_user?: string;
420
+ polymarket_user?: string;
421
+ }): unknown[];
422
+ /** Single-source params (backward-compatible). */
423
+ interface UsePositionValueParams {
424
+ /** Provider source. Omit to aggregate all providers (same address). */
425
+ source?: ProviderSource;
426
+ user: string;
427
+ }
428
+ /** Multi-wallet params — each provider gets its own address. */
429
+ interface UsePositionValueMultiParams {
430
+ kalshi_user?: string;
431
+ polymarket_user?: string;
432
+ }
433
+ declare function usePositionValue(params: UsePositionValueParams, queryOptions?: Omit<UseQueryOptions<PositionValueResponse, Error, PositionValueResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PositionValueResponse, Error>;
434
+ /**
435
+ * Fetch current total position value for multiple wallets in a single request.
436
+ * Each provider is queried with its own address.
437
+ */
438
+ declare function usePositionValueMulti(params: UsePositionValueMultiParams, queryOptions?: Omit<UseQueryOptions<PositionValueResponse, Error, PositionValueResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PositionValueResponse, Error>;
439
+
417
440
  interface UseAvailableSharesParams {
418
441
  source: ProviderSource;
419
442
  user: string;
@@ -511,6 +534,12 @@ interface StartTradeResultConfirmationInput {
511
534
  marketSlug?: string;
512
535
  eventSlug?: string;
513
536
  expectation: TradeResultExpectation;
537
+ /**
538
+ * Expected settlement payout for redeem confirmations. Winning redeems should
539
+ * wait for both balance and position changes; losing redeems only clear the
540
+ * position and may not change the cash balance.
541
+ */
542
+ expectedPayout?: number;
514
543
  orderId?: string;
515
544
  maxDurationMs?: number;
516
545
  getOrdersHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
@@ -1136,4 +1165,4 @@ interface WalkOrderbookParams {
1136
1165
  */
1137
1166
  declare function walkOrderbook({ orderbook, outcome, side, sharesNeeded, slippageBps, }: WalkOrderbookParams): WalkResult;
1138
1167
 
1139
- export { AvailableSharesResponse, BalanceResponse, type BuildV2OrderParams, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, type ClobOrderV2Payload, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, FeeRateResponse, ListCandlesticksParams, ListCommentsParams, ListEventsParams, ListMarketTradesParams, ListOrdersMultiParams, ListOrdersParams, ListTradesMultiParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, OrderbookOutcome, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketDepositWalletDeployResponse, PolymarketProvider, type PolymarketProviderProps, PolymarketRedeemResponse, PolymarketSetupStatus, type PolymarketSigner, PolymarketSupportedAsset, PolymarketTypedData, PolymarketWithdrawBridgeStatusResponse, PolymarketWithdrawPrepareRequest, PolymarketWithdrawPrepareResponse, PolymarketWithdrawQuoteRequest, PolymarketWithdrawQuoteResponse, PolymarketWithdrawRelayBuildRequest, PolymarketWithdrawRelayBuildResponse, PolymarketWithdrawRelaySubmitRequest, PolymarketWithdrawRelaySubmitResponse, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionsResponse, PredictClient, PredictComment, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictOrdersResponse, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, RebateConfig, type RedeemPositionVariables, SimilarEventsParams, type StartTradeResultConfirmationInput, type SyncBalanceAllowanceParams, TickSizeResponse, type TradeResultConfirmationState, type TradeResultExpectation, type UseAvailableSharesOptions, type UseAvailableSharesParams, type UseBalanceParams, type UseCancelOrderOptions, type UseCandlesticksParams, type UseEventParams, type UseInfiniteCommentsParams, type UseInfiniteMatchMarketsParams, type UseInfiniteMatchesParams, type UseInfiniteOrdersOptions, type UseInfiniteOrdersParams, type UseInfiniteTradesMultiParams, type UseInfiniteTradesParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UseOrdersMultiOptions, 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, type WalkOrderbookParams, type WalkOutcome, type WalkResult, type WalkSide, type WalkStatus, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, availableSharesQueryKey, balanceQueryKey, buildSignedV2OrderPayload, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, feeRateQueryKey, fetchEvents, infiniteCommentsQueryKey, infiniteOrdersQueryKey, infiniteTradesMultiQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersMultiQueryKey, ordersQueryKey, pickBestAsk, pickBestBid, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, polymarketSupportedAssetsQueryKey, polymarketWithdrawStatusQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, rebateConfigQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, updatePolymarketBalanceAllowance, useAvailableShares, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useDeployPolymarketDepositWallet, useEvent, useEventStats, useEvents, useFeeRate, useInfiniteComments, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useInfiniteTradesMulti, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, useOrdersMulti, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketSupportedAssets, usePolymarketWithdraw, usePolymarketWithdrawPrepareMutation, usePolymarketWithdrawQuoteMutation, usePolymarketWithdrawRelayBuildMutation, usePolymarketWithdrawRelaySubmitMutation, usePolymarketWithdrawStatusQuery, usePositions, usePositionsMulti, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRebateConfig, useRedeemPosition, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useTickSize, useTradeResultConfirmation, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, walkOrderbook, withdrawStatusQueryKey };
1168
+ export { AvailableSharesResponse, BalanceResponse, type BuildV2OrderParams, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, type ClobOrderV2Payload, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, FeeRateResponse, ListCandlesticksParams, ListCommentsParams, ListEventsParams, ListMarketTradesParams, ListOrdersMultiParams, ListOrdersParams, ListTradesMultiParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, OrderbookOutcome, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketDepositWalletDeployResponse, PolymarketProvider, type PolymarketProviderProps, PolymarketRedeemResponse, PolymarketSetupStatus, type PolymarketSigner, PolymarketSupportedAsset, PolymarketTypedData, PolymarketWithdrawBridgeStatusResponse, PolymarketWithdrawPrepareRequest, PolymarketWithdrawPrepareResponse, PolymarketWithdrawQuoteRequest, PolymarketWithdrawQuoteResponse, PolymarketWithdrawRelayBuildRequest, PolymarketWithdrawRelayBuildResponse, PolymarketWithdrawRelaySubmitRequest, PolymarketWithdrawRelaySubmitResponse, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionValueResponse, PositionsResponse, PredictClient, PredictComment, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictOrdersResponse, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, RebateConfig, type RedeemPositionVariables, SimilarEventsParams, type StartTradeResultConfirmationInput, type SyncBalanceAllowanceParams, TickSizeResponse, type TradeResultConfirmationState, type TradeResultExpectation, type UseAvailableSharesOptions, type UseAvailableSharesParams, type UseBalanceParams, type UseCancelOrderOptions, type UseCandlesticksParams, type UseEventParams, type UseInfiniteCommentsParams, type UseInfiniteMatchMarketsParams, type UseInfiniteMatchesParams, type UseInfiniteOrdersOptions, type UseInfiniteOrdersParams, type UseInfiniteTradesMultiParams, type UseInfiniteTradesParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UseOrdersMultiOptions, type UseOrdersOptions, type UsePositionValueMultiParams, type UsePositionValueParams, 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, type WalkOrderbookParams, type WalkOutcome, type WalkResult, type WalkSide, type WalkStatus, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, availableSharesQueryKey, balanceQueryKey, buildSignedV2OrderPayload, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, feeRateQueryKey, fetchEvents, infiniteCommentsQueryKey, infiniteOrdersQueryKey, infiniteTradesMultiQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersMultiQueryKey, ordersQueryKey, pickBestAsk, pickBestBid, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, polymarketSupportedAssetsQueryKey, polymarketWithdrawStatusQueryKey, positionValueMultiQueryKey, positionValueQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, rebateConfigQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, updatePolymarketBalanceAllowance, useAvailableShares, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useDeployPolymarketDepositWallet, useEvent, useEventStats, useEvents, useFeeRate, useInfiniteComments, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useInfiniteTradesMulti, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, useOrdersMulti, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketSupportedAssets, usePolymarketWithdraw, usePolymarketWithdrawPrepareMutation, usePolymarketWithdrawQuoteMutation, usePolymarketWithdrawRelayBuildMutation, usePolymarketWithdrawRelaySubmitMutation, usePolymarketWithdrawStatusQuery, usePositionValue, usePositionValueMulti, usePositions, usePositionsMulti, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRebateConfig, useRedeemPosition, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useTickSize, useTradeResultConfirmation, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, walkOrderbook, 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 OrderbookOutcome, h as Orderbook, i as ListMarketTradesParams, j as PredictTrade, k as PriceHistoryRange, l as PriceHistoryResponse, m as ListCandlesticksParams, C as Candlestick, n as ListCommentsParams, o as PredictComment, p as PositionsResponse, A as AvailableSharesResponse, B as BalanceResponse, q as ListOrdersParams, r as PredictOrder, s as ListOrdersMultiParams, t as PredictOrdersResponse, u as CancelOrderResult, M as MatchesParams, v as MatchGroupPage, w as MatchGroup, x as MatchMarketParams, y as MatchMarketPage, z as ListTradesParams, D as ListTradesMultiParams, F as DFlowQuoteRequest, G as DFlowQuoteResponse, H as DFlowSubmitResponse, I as DFlowSubmitRequest, J as DFlowKYCStatus, K as PolymarketSetupStatus, N as PolymarketDepositWalletDeployResponse, W as WithdrawBuildResponse, Q as WithdrawBuildRequest, R as WithdrawSubmitResponse, T as WithdrawSubmitRequest, U as WithdrawStatusResponse, V as PolymarketDepositAddresses, X as PolymarketSupportedAsset, Y as PolymarketWithdrawResponse, Z as PolymarketWithdrawRequest, _ as PolymarketWithdrawPrepareResponse, $ as PolymarketWithdrawPrepareRequest, a0 as PolymarketWithdrawQuoteResponse, a1 as PolymarketWithdrawQuoteRequest, a2 as PolymarketWithdrawRelayBuildResponse, a3 as PolymarketWithdrawRelayBuildRequest, a4 as PolymarketWithdrawRelaySubmitResponse, a5 as PolymarketWithdrawRelaySubmitRequest, a6 as PolymarketWithdrawBridgeStatusResponse, a7 as PolymarketRedeemResponse, a8 as PolymarketTypedData, a9 as TickSizeResponse, aa as FeeRateResponse, ab as RebateConfig, ac as WsConnectionStatus, ad as WsDataMessage, ae as WsPriceEvent, af as WsOrderbookEvent, ag as WsTradeEvent, ah as CreateOrderInput } from './server-h41hs9SR.js';
2
- export { bA as BuildClobAuthMessageInput, bO as BuildOrderMessageInput, br as CLOB_AUTH_DOMAIN, bs as CLOB_AUTH_TYPES, bB as CTF_EXCHANGE_ADDRESS, bG as CTF_ORDER_TYPES, bN as ClobOrderPayload, aF as DFlowOrderContext, aJ as DepositBuildRequest, aK as DepositBuildResponse, aN as DepositStatusResponse, aL as DepositSubmitRequest, aM as DepositSubmitResponse, ay as EventSummary, bx as HttpMethod, ar as MarketOutcome, aq as MarketResult, ap as MarketStatus, az as MarketSummary, aX as MatchConfidenceTier, aT as MatchGroupEntry, aU as MatchGroupMarket, aZ as MatchLeg, a_ as MatchMarketFlat, aV as MatchSortField, aS as MatchStatus, aW as MatchesStats, bC as NEG_RISK_CTF_EXCHANGE_ADDRESS, bH as ORDER_TYPE, bP as OrderMessage, aE as OrderSide, aD as OrderStatus, at as OrderbookBatchItem, au as OrderbookBatchResult, as as OrderbookLevel, av as OrderbooksBatchRequest, aw as OrderbooksBatchResponse, bE as POLYGON_CHAIN_ID, aP as PolymarketBridgeToken, aI as PolymarketDepositWalletDeployRequest, bz as PolymarketL2Headers, by as PolymarketL2HeadersInput, aG as PolymarketOrderType, bb as PolymarketRedeemInput, b9 as PolymarketRedeemPrepareInput, ba as PolymarketRedeemPrepareResponse, aQ as PolymarketSupportedAssetsResponse, aR as PolymarketTypedDataArg, aH as PolymarketWalletKind, aj as PredictClientOptions, aA as PredictCommentProfile, aC as PredictPosition, an as PredictTag, al as PredictWsClientConfig, aB as PricePoint, am as ProviderMeta, bi as ResolveEventsParamsInput, bI as SIDE, ao as SettlementSource, aY as SignalTag, bQ as SignedOrder, bj as TagSlugSelection, ax as TradeType, bD as USDC_ADDRESS, aO as UnsignedTx, a$ as WsChannel, b0 as WsChannelEvent, b1 as WsClientMessage, b7 as WsErrorCode, b8 as WsErrorMessage, b3 as WsPingMessage, b5 as WsPongMessage, b4 as WsServerMessage, b2 as WsSubscribeMessage, b6 as WsSubscribedMessage, bt as buildClobAuthMessage, bL as buildClobPayload, bF as buildCtfExchangeDomain, bJ as buildOrderMessage, bv as buildPolymarketL2Headers, bK as buildSignedOrder, ai as createPredictClient, ak as createPredictWsClient, bw as derivePolymarketApiKey, bc as eventQueryKey, bd as fetchEvent, bh as fetchEventsPage, bl as fetchMarket, bq as fetchMatchMarketsPage, bo as fetchMatchesPage, bM as getPolymarketSharesPrecision, bu as hmacSha256Base64, bg as infiniteEventsQueryKey, bk as marketQueryKey, bp as matchMarketsQueryKey, bn as matchQueryKey, bm as matchesQueryKey, bf as resolveEventsParams, be as resolveTagSlug } from './server-h41hs9SR.js';
1
+ import { P as PredictClient, a as PredictWsClient, L as ListEventsParams, b as PredictPage, c as PredictEvent, d as ProviderSource, E as EventStats, e as EventStatus, f as EventSortField, S as SimilarEventsParams, g as PredictMarket, O as OrderbookOutcome, h as Orderbook, i as ListMarketTradesParams, j as PredictTrade, k as PriceHistoryRange, l as PriceHistoryResponse, m as ListCandlesticksParams, C as Candlestick, n as ListCommentsParams, o as PredictComment, p as PositionsResponse, q as PositionValueResponse, A as AvailableSharesResponse, B as BalanceResponse, r as ListOrdersParams, s as PredictOrder, t as ListOrdersMultiParams, u as PredictOrdersResponse, v as CancelOrderResult, M as MatchesParams, w as MatchGroupPage, x as MatchGroup, y as MatchMarketParams, z as MatchMarketPage, D as ListTradesParams, F as ListTradesMultiParams, G as DFlowQuoteRequest, H as DFlowQuoteResponse, I as DFlowSubmitResponse, J as DFlowSubmitRequest, K as DFlowKYCStatus, N as PolymarketSetupStatus, Q as PolymarketDepositWalletDeployResponse, W as WithdrawBuildResponse, R as WithdrawBuildRequest, T as WithdrawSubmitResponse, U as WithdrawSubmitRequest, V as WithdrawStatusResponse, X as PolymarketDepositAddresses, Y as PolymarketSupportedAsset, Z as PolymarketWithdrawResponse, _ as PolymarketWithdrawRequest, $ as PolymarketWithdrawPrepareResponse, a0 as PolymarketWithdrawPrepareRequest, a1 as PolymarketWithdrawQuoteResponse, a2 as PolymarketWithdrawQuoteRequest, a3 as PolymarketWithdrawRelayBuildResponse, a4 as PolymarketWithdrawRelayBuildRequest, a5 as PolymarketWithdrawRelaySubmitResponse, a6 as PolymarketWithdrawRelaySubmitRequest, a7 as PolymarketWithdrawBridgeStatusResponse, a8 as PolymarketRedeemResponse, a9 as PolymarketTypedData, aa as TickSizeResponse, ab as FeeRateResponse, ac as RebateConfig, ad as WsConnectionStatus, ae as WsDataMessage, af as WsPriceEvent, ag as WsOrderbookEvent, ah as WsTradeEvent, ai as CreateOrderInput } from './server-BW_QhQos.js';
2
+ export { bD as BuildClobAuthMessageInput, bR as BuildOrderMessageInput, bu as CLOB_AUTH_DOMAIN, bv as CLOB_AUTH_TYPES, bE as CTF_EXCHANGE_ADDRESS, bJ as CTF_ORDER_TYPES, bQ as ClobOrderPayload, aI as DFlowOrderContext, aM as DepositBuildRequest, aN as DepositBuildResponse, aQ as DepositStatusResponse, aO as DepositSubmitRequest, aP as DepositSubmitResponse, az as EventSummary, bA as HttpMethod, as as MarketOutcome, ar as MarketResult, aq as MarketStatus, aA as MarketSummary, a_ as MatchConfidenceTier, aW as MatchGroupEntry, aX as MatchGroupMarket, b0 as MatchLeg, b1 as MatchMarketFlat, aY as MatchSortField, aV as MatchStatus, aZ as MatchesStats, bF as NEG_RISK_CTF_EXCHANGE_ADDRESS, bK as ORDER_TYPE, bS as OrderMessage, aH as OrderSide, aG as OrderStatus, au as OrderbookBatchItem, av as OrderbookBatchResult, at as OrderbookLevel, aw as OrderbooksBatchRequest, ax as OrderbooksBatchResponse, bH as POLYGON_CHAIN_ID, aS as PolymarketBridgeToken, aL as PolymarketDepositWalletDeployRequest, bC as PolymarketL2Headers, bB as PolymarketL2HeadersInput, aJ as PolymarketOrderType, be as PolymarketRedeemInput, bc as PolymarketRedeemPrepareInput, bd as PolymarketRedeemPrepareResponse, aT as PolymarketSupportedAssetsResponse, aU as PolymarketTypedDataArg, aK as PolymarketWalletKind, aE as PositionValue, aF as PositionValueError, ak as PredictClientOptions, aB as PredictCommentProfile, aD as PredictPosition, ao as PredictTag, am as PredictWsClientConfig, aC as PricePoint, an as ProviderMeta, bl as ResolveEventsParamsInput, bL as SIDE, ap as SettlementSource, a$ as SignalTag, bT as SignedOrder, bm as TagSlugSelection, ay as TradeType, bG as USDC_ADDRESS, aR as UnsignedTx, b2 as WsChannel, b3 as WsChannelEvent, b4 as WsClientMessage, ba as WsErrorCode, bb as WsErrorMessage, b6 as WsPingMessage, b8 as WsPongMessage, b7 as WsServerMessage, b5 as WsSubscribeMessage, b9 as WsSubscribedMessage, bw as buildClobAuthMessage, bO as buildClobPayload, bI as buildCtfExchangeDomain, bM as buildOrderMessage, by as buildPolymarketL2Headers, bN as buildSignedOrder, aj as createPredictClient, al as createPredictWsClient, bz as derivePolymarketApiKey, bf as eventQueryKey, bg as fetchEvent, bk as fetchEventsPage, bo as fetchMarket, bt as fetchMatchMarketsPage, br as fetchMatchesPage, bP as getPolymarketSharesPrecision, bx as hmacSha256Base64, bj as infiniteEventsQueryKey, bn as marketQueryKey, bs as matchMarketsQueryKey, bq as matchQueryKey, bp as matchesQueryKey, bi as resolveEventsParams, bh as resolveTagSlug } from './server-BW_QhQos.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';
@@ -414,6 +414,29 @@ declare function usePositions(params: UsePositionsParams, queryOptions?: Omit<Us
414
414
  */
415
415
  declare function usePositionsMulti(params: UsePositionsMultiParams, queryOptions?: Omit<UseQueryOptions<PositionsResponse, Error, PositionsResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PositionsResponse, Error>;
416
416
 
417
+ declare function positionValueQueryKey(user: string, source?: ProviderSource): unknown[];
418
+ declare function positionValueMultiQueryKey(wallets: {
419
+ kalshi_user?: string;
420
+ polymarket_user?: string;
421
+ }): unknown[];
422
+ /** Single-source params (backward-compatible). */
423
+ interface UsePositionValueParams {
424
+ /** Provider source. Omit to aggregate all providers (same address). */
425
+ source?: ProviderSource;
426
+ user: string;
427
+ }
428
+ /** Multi-wallet params — each provider gets its own address. */
429
+ interface UsePositionValueMultiParams {
430
+ kalshi_user?: string;
431
+ polymarket_user?: string;
432
+ }
433
+ declare function usePositionValue(params: UsePositionValueParams, queryOptions?: Omit<UseQueryOptions<PositionValueResponse, Error, PositionValueResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PositionValueResponse, Error>;
434
+ /**
435
+ * Fetch current total position value for multiple wallets in a single request.
436
+ * Each provider is queried with its own address.
437
+ */
438
+ declare function usePositionValueMulti(params: UsePositionValueMultiParams, queryOptions?: Omit<UseQueryOptions<PositionValueResponse, Error, PositionValueResponse, unknown[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<PositionValueResponse, Error>;
439
+
417
440
  interface UseAvailableSharesParams {
418
441
  source: ProviderSource;
419
442
  user: string;
@@ -511,6 +534,12 @@ interface StartTradeResultConfirmationInput {
511
534
  marketSlug?: string;
512
535
  eventSlug?: string;
513
536
  expectation: TradeResultExpectation;
537
+ /**
538
+ * Expected settlement payout for redeem confirmations. Winning redeems should
539
+ * wait for both balance and position changes; losing redeems only clear the
540
+ * position and may not change the cash balance.
541
+ */
542
+ expectedPayout?: number;
514
543
  orderId?: string;
515
544
  maxDurationMs?: number;
516
545
  getOrdersHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
@@ -1136,4 +1165,4 @@ interface WalkOrderbookParams {
1136
1165
  */
1137
1166
  declare function walkOrderbook({ orderbook, outcome, side, sharesNeeded, slippageBps, }: WalkOrderbookParams): WalkResult;
1138
1167
 
1139
- export { AvailableSharesResponse, BalanceResponse, type BuildV2OrderParams, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, type ClobOrderV2Payload, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, FeeRateResponse, ListCandlesticksParams, ListCommentsParams, ListEventsParams, ListMarketTradesParams, ListOrdersMultiParams, ListOrdersParams, ListTradesMultiParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, OrderbookOutcome, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketDepositWalletDeployResponse, PolymarketProvider, type PolymarketProviderProps, PolymarketRedeemResponse, PolymarketSetupStatus, type PolymarketSigner, PolymarketSupportedAsset, PolymarketTypedData, PolymarketWithdrawBridgeStatusResponse, PolymarketWithdrawPrepareRequest, PolymarketWithdrawPrepareResponse, PolymarketWithdrawQuoteRequest, PolymarketWithdrawQuoteResponse, PolymarketWithdrawRelayBuildRequest, PolymarketWithdrawRelayBuildResponse, PolymarketWithdrawRelaySubmitRequest, PolymarketWithdrawRelaySubmitResponse, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionsResponse, PredictClient, PredictComment, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictOrdersResponse, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, RebateConfig, type RedeemPositionVariables, SimilarEventsParams, type StartTradeResultConfirmationInput, type SyncBalanceAllowanceParams, TickSizeResponse, type TradeResultConfirmationState, type TradeResultExpectation, type UseAvailableSharesOptions, type UseAvailableSharesParams, type UseBalanceParams, type UseCancelOrderOptions, type UseCandlesticksParams, type UseEventParams, type UseInfiniteCommentsParams, type UseInfiniteMatchMarketsParams, type UseInfiniteMatchesParams, type UseInfiniteOrdersOptions, type UseInfiniteOrdersParams, type UseInfiniteTradesMultiParams, type UseInfiniteTradesParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UseOrdersMultiOptions, 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, type WalkOrderbookParams, type WalkOutcome, type WalkResult, type WalkSide, type WalkStatus, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, availableSharesQueryKey, balanceQueryKey, buildSignedV2OrderPayload, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, feeRateQueryKey, fetchEvents, infiniteCommentsQueryKey, infiniteOrdersQueryKey, infiniteTradesMultiQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersMultiQueryKey, ordersQueryKey, pickBestAsk, pickBestBid, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, polymarketSupportedAssetsQueryKey, polymarketWithdrawStatusQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, rebateConfigQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, updatePolymarketBalanceAllowance, useAvailableShares, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useDeployPolymarketDepositWallet, useEvent, useEventStats, useEvents, useFeeRate, useInfiniteComments, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useInfiniteTradesMulti, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, useOrdersMulti, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketSupportedAssets, usePolymarketWithdraw, usePolymarketWithdrawPrepareMutation, usePolymarketWithdrawQuoteMutation, usePolymarketWithdrawRelayBuildMutation, usePolymarketWithdrawRelaySubmitMutation, usePolymarketWithdrawStatusQuery, usePositions, usePositionsMulti, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRebateConfig, useRedeemPosition, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useTickSize, useTradeResultConfirmation, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, walkOrderbook, withdrawStatusQueryKey };
1168
+ export { AvailableSharesResponse, BalanceResponse, type BuildV2OrderParams, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, type ClobOrderV2Payload, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, FeeRateResponse, ListCandlesticksParams, ListCommentsParams, ListEventsParams, ListMarketTradesParams, ListOrdersMultiParams, ListOrdersParams, ListTradesMultiParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, OrderbookOutcome, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketDepositWalletDeployResponse, PolymarketProvider, type PolymarketProviderProps, PolymarketRedeemResponse, PolymarketSetupStatus, type PolymarketSigner, PolymarketSupportedAsset, PolymarketTypedData, PolymarketWithdrawBridgeStatusResponse, PolymarketWithdrawPrepareRequest, PolymarketWithdrawPrepareResponse, PolymarketWithdrawQuoteRequest, PolymarketWithdrawQuoteResponse, PolymarketWithdrawRelayBuildRequest, PolymarketWithdrawRelayBuildResponse, PolymarketWithdrawRelaySubmitRequest, PolymarketWithdrawRelaySubmitResponse, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionValueResponse, PositionsResponse, PredictClient, PredictComment, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictOrdersResponse, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, RebateConfig, type RedeemPositionVariables, SimilarEventsParams, type StartTradeResultConfirmationInput, type SyncBalanceAllowanceParams, TickSizeResponse, type TradeResultConfirmationState, type TradeResultExpectation, type UseAvailableSharesOptions, type UseAvailableSharesParams, type UseBalanceParams, type UseCancelOrderOptions, type UseCandlesticksParams, type UseEventParams, type UseInfiniteCommentsParams, type UseInfiniteMatchMarketsParams, type UseInfiniteMatchesParams, type UseInfiniteOrdersOptions, type UseInfiniteOrdersParams, type UseInfiniteTradesMultiParams, type UseInfiniteTradesParams, type UseMarketHistoryResult, type UseMarketParams, type UseMarketTradesParams, type UseOrderParams, type UseOrderbookParams, type UseOrderbookSubscriptionParams, type UseOrderbookSubscriptionResult, type UseOrdersMultiOptions, type UseOrdersOptions, type UsePositionValueMultiParams, type UsePositionValueParams, 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, type WalkOrderbookParams, type WalkOutcome, type WalkResult, type WalkSide, type WalkStatus, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, availableSharesQueryKey, balanceQueryKey, buildSignedV2OrderPayload, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, feeRateQueryKey, fetchEvents, infiniteCommentsQueryKey, infiniteOrdersQueryKey, infiniteTradesMultiQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersMultiQueryKey, ordersQueryKey, pickBestAsk, pickBestBid, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, polymarketSupportedAssetsQueryKey, polymarketWithdrawStatusQueryKey, positionValueMultiQueryKey, positionValueQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, rebateConfigQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, updatePolymarketBalanceAllowance, useAvailableShares, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useDeployPolymarketDepositWallet, useEvent, useEventStats, useEvents, useFeeRate, useInfiniteComments, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useInfiniteTradesMulti, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, useOrdersMulti, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketSupportedAssets, usePolymarketWithdraw, usePolymarketWithdrawPrepareMutation, usePolymarketWithdrawQuoteMutation, usePolymarketWithdrawRelayBuildMutation, usePolymarketWithdrawRelaySubmitMutation, usePolymarketWithdrawStatusQuery, usePositionValue, usePositionValueMulti, usePositions, usePositionsMulti, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRebateConfig, useRedeemPosition, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useTickSize, useTradeResultConfirmation, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, walkOrderbook, withdrawStatusQueryKey };
package/dist/index.js CHANGED
@@ -176,6 +176,23 @@ var PredictClient = class {
176
176
  const url = `${this.endpoint}/api/v1/positions${query}`;
177
177
  return await utils.httpGet(url);
178
178
  }
179
+ /**
180
+ * Maps to `GET /api/v1/positions/value`.
181
+ *
182
+ * Single-source: `getPositionValue("addr", "polymarket")`.
183
+ * Multi-wallet: `getPositionValue({ kalshi_user: "SOLaddr", polymarket_user: "EVMaddr" })`.
184
+ * Legacy agg: `getPositionValue("addr")` (same address for all providers).
185
+ */
186
+ async getPositionValue(userOrWallets, source) {
187
+ let query;
188
+ if (typeof userOrWallets === "string") {
189
+ query = buildQuery({ source, user: userOrWallets });
190
+ } else {
191
+ query = buildQuery(userOrWallets);
192
+ }
193
+ const url = `${this.endpoint}/api/v1/positions/value${query}`;
194
+ return await utils.httpGet(url);
195
+ }
179
196
  // -------------------------------------------------------------------------
180
197
  // Available shares (for sell flow)
181
198
  // -------------------------------------------------------------------------
@@ -1468,6 +1485,41 @@ function usePositionsMulti(params, queryOptions = {}) {
1468
1485
  ...queryOptions
1469
1486
  });
1470
1487
  }
1488
+ function positionValueQueryKey(user, source) {
1489
+ return ["predict", "position-value", source ?? "all", user];
1490
+ }
1491
+ function positionValueMultiQueryKey(wallets) {
1492
+ return [
1493
+ "predict",
1494
+ "position-value",
1495
+ "multi",
1496
+ wallets.kalshi_user ?? "",
1497
+ wallets.polymarket_user ?? ""
1498
+ ];
1499
+ }
1500
+ function usePositionValue(params, queryOptions = {}) {
1501
+ const client = usePredictClient();
1502
+ return reactQuery.useQuery({
1503
+ queryKey: positionValueQueryKey(params.user, params.source),
1504
+ queryFn: () => client.getPositionValue(params.user, params.source),
1505
+ enabled: Boolean(params.user),
1506
+ staleTime: 1e4,
1507
+ refetchInterval: 3e4,
1508
+ ...queryOptions
1509
+ });
1510
+ }
1511
+ function usePositionValueMulti(params, queryOptions = {}) {
1512
+ const client = usePredictClient();
1513
+ const hasAnyWallet = Boolean(params.kalshi_user || params.polymarket_user);
1514
+ return reactQuery.useQuery({
1515
+ queryKey: positionValueMultiQueryKey(params),
1516
+ queryFn: () => client.getPositionValue(params),
1517
+ enabled: hasAnyWallet,
1518
+ staleTime: 1e4,
1519
+ refetchInterval: 3e4,
1520
+ ...queryOptions
1521
+ });
1522
+ }
1471
1523
  function availableSharesQueryKey(params) {
1472
1524
  return [
1473
1525
  "predict",
@@ -1603,7 +1655,8 @@ var SLOW_AFTER_MS = 12e3;
1603
1655
  var QUERY_PREFIXES = [
1604
1656
  ["predict", "trades"],
1605
1657
  ["predict", "trades-by-wallet"],
1606
- ["predict", "available-shares"]
1658
+ ["predict", "available-shares"],
1659
+ ["predict", "position-value"]
1607
1660
  ];
1608
1661
  var OPEN_ORDER_STATUSES = /* @__PURE__ */ new Set(["live", "open", "submitted", "pending"]);
1609
1662
  function getPositionsWallets(input) {
@@ -1773,7 +1826,8 @@ function getOpenOrderCount(snapshot) {
1773
1826
  function hasBothAccountFields(snapshot) {
1774
1827
  return snapshot.balance !== void 0 && snapshot.positions !== void 0;
1775
1828
  }
1776
- function isTradeResultConfirmed(expectation, baseline, current) {
1829
+ function isTradeResultConfirmed(input, baseline, current) {
1830
+ const expectation = input.expectation;
1777
1831
  const ordersChanged = didFieldChange("orders", baseline, current);
1778
1832
  const baselineOpenOrders = getOpenOrderCount(baseline);
1779
1833
  const currentOpenOrders = getOpenOrderCount(current);
@@ -1803,6 +1857,9 @@ function isTradeResultConfirmed(expectation, baseline, current) {
1803
1857
  case "sell-market":
1804
1858
  return balanceIncreased && positionsDecreased;
1805
1859
  case "redeem":
1860
+ if (input.expectedPayout !== void 0 && input.expectedPayout <= 0) {
1861
+ return positionsChanged;
1862
+ }
1806
1863
  return balanceChanged && positionsChanged;
1807
1864
  case "cancel-order":
1808
1865
  return false;
@@ -1882,6 +1939,29 @@ function requestPositionsSnapshot(queryClient, predictClient, input) {
1882
1939
  return normalizePositionsData(data, input);
1883
1940
  });
1884
1941
  }
1942
+ function refreshPositionValueSnapshot(queryClient, predictClient, input) {
1943
+ const wallets = getPositionsWallets(input);
1944
+ const tasks = [];
1945
+ if (wallets) {
1946
+ tasks.push(
1947
+ predictClient.getPositionValue(wallets).then((data) => {
1948
+ queryClient.setQueryData(positionValueMultiQueryKey(wallets), data);
1949
+ })
1950
+ );
1951
+ }
1952
+ if (input.user) {
1953
+ tasks.push(
1954
+ predictClient.getPositionValue(input.user, input.source).then((data) => {
1955
+ queryClient.setQueryData(
1956
+ positionValueQueryKey(input.user, input.source),
1957
+ data
1958
+ );
1959
+ })
1960
+ );
1961
+ }
1962
+ if (tasks.length === 0) return Promise.resolve();
1963
+ return Promise.all(tasks).then(() => void 0);
1964
+ }
1885
1965
  function requestOrdersSnapshot(queryClient, predictClient, input) {
1886
1966
  if (!input.user) return Promise.resolve(void 0);
1887
1967
  const params = { source: input.source, wallet_address: input.user };
@@ -1957,7 +2037,7 @@ async function runFixedIntervalConfirmation({
1957
2037
  if (value === void 0 || settled) return;
1958
2038
  if (baseline[field] === void 0) {
1959
2039
  current[field] = value;
1960
- if (field === "orders" && isLimitExpectation(input.expectation) && isTradeResultConfirmed(input.expectation, baseline, current)) {
2040
+ if (field === "orders" && isLimitExpectation(input.expectation) && isTradeResultConfirmed(input, baseline, current)) {
1961
2041
  finishConfirmed();
1962
2042
  return;
1963
2043
  }
@@ -1965,14 +2045,18 @@ async function runFixedIntervalConfirmation({
1965
2045
  return;
1966
2046
  }
1967
2047
  current[field] = value;
1968
- if (isTradeResultConfirmed(input.expectation, baseline, current)) {
2048
+ if (isTradeResultConfirmed(input, baseline, current)) {
1969
2049
  finishConfirmed();
1970
2050
  }
1971
2051
  };
1972
2052
  const pollField = (field, request) => {
1973
2053
  if (inFlight[field] || settled) return;
1974
2054
  inFlight[field] = true;
1975
- void request().then((value) => handleSnapshot(field, value)).catch(() => void 0).finally(() => {
2055
+ void request().then((value) => handleSnapshot(field, value)).then(() => {
2056
+ if (field === "positions") {
2057
+ void refreshPositionValueSnapshot(queryClient, predictClient, input);
2058
+ }
2059
+ }).catch(() => void 0).finally(() => {
1976
2060
  inFlight[field] = false;
1977
2061
  });
1978
2062
  };
@@ -3255,6 +3339,8 @@ exports.polymarketDepositAddressesQueryKey = polymarketDepositAddressesQueryKey;
3255
3339
  exports.polymarketSetupQueryKey = polymarketSetupQueryKey;
3256
3340
  exports.polymarketSupportedAssetsQueryKey = polymarketSupportedAssetsQueryKey;
3257
3341
  exports.polymarketWithdrawStatusQueryKey = polymarketWithdrawStatusQueryKey;
3342
+ exports.positionValueMultiQueryKey = positionValueMultiQueryKey;
3343
+ exports.positionValueQueryKey = positionValueQueryKey;
3258
3344
  exports.positionsMultiQueryKey = positionsMultiQueryKey;
3259
3345
  exports.positionsQueryKey = positionsQueryKey;
3260
3346
  exports.priceHistoryQueryKey = priceHistoryQueryKey;
@@ -3305,6 +3391,8 @@ exports.usePolymarketWithdrawQuoteMutation = usePolymarketWithdrawQuoteMutation;
3305
3391
  exports.usePolymarketWithdrawRelayBuildMutation = usePolymarketWithdrawRelayBuildMutation;
3306
3392
  exports.usePolymarketWithdrawRelaySubmitMutation = usePolymarketWithdrawRelaySubmitMutation;
3307
3393
  exports.usePolymarketWithdrawStatusQuery = usePolymarketWithdrawStatusQuery;
3394
+ exports.usePositionValue = usePositionValue;
3395
+ exports.usePositionValueMulti = usePositionValueMulti;
3308
3396
  exports.usePositions = usePositions;
3309
3397
  exports.usePositionsMulti = usePositionsMulti;
3310
3398
  exports.usePredictClient = usePredictClient;