@liberfi.io/react-predict 0.1.66 → 0.1.67

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 Orderbook, h as ListMarketTradesParams, i as PredictTrade, j as PriceHistoryRange, k as PriceHistoryResponse, l as ListCandlesticksParams, C as Candlestick, m as PositionsResponse, A as AvailableSharesResponse, B as BalanceResponse, n as ListOrdersParams, o as PredictOrder, p as ListOrdersMultiParams, q as PredictOrdersResponse, r as CancelOrderResult, M as MatchesParams, s as MatchGroupPage, t as MatchGroup, u as MatchMarketParams, v as MatchMarketPage, w as ListTradesParams, x as ListTradesMultiParams, D as DFlowQuoteRequest, y as DFlowQuoteResponse, z as DFlowSubmitResponse, F as DFlowSubmitRequest, G as DFlowKYCStatus, H as PolymarketSetupStatus, W as WithdrawBuildResponse, I as WithdrawBuildRequest, J as WithdrawSubmitResponse, K as WithdrawSubmitRequest, N as WithdrawStatusResponse, Q as PolymarketDepositAddresses, R as PolymarketWithdrawResponse, T as PolymarketWithdrawRequest, U as TickSizeResponse, V as FeeRateResponse, X as WsConnectionStatus, Y as WsDataMessage, Z as WsPriceEvent, _ as WsOrderbookEvent, $ as WsTradeEvent, a0 as CreateOrderInput } from './server-DsjYCQiB.mjs';
2
- export { b5 as BuildClobAuthMessageInput, bj as BuildOrderMessageInput, aY as CLOB_AUTH_DOMAIN, aZ as CLOB_AUTH_TYPES, b6 as CTF_EXCHANGE_ADDRESS, bb as CTF_ORDER_TYPES, bi as ClobOrderPayload, ai as DFlowOrderContext, ak as DepositBuildRequest, al as DepositBuildResponse, ao as DepositStatusResponse, am as DepositSubmitRequest, an as DepositSubmitResponse, ac as EventSummary, b2 as HttpMethod, a9 as MarketOutcome, a8 as MarketResult, a7 as MarketStatus, ad as MarketSummary, ax as MatchConfidenceTier, at as MatchGroupEntry, au as MatchGroupMarket, ay as MatchMarketFlat, av as MatchSortField, as as MatchStatus, aw as MatchesStats, b7 as NEG_RISK_CTF_EXCHANGE_ADDRESS, bc as ORDER_TYPE, bk as OrderMessage, ah as OrderSide, ag as OrderStatus, aa as OrderbookLevel, b9 as POLYGON_CHAIN_ID, b4 as PolymarketL2Headers, b3 as PolymarketL2HeadersInput, aj as PolymarketOrderType, aq as PolymarketWithdrawPrepareRequest, ar as PolymarketWithdrawPrepareResponse, af as PredictPosition, a5 as PredictTag, a3 as PredictWsClientConfig, ae as PricePoint, a4 as ProviderMeta, aP as ResolveEventsParamsInput, bd as SIDE, a6 as SettlementSource, bl as SignedOrder, aQ as TagSlugSelection, ab as TradeType, b8 as USDC_ADDRESS, ap as UnsignedTx, az as WsChannel, aA as WsChannelEvent, aB as WsClientMessage, aH as WsErrorCode, aI as WsErrorMessage, aD as WsPingMessage, aF as WsPongMessage, aE as WsServerMessage, aC as WsSubscribeMessage, aG as WsSubscribedMessage, a_ as buildClobAuthMessage, bg as buildClobPayload, ba as buildCtfExchangeDomain, be as buildOrderMessage, b0 as buildPolymarketL2Headers, bf as buildSignedOrder, a1 as createPredictClient, a2 as createPredictWsClient, b1 as derivePolymarketApiKey, aJ as eventQueryKey, aK as fetchEvent, aO as fetchEventsPage, aS as fetchMarket, aX as fetchMatchMarketsPage, aV as fetchMatchesPage, bh as getPolymarketSharesPrecision, a$ as hmacSha256Base64, aN as infiniteEventsQueryKey, aR as marketQueryKey, aW as matchMarketsQueryKey, aU as matchQueryKey, aT as matchesQueryKey, aM as resolveEventsParams, aL as resolveTagSlug } from './server-DsjYCQiB.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 Orderbook, h as ListMarketTradesParams, i as PredictTrade, j as PriceHistoryRange, k as PriceHistoryResponse, l as ListCandlesticksParams, C as Candlestick, m as PositionsResponse, A as AvailableSharesResponse, B as BalanceResponse, n as ListOrdersParams, o as PredictOrder, p as ListOrdersMultiParams, q as PredictOrdersResponse, r as CancelOrderResult, M as MatchesParams, s as MatchGroupPage, t as MatchGroup, u as MatchMarketParams, v as MatchMarketPage, w as ListTradesParams, x as ListTradesMultiParams, D as DFlowQuoteRequest, y as DFlowQuoteResponse, z as DFlowSubmitResponse, F as DFlowSubmitRequest, G as DFlowKYCStatus, H as PolymarketSetupStatus, W as WithdrawBuildResponse, I as WithdrawBuildRequest, J as WithdrawSubmitResponse, K as WithdrawSubmitRequest, N as WithdrawStatusResponse, Q as PolymarketDepositAddresses, R as PolymarketWithdrawResponse, T as PolymarketWithdrawRequest, U as PolymarketRedeemResponse, V as TickSizeResponse, X as FeeRateResponse, Y as WsConnectionStatus, Z as WsDataMessage, _ as WsPriceEvent, $ as WsOrderbookEvent, a0 as WsTradeEvent, a1 as CreateOrderInput } from './server-DDzzly1V.mjs';
2
+ export { b9 as BuildClobAuthMessageInput, bn as BuildOrderMessageInput, b0 as CLOB_AUTH_DOMAIN, b1 as CLOB_AUTH_TYPES, ba as CTF_EXCHANGE_ADDRESS, bf as CTF_ORDER_TYPES, bm as ClobOrderPayload, aj as DFlowOrderContext, al as DepositBuildRequest, am as DepositBuildResponse, ap as DepositStatusResponse, an as DepositSubmitRequest, ao as DepositSubmitResponse, ad as EventSummary, b6 as HttpMethod, aa as MarketOutcome, a9 as MarketResult, a8 as MarketStatus, ae as MarketSummary, ay as MatchConfidenceTier, au as MatchGroupEntry, av as MatchGroupMarket, az as MatchMarketFlat, aw as MatchSortField, at as MatchStatus, ax as MatchesStats, bb as NEG_RISK_CTF_EXCHANGE_ADDRESS, bg as ORDER_TYPE, bo as OrderMessage, ai as OrderSide, ah as OrderStatus, ab as OrderbookLevel, bd as POLYGON_CHAIN_ID, b8 as PolymarketL2Headers, b7 as PolymarketL2HeadersInput, ak as PolymarketOrderType, aM as PolymarketRedeemInput, aK as PolymarketRedeemPrepareInput, aL as PolymarketRedeemPrepareResponse, ar as PolymarketWithdrawPrepareRequest, as as PolymarketWithdrawPrepareResponse, ag as PredictPosition, a6 as PredictTag, a4 as PredictWsClientConfig, af as PricePoint, a5 as ProviderMeta, aT as ResolveEventsParamsInput, bh as SIDE, a7 as SettlementSource, bp as SignedOrder, aU as TagSlugSelection, ac as TradeType, bc as USDC_ADDRESS, aq as UnsignedTx, aA as WsChannel, aB as WsChannelEvent, aC as WsClientMessage, aI as WsErrorCode, aJ as WsErrorMessage, aE as WsPingMessage, aG as WsPongMessage, aF as WsServerMessage, aD as WsSubscribeMessage, aH as WsSubscribedMessage, b2 as buildClobAuthMessage, bk as buildClobPayload, be as buildCtfExchangeDomain, bi as buildOrderMessage, b4 as buildPolymarketL2Headers, bj as buildSignedOrder, a2 as createPredictClient, a3 as createPredictWsClient, b5 as derivePolymarketApiKey, aN as eventQueryKey, aO as fetchEvent, aS as fetchEventsPage, aW as fetchMarket, a$ as fetchMatchMarketsPage, aZ as fetchMatchesPage, bl as getPolymarketSharesPrecision, b3 as hmacSha256Base64, aR as infiniteEventsQueryKey, aV as marketQueryKey, a_ as matchMarketsQueryKey, aY as matchQueryKey, aX as matchesQueryKey, aQ as resolveEventsParams, aP as resolveTagSlug } from './server-DDzzly1V.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';
@@ -614,6 +614,46 @@ declare function usePolymarketDepositAddresses(safeAddress: string | undefined):
614
614
  */
