@polymarket/client 0.1.0-beta.3 → 0.1.0-beta.4
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-76B5WBIO.js +2 -0
- package/dist/chunk-76B5WBIO.js.map +1 -0
- package/dist/ethers-v5.d.ts +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{sports-BIOQ9MxA.d.ts → sports-shrXkDsG.d.ts} +1 -1
- package/dist/{types-CYRIvfiu.d.ts → types-BHjtOekI.d.ts} +10 -10
- package/dist/viem.d.ts +1 -1
- package/package.json +2 -2
- package/dist/chunk-RX3J5EHP.js +0 -2
- package/dist/chunk-RX3J5EHP.js.map +0 -1
package/dist/actions/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { aJ as RateLimitError, aL as RequestRejectedError, bt as TransportError, bw as UnexpectedResponseError, bm as SigningError, B as BaseClient, h as BaseSecureClient } from '../types-
|
|
2
|
-
export { e as ApproveErc1155ForAllError, f as ApproveErc20Error, C as CancelAllError, j as CancelMarketOrdersError, bN as CancelMarketOrdersRequest, k as CancelOrderError, bO as CancelOrderRequest, l as CancelOrdersError, bP as CancelOrdersRequest, bQ as CommentsEventType, bR as CommentsSubscription, bS as CryptoPricesEventType, bT as CryptoPricesSubscription, bU as DeployDepositWalletError, bV as DeprecatedTransactionHandle, s as DownloadAccountingSnapshotError, bW as DownloadAccountingSnapshotRequest, t as DropNotificationsError, bX as DropNotificationsRequest, bY as EquityPricesEventType, bZ as EquityPricesSubscription, b_ as Erc1155ApprovalForAllWorkflow, b$ as Erc1155ApprovalForAllWorkflowRequest, c0 as Erc20ApprovalWorkflow, c1 as Erc20ApprovalWorkflowRequest, c2 as Erc20TransferWorkflow, c3 as Erc20TransferWorkflowRequest, c4 as EstimateMarketBuyPriceRequest, u as EstimateMarketPriceError, c5 as EstimateMarketPriceRequest, c6 as EstimateMarketSellPriceRequest, c7 as EventForSubscriptionSpec, c8 as EventForSubscriptionSpecs, c9 as FetchBalanceAllowanceError, ca as FetchBalanceAllowanceRequest, cb as FetchBuilderFeeRatesError, cc as FetchBuilderFeeRatesRequest, F as FetchClosedOnlyModeError, v as FetchCommentsByIdError, cd as FetchCommentsByIdRequest, w as FetchEventError, x as FetchEventLiveVolumeError, ce as FetchEventLiveVolumeRequest, cf as FetchEventRequest, y as FetchEventTagsError, cg as FetchEventTagsRequest, ch as FetchExecuteParamsError, ci as FetchExecuteParamsRequest, cj as FetchGaslessTransactionRequest, z as FetchLastTradePriceError, ck as FetchLastTradePriceRequest, G as FetchLastTradePricesError, cl as FetchLastTradePricesRequest, H as FetchMarketError, cm as FetchMarketInfoError, cn as FetchMarketInfoRequest, co as FetchMarketRequest, I as FetchMarketTagsError, cp as FetchMarketTagsRequest, J as FetchMidpointError, cq as FetchMidpointRequest, K as FetchMidpointsError, cr as FetchMidpointsRequest, cs as FetchNegRiskError, ct as FetchNegRiskRequest, L as FetchNotificationsError, M as FetchOrderBookError, cu as FetchOrderBookRequest, N as FetchOrderBooksError, cv as FetchOrderBooksRequest, O as FetchOrderError, cw as FetchOrderRequest, P as FetchOrderScoringError, cx as FetchOrderScoringRequest, Q as FetchOrdersScoringError, cy as FetchOrdersScoringRequest, R as FetchPortfolioValueError, cz as FetchPortfolioValueRequest, V as FetchPriceError, W as FetchPriceHistoryError, cA as FetchPriceHistoryRequest, cB as FetchPriceRequest, X as FetchPricesError, cC as FetchPricesRequest, Y as FetchPublicProfileError, cD as FetchPublicProfileRequest, Z as FetchRelatedTagResourcesError, cE as FetchRelatedTagResourcesRequest, _ as FetchRelatedTagsError, cF as FetchRelatedTagsRequest, $ as FetchRewardPercentagesError, a0 as FetchSeriesError, cG as FetchSeriesRequest, a1 as FetchSpreadError, cH as FetchSpreadRequest, a2 as FetchSpreadsError, cI as FetchSpreadsRequest, a3 as FetchTagError, cJ as FetchTagRequest, cK as FetchTickSizeError, cL as FetchTickSizeRequest, a4 as FetchTotalEarningsForUserForDayError, cM as FetchTotalEarningsForUserForDayRequest, a5 as FetchTradedMarketCountError, cN as FetchTradedMarketCountRequest, cO as GaslessTransactionMetadataSchema, cP as GaslessWorkflow, cQ as GaslessWorkflowRequest, cR as IsWalletDeployedError, cS as IsWalletDeployedRequest, a7 as ListAccountTradesError, cT as ListAccountTradesRequest, a8 as ListActivityError, cU as ListActivityRequest, a9 as ListBuilderLeaderboardError, cV as ListBuilderLeaderboardRequest, aa as ListBuilderTradesError, cW as ListBuilderTradesRequest, ab as ListBuilderVolumeError, cX as ListBuilderVolumeRequest, ac as ListClosedPositionsError, cY as ListClosedPositionsRequest, ad as ListComboPositionsError, cZ as ListComboPositionsRequest, ae as ListCommentsByUserAddressError, c_ as ListCommentsByUserAddressRequest, af as ListCommentsError, c$ as ListCommentsRequest, ag as ListCurrentRewardsError, d0 as ListCurrentRewardsRequest, ah as ListEventsError, d1 as ListEventsRequest, ai as ListMarketHoldersError, d2 as ListMarketHoldersRequest, aj as ListMarketPositionsError, d3 as ListMarketPositionsRequest, ak as ListMarketRewardsError, d4 as ListMarketRewardsRequest, al as ListMarketsError, d5 as ListMarketsRequest, am as ListOpenInterestError, d6 as ListOpenInterestRequest, an as ListOpenOrdersError, d7 as ListOpenOrdersRequest, ao as ListPositionsError, d8 as ListPositionsRequest, ap as ListSeriesError, d9 as ListSeriesRequest, aq as ListTagsError, da as ListTagsRequest, ar as ListTeamsError, db as ListTeamsRequest, as as ListTraderLeaderboardError, dc as ListTraderLeaderboardRequest, at as ListTradesError, dd as ListTradesRequest, au as ListUserEarningsAndMarketsConfigError, de as ListUserEarningsAndMarketsConfigRequest, av as ListUserEarningsForDayError, df as ListUserEarningsForDayRequest, dg as MarketEventType, dh as MarketSubscription, di as MergeComboPositionError, dj as MergeMarketPositionError, aw as MergePositionsError, dk as MergePositionsWorkflow, dl as MergePositionsWorkflowRequest, ax as OpenRfqSessionError, dm as OrderDraft, dn as OrderPostingWorkflow, dp as OrderWorkflow, dq as OrderWorkflowRequest, aB as PostOrderError, aC as PostOrdersError, dr as PostOrdersRequest, ds as PrepareErc1155ApprovalForAllError, dt as PrepareErc1155ApprovalForAllRequest, du as PrepareErc20ApprovalError, dv as PrepareErc20ApprovalRequest, dw as PrepareErc20TransferError, dx as PrepareErc20TransferRequest, dy as PrepareGaslessTransactionError, dz as PrepareGaslessTransactionRequest, dA as PrepareLimitOrderRequest, dB as PrepareMarketBuyOrderRequest, dC as PrepareMarketOrderRequest, dD as PrepareMarketSellOrderRequest, dE as PrepareMergeComboPositionError, dF as PrepareMergeComboPositionRequest, dG as PrepareMergeMarketPositionError, dH as PrepareMergeMarketPositionRequest, dI as PrepareMergePositionsError, dJ as PrepareMergePositionsRequest, dK as PrepareRedeemComboPositionError, dL as PrepareRedeemComboPositionRequest, dM as PrepareRedeemMarketPositionsByConditionIdRequest, dN as PrepareRedeemMarketPositionsByMarketIdRequest, dO as PrepareRedeemMarketPositionsError, dP as PrepareRedeemMarketPositionsRequest, dQ as PrepareRedeemPositionsError, dR as PrepareRedeemPositionsRequest, dS as PrepareSplitComboPositionError, dT as PrepareSplitComboPositionRequest, dU as PrepareSplitMarketPositionError, dV as PrepareSplitMarketPositionRequest, dW as PrepareSplitPositionError, dX as PrepareSplitPositionRequest, dY as PrepareTradingApprovalsError, dZ as PublicRealtimeEvent, d_ as PublicRealtimeTopic, d$ as PublicSubscriptionSpec, aK as RedeemPositionsError, e0 as RedeemPositionsWorkflow, e1 as RedeemPositionsWorkflowRequest, e2 as ResolveConditionByTokenError, e3 as ResolveConditionByTokenRequest, aN as RfqCancelQuoteAck, aO as RfqCancelQuoteError, aP as RfqCancelQuoteRejectedError, aQ as RfqCancelQuoteRejectedErrorOptions, aR as RfqConfirmationAck, aS as RfqConfirmationError, aT as RfqConfirmationRejectedError, e4 as RfqConfirmationRejectedErrorOptions, aU as RfqConfirmationRequestEvent, aV as RfqEvent, e5 as RfqExecutionUpdateEvent, aW as RfqQuoteError, aX as RfqQuoteReference, aY as RfqQuoteRejectedError, aZ as RfqQuoteRejectedErrorOptions, a_ as RfqQuoteRequestEvent, a$ as RfqQuoteResponse, b0 as RfqQuoteSource, b1 as RfqSession, b2 as SearchError, e6 as SearchRequest, e7 as SearchResults, e8 as SecureRealtimeEvent, e9 as SecureRealtimeTopic, ea as SecureSubscriptionSpec, bk as SetupTradingApprovalsError, eb as SignedOrder, ec as SplitComboPositionError, ed as SplitMarketPositionError, bn as SplitPositionError, ee as SplitPositionWorkflow, ef as SplitPositionWorkflowRequest, eg as SportsEventType, eh as SportsSubscription, ei as SubscribeError, ej as SubscriptionHandle, ek as TradingApprovalsWorkflow, el as TradingApprovalsWorkflowRequest, bs as TransferErc20Error, em as UpdateBalanceAllowanceError, en as UpdateBalanceAllowanceRequest, eo as UserEventType, ep as UserSubscription, eq as WaitForGaslessTransactionError, er as approveErc1155ForAll, es as approveErc20, et as cancelAll, eu as cancelMarketOrders, ev as cancelOrder, ew as cancelOrders, ex as deployDepositWallet, ey as downloadAccountingSnapshot, ez as dropNotifications, eA as estimateMarketPrice, eB as fetchBalanceAllowance, eC as fetchBuilderFeeRates, eD as fetchBuilderVolume, eE as fetchClosedOnlyMode, eF as fetchCommentsById, eG as fetchEvent, eH as fetchEventLiveVolume, eI as fetchEventTags, eJ as fetchExecuteParams, eK as fetchLastTradePrice, eL as fetchLastTradePrices, eM as fetchMarket, eN as fetchMarketInfo, eO as fetchMarketTags, eP as fetchMidpoint, eQ as fetchMidpoints, eR as fetchNegRisk, eS as fetchNotifications, eT as fetchOrder, eU as fetchOrderBook, eV as fetchOrderBooks, eW as fetchOrderScoring, eX as fetchOrdersScoring, eY as fetchPortfolioValue, eZ as fetchPrice, e_ as fetchPriceHistory, e$ as fetchPrices, f0 as fetchPublicProfile, f1 as fetchRelatedTagResources, f2 as fetchRelatedTags, f3 as fetchRewardPercentages, f4 as fetchSeries, f5 as fetchSpread, f6 as fetchSpreads, f7 as fetchTag, f8 as fetchTickSize, f9 as fetchTotalEarningsForUserForDay, fa as fetchTradedMarketCount, fb as fetchTransaction, fc as isWalletDeployed, fd as listAccountTrades, fe as listActivity, ff as listBuilderLeaderboard, fg as listBuilderTrades, fh as listClosedPositions, fi as listComboPositions, fj as listComments, fk as listCommentsByUserAddress, fl as listCurrentRewards, fm as listEvents, fn as listMarketHolders, fo as listMarketPositions, fp as listMarketRewards, fq as listMarkets, fr as listOpenInterest, fs as listOpenOrders, ft as listPositions, fu as listSeries, fv as listTags, fw as listTeams, fx as listTraderLeaderboard, fy as listTrades, fz as listUserEarningsAndMarketsConfig, fA as listUserEarningsForDay, fB as mergeComboPosition, fC as mergeMarketPosition, fD as mergePositions, fE as openRfqSession, fF as postOrder, fG as postOrders, fH as prepareErc1155ApprovalForAll, fI as prepareErc20Approval, fJ as prepareErc20Transfer, fK as prepareGaslessTransaction, fL as prepareMergeComboPosition, fM as prepareMergeMarketPosition, fN as prepareMergePositions, fO as prepareRedeemComboPosition, fP as prepareRedeemMarketPositions, fQ as prepareRedeemPositions, fR as prepareSplitComboPosition, fS as prepareSplitMarketPosition, fT as prepareSplitPosition, fU as prepareTradingApprovals, fV as redeemPositions, fW as resolveConditionByToken, fX as search, fY as setupTradingApprovals, fZ as splitComboPosition, f_ as splitMarketPosition, f$ as splitPosition, g0 as subscribe, g1 as transferErc20, g2 as updateBalanceAllowance } from '../types-CYRIvfiu.js';
|
|
1
|
+
import { aJ as RateLimitError, aL as RequestRejectedError, bt as TransportError, bw as UnexpectedResponseError, bm as SigningError, B as BaseClient, h as BaseSecureClient } from '../types-BHjtOekI.js';
|
|
2
|
+
export { e as ApproveErc1155ForAllError, f as ApproveErc20Error, C as CancelAllError, j as CancelMarketOrdersError, bN as CancelMarketOrdersRequest, k as CancelOrderError, bO as CancelOrderRequest, l as CancelOrdersError, bP as CancelOrdersRequest, bQ as CommentsEventType, bR as CommentsSubscription, bS as CryptoPricesEventType, bT as CryptoPricesSubscription, bU as DeployDepositWalletError, bV as DeprecatedTransactionHandle, s as DownloadAccountingSnapshotError, bW as DownloadAccountingSnapshotRequest, t as DropNotificationsError, bX as DropNotificationsRequest, bY as EquityPricesEventType, bZ as EquityPricesSubscription, b_ as Erc1155ApprovalForAllWorkflow, b$ as Erc1155ApprovalForAllWorkflowRequest, c0 as Erc20ApprovalWorkflow, c1 as Erc20ApprovalWorkflowRequest, c2 as Erc20TransferWorkflow, c3 as Erc20TransferWorkflowRequest, c4 as EstimateMarketBuyPriceRequest, u as EstimateMarketPriceError, c5 as EstimateMarketPriceRequest, c6 as EstimateMarketSellPriceRequest, c7 as EventForSubscriptionSpec, c8 as EventForSubscriptionSpecs, c9 as FetchBalanceAllowanceError, ca as FetchBalanceAllowanceRequest, cb as FetchBuilderFeeRatesError, cc as FetchBuilderFeeRatesRequest, F as FetchClosedOnlyModeError, v as FetchCommentsByIdError, cd as FetchCommentsByIdRequest, w as FetchEventError, x as FetchEventLiveVolumeError, ce as FetchEventLiveVolumeRequest, cf as FetchEventRequest, y as FetchEventTagsError, cg as FetchEventTagsRequest, ch as FetchExecuteParamsError, ci as FetchExecuteParamsRequest, cj as FetchGaslessTransactionRequest, z as FetchLastTradePriceError, ck as FetchLastTradePriceRequest, G as FetchLastTradePricesError, cl as FetchLastTradePricesRequest, H as FetchMarketError, cm as FetchMarketInfoError, cn as FetchMarketInfoRequest, co as FetchMarketRequest, I as FetchMarketTagsError, cp as FetchMarketTagsRequest, J as FetchMidpointError, cq as FetchMidpointRequest, K as FetchMidpointsError, cr as FetchMidpointsRequest, cs as FetchNegRiskError, ct as FetchNegRiskRequest, L as FetchNotificationsError, M as FetchOrderBookError, cu as FetchOrderBookRequest, N as FetchOrderBooksError, cv as FetchOrderBooksRequest, O as FetchOrderError, cw as FetchOrderRequest, P as FetchOrderScoringError, cx as FetchOrderScoringRequest, Q as FetchOrdersScoringError, cy as FetchOrdersScoringRequest, R as FetchPortfolioValueError, cz as FetchPortfolioValueRequest, V as FetchPriceError, W as FetchPriceHistoryError, cA as FetchPriceHistoryRequest, cB as FetchPriceRequest, X as FetchPricesError, cC as FetchPricesRequest, Y as FetchPublicProfileError, cD as FetchPublicProfileRequest, Z as FetchRelatedTagResourcesError, cE as FetchRelatedTagResourcesRequest, _ as FetchRelatedTagsError, cF as FetchRelatedTagsRequest, $ as FetchRewardPercentagesError, a0 as FetchSeriesError, cG as FetchSeriesRequest, a1 as FetchSpreadError, cH as FetchSpreadRequest, a2 as FetchSpreadsError, cI as FetchSpreadsRequest, a3 as FetchTagError, cJ as FetchTagRequest, cK as FetchTickSizeError, cL as FetchTickSizeRequest, a4 as FetchTotalEarningsForUserForDayError, cM as FetchTotalEarningsForUserForDayRequest, a5 as FetchTradedMarketCountError, cN as FetchTradedMarketCountRequest, cO as GaslessTransactionMetadataSchema, cP as GaslessWorkflow, cQ as GaslessWorkflowRequest, cR as IsWalletDeployedError, cS as IsWalletDeployedRequest, a7 as ListAccountTradesError, cT as ListAccountTradesRequest, a8 as ListActivityError, cU as ListActivityRequest, a9 as ListBuilderLeaderboardError, cV as ListBuilderLeaderboardRequest, aa as ListBuilderTradesError, cW as ListBuilderTradesRequest, ab as ListBuilderVolumeError, cX as ListBuilderVolumeRequest, ac as ListClosedPositionsError, cY as ListClosedPositionsRequest, ad as ListComboPositionsError, cZ as ListComboPositionsRequest, ae as ListCommentsByUserAddressError, c_ as ListCommentsByUserAddressRequest, af as ListCommentsError, c$ as ListCommentsRequest, ag as ListCurrentRewardsError, d0 as ListCurrentRewardsRequest, ah as ListEventsError, d1 as ListEventsRequest, ai as ListMarketHoldersError, d2 as ListMarketHoldersRequest, aj as ListMarketPositionsError, d3 as ListMarketPositionsRequest, ak as ListMarketRewardsError, d4 as ListMarketRewardsRequest, al as ListMarketsError, d5 as ListMarketsRequest, am as ListOpenInterestError, d6 as ListOpenInterestRequest, an as ListOpenOrdersError, d7 as ListOpenOrdersRequest, ao as ListPositionsError, d8 as ListPositionsRequest, ap as ListSeriesError, d9 as ListSeriesRequest, aq as ListTagsError, da as ListTagsRequest, ar as ListTeamsError, db as ListTeamsRequest, as as ListTraderLeaderboardError, dc as ListTraderLeaderboardRequest, at as ListTradesError, dd as ListTradesRequest, au as ListUserEarningsAndMarketsConfigError, de as ListUserEarningsAndMarketsConfigRequest, av as ListUserEarningsForDayError, df as ListUserEarningsForDayRequest, dg as MarketEventType, dh as MarketSubscription, di as MergeComboPositionError, dj as MergeMarketPositionError, aw as MergePositionsError, dk as MergePositionsWorkflow, dl as MergePositionsWorkflowRequest, ax as OpenRfqSessionError, dm as OrderDraft, dn as OrderPostingWorkflow, dp as OrderWorkflow, dq as OrderWorkflowRequest, aB as PostOrderError, aC as PostOrdersError, dr as PostOrdersRequest, ds as PrepareErc1155ApprovalForAllError, dt as PrepareErc1155ApprovalForAllRequest, du as PrepareErc20ApprovalError, dv as PrepareErc20ApprovalRequest, dw as PrepareErc20TransferError, dx as PrepareErc20TransferRequest, dy as PrepareGaslessTransactionError, dz as PrepareGaslessTransactionRequest, dA as PrepareLimitOrderRequest, dB as PrepareMarketBuyOrderRequest, dC as PrepareMarketOrderRequest, dD as PrepareMarketSellOrderRequest, dE as PrepareMergeComboPositionError, dF as PrepareMergeComboPositionRequest, dG as PrepareMergeMarketPositionError, dH as PrepareMergeMarketPositionRequest, dI as PrepareMergePositionsError, dJ as PrepareMergePositionsRequest, dK as PrepareRedeemComboPositionError, dL as PrepareRedeemComboPositionRequest, dM as PrepareRedeemMarketPositionsByConditionIdRequest, dN as PrepareRedeemMarketPositionsByMarketIdRequest, dO as PrepareRedeemMarketPositionsError, dP as PrepareRedeemMarketPositionsRequest, dQ as PrepareRedeemPositionsError, dR as PrepareRedeemPositionsRequest, dS as PrepareSplitComboPositionError, dT as PrepareSplitComboPositionRequest, dU as PrepareSplitMarketPositionError, dV as PrepareSplitMarketPositionRequest, dW as PrepareSplitPositionError, dX as PrepareSplitPositionRequest, dY as PrepareTradingApprovalsError, dZ as PublicRealtimeEvent, d_ as PublicRealtimeTopic, d$ as PublicSubscriptionSpec, aK as RedeemPositionsError, e0 as RedeemPositionsWorkflow, e1 as RedeemPositionsWorkflowRequest, e2 as ResolveConditionByTokenError, e3 as ResolveConditionByTokenRequest, aN as RfqCancelQuoteAck, aO as RfqCancelQuoteError, aP as RfqCancelQuoteRejectedError, aQ as RfqCancelQuoteRejectedErrorOptions, aR as RfqConfirmationAck, aS as RfqConfirmationError, aT as RfqConfirmationRejectedError, e4 as RfqConfirmationRejectedErrorOptions, aU as RfqConfirmationRequestEvent, aV as RfqEvent, e5 as RfqExecutionUpdateEvent, aW as RfqQuoteError, aX as RfqQuoteReference, aY as RfqQuoteRejectedError, aZ as RfqQuoteRejectedErrorOptions, a_ as RfqQuoteRequestEvent, a$ as RfqQuoteResponse, b0 as RfqQuoteSource, b1 as RfqSession, b2 as SearchError, e6 as SearchRequest, e7 as SearchResults, e8 as SecureRealtimeEvent, e9 as SecureRealtimeTopic, ea as SecureSubscriptionSpec, bk as SetupTradingApprovalsError, eb as SignedOrder, ec as SplitComboPositionError, ed as SplitMarketPositionError, bn as SplitPositionError, ee as SplitPositionWorkflow, ef as SplitPositionWorkflowRequest, eg as SportsEventType, eh as SportsSubscription, ei as SubscribeError, ej as SubscriptionHandle, ek as TradingApprovalsWorkflow, el as TradingApprovalsWorkflowRequest, bs as TransferErc20Error, em as UpdateBalanceAllowanceError, en as UpdateBalanceAllowanceRequest, eo as UserEventType, ep as UserSubscription, eq as WaitForGaslessTransactionError, er as approveErc1155ForAll, es as approveErc20, et as cancelAll, eu as cancelMarketOrders, ev as cancelOrder, ew as cancelOrders, ex as deployDepositWallet, ey as downloadAccountingSnapshot, ez as dropNotifications, eA as estimateMarketPrice, eB as fetchBalanceAllowance, eC as fetchBuilderFeeRates, eD as fetchBuilderVolume, eE as fetchClosedOnlyMode, eF as fetchCommentsById, eG as fetchEvent, eH as fetchEventLiveVolume, eI as fetchEventTags, eJ as fetchExecuteParams, eK as fetchLastTradePrice, eL as fetchLastTradePrices, eM as fetchMarket, eN as fetchMarketInfo, eO as fetchMarketTags, eP as fetchMidpoint, eQ as fetchMidpoints, eR as fetchNegRisk, eS as fetchNotifications, eT as fetchOrder, eU as fetchOrderBook, eV as fetchOrderBooks, eW as fetchOrderScoring, eX as fetchOrdersScoring, eY as fetchPortfolioValue, eZ as fetchPrice, e_ as fetchPriceHistory, e$ as fetchPrices, f0 as fetchPublicProfile, f1 as fetchRelatedTagResources, f2 as fetchRelatedTags, f3 as fetchRewardPercentages, f4 as fetchSeries, f5 as fetchSpread, f6 as fetchSpreads, f7 as fetchTag, f8 as fetchTickSize, f9 as fetchTotalEarningsForUserForDay, fa as fetchTradedMarketCount, fb as fetchTransaction, fc as isWalletDeployed, fd as listAccountTrades, fe as listActivity, ff as listBuilderLeaderboard, fg as listBuilderTrades, fh as listClosedPositions, fi as listComboPositions, fj as listComments, fk as listCommentsByUserAddress, fl as listCurrentRewards, fm as listEvents, fn as listMarketHolders, fo as listMarketPositions, fp as listMarketRewards, fq as listMarkets, fr as listOpenInterest, fs as listOpenOrders, ft as listPositions, fu as listSeries, fv as listTags, fw as listTeams, fx as listTraderLeaderboard, fy as listTrades, fz as listUserEarningsAndMarketsConfig, fA as listUserEarningsForDay, fB as mergeComboPosition, fC as mergeMarketPosition, fD as mergePositions, fE as openRfqSession, fF as postOrder, fG as postOrders, fH as prepareErc1155ApprovalForAll, fI as prepareErc20Approval, fJ as prepareErc20Transfer, fK as prepareGaslessTransaction, fL as prepareMergeComboPosition, fM as prepareMergeMarketPosition, fN as prepareMergePositions, fO as prepareRedeemComboPosition, fP as prepareRedeemMarketPositions, fQ as prepareRedeemPositions, fR as prepareSplitComboPosition, fS as prepareSplitMarketPosition, fT as prepareSplitPosition, fU as prepareTradingApprovals, fV as redeemPositions, fW as resolveConditionByToken, fX as search, fY as setupTradingApprovals, fZ as splitComboPosition, f_ as splitMarketPosition, f$ as splitPosition, g0 as subscribe, g1 as transferErc20, g2 as updateBalanceAllowance } from '../types-BHjtOekI.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-shrXkDsG.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,wc as CancelAllError,yc as CancelMarketOrdersError,sc as CancelOrderError,uc as CancelOrdersError,kd as ComboPositionStatus,E as CreateApiKeyError,O as CreateBuilderApiKeyError,Wc as CreateLimitOrderError,Sc as CreateMarketOrderError,I as CreateOrDeriveApiKeyError,M as DeleteApiKeyError,ea as DeployDepositWalletError,G as DeriveApiKeyError,id as DownloadAccountingSnapshotError,ua as DropNotificationsError,Ac 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,ic as FetchMarketError,ob as FetchMarketInfoError,kc 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,ed as FetchPortfolioValueError,sb as FetchPriceError,Ib as FetchPriceHistoryError,ub as FetchPricesError,Rd as FetchPublicProfileError,we as FetchRelatedTagResourcesError,ue as FetchRelatedTagsError,Ka as FetchRewardPercentagesError,je as FetchSeriesError,ne as FetchSportsMarketTypesError,Ab as FetchSpreadError,Cb as FetchSpreadsError,se as FetchTagError,ib as FetchTickSizeError,Ga as FetchTotalEarningsForUserForDayError,gd as FetchTradedMarketCountError,da as GaslessTransactionMetadataSchema,ba as IsWalletDeployedError,qa as ListAccountTradesError,Oa as ListActivityError,ac as ListBuilderLeaderboardError,cb as ListBuilderTradesError,cc as ListBuilderVolumeError,ad as ListClosedPositionsError,bd as ListComboPositionsError,Sb as ListCommentsByUserAddressError,Ob as ListCommentsError,Kb as ListCurrentRewardsError,Ub as ListEventsError,mc as ListMarketHoldersError,qc as ListMarketPositionsError,Mb as ListMarketRewardsError,gc as ListMarketsError,oc as ListOpenInterestError,ma as ListOpenOrdersError,_c as ListPositionsError,he as ListSeriesError,le as ListSportsError,qe as ListTagsError,ye as ListTeamsError,ec as ListTraderLeaderboardError,Ma as ListTradesError,Ia as ListUserEarningsAndMarketsConfigError,Ea as ListUserEarningsForDayError,Id as MergeComboPositionError,Hd as MergeMarketPositionError,Gd as MergePositionsError,Zd as OpenRfqSessionError,Yc as PlaceLimitOrderError,Uc as PlaceMarketOrderError,Dc as PostOrderError,Ec as PostOrdersError,Wa as PrepareErc1155ApprovalForAllError,Sa as PrepareErc20ApprovalError,Ae as PrepareErc20TransferError,ha as PrepareGaslessTransactionError,Mc as PrepareLimitOrderError,Qc as PrepareLimitOrderPostingError,Kc as PrepareMarketOrderError,Oc as PrepareMarketOrderPostingError,qd as PrepareMergeComboPositionError,pd as PrepareMergeMarketPositionError,od as PrepareMergePositionsError,td as PrepareRedeemComboPositionError,sd as PrepareRedeemMarketPositionsError,rd as PrepareRedeemPositionsError,nd as PrepareSplitComboPositionError,md as PrepareSplitMarketPositionError,ld as PrepareSplitPositionError,_a as PrepareTradingApprovalsError,Pd as RedeemPositionsError,mb as ResolveConditionByTokenError,S as RevokeBuilderApiKeyError,Wd as RfqCancelQuoteError,Vd as RfqCancelQuoteRejectedError,$d as RfqConfirmationDecision,Yd as RfqConfirmationError,Xd as RfqConfirmationRejectedError,ae as RfqDirection,be as RfqErrorCode,ce as RfqExecutionStatus,Ud as RfqQuoteError,Td as RfqQuoteRejectedError,de as RfqRequestedSizeUnit,ee as RfqSide,fe as SearchError,ab as SetupTradingApprovalsError,zd as SplitComboPositionError,yd as SplitMarketPositionError,xd as SplitPositionError,Ce as TransferErc20Error,ya as UpdateBalanceAllowanceError,ja as WaitForGaslessTransactionError,Za as approveErc1155ForAll,Va as approveErc20,xc as cancelAll,zc as cancelMarketOrders,tc as cancelOrder,vc as cancelOrders,F as createApiKey,P as createBuilderApiKey,Xc as createLimitOrder,Tc as createMarketOrder,J as createOrDeriveApiKey,N as deleteApiKey,fa as deployDepositWallet,H as deriveApiKey,jd as downloadAccountingSnapshot,va as dropNotifications,Bc 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,jc as fetchMarket,pb as fetchMarketInfo,lc 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,fd as fetchPortfolioValue,tb as fetchPrice,Jb as fetchPriceHistory,vb as fetchPrices,Sd as fetchPublicProfile,xe as fetchRelatedTagResources,ve as fetchRelatedTags,La as fetchRewardPercentages,ke as fetchSeries,oe as fetchSportsMarketTypes,Bb as fetchSpread,Db as fetchSpreads,te as fetchTag,jb as fetchTickSize,Ha as fetchTotalEarningsForUserForDay,hd as fetchTradedMarketCount,ga as fetchTransaction,ca as isWalletDeployed,ra as listAccountTrades,Pa as listActivity,bc as listBuilderLeaderboard,db as listBuilderTrades,cd as listClosedPositions,dd as listComboPositions,Pb as listComments,Tb as listCommentsByUserAddress,Lb as listCurrentRewards,Vb as listEvents,nc as listMarketHolders,rc as listMarketPositions,Nb as listMarketRewards,hc as listMarkets,pc as listOpenInterest,na as listOpenOrders,$c as listPositions,ie as listSeries,me as listSports,re as listTags,ze as listTeams,fc as listTraderLeaderboard,Na as listTrades,Ja as listUserEarningsAndMarketsConfig,Fa as listUserEarningsForDay,Kd as mergeComboPosition,Jd as mergeMarketPosition,Ld as mergePositions,_d as openRfqSession,Zc as placeLimitOrder,Vc as placeMarketOrder,Fc as postOrder,Gc as postOrders,Xa as prepareErc1155ApprovalForAll,Ta as prepareErc20Approval,Be as prepareErc20Transfer,ia as prepareGaslessTransaction,Nc as prepareLimitOrder,Rc as prepareLimitOrderPosting,Lc as prepareMarketOrder,Pc as prepareMarketOrderPosting,Ed as prepareMergeComboPosition,Dd as prepareMergeMarketPosition,Fd as prepareMergePositions,Nd as prepareRedeemComboPosition,Md as prepareRedeemMarketPositions,Od as prepareRedeemPositions,vd as prepareSplitComboPosition,ud as prepareSplitMarketPosition,wd as prepareSplitPosition,$a as prepareTradingApprovals,Qd as redeemPositions,nb as resolveConditionByToken,Cc as resolveEstimatedMarketPrice,T as revokeBuilderApiKey,ge as search,bb as setupTradingApprovals,Jc as signOrder,Bd as splitComboPosition,Ad as splitMarketPosition,Cd as splitPosition,pe as subscribe,De as transferErc20,za as updateBalanceAllowance}from'../chunk-
|
|
1
|
+
export{Ya as ApproveErc1155ForAllError,Ua as ApproveErc20Error,wc as CancelAllError,yc as CancelMarketOrdersError,sc as CancelOrderError,uc as CancelOrdersError,kd as ComboPositionStatus,E as CreateApiKeyError,O as CreateBuilderApiKeyError,Wc as CreateLimitOrderError,Sc as CreateMarketOrderError,I as CreateOrDeriveApiKeyError,M as DeleteApiKeyError,ea as DeployDepositWalletError,G as DeriveApiKeyError,id as DownloadAccountingSnapshotError,ua as DropNotificationsError,Ac 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,ic as FetchMarketError,ob as FetchMarketInfoError,kc 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,ed as FetchPortfolioValueError,sb as FetchPriceError,Ib as FetchPriceHistoryError,ub as FetchPricesError,Rd as FetchPublicProfileError,we as FetchRelatedTagResourcesError,ue as FetchRelatedTagsError,Ka as FetchRewardPercentagesError,je as FetchSeriesError,ne as FetchSportsMarketTypesError,Ab as FetchSpreadError,Cb as FetchSpreadsError,se as FetchTagError,ib as FetchTickSizeError,Ga as FetchTotalEarningsForUserForDayError,gd as FetchTradedMarketCountError,da as GaslessTransactionMetadataSchema,ba as IsWalletDeployedError,qa as ListAccountTradesError,Oa as ListActivityError,ac as ListBuilderLeaderboardError,cb as ListBuilderTradesError,cc as ListBuilderVolumeError,ad as ListClosedPositionsError,bd as ListComboPositionsError,Sb as ListCommentsByUserAddressError,Ob as ListCommentsError,Kb as ListCurrentRewardsError,Ub as ListEventsError,mc as ListMarketHoldersError,qc as ListMarketPositionsError,Mb as ListMarketRewardsError,gc as ListMarketsError,oc as ListOpenInterestError,ma as ListOpenOrdersError,_c as ListPositionsError,he as ListSeriesError,le as ListSportsError,qe as ListTagsError,ye as ListTeamsError,ec as ListTraderLeaderboardError,Ma as ListTradesError,Ia as ListUserEarningsAndMarketsConfigError,Ea as ListUserEarningsForDayError,Id as MergeComboPositionError,Hd as MergeMarketPositionError,Gd as MergePositionsError,Zd as OpenRfqSessionError,Yc as PlaceLimitOrderError,Uc as PlaceMarketOrderError,Dc as PostOrderError,Ec as PostOrdersError,Wa as PrepareErc1155ApprovalForAllError,Sa as PrepareErc20ApprovalError,Ae as PrepareErc20TransferError,ha as PrepareGaslessTransactionError,Mc as PrepareLimitOrderError,Qc as PrepareLimitOrderPostingError,Kc as PrepareMarketOrderError,Oc as PrepareMarketOrderPostingError,qd as PrepareMergeComboPositionError,pd as PrepareMergeMarketPositionError,od as PrepareMergePositionsError,td as PrepareRedeemComboPositionError,sd as PrepareRedeemMarketPositionsError,rd as PrepareRedeemPositionsError,nd as PrepareSplitComboPositionError,md as PrepareSplitMarketPositionError,ld as PrepareSplitPositionError,_a as PrepareTradingApprovalsError,Pd as RedeemPositionsError,mb as ResolveConditionByTokenError,S as RevokeBuilderApiKeyError,Wd as RfqCancelQuoteError,Vd as RfqCancelQuoteRejectedError,$d as RfqConfirmationDecision,Yd as RfqConfirmationError,Xd as RfqConfirmationRejectedError,ae as RfqDirection,be as RfqErrorCode,ce as RfqExecutionStatus,Ud as RfqQuoteError,Td as RfqQuoteRejectedError,de as RfqRequestedSizeUnit,ee as RfqSide,fe as SearchError,ab as SetupTradingApprovalsError,zd as SplitComboPositionError,yd as SplitMarketPositionError,xd as SplitPositionError,Ce as TransferErc20Error,ya as UpdateBalanceAllowanceError,ja as WaitForGaslessTransactionError,Za as approveErc1155ForAll,Va as approveErc20,xc as cancelAll,zc as cancelMarketOrders,tc as cancelOrder,vc as cancelOrders,F as createApiKey,P as createBuilderApiKey,Xc as createLimitOrder,Tc as createMarketOrder,J as createOrDeriveApiKey,N as deleteApiKey,fa as deployDepositWallet,H as deriveApiKey,jd as downloadAccountingSnapshot,va as dropNotifications,Bc 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,jc as fetchMarket,pb as fetchMarketInfo,lc 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,fd as fetchPortfolioValue,tb as fetchPrice,Jb as fetchPriceHistory,vb as fetchPrices,Sd as fetchPublicProfile,xe as fetchRelatedTagResources,ve as fetchRelatedTags,La as fetchRewardPercentages,ke as fetchSeries,oe as fetchSportsMarketTypes,Bb as fetchSpread,Db as fetchSpreads,te as fetchTag,jb as fetchTickSize,Ha as fetchTotalEarningsForUserForDay,hd as fetchTradedMarketCount,ga as fetchTransaction,ca as isWalletDeployed,ra as listAccountTrades,Pa as listActivity,bc as listBuilderLeaderboard,db as listBuilderTrades,cd as listClosedPositions,dd as listComboPositions,Pb as listComments,Tb as listCommentsByUserAddress,Lb as listCurrentRewards,Vb as listEvents,nc as listMarketHolders,rc as listMarketPositions,Nb as listMarketRewards,hc as listMarkets,pc as listOpenInterest,na as listOpenOrders,$c as listPositions,ie as listSeries,me as listSports,re as listTags,ze as listTeams,fc as listTraderLeaderboard,Na as listTrades,Ja as listUserEarningsAndMarketsConfig,Fa as listUserEarningsForDay,Kd as mergeComboPosition,Jd as mergeMarketPosition,Ld as mergePositions,_d as openRfqSession,Zc as placeLimitOrder,Vc as placeMarketOrder,Fc as postOrder,Gc as postOrders,Xa as prepareErc1155ApprovalForAll,Ta as prepareErc20Approval,Be as prepareErc20Transfer,ia as prepareGaslessTransaction,Nc as prepareLimitOrder,Rc as prepareLimitOrderPosting,Lc as prepareMarketOrder,Pc as prepareMarketOrderPosting,Ed as prepareMergeComboPosition,Dd as prepareMergeMarketPosition,Fd as prepareMergePositions,Nd as prepareRedeemComboPosition,Md as prepareRedeemMarketPositions,Od as prepareRedeemPositions,vd as prepareSplitComboPosition,ud as prepareSplitMarketPosition,wd as prepareSplitPosition,$a as prepareTradingApprovals,Qd as redeemPositions,nb as resolveConditionByToken,Cc as resolveEstimatedMarketPrice,T as revokeBuilderApiKey,ge as search,bb as setupTradingApprovals,Jc as signOrder,Bd as splitComboPosition,Ad as splitMarketPosition,Cd as splitPosition,pe as subscribe,De as transferErc20,za as updateBalanceAllowance}from'../chunk-76B5WBIO.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 kd}from'@polymarket/bindings/data';import {RelayerTransactionType,RelayerExecuteRequestSchema,RelayerTransactionState,RelayerExecuteParamsSchema,RelayerDeployedResponseSchema,GaslessTransactionSchema,RelayerExecuteResponseSchema}from'@polymarket/bindings/relayer';export{RfqConfirmationDecision as $d,RfqDirection as ae,RfqErrorCode as be,RfqExecutionStatus as ce,RfqRequestedSizeUnit as de,RfqSide as ee}from'@polymarket/bindings/rfq';import Md from'it-merge';function l(e,r){let t=r.safeParse(e);if(t.success)return t.data;throw a.fromZodError(t.error)}var q=z$1.number().int().positive(),Kr=z$1.object({offset:z$1.number().int().min(0),pageSize:q});function C(e,r,t=[]){function o(){return {async firstPage(){return {items:t,hasMore:false}},from(){return o()},async*[Symbol.asyncIterator](){}}}function n(c=r){return {firstPage(){return unwrap(e(c))},from(a){return a===void 0?o():n(a)},async*[Symbol.asyncIterator](){let a=c;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=>kn(t.url,e,o))}}function Jr(e){return ResultAsync.fromPromise(e.blob(),()=>new b(`Received unreadable binary response from ${e.url}`))}function kn(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.#r({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){if(r.length===0)return [];let t=await this.#t(r.map((n,c)=>({jsonrpc:"2.0",id:c+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,c)=>{let a=c+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 bn(y.result)})}async#r(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#t(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,In(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 bn(e){if(typeof e!="string"||!ot(e))throw new b("Expected JSON-RPC eth_call result to be a hex string");return e}function In(e){if(e===void 0)return "";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return ""}}function Eu(e,r,t){return {signer:r,wallet:t,walletType:$n(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 qn="3d3d606380380380913d393d73%s5af4602a57600080fd5b602d8060366000396000f3363d3d373d3d3d363d73%s5af43d82803e903d91602b57fd5bf352e831dd00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000";function vn(e){let r=qn.replace("%s",e.proxyFactory.slice(2).toLowerCase()).replace("%s",e.proxyImplementation.slice(2).toLowerCase());return expectHexString(Hash.keccak256(`0x${r}`))}function On(e,r){return expectEvmAddress(ContractAddress.fromCreate2({bytecodeHash:vn(r),from:r.proxyFactory,salt:Hash.keccak256(AbiParameters.encodePacked(["address"],[e]))}))}function Ln(e,r){return expectEvmAddress(ContractAddress.fromCreate2({bytecodeHash:r.safeInitCodeHash,from:r.safeFactory,salt:Hash.keccak256(AbiParameters.encode([{name:"address",type:"address"}],[e]))}))}var wn="0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3",Mn="0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076",Bn=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:Hn(r.depositWalletImplementation,o),from:r.depositWalletFactory,salt:Hash.keccak256(o)}))}var Fn="0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3",Un="0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c",zn="0x60195155f3363d3d373d3d363d602036600436635c60da",Dn=0x6100523d8160233d3973n,jn="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:Wn(r.depositWalletBeacon,o),from:r.depositWalletFactory,salt:Hash.keccak256(o)}))}function Hn(e,r){let t=BigInt((r.length-2)/2),o=Bn+(t<<56n);return expectHexString(Hash.keccak256(Bytes.concat(Bytes.fromNumber(o,{size:10}),Bytes.fromHex(e),Bytes.fromHex("0x6009"),Bytes.fromHex(Mn),Bytes.fromHex(wn),Bytes.fromHex(r)),{as:"Hex"}))}function Wn(e,r){let t=BigInt((r.length-2)/2),o=Dn+(t<<56n);return expectHexString(Hash.keccak256(Bytes.concat(Bytes.fromNumber(o,{size:10}),Bytes.fromHex(e),Bytes.fromHex(zn),Bytes.fromHex(Un),Bytes.fromHex(Fn),Bytes.fromHex(r)),{as:"Hex"}))}async function _n(e,r){try{let t=await e.ethCall({to:r,data:jn});return Gn(t)}catch(t){if(et(t))return ZERO_ADDRESS;throw t}}async function Nn(e,r){let t=await _n(e,r);return !isSameEvmAddress(t,ZERO_ADDRESS)}async function it(e,r,t){return await Nn(e,t.depositWalletFactory)?st(r,t):at(r,t)}function Gn(e){return e.length<66?ZERO_ADDRESS:expectEvmAddress(`0x${e.slice(-40)}`)}function $n(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,Ln(r,o)))return WalletType.GNOSIS_SAFE;if(isSameEvmAddress(t,On(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(Vn(r))return Kn(e,r.exceptions);let t=new URLSearchParams;for(let[o,n]of Object.entries(r)){let c=e[o];if(c!==void 0){if(pt(c)){for(let a of c)t.append(n,fe(a));continue}t.append(n,fe(c));}}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(fe).join(","));continue}r.append(t,fe(o));}return r}function Vn(e){return "format"in e}function Kn(e,r){let t=new URLSearchParams;for(let[o,n]of Object.entries(e)){if(n===void 0)continue;let c=r[o]??Yn(o);if(pt(n)){for(let a of n)t.append(c,fe(a));continue}t.append(c,fe(n));}return t}function pt(e){return Array.isArray(e)}function Yn(e){return e.replace(/[A-Z]/g,r=>`_${r.toLowerCase()}`)}function fe(e){return String(e)}var qu=k(e,d,j$1,c,b);async function vu(e){return (await unwrap(e.secureClob.get("/auth/ban-status/closed-only").andThen(f(ClosedOnlyModeSchema)))).closedOnly}var pa=z$1.object({tokenId:z$1.string().optional(),cursor:PaginationCursorSchema.optional(),id:z$1.string().optional(),market:z$1.string().optional()}).default({}),Ou=k(e,d,j$1,c,b,a);function Lu(e,r){let{cursor:t,...o}=l(r,pa);return C(n=>e.secureClob.get("/data/orders",{params:R({...o,nextCursor:n},S({tokenId:"asset_id"}))}).andThen(f(OpenOrdersPageSchema)).map(c=>({items:c.data,hasMore:c.nextCursor!==END_CURSOR,nextCursor:c.nextCursor===END_CURSOR?void 0:toPaginationCursor(c.nextCursor),totalCount:c.count})),t)}var ca=z$1.object({orderId:z$1.string()}),wu=k(e,d,j$1,c,b,a);async function Mu(e,r){let t=l(r,ca);return unwrap(e.secureClob.get(`/data/order/${t.orderId}`).andThen(f(OpenOrderSchema)))}var da={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()},ua=z$1.object(da).default({}),Bu=k(e,d,j$1,c,b,a);function Fu(e,r){let{cursor:t,...o}=l(r,ua);return C(n=>e.secureClob.get("/data/trades",{params:R({...o,nextCursor:n},S({tokenId:"asset_id"}))}).andThen(f(ClobTradesPageSchema)).map(c=>({items:c.data,hasMore:c.nextCursor!==END_CURSOR,nextCursor:c.nextCursor===END_CURSOR?void 0:toPaginationCursor(c.nextCursor),totalCount:c.count})),t)}var Uu=k(e,d,j$1,c,b),ma=z$1.object({ids:z$1.array(z$1.string()).min(1)});async function zu(e){let r=ee(e.account.walletType);return unwrap(e.secureClob.get("/notifications",{params:R({signatureType:r},S())}).andThen(f(NotificationsResponseSchema)))}var Du=k(e,d,j$1,c,b,a);async function ju(e,r){let t=l(r,ma),o=ee(e.account.walletType),n=R({ids:t.ids.join(","),signatureType:o},S());await unwrap(e.secureClob.del("/notifications",{params:n}));}var la=z$1.object({assetType:AssetTypeSchema,tokenId:z$1.string().optional()}),Hu=k(e,d,j$1,c,b,a);async function sr(e,r){let t=l(r,la),o=ee(e.account.walletType);return unwrap(e.secureClob.get("/balance-allowance",{params:R({...t,signatureType:o},S())}).andThen(f(BalanceAllowanceResponseSchema)))}var fa=z$1.object({assetType:AssetTypeSchema,tokenId:z$1.string().optional()}),Wu=k(e,d,j$1,c,b,a);async function dt(e,r){let t=l(r,fa),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 ya=z$1.object({orderId:z$1.string()}),_u=k(e,d,j$1,c,b,a);async function Nu(e,r){let t=l(r,ya);return (await unwrap(e.secureClob.get("/order-scoring",{params:R(t,S())}).andThen(f(OrderScoringResponseSchema)))).scoring}var Ea=z$1.object({orderIds:z$1.array(z$1.string())}),Gu=k(e,d,j$1,c,b,a);async function $u(e,r){let o=l(r,Ea).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()}),Vu=k(e,d,j$1,c,b,a);function Ku(e,r){let{cursor:t,...o}=l(r,ut),n=ee(e.account.walletType);return C(c=>e.secureClob.get("/rewards/user",{params:R({...o,nextCursor:c,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 Yu=k(e,d,j$1,c,b,a);async function Ju(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 ga=z$1.object({cursor:PaginationCursorSchema.optional(),date:z$1.string(),noCompetition:z$1.boolean().optional(),orderBy:z$1.string().optional(),pageSize:q.max(500).default(100),position:z$1.string().optional()}),Qu=k(e,d,j$1,c,b,a);function Zu(e,r){let{cursor:t,...o}=l(r,ga),n=ee(e.account.walletType);return C(c=>e.secureClob.get("/rewards/user/markets",{params:R({...o,nextCursor:c,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 Xu=k(e,d,j$1,c,b);async function em(e){let r=ee(e.account.walletType);return unwrap(e.secureClob.get("/rewards/user/percentages",{params:R({signatureType:r},S())}).andThen(f(RewardsPercentagesSchema)))}var xa=z$1.enum(["TIMESTAMP","TOKENS","CASH"]),Ta=z$1.enum(["ASC","DESC"]),Pa=z$1.enum(["CASH","TOKENS"]),Ca=z$1.object({cursor:PaginationCursorSchema.optional(),pageSize:q.default(20),takerOnly:z$1.boolean().optional(),filterType:Pa.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"]}),ka=z$1.object({cursor:PaginationCursorSchema.optional(),pageSize:q.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:xa.optional(),sortDirection:Ta.optional(),side:SideSchema.optional()}).refine(e=>!(e.market&&e.eventId),{message:"Provide market or eventId, not both",path:["eventId"]}),dm=k(e,d,c,b,a);function um(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,Ca);return C(c=>{let a=O(c,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 mm=k(e,d,c,b,a);function lm(e,r){let{cursor:t,pageSize:o,...n}=l(r,ka);return C(c=>{let a=O(c,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 Ia=64,Aa=/^0x[0-9a-fA-F]{62}$/,qa=/^0x[0-9a-fA-F]{64}$/,ir="0x0000000000000000000000000000000000000000000000000000000000000000",va=AbiFunction.from("function approve(address spender, uint256 amount)"),yt=AbiFunction.from("function allowance(address owner, address spender) view returns (uint256)"),Oa=AbiFunction.from("function transfer(address recipient, uint256 amount)"),La=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[])"),wa=AbiFunction.from("function splitPosition(address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] partition, uint256 amount)"),Ma=AbiFunction.from("function mergePositions(address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] partition, uint256 amount)"),Ba=AbiFunction.from("function redeemPositions(address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] indexSets)"),Fa=AbiFunction.from("function split(bytes31 conditionId, uint256 amount)"),Ua=AbiFunction.from("function merge(bytes31 conditionId, uint256 amount)"),za=AbiFunction.from("function redeem(bytes31 conditionId, uint256 outcomeIndex, uint256 amount)"),Da=AbiFunction.from("function prepareCondition(uint256[] legs) returns (bytes31)"),ja=AbiFunction.from("function multiSend(bytes)"),Ha=AbiFunction.from("function proxy((uint8 typeCode, address to, uint256 value, bytes data)[] calls) returns (bytes[])"),St=[1n,2n],Wa=[1n,2n],$=(1n<<256n)-1n,Rm=k(a);function He(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:_a(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 We(e,r,t){return {data:Na(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,ie(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=>ie(BigInt(o),"id"))]),to:e}}function cr(e){return AbiFunction.decodeResult(Rt,e)}var Sm=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:Ga(r,t),to:e}}var hm=k(a),xm=k(a);function bt(e,r,t,o){return {data:$a(r,t,o),to:e}}var Tm=k(a);function It(e,r,t,o){return {data:Va(r,t,o),to:e}}function At(e,r,t){return {data:Ka(r,t),to:e}}var Pm=k(a);function qt(e,r,t){return {data:AbiFunction.encodeData(Fa,[mr(r),ie(t,"Split amount")]),to:e}}var Cm=k(a);function vt(e,r,t){return {data:AbiFunction.encodeData(Ua,[mr(r),ie(t,"Merge amount")]),to:e}}var km=k(a);function Ot(e,r,t,o){return {data:AbiFunction.encodeData(za,[mr(r),BigInt(Ya(t)),ie(o,"Redeem amount")]),to:e}}var bm=k(a);function ur(e,r){return {data:AbiFunction.encodeData(Da,[r.map(t=>ie(t,"Leg position ID"))]),to:e}}function _a(e,r){return invariant(r>=0n,"Approval amount must be non-negative"),AbiFunction.encodeData(va,[e,r])}function Na(e,r){return AbiFunction.encodeData(La,[e,r])}function Ga(e,r){return AbiFunction.encodeData(Oa,[e,r])}function $a(e,r,t){return AbiFunction.encodeData(wa,[e,ir,r,St,ie(t,"Split amount")])}function Va(e,r,t){return AbiFunction.encodeData(Ma,[e,ir,r,St,ie(t,"Merge amount")])}function Ka(e,r){return AbiFunction.encodeData(Ba,[e,ir,r,Wa])}function ie(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(Aa.test(e))return e.toLowerCase();if(qa.test(e)){let r=e.toLowerCase();if(r.endsWith("00")||r.endsWith("01"))return r.slice(0,Ia)}throw new a("Protocol v2 condition ID must be bytes31, or bytes32 with a binary outcome byte")}function Ya(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(Ha,[e.map(r=>({typeCode:1,to:r.to,value:r.value??0n,data:r.data}))])}function wt(e){let r=e.map(t=>Ja(t));return AbiFunction.encodeData(ja,[r.length===0?"0x":AbiParameters.encodePacked(Array.from({length:r.length},()=>"bytes"),r)])}function Ja(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 vm=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 Bm(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 F(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 cs=[{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],ds=[{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"}],us="DepositWallet",ms="1",ls=600,fs=[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],ys=[{name:"wallet",type:"address"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"},{name:"calls",type:"Call[]"}],Es=z$1.object({address:z$1.string(),type:z$1.enum(RelayerTransactionType)}),Jm=k(e,d,c,b,a);async function Er(e,r){let t=l(r,Es);return unwrap(e.relayer.get("/v1/account/transactions/params",{params:R(t,{address:"address",type:"type"})}).andThen(f(RelayerExecuteParamsSchema)))}var gs=z$1.object({transactionId:TransactionIdSchema}),Rs=z$1.object({wallet:EvmAddressSchema,type:z$1.enum(WalletType)}),Qm=k(e,d,c,b,a);async function Zm(e,r){let t=await Ss(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 Ss(e,r){if(r!==void 0)return l(r,Rs);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,Xm=k(e,d,c,b,a);async function el(e){return invariant(e.supportsGasless,"Deposit Wallet deployment requires a Relayer API Key or Builder API Key in the client configuration."),Ge(e,{from:e.account.signer,metadata:"Deploy Deposit Wallet",to:e.environment.walletDerivation.depositWalletFactory,type:RelayerTransactionType.WALLET_CREATE})}async function hs(e,r){let t=l(r,gs);return unwrap(e.relayer.get(`/v1/account/transactions/${t.transactionId}`).andThen(f(GaslessTransactionSchema)))}var xs=z$1.object({data:z$1.custom(isHexString),to:EvmAddressSchema,value:z$1.bigint().optional()}),Ts=z$1.object({calls:z$1.array(xs).min(1).transform(e=>expectNonEmptyArray(e)),metadata:j}),rl=k(e,d,c,b,a);async function G(e,r){let t=l(r,Ts);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*Ps(e,t);case WalletType.DEPOSIT_WALLET:return yield*Cs(e,t);case WalletType.GNOSIS_SAFE:return yield*ks(e,t)}invariant(!1,"Unsupported wallet type for gasless transaction");}catch(c){if(!bs(c)||n===Bt)throw c;await delay(e.environment.relayerPollFrequencyMs);}invariant(false,"Expected gasless transaction retry loop to return");}.call(null)}async function*Ps(e,r){let t=await Er(e,{address:e.account.signer,type:RelayerTransactionType.PROXY}),o=e.environment.walletDerivation.proxyFactory,n=Lt(r.calls),c="0",a="0",y="10000000",x=e.environment.relayHub,Ae=ZERO_ADDRESS,hn=ws(e.account.signer,o,n,c,a,y,t.nonce,x,Ae),xn=expectEvmSignature(yield zt(hn));return Ge(e,{data:n,from:e.account.signer,metadata:r.metadata,nonce:t.nonce,proxyWallet:e.account.wallet,signature:xn,signatureParams:{gasLimit:y,gasPrice:a,relay:Ae,relayHub:x,relayerFee:c},to:o,type:RelayerTransactionType.PROXY})}async function*Cs(e,r){let t=await Er(e,{address:e.account.signer,type:RelayerTransactionType.WALLET}),o=r.calls.map(Is),n=`${Math.floor(Date.now()/1e3)+ls}`,c=expectEvmSignature(yield Ls(As({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:c,to:e.environment.walletDerivation.depositWalletFactory,type:RelayerTransactionType.WALLET};return Ge(e,a)}async function*ks(e,r){let t=await Er(e,{address:e.account.signer,type:RelayerTransactionType.SAFE}),o=qs(r.calls,e.environment.safeMultisend),n=Os({chainId:e.environment.chainId,data:o.data,nonce:t.nonce,operation:o.operation,safeAddress:e.account.wallet,to:o.to,value:o.value}),c=expectEvmSignature(yield zt(expectHexString(TypedData.getSignPayload(n))));return Ge(e,{data:o.data,from:e.account.signer,metadata:r.metadata,nonce:t.nonce,proxyWallet:e.account.wallet,signature:Ms(c),signatureParams:vs(o.operation),to:o.to,type:RelayerTransactionType.SAFE,value:o.value>0n?`${o.value}`:void 0})}async function Ge(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 bs(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 Is(e){return {data:e.data,target:e.to,value:`${e.value??0n}`}}function As(e){return {domain:{chainId:e.chainId,name:us,verifyingContract:e.wallet,version:ms},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:ys,Call:fs}}}function qs(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 vs(e){return {baseGas:"0",gasPrice:"0",gasToken:ZERO_ADDRESS,operation:`${e}`,refundReceiver:ZERO_ADDRESS,safeTxnGas:"0"}}function Os(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:cs,SafeTx:ds}}}function zt(e){return {kind:"signGaslessMessage",payload:e}}function Ls(e){return {kind:"signGaslessTypedData",payload:e}}function ws(e,r,t,o,n,c,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(c),{size:32}),Bytes.fromNumber(BigInt(a),{size:32}),Bytes.fromHex(y),Bytes.fromHex(x)),{as:"Hex"}))}function Ms(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 tl=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 hs(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 Bs=z$1.object({amount:z$1.union([z$1.bigint(),z$1.literal("max")]),metadata:j.optional(),spenderAddress:EvmAddressSchema,tokenAddress:EvmAddressSchema}),ll=k(a);async function Fs(e,r){let t=l(r,Bs),o=t.amount==="max"?$:t.amount;return async function*(){return e.account.walletType===WalletType.EOA?z(yield Ht(D(e.environment.chainId,He(t.tokenAddress,t.spenderAddress,o)))):yield*await G(e,{calls:[He(t.tokenAddress,t.spenderAddress,o)],metadata:t.metadata??`Approve ${t.amount} of ${t.tokenAddress} to ${t.spenderAddress}`})}.call(null)}var fl=k(h,e,d,j$1,c,b,a);function Dt(e,r){return Fs(e,r).then(F(e.signer))}var Us=z$1.object({approved:z$1.boolean().default(true),metadata:j.optional(),operatorAddress:EvmAddressSchema,tokenAddress:EvmAddressSchema}),yl=k(a);async function zs(e,r){let t=l(r,Us);return async function*(){return e.account.walletType===WalletType.EOA?z(yield Wt(D(e.environment.chainId,We(t.tokenAddress,t.operatorAddress,t.approved)))):yield*await G(e,{calls:[We(t.tokenAddress,t.operatorAddress,t.approved)],metadata:t.metadata??`${t.approved?"Approve":"Revoke"} ${t.operatorAddress} on ${t.tokenAddress}`})}.call(null)}var El=k(h,e,d,j$1,c,b,a);function jt(e,r){return zs(e,r).then(F(e.signer))}var gl=k(d,c,b,a);async function Ds(e){let r=await Hs(e),t=r.erc20.map(n=>He(n.tokenAddress,n.spenderAddress,n.amount)),o=r.erc1155.map(n=>We(n.tokenAddress,n.operatorAddress,true));return async function*(){if(t.length===0&&o.length===0)return;if(e.account.walletType===WalletType.EOA){for(let c of t)await z(yield Ht(D(e.environment.chainId,c))).wait();for(let c of o)await z(yield Wt(D(e.environment.chainId,c))).wait();return}await(yield*await G(e,{calls:[...t,...o],metadata:"Trading setup approvals"})).wait();}.call(null)}var Rl=k(h,e,d,j$1,f$1,g,c,b,a);function Sl(e){return Ds(e).then(F(e.signer)).then(js)}function js(){return {transactionHash:null,transactionId:null,wait:async()=>{}}}async function Hs(e){let r=Ws(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),c=o.slice(r.erc20.length);return {erc20:r.erc20.filter((a,y)=>xt(n[y])<a.amount),erc1155:r.erc1155.filter((a,y)=>!Pt(c[y]))}}function Ws(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 bl=k(e,d,c,b);async function $s(e,r){return unwrap(e.clob.post("/auth/api-key",{headers:Gt(r)}).andThen(f(ApiKeyCredsSchema)))}var Il=k(e,d,c,b);async function Vs(e,r){return unwrap(e.clob.get("/auth/derive-api-key",{headers:Gt(r)}).andThen(f(ApiKeyCredsSchema)))}var Al=k(e,d,c,b);async function ql(e,r){try{return await $s(e,r)}catch(t){if(!(t instanceof d)||t.status!==400)throw t}return Vs(e,r)}var vl=k(e,d,j$1,c,b);async function Ol(e){return (await unwrap(e.secureClob.get("/auth/api-keys").andThen(f(ApiKeysResponseSchema)))).apiKeys}var Ll=k(e,d,j$1,c,b);async function wl(e){await unwrap(e.secureClob.del("/auth/api-key").andThen(f(z$1.literal("OK"))));}var Ml=k(e,d,j$1,c,b);async function Bl(e){return unwrap(e.secureClob.post("/auth/builder-api-key").andThen(f(BuilderApiKeyCredsSchema)))}var Fl=k(e,d,j$1,c,b);async function Ul(e){return unwrap(e.secureClob.get("/auth/builder-api-key").andThen(f(BuilderApiKeysResponseSchema)))}var zl=k(e,d,j$1,c,b);async function Dl(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 Zs=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()}),Yl=k(e,d,c,b,a);function Jl(e,r){let{cursor:t,...o}=l(r,Zs);return C(n=>e.clob.get("/builder/trades",{params:R({...o,nextCursor:n},S({builderCode:"builder_code",tokenId:"asset_id"}))}).andThen(f(PaginatedBuilderTradesSchema)).map(c=>({items:c.data,hasMore:c.nextCursor!==END_CURSOR,nextCursor:c.nextCursor===END_CURSOR?void 0:toPaginationCursor(c.nextCursor),totalCount:c.count})),t)}var hi=z$1.object({tokenId:z$1.string()}),pf=k(e,d,c,b,a);async function cf(e,r){let t=l(r,hi);return (await unwrap(e.clob.get("/midpoint",{params:R(t,S())}).andThen(f(MidpointSchema)))).mid}var xi=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),df=k(e,d,c,b,a);async function uf(e,r){let t=l(r,xi);return unwrap(e.clob.post("midpoints",{json:Ke(t)}).andThen(f(MidpointsSchema)))}var Ti=z$1.object({tokenId:z$1.string()}),mf=k(e,d,c,b,a);async function Re(e,r){let t=l(r,Ti);return (await unwrap(e.clob.get("/tick-size",{params:R(t,S())}).andThen(f(FetchTickSizeResponseSchema)))).minimumTickSize}var Pi=z$1.object({tokenId:z$1.string()}),lf=k(e,d,c,b,a);async function Se(e,r){let t=l(r,Pi);return (await unwrap(e.clob.get("/neg-risk",{params:R(t,S())}).andThen(f(FetchNegRiskResponseSchema)))).negRisk}var Ci=z$1.object({tokenId:TokenIdSchema}),ff=k(e,d,c,b,a);async function Qt(e,r){let t=l(r,Ci);return unwrap(e.clob.get(`/markets-by-token/${t.tokenId}`).andThen(f(ResolveConditionByTokenResponseSchema)))}var ki=z$1.object({conditionId:CtfConditionIdSchema}),yf=k(e,d,c,b,a);async function Zt(e,r){let t=l(r,ki);return unwrap(e.clob.get(`/clob-markets/${t.conditionId}`).andThen(f(FetchMarketInfoResponseSchema)))}var bi=z$1.object({builderCode:BuilderCodeSchema}),Ef=k(e,d,c,b,a);async function Xt(e,r){let t=l(r,bi);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 Ii=z$1.object({tokenId:z$1.string(),side:OrderSideSchema}),gf=k(e,d,c,b,a);async function Rf(e,r){let t=l(r,Ii);return (await unwrap(e.clob.get("/price",{params:R(t,S())}).andThen(f(PriceSchema)))).price}var Ai=z$1.array(z$1.object({tokenId:z$1.string(),side:OrderSideSchema})).min(1),Sf=k(e,d,c,b,a);async function hf(e,r){let t=l(r,Ai);return unwrap(e.clob.post("prices",{json:zi(t)}).andThen(f(PricesSchema)))}var qi=z$1.object({tokenId:z$1.string()}),xf=k(e,d,c,b,a);async function eo(e,r){let t=l(r,qi);return unwrap(e.clob.get("/book",{params:R(t,S())}).andThen(f(FetchOrderBookResponseSchema)))}var vi=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),Tf=k(e,d,c,b,a);async function Pf(e,r){let t=l(r,vi);return unwrap(e.clob.post("books",{json:Ke(t)}).andThen(f(OrderBooksSchema)))}var Oi=z$1.object({tokenId:z$1.string()}),Cf=k(e,d,c,b,a);async function kf(e,r){let t=l(r,Oi);return (await unwrap(e.clob.get("/spread",{params:R(t,S())}).andThen(f(SpreadSchema)))).spread}var Li=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),bf=k(e,d,c,b,a);async function If(e,r){let t=l(r,Li);return unwrap(e.clob.post("spreads",{json:Ke(t)}).andThen(f(SpreadsSchema)))}var wi=z$1.object({tokenId:z$1.string()}),Af=k(e,d,c,b,a);async function qf(e,r){let t=l(r,wi);return unwrap(e.clob.get("/last-trade-price",{params:R(t,S())}).andThen(f(LastTradePriceSchema)))}var Mi=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),vf=k(e,d,c,b,a);async function Of(e,r){let t=l(r,Mi);return unwrap(e.clob.post("last-trades-prices",{json:Ke(t)}).andThen(f(LastTradePricesSchema)))}var Bi=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()}),Lf=k(e,d,c,b,a);async function wf(e,r){let t=l(r,Bi);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 Fi=z$1.object({cursor:PaginationCursorSchema.optional(),sponsored:z$1.boolean().optional()}).default({}),Mf=k(e,d,c,b,a);function Bf(e,r={}){let{cursor:t,...o}=l(r,Fi);return C(n=>e.clob.get("/rewards/markets/current",{params:R({...o,nextCursor:n},S())}).andThen(f(PaginatedCurrentRewardsSchema)).map(c=>({items:c.data,hasMore:c.nextCursor!==END_CURSOR,nextCursor:c.nextCursor===END_CURSOR?void 0:toPaginationCursor(c.nextCursor),totalCount:c.count})),t)}var Ui=z$1.object({conditionId:CtfConditionIdSchema,cursor:PaginationCursorSchema.optional(),sponsored:z$1.boolean().optional()}),Ff=k(e,d,c,b,a);function Uf(e,r){let{cursor:t,...o}=l(r,Ui);return C(n=>e.clob.get(`rewards/markets/${o.conditionId}`,{params:R({nextCursor:n,sponsored:o.sponsored},S())}).andThen(f(PaginatedMarketRewardsSchema)).map(c=>({items:c.data,hasMore:c.nextCursor!==END_CURSOR,nextCursor:c.nextCursor===END_CURSOR?void 0:toPaginationCursor(c.nextCursor),totalCount:c.count})),t)}function Ke(e){return e.map(({tokenId:r})=>({token_id:r}))}function zi(e){return e.map(({tokenId:r,side:t})=>({token_id:r,side:t}))}var Ni=z$1.object({ascending:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),pageSize:q.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}),Gi=z$1.object({getPositions:z$1.boolean().optional(),id:CommentIdSchema}),$i=z$1.object({address:z$1.string(),ascending:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),order:z$1.string().optional(),pageSize:q.default(20)}),Kf=k(e,d,c,b,a);function Yf(e,r){let{cursor:t,pageSize:o,...n}=l(r,Ni);return C(c=>{let a=O(c,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 Jf=k(e,d,c,b,a);async function Qf(e,r){let t=l(r,Gi);return unwrap(e.gamma.get(`comments/${t.id}`,{params:R({getPositions:t.getPositions},S())}).andThen(f(ListCommentsResponseSchema)))}var Zf=k(e,d,c,b,a);function Xf(e,r){let{address:t,cursor:o,pageSize:n,...c}=l(r,$i);return C(a=>{let y=O(a,n);return e.gamma.get(`comments/user_address/${t}`,{params:R({ascending:c.ascending,limit:y.pageSize+1,offset:y.offset,order:c.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 Ye(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,...c]=t.pathname.split("/").filter(Boolean),a$1=c[0];if(r==="market"&&o==="event"&&n!==void 0&&c.length<=1)return a$1??n;if(o!==r||n===void 0||c.length>0)throw new a(`Expected a Polymarket ${r} URL.`);return n}var Zi=z$1.object({ascending:z$1.boolean().optional(),closed:z$1.boolean().default(false),cursor:PaginationCursorSchema.optional(),pageSize:q.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()}),Xi=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()})]),ep=z$1.object({id:z$1.string()}),rp=z$1.object({id:z$1.string()}),fy=k(e,d,c,b,a);function yy(e,r={}){let t=l(r,Zi);return C(o=>e.gamma.get("/events/keyset",{params:tp({...t,cursor:o??t.cursor})}).andThen(f(ListEventsKeysetResponseSchema)).map(n=>({items:n.items,hasMore:n.nextCursor!==void 0,nextCursor:n.nextCursor})),t.cursor)}var Ey=k(e,d,c,b,a);async function gy(e,r){let t=l(r,Xi);if("id"in t)return unwrap(e.gamma.get(`events/${t.id}`,{params:op(t)}).andThen(f(EventSchema)));let o="url"in t?Ye(t.url,"event"):t.slug;return unwrap(e.gamma.get(`events/slug/${o}`,{params:np(t)}).andThen(f(EventSchema)))}var Ry=k(e,d,c,b,a);async function Sy(e,r){let t=l(r,ep);return unwrap(e.gamma.get(`events/${t.id}/tags`).andThen(f(FetchEventTagsResponseSchema)))}var hy=k(e,d,c,b,a);async function xy(e,r){let t=l(r,rp);return unwrap(e.data.get("/live-volume",{params:w(t)}).andThen(f(FetchEventLiveVolumeResponseSchema)))}function tp(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 op(e){return R({includeBestLines:e.includeBestLines,includeChat:e.includeChat,includeTemplate:e.includeTemplate,locale:e.locale},S())}function np(e){return R({includeBestLines:e.includeBestLines,includeChat:e.includeChat,includeTemplate:e.includeTemplate,locale:e.locale},S())}var up=z$1.object({cursor:PaginationCursorSchema.optional(),pageSize:q.default(20),timePeriod:TimePeriodSchema.optional()}),mp=z$1.object({timePeriod:TimePeriodSchema.optional()}),lp=z$1.object({category:LeaderboardCategorySchema.optional(),cursor:PaginationCursorSchema.optional(),pageSize:q.default(20),timePeriod:TimePeriodSchema.optional(),orderBy:LeaderboardOrderBySchema.optional(),user:z$1.string().optional(),userName:z$1.string().optional()}),Ly=k(e,d,c,b,a);function wy(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,up);return C(c=>{let a=O(c,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 My=k(e,d,c,b,a);async function By(e,r={}){let t=l(r,mp);return unwrap(e.data.get("/v1/builders/volume",{params:w(t)}).andThen(f(ListBuilderVolumeResponseSchema)))}var Fy=k(e,d,c,b,a);function Uy(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,lp);return C(c=>{let a=O(c,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 xp=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:q.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()}),Tp=z$1.object({id:z$1.string(),includeTag:z$1.boolean().optional(),locale:z$1.string().optional()}),Pp=z$1.object({slug:z$1.string(),includeTag:z$1.boolean().optional(),locale:z$1.string().optional()}),Cp=z$1.object({url:z$1.string(),includeTag:z$1.boolean().optional(),locale:z$1.string().optional()}),kp=z$1.union([Tp,Pp,Cp]),bp=z$1.object({id:z$1.string()}),Ip=z$1.object({limit:z$1.number().int().optional(),market:z$1.array(z$1.string()),minBalance:z$1.number().int().optional()}),Ap=z$1.object({market:z$1.array(z$1.string()).optional()}),qp=z$1.enum(["OPEN","CLOSED","ALL"]),vp=z$1.enum(["TOKENS","CASH_PNL","REALIZED_PNL","TOTAL_PNL"]),Op=z$1.enum(["ASC","DESC"]),Lp=z$1.object({cursor:PaginationCursorSchema.optional(),market:z$1.string(),pageSize:q.default(20),user:z$1.string().optional(),status:qp.optional(),sortBy:vp.optional(),sortDirection:Op.optional()}),Jy=k(e,d,c,b,a);function io(e,r={}){let t=l(r,xp);return C(o=>e.gamma.get("/markets/keyset",{params:wp({...t,cursor:o??t.cursor})}).andThen(f(ListMarketsKeysetResponseSchema)).map(n=>({items:n.items,hasMore:n.nextCursor!==void 0,nextCursor:n.nextCursor})),t.cursor)}var Qy=k(e,d,c,b,a);async function Zy(e,r){let t=l(r,kp);return "id"in t?Mp(e,t):"url"in t?no(e,{includeTag:t.includeTag,locale:t.locale,slug:Ye(t.url,"market")}):no(e,t)}var Xy=k(e,d,c,b,a);async function eE(e,r){let t=l(r,bp);return unwrap(e.gamma.get(`markets/${t.id}/tags`).andThen(f(FetchMarketTagsResponseSchema)))}var rE=k(e,d,c,b,a);async function tE(e,r){let t=l(r,Ip);return unwrap(e.data.get("/holders",{params:w(t)}).andThen(f(ListMarketHoldersResponseSchema)))}var oE=k(e,d,c,b,a);async function nE(e,r={}){let t=l(r,Ap);return unwrap(e.data.get("/oi",{params:w(t)}).andThen(f(ListOpenInterestResponseSchema)))}var aE=k(e,d,c,b,a);function sE(e,r){let{cursor:t,pageSize:o,...n}=l(r,Lp);return C(c=>{let a=O(c,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 wp(e){return R(e,S({cursor:"after_cursor",ids:"id",marketMakerAddresses:"market_maker_address",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 Mp(e,r){return unwrap(e.gamma.get(`markets/${r.id}`,{params:R({includeTag:r.includeTag,locale:r.locale},S())}).andThen(f(MarketSchema)))}var Up=z$1.object({orderId:z$1.string()}),zp=z$1.object({orderIds:z$1.array(z$1.string()).min(1).max(3e3)}),Dp=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"]}),fE=k(d,e,j$1,c,b,a);async function yE(e,r){let t=l(r,Up);return Ze(e,"/order",{orderID:t.orderId})}var EE=k(d,e,j$1,c,b,a);async function gE(e,r){let t=l(r,zp);return Ze(e,"/orders",t.orderIds)}var RE=k(d,e,j$1,c,b);async function SE(e){return Ze(e,"/cancel-all")}var hE=k(d,e,j$1,c,b,a);async function xE(e,r){let t=l(r,Dp);return Ze(e,"/cancel-market-orders",{asset_id:t.tokenId,market:t.market})}async function Ze(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)}),Hp=z$1.discriminatedUnion("side",[co.extend({side:z$1.literal(OrderSide.BUY),amount:PositiveDecimalNumberSchema}),co.extend({side:z$1.literal(OrderSide.SELL),shares:PositiveDecimalNumberSchema})]),qE=k(i,e,d,c,b,a);async function vE(e,r){let t=l(r,Hp),o=await Re(e,{tokenId:t.tokenId}),n=t.side===OrderSide.BUY?t.amount:t.shares;return hr(e,{amount:n,orderType:t.orderType,side:t.side,tickSize:o,tokenId:t.tokenId})}async function hr(e,r){let t=await eo(e,{tokenId:r.tokenId}),o=r.side===OrderSide.BUY?_p(t.asks,r.amount,r.orderType):Np(t.bids,r.amount,r.orderType);return invariant(Wp(o,r.tickSize),`Resolved market price fell outside the valid range for tick size ${r.tickSize}.`),o}function Wp(e,r){return e>=r&&e<=1-r}function _p(e,r,t){if(e.length===0)throw new i("No resting liquidity.");let o=0;for(let c=e.length-1;c>=0;c-=1){let a=e[c];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 Np(e,r,t){if(e.length===0)throw new i("No resting liquidity.");let o=0;for(let c=e.length-1;c>=0;c-=1){let a=e[c];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 Kp=z$1.array(z$1.custom()).min(1).max(15),DE=k(e,d,j$1,c,b),jE=k(e,d,j$1,c,b,a);function er(e){return async function(t){let o=fo(e,t);return unwrap(e.secureClob.post("/order",{json:o}).andThen(f(OrderResponseSchema)))}}function HE(e){return async function(t){let n=l(t,Kp).map(c=>fo(e,c));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 Fe(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 xe(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 _(e)<=r?e:Math.floor(e*10**r)/10**r}function Te(e,r){return _(e)<=r?e:Math.ceil(e*10**r)/10**r}function xr(e,r){return _(e)<=r?e:Math.round(e*10**r)/10**r}function _(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 c=Number.parseInt(t,10);return Math.max(0,n-c)}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 ec(e,{price:r.price,tokenId:r.tokenId}),o=rc({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 ec(e,r){let t=e.account,o=await Re(e,{tokenId:r.tokenId}),n=await Se(e,{tokenId:r.tokenId});return {exchangeAddress:xe(e,n),funderAddress:t.wallet,negRisk:n,price:tc(r.price,o),signerAddress:t.signer,tickSize:o}}function rc(e){let r=Fe(e.tickSize),t=xr(e.price,r.price);if(e.side===OrderSide.BUY){let c=oe(e.size,r.size),a=c*t;return _(a)>r.amount&&(a=Te(a,r.amount+4),_(a)>r.amount&&(a=oe(a,r.amount))),{offeredAmount:te(a),requestedAmount:te(c)}}let o=oe(e.size,r.size),n=o*t;return _(n)>r.amount&&(n=Te(n,r.amount+4),_(n)>r.amount&&(n=oe(n,r.amount))),{offeredAmount:te(o),requestedAmount:te(n)}}function tc(e,r){let t=Fe(r);if(e<r||e>1-r)throw new a(`Price must be between ${r} and ${1-r} for tick size ${r}.`);if(_(e)>t.price)throw new a(`Price must conform to tick size ${r} with at most ${t.price} decimal places.`);return xr(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)}),ho=z$1.discriminatedUnion("side",[So.extend({side:z$1.literal(OrderSide.BUY),amount:PositiveDecimalNumberSchema,maxSpend:PositiveDecimalNumberSchema.optional()}),So.extend({side:z$1.literal(OrderSide.SELL),shares:PositiveDecimalNumberSchema})]);async function xo(e,r){let t=await ac(e,r),o=sc({amount:t.resolvedAmount,price:t.price,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 ac(e,r){let t=e.account,o=await Re(e,{tokenId:r.tokenId}),n=r.side===OrderSide.BUY?r.amount:r.shares,c=await hr(e,{amount:n,orderType:r.orderType,side:r.side,tickSize:o,tokenId:r.tokenId}),a=await Se(e,{tokenId:r.tokenId}),y=await ic(e,{amount:n,builderCode:r.builderCode,maxSpend:r.side===OrderSide.BUY?r.maxSpend:void 0,price:c,side:r.side,tokenId:r.tokenId});return {exchangeAddress:xe(e,a),funderAddress:t.wallet,negRisk:a,price:c,resolvedAmount:y,signerAddress:t.signer,tickSize:o}}function sc(e){let r=Fe(e.tickSize),t=oe(e.price,r.price),o=oe(e.amount,r.size);if(e.side===OrderSide.BUY){let c=o/t;return _(c)>r.amount&&(c=Te(c,r.amount+4),_(c)>r.amount&&(c=oe(c,r.amount))),{offeredAmount:te(o),requestedAmount:te(c)}}let n=o*t;return _(n)>r.amount&&(n=Te(n,r.amount+4),_(n)>r.amount&&(n=oe(n,r.amount))),{offeredAmount:te(o),requestedAmount:te(n)}}async function ic(e,r){if(r.side!==OrderSide.BUY||r.maxSpend===void 0)return r.amount;let[t,o]=await Promise.all([pc(e,r.tokenId),cc(e,r.builderCode)]);return dc({amount:r.amount,builderTakerFeeRate:o,platformFeeExponent:t.exponent,platformFeeRate:t.rate,maxSpend:r.maxSpend,price:r.price})}async function pc(e,r){let t=await Qt(e,{tokenId:r});return (await Zt(e,{conditionId:t})).feeInfo}async function cc(e,r){return r===void 0?0:(await Xt(e,{builderCode:r})).taker}function dc(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 To="0x0000000000000000000000000000000000000000000000000000000000000000";function kr(e,r){let t=nt(r);return {builder:e.builderCode??To,chainId:e.chainId,exchangeAddress:e.exchangeAddress,expiration:e.expiration,maker:t.maker,makerAmount:e.offeredAmount.toString(),metadata:To,orderType:e.orderType,salt:uc().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 uc(){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 ko="Polymarket CTF Exchange",fc="DepositWallet",yc="1",Ir="0x0000000000000000000000000000000000000000000000000000000000000000",Ar="Order(uint256 salt,address maker,address signer,uint256 tokenId,uint256 makerAmount,uint256 takerAmount,uint8 side,uint8 signatureType,uint256 timestamp,bytes32 metadata,bytes32 builder)",Ec=Hash.keccak256(Bytes.fromString(Ar),{as:"Hex"}),gc=Hash.keccak256(Bytes.fromString("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),{as:"Hex"}),Rc=Hash.keccak256(Bytes.fromString(ko),{as:"Hex"}),Sc=[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],bo=[{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"}],hc=[{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 Io(e){let r=xc(e.domain,e.order);return e.order.signatureType!==SignatureType.POLY_1271?r:{domain:vo(e.domain),message:{chainId:e.domain.chainId,contents:r.message,name:fc,salt:Ir,verifyingContract:e.order.signer,version:yc},primaryType:"TypedDataSign",types:{Order:bo,TypedDataSign:hc}}}function Ao(e){if(e.order.signatureType!==SignatureType.POLY_1271)return e.signature;let r=Bytes.toHex(Bytes.fromString(Ar)),t=Ar.length.toString(16).padStart(4,"0");return expectErc1271Signature(`0x${e.signature.slice(2)}${Tc(e.domain).slice(2)}${Pc(e.order).slice(2)}${r.slice(2)}${t}`)}function qo(e){return {builder:e.builder??Ir,maker:e.maker,makerAmount:BigInt(e.makerAmount),metadata:e.metadata??Ir,salt:BigInt(e.salt),side:kc(e.side),signatureType:e.signatureType,signer:e.signer,takerAmount:BigInt(e.takerAmount),timestamp:BigInt(e.timestamp),tokenId:BigInt(e.tokenId)}}function xc(e,r){return {domain:vo(e),message:qo(r),primaryType:"Order",types:{EIP712Domain:Sc,Order:bo}}}function vo(e){return {chainId:e.chainId,name:ko,verifyingContract:e.exchange,version:e.protocolVersion}}function Tc(e){return expectHexString(Hash.keccak256(AbiParameters.encode([{type:"bytes32"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"address"}],[gc,Rc,Cc(e.protocolVersion),BigInt(e.chainId),e.exchange]),{as:"Hex"}))}function Pc(e){let r=qo(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"}],[Ec,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 Cc(e){return expectHexString(Hash.keccak256(Bytes.fromString(e),{as:"Hex"}))}function kc(e){return e===0||e===1?e:e===OrderSide.BUY?0:1}function vr(e){return Io({domain:Oo(e),order:e})}function Or(e,r){return Ao({domain:Oo(e),order:e,signature:r})}function Oo(e){return {chainId:e.chainId,exchange:e.exchangeAddress,protocolVersion:"2"}}function Lr(e){return {kind:"signOrder",payload:e}}var bc=k(i,e,d,j$1,c,b,a);async function wr(e,r){let t=l(r,ho);return async function*(){let o=await xo(e,t),n=kr(o,e.account),c=expectEvmSignature(yield Lr(vr(n)));return br(n,Or(n,c))}.call(null)}var Ic=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),c=expectEvmSignature(yield Lr(vr(n))),a=br(n,Or(n,c));return t.postOnly===true?{...a,postOnly:true}:a}.call(null)}var bg=bc;async function Ig(e,r){return wo(e,wr(e,r))}var Ag=Ic;async function qg(e,r){return wo(e,Mr(e,r))}async function wo(e,r){let t=await r;return async function*(){let o=yield*t;return er(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 qc(o,r.spenderAddress)}function qc(e,r){return Object.entries(e).find(([o])=>isSameEvmAddress(o,r))?.[1]??0n}var Vg=k(h,i,e,d,j$1,c,b,a);function vc(e,r){return wr(e,r).then(F(e.signer))}var Kg=k(h,i,e,d,j$1,f$1,g,c,b,a);function Yg(e,r){return vc(e,r).then(t=>zo(e,t))}var Jg=k(h,e,d,j$1,c,b,a);function Oc(e,r){return Mr(e,r).then(F(e.signer))}var Qg=k(h,e,d,j$1,f$1,g,c,b,a);function Zg(e,r){return Oc(e,r).then(t=>zo(e,t))}async function zo(e,r){let t=er(e);try{return await t(r)}catch(o){if(!wc(o))throw o;let n=await Lc(e,r,t);if(n===void 0)throw o;return n}}async function Lc(e,r,t){return await Mc(e,r)?t(r):void 0}function wc(e){return e instanceof d&&e.status===400&&e.message.includes("allowance is not enough")}async function Mc(e,r){let t=await Se(e,{tokenId:r.tokenId}),o=xe(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 _c=z$1.enum(["CURRENT","INITIAL","TOKENS","CASHPNL","PERCENTPNL","TITLE","RESOLVING","PRICE","AVGPRICE"]),Do=z$1.enum(["ASC","DESC"]),Nc=z$1.enum(["REALIZEDPNL","TITLE","PRICE","AVGPRICE","TIMESTAMP"]),Gc=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:q.default(20),sortBy:_c.optional(),sortDirection:Do.optional(),title:z$1.string().max(100).optional()}).refine(e=>!(e.market&&e.eventId),{message:"Provide market or eventId, not both",path:["eventId"]}),$c=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:q.default(20),sortBy:Nc.optional(),sortDirection:Do.optional()}).refine(e=>!(e.market&&e.eventId),{message:"Provide market or eventId, not both",path:["eventId"]}),Vc=z$1.object({cursor:PaginationCursorSchema.optional(),user:z$1.string(),pageSize:q.default(20),status:ComboPositionStatusSchema.optional(),conditionId:ComboConditionIdSchema.optional(),positionId:PositionIdSchema.optional()}),Kc=z$1.object({user:z$1.string(),market:z$1.array(z$1.string()).optional()}),Yc=z$1.object({user:z$1.string()}),Jc=z$1.object({user:z$1.string()}),cR=k(e,d,c,b,a);function dR(e,r){let{cursor:t,pageSize:o,...n}=l(r,Gc);return C(c=>{let a=O(c,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 uR=k(e,d,c,b,a),mR=k(e,d,c,b,a);function lR(e,r){let{cursor:t,pageSize:o,...n}=l(r,$c);return C(c=>{let a=O(c,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 fR(e,r){let{cursor:t,pageSize:o,...n}=l(r,Vc);return C(c=>{let a=O(c,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 yR=k(e,d,c,b,a);async function ER(e,r){let t=l(r,Kc);return unwrap(e.data.get("/value",{params:w(t)}).andThen(f(FetchPortfolioValueResponseSchema)))}var gR=k(e,d,c,b,a);async function RR(e,r){let t=l(r,Yc);return unwrap(e.data.get("/traded",{params:w(t)}).andThen(f(TradedSchema)))}var SR=k(e,d,c,b,a);async function hR(e,r){let t=l(r,Jc);return unwrap(e.data.get("/v1/accounting/snapshot",{params:w(t)}).andThen(Jr))}var No=32,Go=3n,Wo=50,Zc=(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"}],[Go,r])),o=toComboConditionId(`0x03${t.slice(34)}0000000000000000000000000000`);return {conditionId:o,positionIds:[toPositionId(BigInt(`${o}00`).toString()),toPositionId(BigInt(`${o}01`).toString())]}}function $o(e){if(e.length===0||e.length>Wo)throw new a(`Combo legs must include 1 to ${Wo} position IDs`);let r=e.map(t=>{let o=Ko(t),n=o.toString(16).padStart(No*2,"0"),c=Number.parseInt(n.slice(0,2),16),a$1=Number.parseInt(n.slice(-2),16);if(c!==1&&c!==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 Vo(e){let t=Ko(e).toString(16).padStart(No*2,"0"),o=BigInt(`0x${t.slice(0,2)}`),n=Number.parseInt(t.slice(-2),16);if(o!==Go)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 Ko(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>Zc)throw new a("Position ID must be a uint256 value");return t}var Yo=z$1.object({amount:z$1.bigint().min(0n),conditionId:CtfConditionIdSchema,metadata:j.optional()}),ed=z$1.object({amount:z$1.bigint().positive(),legs:z$1.array(PositionIdSchema).min(1).max(50),metadata:j.optional()}),Jo=z$1.array(PositionIdSchema).min(1).max(50).transform($o),rd=z$1.object({amount:z$1.bigint().positive(),legs:Jo,metadata:j.optional()}),td=z$1.union([Yo.extend({legs:z$1.never().optional()}),ed.extend({conditionId:z$1.never().optional()})]),Qo=k(e,d,c,b,a),jR=Qo,HR=Qo,Zo=k(e,d,c,b,a),WR=Zo,_R=Zo,Xo=k(e,d,c,b,a),NR=Xo,GR=Xo;async function en(e,r){let t=l(r,Yo),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 rn(e,r){let t=l(r,rd),o=ur(e.environment.combinatorialModule,t.legs),n=zr(t.legs),c=qt(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,c)))):yield*await G(e,{calls:[o,c],metadata:t.metadata??`Split ${t.amount} combo positions for condition ${n.conditionId}`})}.call(null)}async function od(e,r){let t=l(r,td);return t.legs!==void 0?rn(e,t):en(e,t)}var tn=k(h,e,d,j$1,f$1,g,c,b,a),$R=tn,VR=tn;function KR(e,r){return en(e,r).then(F(e.signer))}function YR(e,r){return rn(e,r).then(F(e.signer))}function JR(e,r){return od(e,r).then(F(e.signer))}var on=z$1.object({amount:z$1.union([z$1.bigint().positive(),z$1.literal("max")]),conditionId:CtfConditionIdSchema,metadata:j.optional()}),nd=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()}),ad=z$1.object({amount:z$1.union([z$1.bigint().positive(),z$1.literal("max")]),legs:Jo,metadata:j.optional()}),sd=z$1.union([on.extend({legs:z$1.never().optional()}),nd.extend({conditionId:z$1.never().optional()})]);async function nn(e,r){let t=l(r,on),o=await Wr(e,{conditionId:t.conditionId}),n=cr(await e.rpc.ethCall(pr(o.positionErc1155Address,e.account.wallet,o.tokenIds))),c=mn(o.conditionId,n,t.amount),a=It(o.adapterAddress,e.environment.collateralToken,o.conditionId,c);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 ${c} positions for market ${o.marketId} (condition ${o.conditionId})`})}.call(null)}async function an(e,r){let t=l(r,ad),o=ur(e.environment.combinatorialModule,t.legs),n=zr(t.legs),c=cr(await e.rpc.ethCall(pr(e.environment.positionManager,e.account.wallet,n.positionIds))),a=mn(n.conditionId,c,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 id(e,r){let t=l(r,sd);return t.legs!==void 0?an(e,t):nn(e,t)}var sn=k(h,e,d,j$1,f$1,g,c,b,a),QR=sn,ZR=sn;function XR(e,r){return nn(e,r).then(F(e.signer))}function eS(e,r){return an(e,r).then(F(e.signer))}function rS(e,r){return id(e,r).then(F(e.signer))}var pn=z$1.object({conditionId:CtfConditionIdSchema,marketId:z$1.never().optional(),amount:z$1.never().optional(),positionId:z$1.never().optional(),metadata:j.optional()}),cn=z$1.object({conditionId:z$1.never().optional(),marketId:MarketIdSchema,amount:z$1.never().optional(),positionId:z$1.never().optional(),metadata:j.optional()}),pd=z$1.union([pn,cn]),dn=z$1.object({positionId:PositionIdSchema,conditionId:z$1.never().optional(),marketId:z$1.never().optional(),metadata:j.optional()}),cd=z$1.union([pn,cn,dn]);async function dd(e,r){let t=l(r,pd),o=await Wr(e,t.conditionId!==void 0?{conditionId:t.conditionId}:{marketId:t.marketId}),n=At(o.adapterAddress,e.environment.collateralToken,o.conditionId);return async function*(){return e.account.walletType===WalletType.EOA?z(yield un(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 ud(e,r){let t=l(r,dn),o=Vo(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 c=Ot(e.environment.protocolV2Router,o.conditionId,o.outcomeIndex,n);return async function*(){return e.account.walletType===WalletType.EOA?z(yield un(D(e.environment.chainId,c))):yield*await G(e,{calls:[c],metadata:t.metadata??`Redeem combo position ${t.positionId}`})}.call(null)}async function md(e,r){let t=l(r,cd);return t.positionId!==void 0?ud(e,t):dd(e,t)}var tS=k(h,e,d,j$1,c,b,a);function oS(e,r){return md(e,r).then(F(e.signer))}function Dr(e){return {kind:"sendSplitPositionTransaction",request:e}}function jr(e){return {kind:"sendMergePositionsTransaction",request:e}}function un(e){return {kind:"sendRedeemPositionsTransaction",request:e}}async function Wr(e,r){let t=r.conditionId!==void 0?`condition ${r.conditionId}`:`market ${r.marketId}`,n=(await io(e,r.conditionId!==void 0?{conditionIds:[r.conditionId],pageSize:1}:{ids:[ld(r.marketId)],pageSize:1}).firstPage()).items;invariant(n.length===1,`Expected exactly one ${t}`);let c=n[0];invariant(c!==void 0,`No market found for ${t}`);let a=fd(c,t);return {...a,adapterAddress:a.negRisk?e.environment.negRiskCollateralAdapter:e.environment.collateralAdapter,positionErc1155Address:a.negRisk?e.environment.negRiskAdapter:e.environment.conditionalTokens}}function ld(e){let r=Number(e);if(!Number.isInteger(r))throw new a(`Market ID must be an integer, received ${e}`);return r}function fd(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 mn(e,r,t){let o=yd(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 yd(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 hd=z$1.object({address:z$1.string()}),mS=k(e,d,c,b,a);async function lS(e,r){let t=l(r,hd);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;}},gS=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;}},RS=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;}},SS=k(Gr,f$1,c),hS=k(c);async function xS(e){return e.webSockets.rfqQuoter.connect()}var Pd=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:q.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()}),zS=k(e,d,c,b,a);function DS(e,r){let{cursor:t,pageSize:o,...n}=l(r,Pd);return C(c=>{let a=O(c,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:Cd(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 Cd(e){return {events:e.events??[],profiles:e.profiles??[],tags:e.tags??[]}}var qd=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:q.default(20),recurrence:z$1.enum(["daily","weekly","monthly"]).optional(),slug:z$1.array(z$1.string()).optional()}),vd=z$1.object({id:z$1.string(),locale:z$1.string().optional()}),JS=k(e,d,c,b,a);function QS(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,qd);return C(c=>{let a=O(c,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 ZS=k(e,d,c,b,a);async function XS(e,r){let t=l(r,vd);return unwrap(e.gamma.get(`series/${t.id}`,{params:R({locale:t.locale},S())}).andThen(f(SeriesSchema)))}var ah=k(e,d,c,b);async function sh(e){return unwrap(e.gamma.get("/sports").andThen(f(ListSportsMetadataResponseSchema)))}var ih=k(e,d,c,b);async function ph(e){return unwrap(e.gamma.get("/sports/market-types").andThen(f(SportsMarketTypesResponseSchema)))}async function mh(e,r){let t=await Promise.all(r.map(o=>Bd(e,o)));return Fd(t)}function Bd(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 Fd(e){let r;async function t(){r===void 0&&(r=Promise.all(e.map(n=>n.close())).then(()=>{})),await r;}let o=Md(...e);return {close:t,[Symbol.asyncIterator](){return o[Symbol.asyncIterator]()}}}var Dd=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:q.default(20)}),jd=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()})]),Hd=z$1.object({id:z$1.string(),omitEmpty:z$1.boolean().optional(),status:z$1.enum(["active","closed","all"]).optional()}),Wd=z$1.object({slug:z$1.string()}),_d=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()}),Nd=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()}),Ph=k(e,d,c,b,a);function Ch(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,Dd);return C(c=>{let a=O(c,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 kh=k(e,d,c,b,a);async function bh(e,r){let t=l(r,jd);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 Ih=k(e,d,c,b,a);async function Ah(e,r){if("id"in r){let o=l(r,Hd);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,Wd);return unwrap(e.gamma.get(`tags/slug/${t.slug}/related-tags`).andThen(f(ListRelatedTagsResponseSchema)))}var qh=k(e,d,c,b,a);async function vh(e,r){if("id"in r){let o=l(r,_d);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,Nd);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 Vd=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:q.default(20),providerId:z$1.array(z$1.number().int()).optional()}),jh=k(e,d,c,b,a);function Hh(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,Vd);return C(c=>{let a=O(c,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 Yd=z$1.object({amount:z$1.bigint(),metadata:j.optional(),recipientAddress:EvmAddressSchema,tokenAddress:EvmAddressSchema}),Zh=k(a);async function Jd(e,r){let t=l(r,Yd);return async function*(){return e.account.walletType===WalletType.EOA?z(yield Qd(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 Xh=k(h,e,d,j$1,c,b,a);function ex(e,r){return Jd(e,r).then(F(e.signer))}function Qd(e){return {kind:"sendErc20TransferTransaction",request:e}}export{Jm as $,Ds as $a,xy as $b,dR as $c,bm as A,_u as Aa,Cf as Ab,qE as Ac,KR as Ad,Zh as Ae,ur as B,Nu as Ba,kf as Bb,vE as Bc,YR as Bd,Jd as Be,Lt as C,Gu as Ca,bf as Cb,hr as Cc,JR as Cd,Xh as Ce,wt as D,$u as Da,If as Db,DE as Dc,nn as Dd,ex as De,bl as E,Vu as Ea,Af as Eb,jE as Ec,an as Ed,$s as F,Ku as Fa,qf as Fb,er as Fc,id as Fd,Il as G,Yu as Ga,vf as Gb,HE as Gc,sn as Gd,Vs as H,Ju as Ha,Of as Hb,Io as Hc,QR as Hd,Al as I,Qu as Ia,Lf as Ib,Ao as Ic,ZR as Id,ql as J,Zu as Ja,wf as Jb,Lr as Jc,XR as Jd,vl as K,Xu as Ka,Mf as Kb,bc as Kc,eS as Kd,Ol as L,em as La,Bf as Lb,wr as Lc,rS as Ld,Ll as M,dm as Ma,Ff as Mb,Ic as Mc,dd as Md,wl as N,um as Na,Uf as Nb,Mr as Nc,ud as Nd,Ml as O,mm as Oa,Kf as Ob,bg as Oc,md as Od,Bl as P,lm as Pa,Yf as Pb,Ig as Pc,tS as Pd,Fl as Q,vm as Qa,Jf as Qb,Ag as Qc,oS as Qd,Ul as R,z as Ra,Qf as Rb,qg as Rc,mS as Rd,zl as S,ll as Sa,Zf as Sb,Vg as Sc,lS as Sd,Dl as T,Fs as Ta,Xf as Tb,vc as Tc,_r as Td,l as U,fl as Ua,fy as Ub,Kg as Uc,gS as Ud,Zr as V,Dt as Va,yy as Vb,Yg as Vc,Nr as Vd,Eu as W,yl as Wa,Ey as Wb,Jg as Wc,RS as Wd,nt as X,zs as Xa,gy as Xb,Oc as Xc,Gr as Xd,it as Y,El as Ya,Ry as Yb,Qg as Yc,SS as Yd,Bm as Z,jt as Za,Sy as Zb,Zg as Zc,hS as Zd,Mt as _,gl as _a,hy as _b,cR as _c,xS as _d,$ as a,Er as aa,Rl as ab,Ly as ac,uR as ad,Rm as b,Qm as ba,Sl as bb,wy as bc,mR as bd,He as c,Zm as ca,Yl as cb,My as cc,lR as cd,ht as d,j as da,Jl as db,By as dc,fR as dd,xt as e,Xm as ea,pf as eb,Fy as ec,yR as ed,We as f,el as fa,cf as fb,Uy as fc,ER as fd,zS as fe,Tt as g,hs as ga,df as gb,Jy as gc,gR as gd,DS as ge,Pt as h,rl as ha,uf as hb,io as hc,RR as hd,JS as he,Ct as i,G as ia,mf as ib,Qy as ic,SR as id,QS as ie,kt as j,tl as ja,Re as jb,Zy as jc,hR as jd,ZS as je,pr as k,qu as ka,lf as kb,Xy as kc,XS as ke,cr as l,vu as la,Se as lb,eE as lc,Qo as ld,ah as le,Sm as m,Ou as ma,ff as mb,rE as mc,jR as md,sh as me,dr as n,Lu as na,Qt as nb,tE as nc,HR as nd,ih as ne,hm as o,wu as oa,yf as ob,oE as oc,Zo as od,ph as oe,xm as p,Mu as pa,Zt as pb,nE as pc,WR as pd,mh as pe,bt as q,Bu as qa,Ef as qb,aE as qc,_R as qd,Ph as qe,Tm as r,Fu as ra,Xt as rb,sE as rc,Xo as rd,Ch as re,It as s,Uu as sa,gf as sb,fE as sc,NR as sd,kh as se,At as t,zu as ta,Rf as tb,yE as tc,GR as td,bh as te,Pm as u,Du as ua,Sf as ub,EE as uc,en as ud,Ih as ue,qt as v,ju as va,hf as vb,gE as vc,rn as vd,Ah as ve,Cm as w,Hu as wa,xf as wb,RE as wc,od as wd,qh as we,vt as x,sr as xa,eo as xb,SE as xc,tn as xd,vh as xe,km as y,Wu as ya,Tf as yb,hE as yc,$R as yd,jh as ye,Ot as z,dt as za,Pf as zb,xE as zc,VR as zd,Hh as ze};//# sourceMappingURL=chunk-76B5WBIO.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-76B5WBIO.js.map
|