@polymarket/client 0.1.0-beta.5 → 0.1.0-beta.7
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/actions/index.d.ts +3 -3
- package/dist/actions/index.js +1 -1
- package/dist/chunk-UBQO5URS.js +2 -0
- package/dist/chunk-UBQO5URS.js.map +1 -0
- package/dist/ethers-v5.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{sports-DNd7kOz2.d.ts → sports-DNQLB2c4.d.ts} +25 -3
- package/dist/{types-DLNcPNT6.d.ts → types-C9xs0MNQ.d.ts} +58 -2
- package/dist/viem.d.ts +1 -1
- package/package.json +2 -2
- package/dist/chunk-2ZZDFOKL.js +0 -2
- package/dist/chunk-2ZZDFOKL.js.map +0 -1
package/dist/actions/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { aK as RateLimitError, aM as RequestRejectedError, bu as TransportError, bx as UnexpectedResponseError, bn as SigningError, B as BaseClient, h as BaseSecureClient } from '../types-
|
|
2
|
-
export { e as ApproveErc1155ForAllError, f as ApproveErc20Error, C as CancelAllError, j as CancelMarketOrdersError, bO as CancelMarketOrdersRequest, k as CancelOrderError, bP as CancelOrderRequest, l as CancelOrdersError, bQ as CancelOrdersRequest, bR as CommentsEventType, bS as CommentsSubscription, bT as CryptoPricesEventType, bU as CryptoPricesSubscription, bV as DeployDepositWalletError, bW as DeprecatedTransactionHandle, s as DownloadAccountingSnapshotError, bX as DownloadAccountingSnapshotRequest, t as DropNotificationsError, bY as DropNotificationsRequest, bZ as EquityPricesEventType, b_ as EquityPricesSubscription, b$ as Erc1155ApprovalForAllWorkflow, c0 as Erc1155ApprovalForAllWorkflowRequest, c1 as Erc20ApprovalWorkflow, c2 as Erc20ApprovalWorkflowRequest, c3 as Erc20TransferWorkflow, c4 as Erc20TransferWorkflowRequest, c5 as EstimateMarketBuyPriceRequest, u as EstimateMarketPriceError, c6 as EstimateMarketPriceRequest, c7 as EstimateMarketSellPriceRequest, c8 as EventForSubscriptionSpec, c9 as EventForSubscriptionSpecs, ca as FetchBalanceAllowanceError, cb as FetchBalanceAllowanceRequest, cc as FetchBuilderFeeRatesError, cd as FetchBuilderFeeRatesRequest, F as FetchClosedOnlyModeError, v as FetchCommentsByIdError, ce as FetchCommentsByIdRequest, w as FetchEventError, x as FetchEventLiveVolumeError, cf as FetchEventLiveVolumeRequest, cg as FetchEventRequest, y as FetchEventTagsError, ch as FetchEventTagsRequest, ci as FetchExecuteParamsError, cj as FetchExecuteParamsRequest, ck as FetchGaslessTransactionRequest, z as FetchLastTradePriceError, cl as FetchLastTradePriceRequest, G as FetchLastTradePricesError, cm as FetchLastTradePricesRequest, H as FetchMarketError, cn as FetchMarketInfoError, co as FetchMarketInfoRequest, cp as FetchMarketRequest, I as FetchMarketTagsError, cq as FetchMarketTagsRequest, J as FetchMidpointError, cr as FetchMidpointRequest, K as FetchMidpointsError, cs as FetchMidpointsRequest, ct as FetchNegRiskError, cu as FetchNegRiskRequest, L as FetchNotificationsError, M as FetchOrderBookError, cv as FetchOrderBookRequest, N as FetchOrderBooksError, cw as FetchOrderBooksRequest, O as FetchOrderError, cx as FetchOrderRequest, P as FetchOrderScoringError, cy as FetchOrderScoringRequest, Q as FetchOrdersScoringError, cz as FetchOrdersScoringRequest, R as FetchPortfolioValueError, cA as FetchPortfolioValueRequest, V as FetchPriceError, W as FetchPriceHistoryError, cB as FetchPriceHistoryRequest, cC as FetchPriceRequest, X as FetchPricesError, cD as FetchPricesRequest, Y as FetchPublicProfileError, cE as FetchPublicProfileRequest, Z as FetchRelatedTagResourcesError, cF as FetchRelatedTagResourcesRequest, _ as FetchRelatedTagsError, cG as FetchRelatedTagsRequest, $ as FetchRewardPercentagesError, a0 as FetchSeriesError, cH as FetchSeriesRequest, a1 as FetchSpreadError, cI as FetchSpreadRequest, a2 as FetchSpreadsError, cJ as FetchSpreadsRequest, a3 as FetchTagError, cK as FetchTagRequest, cL as FetchTickSizeError, cM as FetchTickSizeRequest, a4 as FetchTotalEarningsForUserForDayError, cN as FetchTotalEarningsForUserForDayRequest, a5 as FetchTradedMarketCountError, cO as FetchTradedMarketCountRequest, cP as GaslessTransactionMetadataSchema, cQ as GaslessWorkflow, cR as GaslessWorkflowRequest, cS as IsWalletDeployedError, cT as IsWalletDeployedRequest, a7 as ListAccountTradesError, cU as ListAccountTradesRequest, a8 as ListActivityError, cV as ListActivityRequest, a9 as ListBuilderLeaderboardError, cW as ListBuilderLeaderboardRequest, aa as ListBuilderTradesError, cX as ListBuilderTradesRequest, ab as ListBuilderVolumeError, cY as ListBuilderVolumeRequest, ac as ListClosedPositionsError, cZ as ListClosedPositionsRequest, ad as ListComboMarketsError, c_ as ListComboMarketsRequest, ae as ListComboPositionsError, c$ as ListComboPositionsRequest, af as ListCommentsByUserAddressError, d0 as ListCommentsByUserAddressRequest, ag as ListCommentsError, d1 as ListCommentsRequest, ah as ListCurrentRewardsError, d2 as ListCurrentRewardsRequest, ai as ListEventsError, d3 as ListEventsRequest, aj as ListMarketHoldersError, d4 as ListMarketHoldersRequest, ak as ListMarketPositionsError, d5 as ListMarketPositionsRequest, al as ListMarketRewardsError, d6 as ListMarketRewardsRequest, am as ListMarketsError, d7 as ListMarketsRequest, an as ListOpenInterestError, d8 as ListOpenInterestRequest, ao as ListOpenOrdersError, d9 as ListOpenOrdersRequest, ap as ListPositionsError, da as ListPositionsRequest, aq as ListSeriesError, db as ListSeriesRequest, ar as ListTagsError, dc as ListTagsRequest, as as ListTeamsError, dd as ListTeamsRequest, at as ListTraderLeaderboardError, de as ListTraderLeaderboardRequest, au as ListTradesError, df as ListTradesRequest, av as ListUserEarningsAndMarketsConfigError, dg as ListUserEarningsAndMarketsConfigRequest, aw as ListUserEarningsForDayError, dh as ListUserEarningsForDayRequest, di as MarketEventType, dj as MarketSubscription, dk as MergeComboPositionError, dl as MergeMarketPositionError, ax as MergePositionsError, dm as MergePositionsWorkflow, dn as MergePositionsWorkflowRequest, ay as OpenRfqSessionError, dp as OrderDraft, dq as OrderPostingWorkflow, dr as OrderWorkflow, ds as OrderWorkflowRequest, aC as PostOrderError, aD as PostOrdersError, dt as PostOrdersRequest, du as PrepareErc1155ApprovalForAllError, dv as PrepareErc1155ApprovalForAllRequest, dw as PrepareErc20ApprovalError, dx as PrepareErc20ApprovalRequest, dy as PrepareErc20TransferError, dz as PrepareErc20TransferRequest, dA as PrepareGaslessTransactionError, dB as PrepareGaslessTransactionRequest, dC as PrepareLimitOrderRequest, dD as PrepareMarketBuyOrderRequest, dE as PrepareMarketOrderRequest, dF as PrepareMarketSellOrderRequest, dG as PrepareMergeComboPositionError, dH as PrepareMergeComboPositionRequest, dI as PrepareMergeMarketPositionError, dJ as PrepareMergeMarketPositionRequest, dK as PrepareMergePositionsError, dL as PrepareMergePositionsRequest, dM as PrepareRedeemComboPositionError, dN as PrepareRedeemComboPositionRequest, dO as PrepareRedeemMarketPositionsByConditionIdRequest, dP as PrepareRedeemMarketPositionsByMarketIdRequest, dQ as PrepareRedeemMarketPositionsError, dR as PrepareRedeemMarketPositionsRequest, dS as PrepareRedeemPositionsError, dT as PrepareRedeemPositionsRequest, dU as PrepareSplitComboPositionError, dV as PrepareSplitComboPositionRequest, dW as PrepareSplitMarketPositionError, dX as PrepareSplitMarketPositionRequest, dY as PrepareSplitPositionError, dZ as PrepareSplitPositionRequest, d_ as PrepareTradingApprovalsError, d$ as PublicRealtimeEvent, e0 as PublicRealtimeTopic, e1 as PublicSubscriptionSpec, aL as RedeemPositionsError, e2 as RedeemPositionsWorkflow, e3 as RedeemPositionsWorkflowRequest, e4 as ResolveConditionByTokenError, e5 as ResolveConditionByTokenRequest, aO as RfqCancelQuoteAck, aP as RfqCancelQuoteError, aQ as RfqCancelQuoteRejectedError, aR as RfqCancelQuoteRejectedErrorOptions, aS as RfqConfirmationAck, aT as RfqConfirmationError, aU as RfqConfirmationRejectedError, e6 as RfqConfirmationRejectedErrorOptions, aV as RfqConfirmationRequestEvent, aW as RfqEvent, e7 as RfqExecutionUpdateEvent, aX as RfqQuoteError, aY as RfqQuoteReference, aZ as RfqQuoteRejectedError, a_ as RfqQuoteRejectedErrorOptions, a$ as RfqQuoteRequestEvent, b0 as RfqQuoteResponse, b1 as RfqQuoteSource, b2 as RfqSession, b3 as SearchError, e8 as SearchRequest, e9 as SearchResults, ea as SecureRealtimeEvent, eb as SecureRealtimeTopic, ec as SecureSubscriptionSpec, bl as SetupTradingApprovalsError, ed as SignedOrder, ee as SplitComboPositionError, ef as SplitMarketPositionError, bo as SplitPositionError, eg as SplitPositionWorkflow, eh as SplitPositionWorkflowRequest, ei as SportsEventType, ej as SportsSubscription, ek as SubscribeError, el as SubscriptionHandle, em as TradingApprovalsWorkflow, en as TradingApprovalsWorkflowRequest, bt as TransferErc20Error, eo as UpdateBalanceAllowanceError, ep as UpdateBalanceAllowanceRequest, eq as UserEventType, er as UserSubscription, es as WaitForGaslessTransactionError, et as approveErc1155ForAll, eu as approveErc20, ev as cancelAll, ew as cancelMarketOrders, ex as cancelOrder, ey as cancelOrders, ez as deployDepositWallet, eA as downloadAccountingSnapshot, eB as dropNotifications, eC as estimateMarketPrice, eD as fetchBalanceAllowance, eE as fetchBuilderFeeRates, eF as fetchBuilderVolume, eG as fetchClosedOnlyMode, eH as fetchCommentsById, eI as fetchEvent, eJ as fetchEventLiveVolume, eK as fetchEventTags, eL as fetchExecuteParams, eM as fetchLastTradePrice, eN as fetchLastTradePrices, eO as fetchMarket, eP as fetchMarketInfo, eQ as fetchMarketTags, eR as fetchMidpoint, eS as fetchMidpoints, eT as fetchNegRisk, eU as fetchNotifications, eV as fetchOrder, eW as fetchOrderBook, eX as fetchOrderBooks, eY as fetchOrderScoring, eZ as fetchOrdersScoring, e_ as fetchPortfolioValue, e$ as fetchPrice, f0 as fetchPriceHistory, f1 as fetchPrices, f2 as fetchPublicProfile, f3 as fetchRelatedTagResources, f4 as fetchRelatedTags, f5 as fetchRewardPercentages, f6 as fetchSeries, f7 as fetchSpread, f8 as fetchSpreads, f9 as fetchTag, fa as fetchTickSize, fb as fetchTotalEarningsForUserForDay, fc as fetchTradedMarketCount, fd as fetchTransaction, fe as isWalletDeployed, ff as listAccountTrades, fg as listActivity, fh as listBuilderLeaderboard, fi as listBuilderTrades, fj as listClosedPositions, fk as listComboMarkets, fl as listComboPositions, fm as listComments, fn as listCommentsByUserAddress, fo as listCurrentRewards, fp as listEvents, fq as listMarketHolders, fr as listMarketPositions, fs as listMarketRewards, ft as listMarkets, fu as listOpenInterest, fv as listOpenOrders, fw as listPositions, fx as listSeries, fy as listTags, fz as listTeams, fA as listTraderLeaderboard, fB as listTrades, fC as listUserEarningsAndMarketsConfig, fD as listUserEarningsForDay, fE as mergeComboPosition, fF as mergeMarketPosition, fG as mergePositions, fH as openRfqSession, fI as postOrder, fJ as postOrders, fK as prepareErc1155ApprovalForAll, fL as prepareErc20Approval, fM as prepareErc20Transfer, fN as prepareGaslessTransaction, fO as prepareMergeComboPosition, fP as prepareMergeMarketPosition, fQ as prepareMergePositions, fR as prepareRedeemComboPosition, fS as prepareRedeemMarketPositions, fT as prepareRedeemPositions, fU as prepareSplitComboPosition, fV as prepareSplitMarketPosition, fW as prepareSplitPosition, fX as prepareTradingApprovals, fY as redeemPositions, fZ as resolveConditionByToken, f_ as search, f$ as setupTradingApprovals, g0 as splitComboPosition, g1 as splitMarketPosition, g2 as splitPosition, g3 as subscribe, g4 as transferErc20, g5 as updateBalanceAllowance } from '../types-DLNcPNT6.js';
|
|
1
|
+
import { aK as RateLimitError, aM as RequestRejectedError, bu as TransportError, bx as UnexpectedResponseError, bn as SigningError, B as BaseClient, h as BaseSecureClient } from '../types-C9xs0MNQ.js';
|
|
2
|
+
export { e as ApproveErc1155ForAllError, f as ApproveErc20Error, C as CancelAllError, j as CancelMarketOrdersError, bO as CancelMarketOrdersRequest, k as CancelOrderError, bP as CancelOrderRequest, l as CancelOrdersError, bQ as CancelOrdersRequest, bR as CommentsEventType, bS as CommentsSubscription, bT as CryptoPricesEventType, bU as CryptoPricesSubscription, bV as DeployDepositWalletError, bW as DeprecatedTransactionHandle, s as DownloadAccountingSnapshotError, bX as DownloadAccountingSnapshotRequest, t as DropNotificationsError, bY as DropNotificationsRequest, bZ as EquityPricesEventType, b_ as EquityPricesSubscription, b$ as Erc1155ApprovalForAllWorkflow, c0 as Erc1155ApprovalForAllWorkflowRequest, c1 as Erc20ApprovalWorkflow, c2 as Erc20ApprovalWorkflowRequest, c3 as Erc20TransferWorkflow, c4 as Erc20TransferWorkflowRequest, c5 as EstimateMarketBuyPriceRequest, u as EstimateMarketPriceError, c6 as EstimateMarketPriceRequest, c7 as EstimateMarketSellPriceRequest, c8 as EventForSubscriptionSpec, c9 as EventForSubscriptionSpecs, ca as FetchBalanceAllowanceError, cb as FetchBalanceAllowanceRequest, cc as FetchBuilderFeeRatesError, cd as FetchBuilderFeeRatesRequest, F as FetchClosedOnlyModeError, v as FetchCommentsByIdError, ce as FetchCommentsByIdRequest, w as FetchEventError, x as FetchEventLiveVolumeError, cf as FetchEventLiveVolumeRequest, cg as FetchEventRequest, y as FetchEventTagsError, ch as FetchEventTagsRequest, ci as FetchExecuteParamsError, cj as FetchExecuteParamsRequest, ck as FetchGaslessTransactionRequest, z as FetchLastTradePriceError, cl as FetchLastTradePriceRequest, G as FetchLastTradePricesError, cm as FetchLastTradePricesRequest, H as FetchMarketError, cn as FetchMarketInfoError, co as FetchMarketInfoRequest, cp as FetchMarketRequest, I as FetchMarketTagsError, cq as FetchMarketTagsRequest, J as FetchMidpointError, cr as FetchMidpointRequest, K as FetchMidpointsError, cs as FetchMidpointsRequest, ct as FetchNegRiskError, cu as FetchNegRiskRequest, L as FetchNotificationsError, M as FetchOrderBookError, cv as FetchOrderBookRequest, N as FetchOrderBooksError, cw as FetchOrderBooksRequest, O as FetchOrderError, cx as FetchOrderRequest, P as FetchOrderScoringError, cy as FetchOrderScoringRequest, Q as FetchOrdersScoringError, cz as FetchOrdersScoringRequest, R as FetchPortfolioValueError, cA as FetchPortfolioValueRequest, V as FetchPriceError, W as FetchPriceHistoryError, cB as FetchPriceHistoryRequest, cC as FetchPriceRequest, X as FetchPricesError, cD as FetchPricesRequest, Y as FetchPublicProfileError, cE as FetchPublicProfileRequest, Z as FetchRelatedTagResourcesError, cF as FetchRelatedTagResourcesRequest, _ as FetchRelatedTagsError, cG as FetchRelatedTagsRequest, $ as FetchRewardPercentagesError, a0 as FetchSeriesError, cH as FetchSeriesRequest, a1 as FetchSpreadError, cI as FetchSpreadRequest, a2 as FetchSpreadsError, cJ as FetchSpreadsRequest, a3 as FetchTagError, cK as FetchTagRequest, cL as FetchTickSizeError, cM as FetchTickSizeRequest, a4 as FetchTotalEarningsForUserForDayError, cN as FetchTotalEarningsForUserForDayRequest, a5 as FetchTradedMarketCountError, cO as FetchTradedMarketCountRequest, cP as GaslessTransactionMetadataSchema, cQ as GaslessWorkflow, cR as GaslessWorkflowRequest, cS as IsWalletDeployedError, cT as IsWalletDeployedRequest, a7 as ListAccountTradesError, cU as ListAccountTradesRequest, a8 as ListActivityError, cV as ListActivityRequest, a9 as ListBuilderLeaderboardError, cW as ListBuilderLeaderboardRequest, aa as ListBuilderTradesError, cX as ListBuilderTradesRequest, ab as ListBuilderVolumeError, cY as ListBuilderVolumeRequest, ac as ListClosedPositionsError, cZ as ListClosedPositionsRequest, ad as ListComboMarketsError, c_ as ListComboMarketsRequest, ae as ListComboPositionsError, c$ as ListComboPositionsRequest, af as ListCommentsByUserAddressError, d0 as ListCommentsByUserAddressRequest, ag as ListCommentsError, d1 as ListCommentsRequest, ah as ListCurrentRewardsError, d2 as ListCurrentRewardsRequest, ai as ListEventsError, d3 as ListEventsRequest, aj as ListMarketHoldersError, d4 as ListMarketHoldersRequest, ak as ListMarketPositionsError, d5 as ListMarketPositionsRequest, al as ListMarketRewardsError, d6 as ListMarketRewardsRequest, am as ListMarketsError, d7 as ListMarketsRequest, an as ListOpenInterestError, d8 as ListOpenInterestRequest, ao as ListOpenOrdersError, d9 as ListOpenOrdersRequest, ap as ListPositionsError, da as ListPositionsRequest, aq as ListSeriesError, db as ListSeriesRequest, ar as ListTagsError, dc as ListTagsRequest, as as ListTeamsError, dd as ListTeamsRequest, at as ListTraderLeaderboardError, de as ListTraderLeaderboardRequest, au as ListTradesError, df as ListTradesRequest, av as ListUserEarningsAndMarketsConfigError, dg as ListUserEarningsAndMarketsConfigRequest, aw as ListUserEarningsForDayError, dh as ListUserEarningsForDayRequest, di as MarketEventType, dj as MarketSubscription, dk as MergeComboPositionError, dl as MergeMarketPositionError, ax as MergePositionsError, dm as MergePositionsWorkflow, dn as MergePositionsWorkflowRequest, ay as OpenRfqSessionError, dp as OrderDraft, dq as OrderPostingWorkflow, dr as OrderWorkflow, ds as OrderWorkflowRequest, aC as PostOrderError, aD as PostOrdersError, dt as PostOrdersRequest, du as PrepareErc1155ApprovalForAllError, dv as PrepareErc1155ApprovalForAllRequest, dw as PrepareErc20ApprovalError, dx as PrepareErc20ApprovalRequest, dy as PrepareErc20TransferError, dz as PrepareErc20TransferRequest, dA as PrepareGaslessTransactionError, dB as PrepareGaslessTransactionRequest, dC as PrepareLimitOrderRequest, dD as PrepareMarketBuyOrderRequest, dE as PrepareMarketOrderRequest, dF as PrepareMarketSellOrderRequest, dG as PrepareMergeComboPositionError, dH as PrepareMergeComboPositionRequest, dI as PrepareMergeMarketPositionError, dJ as PrepareMergeMarketPositionRequest, dK as PrepareMergePositionsError, dL as PrepareMergePositionsRequest, dM as PrepareRedeemComboPositionError, dN as PrepareRedeemComboPositionRequest, dO as PrepareRedeemMarketPositionsByConditionIdRequest, dP as PrepareRedeemMarketPositionsByMarketIdRequest, dQ as PrepareRedeemMarketPositionsError, dR as PrepareRedeemMarketPositionsRequest, dS as PrepareRedeemPositionsError, dT as PrepareRedeemPositionsRequest, dU as PrepareSplitComboPositionError, dV as PrepareSplitComboPositionRequest, dW as PrepareSplitMarketPositionError, dX as PrepareSplitMarketPositionRequest, dY as PrepareSplitPositionError, dZ as PrepareSplitPositionRequest, d_ as PrepareTradingApprovalsError, d$ as PublicRealtimeEvent, e0 as PublicRealtimeTopic, e1 as PublicSubscriptionSpec, aL as RedeemPositionsError, e2 as RedeemPositionsWorkflow, e3 as RedeemPositionsWorkflowRequest, e4 as ResolveConditionByTokenError, e5 as ResolveConditionByTokenRequest, aO as RfqCancelQuoteAck, aP as RfqCancelQuoteError, aQ as RfqCancelQuoteRejectedError, aR as RfqCancelQuoteRejectedErrorOptions, aS as RfqConfirmationAck, aT as RfqConfirmationError, aU as RfqConfirmationRejectedError, e6 as RfqConfirmationRejectedErrorOptions, aV as RfqConfirmationRequestEvent, aW as RfqEvent, e7 as RfqExecutionUpdateEvent, aX as RfqQuoteError, aY as RfqQuoteReference, aZ as RfqQuoteRejectedError, a_ as RfqQuoteRejectedErrorOptions, a$ as RfqQuoteRequestEvent, b0 as RfqQuoteResponse, b1 as RfqQuoteSource, b2 as RfqSession, b3 as SearchError, e8 as SearchRequest, e9 as SearchResults, ea as SecureRealtimeEvent, eb as SecureRealtimeTopic, ec as SecureSubscriptionSpec, bl as SetupTradingApprovalsError, ed as SignedOrder, ee as SplitComboPositionError, ef as SplitMarketPositionError, bo as SplitPositionError, eg as SplitPositionWorkflow, eh as SplitPositionWorkflowRequest, ei as SportsEventType, ej as SportsSubscription, ek as SubscribeError, el as SubscriptionHandle, em as TradingApprovalsWorkflow, en as TradingApprovalsWorkflowRequest, bt as TransferErc20Error, eo as UpdateBalanceAllowanceError, ep as UpdateBalanceAllowanceRequest, eq as UserEventType, er as UserSubscription, es as WaitForGaslessTransactionError, et as approveErc1155ForAll, eu as approveErc20, ev as cancelAll, ew as cancelMarketOrders, ex as cancelOrder, ey as cancelOrders, ez as deployDepositWallet, eA as downloadAccountingSnapshot, eB as dropNotifications, eC as estimateMarketPrice, eD as fetchBalanceAllowance, eE as fetchBuilderFeeRates, eF as fetchBuilderVolume, eG as fetchClosedOnlyMode, eH as fetchCommentsById, eI as fetchEvent, eJ as fetchEventLiveVolume, eK as fetchEventTags, eL as fetchExecuteParams, eM as fetchLastTradePrice, eN as fetchLastTradePrices, eO as fetchMarket, eP as fetchMarketInfo, eQ as fetchMarketTags, eR as fetchMidpoint, eS as fetchMidpoints, eT as fetchNegRisk, eU as fetchNotifications, eV as fetchOrder, eW as fetchOrderBook, eX as fetchOrderBooks, eY as fetchOrderScoring, eZ as fetchOrdersScoring, e_ as fetchPortfolioValue, e$ as fetchPrice, f0 as fetchPriceHistory, f1 as fetchPrices, f2 as fetchPublicProfile, f3 as fetchRelatedTagResources, f4 as fetchRelatedTags, f5 as fetchRewardPercentages, f6 as fetchSeries, f7 as fetchSpread, f8 as fetchSpreads, f9 as fetchTag, fa as fetchTickSize, fb as fetchTotalEarningsForUserForDay, fc as fetchTradedMarketCount, fd as fetchTransaction, fe as isWalletDeployed, ff as listAccountTrades, fg as listActivity, fh as listBuilderLeaderboard, fi as listBuilderTrades, fj as listClosedPositions, fk as listComboMarkets, fl as listComboPositions, fm as listComments, fn as listCommentsByUserAddress, fo as listCurrentRewards, fp as listEvents, fq as listMarketHolders, fr as listMarketPositions, fs as listMarketRewards, ft as listMarkets, fu as listOpenInterest, fv as listOpenOrders, fw as listPositions, fx as listSeries, fy as listTags, fz as listTeams, fA as listTraderLeaderboard, fB as listTrades, fC as listUserEarningsAndMarketsConfig, fD as listUserEarningsForDay, fE as mergeComboPosition, fF as mergeMarketPosition, fG as mergePositions, fH as openRfqSession, fI as postOrder, fJ as postOrders, fK as prepareErc1155ApprovalForAll, fL as prepareErc20Approval, fM as prepareErc20Transfer, fN as prepareGaslessTransaction, fO as prepareMergeComboPosition, fP as prepareMergeMarketPosition, fQ as prepareMergePositions, fR as prepareRedeemComboPosition, fS as prepareRedeemMarketPositions, fT as prepareRedeemPositions, fU as prepareSplitComboPosition, fV as prepareSplitMarketPosition, fW as prepareSplitPosition, fX as prepareTradingApprovals, fY as redeemPositions, fZ as resolveConditionByToken, f_ as search, f$ as setupTradingApprovals, g0 as splitComboPosition, g1 as splitMarketPosition, g2 as splitPosition, g3 as subscribe, g4 as transferErc20, g5 as updateBalanceAllowance } from '../types-C9xs0MNQ.js';
|
|
3
3
|
import { ApiKey } from '@polymarket/bindings';
|
|
4
4
|
import { ApiKeyCreds, BuilderApiKeyCreds, BuilderApiKey } from '@polymarket/bindings/clob';
|
|
5
5
|
import { EvmAddress, EvmSignature } from '@polymarket/types';
|
|
6
|
-
export { C as CreateLimitOrderError, a as CreateMarketOrderError, F as FetchSportsMarketTypesError, L as ListSportsError, P as PlaceLimitOrderError, b as PlaceMarketOrderError, c as PrepareLimitOrderError, d as PrepareLimitOrderPostingError, e as PrepareMarketOrderError, f as PrepareMarketOrderPostingError, g as createLimitOrder, h as createMarketOrder, i as fetchSportsMarketTypes, l as listSports, p as placeLimitOrder, j as placeMarketOrder, k as prepareLimitOrder, m as prepareLimitOrderPosting, n as prepareMarketOrder, o as prepareMarketOrderPosting } from '../sports-
|
|
6
|
+
export { C as CreateLimitOrderError, a as CreateMarketOrderError, F as FetchSportsMarketTypesError, L as ListSportsError, P as PlaceLimitOrderError, b as PlaceMarketOrderError, c as PrepareLimitOrderError, d as PrepareLimitOrderPostingError, e as PrepareMarketOrderError, f as PrepareMarketOrderPostingError, g as createLimitOrder, h as createMarketOrder, i as fetchSportsMarketTypes, l as listSports, p as placeLimitOrder, j as placeMarketOrder, k as prepareLimitOrder, m as prepareLimitOrderPosting, n as prepareMarketOrder, o as prepareMarketOrderPosting } from '../sports-DNQLB2c4.js';
|
|
7
7
|
export { ComboPositionStatus } from '@polymarket/bindings/data';
|
|
8
8
|
export { CommentsEvent, CryptoPricesBinanceEvent, CryptoPricesChainlinkEvent, CryptoPricesEvent, CustomMarketEvent, EquityPricesEvent, MarketEvent, SportsEvent, StandardMarketEvent, UserEvent } from '@polymarket/bindings/subscriptions';
|
|
9
9
|
export { RfqConfirmationDecision, RfqConfirmationRequest, RfqDirection, RfqErrorCode, RfqExecutionStatus, RfqExecutionUpdate, RfqId, RfqQuoteId, RfqQuoteRequest, RfqRequestedSize, RfqRequestedSizeUnit, RfqRequestorPublicId, RfqSide } from '@polymarket/bindings/rfq';
|
package/dist/actions/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{Ya as ApproveErc1155ForAllError,Ua as ApproveErc20Error,yc as CancelAllError,Ac as CancelMarketOrdersError,uc as CancelOrderError,wc as CancelOrdersError,md as ComboPositionStatus,E as CreateApiKeyError,O as CreateBuilderApiKeyError,Yc as CreateLimitOrderError,Uc as CreateMarketOrderError,I as CreateOrDeriveApiKeyError,M as DeleteApiKeyError,ea as DeployDepositWalletError,G as DeriveApiKeyError,kd as DownloadAccountingSnapshotError,ua as DropNotificationsError,Cc as EstimateMarketPriceError,K as FetchApiKeysError,wa as FetchBalanceAllowanceError,Q as FetchBuilderApiKeysError,qb as FetchBuilderFeeRatesError,ka as FetchClosedOnlyModeError,Qb as FetchCommentsByIdError,Wb as FetchEventError,_b as FetchEventLiveVolumeError,Yb as FetchEventTagsError,$ as FetchExecuteParamsError,Eb as FetchLastTradePriceError,Gb as FetchLastTradePricesError,kc as FetchMarketError,ob as FetchMarketInfoError,mc as FetchMarketTagsError,eb as FetchMidpointError,gb as FetchMidpointsError,kb as FetchNegRiskError,sa as FetchNotificationsError,wb as FetchOrderBookError,yb as FetchOrderBooksError,oa as FetchOrderError,Aa as FetchOrderScoringError,Ca as FetchOrdersScoringError,gd as FetchPortfolioValueError,sb as FetchPriceError,Ib as FetchPriceHistoryError,ub as FetchPricesError,Td as FetchPublicProfileError,ye as FetchRelatedTagResourcesError,we as FetchRelatedTagsError,Ka as FetchRewardPercentagesError,le as FetchSeriesError,pe as FetchSportsMarketTypesError,Ab as FetchSpreadError,Cb as FetchSpreadsError,ue as FetchTagError,ib as FetchTickSizeError,Ga as FetchTotalEarningsForUserForDayError,id as FetchTradedMarketCountError,da as GaslessTransactionMetadataSchema,ba as IsWalletDeployedError,qa as ListAccountTradesError,Oa as ListActivityError,ac as ListBuilderLeaderboardError,cb as ListBuilderTradesError,cc as ListBuilderVolumeError,cd as ListClosedPositionsError,ic as ListComboMarketsError,dd as ListComboPositionsError,Sb as ListCommentsByUserAddressError,Ob as ListCommentsError,Kb as ListCurrentRewardsError,Ub as ListEventsError,oc as ListMarketHoldersError,sc as ListMarketPositionsError,Mb as ListMarketRewardsError,gc as ListMarketsError,qc as ListOpenInterestError,ma as ListOpenOrdersError,ad as ListPositionsError,je as ListSeriesError,ne as ListSportsError,se as ListTagsError,Ae as ListTeamsError,ec as ListTraderLeaderboardError,Ma as ListTradesError,Ia as ListUserEarningsAndMarketsConfigError,Ea as ListUserEarningsForDayError,Kd as MergeComboPositionError,Jd as MergeMarketPositionError,Id as MergePositionsError,$d as OpenRfqSessionError,_c as PlaceLimitOrderError,Wc as PlaceMarketOrderError,Fc as PostOrderError,Gc as PostOrdersError,Wa as PrepareErc1155ApprovalForAllError,Sa as PrepareErc20ApprovalError,Ce as PrepareErc20TransferError,ha as PrepareGaslessTransactionError,Oc as PrepareLimitOrderError,Sc as PrepareLimitOrderPostingError,Mc as PrepareMarketOrderError,Qc as PrepareMarketOrderPostingError,sd as PrepareMergeComboPositionError,rd as PrepareMergeMarketPositionError,qd as PrepareMergePositionsError,vd as PrepareRedeemComboPositionError,ud as PrepareRedeemMarketPositionsError,td as PrepareRedeemPositionsError,pd as PrepareSplitComboPositionError,od as PrepareSplitMarketPositionError,nd as PrepareSplitPositionError,_a as PrepareTradingApprovalsError,Rd as RedeemPositionsError,mb as ResolveConditionByTokenError,S as RevokeBuilderApiKeyError,Yd as RfqCancelQuoteError,Xd as RfqCancelQuoteRejectedError,be as RfqConfirmationDecision,_d as RfqConfirmationError,Zd as RfqConfirmationRejectedError,ce as RfqDirection,de as RfqErrorCode,ee as RfqExecutionStatus,Wd as RfqQuoteError,Vd as RfqQuoteRejectedError,fe as RfqRequestedSizeUnit,ge as RfqSide,he as SearchError,ab as SetupTradingApprovalsError,Bd as SplitComboPositionError,Ad as SplitMarketPositionError,zd as SplitPositionError,Ee as TransferErc20Error,ya as UpdateBalanceAllowanceError,ja as WaitForGaslessTransactionError,Za as approveErc1155ForAll,Va as approveErc20,zc as cancelAll,Bc as cancelMarketOrders,vc as cancelOrder,xc as cancelOrders,F as createApiKey,P as createBuilderApiKey,Zc as createLimitOrder,Vc as createMarketOrder,J as createOrDeriveApiKey,N as deleteApiKey,fa as deployDepositWallet,H as deriveApiKey,ld as downloadAccountingSnapshot,va as dropNotifications,Dc as estimateMarketPrice,L as fetchApiKeys,xa as fetchBalanceAllowance,R as fetchBuilderApiKeys,rb as fetchBuilderFeeRates,dc as fetchBuilderVolume,la as fetchClosedOnlyMode,Rb as fetchCommentsById,Xb as fetchEvent,$b as fetchEventLiveVolume,Zb as fetchEventTags,aa as fetchExecuteParams,Fb as fetchLastTradePrice,Hb as fetchLastTradePrices,lc as fetchMarket,pb as fetchMarketInfo,nc as fetchMarketTags,fb as fetchMidpoint,hb as fetchMidpoints,lb as fetchNegRisk,ta as fetchNotifications,pa as fetchOrder,xb as fetchOrderBook,zb as fetchOrderBooks,Ba as fetchOrderScoring,Da as fetchOrdersScoring,hd as fetchPortfolioValue,tb as fetchPrice,Jb as fetchPriceHistory,vb as fetchPrices,Ud as fetchPublicProfile,ze as fetchRelatedTagResources,xe as fetchRelatedTags,La as fetchRewardPercentages,me as fetchSeries,qe as fetchSportsMarketTypes,Bb as fetchSpread,Db as fetchSpreads,ve as fetchTag,jb as fetchTickSize,Ha as fetchTotalEarningsForUserForDay,jd as fetchTradedMarketCount,ga as fetchTransaction,ca as isWalletDeployed,ra as listAccountTrades,Pa as listActivity,bc as listBuilderLeaderboard,db as listBuilderTrades,ed as listClosedPositions,jc as listComboMarkets,fd as listComboPositions,Pb as listComments,Tb as listCommentsByUserAddress,Lb as listCurrentRewards,Vb as listEvents,pc as listMarketHolders,tc as listMarketPositions,Nb as listMarketRewards,hc as listMarkets,rc as listOpenInterest,na as listOpenOrders,bd as listPositions,ke as listSeries,oe as listSports,te as listTags,Be as listTeams,fc as listTraderLeaderboard,Na as listTrades,Ja as listUserEarningsAndMarketsConfig,Fa as listUserEarningsForDay,Md as mergeComboPosition,Ld as mergeMarketPosition,Nd as mergePositions,ae as openRfqSession,$c as placeLimitOrder,Xc as placeMarketOrder,Hc as postOrder,Ic as postOrders,Xa as prepareErc1155ApprovalForAll,Ta as prepareErc20Approval,De as prepareErc20Transfer,ia as prepareGaslessTransaction,Pc as prepareLimitOrder,Tc as prepareLimitOrderPosting,Nc as prepareMarketOrder,Rc as prepareMarketOrderPosting,Gd as prepareMergeComboPosition,Fd as prepareMergeMarketPosition,Hd as prepareMergePositions,Pd as prepareRedeemComboPosition,Od as prepareRedeemMarketPositions,Qd as prepareRedeemPositions,xd as prepareSplitComboPosition,wd as prepareSplitMarketPosition,yd as prepareSplitPosition,$a as prepareTradingApprovals,Sd as redeemPositions,nb as resolveConditionByToken,Ec as resolveEstimatedMarketPrice,T as revokeBuilderApiKey,ie as search,bb as setupTradingApprovals,Lc as signOrder,Dd as splitComboPosition,Cd as splitMarketPosition,Ed as splitPosition,re as subscribe,Fe as transferErc20,za as updateBalanceAllowance}from'../chunk-
|
|
1
|
+
export{Ya as ApproveErc1155ForAllError,Ua as ApproveErc20Error,yc as CancelAllError,Ac as CancelMarketOrdersError,uc as CancelOrderError,wc as CancelOrdersError,md as ComboPositionStatus,E as CreateApiKeyError,O as CreateBuilderApiKeyError,Yc as CreateLimitOrderError,Uc as CreateMarketOrderError,I as CreateOrDeriveApiKeyError,M as DeleteApiKeyError,ea as DeployDepositWalletError,G as DeriveApiKeyError,kd as DownloadAccountingSnapshotError,ua as DropNotificationsError,Cc as EstimateMarketPriceError,K as FetchApiKeysError,wa as FetchBalanceAllowanceError,Q as FetchBuilderApiKeysError,qb as FetchBuilderFeeRatesError,ka as FetchClosedOnlyModeError,Qb as FetchCommentsByIdError,Wb as FetchEventError,_b as FetchEventLiveVolumeError,Yb as FetchEventTagsError,$ as FetchExecuteParamsError,Eb as FetchLastTradePriceError,Gb as FetchLastTradePricesError,kc as FetchMarketError,ob as FetchMarketInfoError,mc as FetchMarketTagsError,eb as FetchMidpointError,gb as FetchMidpointsError,kb as FetchNegRiskError,sa as FetchNotificationsError,wb as FetchOrderBookError,yb as FetchOrderBooksError,oa as FetchOrderError,Aa as FetchOrderScoringError,Ca as FetchOrdersScoringError,gd as FetchPortfolioValueError,sb as FetchPriceError,Ib as FetchPriceHistoryError,ub as FetchPricesError,Td as FetchPublicProfileError,ye as FetchRelatedTagResourcesError,we as FetchRelatedTagsError,Ka as FetchRewardPercentagesError,le as FetchSeriesError,pe as FetchSportsMarketTypesError,Ab as FetchSpreadError,Cb as FetchSpreadsError,ue as FetchTagError,ib as FetchTickSizeError,Ga as FetchTotalEarningsForUserForDayError,id as FetchTradedMarketCountError,da as GaslessTransactionMetadataSchema,ba as IsWalletDeployedError,qa as ListAccountTradesError,Oa as ListActivityError,ac as ListBuilderLeaderboardError,cb as ListBuilderTradesError,cc as ListBuilderVolumeError,cd as ListClosedPositionsError,ic as ListComboMarketsError,dd as ListComboPositionsError,Sb as ListCommentsByUserAddressError,Ob as ListCommentsError,Kb as ListCurrentRewardsError,Ub as ListEventsError,oc as ListMarketHoldersError,sc as ListMarketPositionsError,Mb as ListMarketRewardsError,gc as ListMarketsError,qc as ListOpenInterestError,ma as ListOpenOrdersError,ad as ListPositionsError,je as ListSeriesError,ne as ListSportsError,se as ListTagsError,Ae as ListTeamsError,ec as ListTraderLeaderboardError,Ma as ListTradesError,Ia as ListUserEarningsAndMarketsConfigError,Ea as ListUserEarningsForDayError,Kd as MergeComboPositionError,Jd as MergeMarketPositionError,Id as MergePositionsError,$d as OpenRfqSessionError,_c as PlaceLimitOrderError,Wc as PlaceMarketOrderError,Fc as PostOrderError,Gc as PostOrdersError,Wa as PrepareErc1155ApprovalForAllError,Sa as PrepareErc20ApprovalError,Ce as PrepareErc20TransferError,ha as PrepareGaslessTransactionError,Oc as PrepareLimitOrderError,Sc as PrepareLimitOrderPostingError,Mc as PrepareMarketOrderError,Qc as PrepareMarketOrderPostingError,sd as PrepareMergeComboPositionError,rd as PrepareMergeMarketPositionError,qd as PrepareMergePositionsError,vd as PrepareRedeemComboPositionError,ud as PrepareRedeemMarketPositionsError,td as PrepareRedeemPositionsError,pd as PrepareSplitComboPositionError,od as PrepareSplitMarketPositionError,nd as PrepareSplitPositionError,_a as PrepareTradingApprovalsError,Rd as RedeemPositionsError,mb as ResolveConditionByTokenError,S as RevokeBuilderApiKeyError,Yd as RfqCancelQuoteError,Xd as RfqCancelQuoteRejectedError,be as RfqConfirmationDecision,_d as RfqConfirmationError,Zd as RfqConfirmationRejectedError,ce as RfqDirection,de as RfqErrorCode,ee as RfqExecutionStatus,Wd as RfqQuoteError,Vd as RfqQuoteRejectedError,fe as RfqRequestedSizeUnit,ge as RfqSide,he as SearchError,ab as SetupTradingApprovalsError,Bd as SplitComboPositionError,Ad as SplitMarketPositionError,zd as SplitPositionError,Ee as TransferErc20Error,ya as UpdateBalanceAllowanceError,ja as WaitForGaslessTransactionError,Za as approveErc1155ForAll,Va as approveErc20,zc as cancelAll,Bc as cancelMarketOrders,vc as cancelOrder,xc as cancelOrders,F as createApiKey,P as createBuilderApiKey,Zc as createLimitOrder,Vc as createMarketOrder,J as createOrDeriveApiKey,N as deleteApiKey,fa as deployDepositWallet,H as deriveApiKey,ld as downloadAccountingSnapshot,va as dropNotifications,Dc as estimateMarketPrice,L as fetchApiKeys,xa as fetchBalanceAllowance,R as fetchBuilderApiKeys,rb as fetchBuilderFeeRates,dc as fetchBuilderVolume,la as fetchClosedOnlyMode,Rb as fetchCommentsById,Xb as fetchEvent,$b as fetchEventLiveVolume,Zb as fetchEventTags,aa as fetchExecuteParams,Fb as fetchLastTradePrice,Hb as fetchLastTradePrices,lc as fetchMarket,pb as fetchMarketInfo,nc as fetchMarketTags,fb as fetchMidpoint,hb as fetchMidpoints,lb as fetchNegRisk,ta as fetchNotifications,pa as fetchOrder,xb as fetchOrderBook,zb as fetchOrderBooks,Ba as fetchOrderScoring,Da as fetchOrdersScoring,hd as fetchPortfolioValue,tb as fetchPrice,Jb as fetchPriceHistory,vb as fetchPrices,Ud as fetchPublicProfile,ze as fetchRelatedTagResources,xe as fetchRelatedTags,La as fetchRewardPercentages,me as fetchSeries,qe as fetchSportsMarketTypes,Bb as fetchSpread,Db as fetchSpreads,ve as fetchTag,jb as fetchTickSize,Ha as fetchTotalEarningsForUserForDay,jd as fetchTradedMarketCount,ga as fetchTransaction,ca as isWalletDeployed,ra as listAccountTrades,Pa as listActivity,bc as listBuilderLeaderboard,db as listBuilderTrades,ed as listClosedPositions,jc as listComboMarkets,fd as listComboPositions,Pb as listComments,Tb as listCommentsByUserAddress,Lb as listCurrentRewards,Vb as listEvents,pc as listMarketHolders,tc as listMarketPositions,Nb as listMarketRewards,hc as listMarkets,rc as listOpenInterest,na as listOpenOrders,bd as listPositions,ke as listSeries,oe as listSports,te as listTags,Be as listTeams,fc as listTraderLeaderboard,Na as listTrades,Ja as listUserEarningsAndMarketsConfig,Fa as listUserEarningsForDay,Md as mergeComboPosition,Ld as mergeMarketPosition,Nd as mergePositions,ae as openRfqSession,$c as placeLimitOrder,Xc as placeMarketOrder,Hc as postOrder,Ic as postOrders,Xa as prepareErc1155ApprovalForAll,Ta as prepareErc20Approval,De as prepareErc20Transfer,ia as prepareGaslessTransaction,Pc as prepareLimitOrder,Tc as prepareLimitOrderPosting,Nc as prepareMarketOrder,Rc as prepareMarketOrderPosting,Gd as prepareMergeComboPosition,Fd as prepareMergeMarketPosition,Hd as prepareMergePositions,Pd as prepareRedeemComboPosition,Od as prepareRedeemMarketPositions,Qd as prepareRedeemPositions,xd as prepareSplitComboPosition,wd as prepareSplitMarketPosition,yd as prepareSplitPosition,$a as prepareTradingApprovals,Sd as redeemPositions,nb as resolveConditionByToken,Ec as resolveEstimatedMarketPrice,T as revokeBuilderApiKey,ie as search,bb as setupTradingApprovals,Lc as signOrder,Dd as splitComboPosition,Cd as splitMarketPosition,Ed as splitPosition,re as subscribe,Fe as transferErc20,za as updateBalanceAllowance}from'../chunk-UBQO5URS.js';import'../chunk-E2CLUN5M.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {k,e,d,j as j$1,c,b,a,f as f$1,g,h,i}from'./chunk-E2CLUN5M.js';import {PaginationCursorSchema,TransactionIdSchema,EvmAddressSchema,BuilderCodeSchema,TokenIdSchema,CtfConditionIdSchema,OrderSideSchema,CommentParentEntityTypeSchema,EventIdSchema,CommentIdSchema,IsoDateTimeStringSchema,IsoCalendarDateStringSchema,PositionIdSchema,OrderType,PositiveDecimalNumberSchema,OrderSide,ComboConditionIdSchema,MarketIdSchema,toComboConditionId,toPositionId,toPaginationCursor}from'@polymarket/bindings';import {AssetTypeSchema,PriceHistoryIntervalSchema,SignatureType,AssetType,ClosedOnlyModeSchema,OpenOrdersPageSchema,END_CURSOR,OpenOrderSchema,ClobTradesPageSchema,NotificationsResponseSchema,BalanceAllowanceResponseSchema,OrderScoringResponseSchema,OrdersScoringResponseSchema,UserEarningsPageSchema,TotalUserEarningsResponseSchema,UserRewardsEarningsPageSchema,RewardsPercentagesSchema,ApiKeyCredsSchema,ApiKeysResponseSchema,BuilderApiKeyCredsSchema,BuilderApiKeysResponseSchema,PaginatedBuilderTradesSchema,MidpointSchema,MidpointsSchema,FetchTickSizeResponseSchema,FetchNegRiskResponseSchema,ResolveConditionByTokenResponseSchema,FetchMarketInfoResponseSchema,FetchBuilderFeeRatesResponseSchema,PriceSchema,PricesSchema,FetchOrderBookResponseSchema,OrderBooksSchema,SpreadSchema,SpreadsSchema,LastTradePriceSchema,LastTradePricesSchema,PriceHistorySchema,PaginatedCurrentRewardsSchema,PaginatedMarketRewardsSchema,CancelOrdersResponseSchema,OrderResponseSchema,OrderResponsesSchema}from'@polymarket/bindings/clob';import {isHexString,expectNonEmptyArray,PolymarketError,isSameEvmAddress,never,unwrap,invariant,expectEvmAddress,delay,expectEvmSignature,expectHexString,ZERO_ADDRESS,expectErc1271Signature,isPresent,ok,err,ResultAsync}from'@polymarket/types';import {z as z$1}from'zod';import {WalletType,SeriesIdSchema,ListCommentsResponseSchema,ListEventsKeysetResponseSchema,EventSchema,FetchEventTagsResponseSchema,ListMarketsKeysetResponseSchema,FetchMarketTagsResponseSchema,MarketSchema,PublicProfileSchema,PublicSearchResponseSchema,ListSeriesResponseSchema,SeriesSchema,ListSportsMetadataResponseSchema,SportsMarketTypesResponseSchema,ListTagsResponseSchema,TagSchema,ListRelatedTagsResponseSchema,ListRelatedTagResourcesResponseSchema,ListTeamsResponseSchema}from'@polymarket/bindings/gamma';import {AbiFunction,Hash,Bytes,AbiParameters,TypedData,ContractAddress}from'ox';import Qr from'ky';import {SideSchema,ActivityTypeSchema,TimePeriodSchema,LeaderboardOrderBySchema,LeaderboardCategorySchema,ComboPositionStatusSchema,ListTradesResponseSchema,ListActivityResponseSchema,FetchEventLiveVolumeResponseSchema,ListBuilderLeaderboardResponseSchema,ListBuilderVolumeResponseSchema,ListTraderLeaderboardResponseSchema,ListMarketHoldersResponseSchema,ListOpenInterestResponseSchema,ListMarketPositionsResponseSchema,ListPositionsResponseSchema,ListClosedPositionsResponseSchema,ListComboPositionsResponseSchema,FetchPortfolioValueResponseSchema,TradedSchema}from'@polymarket/bindings/data';export{ComboPositionStatus as md}from'@polymarket/bindings/data';import {RelayerTransactionType,RelayerExecuteRequestSchema,RelayerTransactionState,RelayerExecuteParamsSchema,RelayerDeployedResponseSchema,GaslessTransactionSchema,RelayerExecuteResponseSchema}from'@polymarket/bindings/relayer';import {ListComboMarketsResponseSchema}from'@polymarket/bindings/rfq';export{RfqConfirmationDecision as be,RfqDirection as ce,RfqErrorCode as de,RfqExecutionStatus as ee,RfqRequestedSizeUnit as fe,RfqSide as ge}from'@polymarket/bindings/rfq';import jd from'it-merge';function l(e,r){let t=r.safeParse(e);if(t.success)return t.data;throw a.fromZodError(t.error)}var I=z$1.number().int().positive(),Kr=z$1.object({offset:z$1.number().int().min(0),pageSize:I});function C(e,r,t=[]){function o(){return {async firstPage(){return {items:t,hasMore:false}},from(){return o()},async*[Symbol.asyncIterator](){}}}function n(p=r){return {firstPage(){return unwrap(e(p))},from(a){return a===void 0?o():n(a)},async*[Symbol.asyncIterator](){let a=p;for(;;){let y=await unwrap(e(a));if(yield y,!y.hasMore)return;a=y.nextCursor;}}}}return n()}function v(e){return toPaginationCursor(btoa(JSON.stringify(Kr.parse(e))))}function O(e,r){if(e===void 0)return {offset:0,pageSize:r};try{return Kr.parse(JSON.parse(atob(e)))}catch(t){throw new a("Invalid pagination cursor",{cause:t})}}function f(e){return function(t){return ResultAsync.fromPromise(t.json(),()=>new b(`Received non-JSON response from ${t.url}`)).andThen(o=>In(t.url,e,o))}}function Jr(e){return ResultAsync.fromPromise(e.blob(),()=>new b(`Received unreadable binary response from ${e.url}`))}function In(e,r,t){let o=r.safeParse(t);return o.success?ok(o.data):err(b.fromZodError(o.error,{endpoint:e}))}var Zr=class{#e;constructor({url:r}){this.#e=r;}async ethCall(r){let t=await this.#o({jsonrpc:"2.0",id:1,method:"eth_call",params:[{to:r.to,data:r.data},"latest"]});if("error"in t)throw new d(`JSON-RPC eth_call failed: ${t.error.message}`,{cause:t.error,status:200});if(typeof t.result!="string")throw new b("Expected JSON-RPC eth_call result to be a hex string");if(!ot(t.result))throw new b("Expected JSON-RPC eth_call result to be a hex string");return t.result}async ethCallBatch(r){return r.length===0?[]:this.#r(r)}async#r(r){if(r.length===1)return [await this.ethCall(r[0])];try{return await this.#t(r)}catch(t){if(!(t instanceof d)||t.status<500)throw t;let o=Math.ceil(r.length/2),[n,p]=await Promise.all([this.#r(r.slice(0,o)),this.#r(r.slice(o))]);return [...n,...p]}}async#t(r){let t=await this.#n(r.map((n,p)=>({jsonrpc:"2.0",id:p+1,method:"eth_call",params:[{to:n.to,data:n.data},"latest"]}))),o=new Map;for(let n of t){if("error"in n&&n.id===null)throw new d(`JSON-RPC eth_call failed: ${n.error.message}`,{cause:n.error,status:200});n.id!==null&&o.set(n.id,n);}return r.map((n,p)=>{let a=p+1,y=o.get(a);if(y===void 0)throw new b("Expected JSON-RPC batch response for every request");if("error"in y)throw new d(`JSON-RPC eth_call failed: ${y.error.message}`,{cause:y.error,status:200});return qn(y.result)})}async#o(r){let t;try{t=await Qr.post(this.#e,{json:r,throwHttpErrors:!1});}catch(n){throw c.fromError(n)}if(!t.ok)throw new d(`JSON-RPC request to ${this.#e} failed with status ${t.status}`,{status:t.status});let o;try{o=await t.json();}catch(n){throw new b("Expected JSON-RPC response body to be JSON",{cause:n})}if(!Xr(o))throw new b("Unexpected JSON-RPC response shape");return o}async#n(r){let t;try{t=await Qr.post(this.#e,{json:r,throwHttpErrors:!1});}catch(n){throw c.fromError(n)}if(!t.ok)throw new d(`JSON-RPC request to ${this.#e} failed with status ${t.status}`,{status:t.status});let o;try{o=await t.json();}catch(n){throw new b("Expected JSON-RPC response body to be JSON",{cause:n})}if(!Array.isArray(o)||!o.every(n=>Xr(n)))throw new b("Unexpected JSON-RPC response shape");return o}};function et(e){if(!(e instanceof d)||!rt(e.cause))return false;let r=[e.cause.message,An(e.cause.data)].join(" ").toLowerCase();return (e.cause.code===3||e.cause.code===-32e3||e.cause.code===-32003||e.cause.code===-32015||e.cause.code===-32603)&&(r.includes("execution reverted")||r.includes("revert")||r.includes("invalid opcode"))}function Xr(e){return !tt(e)||e.jsonrpc!=="2.0"?false:"error"in e?rt(e.error):"result"in e}function rt(e){return tt(e)&&typeof e.code=="number"&&typeof e.message=="string"}function tt(e){return typeof e=="object"&&e!==null}function ot(e){return /^0x[a-fA-F0-9]*$/.test(e)}function qn(e){if(typeof e!="string"||!ot(e))throw new b("Expected JSON-RPC eth_call result to be a hex string");return e}function An(e){if(e===void 0)return "";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return ""}}function Tu(e,r,t){return {signer:r,wallet:t,walletType:Kn(e,r,t)}}function ee(e){switch(e){case WalletType.EOA:return SignatureType.EOA;case WalletType.POLY_PROXY:return SignatureType.POLY_PROXY;case WalletType.GNOSIS_SAFE:return SignatureType.POLY_GNOSIS_SAFE;case WalletType.DEPOSIT_WALLET:return SignatureType.POLY_1271}}function nt(e){let r=ee(e.walletType);return {maker:e.wallet,signatureType:r,signer:r===SignatureType.POLY_1271?e.wallet:e.signer}}var On="3d3d606380380380913d393d73%s5af4602a57600080fd5b602d8060366000396000f3363d3d373d3d3d363d73%s5af43d82803e903d91602b57fd5bf352e831dd00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000";function Ln(e){let r=On.replace("%s",e.proxyFactory.slice(2).toLowerCase()).replace("%s",e.proxyImplementation.slice(2).toLowerCase());return expectHexString(Hash.keccak256(`0x${r}`))}function wn(e,r){return expectEvmAddress(ContractAddress.fromCreate2({bytecodeHash:Ln(r),from:r.proxyFactory,salt:Hash.keccak256(AbiParameters.encodePacked(["address"],[e]))}))}function Mn(e,r){return expectEvmAddress(ContractAddress.fromCreate2({bytecodeHash:r.safeInitCodeHash,from:r.safeFactory,salt:Hash.keccak256(AbiParameters.encode([{name:"address",type:"address"}],[e]))}))}var Bn="0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3",Un="0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076",Fn=0x61003d3d8160233d3973n;function at(e,r){let t=expectHexString(`0x${e.slice(2).padStart(64,"0")}`),o=AbiParameters.encode([{type:"address"},{type:"bytes32"}],[r.depositWalletFactory,t]);return expectEvmAddress(ContractAddress.fromCreate2({bytecodeHash:_n(r.depositWalletImplementation,o),from:r.depositWalletFactory,salt:Hash.keccak256(o)}))}var zn="0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3",Dn="0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c",jn="0x60195155f3363d3d373d3d363d602036600436635c60da",Hn=0x6100523d8160233d3973n,Wn="0x49493a4d";function st(e,r){let t=expectHexString(`0x${e.slice(2).padStart(64,"0")}`),o=AbiParameters.encode([{type:"address"},{type:"bytes32"}],[r.depositWalletFactory,t]);return expectEvmAddress(ContractAddress.fromCreate2({bytecodeHash:Nn(r.depositWalletBeacon,o),from:r.depositWalletFactory,salt:Hash.keccak256(o)}))}function _n(e,r){let t=BigInt((r.length-2)/2),o=Fn+(t<<56n);return expectHexString(Hash.keccak256(Bytes.concat(Bytes.fromNumber(o,{size:10}),Bytes.fromHex(e),Bytes.fromHex("0x6009"),Bytes.fromHex(Un),Bytes.fromHex(Bn),Bytes.fromHex(r)),{as:"Hex"}))}function Nn(e,r){let t=BigInt((r.length-2)/2),o=Hn+(t<<56n);return expectHexString(Hash.keccak256(Bytes.concat(Bytes.fromNumber(o,{size:10}),Bytes.fromHex(e),Bytes.fromHex(jn),Bytes.fromHex(Dn),Bytes.fromHex(zn),Bytes.fromHex(r)),{as:"Hex"}))}async function Gn(e,r){try{let t=await e.ethCall({to:r,data:Wn});return Vn(t)}catch(t){if(et(t))return ZERO_ADDRESS;throw t}}async function $n(e,r){let t=await Gn(e,r);return !isSameEvmAddress(t,ZERO_ADDRESS)}async function it(e,r,t){return await $n(e,t.depositWalletFactory)?st(r,t):at(r,t)}function Vn(e){return e.length<66?ZERO_ADDRESS:expectEvmAddress(`0x${e.slice(-40)}`)}function Kn(e,r,t){if(isSameEvmAddress(t,r))return WalletType.EOA;let o=e.walletDerivation;if(isSameEvmAddress(t,st(r,o)))return WalletType.DEPOSIT_WALLET;if(isSameEvmAddress(t,at(r,o)))return WalletType.DEPOSIT_WALLET;if(isSameEvmAddress(t,Mn(r,o)))return WalletType.GNOSIS_SAFE;if(isSameEvmAddress(t,wn(r,o)))return WalletType.POLY_PROXY;never(`Wallet ${t} does not match the signer ${r} or any supported deterministic wallet address.`);}function R(e,r){if(Yn(r))return Jn(e,r.exceptions);let t=new URLSearchParams;for(let[o,n]of Object.entries(r)){let p=e[o];if(p!==void 0){if(pt(p)){for(let a of p)t.append(n,Ee(a));continue}t.append(n,Ee(p));}}return t}function S(e={}){return {format:"snake_case",exceptions:e}}function w(e){let r=new URLSearchParams;for(let[t,o]of Object.entries(e))if(o!==void 0){if(Array.isArray(o)){r.append(t,o.map(Ee).join(","));continue}r.append(t,Ee(o));}return r}function Yn(e){return "format"in e}function Jn(e,r){let t=new URLSearchParams;for(let[o,n]of Object.entries(e)){if(n===void 0)continue;let p=r[o]??Qn(o);if(pt(n)){for(let a of n)t.append(p,Ee(a));continue}t.append(p,Ee(n));}return t}function pt(e){return Array.isArray(e)}function Qn(e){return e.replace(/[A-Z]/g,r=>`_${r.toLowerCase()}`)}function Ee(e){return String(e)}var Bu=k(e,d,j$1,c,b);async function Uu(e){return (await unwrap(e.secureClob.get("/auth/ban-status/closed-only").andThen(f(ClosedOnlyModeSchema)))).closedOnly}var da=z$1.object({tokenId:z$1.string().optional(),cursor:PaginationCursorSchema.optional(),id:z$1.string().optional(),market:z$1.string().optional()}).default({}),Fu=k(e,d,j$1,c,b,a);function zu(e,r){let{cursor:t,...o}=l(r,da);return C(n=>e.secureClob.get("/data/orders",{params:R({...o,nextCursor:n},S({tokenId:"asset_id"}))}).andThen(f(OpenOrdersPageSchema)).map(p=>({items:p.data,hasMore:p.nextCursor!==END_CURSOR,nextCursor:p.nextCursor===END_CURSOR?void 0:toPaginationCursor(p.nextCursor),totalCount:p.count})),t)}var ua=z$1.object({orderId:z$1.string()}),Du=k(e,d,j$1,c,b,a);async function ju(e,r){let t=l(r,ua);return unwrap(e.secureClob.get(`/data/order/${t.orderId}`).andThen(f(OpenOrderSchema)))}var ma={after:z$1.string().optional(),tokenId:z$1.string().optional(),before:z$1.string().optional(),cursor:PaginationCursorSchema.optional(),id:z$1.string().optional(),makerAddress:z$1.string().optional(),market:z$1.string().optional()},la=z$1.object(ma).default({}),Hu=k(e,d,j$1,c,b,a);function Wu(e,r){let{cursor:t,...o}=l(r,la);return C(n=>e.secureClob.get("/data/trades",{params:R({...o,nextCursor:n},S({tokenId:"asset_id"}))}).andThen(f(ClobTradesPageSchema)).map(p=>({items:p.data,hasMore:p.nextCursor!==END_CURSOR,nextCursor:p.nextCursor===END_CURSOR?void 0:toPaginationCursor(p.nextCursor),totalCount:p.count})),t)}var _u=k(e,d,j$1,c,b),fa=z$1.object({ids:z$1.array(z$1.string()).min(1)});async function Nu(e){let r=ee(e.account.walletType);return unwrap(e.secureClob.get("/notifications",{params:R({signatureType:r},S())}).andThen(f(NotificationsResponseSchema)))}var Gu=k(e,d,j$1,c,b,a);async function $u(e,r){let t=l(r,fa),o=ee(e.account.walletType),n=R({ids:t.ids.join(","),signatureType:o},S());await unwrap(e.secureClob.del("/notifications",{params:n}));}var ya=z$1.object({assetType:AssetTypeSchema,tokenId:z$1.string().optional()}),Vu=k(e,d,j$1,c,b,a);async function sr(e,r){let t=l(r,ya),o=ee(e.account.walletType);return unwrap(e.secureClob.get("/balance-allowance",{params:R({...t,signatureType:o},S())}).andThen(f(BalanceAllowanceResponseSchema)))}var Ea=z$1.object({assetType:AssetTypeSchema,tokenId:z$1.string().optional()}),Ku=k(e,d,j$1,c,b,a);async function dt(e,r){let t=l(r,Ea),o=ee(e.account.walletType),n=R({...t,signatureType:o},S());return await unwrap(e.secureClob.get("/balance-allowance/update",{params:n})),sr(e,t)}var ga=z$1.object({orderId:z$1.string()}),Yu=k(e,d,j$1,c,b,a);async function Ju(e,r){let t=l(r,ga);return (await unwrap(e.secureClob.get("/order-scoring",{params:R(t,S())}).andThen(f(OrderScoringResponseSchema)))).scoring}var Ra=z$1.object({orderIds:z$1.array(z$1.string())}),Qu=k(e,d,j$1,c,b,a);async function Zu(e,r){let o=l(r,Ra).orderIds;return unwrap(e.secureClob.post("/orders-scoring",{json:o}).andThen(f(OrdersScoringResponseSchema)))}var ut=z$1.object({cursor:PaginationCursorSchema.optional(),date:z$1.string()}),Xu=k(e,d,j$1,c,b,a);function em(e,r){let{cursor:t,...o}=l(r,ut),n=ee(e.account.walletType);return C(p=>e.secureClob.get("/rewards/user",{params:R({...o,nextCursor:p,signatureType:n},S())}).andThen(f(UserEarningsPageSchema)).map(a=>({items:a.data,hasMore:a.nextCursor!==END_CURSOR,nextCursor:a.nextCursor===END_CURSOR?void 0:toPaginationCursor(a.nextCursor),totalCount:a.count})),t)}var rm=k(e,d,j$1,c,b,a);async function tm(e,r){let t=l(r,ut),o=ee(e.account.walletType);return unwrap(e.secureClob.get("/rewards/user/total",{params:R({...t,signatureType:o},S())}).andThen(f(TotalUserEarningsResponseSchema)))}var Sa=z$1.object({cursor:PaginationCursorSchema.optional(),date:z$1.string(),noCompetition:z$1.boolean().optional(),orderBy:z$1.string().optional(),pageSize:I.max(500).default(100),position:z$1.string().optional()}),om=k(e,d,j$1,c,b,a);function nm(e,r){let{cursor:t,...o}=l(r,Sa),n=ee(e.account.walletType);return C(p=>e.secureClob.get("/rewards/user/markets",{params:R({...o,nextCursor:p,signatureType:n},S())}).andThen(f(UserRewardsEarningsPageSchema)).map(a=>({items:a.data,hasMore:a.nextCursor!==END_CURSOR,nextCursor:a.nextCursor===END_CURSOR?void 0:toPaginationCursor(a.nextCursor),totalCount:a.count})),t)}var am=k(e,d,j$1,c,b);async function sm(e){let r=ee(e.account.walletType);return unwrap(e.secureClob.get("/rewards/user/percentages",{params:R({signatureType:r},S())}).andThen(f(RewardsPercentagesSchema)))}var Pa=z$1.enum(["TIMESTAMP","TOKENS","CASH"]),Ca=z$1.enum(["ASC","DESC"]),ka=z$1.enum(["CASH","TOKENS"]),ba=z$1.object({cursor:PaginationCursorSchema.optional(),pageSize:I.default(20),takerOnly:z$1.boolean().optional(),filterType:ka.optional(),filterAmount:z$1.number().optional(),market:z$1.array(z$1.string()).optional(),eventId:z$1.array(z$1.number().int()).optional(),user:z$1.string().optional(),side:SideSchema.optional()}).refine(e=>!(e.market&&e.eventId),{message:"Provide market or eventId, not both",path:["eventId"]}).refine(e=>e.filterType===void 0==(e.filterAmount===void 0),{message:"Provide filterType and filterAmount together",path:["filterAmount"]}),Ia=z$1.object({cursor:PaginationCursorSchema.optional(),pageSize:I.default(20),user:z$1.string(),market:z$1.array(z$1.string()).optional(),eventId:z$1.array(z$1.number().int()).optional(),type:z$1.array(ActivityTypeSchema).optional(),start:z$1.number().int().optional(),end:z$1.number().int().optional(),sortBy:Pa.optional(),sortDirection:Ca.optional(),side:SideSchema.optional()}).refine(e=>!(e.market&&e.eventId),{message:"Provide market or eventId, not both",path:["eventId"]}),Em=k(e,d,c,b,a);function gm(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,ba);return C(p=>{let a=O(p,o);return e.data.get("/trades",{params:w({...n,limit:a.pageSize+1,offset:a.offset})}).andThen(f(ListTradesResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var Rm=k(e,d,c,b,a);function Sm(e,r){let{cursor:t,pageSize:o,...n}=l(r,Ia);return C(p=>{let a=O(p,o);return e.data.get("/activity",{params:w({...n,limit:a.pageSize+1,offset:a.offset})}).andThen(f(ListActivityResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var Aa=64,va=/^0x[0-9a-fA-F]{62}$/,Oa=/^0x[0-9a-fA-F]{64}$/,ir="0x0000000000000000000000000000000000000000000000000000000000000000",La=AbiFunction.from("function approve(address spender, uint256 amount)"),yt=AbiFunction.from("function allowance(address owner, address spender) view returns (uint256)"),wa=AbiFunction.from("function transfer(address recipient, uint256 amount)"),Ma=AbiFunction.from("function setApprovalForAll(address operator, bool approved)"),Et=AbiFunction.from("function isApprovedForAll(address account, address operator) view returns (bool)"),gt=AbiFunction.from("function balanceOf(address account, uint256 id) view returns (uint256)"),Rt=AbiFunction.from("function balanceOfBatch(address[] accounts, uint256[] ids) view returns (uint256[])"),Ba=AbiFunction.from("function splitPosition(address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] partition, uint256 amount)"),Ua=AbiFunction.from("function mergePositions(address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] partition, uint256 amount)"),Fa=AbiFunction.from("function redeemPositions(address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] indexSets)"),za=AbiFunction.from("function split(bytes31 conditionId, uint256 amount)"),Da=AbiFunction.from("function merge(bytes31 conditionId, uint256 amount)"),ja=AbiFunction.from("function redeem(bytes31 conditionId, uint256 outcomeIndex, uint256 amount)"),Ha=AbiFunction.from("function prepareCondition(uint256[] legs) returns (bytes31)"),Wa=AbiFunction.from("function multiSend(bytes)"),_a=AbiFunction.from("function proxy((uint8 typeCode, address to, uint256 value, bytes data)[] calls) returns (bytes[])"),St=[1n,2n],Na=[1n,2n],$=(1n<<256n)-1n,Cm=k(a);function We(e,r,t){if(t<0n)throw new a("Approval amount must be non-negative");if(t>$)throw new a("Approval amount exceeds uint256 range");return {data:Ga(r,t),to:e}}function ht(e,r,t){return {data:AbiFunction.encodeData(yt,[r,t]),to:e}}function xt(e){return AbiFunction.decodeResult(yt,e)}function _e(e,r,t){return {data:$a(r,t),to:e}}function Tt(e,r,t){return {data:AbiFunction.encodeData(Et,[r,t]),to:e}}function Pt(e){return AbiFunction.decodeResult(Et,e)}function Ct(e,r,t){return {data:AbiFunction.encodeData(gt,[r,pe(BigInt(t),"Position ID")]),to:e}}function kt(e){return AbiFunction.decodeResult(gt,e)}function pr(e,r,t){return {data:AbiFunction.encodeData(Rt,[t.map(()=>r),t.map(o=>pe(BigInt(o),"id"))]),to:e}}function cr(e){return AbiFunction.decodeResult(Rt,e)}var km=k(a);function dr(e,r,t){if(t<0n)throw new a("Transfer amount must be non-negative");if(t>$)throw new a("Transfer amount exceeds uint256 range");return {data:Va(r,t),to:e}}var bm=k(a),Im=k(a);function bt(e,r,t,o){return {data:Ka(r,t,o),to:e}}var qm=k(a);function It(e,r,t,o){return {data:Ya(r,t,o),to:e}}function qt(e,r,t){return {data:Ja(r,t),to:e}}var Am=k(a);function At(e,r,t){return {data:AbiFunction.encodeData(za,[mr(r),pe(t,"Split amount")]),to:e}}var vm=k(a);function vt(e,r,t){return {data:AbiFunction.encodeData(Da,[mr(r),pe(t,"Merge amount")]),to:e}}var Om=k(a);function Ot(e,r,t,o){return {data:AbiFunction.encodeData(ja,[mr(r),BigInt(Qa(t)),pe(o,"Redeem amount")]),to:e}}var Lm=k(a);function ur(e,r){return {data:AbiFunction.encodeData(Ha,[r.map(t=>pe(t,"Leg position ID"))]),to:e}}function Ga(e,r){return invariant(r>=0n,"Approval amount must be non-negative"),AbiFunction.encodeData(La,[e,r])}function $a(e,r){return AbiFunction.encodeData(Ma,[e,r])}function Va(e,r){return AbiFunction.encodeData(wa,[e,r])}function Ka(e,r,t){return AbiFunction.encodeData(Ba,[e,ir,r,St,pe(t,"Split amount")])}function Ya(e,r,t){return AbiFunction.encodeData(Ua,[e,ir,r,St,pe(t,"Merge amount")])}function Ja(e,r){return AbiFunction.encodeData(Fa,[e,ir,r,Na])}function pe(e,r){if(e<0n)throw new a(`${r} must be non-negative`);if(e>$)throw new a(`${r} exceeds uint256 range`);return e}function mr(e){if(va.test(e))return e.toLowerCase();if(Oa.test(e)){let r=e.toLowerCase();if(r.endsWith("00")||r.endsWith("01"))return r.slice(0,Aa)}throw new a("Protocol v2 condition ID must be bytes31, or bytes32 with a binary outcome byte")}function Qa(e){if(e!==0&&e!==1)throw new a("Protocol v2 outcome index must be 0 or 1");return e}function Lt(e){return AbiFunction.encodeData(_a,[e.map(r=>({typeCode:1,to:r.to,value:r.value??0n,data:r.data}))])}function wt(e){let r=e.map(t=>Za(t));return AbiFunction.encodeData(Wa,[r.length===0?"0x":AbiParameters.encodePacked(Array.from({length:r.length},()=>"bytes"),r)])}function Za(e){let r=e.value??0n;return AbiParameters.encodePacked(["uint8","address","uint256","uint256","bytes"],[0,e.to,r,BigInt((e.data.length-2)/2),e.data])}var Um=k(e,d,f$1,g,c,b,a);function z(e,r="Expected a TransactionHandle"){return invariant(typeof e=="object"&&e!==null&&"transactionHash"in e&&"transactionId"in e&&"wait"in e&&typeof e.wait=="function",r),e}k(h,j$1);k(h,j$1);function Hm(e){return async function(t){let o=await t.next();for(;!o.done;)try{switch(o.value.kind){case "requestAddress":o=await t.next(await e.getAddress());break;case "signAuthMessage":o=await t.next(await e.signTypedData(o.value.payload));break}}catch(n){o=await t.throw(n);}return o.value}}function U(e){return async function(t){let o=await t.next();for(;!o.done;)try{switch(o.value.kind){case "requestAddress":o=await t.next(await e.getAddress());break;case "signGaslessTypedData":case "signOrder":o=await t.next(await e.signTypedData(o.value.payload));break;case "signGaslessMessage":o=await t.next(await e.signMessage(o.value.payload));break;case "sendErc20ApprovalTransaction":case "sendErc1155ApprovalForAllTransaction":case "sendErc20TransferTransaction":case "sendMergePositionsTransaction":case "sendRedeemPositionsTransaction":case "sendSplitPositionTransaction":o=await t.next(await e.sendTransaction(o.value.request));break}}catch(n){o=await t.throw(n);}return o.value}}function Mt(){return {kind:"requestAddress"}}function D(e,r){return {chainId:e,...r}}var us=[{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],ms=[{name:"to",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"},{name:"operation",type:"uint8"},{name:"safeTxGas",type:"uint256"},{name:"baseGas",type:"uint256"},{name:"gasPrice",type:"uint256"},{name:"gasToken",type:"address"},{name:"refundReceiver",type:"address"},{name:"nonce",type:"uint256"}],ls="DepositWallet",fs="1",ys=600,Es=[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],gs=[{name:"wallet",type:"address"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"},{name:"calls",type:"Call[]"}],Rs=z$1.object({address:z$1.string(),type:z$1.enum(RelayerTransactionType)}),tl=k(e,d,c,b,a);async function Er(e,r){let t=l(r,Rs);return unwrap(e.relayer.get("/v1/account/transactions/params",{params:R(t,{address:"address",type:"type"})}).andThen(f(RelayerExecuteParamsSchema)))}var Ss=z$1.object({transactionId:TransactionIdSchema}),hs=z$1.object({wallet:EvmAddressSchema,type:z$1.enum(WalletType)}),ol=k(e,d,c,b,a);async function nl(e,r){let t=await xs(e,r);return t.type===WalletType.EOA?false:unwrap(e.relayer.get("/deployed",{params:R({address:t.wallet,type:t.type===WalletType.DEPOSIT_WALLET?RelayerTransactionType.WALLET:void 0},{address:"address",type:"type"})}).andThen(f(RelayerDeployedResponseSchema)).map(({deployed:o})=>o))}async function xs(e,r){if(r!==void 0)return l(r,hs);if(!e.isSecureClient())throw new a("Gasless readiness inference requires a secure client. Pass a wallet and type when using a public client.");return e.account.walletType!==WalletType.EOA?{wallet:e.account.wallet,type:e.account.walletType}:{wallet:await it(e.rpc,e.account.signer,e.environment.walletDerivation),type:WalletType.DEPOSIT_WALLET}}var j=z$1.string().max(500),Bt=10,al=k(e,d,c,b,a);async function sl(e){return invariant(e.supportsGasless,"Deposit Wallet deployment requires a Relayer API Key or Builder API Key in the client configuration."),$e(e,{from:e.account.signer,metadata:"Deploy Deposit Wallet",to:e.environment.walletDerivation.depositWalletFactory,type:RelayerTransactionType.WALLET_CREATE})}async function Ts(e,r){let t=l(r,Ss);return unwrap(e.relayer.get(`/v1/account/transactions/${t.transactionId}`).andThen(f(GaslessTransactionSchema)))}var Ps=z$1.object({data:z$1.custom(isHexString),to:EvmAddressSchema,value:z$1.bigint().optional()}),Cs=z$1.object({calls:z$1.array(Ps).min(1).transform(e=>expectNonEmptyArray(e)),metadata:j}),il=k(e,d,c,b,a);async function G(e,r){let t=l(r,Cs);return invariant(e.supportsGasless,"Gasless transactions require a Relayer API Key or Builder API Key in the client configuration."),invariant(e.account.walletType===WalletType.GNOSIS_SAFE||e.account.walletType===WalletType.POLY_PROXY||e.account.walletType===WalletType.DEPOSIT_WALLET,"Gasless transaction preparation supports Deposit Wallet, Safe-backed, and proxy-backed accounts"),async function*(){let o=expectEvmAddress(yield Mt());invariant(o===e.account.signer,"Wallet client address does not match the authenticated signer");for(let n=0;n<=Bt;n+=1)try{switch(e.account.walletType){case WalletType.POLY_PROXY:return yield*ks(e,t);case WalletType.DEPOSIT_WALLET:return yield*bs(e,t);case WalletType.GNOSIS_SAFE:return yield*Is(e,t)}invariant(!1,"Unsupported wallet type for gasless transaction");}catch(p){if(!qs(p)||n===Bt)throw p;await delay(e.environment.relayerPollFrequencyMs);}invariant(false,"Expected gasless transaction retry loop to return");}.call(null)}async function*ks(e,r){let t=await Er(e,{address:e.account.signer,type:RelayerTransactionType.PROXY}),o=e.environment.walletDerivation.proxyFactory,n=Lt(r.calls),p="0",a="0",y="10000000",x=e.environment.relayHub,Ae=ZERO_ADDRESS,Tn=Bs(e.account.signer,o,n,p,a,y,t.nonce,x,Ae),Pn=expectEvmSignature(yield zt(Tn));return $e(e,{data:n,from:e.account.signer,metadata:r.metadata,nonce:t.nonce,proxyWallet:e.account.wallet,signature:Pn,signatureParams:{gasLimit:y,gasPrice:a,relay:Ae,relayHub:x,relayerFee:p},to:o,type:RelayerTransactionType.PROXY})}async function*bs(e,r){let t=await Er(e,{address:e.account.signer,type:RelayerTransactionType.WALLET}),o=r.calls.map(As),n=`${Math.floor(Date.now()/1e3)+ys}`,p=expectEvmSignature(yield Ms(vs({calls:o,chainId:e.environment.chainId,deadline:n,nonce:t.nonce,wallet:e.account.wallet}))),a={depositWalletParams:{calls:o,deadline:n,depositWallet:e.account.wallet},from:e.account.signer,metadata:r.metadata,nonce:t.nonce,signature:p,to:e.environment.walletDerivation.depositWalletFactory,type:RelayerTransactionType.WALLET};return $e(e,a)}async function*Is(e,r){let t=await Er(e,{address:e.account.signer,type:RelayerTransactionType.SAFE}),o=Os(r.calls,e.environment.safeMultisend),n=ws({chainId:e.environment.chainId,data:o.data,nonce:t.nonce,operation:o.operation,safeAddress:e.account.wallet,to:o.to,value:o.value}),p=expectEvmSignature(yield zt(expectHexString(TypedData.getSignPayload(n))));return $e(e,{data:o.data,from:e.account.signer,metadata:r.metadata,nonce:t.nonce,proxyWallet:e.account.wallet,signature:Us(p),signatureParams:Ls(o.operation),to:o.to,type:RelayerTransactionType.SAFE,value:o.value>0n?`${o.value}`:void 0})}async function $e(e,r){let t=l(r,RelayerExecuteRequestSchema),o=await unwrap(e.relayer.post("/submit",{json:t}).andThen(f(RelayerExecuteResponseSchema)));return new lr(e,o)}function qs(e$1){if(e$1 instanceof e)return true;if(!(e$1 instanceof d)||e$1.status!==400)return false;if(/wallet busy/i.test(e$1.message)&&/active action/i.test(e$1.message)||/wallet has in-flight action/i.test(e$1.message))return true;let r=/batch nonce\s+(\d+)\s+does not match on-chain nonce\s+(\d+)/i.exec(e$1.message);if(r===null)return false;let t=r[1],o=r[2];return t===void 0||o===void 0?false:BigInt(t)<BigInt(o)}function As(e){return {data:e.data,target:e.to,value:`${e.value??0n}`}}function vs(e){return {domain:{chainId:e.chainId,name:ls,verifyingContract:e.wallet,version:fs},message:{calls:e.calls.map(r=>({data:r.data,target:r.target,value:BigInt(r.value)})),deadline:BigInt(e.deadline),nonce:BigInt(e.nonce),wallet:e.wallet},primaryType:"Batch",types:{Batch:gs,Call:Es}}}function Os(e,r){if(e.length===1){let[t]=e;return {data:t.data,operation:0,to:t.to,value:t.value??0n}}return {data:wt(e),operation:1,to:r,value:0n}}function Ls(e){return {baseGas:"0",gasPrice:"0",gasToken:ZERO_ADDRESS,operation:`${e}`,refundReceiver:ZERO_ADDRESS,safeTxnGas:"0"}}function ws(e){return {domain:{chainId:e.chainId,verifyingContract:e.safeAddress},message:{baseGas:0n,data:e.data,gasPrice:0n,gasToken:ZERO_ADDRESS,nonce:BigInt(e.nonce),operation:e.operation,refundReceiver:ZERO_ADDRESS,safeTxGas:0n,to:e.to,value:e.value},primaryType:"SafeTx",types:{EIP712Domain:us,SafeTx:ms}}}function zt(e){return {kind:"signGaslessMessage",payload:e}}function Ms(e){return {kind:"signGaslessTypedData",payload:e}}function Bs(e,r,t,o,n,p,a,y,x){return expectHexString(Hash.keccak256(Bytes.concat(Bytes.fromString("rlx:"),Bytes.fromHex(e),Bytes.fromHex(r),Bytes.fromHex(t),Bytes.fromNumber(BigInt(o),{size:32}),Bytes.fromNumber(BigInt(n),{size:32}),Bytes.fromNumber(BigInt(p),{size:32}),Bytes.fromNumber(BigInt(a),{size:32}),Bytes.fromHex(y),Bytes.fromHex(x)),{as:"Hex"}))}function Us(e){let r=e.slice(2),t=Number.parseInt(r.slice(128,130),16),o=t===0||t===1?t+31:t===27||t===28?t+4:t;return expectHexString(`0x${r.slice(0,128)}${o.toString(16).padStart(2,"0")}`)}var pl=k(e,d,c,b,a,f$1,g),lr=class{#e;transactionHash;transactionId;constructor(r,t){this.#e=r,this.transactionHash=t.transactionHash,this.transactionId=t.transactionId;}async wait(){let r=0;for(;r<this.#e.environment.relayerMaxPolls;){let t=await Ts(this.#e,{transactionId:this.transactionId});if(t.state===RelayerTransactionState.STATE_MINED||t.state===RelayerTransactionState.STATE_CONFIRMED){let o=t.transactionHash??this.transactionHash;if(o===null)throw new b("Expected submitted transaction to have a transaction hash once settled");return {transactionHash:o,transactionId:t.transactionId}}if(t.state===RelayerTransactionState.STATE_FAILED||t.state===RelayerTransactionState.STATE_INVALID)throw new g(t.errorMsg??`Transaction ${t.transactionId} reached terminal state ${t.state}`);r+=1,await delay(this.#e.environment.relayerPollFrequencyMs);}throw new f$1(`Timed out waiting for transaction ${this.transactionId} to settle`)}};var Fs=z$1.object({amount:z$1.union([z$1.bigint(),z$1.literal("max")]),metadata:j.optional(),spenderAddress:EvmAddressSchema,tokenAddress:EvmAddressSchema}),Sl=k(a);async function zs(e,r){let t=l(r,Fs),o=t.amount==="max"?$:t.amount;return async function*(){return e.account.walletType===WalletType.EOA?z(yield Ht(D(e.environment.chainId,We(t.tokenAddress,t.spenderAddress,o)))):yield*await G(e,{calls:[We(t.tokenAddress,t.spenderAddress,o)],metadata:t.metadata??`Approve ${t.amount} of ${t.tokenAddress} to ${t.spenderAddress}`})}.call(null)}var hl=k(h,e,d,j$1,c,b,a);function Dt(e,r){return zs(e,r).then(U(e.signer))}var Ds=z$1.object({approved:z$1.boolean().default(true),metadata:j.optional(),operatorAddress:EvmAddressSchema,tokenAddress:EvmAddressSchema}),xl=k(a);async function js(e,r){let t=l(r,Ds);return async function*(){return e.account.walletType===WalletType.EOA?z(yield Wt(D(e.environment.chainId,_e(t.tokenAddress,t.operatorAddress,t.approved)))):yield*await G(e,{calls:[_e(t.tokenAddress,t.operatorAddress,t.approved)],metadata:t.metadata??`${t.approved?"Approve":"Revoke"} ${t.operatorAddress} on ${t.tokenAddress}`})}.call(null)}var Tl=k(h,e,d,j$1,c,b,a);function jt(e,r){return js(e,r).then(U(e.signer))}var Pl=k(d,c,b,a);async function Hs(e){let r=await _s(e),t=r.erc20.map(n=>We(n.tokenAddress,n.spenderAddress,n.amount)),o=r.erc1155.map(n=>_e(n.tokenAddress,n.operatorAddress,true));return async function*(){if(t.length===0&&o.length===0)return;if(e.account.walletType===WalletType.EOA){for(let p of t)await z(yield Ht(D(e.environment.chainId,p))).wait();for(let p of o)await z(yield Wt(D(e.environment.chainId,p))).wait();return}await(yield*await G(e,{calls:[...t,...o],metadata:"Trading setup approvals"})).wait();}.call(null)}var Cl=k(h,e,d,j$1,f$1,g,c,b,a);function kl(e){return Hs(e).then(U(e.signer)).then(Ws)}function Ws(){return {transactionHash:null,transactionId:null,wait:async()=>{}}}async function _s(e){let r=Ns(e),t=[...r.erc20.map(a=>ht(a.tokenAddress,e.account.wallet,a.spenderAddress)),...r.erc1155.map(a=>Tt(a.tokenAddress,e.account.wallet,a.operatorAddress))],o=await e.rpc.ethCallBatch(t),n=o.slice(0,r.erc20.length),p=o.slice(r.erc20.length);return {erc20:r.erc20.filter((a,y)=>xt(n[y])<a.amount),erc1155:r.erc1155.filter((a,y)=>!Pt(p[y]))}}function Ns(e){return {erc20:[{amount:$,spenderAddress:e.environment.standardExchange,tokenAddress:e.environment.collateralToken},{amount:$,spenderAddress:e.environment.negRiskExchange,tokenAddress:e.environment.collateralToken},{amount:$,spenderAddress:e.environment.negRiskAdapter,tokenAddress:e.environment.collateralToken},{amount:$,spenderAddress:e.environment.collateralAdapter,tokenAddress:e.environment.collateralToken},{amount:$,spenderAddress:e.environment.negRiskCollateralAdapter,tokenAddress:e.environment.collateralToken},{amount:$,spenderAddress:e.environment.protocolV2Router,tokenAddress:e.environment.collateralToken},{amount:$,spenderAddress:e.environment.exchangeV3,tokenAddress:e.environment.collateralToken}],erc1155:[{operatorAddress:e.environment.standardExchange,tokenAddress:e.environment.conditionalTokens},{operatorAddress:e.environment.negRiskExchange,tokenAddress:e.environment.conditionalTokens},{operatorAddress:e.environment.negRiskAdapter,tokenAddress:e.environment.conditionalTokens},{operatorAddress:e.environment.collateralAdapter,tokenAddress:e.environment.conditionalTokens},{operatorAddress:e.environment.negRiskCollateralAdapter,tokenAddress:e.environment.conditionalTokens},{operatorAddress:e.environment.autoRedeemOperator,tokenAddress:e.environment.conditionalTokens},{operatorAddress:e.environment.protocolV2Router,tokenAddress:e.environment.positionManager},{operatorAddress:e.environment.exchangeV3,tokenAddress:e.environment.positionManager},{operatorAddress:e.environment.autoRedeemOperator,tokenAddress:e.environment.positionManager}]}}function Ht(e){return {kind:"sendErc20ApprovalTransaction",request:e}}function Wt(e){return {kind:"sendErc1155ApprovalForAllTransaction",request:e}}var Ll=k(e,d,c,b);async function Ks(e,r){return unwrap(e.clob.post("/auth/api-key",{headers:Gt(r)}).andThen(f(ApiKeyCredsSchema)))}var wl=k(e,d,c,b);async function Ys(e,r){return unwrap(e.clob.get("/auth/derive-api-key",{headers:Gt(r)}).andThen(f(ApiKeyCredsSchema)))}var Ml=k(e,d,c,b);async function Bl(e,r){try{return await Ks(e,r)}catch(t){if(!(t instanceof d)||t.status!==400)throw t}return Ys(e,r)}var Ul=k(e,d,j$1,c,b);async function Fl(e){return (await unwrap(e.secureClob.get("/auth/api-keys").andThen(f(ApiKeysResponseSchema)))).apiKeys}var zl=k(e,d,j$1,c,b);async function Dl(e){await unwrap(e.secureClob.del("/auth/api-key").andThen(f(z$1.literal("OK"))));}var jl=k(e,d,j$1,c,b);async function Hl(e){return unwrap(e.secureClob.post("/auth/builder-api-key").andThen(f(BuilderApiKeyCredsSchema)))}var Wl=k(e,d,j$1,c,b);async function _l(e){return unwrap(e.secureClob.get("/auth/builder-api-key").andThen(f(BuilderApiKeysResponseSchema)))}var Nl=k(e,d,j$1,c,b);async function Gl(e){await unwrap(e.clob.del("/auth/builder-api-key").andThen(f(z$1.literal("OK"))));}function Gt(e){return {POLY_ADDRESS:e.address,POLY_NONCE:`${e.nonce}`,POLY_SIGNATURE:e.signature,POLY_TIMESTAMP:`${e.timestamp}`}}var ei=z$1.object({after:z$1.string().optional(),before:z$1.string().optional(),builderCode:BuilderCodeSchema,cursor:PaginationCursorSchema.optional(),id:z$1.string().optional(),market:z$1.string().optional(),tokenId:z$1.string().optional()}),rf=k(e,d,c,b,a);function tf(e,r){let{cursor:t,...o}=l(r,ei);return C(n=>e.clob.get("/builder/trades",{params:R({...o,nextCursor:n},S({builderCode:"builder_code",tokenId:"asset_id"}))}).andThen(f(PaginatedBuilderTradesSchema)).map(p=>({items:p.data,hasMore:p.nextCursor!==END_CURSOR,nextCursor:p.nextCursor===END_CURSOR?void 0:toPaginationCursor(p.nextCursor),totalCount:p.count})),t)}var Ti=z$1.object({tokenId:z$1.string()}),ff=k(e,d,c,b,a);async function yf(e,r){let t=l(r,Ti);return (await unwrap(e.clob.get("/midpoint",{params:R(t,S())}).andThen(f(MidpointSchema)))).mid}var Pi=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),Ef=k(e,d,c,b,a);async function gf(e,r){let t=l(r,Pi);return unwrap(e.clob.post("midpoints",{json:Ye(t)}).andThen(f(MidpointsSchema)))}var Ci=z$1.object({tokenId:z$1.string()}),Rf=k(e,d,c,b,a);async function he(e,r){let t=l(r,Ci);return (await unwrap(e.clob.get("/tick-size",{params:R(t,S())}).andThen(f(FetchTickSizeResponseSchema)))).minimumTickSize}var ki=z$1.object({tokenId:z$1.string()}),Sf=k(e,d,c,b,a);async function xe(e,r){let t=l(r,ki);return (await unwrap(e.clob.get("/neg-risk",{params:R(t,S())}).andThen(f(FetchNegRiskResponseSchema)))).negRisk}var bi=z$1.object({tokenId:TokenIdSchema}),hf=k(e,d,c,b,a);async function Qt(e,r){let t=l(r,bi);return unwrap(e.clob.get(`/markets-by-token/${t.tokenId}`).andThen(f(ResolveConditionByTokenResponseSchema)))}var Ii=z$1.object({conditionId:CtfConditionIdSchema}),xf=k(e,d,c,b,a);async function Zt(e,r){let t=l(r,Ii);return unwrap(e.clob.get(`/clob-markets/${t.conditionId}`).andThen(f(FetchMarketInfoResponseSchema)))}var qi=z$1.object({builderCode:BuilderCodeSchema}),Tf=k(e,d,c,b,a);async function Xt(e,r){let t=l(r,qi);return unwrap(e.clob.get(`/fees/builder-fees/${t.builderCode}`).andThen(f(FetchBuilderFeeRatesResponseSchema)).mapErr(o=>o instanceof d&&o.status===404?new a(`Unknown builder code: ${t.builderCode}`,{cause:o}):o))}var Ai=z$1.object({tokenId:z$1.string(),side:OrderSideSchema}),Pf=k(e,d,c,b,a);async function Cf(e,r){let t=l(r,Ai);return (await unwrap(e.clob.get("/price",{params:R(t,S())}).andThen(f(PriceSchema)))).price}var vi=z$1.array(z$1.object({tokenId:z$1.string(),side:OrderSideSchema})).min(1),kf=k(e,d,c,b,a);async function bf(e,r){let t=l(r,vi);return unwrap(e.clob.post("prices",{json:ji(t)}).andThen(f(PricesSchema)))}var Oi=z$1.object({tokenId:z$1.string()}),If=k(e,d,c,b,a);async function eo(e,r){let t=l(r,Oi);return unwrap(e.clob.get("/book",{params:R(t,S())}).andThen(f(FetchOrderBookResponseSchema)))}var Li=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),qf=k(e,d,c,b,a);async function Af(e,r){let t=l(r,Li);return unwrap(e.clob.post("books",{json:Ye(t)}).andThen(f(OrderBooksSchema)))}var wi=z$1.object({tokenId:z$1.string()}),vf=k(e,d,c,b,a);async function Of(e,r){let t=l(r,wi);return (await unwrap(e.clob.get("/spread",{params:R(t,S())}).andThen(f(SpreadSchema)))).spread}var Mi=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),Lf=k(e,d,c,b,a);async function wf(e,r){let t=l(r,Mi);return unwrap(e.clob.post("spreads",{json:Ye(t)}).andThen(f(SpreadsSchema)))}var Bi=z$1.object({tokenId:z$1.string()}),Mf=k(e,d,c,b,a);async function Bf(e,r){let t=l(r,Bi);return unwrap(e.clob.get("/last-trade-price",{params:R(t,S())}).andThen(f(LastTradePriceSchema)))}var Ui=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),Uf=k(e,d,c,b,a);async function Ff(e,r){let t=l(r,Ui);return unwrap(e.clob.post("last-trades-prices",{json:Ye(t)}).andThen(f(LastTradePricesSchema)))}var Fi=z$1.object({tokenId:z$1.string(),startTs:z$1.number().int().optional(),endTs:z$1.number().int().optional(),fidelity:z$1.number().int().positive().optional(),interval:PriceHistoryIntervalSchema.optional()}),zf=k(e,d,c,b,a);async function Df(e,r){let t=l(r,Fi);return (await unwrap(e.clob.get("/prices-history",{params:R(t,{tokenId:"market",startTs:"startTs",endTs:"endTs",fidelity:"fidelity",interval:"interval"})}).andThen(f(PriceHistorySchema)))).history}var zi=z$1.object({cursor:PaginationCursorSchema.optional(),sponsored:z$1.boolean().optional()}).default({}),jf=k(e,d,c,b,a);function Hf(e,r={}){let{cursor:t,...o}=l(r,zi);return C(n=>e.clob.get("/rewards/markets/current",{params:R({...o,nextCursor:n},S())}).andThen(f(PaginatedCurrentRewardsSchema)).map(p=>({items:p.data,hasMore:p.nextCursor!==END_CURSOR,nextCursor:p.nextCursor===END_CURSOR?void 0:toPaginationCursor(p.nextCursor),totalCount:p.count})),t)}var Di=z$1.object({conditionId:CtfConditionIdSchema,cursor:PaginationCursorSchema.optional(),sponsored:z$1.boolean().optional()}),Wf=k(e,d,c,b,a);function _f(e,r){let{cursor:t,...o}=l(r,Di);return C(n=>e.clob.get(`rewards/markets/${o.conditionId}`,{params:R({nextCursor:n,sponsored:o.sponsored},S())}).andThen(f(PaginatedMarketRewardsSchema)).map(p=>({items:p.data,hasMore:p.nextCursor!==END_CURSOR,nextCursor:p.nextCursor===END_CURSOR?void 0:toPaginationCursor(p.nextCursor),totalCount:p.count})),t)}function Ye(e){return e.map(({tokenId:r})=>({token_id:r}))}function ji(e){return e.map(({tokenId:r,side:t})=>({token_id:r,side:t}))}var $i=z$1.object({ascending:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),pageSize:I.default(20),getPositions:z$1.boolean().optional(),holdersOnly:z$1.boolean().optional(),order:z$1.string().optional(),parentEntityId:z$1.union([EventIdSchema,SeriesIdSchema]),parentEntityType:CommentParentEntityTypeSchema}),Vi=z$1.object({getPositions:z$1.boolean().optional(),id:CommentIdSchema}),Ki=z$1.object({address:z$1.string(),ascending:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),order:z$1.string().optional(),pageSize:I.default(20)}),ey=k(e,d,c,b,a);function ry(e,r){let{cursor:t,pageSize:o,...n}=l(r,$i);return C(p=>{let a=O(p,o);return e.gamma.get("/comments",{params:R({ascending:n.ascending,getPositions:n.getPositions,holdersOnly:n.holdersOnly,limit:a.pageSize+1,offset:a.offset,order:n.order,parentEntityId:n.parentEntityId,parentEntityType:n.parentEntityType},S())}).andThen(f(ListCommentsResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var ty=k(e,d,c,b,a);async function oy(e,r){let t=l(r,Vi);return unwrap(e.gamma.get(`comments/${t.id}`,{params:R({getPositions:t.getPositions},S())}).andThen(f(ListCommentsResponseSchema)))}var ny=k(e,d,c,b,a);function ay(e,r){let{address:t,cursor:o,pageSize:n,...p}=l(r,Ki);return C(a=>{let y=O(a,n);return e.gamma.get(`comments/user_address/${t}`,{params:R({ascending:p.ascending,limit:y.pageSize+1,offset:y.offset,order:p.order},S())}).andThen(f(ListCommentsResponseSchema)).map(x=>{let Ae=x.length>y.pageSize;return {items:x.slice(0,y.pageSize),hasMore:Ae,nextCursor:Ae?v({offset:y.offset+y.pageSize,pageSize:y.pageSize}):void 0}})},o)}function Je(e,r){let t;try{t=new URL(e);}catch(y){throw new a("Expected a valid Polymarket URL.",{cause:y})}if(t.protocol!=="https:"||t.hostname!=="polymarket.com"&&t.hostname!=="www.polymarket.com")throw new a("Expected a valid Polymarket URL.");let[o,n,...p]=t.pathname.split("/").filter(Boolean),a$1=p[0];if(r==="market"&&o==="event"&&n!==void 0&&p.length<=1)return a$1??n;if(o!==r||n===void 0||p.length>0)throw new a(`Expected a Polymarket ${r} URL.`);return n}var ep=z$1.object({ascending:z$1.boolean().optional(),closed:z$1.boolean().default(false),cursor:PaginationCursorSchema.optional(),pageSize:I.optional(),cyom:z$1.boolean().optional(),endDateMax:IsoDateTimeStringSchema.optional(),endDateMin:IsoDateTimeStringSchema.optional(),ended:z$1.boolean().optional(),eventDate:IsoCalendarDateStringSchema.optional(),eventWeek:z$1.number().int().optional(),excludeTagIds:z$1.array(z$1.number().int()).optional(),featured:z$1.boolean().optional(),featuredOrder:z$1.boolean().optional(),gameIds:z$1.array(z$1.number().int()).optional(),ids:z$1.array(z$1.number().int()).optional(),includeBestLines:z$1.boolean().optional(),includeChat:z$1.boolean().optional(),includeChildren:z$1.boolean().optional(),includeTemplate:z$1.boolean().optional(),liquidityMax:z$1.number().optional(),liquidityMin:z$1.number().optional(),live:z$1.boolean().optional(),locale:z$1.string().optional(),order:z$1.string().optional(),parentEventId:z$1.number().int().optional(),partnerSlug:z$1.string().optional(),recurrence:z$1.enum(["daily","weekly","monthly"]).optional(),relatedTags:z$1.boolean().optional(),seriesIds:z$1.array(z$1.number().int()).optional(),slug:z$1.array(z$1.string()).optional(),startDateMax:IsoDateTimeStringSchema.optional(),startDateMin:IsoDateTimeStringSchema.optional(),startTimeMax:IsoDateTimeStringSchema.optional(),startTimeMin:IsoDateTimeStringSchema.optional(),tagIds:z$1.array(z$1.number().int()).optional(),tagMatch:z$1.enum(["any","all"]).optional(),tagSlug:z$1.string().optional(),titleSearch:z$1.string().optional(),volumeMax:z$1.number().optional(),volumeMin:z$1.number().optional()}),rp=z$1.union([z$1.object({id:z$1.string(),includeBestLines:z$1.boolean().optional(),includeChat:z$1.boolean().optional(),includeTemplate:z$1.boolean().optional(),locale:z$1.string().optional()}),z$1.object({slug:z$1.string(),includeBestLines:z$1.boolean().optional(),includeChat:z$1.boolean().optional(),includeTemplate:z$1.boolean().optional(),locale:z$1.string().optional()}),z$1.object({url:z$1.string(),includeBestLines:z$1.boolean().optional(),includeChat:z$1.boolean().optional(),includeTemplate:z$1.boolean().optional(),locale:z$1.string().optional()})]),tp=z$1.object({id:z$1.string()}),op=z$1.object({id:z$1.string()}),hy=k(e,d,c,b,a);function xy(e,r={}){let t=l(r,ep);return C(o=>e.gamma.get("/events/keyset",{params:np({...t,cursor:o??t.cursor})}).andThen(f(ListEventsKeysetResponseSchema)).map(n=>({items:n.items,hasMore:n.nextCursor!==void 0,nextCursor:n.nextCursor})),t.cursor)}var Ty=k(e,d,c,b,a);async function Py(e,r){let t=l(r,rp);if("id"in t)return unwrap(e.gamma.get(`events/${t.id}`,{params:ap(t)}).andThen(f(EventSchema)));let o="url"in t?Je(t.url,"event"):t.slug;return unwrap(e.gamma.get(`events/slug/${o}`,{params:sp(t)}).andThen(f(EventSchema)))}var Cy=k(e,d,c,b,a);async function ky(e,r){let t=l(r,tp);return unwrap(e.gamma.get(`events/${t.id}/tags`).andThen(f(FetchEventTagsResponseSchema)))}var by=k(e,d,c,b,a);async function Iy(e,r){let t=l(r,op);return unwrap(e.data.get("/live-volume",{params:w(t)}).andThen(f(FetchEventLiveVolumeResponseSchema)))}function np(e){return R(e,S({cursor:"after_cursor",excludeTagIds:"exclude_tag_id",gameIds:"game_id",ids:"id",pageSize:"limit",seriesIds:"series_id",tagIds:"tag_id"}))}function ap(e){return R({includeBestLines:e.includeBestLines,includeChat:e.includeChat,includeTemplate:e.includeTemplate,locale:e.locale},S())}function sp(e){return R({includeBestLines:e.includeBestLines,includeChat:e.includeChat,includeTemplate:e.includeTemplate,locale:e.locale},S())}var lp=z$1.object({cursor:PaginationCursorSchema.optional(),pageSize:I.default(20),timePeriod:TimePeriodSchema.optional()}),fp=z$1.object({timePeriod:TimePeriodSchema.optional()}),yp=z$1.object({category:LeaderboardCategorySchema.optional(),cursor:PaginationCursorSchema.optional(),pageSize:I.default(20),timePeriod:TimePeriodSchema.optional(),orderBy:LeaderboardOrderBySchema.optional(),user:z$1.string().optional(),userName:z$1.string().optional()}),zy=k(e,d,c,b,a);function Dy(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,lp);return C(p=>{let a=O(p,o);return e.data.get("/v1/builders/leaderboard",{params:w({...n,limit:a.pageSize+1,offset:a.offset})}).andThen(f(ListBuilderLeaderboardResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var jy=k(e,d,c,b,a);async function Hy(e,r={}){let t=l(r,fp);return unwrap(e.data.get("/v1/builders/volume",{params:w(t)}).andThen(f(ListBuilderVolumeResponseSchema)))}var Wy=k(e,d,c,b,a);function _y(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,yp);return C(p=>{let a=O(p,o);return e.data.get("/v1/leaderboard",{params:w({...n,limit:a.pageSize+1,offset:a.offset})}).andThen(f(ListTraderLeaderboardResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var Pp=z$1.object({ascending:z$1.boolean().optional(),closed:z$1.boolean().optional(),clobTokenIds:z$1.array(z$1.string()).optional(),cursor:PaginationCursorSchema.optional(),pageSize:I.optional(),conditionIds:z$1.array(CtfConditionIdSchema).optional(),cyom:z$1.boolean().optional(),decimalized:z$1.boolean().optional(),endDateMax:IsoDateTimeStringSchema.optional(),endDateMin:IsoDateTimeStringSchema.optional(),gameId:z$1.string().optional(),ids:z$1.array(z$1.number().int()).optional(),includeTag:z$1.boolean().optional(),liquidityNumMax:z$1.number().optional(),liquidityNumMin:z$1.number().optional(),locale:z$1.string().optional(),marketMakerAddresses:z$1.array(z$1.string()).optional(),order:z$1.string().optional(),positionIds:z$1.array(PositionIdSchema).optional(),questionIds:z$1.array(z$1.string()).optional(),relatedTags:z$1.boolean().optional(),rfqEnabled:z$1.boolean().optional(),rewardsMinSize:z$1.number().optional(),slug:z$1.array(z$1.string()).optional(),sportsMarketTypes:z$1.array(z$1.string()).optional(),startDateMax:IsoDateTimeStringSchema.optional(),startDateMin:IsoDateTimeStringSchema.optional(),tagId:z$1.number().int().optional(),tagMatch:z$1.enum(["any","all"]).optional(),umaResolutionStatus:z$1.string().optional(),volumeNumMax:z$1.number().optional(),volumeNumMin:z$1.number().optional()}),Cp=z$1.object({id:z$1.string(),includeTag:z$1.boolean().optional(),locale:z$1.string().optional()}),kp=z$1.object({slug:z$1.string(),includeTag:z$1.boolean().optional(),locale:z$1.string().optional()}),bp=z$1.object({url:z$1.string(),includeTag:z$1.boolean().optional(),locale:z$1.string().optional()}),Ip=z$1.union([Cp,kp,bp]),qp=z$1.object({id:z$1.string()}),Ap=z$1.object({limit:z$1.number().int().optional(),market:z$1.array(z$1.string()),minBalance:z$1.number().int().optional()}),vp=z$1.object({market:z$1.array(z$1.string()).optional()}),Op=z$1.enum(["OPEN","CLOSED","ALL"]),Lp=z$1.enum(["TOKENS","CASH_PNL","REALIZED_PNL","TOTAL_PNL"]),wp=z$1.enum(["ASC","DESC"]),Mp=z$1.object({cursor:PaginationCursorSchema.optional(),market:z$1.string(),pageSize:I.default(20),user:z$1.string().optional(),status:Op.optional(),sortBy:Lp.optional(),sortDirection:wp.optional()}),oE=k(e,d,c,b,a);function io(e,r={}){let t=l(r,Pp);return C(o=>e.gamma.get("/markets/keyset",{params:Up({...t,cursor:o??t.cursor})}).andThen(f(ListMarketsKeysetResponseSchema)).map(n=>({items:n.items,hasMore:n.nextCursor!==void 0,nextCursor:n.nextCursor})),t.cursor)}var Bp=z$1.object({cursor:PaginationCursorSchema.optional(),pageSize:I.max(100).optional(),exclude:z$1.array(CtfConditionIdSchema).optional()}),nE=k(e,d,c,b,a);function aE(e,r={}){let t=l(r,Bp);return C(o=>e.rfq.get("/v1/rfq/combo-markets",{params:Fp({...t,cursor:o??t.cursor})}).andThen(f(ListComboMarketsResponseSchema)).map(n=>({items:n.markets,hasMore:n.nextCursor!==void 0,nextCursor:n.nextCursor})),t.cursor)}var sE=k(e,d,c,b,a);async function iE(e,r){let t=l(r,Ip);return "id"in t?zp(e,t):"url"in t?no(e,{includeTag:t.includeTag,locale:t.locale,slug:Je(t.url,"market")}):no(e,t)}var pE=k(e,d,c,b,a);async function cE(e,r){let t=l(r,qp);return unwrap(e.gamma.get(`markets/${t.id}/tags`).andThen(f(FetchMarketTagsResponseSchema)))}var dE=k(e,d,c,b,a);async function uE(e,r){let t=l(r,Ap);return unwrap(e.data.get("/holders",{params:w(t)}).andThen(f(ListMarketHoldersResponseSchema)))}var mE=k(e,d,c,b,a);async function lE(e,r={}){let t=l(r,vp);return unwrap(e.data.get("/oi",{params:w(t)}).andThen(f(ListOpenInterestResponseSchema)))}var fE=k(e,d,c,b,a);function yE(e,r){let{cursor:t,pageSize:o,...n}=l(r,Mp);return C(p=>{let a=O(p,o);return e.data.get("/v1/market-positions",{params:w({...n,limit:a.pageSize+1,offset:a.offset})}).andThen(f(ListMarketPositionsResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}function Up(e){return R(e,S({cursor:"after_cursor",ids:"id",marketMakerAddresses:"market_maker_address",pageSize:"limit"}))}function Fp(e){return R({cursor:e.cursor,exclude:e.exclude?.join(","),pageSize:e.pageSize},{cursor:"cursor",exclude:"exclude",pageSize:"limit"})}async function no(e,r){return unwrap(e.gamma.get(`markets/slug/${r.slug}`,{params:R({includeTag:r.includeTag,locale:r.locale},S())}).andThen(f(MarketSchema)))}async function zp(e,r){return unwrap(e.gamma.get(`markets/${r.id}`,{params:R({includeTag:r.includeTag,locale:r.locale},S())}).andThen(f(MarketSchema)))}var Hp=z$1.object({orderId:z$1.string()}),Wp=z$1.object({orderIds:z$1.array(z$1.string()).min(1).max(3e3)}),_p=z$1.object({tokenId:z$1.string().optional(),market:z$1.string().optional()}).refine(e=>e.market!==void 0||e.tokenId!==void 0,{message:"At least one of market or tokenId is required.",path:["market"]}),PE=k(d,e,j$1,c,b,a);async function CE(e,r){let t=l(r,Hp);return Xe(e,"/order",{orderID:t.orderId})}var kE=k(d,e,j$1,c,b,a);async function bE(e,r){let t=l(r,Wp);return Xe(e,"/orders",t.orderIds)}var IE=k(d,e,j$1,c,b);async function qE(e){return Xe(e,"/cancel-all")}var AE=k(d,e,j$1,c,b,a);async function vE(e,r){let t=l(r,_p);return Xe(e,"/cancel-market-orders",{asset_id:t.tokenId,market:t.market})}async function Xe(e,r,t){return unwrap(e.secureClob.del(r,{json:t}).andThen(f(CancelOrdersResponseSchema)))}var co=z$1.object({tokenId:z$1.string(),orderType:z$1.union([z$1.literal(OrderType.FAK),z$1.literal(OrderType.FOK)]).default(OrderType.FOK)}),Gp=z$1.discriminatedUnion("side",[co.extend({side:z$1.literal(OrderSide.BUY),amount:PositiveDecimalNumberSchema}),co.extend({side:z$1.literal(OrderSide.SELL),shares:PositiveDecimalNumberSchema})]),zE=k(i,e,d,c,b,a);async function DE(e,r){let t=l(r,Gp),o=await he(e,{tokenId:t.tokenId}),n=t.side===OrderSide.BUY?t.amount:t.shares;return xr(e,{amount:n,orderType:t.orderType,side:t.side,tickSize:o,tokenId:t.tokenId})}async function xr(e,r){let t=await eo(e,{tokenId:r.tokenId}),o=r.side===OrderSide.BUY?Vp(t.asks,r.amount,r.orderType):Kp(t.bids,r.amount,r.orderType);return invariant($p(o,r.tickSize),`Resolved market price fell outside the valid range for tick size ${r.tickSize}.`),o}function $p(e,r){return e>=r&&e<=1-r}function Vp(e,r,t){if(e.length===0)throw new i("No resting liquidity.");let o=0;for(let p=e.length-1;p>=0;p-=1){let a=e[p];if(a!==void 0&&(o+=Number.parseFloat(a.size)*Number.parseFloat(a.price),o>=r))return Number.parseFloat(a.price)}if(t===OrderType.FOK)throw new i("Insufficient liquidity for full fill.");let n=e[0];return Number.parseFloat(n.price)}function Kp(e,r,t){if(e.length===0)throw new i("No resting liquidity.");let o=0;for(let p=e.length-1;p>=0;p-=1){let a=e[p];if(a!==void 0&&(o+=Number.parseFloat(a.size),o>=r))return Number.parseFloat(a.price)}if(t===OrderType.FOK)throw new i("Insufficient liquidity for full fill.");let n=e[0];return Number.parseFloat(n.price)}var Zp=z$1.array(z$1.custom()).min(1).max(15),KE=k(e,d,j$1,c,b),YE=k(e,d,j$1,c,b,a);function rr(e){return async function(t){let o=fo(e,t);return unwrap(e.secureClob.post("/order",{json:o}).andThen(f(OrderResponseSchema)))}}function JE(e){return async function(t){let n=l(t,Zp).map(p=>fo(e,p));return unwrap(e.secureClob.post("/orders",{json:n}).andThen(f(OrderResponsesSchema)))}}function fo(e,r){return invariant(r.postOnly!==true||r.orderType===OrderType.GTC||r.orderType===OrderType.GTD,"Post-only orders are only supported for GTC and GTD order types."),{deferExec:false,order:{builder:r.builder,expiration:`${r.expiration}`,maker:r.maker,makerAmount:r.makerAmount,metadata:r.metadata,salt:Number.parseInt(r.salt,10),side:r.side,signature:r.signature,signatureType:r.signatureType,signer:r.signer,takerAmount:r.takerAmount,timestamp:r.timestamp,tokenId:r.tokenId},orderType:r.orderType,owner:e.credentials.key,...r.postOnly===true?{postOnly:true}:{}}}function Pe(e){switch(e){case .1:return {amount:3,price:1,size:2};case .01:return {amount:4,price:2,size:2};case .001:return {amount:5,price:3,size:2};case 1e-4:return {amount:6,price:4,size:2}}invariant(false,`Unsupported tick size: ${e}`);}function Ce(e,r){return r?e.environment.negRiskExchange:e.environment.standardExchange}function te(e){return BigInt(Math.round(e*10**6))}function oe(e,r){return W(e)<=r?e:Math.floor(e*10**r)/10**r}function ue(e,r){return W(e)<=r?e:Math.ceil(e*10**r)/10**r}function Tr(e,r){return W(e)<=r?e:Math.round(e*10**r)/10**r}function W(e){if(typeof e=="number"&&Number.isInteger(e))return 0;let[r="",t]=e.toString().toLowerCase().split("e"),[,o=""]=r.split("."),n=o.length;if(t===void 0)return n;let p=Number.parseInt(t,10);return Math.max(0,n-p)}var go=z$1.strictObject({tokenId:TokenIdSchema,price:PositiveDecimalNumberSchema,size:PositiveDecimalNumberSchema,side:OrderSideSchema,builderCode:BuilderCodeSchema.optional(),postOnly:z$1.boolean().default(false),expiration:z$1.number().int().nonnegative().optional()}).superRefine((e,r)=>{if(e.expiration!==void 0){let t=Math.floor(Date.now()/1e3)+60;e.expiration<t&&r.addIssue({code:"custom",message:"Expiration must be at least 60 seconds in the future.",path:["expiration"]});}});async function Ro(e,r){let t=await nc(e,{price:r.price,tokenId:r.tokenId}),o=ac({price:t.price,side:r.side,size:r.size,tickSize:t.tickSize});return {builderCode:r.builderCode,chainId:e.environment.chainId,exchangeAddress:t.exchangeAddress,expiration:r.expiration??0,funderAddress:t.funderAddress,offeredAmount:o.offeredAmount,orderType:r.expiration===void 0?OrderType.GTC:OrderType.GTD,side:r.side,signer:t.signerAddress,requestedAmount:o.requestedAmount,tokenId:r.tokenId}}async function nc(e,r){let t=e.account,o=await he(e,{tokenId:r.tokenId}),n=await xe(e,{tokenId:r.tokenId});return {exchangeAddress:Ce(e,n),funderAddress:t.wallet,negRisk:n,price:sc(r.price,o),signerAddress:t.signer,tickSize:o}}function ac(e){let r=Pe(e.tickSize),t=Tr(e.price,r.price);if(e.side===OrderSide.BUY){let p=oe(e.size,r.size),a=p*t;return W(a)>r.amount&&(a=ue(a,r.amount+4),W(a)>r.amount&&(a=oe(a,r.amount))),{offeredAmount:te(a),requestedAmount:te(p)}}let o=oe(e.size,r.size),n=o*t;return W(n)>r.amount&&(n=ue(n,r.amount+4),W(n)>r.amount&&(n=oe(n,r.amount))),{offeredAmount:te(o),requestedAmount:te(n)}}function sc(e,r){let t=Pe(r);if(e<r||e>1-r)throw new a(`Price must be between ${r} and ${1-r} for tick size ${r}.`);if(W(e)>t.price)throw new a(`Price must conform to tick size ${r} with at most ${t.price} decimal places.`);return Tr(e,t.price)}var So=z$1.object({tokenId:TokenIdSchema,builderCode:BuilderCodeSchema.optional(),orderType:z$1.union([z$1.literal(OrderType.FAK),z$1.literal(OrderType.FOK)]).default(OrderType.FAK)}),xo=z$1.discriminatedUnion("side",[So.extend({side:z$1.literal(OrderSide.BUY),amount:PositiveDecimalNumberSchema,maxSpend:PositiveDecimalNumberSchema.optional(),maxPrice:PositiveDecimalNumberSchema.optional()}),So.extend({side:z$1.literal(OrderSide.SELL),shares:PositiveDecimalNumberSchema,minPrice:PositiveDecimalNumberSchema.optional()})]);async function To(e,r){let t=await cc(e,r),o=mc({amount:t.resolvedAmount,price:t.price,protectPrice:uc(r),side:r.side,tickSize:t.tickSize});return {builderCode:r.builderCode,chainId:e.environment.chainId,exchangeAddress:t.exchangeAddress,expiration:0,funderAddress:t.funderAddress,offeredAmount:o.offeredAmount,orderType:r.orderType,side:r.side,signer:t.signerAddress,requestedAmount:o.requestedAmount,tokenId:r.tokenId}}async function cc(e,r){let t=e.account,o=await he(e,{tokenId:r.tokenId}),n=r.side===OrderSide.BUY?r.amount:r.shares,p=await dc(e,r,n,o),a=await xe(e,{tokenId:r.tokenId}),y=await lc(e,{amount:n,builderCode:r.builderCode,maxSpend:r.side===OrderSide.BUY?r.maxSpend:void 0,price:p,side:r.side,tokenId:r.tokenId});return {exchangeAddress:Ce(e,a),funderAddress:t.wallet,negRisk:a,price:p,resolvedAmount:y,signerAddress:t.signer,tickSize:o}}async function dc(e,r,t,o){return r.side===OrderSide.BUY&&r.maxPrice!==void 0?ho(r.maxPrice,o,"maxPrice"):r.side===OrderSide.SELL&&r.minPrice!==void 0?ho(r.minPrice,o,"minPrice"):xr(e,{amount:t,orderType:r.orderType,side:r.side,tickSize:o,tokenId:r.tokenId})}function ho(e,r,t){let o=Pe(r);if(e<r||e>1-r)throw new a(`${t} must be between ${r} and ${1-r} for tick size ${r}.`);if(W(e)>o.price)throw new a(`${t} must conform to tick size ${r} with at most ${o.price} decimal places.`);return e}function uc(e){return e.side===OrderSide.BUY&&e.maxPrice!==void 0||e.side===OrderSide.SELL&&e.minPrice!==void 0}function mc(e){let r=Pe(e.tickSize),t=oe(e.price,r.price),o=oe(e.amount,r.size);if(e.side===OrderSide.BUY){let p=o/t;return W(p)>r.amount&&(p=ue(p,r.amount+4),W(p)>r.amount&&(p=e.protectPrice?ue(p,r.amount):oe(p,r.amount))),{offeredAmount:te(o),requestedAmount:te(p)}}let n=o*t;return W(n)>r.amount&&(n=ue(n,r.amount+4),W(n)>r.amount&&(n=e.protectPrice?ue(n,r.amount):oe(n,r.amount))),{offeredAmount:te(o),requestedAmount:te(n)}}async function lc(e,r){if(r.side!==OrderSide.BUY||r.maxSpend===void 0)return r.amount;let[t,o]=await Promise.all([fc(e,r.tokenId),yc(e,r.builderCode)]);return Ec({amount:r.amount,builderTakerFeeRate:o,platformFeeExponent:t.exponent,platformFeeRate:t.rate,maxSpend:r.maxSpend,price:r.price})}async function fc(e,r){let t=await Qt(e,{tokenId:r});return (await Zt(e,{conditionId:t})).feeInfo}async function yc(e,r){return r===void 0?0:(await Xt(e,{builderCode:r})).taker}function Ec(e){let r=e.platformFeeRate*(e.price*(1-e.price))**e.platformFeeExponent,t=e.amount/e.price*r,o=e.amount+t+e.amount*e.builderTakerFeeRate;return e.maxSpend<=o?e.maxSpend/(1+r/e.price+e.builderTakerFeeRate):e.amount}var Po="0x0000000000000000000000000000000000000000000000000000000000000000";function kr(e,r){let t=nt(r);return {builder:e.builderCode??Po,chainId:e.chainId,exchangeAddress:e.exchangeAddress,expiration:e.expiration,maker:t.maker,makerAmount:e.offeredAmount.toString(),metadata:Po,orderType:e.orderType,salt:gc().toString(),side:e.side,signatureType:t.signatureType,signer:t.signer,takerAmount:e.requestedAmount.toString(),timestamp:Date.now().toString(),tokenId:e.tokenId}}function br(e,r){let{chainId:t,exchangeAddress:o,...n}=e;return {...n,signature:r}}function gc(){let e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),BigInt(`0x${Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}`)&(1n<<53n)-1n}var bo="Polymarket CTF Exchange",hc="DepositWallet",xc="1",Ir="0x0000000000000000000000000000000000000000000000000000000000000000",qr="Order(uint256 salt,address maker,address signer,uint256 tokenId,uint256 makerAmount,uint256 takerAmount,uint8 side,uint8 signatureType,uint256 timestamp,bytes32 metadata,bytes32 builder)",Tc=Hash.keccak256(Bytes.fromString(qr),{as:"Hex"}),Pc=Hash.keccak256(Bytes.fromString("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),{as:"Hex"}),Cc=Hash.keccak256(Bytes.fromString(bo),{as:"Hex"}),kc=[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Io=[{name:"salt",type:"uint256"},{name:"maker",type:"address"},{name:"signer",type:"address"},{name:"tokenId",type:"uint256"},{name:"makerAmount",type:"uint256"},{name:"takerAmount",type:"uint256"},{name:"side",type:"uint8"},{name:"signatureType",type:"uint8"},{name:"timestamp",type:"uint256"},{name:"metadata",type:"bytes32"},{name:"builder",type:"bytes32"}],bc=[{name:"contents",type:"Order"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"}];function qo(e){let r=Ic(e.domain,e.order);return e.order.signatureType!==SignatureType.POLY_1271?r:{domain:Oo(e.domain),message:{chainId:e.domain.chainId,contents:r.message,name:hc,salt:Ir,verifyingContract:e.order.signer,version:xc},primaryType:"TypedDataSign",types:{Order:Io,TypedDataSign:bc}}}function Ao(e){if(e.order.signatureType!==SignatureType.POLY_1271)return e.signature;let r=Bytes.toHex(Bytes.fromString(qr)),t=qr.length.toString(16).padStart(4,"0");return expectErc1271Signature(`0x${e.signature.slice(2)}${qc(e.domain).slice(2)}${Ac(e.order).slice(2)}${r.slice(2)}${t}`)}function vo(e){return {builder:e.builder??Ir,maker:e.maker,makerAmount:BigInt(e.makerAmount),metadata:e.metadata??Ir,salt:BigInt(e.salt),side:Oc(e.side),signatureType:e.signatureType,signer:e.signer,takerAmount:BigInt(e.takerAmount),timestamp:BigInt(e.timestamp),tokenId:BigInt(e.tokenId)}}function Ic(e,r){return {domain:Oo(e),message:vo(r),primaryType:"Order",types:{EIP712Domain:kc,Order:Io}}}function Oo(e){return {chainId:e.chainId,name:bo,verifyingContract:e.exchange,version:e.protocolVersion}}function qc(e){return expectHexString(Hash.keccak256(AbiParameters.encode([{type:"bytes32"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"address"}],[Pc,Cc,vc(e.protocolVersion),BigInt(e.chainId),e.exchange]),{as:"Hex"}))}function Ac(e){let r=vo(e);return expectHexString(Hash.keccak256(AbiParameters.encode([{type:"bytes32"},{type:"uint256"},{type:"address"},{type:"address"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint8"},{type:"uint8"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"}],[Tc,r.salt,r.maker,r.signer,r.tokenId,r.makerAmount,r.takerAmount,r.side,r.signatureType,r.timestamp,r.metadata,r.builder]),{as:"Hex"}))}function vc(e){return expectHexString(Hash.keccak256(Bytes.fromString(e),{as:"Hex"}))}function Oc(e){return e===0||e===1?e:e===OrderSide.BUY?0:1}function vr(e){return qo({domain:Lo(e),order:e})}function Or(e,r){return Ao({domain:Lo(e),order:e,signature:r})}function Lo(e){return {chainId:e.chainId,exchange:e.exchangeAddress,protocolVersion:"2"}}function Lr(e){return {kind:"signOrder",payload:e}}var Lc=k(i,e,d,j$1,c,b,a);async function wr(e,r){let t=l(r,xo);return async function*(){let o=await To(e,t),n=kr(o,e.account),p=expectEvmSignature(yield Lr(vr(n)));return br(n,Or(n,p))}.call(null)}var wc=k(e,d,j$1,c,b,a);async function Mr(e,r){let t=l(r,go);return async function*(){let o=await Ro(e,t),n=kr(o,e.account),p=expectEvmSignature(yield Lr(vr(n))),a=br(n,Or(n,p));return t.postOnly===true?{...a,postOnly:true}:a}.call(null)}var Ug=Lc;async function Fg(e,r){return Mo(e,wr(e,r))}var zg=wc;async function Dg(e,r){return Mo(e,Mr(e,r))}async function Mo(e,r){let t=await r;return async function*(){let o=yield*t;return rr(e)(o)}.call(null)}async function Fo(e,r){let t=r.side===OrderSide.BUY?AssetType.COLLATERAL:AssetType.CONDITIONAL,{allowances:o}=await sr(e,r.side===OrderSide.BUY?{assetType:t}:{assetType:t,tokenId:r.tokenId});return Bc(o,r.spenderAddress)}function Bc(e,r){return Object.entries(e).find(([o])=>isSameEvmAddress(o,r))?.[1]??0n}var oR=k(h,i,e,d,j$1,c,b,a);function Uc(e,r){return wr(e,r).then(U(e.signer))}var nR=k(h,i,e,d,j$1,f$1,g,c,b,a);function aR(e,r){return Uc(e,r).then(t=>Do(e,t))}var sR=k(h,e,d,j$1,c,b,a);function Fc(e,r){return Mr(e,r).then(U(e.signer))}var iR=k(h,e,d,j$1,f$1,g,c,b,a);function pR(e,r){return Fc(e,r).then(t=>Do(e,t))}async function Do(e,r){let t=rr(e);try{return await t(r)}catch(o){if(!Dc(o))throw o;let n=await zc(e,r,t);if(n===void 0)throw o;return n}}async function zc(e,r,t){return await jc(e,r)?t(r):void 0}function Dc(e){return e instanceof d&&e.status===400&&e.message.includes("allowance is not enough")}async function jc(e,r){let t=await xe(e,{tokenId:r.tokenId}),o=Ce(e,t),n=BigInt(r.makerAmount);return await Fo(e,{spenderAddress:o,side:r.side,tokenId:r.tokenId})>=n?false:(await(r.side===OrderSide.BUY?await Dt(e,{amount:"max",spenderAddress:o,tokenAddress:e.environment.collateralToken}):await jt(e,{operatorAddress:o,tokenAddress:e.environment.conditionalTokens})).wait(),await dt(e,{assetType:r.side===OrderSide.BUY?AssetType.COLLATERAL:AssetType.CONDITIONAL,tokenId:r.side===OrderSide.SELL?r.tokenId:void 0}),true)}var Yc=z$1.enum(["CURRENT","INITIAL","TOKENS","CASHPNL","PERCENTPNL","TITLE","RESOLVING","PRICE","AVGPRICE"]),jo=z$1.enum(["ASC","DESC"]),Jc=z$1.enum(["REALIZEDPNL","TITLE","PRICE","AVGPRICE","TIMESTAMP"]),Qc=z$1.object({cursor:PaginationCursorSchema.optional(),user:z$1.string(),market:z$1.array(z$1.string()).optional(),eventId:z$1.array(z$1.number().int()).optional(),sizeThreshold:z$1.number().optional(),redeemable:z$1.boolean().optional(),mergeable:z$1.boolean().optional(),pageSize:I.default(20),sortBy:Yc.optional(),sortDirection:jo.optional(),title:z$1.string().max(100).optional()}).refine(e=>!(e.market&&e.eventId),{message:"Provide market or eventId, not both",path:["eventId"]}),Zc=z$1.object({cursor:PaginationCursorSchema.optional(),user:z$1.string(),market:z$1.array(z$1.string()).optional(),title:z$1.string().max(100).optional(),eventId:z$1.array(z$1.number().int()).optional(),pageSize:I.default(20),sortBy:Jc.optional(),sortDirection:jo.optional()}).refine(e=>!(e.market&&e.eventId),{message:"Provide market or eventId, not both",path:["eventId"]}),Xc=z$1.object({cursor:PaginationCursorSchema.optional(),user:z$1.string(),pageSize:I.default(20),status:ComboPositionStatusSchema.optional(),conditionId:ComboConditionIdSchema.optional(),positionId:PositionIdSchema.optional()}),ed=z$1.object({user:z$1.string(),market:z$1.array(z$1.string()).optional()}),rd=z$1.object({user:z$1.string()}),td=z$1.object({user:z$1.string()}),SR=k(e,d,c,b,a);function hR(e,r){let{cursor:t,pageSize:o,...n}=l(r,Qc);return C(p=>{let a=O(p,o);return e.data.get("/positions",{params:w({...n,limit:a.pageSize+1,offset:a.offset})}).andThen(f(ListPositionsResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var xR=k(e,d,c,b,a),TR=k(e,d,c,b,a);function PR(e,r){let{cursor:t,pageSize:o,...n}=l(r,Zc);return C(p=>{let a=O(p,o);return e.data.get("/closed-positions",{params:w({...n,limit:a.pageSize+1,offset:a.offset})}).andThen(f(ListClosedPositionsResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}function CR(e,r){let{cursor:t,pageSize:o,...n}=l(r,Xc);return C(p=>{let a=O(p,o);return e.data.get("/v1/positions/combos",{params:R({...n,limit:a.pageSize+1,offset:a.offset},S({conditionId:"combo_condition_id",positionId:"combo_position_id"}))}).andThen(f(ListComboPositionsResponseSchema)).map(y=>{let x=y.combos.length>a.pageSize;return {items:y.combos.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var kR=k(e,d,c,b,a);async function bR(e,r){let t=l(r,ed);return unwrap(e.data.get("/value",{params:w(t)}).andThen(f(FetchPortfolioValueResponseSchema)))}var IR=k(e,d,c,b,a);async function qR(e,r){let t=l(r,rd);return unwrap(e.data.get("/traded",{params:w(t)}).andThen(f(TradedSchema)))}var AR=k(e,d,c,b,a);async function vR(e,r){let t=l(r,td);return unwrap(e.data.get("/v1/accounting/snapshot",{params:w(t)}).andThen(Jr))}var Go=32,$o=3n,_o=50,nd=(1n<<256n)-1n;function zr(e){let r=AbiParameters.encode([{name:"legs",type:"uint256[]"}],[e]),t=Hash.keccak256(AbiParameters.encode([{name:"moduleId",type:"uint256"},{name:"data",type:"bytes"}],[$o,r])),o=toComboConditionId(`0x03${t.slice(34)}0000000000000000000000000000`);return {conditionId:o,positionIds:[toPositionId(BigInt(`${o}00`).toString()),toPositionId(BigInt(`${o}01`).toString())]}}function Vo(e){if(e.length===0||e.length>_o)throw new a(`Combo legs must include 1 to ${_o} position IDs`);let r=e.map(t=>{let o=Yo(t),n=o.toString(16).padStart(Go*2,"0"),p=Number.parseInt(n.slice(0,2),16),a$1=Number.parseInt(n.slice(-2),16);if(p!==1&&p!==2||a$1>1)throw new a("Combo legs must be binary or neg-risk YES/NO position IDs");return {value:o,conditionId:n.slice(0,-2)}});r.sort((t,o)=>t.value<o.value?-1:t.value>o.value?1:0);for(let t=1;t<r.length;t+=1){let o=r[t-1],n=r[t];if(o===void 0||n===void 0)throw new a("Invalid combo leg set");if(o.value===n.value)throw new a("Combo legs must not contain duplicate position IDs");if(o.conditionId===n.conditionId)throw new a("Combo legs must not contain both outcomes for the same condition")}return r.map(t=>t.value)}function Ko(e){let t=Yo(e).toString(16).padStart(Go*2,"0"),o=BigInt(`0x${t.slice(0,2)}`),n=Number.parseInt(t.slice(-2),16);if(o!==$o)throw new a("Combo position ID must use the combinatorial module");if(n!==0&&n!==1)throw new a("Combo position ID must be a YES/NO position ID");return {conditionId:toComboConditionId(`0x${t.slice(0,-2)}`),outcomeIndex:n}}function Yo(e){let r=e.trim(),t;if(r.length===0)throw new a("Position ID must be a uint256 value");try{t=BigInt(r);}catch{throw new a("Position ID must be a uint256 value")}if(t<0n||t>nd)throw new a("Position ID must be a uint256 value");return t}var Qo=z$1.object({amount:z$1.bigint().min(0n),conditionId:CtfConditionIdSchema,metadata:j.optional()}),sd=z$1.object({amount:z$1.bigint().positive(),legs:z$1.array(PositionIdSchema).min(1).max(50),metadata:j.optional()}),Zo=z$1.array(PositionIdSchema).min(1).max(50).transform(Vo),id=z$1.object({amount:z$1.bigint().positive(),legs:Zo,metadata:j.optional()}),pd=z$1.union([Qo.extend({legs:z$1.never().optional()}),sd.extend({conditionId:z$1.never().optional()})]),Xo=k(e,d,c,b,a),JR=Xo,QR=Xo,en=k(e,d,c,b,a),ZR=en,XR=en,rn=k(e,d,c,b,a),eS=rn,rS=rn;async function tn(e,r){let t=l(r,Qo),o=await Wr(e,{conditionId:t.conditionId}),n=bt(o.adapterAddress,e.environment.collateralToken,o.conditionId,t.amount);return async function*(){return e.account.walletType===WalletType.EOA?z(yield Dr(D(e.environment.chainId,n))):yield*await G(e,{calls:[n],metadata:t.metadata??`Split ${t.amount} positions for market ${o.marketId} (condition ${o.conditionId})`})}.call(null)}async function on(e,r){let t=l(r,id),o=ur(e.environment.combinatorialModule,t.legs),n=zr(t.legs),p=At(e.environment.protocolV2Router,n.conditionId,t.amount);return async function*(){return e.account.walletType===WalletType.EOA?(await z(yield Dr(D(e.environment.chainId,o))).wait(),z(yield Dr(D(e.environment.chainId,p)))):yield*await G(e,{calls:[o,p],metadata:t.metadata??`Split ${t.amount} combo positions for condition ${n.conditionId}`})}.call(null)}async function cd(e,r){let t=l(r,pd);return t.legs!==void 0?on(e,t):tn(e,t)}var nn=k(h,e,d,j$1,f$1,g,c,b,a),tS=nn,oS=nn;function nS(e,r){return tn(e,r).then(U(e.signer))}function aS(e,r){return on(e,r).then(U(e.signer))}function sS(e,r){return cd(e,r).then(U(e.signer))}var an=z$1.object({amount:z$1.union([z$1.bigint().positive(),z$1.literal("max")]),conditionId:CtfConditionIdSchema,metadata:j.optional()}),dd=z$1.object({amount:z$1.union([z$1.bigint().positive(),z$1.literal("max")]),legs:z$1.array(PositionIdSchema).min(1).max(50),metadata:j.optional()}),ud=z$1.object({amount:z$1.union([z$1.bigint().positive(),z$1.literal("max")]),legs:Zo,metadata:j.optional()}),md=z$1.union([an.extend({legs:z$1.never().optional()}),dd.extend({conditionId:z$1.never().optional()})]);async function sn(e,r){let t=l(r,an),o=await Wr(e,{conditionId:t.conditionId}),n=cr(await e.rpc.ethCall(pr(o.positionErc1155Address,e.account.wallet,o.tokenIds))),p=fn(o.conditionId,n,t.amount),a=It(o.adapterAddress,e.environment.collateralToken,o.conditionId,p);return async function*(){return e.account.walletType===WalletType.EOA?z(yield jr(D(e.environment.chainId,a))):yield*await G(e,{calls:[a],metadata:t.metadata??`Merge ${p} positions for market ${o.marketId} (condition ${o.conditionId})`})}.call(null)}async function pn(e,r){let t=l(r,ud),o=ur(e.environment.combinatorialModule,t.legs),n=zr(t.legs),p=cr(await e.rpc.ethCall(pr(e.environment.positionManager,e.account.wallet,n.positionIds))),a=fn(n.conditionId,p,t.amount),y=vt(e.environment.protocolV2Router,n.conditionId,a);return async function*(){return e.account.walletType===WalletType.EOA?(await z(yield jr(D(e.environment.chainId,o))).wait(),z(yield jr(D(e.environment.chainId,y)))):yield*await G(e,{calls:[o,y],metadata:t.metadata??`Merge ${a} combo positions for condition ${n.conditionId}`})}.call(null)}async function ld(e,r){let t=l(r,md);return t.legs!==void 0?pn(e,t):sn(e,t)}var cn=k(h,e,d,j$1,f$1,g,c,b,a),iS=cn,pS=cn;function cS(e,r){return sn(e,r).then(U(e.signer))}function dS(e,r){return pn(e,r).then(U(e.signer))}function uS(e,r){return ld(e,r).then(U(e.signer))}var dn=z$1.object({conditionId:CtfConditionIdSchema,marketId:z$1.never().optional(),amount:z$1.never().optional(),positionId:z$1.never().optional(),metadata:j.optional()}),un=z$1.object({conditionId:z$1.never().optional(),marketId:MarketIdSchema,amount:z$1.never().optional(),positionId:z$1.never().optional(),metadata:j.optional()}),fd=z$1.union([dn,un]),mn=z$1.object({positionId:PositionIdSchema,conditionId:z$1.never().optional(),marketId:z$1.never().optional(),metadata:j.optional()}),yd=z$1.union([dn,un,mn]);async function Ed(e,r){let t=l(r,fd),o=await Wr(e,t.conditionId!==void 0?{conditionId:t.conditionId}:{marketId:t.marketId}),n=qt(o.adapterAddress,e.environment.collateralToken,o.conditionId);return async function*(){return e.account.walletType===WalletType.EOA?z(yield ln(D(e.environment.chainId,n))):yield*await G(e,{calls:[n],metadata:t.metadata??`Redeem positions for market ${o.marketId} (condition ${o.conditionId})`})}.call(null)}async function gd(e,r){let t=l(r,mn),o=Ko(t.positionId),n=kt(await e.rpc.ethCall(Ct(e.environment.positionManager,e.account.wallet,t.positionId)));if(n===0n)throw new a("Combo position has no balance to redeem");let p=Ot(e.environment.protocolV2Router,o.conditionId,o.outcomeIndex,n);return async function*(){return e.account.walletType===WalletType.EOA?z(yield ln(D(e.environment.chainId,p))):yield*await G(e,{calls:[p],metadata:t.metadata??`Redeem combo position ${t.positionId}`})}.call(null)}async function Rd(e,r){let t=l(r,yd);return t.positionId!==void 0?gd(e,t):Ed(e,t)}var mS=k(h,e,d,j$1,c,b,a);function lS(e,r){return Rd(e,r).then(U(e.signer))}function Dr(e){return {kind:"sendSplitPositionTransaction",request:e}}function jr(e){return {kind:"sendMergePositionsTransaction",request:e}}function ln(e){return {kind:"sendRedeemPositionsTransaction",request:e}}async function Wr(e,r){let t=r.conditionId!==void 0?`condition ${r.conditionId}`:`market ${r.marketId}`,o=await io(e,r.conditionId!==void 0?{conditionIds:[r.conditionId],pageSize:1}:{ids:[Sd(r.marketId)],pageSize:1}).firstPage(),[n]=o.items;if(n===void 0)throw new a(`No market found for ${t}`);let p=hd(n,t);return {...p,adapterAddress:p.negRisk?e.environment.negRiskCollateralAdapter:e.environment.collateralAdapter,positionErc1155Address:p.negRisk?e.environment.negRiskAdapter:e.environment.conditionalTokens}}function Sd(e){let r=Number(e);if(!Number.isInteger(r))throw new a(`Market ID must be an integer, received ${e}`);return r}function hd(e,r){if(!isPresent(e.conditionId))throw new b(`Missing condition ID for ${r}`);if(!isPresent(e.state.negRisk))throw new b(`Missing negative-risk flag for ${r}`);let t=e.outcomes.yes.tokenId,o=e.outcomes.no.tokenId;if(!isPresent(t)||!isPresent(o))throw new b(`Missing market token IDs for ${r}`);return {marketId:e.id,conditionId:e.conditionId,negRisk:e.state.negRisk,tokenIds:[t,o]}}function fn(e,r,t){let o=xd(r);if(o===0n)throw new a(`You have no complementary positions to merge for condition ${e}`);if(t==="max")return o;if(t>o)throw new a(`Requested merge amount ${t} exceeds the maximum mergeable amount ${o} for condition ${e}`);return t}function xd(e){if(e.length!==2)throw new b("Expected two position balances");let[r,t]=e;return invariant(r!==void 0,"Expected YES position balance"),invariant(t!==void 0,"Expected NO position balance"),r<t?r:t}var bd=z$1.object({address:z$1.string()}),TS=k(e,d,c,b,a);async function PS(e,r){let t=l(r,bd);return unwrap(e.gamma.get("/public-profile",{params:R(t,S())}).andThen(f(PublicProfileSchema)).orElse(o=>o instanceof d&&o.status===404?ok(null):err(o)))}var _r=class extends PolymarketError{name="RfqQuoteRejectedError";code;rfqId;constructor(r,t){super(r,t),this.code=t.code,this.rfqId=t.rfqId;}},IS=k(_r,j$1,f$1,c,a),Nr=class extends PolymarketError{name="RfqCancelQuoteRejectedError";code;rfqId;quoteId;constructor(r,t){super(r,t),this.code=t.code,this.rfqId=t.rfqId,this.quoteId=t.quoteId;}},qS=k(Nr,f$1,c),Gr=class extends PolymarketError{name="RfqConfirmationRejectedError";code;rfqId;quoteId;constructor(r,t){super(r,t),this.code=t.code,this.rfqId=t.rfqId,this.quoteId=t.quoteId;}},AS=k(Gr,f$1,c),vS=k(c);async function OS(e){return e.webSockets.rfqQuoter.connect()}var Ad=z$1.object({q:z$1.string().trim().min(1),ascending:z$1.boolean().optional(),cache:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),eventsStatus:z$1.string().min(1).optional(),eventsTag:z$1.array(z$1.string()).optional(),excludeTagIds:z$1.array(z$1.number().int()).optional(),keepClosedMarkets:z$1.number().int().optional(),optimized:z$1.boolean().optional(),pageSize:I.default(10),presets:z$1.array(z$1.string()).optional(),recurrence:z$1.enum(["daily","weekly","monthly"]).optional(),searchProfiles:z$1.boolean().optional(),searchTags:z$1.boolean().optional(),sort:z$1.string().min(1).optional()}),KS=k(e,d,c,b,a);function YS(e,r){let{cursor:t,pageSize:o,...n}=l(r,Ad);return C(p=>{let a=O(p,o);return e.gamma.get("/public-search",{params:R({...n,limitPerType:a.pageSize,page:a.offset},S({excludeTagIds:"exclude_tag_id"}))}).andThen(f(PublicSearchResponseSchema)).map(y=>({items:vd(y),hasMore:y.pagination?.hasMore??false,totalCount:y.pagination?.totalResults??void 0,nextCursor:y.pagination?.hasMore?v({offset:a.offset+1,pageSize:a.pageSize}):void 0}))},t??v({offset:1,pageSize:o}),{events:[],profiles:[],tags:[]})}function vd(e){return {events:e.events??[],profiles:e.profiles??[],tags:e.tags??[]}}var Bd=z$1.object({ascending:z$1.boolean().optional(),closed:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),excludeEvents:z$1.boolean().optional(),locale:z$1.string().optional(),order:z$1.string().optional(),pageSize:I.default(20),recurrence:z$1.enum(["daily","weekly","monthly"]).optional(),slug:z$1.array(z$1.string()).optional()}),Ud=z$1.object({id:z$1.string(),locale:z$1.string().optional()}),sh=k(e,d,c,b,a);function ih(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,Bd);return C(p=>{let a=O(p,o);return e.gamma.get("/series",{params:R({...n,limit:a.pageSize+1,offset:a.offset},S())}).andThen(f(ListSeriesResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var ph=k(e,d,c,b,a);async function ch(e,r){let t=l(r,Ud);return unwrap(e.gamma.get(`series/${t.id}`,{params:R({locale:t.locale},S())}).andThen(f(SeriesSchema)))}var yh=k(e,d,c,b);async function Eh(e){return unwrap(e.gamma.get("/sports").andThen(f(ListSportsMetadataResponseSchema)))}var gh=k(e,d,c,b);async function Rh(e){return unwrap(e.gamma.get("/sports/market-types").andThen(f(SportsMarketTypesResponseSchema)))}async function Th(e,r){let t=await Promise.all(r.map(o=>Hd(e,o)));return Wd(t)}function Hd(e,r){switch(r.topic){case "market":return e.webSockets.clobMarket.subscribe(r);case "sports":return e.webSockets.sports.subscribe(r);case "comments":case "prices.crypto.binance":case "prices.crypto.chainlink":case "prices.equity.pyth":return e.webSockets.rtds.subscribe(r);case "user":return invariant(e.isSecureClient(),"A 'user' subscription requires a secure client instance."),e.webSockets.clobUser.subscribe(r)}}function Wd(e){let r;async function t(){r===void 0&&(r=Promise.all(e.map(n=>n.close())).then(()=>{})),await r;}let o=jd(...e);return {close:t,[Symbol.asyncIterator](){return o[Symbol.asyncIterator]()}}}var Gd=z$1.object({ascending:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),includeTemplate:z$1.boolean().optional(),isCarousel:z$1.boolean().optional(),locale:z$1.string().optional(),order:z$1.string().optional(),pageSize:I.default(20)}),$d=z$1.union([z$1.object({id:z$1.string(),includeTemplate:z$1.boolean().optional(),locale:z$1.string().optional()}),z$1.object({slug:z$1.string(),locale:z$1.string().optional()})]),Vd=z$1.object({id:z$1.string(),omitEmpty:z$1.boolean().optional(),status:z$1.enum(["active","closed","all"]).optional()}),Kd=z$1.object({slug:z$1.string()}),Yd=z$1.object({id:z$1.string(),locale:z$1.string().optional(),omitEmpty:z$1.boolean().optional(),status:z$1.enum(["active","closed","all"]).optional()}),Jd=z$1.object({locale:z$1.string().optional(),slug:z$1.string(),omitEmpty:z$1.boolean().optional(),status:z$1.enum(["active","closed","all"]).optional()}),wh=k(e,d,c,b,a);function Mh(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,Gd);return C(p=>{let a=O(p,o);return e.gamma.get("/tags",{params:R({...n,limit:a.pageSize+1,offset:a.offset},S())}).andThen(f(ListTagsResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var Bh=k(e,d,c,b,a);async function Uh(e,r){let t=l(r,$d);return "id"in t?unwrap(e.gamma.get(`tags/${t.id}`,{params:R({includeTemplate:t.includeTemplate,locale:t.locale},S())}).andThen(f(TagSchema))):unwrap(e.gamma.get(`tags/slug/${t.slug}`,{params:R({locale:t.locale},S())}).andThen(f(TagSchema)))}var Fh=k(e,d,c,b,a);async function zh(e,r){if("id"in r){let o=l(r,Vd);return unwrap(e.gamma.get(`tags/${o.id}/related-tags`,{params:R({omitEmpty:o.omitEmpty,status:o.status},S())}).andThen(f(ListRelatedTagsResponseSchema)))}let t=l(r,Kd);return unwrap(e.gamma.get(`tags/slug/${t.slug}/related-tags`).andThen(f(ListRelatedTagsResponseSchema)))}var Dh=k(e,d,c,b,a);async function jh(e,r){if("id"in r){let o=l(r,Yd);return unwrap(e.gamma.get(`tags/${o.id}/related-tags/tags`,{params:R({locale:o.locale,omitEmpty:o.omitEmpty,status:o.status},S())}).andThen(f(ListRelatedTagResourcesResponseSchema)))}let t=l(r,Jd);return unwrap(e.gamma.get(`tags/slug/${t.slug}/related-tags/tags`,{params:R({locale:t.locale,omitEmpty:t.omitEmpty,status:t.status},S())}).andThen(f(ListRelatedTagResourcesResponseSchema)))}var Xd=z$1.object({abbreviation:z$1.array(z$1.string()).optional(),ascending:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),league:z$1.array(z$1.string()).optional(),name:z$1.array(z$1.string()).optional(),order:z$1.string().optional(),pageSize:I.default(20),providerId:z$1.array(z$1.number().int()).optional()}),Jh=k(e,d,c,b,a);function Qh(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,Xd);return C(p=>{let a=O(p,o);return e.gamma.get("/teams",{params:R({...n,limit:a.pageSize+1,offset:a.offset},S({providerId:"provider_id"}))}).andThen(f(ListTeamsResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var ru=z$1.object({amount:z$1.bigint(),metadata:j.optional(),recipientAddress:EvmAddressSchema,tokenAddress:EvmAddressSchema}),px=k(a);async function tu(e,r){let t=l(r,ru);return async function*(){return e.account.walletType===WalletType.EOA?z(yield ou(D(e.environment.chainId,dr(t.tokenAddress,t.recipientAddress,t.amount)))):yield*await G(e,{calls:[dr(t.tokenAddress,t.recipientAddress,t.amount)],metadata:t.metadata??`Transfer ${t.amount} of ${t.tokenAddress} to ${t.recipientAddress}`})}.call(null)}var cx=k(h,e,d,j$1,c,b,a);function dx(e,r){return tu(e,r).then(U(e.signer))}function ou(e){return {kind:"sendErc20TransferTransaction",request:e}}export{tl as $,Hs as $a,Iy as $b,pR as $c,vS as $d,Lm as A,Yu as Aa,vf as Ab,AE as Ac,tS as Ad,Jh as Ae,ur as B,Ju as Ba,Of as Bb,vE as Bc,oS as Bd,Qh as Be,Lt as C,Qu as Ca,Lf as Cb,zE as Cc,nS as Cd,px as Ce,wt as D,Zu as Da,wf as Db,DE as Dc,aS as Dd,tu as De,Ll as E,Xu as Ea,Mf as Eb,xr as Ec,sS as Ed,cx as Ee,Ks as F,em as Fa,Bf as Fb,KE as Fc,sn as Fd,dx as Fe,wl as G,rm as Ga,Uf as Gb,YE as Gc,pn as Gd,Ys as H,tm as Ha,Ff as Hb,rr as Hc,ld as Hd,Ml as I,om as Ia,zf as Ib,JE as Ic,cn as Id,Bl as J,nm as Ja,Df as Jb,qo as Jc,iS as Jd,Ul as K,am as Ka,jf as Kb,Ao as Kc,pS as Kd,Fl as L,sm as La,Hf as Lb,Lr as Lc,cS as Ld,zl as M,Em as Ma,Wf as Mb,Lc as Mc,dS as Md,Dl as N,gm as Na,_f as Nb,wr as Nc,uS as Nd,jl as O,Rm as Oa,ey as Ob,wc as Oc,Ed as Od,Hl as P,Sm as Pa,ry as Pb,Mr as Pc,gd as Pd,Wl as Q,Um as Qa,ty as Qb,Ug as Qc,Rd as Qd,_l as R,z as Ra,oy as Rb,Fg as Rc,mS as Rd,Nl as S,Sl as Sa,ny as Sb,zg as Sc,lS as Sd,Gl as T,zs as Ta,ay as Tb,Dg as Tc,TS as Td,l as U,hl as Ua,hy as Ub,oR as Uc,PS as Ud,Zr as V,Dt as Va,xy as Vb,Uc as Vc,_r as Vd,Tu as W,xl as Wa,Ty as Wb,nR as Wc,IS as Wd,nt as X,js as Xa,Py as Xb,aR as Xc,Nr as Xd,it as Y,Tl as Ya,Cy as Yb,sR as Yc,qS as Yd,Hm as Z,jt as Za,ky as Zb,Fc as Zc,Gr as Zd,Mt as _,Pl as _a,by as _b,iR as _c,AS as _d,$ as a,Er as aa,Cl as ab,zy as ac,SR as ad,OS as ae,Cm as b,ol as ba,kl as bb,Dy as bc,hR as bd,We as c,nl as ca,rf as cb,jy as cc,xR as cd,ht as d,j as da,tf as db,Hy as dc,TR as dd,xt as e,al as ea,ff as eb,Wy as ec,PR as ed,_e as f,sl as fa,yf as fb,_y as fc,CR as fd,Tt as g,Ts as ga,Ef as gb,oE as gc,kR as gd,Pt as h,il as ha,gf as hb,io as hc,bR as hd,KS as he,Ct as i,G as ia,Rf as ib,nE as ic,IR as id,YS as ie,kt as j,pl as ja,he as jb,aE as jc,qR as jd,sh as je,pr as k,Bu as ka,Sf as kb,sE as kc,AR as kd,ih as ke,cr as l,Uu as la,xe as lb,iE as lc,vR as ld,ph as le,km as m,Fu as ma,hf as mb,pE as mc,ch as me,dr as n,zu as na,Qt as nb,cE as nc,Xo as nd,yh as ne,bm as o,Du as oa,xf as ob,dE as oc,JR as od,Eh as oe,Im as p,ju as pa,Zt as pb,uE as pc,QR as pd,gh as pe,bt as q,Hu as qa,Tf as qb,mE as qc,en as qd,Rh as qe,qm as r,Wu as ra,Xt as rb,lE as rc,ZR as rd,Th as re,It as s,_u as sa,Pf as sb,fE as sc,XR as sd,wh as se,qt as t,Nu as ta,Cf as tb,yE as tc,rn as td,Mh as te,Am as u,Gu as ua,kf as ub,PE as uc,eS as ud,Bh as ue,At as v,$u as va,bf as vb,CE as vc,rS as vd,Uh as ve,vm as w,Vu as wa,If as wb,kE as wc,tn as wd,Fh as we,vt as x,sr as xa,eo as xb,bE as xc,on as xd,zh as xe,Om as y,Ku as ya,qf as yb,IE as yc,cd as yd,Dh as ye,Ot as z,dt as za,Af as zb,qE as zc,nn as zd,jh as ze};//# sourceMappingURL=chunk-UBQO5URS.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-UBQO5URS.js.map
|