615
615
  declare function usePolymarketWithdraw(): _tanstack_react_query.UseMutationResult<PolymarketWithdrawResponse, Error, PolymarketWithdrawRequest, unknown>;
616
616
 
617
+ interface RedeemPositionVariables {
618
+ wallet_address: string;
619
+ condition_id: string;
620
+ neg_risk: boolean;
621
+ /**
622
+ * Sign the EIP-712 SafeTx hash with personal_sign (EIP-191).
623
+ * Receives the 0x-prefixed hash and must return the raw 65-byte
624
+ * signature (0x-prefixed, v=27/28). The backend handles v adjustment.
625
+ */
626
+ signMessage: (messageHash: string) => Promise<string>;
627
+ }
628
+ /**
629
+ * Mutation hook to redeem tokens from a resolved Polymarket market via the
630
+ * gasless Relayer. Handles the full two-step flow:
631
+ *
632
+ * 1. **Prepare** — calls the backend to compute the EIP-712 SafeTx hash
633
+ * and fetch the relayer nonce.
634
+ * 2. **Sign** — prompts the user's wallet to sign the hash via
635
+ * `personal_sign` (EIP-191).
636
+ * 3. **Execute** — sends the signed request to the backend, which adjusts
637
+ * the signature v value and submits to the Polymarket Relayer.
638
+ *
639
+ * On success, the `positions` and `balance` query caches are invalidated.
640
+ *
641
+ * @example
642
+ * ```ts
643
+ * const { mutateAsync: redeem, isPending } = useRedeemPosition();
644
+ * await redeem({
645
+ * wallet_address: "0xEOA...",
646
+ * condition_id: "0xcondition...",
647
+ * neg_risk: false,
648
+ * signMessage: async (hash) => {
649
+ * const provider = await wallet.getEip1193Provider();
650
+ * return provider.request({ method: "personal_sign", params: [hash, walletAddress] });
651
+ * },
652
+ * });
653
+ * ```
654
+ */
655
+ declare function useRedeemPosition(): _tanstack_react_query.UseMutationResult<PolymarketRedeemResponse, Error, RedeemPositionVariables, unknown>;
656
+
617
657
  declare function tickSizeQueryKey(tokenId: string): unknown[];
