@liberfi.io/react-predict 0.3.47 → 0.3.49
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 +21 -10
- package/dist/index.d.ts +21 -10
- package/dist/index.js +78 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +78 -14
- package/dist/index.mjs.map +1 -1
- package/dist/{server-Byq4PK9C.d.mts → server-D5LNY5tz.d.mts} +28 -8
- package/dist/{server-Byq4PK9C.d.ts → server-D5LNY5tz.d.ts} +28 -8
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +44 -10
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +44 -10
- package/dist/server.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PredictClient, a as PredictWsClient, L as ListEventsParams, b as PredictPage, c as PredictEvent, d as ProviderSource, E as EventStats, e as EventStatus, f as EventSortField, S as SimilarEventsParams, g as PredictMarket, O as 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
|
|
2
|
-
export { bz as BuildClobAuthMessageInput, bN as BuildOrderMessageInput, bq as CLOB_AUTH_DOMAIN, br as CLOB_AUTH_TYPES, bA as CTF_EXCHANGE_ADDRESS, bF as CTF_ORDER_TYPES, bM as ClobOrderPayload,
|
|
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-D5LNY5tz.mjs';
|
|
2
|
+
export { bz as BuildClobAuthMessageInput, bN as BuildOrderMessageInput, bq as CLOB_AUTH_DOMAIN, br as CLOB_AUTH_TYPES, bA as CTF_EXCHANGE_ADDRESS, bF as CTF_ORDER_TYPES, bM as ClobOrderPayload, aE as DFlowOrderContext, aI as DepositBuildRequest, aJ as DepositBuildResponse, aM as DepositStatusResponse, aK as DepositSubmitRequest, aL as DepositSubmitResponse, ax as EventSummary, bw as HttpMethod, aq as MarketOutcome, ap as MarketResult, ao as MarketStatus, ay as MarketSummary, aW as MatchConfidenceTier, aS as MatchGroupEntry, aT as MatchGroupMarket, aY as MatchLeg, aZ as MatchMarketFlat, aU as MatchSortField, aR as MatchStatus, aV as MatchesStats, bB as NEG_RISK_CTF_EXCHANGE_ADDRESS, bG as ORDER_TYPE, bO as OrderMessage, aD as OrderSide, aC as OrderStatus, as as OrderbookBatchItem, at as OrderbookBatchResult, ar as OrderbookLevel, au as OrderbooksBatchRequest, av as OrderbooksBatchResponse, bD as POLYGON_CHAIN_ID, aO as PolymarketBridgeToken, aH as PolymarketDepositWalletDeployRequest, by as PolymarketL2Headers, bx as PolymarketL2HeadersInput, aF as PolymarketOrderType, ba as PolymarketRedeemInput, b8 as PolymarketRedeemPrepareInput, b9 as PolymarketRedeemPrepareResponse, aP as PolymarketSupportedAssetsResponse, aQ as PolymarketTypedDataArg, aG as PolymarketWalletKind, az as PredictCommentProfile, aB as PredictPosition, am as PredictTag, ak as PredictWsClientConfig, aA as PricePoint, al as ProviderMeta, bh as ResolveEventsParamsInput, bH as SIDE, an as SettlementSource, aX as SignalTag, bP as SignedOrder, bi as TagSlugSelection, aw as TradeType, bC as USDC_ADDRESS, aN as UnsignedTx, a_ as WsChannel, a$ as WsChannelEvent, b0 as WsClientMessage, b6 as WsErrorCode, b7 as WsErrorMessage, b2 as WsPingMessage, b4 as WsPongMessage, b3 as WsServerMessage, b1 as WsSubscribeMessage, b5 as WsSubscribedMessage, bs as buildClobAuthMessage, bK as buildClobPayload, bE as buildCtfExchangeDomain, bI as buildOrderMessage, bu as buildPolymarketL2Headers, bJ as buildSignedOrder, ai as createPredictClient, aj as createPredictWsClient, bv as derivePolymarketApiKey, bb as eventQueryKey, bc as fetchEvent, bg as fetchEventsPage, bk as fetchMarket, bp as fetchMatchMarketsPage, bn as fetchMatchesPage, bL as getPolymarketSharesPrecision, bt as hmacSha256Base64, bf as infiniteEventsQueryKey, bj as marketQueryKey, bo as matchMarketsQueryKey, bm as matchQueryKey, bl as matchesQueryKey, be as resolveEventsParams, bd as resolveTagSlug } from './server-D5LNY5tz.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';
|
|
@@ -678,22 +678,26 @@ interface RedeemPositionVariables {
|
|
|
678
678
|
condition_id: string;
|
|
679
679
|
neg_risk: boolean;
|
|
680
680
|
/**
|
|
681
|
-
* Sign the EIP-712 SafeTx hash with personal_sign (EIP-191).
|
|
681
|
+
* Sign the legacy EIP-712 SafeTx hash with personal_sign (EIP-191).
|
|
682
682
|
* Receives the 0x-prefixed hash and must return the raw 65-byte
|
|
683
683
|
* signature (0x-prefixed, v=27/28). The backend handles v adjustment.
|
|
684
684
|
*/
|
|
685
685
|
signMessage: (messageHash: string) => Promise<string>;
|
|
686
|
+
/**
|
|
687
|
+
* Sign CLOB V2 deposit-wallet Batch typed data via eth_signTypedData_v4.
|
|
688
|
+
* Required when the backend resolves wallet_kind="deposit".
|
|
689
|
+
*/
|
|
690
|
+
signTypedData?: (typedData: PolymarketTypedData) => Promise<string>;
|
|
686
691
|
}
|
|
687
692
|
/**
|
|
688
693
|
* Mutation hook to redeem tokens from a resolved Polymarket market via the
|
|
689
694
|
* gasless Relayer. Handles the full two-step flow:
|
|
690
695
|
*
|
|
691
|
-
* 1. **Prepare** — calls the backend to
|
|
692
|
-
*
|
|
693
|
-
* 2. **Sign** — prompts the user's wallet to sign the hash
|
|
694
|
-
*
|
|
695
|
-
* 3. **Execute** — sends the signed request to the backend
|
|
696
|
-
* the signature v value and submits to the Polymarket Relayer.
|
|
696
|
+
* 1. **Prepare** — calls the backend to resolve the active wallet and fetch
|
|
697
|
+
* the relayer nonce.
|
|
698
|
+
* 2. **Sign** — prompts the user's wallet to sign either the legacy Safe hash
|
|
699
|
+
* or the deposit-wallet Batch typed data.
|
|
700
|
+
* 3. **Execute** — sends the signed request to the backend for Relayer submit.
|
|
697
701
|
*
|
|
698
702
|
* On success, the `positions` and `balance` query caches are invalidated.
|
|
699
703
|
*
|
|
@@ -708,6 +712,13 @@ interface RedeemPositionVariables {
|
|
|
708
712
|
* const provider = await wallet.getEip1193Provider();
|
|
709
713
|
* return provider.request({ method: "personal_sign", params: [hash, walletAddress] });
|
|
710
714
|
* },
|
|
715
|
+
* signTypedData: async (typedData) => {
|
|
716
|
+
* const provider = await wallet.getEip1193Provider();
|
|
717
|
+
* return provider.request({
|
|
718
|
+
* method: "eth_signTypedData_v4",
|
|
719
|
+
* params: [walletAddress, JSON.stringify(typedData)],
|
|
720
|
+
* });
|
|
721
|
+
* },
|
|
711
722
|
* });
|
|
712
723
|
* ```
|
|
713
724
|
*/
|
|
@@ -1101,4 +1112,4 @@ interface WalkOrderbookParams {
|
|
|
1101
1112
|
*/
|
|
1102
1113
|
declare function walkOrderbook({ orderbook, outcome, side, sharesNeeded, slippageBps, }: WalkOrderbookParams): WalkResult;
|
|
1103
1114
|
|
|
1104
|
-
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, 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 SyncBalanceAllowanceParams, TickSizeResponse, 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, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, walkOrderbook, withdrawStatusQueryKey };
|
|
1115
|
+
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 SyncBalanceAllowanceParams, TickSizeResponse, 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, 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
|
|
2
|
-
export { bz as BuildClobAuthMessageInput, bN as BuildOrderMessageInput, bq as CLOB_AUTH_DOMAIN, br as CLOB_AUTH_TYPES, bA as CTF_EXCHANGE_ADDRESS, bF as CTF_ORDER_TYPES, bM as ClobOrderPayload,
|
|
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-D5LNY5tz.js';
|
|
2
|
+
export { bz as BuildClobAuthMessageInput, bN as BuildOrderMessageInput, bq as CLOB_AUTH_DOMAIN, br as CLOB_AUTH_TYPES, bA as CTF_EXCHANGE_ADDRESS, bF as CTF_ORDER_TYPES, bM as ClobOrderPayload, aE as DFlowOrderContext, aI as DepositBuildRequest, aJ as DepositBuildResponse, aM as DepositStatusResponse, aK as DepositSubmitRequest, aL as DepositSubmitResponse, ax as EventSummary, bw as HttpMethod, aq as MarketOutcome, ap as MarketResult, ao as MarketStatus, ay as MarketSummary, aW as MatchConfidenceTier, aS as MatchGroupEntry, aT as MatchGroupMarket, aY as MatchLeg, aZ as MatchMarketFlat, aU as MatchSortField, aR as MatchStatus, aV as MatchesStats, bB as NEG_RISK_CTF_EXCHANGE_ADDRESS, bG as ORDER_TYPE, bO as OrderMessage, aD as OrderSide, aC as OrderStatus, as as OrderbookBatchItem, at as OrderbookBatchResult, ar as OrderbookLevel, au as OrderbooksBatchRequest, av as OrderbooksBatchResponse, bD as POLYGON_CHAIN_ID, aO as PolymarketBridgeToken, aH as PolymarketDepositWalletDeployRequest, by as PolymarketL2Headers, bx as PolymarketL2HeadersInput, aF as PolymarketOrderType, ba as PolymarketRedeemInput, b8 as PolymarketRedeemPrepareInput, b9 as PolymarketRedeemPrepareResponse, aP as PolymarketSupportedAssetsResponse, aQ as PolymarketTypedDataArg, aG as PolymarketWalletKind, az as PredictCommentProfile, aB as PredictPosition, am as PredictTag, ak as PredictWsClientConfig, aA as PricePoint, al as ProviderMeta, bh as ResolveEventsParamsInput, bH as SIDE, an as SettlementSource, aX as SignalTag, bP as SignedOrder, bi as TagSlugSelection, aw as TradeType, bC as USDC_ADDRESS, aN as UnsignedTx, a_ as WsChannel, a$ as WsChannelEvent, b0 as WsClientMessage, b6 as WsErrorCode, b7 as WsErrorMessage, b2 as WsPingMessage, b4 as WsPongMessage, b3 as WsServerMessage, b1 as WsSubscribeMessage, b5 as WsSubscribedMessage, bs as buildClobAuthMessage, bK as buildClobPayload, bE as buildCtfExchangeDomain, bI as buildOrderMessage, bu as buildPolymarketL2Headers, bJ as buildSignedOrder, ai as createPredictClient, aj as createPredictWsClient, bv as derivePolymarketApiKey, bb as eventQueryKey, bc as fetchEvent, bg as fetchEventsPage, bk as fetchMarket, bp as fetchMatchMarketsPage, bn as fetchMatchesPage, bL as getPolymarketSharesPrecision, bt as hmacSha256Base64, bf as infiniteEventsQueryKey, bj as marketQueryKey, bo as matchMarketsQueryKey, bm as matchQueryKey, bl as matchesQueryKey, be as resolveEventsParams, bd as resolveTagSlug } from './server-D5LNY5tz.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';
|
|
@@ -678,22 +678,26 @@ interface RedeemPositionVariables {
|
|
|
678
678
|
condition_id: string;
|
|
679
679
|
neg_risk: boolean;
|
|
680
680
|
/**
|
|
681
|
-
* Sign the EIP-712 SafeTx hash with personal_sign (EIP-191).
|
|
681
|
+
* Sign the legacy EIP-712 SafeTx hash with personal_sign (EIP-191).
|
|
682
682
|
* Receives the 0x-prefixed hash and must return the raw 65-byte
|
|
683
683
|
* signature (0x-prefixed, v=27/28). The backend handles v adjustment.
|
|
684
684
|
*/
|
|
685
685
|
signMessage: (messageHash: string) => Promise<string>;
|
|
686
|
+
/**
|
|
687
|
+
* Sign CLOB V2 deposit-wallet Batch typed data via eth_signTypedData_v4.
|
|
688
|
+
* Required when the backend resolves wallet_kind="deposit".
|
|
689
|
+
*/
|
|
690
|
+
signTypedData?: (typedData: PolymarketTypedData) => Promise<string>;
|
|
686
691
|
}
|
|
687
692
|
/**
|
|
688
693
|
* Mutation hook to redeem tokens from a resolved Polymarket market via the
|
|
689
694
|
* gasless Relayer. Handles the full two-step flow:
|
|
690
695
|
*
|
|
691
|
-
* 1. **Prepare** — calls the backend to
|
|
692
|
-
*
|
|
693
|
-
* 2. **Sign** — prompts the user's wallet to sign the hash
|
|
694
|
-
*
|
|
695
|
-
* 3. **Execute** — sends the signed request to the backend
|
|
696
|
-
* the signature v value and submits to the Polymarket Relayer.
|
|
696
|
+
* 1. **Prepare** — calls the backend to resolve the active wallet and fetch
|
|
697
|
+
* the relayer nonce.
|
|
698
|
+
* 2. **Sign** — prompts the user's wallet to sign either the legacy Safe hash
|
|
699
|
+
* or the deposit-wallet Batch typed data.
|
|
700
|
+
* 3. **Execute** — sends the signed request to the backend for Relayer submit.
|
|
697
701
|
*
|
|
698
702
|
* On success, the `positions` and `balance` query caches are invalidated.
|
|
699
703
|
*
|
|
@@ -708,6 +712,13 @@ interface RedeemPositionVariables {
|
|
|
708
712
|
* const provider = await wallet.getEip1193Provider();
|
|
709
713
|
* return provider.request({ method: "personal_sign", params: [hash, walletAddress] });
|
|
710
714
|
* },
|
|
715
|
+
* signTypedData: async (typedData) => {
|
|
716
|
+
* const provider = await wallet.getEip1193Provider();
|
|
717
|
+
* return provider.request({
|
|
718
|
+
* method: "eth_signTypedData_v4",
|
|
719
|
+
* params: [walletAddress, JSON.stringify(typedData)],
|
|
720
|
+
* });
|
|
721
|
+
* },
|
|
711
722
|
* });
|
|
712
723
|
* ```
|
|
713
724
|
*/
|
|
@@ -1101,4 +1112,4 @@ interface WalkOrderbookParams {
|
|
|
1101
1112
|
*/
|
|
1102
1113
|
declare function walkOrderbook({ orderbook, outcome, side, sharesNeeded, slippageBps, }: WalkOrderbookParams): WalkResult;
|
|
1103
1114
|
|
|
1104
|
-
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, 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 SyncBalanceAllowanceParams, TickSizeResponse, 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, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, walkOrderbook, withdrawStatusQueryKey };
|
|
1115
|
+
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 SyncBalanceAllowanceParams, TickSizeResponse, 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, useTrades, useTradesSubscription, useWithdrawBuildMutation, useWithdrawStatusQuery, useWithdrawSubmitMutation, walkOrderbook, withdrawStatusQueryKey };
|
package/dist/index.js
CHANGED
|
@@ -521,8 +521,9 @@ var PredictClient = class {
|
|
|
521
521
|
// Redeem (resolved market token redemption)
|
|
522
522
|
// -------------------------------------------------------------------------
|
|
523
523
|
/**
|
|
524
|
-
* Prepare
|
|
525
|
-
* The frontend must sign
|
|
524
|
+
* Prepare the signing payload for a Polymarket redeem transaction.
|
|
525
|
+
* The frontend must sign the returned Safe hash or deposit-wallet typed data
|
|
526
|
+
* and pass the signature to `redeemPolymarket`.
|
|
526
527
|
*
|
|
527
528
|
* Maps to `POST /api/v1/redeem/polymarket/prepare`.
|
|
528
529
|
*/
|
|
@@ -532,7 +533,7 @@ var PredictClient = class {
|
|
|
532
533
|
}
|
|
533
534
|
/**
|
|
534
535
|
* Redeem tokens from a resolved Polymarket market via gasless Relayer.
|
|
535
|
-
* Requires a valid
|
|
536
|
+
* Requires a valid signature for the payload returned by the prepare step.
|
|
536
537
|
*
|
|
537
538
|
* Maps to `POST /api/v1/redeem/polymarket`.
|
|
538
539
|
*/
|
|
@@ -550,6 +551,13 @@ var DEFAULT_RECONNECT_BASE = 1e3;
|
|
|
550
551
|
var DEFAULT_RECONNECT_MAX = 3e4;
|
|
551
552
|
var DEFAULT_PING_INTERVAL = 2e4;
|
|
552
553
|
var DEFAULT_PONG_TIMEOUT = 1e4;
|
|
554
|
+
var MAX_SUBSCRIPTION_FRAME_BYTES = 3500;
|
|
555
|
+
function byteLength(str) {
|
|
556
|
+
if (typeof TextEncoder !== "undefined") {
|
|
557
|
+
return new TextEncoder().encode(str).length;
|
|
558
|
+
}
|
|
559
|
+
return str.length;
|
|
560
|
+
}
|
|
553
561
|
var PredictWsClient = class {
|
|
554
562
|
ws = null;
|
|
555
563
|
wsUrl;
|
|
@@ -667,7 +675,7 @@ var PredictWsClient = class {
|
|
|
667
675
|
const set = this.subs.channels.get(ch);
|
|
668
676
|
for (const slug of marketSlugs) set.add(slug);
|
|
669
677
|
}
|
|
670
|
-
this.
|
|
678
|
+
this.sendChunkedSubscription("subscribe", channels, marketSlugs);
|
|
671
679
|
}
|
|
672
680
|
/**
|
|
673
681
|
* Unsubscribe from one or more channels for the given market slugs.
|
|
@@ -677,7 +685,7 @@ var PredictWsClient = class {
|
|
|
677
685
|
const set = this.subs.channels.get(ch);
|
|
678
686
|
for (const slug of marketSlugs) set.delete(slug);
|
|
679
687
|
}
|
|
680
|
-
this.
|
|
688
|
+
this.sendChunkedSubscription("unsubscribe", channels, marketSlugs);
|
|
681
689
|
}
|
|
682
690
|
// -------------------------------------------------------------------------
|
|
683
691
|
// Subscription — convenience (single channel)
|
|
@@ -833,13 +841,39 @@ var PredictWsClient = class {
|
|
|
833
841
|
restoreSubscriptions() {
|
|
834
842
|
for (const [channel, slugs] of this.subs.channels.entries()) {
|
|
835
843
|
if (slugs.size > 0) {
|
|
836
|
-
this.
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
844
|
+
this.sendChunkedSubscription("subscribe", [channel], Array.from(slugs));
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* Send a subscribe/unsubscribe message, splitting `marketSlugs` across
|
|
850
|
+
* multiple frames so no single frame exceeds the server read limit.
|
|
851
|
+
*/
|
|
852
|
+
sendChunkedSubscription(type, channels, marketSlugs) {
|
|
853
|
+
if (marketSlugs.length === 0) {
|
|
854
|
+
this.send({ type, channels, market_slugs: [] });
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
const envelopeBytes = byteLength(
|
|
858
|
+
JSON.stringify({ type, channels, market_slugs: [] })
|
|
859
|
+
);
|
|
860
|
+
const budget = MAX_SUBSCRIPTION_FRAME_BYTES - envelopeBytes;
|
|
861
|
+
let chunk = [];
|
|
862
|
+
let chunkBytes = 0;
|
|
863
|
+
const flush = () => {
|
|
864
|
+
if (chunk.length > 0) {
|
|
865
|
+
this.send({ type, channels, market_slugs: chunk });
|
|
866
|
+
chunk = [];
|
|
867
|
+
chunkBytes = 0;
|
|
841
868
|
}
|
|
869
|
+
};
|
|
870
|
+
for (const slug of marketSlugs) {
|
|
871
|
+
const slugBytes = byteLength(JSON.stringify(slug)) + 1;
|
|
872
|
+
if (chunk.length > 0 && chunkBytes + slugBytes > budget) flush();
|
|
873
|
+
chunk.push(slug);
|
|
874
|
+
chunkBytes += slugBytes;
|
|
842
875
|
}
|
|
876
|
+
flush();
|
|
843
877
|
}
|
|
844
878
|
startPing() {
|
|
845
879
|
this.stopPing();
|
|
@@ -1910,21 +1944,51 @@ function useRedeemPosition() {
|
|
|
1910
1944
|
wallet_address,
|
|
1911
1945
|
condition_id,
|
|
1912
1946
|
neg_risk,
|
|
1913
|
-
signMessage
|
|
1947
|
+
signMessage,
|
|
1948
|
+
signTypedData
|
|
1914
1949
|
}) => {
|
|
1915
1950
|
const prepared = await client.prepareRedeemPolymarket({
|
|
1916
1951
|
wallet_address,
|
|
1917
1952
|
condition_id,
|
|
1918
1953
|
neg_risk
|
|
1919
1954
|
});
|
|
1920
|
-
const
|
|
1921
|
-
|
|
1955
|
+
const walletKind = prepared.wallet_kind ?? "safe";
|
|
1956
|
+
let signature;
|
|
1957
|
+
if (walletKind === "deposit") {
|
|
1958
|
+
if (!prepared.typed_data) {
|
|
1959
|
+
throw new Error("Redeem prepare response missing typed_data");
|
|
1960
|
+
}
|
|
1961
|
+
if (!prepared.deadline) {
|
|
1962
|
+
throw new Error("Redeem prepare response missing deadline");
|
|
1963
|
+
}
|
|
1964
|
+
if (!signTypedData) {
|
|
1965
|
+
throw new Error("Deposit wallet redeem requires signTypedData");
|
|
1966
|
+
}
|
|
1967
|
+
signature = await signTypedData(prepared.typed_data);
|
|
1968
|
+
} else {
|
|
1969
|
+
if (!prepared.message_hash) {
|
|
1970
|
+
throw new Error("Redeem prepare response missing message_hash");
|
|
1971
|
+
}
|
|
1972
|
+
signature = await signMessage(prepared.message_hash);
|
|
1973
|
+
}
|
|
1974
|
+
const result = await client.redeemPolymarket({
|
|
1922
1975
|
wallet_address,
|
|
1923
1976
|
condition_id,
|
|
1924
1977
|
neg_risk,
|
|
1925
1978
|
signature,
|
|
1926
|
-
nonce: prepared.nonce
|
|
1979
|
+
nonce: prepared.nonce,
|
|
1980
|
+
wallet_kind: walletKind,
|
|
1981
|
+
deadline: prepared.deadline
|
|
1927
1982
|
});
|
|
1983
|
+
if (result.status === "STATE_FAILED" || result.status === "STATE_INVALID") {
|
|
1984
|
+
throw new Error(`Redeem transaction ${result.status}`);
|
|
1985
|
+
}
|
|
1986
|
+
if (result.status !== "STATE_MINED" && result.status !== "STATE_CONFIRMED") {
|
|
1987
|
+
throw new Error(
|
|
1988
|
+
`Redeem transaction not settled yet (${result.status})`
|
|
1989
|
+
);
|
|
1990
|
+
}
|
|
1991
|
+
return result;
|
|
1928
1992
|
},
|
|
1929
1993
|
onSuccess: () => {
|
|
1930
1994
|
queryClient.invalidateQueries({ queryKey: ["predict", "positions"] });
|