@liberfi.io/react-predict 0.1.65 → 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 +43 -3
- package/dist/index.d.ts +43 -3
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{server-DsjYCQiB.d.mts → server-DDzzly1V.d.mts} +41 -1
- package/dist/{server-DsjYCQiB.d.ts → server-DDzzly1V.d.ts} +41 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +23 -0
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +23 -0
- package/dist/server.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -433,6 +433,29 @@ var PredictClient = class {
|
|
|
433
433
|
const url = `${this.endpoint}/api/v1/withdraw/polymarket/execute`;
|
|
434
434
|
return await httpPost(url, body);
|
|
435
435
|
}
|
|
436
|
+
// -------------------------------------------------------------------------
|
|
437
|
+
// Redeem (resolved market token redemption)
|
|
438
|
+
// -------------------------------------------------------------------------
|
|
439
|
+
/**
|
|
440
|
+
* Prepare EIP-712 SafeTx typed data for a Polymarket redeem transaction.
|
|
441
|
+
* The frontend must sign this data and pass the signature to `redeemPolymarket`.
|
|
442
|
+
*
|
|
443
|
+
* Maps to `POST /api/v1/redeem/polymarket/prepare`.
|
|
444
|
+
*/
|
|
445
|
+
async prepareRedeemPolymarket(body) {
|
|
446
|
+
const url = `${this.endpoint}/api/v1/redeem/polymarket/prepare`;
|
|
447
|
+
return await httpPost(url, body);
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Redeem tokens from a resolved Polymarket market via gasless Relayer.
|
|
451
|
+
* Requires a valid EIP-712 signature from the prepare step.
|
|
452
|
+
*
|
|
453
|
+
* Maps to `POST /api/v1/redeem/polymarket`.
|
|
454
|
+
*/
|
|
455
|
+
async redeemPolymarket(body) {
|
|
456
|
+
const url = `${this.endpoint}/api/v1/redeem/polymarket`;
|
|
457
|
+
return await httpPost(url, body);
|
|
458
|
+
}
|
|
436
459
|
};
|
|
437
460
|
function createPredictClient(endpoint) {
|
|
438
461
|
return new PredictClient(endpoint);
|
|
@@ -1712,6 +1735,36 @@ function usePolymarketWithdraw() {
|
|
|
1712
1735
|
mutationFn: (req) => client.executePolymarketWithdraw(req)
|
|
1713
1736
|
});
|
|
1714
1737
|
}
|
|
1738
|
+
function useRedeemPosition() {
|
|
1739
|
+
const client = usePredictClient();
|
|
1740
|
+
const queryClient = useQueryClient();
|
|
1741
|
+
return useMutation({
|
|
1742
|
+
mutationFn: async ({
|
|
1743
|
+
wallet_address,
|
|
1744
|
+
condition_id,
|
|
1745
|
+
neg_risk,
|
|
1746
|
+
signMessage
|
|
1747
|
+
}) => {
|
|
1748
|
+
const prepared = await client.prepareRedeemPolymarket({
|
|
1749
|
+
wallet_address,
|
|
1750
|
+
condition_id,
|
|
1751
|
+
neg_risk
|
|
1752
|
+
});
|
|
1753
|
+
const signature = await signMessage(prepared.message_hash);
|
|
1754
|
+
return client.redeemPolymarket({
|
|
1755
|
+
wallet_address,
|
|
1756
|
+
condition_id,
|
|
1757
|
+
neg_risk,
|
|
1758
|
+
signature,
|
|
1759
|
+
nonce: prepared.nonce
|
|
1760
|
+
});
|
|
1761
|
+
},
|
|
1762
|
+
onSuccess: () => {
|
|
1763
|
+
queryClient.invalidateQueries({ queryKey: ["predict", "positions"] });
|
|
1764
|
+
queryClient.invalidateQueries({ queryKey: ["predict", "balance"] });
|
|
1765
|
+
}
|
|
1766
|
+
});
|
|
1767
|
+
}
|
|
1715
1768
|
function tickSizeQueryKey(tokenId) {
|
|
1716
1769
|
return ["predict", "polymarket", "tick-size", tokenId];
|
|
1717
1770
|
}
|
|
@@ -2231,6 +2284,6 @@ async function pollTxConfirmed(fetchStatus, txHash) {
|
|
|
2231
2284
|
);
|
|
2232
2285
|
}
|
|
2233
2286
|
|
|
2234
|
-
export { CLOB_AUTH_DOMAIN, CLOB_AUTH_TYPES, CTF_EXCHANGE_ADDRESS, CTF_ORDER_TYPES, ChartRange, NEG_RISK_CTF_EXCHANGE_ADDRESS, ORDER_TYPE, POLYGON_CHAIN_ID, PolymarketContext, PolymarketProvider, PredictClient, PredictContext, PredictProvider, PredictWsClient, SIDE, USDC_ADDRESS, availableSharesQueryKey, balanceQueryKey, buildClobAuthMessage, buildClobPayload, buildCtfExchangeDomain, buildOrderMessage, buildPolymarketL2Headers, buildSignedOrder, candlesticksQueryKey, createPredictClient, createPredictWsClient, derivePolymarketApiKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventQueryKey, eventStatsQueryKey, eventsQueryKey, feeRateQueryKey, fetchEvent, fetchEvents, fetchEventsPage, fetchMarket, fetchMatchMarketsPage, fetchMatchesPage, getPolymarketSharesPrecision, hmacSha256Base64, infiniteEventsQueryKey, infiniteOrdersQueryKey, infiniteTradesMultiQueryKey, infiniteTradesQueryKey, marketQueryKey, marketTradesQueryKey, matchMarketsQueryKey, matchQueryKey, matchesQueryKey, orderQueryKey, orderbookQueryKey, ordersMultiQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, resolveEventsParams, resolveTagSlug, 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 };
|
|
2287
|
+
export { CLOB_AUTH_DOMAIN, CLOB_AUTH_TYPES, CTF_EXCHANGE_ADDRESS, CTF_ORDER_TYPES, ChartRange, NEG_RISK_CTF_EXCHANGE_ADDRESS, ORDER_TYPE, POLYGON_CHAIN_ID, PolymarketContext, PolymarketProvider, PredictClient, PredictContext, PredictProvider, PredictWsClient, SIDE, USDC_ADDRESS, availableSharesQueryKey, balanceQueryKey, buildClobAuthMessage, buildClobPayload, buildCtfExchangeDomain, buildOrderMessage, buildPolymarketL2Headers, buildSignedOrder, candlesticksQueryKey, createPredictClient, createPredictWsClient, derivePolymarketApiKey, dflowKYCQueryKey, dflowQuoteQueryKey, eventQueryKey, eventStatsQueryKey, eventsQueryKey, feeRateQueryKey, fetchEvent, fetchEvents, fetchEventsPage, fetchMarket, fetchMatchMarketsPage, fetchMatchesPage, getPolymarketSharesPrecision, hmacSha256Base64, infiniteEventsQueryKey, infiniteOrdersQueryKey, infiniteTradesMultiQueryKey, infiniteTradesQueryKey, marketQueryKey, marketTradesQueryKey, matchMarketsQueryKey, matchQueryKey, matchesQueryKey, orderQueryKey, orderbookQueryKey, ordersMultiQueryKey, ordersQueryKey, polymarketDepositAddressesQueryKey, polymarketSetupQueryKey, positionsMultiQueryKey, positionsQueryKey, priceHistoryQueryKey, resolveEventsParams, resolveTagSlug, 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 };
|
|
2235
2288
|
//# sourceMappingURL=index.mjs.map
|
|
2236
2289
|
//# sourceMappingURL=index.mjs.map
|