618
658
  /**
619
659
  * Query hook that fetches the minimum tick size for a Polymarket token.
@@ -865,4 +905,4 @@ interface CreatePolymarketOrderVariables {
865
905
  */
866
906
  declare function useCreatePolymarketOrder(mutationOptions?: Omit<UseMutationOptions<PredictOrder, Error, CreatePolymarketOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<PredictOrder, Error, CreatePolymarketOrderVariables, unknown>;
867
907
 
868
- export { AvailableSharesResponse, BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, FeeRateResponse, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersMultiParams, ListOrdersParams, ListTradesMultiParams, 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, PredictOrdersResponse, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, SimilarEventsParams, TickSizeResponse, type UseAvailableSharesOptions, type UseAvailableSharesParams, type UseBalanceParams, type UseCancelOrderOptions, type UseCandlesticksParams, type UseEventParams, 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, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, availableSharesQueryKey, balanceQueryKey, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, feeRateQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesMultiQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersMultiQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, useAvailableShares, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, useEventStats, useEvents, useFeeRate, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useInfiniteTradesMulti, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, useOrdersMulti, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketWithdraw, usePositions, usePositionsMulti, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useTickSize, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, withdrawStatusQueryKey };
908
+ export { AvailableSharesResponse, BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, FeeRateResponse, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersMultiParams, ListOrdersParams, ListTradesMultiParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketProvider, type PolymarketProviderProps, PolymarketRedeemResponse, type PolymarketSigner, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionsResponse, PredictClient, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictOrdersResponse, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, type RedeemPositionVariables, SimilarEventsParams, TickSizeResponse, type UseAvailableSharesOptions, type UseAvailableSharesParams, type UseBalanceParams, type UseCancelOrderOptions, type UseCandlesticksParams, type UseEventParams, 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, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, availableSharesQueryKey, balanceQueryKey, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, feeRateQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesMultiQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersMultiQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, useAvailableShares, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, useEventStats, useEvents, useFeeRate, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useInfiniteTradesMulti, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, useOrdersMulti, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketWithdraw, usePositions, usePositionsMulti, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRedeemPosition, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useTickSize, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, withdrawStatusQueryKey };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PredictClient, a as PredictWsClient, L as ListEventsParams, b as PredictPage, c as PredictEvent, d as ProviderSource, E as EventStats, e as EventStatus, f as EventSortField, S as SimilarEventsParams, g as PredictMarket, O as Orderbook, h as ListMarketTradesParams, i as PredictTrade, j as PriceHistoryRange, k as PriceHistoryResponse, l as ListCandlesticksParams, C as Candlestick, m as PositionsResponse, A as AvailableSharesResponse, B as BalanceResponse, n as ListOrdersParams, o as PredictOrder, p as ListOrdersMultiParams, q as PredictOrdersResponse, r as CancelOrderResult, M as MatchesParams, s as MatchGroupPage, t as MatchGroup, u as MatchMarketParams, v as MatchMarketPage, w as ListTradesParams, x as ListTradesMultiParams, D as DFlowQuoteRequest, y as DFlowQuoteResponse, z as DFlowSubmitResponse, F as DFlowSubmitRequest, G as DFlowKYCStatus, H as PolymarketSetupStatus, W as WithdrawBuildResponse, I as WithdrawBuildRequest, J as WithdrawSubmitResponse, K as WithdrawSubmitRequest, N as WithdrawStatusResponse, Q as PolymarketDepositAddresses, R as PolymarketWithdrawResponse, T as PolymarketWithdrawRequest, U as TickSizeResponse, V as FeeRateResponse, X as WsConnectionStatus, Y as WsDataMessage, Z as WsPriceEvent, _ as WsOrderbookEvent, $ as WsTradeEvent, a0 as CreateOrderInput } from './server-DsjYCQiB.js';
2
- export { b5 as BuildClobAuthMessageInput, bj as BuildOrderMessageInput, aY as CLOB_AUTH_DOMAIN, aZ as CLOB_AUTH_TYPES, b6 as CTF_EXCHANGE_ADDRESS, bb as CTF_ORDER_TYPES, bi as ClobOrderPayload, ai as DFlowOrderContext, ak as DepositBuildRequest, al as DepositBuildResponse, ao as DepositStatusResponse, am as DepositSubmitRequest, an as DepositSubmitResponse, ac as EventSummary, b2 as HttpMethod, a9 as MarketOutcome, a8 as MarketResult, a7 as MarketStatus, ad as MarketSummary, ax as MatchConfidenceTier, at as MatchGroupEntry, au as MatchGroupMarket, ay as MatchMarketFlat, av as MatchSortField, as as MatchStatus, aw as MatchesStats, b7 as NEG_RISK_CTF_EXCHANGE_ADDRESS, bc as ORDER_TYPE, bk as OrderMessage, ah as OrderSide, ag as OrderStatus, aa as OrderbookLevel, b9 as POLYGON_CHAIN_ID, b4 as PolymarketL2Headers, b3 as PolymarketL2HeadersInput, aj as PolymarketOrderType, aq as PolymarketWithdrawPrepareRequest, ar as PolymarketWithdrawPrepareResponse, af as PredictPosition, a5 as PredictTag, a3 as PredictWsClientConfig, ae as PricePoint, a4 as ProviderMeta, aP as ResolveEventsParamsInput, bd as SIDE, a6 as SettlementSource, bl as SignedOrder, aQ as TagSlugSelection, ab as TradeType, b8 as USDC_ADDRESS, ap as UnsignedTx, az as WsChannel, aA as WsChannelEvent, aB as WsClientMessage, aH as WsErrorCode, aI as WsErrorMessage, aD as WsPingMessage, aF as WsPongMessage, aE as WsServerMessage, aC as WsSubscribeMessage, aG as WsSubscribedMessage, a_ as buildClobAuthMessage, bg as buildClobPayload, ba as buildCtfExchangeDomain, be as buildOrderMessage, b0 as buildPolymarketL2Headers, bf as buildSignedOrder, a1 as createPredictClient, a2 as createPredictWsClient, b1 as derivePolymarketApiKey, aJ as eventQueryKey, aK as fetchEvent, aO as fetchEventsPage, aS as fetchMarket, aX as fetchMatchMarketsPage, aV as fetchMatchesPage, bh as getPolymarketSharesPrecision, a$ as hmacSha256Base64, aN as infiniteEventsQueryKey, aR as marketQueryKey, aW as matchMarketsQueryKey, aU as matchQueryKey, aT as matchesQueryKey, aM as resolveEventsParams, aL as resolveTagSlug } from './server-DsjYCQiB.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 Orderbook, h as ListMarketTradesParams, i as PredictTrade, j as PriceHistoryRange, k as PriceHistoryResponse, l as ListCandlesticksParams, C as Candlestick, m as PositionsResponse, A as AvailableSharesResponse, B as BalanceResponse, n as ListOrdersParams, o as PredictOrder, p as ListOrdersMultiParams, q as PredictOrdersResponse, r as CancelOrderResult, M as MatchesParams, s as MatchGroupPage, t as MatchGroup, u as MatchMarketParams, v as MatchMarketPage, w as ListTradesParams, x as ListTradesMultiParams, D as DFlowQuoteRequest, y as DFlowQuoteResponse, z as DFlowSubmitResponse, F as DFlowSubmitRequest, G as DFlowKYCStatus, H as PolymarketSetupStatus, W as WithdrawBuildResponse, I as WithdrawBuildRequest, J as WithdrawSubmitResponse, K as WithdrawSubmitRequest, N as WithdrawStatusResponse, Q as PolymarketDepositAddresses, R as PolymarketWithdrawResponse, T as PolymarketWithdrawRequest, U as PolymarketRedeemResponse, V as TickSizeResponse, X as FeeRateResponse, Y as WsConnectionStatus, Z as WsDataMessage, _ as WsPriceEvent, $ as WsOrderbookEvent, a0 as WsTradeEvent, a1 as CreateOrderInput } from './server-DDzzly1V.js';
2
+ export { b9 as BuildClobAuthMessageInput, bn as BuildOrderMessageInput, b0 as CLOB_AUTH_DOMAIN, b1 as CLOB_AUTH_TYPES, ba as CTF_EXCHANGE_ADDRESS, bf as CTF_ORDER_TYPES, bm as ClobOrderPayload, aj as DFlowOrderContext, al as DepositBuildRequest, am as DepositBuildResponse, ap as DepositStatusResponse, an as DepositSubmitRequest, ao as DepositSubmitResponse, ad as EventSummary, b6 as HttpMethod, aa as MarketOutcome, a9 as MarketResult, a8 as MarketStatus, ae as MarketSummary, ay as MatchConfidenceTier, au as MatchGroupEntry, av as MatchGroupMarket, az as MatchMarketFlat, aw as MatchSortField, at as MatchStatus, ax as MatchesStats, bb as NEG_RISK_CTF_EXCHANGE_ADDRESS, bg as ORDER_TYPE, bo as OrderMessage, ai as OrderSide, ah as OrderStatus, ab as OrderbookLevel, bd as POLYGON_CHAIN_ID, b8 as PolymarketL2Headers, b7 as PolymarketL2HeadersInput, ak as PolymarketOrderType, aM as PolymarketRedeemInput, aK as PolymarketRedeemPrepareInput, aL as PolymarketRedeemPrepareResponse, ar as PolymarketWithdrawPrepareRequest, as as PolymarketWithdrawPrepareResponse, ag as PredictPosition, a6 as PredictTag, a4 as PredictWsClientConfig, af as PricePoint, a5 as ProviderMeta, aT as ResolveEventsParamsInput, bh as SIDE, a7 as SettlementSource, bp as SignedOrder, aU as TagSlugSelection, ac as TradeType, bc as USDC_ADDRESS, aq as UnsignedTx, aA as WsChannel, aB as WsChannelEvent, aC as WsClientMessage, aI as WsErrorCode, aJ as WsErrorMessage, aE as WsPingMessage, aG as WsPongMessage, aF as WsServerMessage, aD as WsSubscribeMessage, aH as WsSubscribedMessage, b2 as buildClobAuthMessage, bk as buildClobPayload, be as buildCtfExchangeDomain, bi as buildOrderMessage, b4 as buildPolymarketL2Headers, bj as buildSignedOrder, a2 as createPredictClient, a3 as createPredictWsClient, b5 as derivePolymarketApiKey, aN as eventQueryKey, aO as fetchEvent, aS as fetchEventsPage, aW as fetchMarket, a$ as fetchMatchMarketsPage, aZ as fetchMatchesPage, bl as getPolymarketSharesPrecision, b3 as hmacSha256Base64, aR as infiniteEventsQueryKey, aV as marketQueryKey, a_ as matchMarketsQueryKey, aY as matchQueryKey, aX as matchesQueryKey, aQ as resolveEventsParams, aP as resolveTagSlug } from './server-DDzzly1V.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';
@@ -614,6 +614,46 @@ declare function usePolymarketDepositAddresses(safeAddress: string | undefined):
614
614
  */
615
615
  declare function usePolymarketWithdraw(): _tanstack_react_query.UseMutationResult<PolymarketWithdrawResponse, Error, PolymarketWithdrawRequest, unknown>;
616
616
 
617
+ interface RedeemPositionVariables {
618
+ wallet_address: string;
619
+ condition_id: string;
620
+ neg_risk: boolean;
621
+ /**
622
+ * Sign the EIP-712 SafeTx hash with personal_sign (EIP-191).
623
+ * Receives the 0x-prefixed hash and must return the raw 65-byte
624
+ * signature (0x-prefixed, v=27/28). The backend handles v adjustment.
625
+ */
626
+ signMessage: (messageHash: string) => Promise<string>;
627
+ }
628
+ /**
629
+ * Mutation hook to redeem tokens from a resolved Polymarket market via the
630
+ * gasless Relayer. Handles the full two-step flow:
631
+ *
632
+ * 1. **Prepare** — calls the backend to compute the EIP-712 SafeTx hash
633
+ * and fetch the relayer nonce.
634
+ * 2. **Sign** — prompts the user's wallet to sign the hash via
635
+ * `personal_sign` (EIP-191).
636
+ * 3. **Execute** — sends the signed request to the backend, which adjusts
637
+ * the signature v value and submits to the Polymarket Relayer.
638
+ *
639
+ * On success, the `positions` and `balance` query caches are invalidated.
640
+ *
641
+ * @example
642
+ * ```ts
643
+ * const { mutateAsync: redeem, isPending } = useRedeemPosition();
644
+ * await redeem({
645
+ * wallet_address: "0xEOA...",
646
+ * condition_id: "0xcondition...",
647
+ * neg_risk: false,
648
+ * signMessage: async (hash) => {
649
+ * const provider = await wallet.getEip1193Provider();
650
+ * return provider.request({ method: "personal_sign", params: [hash, walletAddress] });
651
+ * },
652
+ * });
653
+ * ```
654
+ */
655
+ declare function useRedeemPosition(): _tanstack_react_query.UseMutationResult<PolymarketRedeemResponse, Error, RedeemPositionVariables, unknown>;
656
+
617
657
  declare function tickSizeQueryKey(tokenId: string): unknown[];
618
658
  /**
619
659
  * Query hook that fetches the minimum tick size for a Polymarket token.
@@ -865,4 +905,4 @@ interface CreatePolymarketOrderVariables {
865
905
  */
866
906
  declare function useCreatePolymarketOrder(mutationOptions?: Omit<UseMutationOptions<PredictOrder, Error, CreatePolymarketOrderVariables>, "mutationFn">): _tanstack_react_query.UseMutationResult<PredictOrder, Error, CreatePolymarketOrderVariables, unknown>;
867
907
 
868
- export { AvailableSharesResponse, BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, FeeRateResponse, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersMultiParams, ListOrdersParams, ListTradesMultiParams, 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, PredictOrdersResponse, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, SimilarEventsParams, TickSizeResponse, type UseAvailableSharesOptions, type UseAvailableSharesParams, type UseBalanceParams, type UseCancelOrderOptions, type UseCandlesticksParams, type UseEventParams, 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, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, availableSharesQueryKey, balanceQueryKey, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, feeRateQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesMultiQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersMultiQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, useAvailableShares, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, useEventStats, useEvents, useFeeRate, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useInfiniteTradesMulti, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, useOrdersMulti, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketWithdraw, usePositions, usePositionsMulti, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useTickSize, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, withdrawStatusQueryKey };
908
+ export { AvailableSharesResponse, BalanceResponse, CancelOrderResult, type CancelOrderVariables, Candlestick, ChartRange, type ChartRangeType, CreateOrderInput, type CreatePolymarketOrderVariables, DFlowKYCStatus, DFlowQuoteRequest, DFlowQuoteResponse, DFlowSubmitRequest, DFlowSubmitResponse, EventSortField, EventStats, EventStatus, FeeRateResponse, ListCandlesticksParams, ListEventsParams, ListMarketTradesParams, ListOrdersMultiParams, ListOrdersParams, ListTradesMultiParams, ListTradesParams, type MarketHistoryPoint, type MarketHistorySeries, MatchGroup, MatchGroupPage, MatchMarketPage, MatchMarketParams, MatchesParams, Orderbook, PolymarketContext, type PolymarketContextValue, type PolymarketCredentials, PolymarketDepositAddresses, type PolymarketDepositResult, type PolymarketDepositVariables, PolymarketProvider, type PolymarketProviderProps, PolymarketRedeemResponse, type PolymarketSigner, PolymarketWithdrawRequest, PolymarketWithdrawResponse, PositionsResponse, PredictClient, PredictContext, type PredictContextValue, PredictEvent, PredictMarket, PredictOrder, PredictOrdersResponse, PredictPage, PredictProvider, type PredictProviderProps, PredictTrade, PredictWsClient, PriceHistoryRange, PriceHistoryResponse, ProviderSource, type RedeemPositionVariables, SimilarEventsParams, TickSizeResponse, type UseAvailableSharesOptions, type UseAvailableSharesParams, type UseBalanceParams, type UseCancelOrderOptions, type UseCandlesticksParams, type UseEventParams, 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, WithdrawBuildRequest, WithdrawBuildResponse, WithdrawStatusResponse, WithdrawSubmitRequest, WithdrawSubmitResponse, WsConnectionStatus, WsDataMessage, WsOrderbookEvent, WsPriceEvent, WsTradeEvent, availableSharesQueryKey, balanceQueryKey, candlesticksQueryKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventStatsQueryKey, eventsQueryKey, feeRateQueryKey, fetchEvents, infiniteOrdersQueryKey, infiniteTradesMultiQueryKey, infiniteTradesQueryKey, marketTradesQueryKey, orderQueryKey, orderbookQueryKey, ordersMultiQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, similarEventsQueryKey, tickSizeQueryKey, tradesQueryKey, useAvailableShares, useBalance, useCancelOrder, useCandlesticks, useCreatePolymarketOrder, useDFlowKYC, useDFlowQuote, useDFlowSubmit, useEvent, useEventStats, useEvents, useFeeRate, useInfiniteEvents, useInfiniteMatchMarkets, useInfiniteMatches, useInfiniteOrders, useInfiniteTrades, useInfiniteTradesMulti, useMarket, useMarketHistory, useMarketTrades, useMatch, useOrder, useOrderbook, useOrderbookSubscription, useOrders, useOrdersMulti, usePolymarket, usePolymarketDeposit, usePolymarketDepositAddresses, usePolymarketSetup, usePolymarketWithdraw, usePositions, usePositionsMulti, usePredictClient, usePredictWsClient, usePriceHistory, usePricesSubscription, useRealtimeOrderbook, useRealtimePrices, useRealtimeTrades, useRedeemPosition, useRunPolymarketSetup, useSearchEvents, useSimilarEvents, useTickSize, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, withdrawStatusQueryKey };
package/dist/index.js CHANGED
@@ -435,6 +435,29 @@ var PredictClient = class {
435
435
  const url = `${this.endpoint}/api/v1/withdraw/polymarket/execute`;
436
436
  return await utils.httpPost(url, body);
437
437
  }
438
+ // -------------------------------------------------------------------------
439
+ // Redeem (resolved market token redemption)
440
+ // -------------------------------------------------------------------------
441
+ /**
442
+ * Prepare EIP-712 SafeTx typed data for a Polymarket redeem transaction.
443
+ * The frontend must sign this data and pass the signature to `redeemPolymarket`.
444
+ *
445
+ * Maps to `POST /api/v1/redeem/polymarket/prepare`.
446
+ */
447
+ async prepareRedeemPolymarket(body) {
448
+ const url = `${this.endpoint}/api/v1/redeem/polymarket/prepare`;
449
+ return await utils.httpPost(url, body);
450
+ }
451
+ /**
452
+ * Redeem tokens from a resolved Polymarket market via gasless Relayer.
453
+ * Requires a valid EIP-712 signature from the prepare step.
454
+ *
455
+ * Maps to `POST /api/v1/redeem/polymarket`.
456
+ */
457
+ async redeemPolymarket(body) {
458
+ const url = `${this.endpoint}/api/v1/redeem/polymarket`;
459
+ return await utils.httpPost(url, body);
460
+ }
438
461
  };
439
462
  function createPredictClient(endpoint) {
440
463
  return new PredictClient(endpoint);
@@ -1714,6 +1737,36 @@ function usePolymarketWithdraw() {
1714
1737
  mutationFn: (req) => client.executePolymarketWithdraw(req)
1715
1738
  });
1716
1739
  }
1740
+ function useRedeemPosition() {
1741
+ const client = usePredictClient();
1742
+ const queryClient = reactQuery.useQueryClient();
1743
+ return reactQuery.useMutation({
1744
+ mutationFn: async ({
1745
+ wallet_address,
1746
+ condition_id,
1747
+ neg_risk,
1748
+ signMessage
1749
+ }) => {
1750
+ const prepared = await client.prepareRedeemPolymarket({
1751
+ wallet_address,
1752
+ condition_id,
1753
+ neg_risk
1754
+ });
1755
+ const signature = await signMessage(prepared.message_hash);
1756
+ return client.redeemPolymarket({
1757
+ wallet_address,
1758
+ condition_id,
1759
+ neg_risk,
1760
+ signature,
1761
+ nonce: prepared.nonce
1762
+ });
1763
+ },
1764
+ onSuccess: () => {
1765
+ queryClient.invalidateQueries({ queryKey: ["predict", "positions"] });
1766
+ queryClient.invalidateQueries({ queryKey: ["predict", "balance"] });
1767
+ }
1768
+ });
1769
+ }
1717
1770
  function tickSizeQueryKey(tokenId) {
1718
1771
  return ["predict", "polymarket", "tick-size", tokenId];
1719
1772
  }
@@ -2339,6 +2392,7 @@ exports.usePricesSubscription = usePricesSubscription;
2339
2392
  exports.useRealtimeOrderbook = useRealtimeOrderbook;
2340
2393
  exports.useRealtimePrices = useRealtimePrices;
2341
2394
  exports.useRealtimeTrades = useRealtimeTrades;
2395
+ exports.useRedeemPosition = useRedeemPosition;
2342
2396
  exports.useRunPolymarketSetup = useRunPolymarketSetup;
2343
2397
  exports.useSearchEvents = useSearchEvents;
2344
2398
  exports.useSimilarEvents = useSimilarEvents;