@polymarket/client 0.1.0-beta.1 → 0.1.0-beta.3
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/README.md +2 -10
- package/dist/actions/index.d.ts +13 -12
- package/dist/actions/index.js +1 -1
- package/dist/chunk-RX3J5EHP.js +2 -0
- package/dist/chunk-RX3J5EHP.js.map +1 -0
- package/dist/ethers-v5.d.ts +2 -1
- package/dist/index.d.ts +53 -6
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{sports-BDLhQVTP.d.ts → sports-BIOQ9MxA.d.ts} +31 -5
- package/dist/{types-D7tLX0ye.d.ts → types-CYRIvfiu.d.ts} +1276 -350
- package/dist/viem.d.ts +2 -1
- package/package.json +12 -4
- package/dist/chunk-VQOVE5SC.js +0 -2
- package/dist/chunk-VQOVE5SC.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# `@polymarket/client`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@polymarket/client` is the official TypeScript client for building on Polymarket.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
pnpm add @polymarket/client
|
|
8
|
+
pnpm add @polymarket/client@beta
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
@@ -25,14 +25,6 @@ for await (const page of result) {
|
|
|
25
25
|
}
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
## Development
|
|
29
|
-
|
|
30
|
-
From the monorepo root:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
pnpm --filter @polymarket/client build
|
|
34
|
-
```
|
|
35
|
-
|
|
36
28
|
## License
|
|
37
29
|
|
|
38
30
|
MIT
|
package/dist/actions/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { e as ApproveErc1155ForAllError, f as ApproveErc20Error, C as CancelAllError, j as CancelMarketOrdersError, bs as CancelMarketOrdersRequest, k as CancelOrderError, bt as CancelOrderRequest, l as CancelOrdersError, bu as CancelOrdersRequest, bv as CommentsEventType, bw as CommentsSubscription, bx as CryptoPricesEventType, by as CryptoPricesSubscription, bz as DeployDepositWalletError, s as DownloadAccountingSnapshotError, bA as DownloadAccountingSnapshotRequest, t as DropNotificationsError, bB as DropNotificationsRequest, bC as EquityPricesEventType, bD as EquityPricesSubscription, bE as Erc1155ApprovalForAllWorkflow, bF as Erc1155ApprovalForAllWorkflowRequest, bG as Erc20ApprovalWorkflow, bH as Erc20ApprovalWorkflowRequest, bI as Erc20TransferWorkflow, bJ as Erc20TransferWorkflowRequest, bK as EstimateMarketBuyPriceRequest, u as EstimateMarketPriceError, bL as EstimateMarketPriceRequest, bM as EstimateMarketSellPriceRequest, bN as EventForSubscriptionSpec, bO as EventForSubscriptionSpecs, bP as FetchBalanceAllowanceError, bQ as FetchBalanceAllowanceRequest, bR as FetchBuilderFeeRatesError, bS as FetchBuilderFeeRatesRequest, F as FetchClosedOnlyModeError, v as FetchCommentsByIdError, bT as FetchCommentsByIdRequest, w as FetchEventError, x as FetchEventLiveVolumeError, bU as FetchEventLiveVolumeRequest, bV as FetchEventRequest, y as FetchEventTagsError, bW as FetchEventTagsRequest, bX as FetchExecuteParamsError, bY as FetchExecuteParamsRequest, bZ as FetchGaslessTransactionRequest, z as FetchLastTradePriceError, b_ as FetchLastTradePriceRequest, G as FetchLastTradePricesError, b$ as FetchLastTradePricesRequest, H as FetchMarketError, c0 as FetchMarketInfoError, c1 as FetchMarketInfoRequest, c2 as FetchMarketRequest, I as FetchMarketTagsError, c3 as FetchMarketTagsRequest, J as FetchMidpointError, c4 as FetchMidpointRequest, K as FetchMidpointsError, c5 as FetchMidpointsRequest, c6 as FetchNegRiskError, c7 as FetchNegRiskRequest, L as FetchNotificationsError, M as FetchOrderBookError, c8 as FetchOrderBookRequest, N as FetchOrderBooksError, c9 as FetchOrderBooksRequest, O as FetchOrderError, ca as FetchOrderRequest, P as FetchOrderScoringError, cb as FetchOrderScoringRequest, Q as FetchOrdersScoringError, cc as FetchOrdersScoringRequest, R as FetchPortfolioValueError, cd as FetchPortfolioValueRequest, V as FetchPriceError, W as FetchPriceHistoryError, ce as FetchPriceHistoryRequest, cf as FetchPriceRequest, X as FetchPricesError, cg as FetchPricesRequest, Y as FetchPublicProfileError, ch as FetchPublicProfileRequest, Z as FetchRelatedTagResourcesError, ci as FetchRelatedTagResourcesRequest, _ as FetchRelatedTagsError, cj as FetchRelatedTagsRequest, $ as FetchRewardPercentagesError, a0 as FetchSeriesError, ck as FetchSeriesRequest, a1 as FetchSpreadError, cl as FetchSpreadRequest, a2 as FetchSpreadsError, cm as FetchSpreadsRequest, a3 as FetchTagError, cn as FetchTagRequest, co as FetchTickSizeError, cp as FetchTickSizeRequest, a4 as FetchTotalEarningsForUserForDayError, cq as FetchTotalEarningsForUserForDayRequest, a5 as FetchTradedMarketCountError, cr as FetchTradedMarketCountRequest, cs as GaslessTransactionMetadataSchema, ct as GaslessWorkflow, cu as GaslessWorkflowRequest, a7 as IsGaslessReadyError, cv as IsGaslessReadyRequest, a8 as ListAccountTradesError, cw as ListAccountTradesRequest, a9 as ListActivityError, cx as ListActivityRequest, aa as ListBuilderLeaderboardError, cy as ListBuilderLeaderboardRequest, ab as ListBuilderTradesError, cz as ListBuilderTradesRequest, ac as ListBuilderVolumeError, cA as ListBuilderVolumeRequest, ad as ListClosedPositionsError, cB as ListClosedPositionsRequest, ae as ListCommentsByUserAddressError, cC as ListCommentsByUserAddressRequest, af as ListCommentsError, cD as ListCommentsRequest, ag as ListCurrentRewardsError, cE as ListCurrentRewardsRequest, ah as ListEventsError, cF as ListEventsRequest, ai as ListMarketHoldersError, cG as ListMarketHoldersRequest, aj as ListMarketPositionsError, cH as ListMarketPositionsRequest, ak as ListMarketRewardsError, cI as ListMarketRewardsRequest, al as ListMarketsError, cJ as ListMarketsRequest, am as ListOpenInterestError, cK as ListOpenInterestRequest, an as ListOpenOrdersError, cL as ListOpenOrdersRequest, ao as ListPositionsError, cM as ListPositionsRequest, ap as ListSeriesError, cN as ListSeriesRequest, aq as ListTagsError, cO as ListTagsRequest, ar as ListTeamsError, cP as ListTeamsRequest, as as ListTraderLeaderboardError, cQ as ListTraderLeaderboardRequest, at as ListTradesError, cR as ListTradesRequest, au as ListUserEarningsAndMarketsConfigError, cS as ListUserEarningsAndMarketsConfigRequest, av as ListUserEarningsForDayError, cT as ListUserEarningsForDayRequest, cU as MarketEventType, cV as MarketSubscription, aw as MergePositionsError, cW as MergePositionsWorkflow, cX as MergePositionsWorkflowRequest, cY as OrderDraft, cZ as OrderPostingWorkflow, c_ as OrderWorkflow, c$ as OrderWorkflowRequest, aA as PostOrderError, aB as PostOrdersError, d0 as PostOrdersRequest, d1 as PrepareErc1155ApprovalForAllError, d2 as PrepareErc1155ApprovalForAllRequest, d3 as PrepareErc20ApprovalError, d4 as PrepareErc20ApprovalRequest, d5 as PrepareErc20TransferError, d6 as PrepareErc20TransferRequest, d7 as PrepareGaslessTransactionError, d8 as PrepareGaslessTransactionRequest, d9 as PrepareLimitOrderRequest, da as PrepareMarketBuyOrderRequest, db as PrepareMarketOrderRequest, dc as PrepareMarketSellOrderRequest, dd as PrepareMergePositionsError, de as PrepareMergePositionsRequest, df as PrepareRedeemPositionsError, dg as PrepareRedeemPositionsRequest, dh as PrepareSplitPositionError, di as PrepareSplitPositionRequest, dj as PrepareTradingApprovalsError, dk as PublicRealtimeEvent, dl as PublicRealtimeTopic, dm as PublicSubscriptionSpec, aJ as RedeemPositionsError, dn as RedeemPositionsWorkflow, dp as RedeemPositionsWorkflowRequest, dq as ResolveConditionByTokenError, dr as ResolveConditionByTokenRequest, aM as SearchError, ds as SearchRequest, dt as SearchResults, du as SecureRealtimeEvent, dv as SecureRealtimeTopic, dw as SecureSubscriptionSpec, b0 as SetupTradingApprovalsError, dx as SignedOrder, b3 as SplitPositionError, dy as SplitPositionWorkflow, dz as SplitPositionWorkflowRequest, dA as SportsEventType, dB as SportsSubscription, dC as SubscribeError, dD as SubscriptionHandle, dE as TradingApprovalsWorkflow, dF as TradingApprovalsWorkflowRequest, b8 as TransferErc20Error, dG as UpdateBalanceAllowanceError, dH as UpdateBalanceAllowanceRequest, dI as UserEventType, dJ as UserSubscription, dK as WaitForGaslessTransactionError, dL as approveErc1155ForAll, dM as approveErc20, dN as cancelAll, dO as cancelMarketOrders, dP as cancelOrder, dQ as cancelOrders, dR as deployDepositWallet, dS as downloadAccountingSnapshot, dT as dropNotifications, dU as estimateMarketPrice, dV as fetchBalanceAllowance, dW as fetchBuilderFeeRates, dX as fetchBuilderVolume, dY as fetchClosedOnlyMode, dZ as fetchCommentsById, d_ as fetchEvent, d$ as fetchEventLiveVolume, e0 as fetchEventTags, e1 as fetchExecuteParams, e2 as fetchLastTradePrice, e3 as fetchLastTradePrices, e4 as fetchMarket, e5 as fetchMarketInfo, e6 as fetchMarketTags, e7 as fetchMidpoint, e8 as fetchMidpoints, e9 as fetchNegRisk, ea as fetchNotifications, eb as fetchOrder, ec as fetchOrderBook, ed as fetchOrderBooks, ee as fetchOrderScoring, ef as fetchOrdersScoring, eg as fetchPortfolioValue, eh as fetchPrice, ei as fetchPriceHistory, ej as fetchPrices, ek as fetchPublicProfile, el as fetchRelatedTagResources, em as fetchRelatedTags, en as fetchRewardPercentages, eo as fetchSeries, ep as fetchSpread, eq as fetchSpreads, er as fetchTag, es as fetchTickSize, et as fetchTotalEarningsForUserForDay, eu as fetchTradedMarketCount, ev as fetchTransaction, ew as isGaslessReady, ex as listAccountTrades, ey as listActivity, ez as listBuilderLeaderboard, eA as listBuilderTrades, eB as listClosedPositions, eC as listComments, eD as listCommentsByUserAddress, eE as listCurrentRewards, eF as listEvents, eG as listMarketHolders, eH as listMarketPositions, eI as listMarketRewards, eJ as listMarkets, eK as listOpenInterest, eL as listOpenOrders, eM as listPositions, eN as listSeries, eO as listTags, eP as listTeams, eQ as listTraderLeaderboard, eR as listTrades, eS as listUserEarningsAndMarketsConfig, eT as listUserEarningsForDay, eU as mergePositions, eV as postOrder, eW as postOrders, eX as prepareErc1155ApprovalForAll, eY as prepareErc20Approval, eZ as prepareErc20Transfer, e_ as prepareGaslessTransaction, e$ as prepareMergePositions, f0 as prepareRedeemPositions, f1 as prepareSplitPosition, f2 as prepareTradingApprovals, f3 as redeemPositions, f4 as resolveConditionByToken, f5 as search, f6 as setupTradingApprovals, f7 as splitPosition, f8 as subscribe, f9 as transferErc20, fa as updateBalanceAllowance } from '../types-D7tLX0ye.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-CYRIvfiu.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-CYRIvfiu.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-BIOQ9MxA.js';
|
|
7
|
+
export { ComboPositionStatus } from '@polymarket/bindings/data';
|
|
7
8
|
export { CommentsEvent, CryptoPricesBinanceEvent, CryptoPricesChainlinkEvent, CryptoPricesEvent, CustomMarketEvent, EquityPricesEvent, MarketEvent, SportsEvent, StandardMarketEvent, UserEvent } from '@polymarket/bindings/subscriptions';
|
|
9
|
+
export { RfqConfirmationDecision, RfqConfirmationRequest, RfqDirection, RfqErrorCode, RfqExecutionStatus, RfqExecutionUpdate, RfqId, RfqQuoteId, RfqQuoteRequest, RfqRequestedSize, RfqRequestedSizeUnit, RfqRequestorPublicId, RfqSide } from '@polymarket/bindings/rfq';
|
|
8
10
|
import '@polymarket/bindings/gamma';
|
|
9
11
|
import '@polymarket/bindings/relayer';
|
|
10
12
|
import 'zod';
|
|
11
|
-
import '@polymarket/bindings/data';
|
|
12
13
|
import 'ox';
|
|
13
14
|
|
|
14
15
|
type ApiKeyAuthRequest = {
|
|
@@ -25,7 +26,7 @@ declare const CreateApiKeyError: {
|
|
|
25
26
|
* Creates a new API key from a signed L1 auth payload.
|
|
26
27
|
*
|
|
27
28
|
* @remarks
|
|
28
|
-
* This is a low-level
|
|
29
|
+
* This is a low-level function. Most SDK consumers should prefer the client instance API.
|
|
29
30
|
*
|
|
30
31
|
* @example
|
|
31
32
|
* ```ts
|
|
@@ -44,7 +45,7 @@ declare const DeriveApiKeyError: {
|
|
|
44
45
|
* Derives an existing API key from a signed L1 auth payload.
|
|
45
46
|
*
|
|
46
47
|
* @remarks
|
|
47
|
-
* This is a low-level
|
|
48
|
+
* This is a low-level function. Most SDK consumers should prefer the client instance API.
|
|
48
49
|
*
|
|
49
50
|
* @example
|
|
50
51
|
* ```ts
|
|
@@ -63,7 +64,7 @@ declare const CreateOrDeriveApiKeyError: {
|
|
|
63
64
|
* Creates an API key and falls back to derivation when it already exists.
|
|
64
65
|
*
|
|
65
66
|
* @remarks
|
|
66
|
-
* This is a low-level
|
|
67
|
+
* This is a low-level function. Most SDK consumers should prefer the client instance API.
|
|
67
68
|
*
|
|
68
69
|
* @example
|
|
69
70
|
* ```ts
|
|
@@ -82,7 +83,7 @@ declare const FetchApiKeysError: {
|
|
|
82
83
|
* Fetches all API keys associated with the authenticated client.
|
|
83
84
|
*
|
|
84
85
|
* @remarks
|
|
85
|
-
* This is a low-level
|
|
86
|
+
* This is a low-level function. Most SDK consumers should prefer the client instance API.
|
|
86
87
|
*
|
|
87
88
|
* @example
|
|
88
89
|
* ```ts
|
|
@@ -101,7 +102,7 @@ declare const DeleteApiKeyError: {
|
|
|
101
102
|
* Deletes the authenticated API key.
|
|
102
103
|
*
|
|
103
104
|
* @remarks
|
|
104
|
-
* This is a low-level
|
|
105
|
+
* This is a low-level function. Most SDK consumers should prefer the client instance API.
|
|
105
106
|
*
|
|
106
107
|
* @example
|
|
107
108
|
* ```ts
|
|
@@ -121,7 +122,7 @@ declare const CreateBuilderApiKeyError: {
|
|
|
121
122
|
* Creates a new builder API key for the authenticated client.
|
|
122
123
|
*
|
|
123
124
|
* @remarks
|
|
124
|
-
* This is a low-level
|
|
125
|
+
* This is a low-level function. Most SDK consumers should prefer the client instance API.
|
|
125
126
|
*
|
|
126
127
|
* @example
|
|
127
128
|
* ```ts
|
|
@@ -141,7 +142,7 @@ declare const FetchBuilderApiKeysError: {
|
|
|
141
142
|
* Fetches builder API keys associated with the authenticated client.
|
|
142
143
|
*
|
|
143
144
|
* @remarks
|
|
144
|
-
* This is a low-level
|
|
145
|
+
* This is a low-level function. Most SDK consumers should prefer the client instance API.
|
|
145
146
|
*
|
|
146
147
|
* @example
|
|
147
148
|
* ```ts
|
|
@@ -161,7 +162,7 @@ declare const RevokeBuilderApiKeyError: {
|
|
|
161
162
|
* Revokes a builder API key.
|
|
162
163
|
*
|
|
163
164
|
* @remarks
|
|
164
|
-
* This is a low-level
|
|
165
|
+
* This is a low-level function. Most SDK consumers should prefer the client instance API.
|
|
165
166
|
*
|
|
166
167
|
* @example
|
|
167
168
|
* ```ts
|
package/dist/actions/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{
|
|
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-RX3J5EHP.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,ConditionIdSchema,OrderSideSchema,CommentParentEntityTypeSchema,EventIdSchema,CommentIdSchema,IsoDateTimeStringSchema,IsoCalendarDateStringSchema,PositionIdSchema,OrderType,PositiveDecimalNumberSchema,OrderSide,MarketIdSchema,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 Od 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=>Cn(t.url,e,o))}}function Jr(e){return ResultAsync.fromPromise(e.blob(),()=>new b(`Received unreadable binary response from ${e.url}`))}function Cn(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 kn(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,bn(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 kn(e){if(typeof e!="string"||!ot(e))throw new b("Expected JSON-RPC eth_call result to be a hex string");return e}function bn(e){if(e===void 0)return "";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return ""}}function lu(e,r,t){return {signer:r,wallet:t,walletType:Gn(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 In="3d3d606380380380913d393d73%s5af4602a57600080fd5b602d8060366000396000f3363d3d373d3d3d363d73%s5af43d82803e903d91602b57fd5bf352e831dd00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000";function qn(e){let r=In.replace("%s",e.proxyFactory.slice(2).toLowerCase()).replace("%s",e.proxyImplementation.slice(2).toLowerCase());return expectHexString(Hash.keccak256(`0x${r}`))}function vn(e,r){return expectEvmAddress(ContractAddress.fromCreate2({bytecodeHash:qn(r),from:r.proxyFactory,salt:Hash.keccak256(AbiParameters.encodePacked(["address"],[e]))}))}function On(e,r){return expectEvmAddress(ContractAddress.fromCreate2({bytecodeHash:r.safeInitCodeHash,from:r.safeFactory,salt:Hash.keccak256(AbiParameters.encode([{name:"address",type:"address"}],[e]))}))}var Ln="0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3",wn="0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076",Mn=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:jn(r.depositWalletImplementation,o),from:r.depositWalletFactory,salt:Hash.keccak256(o)}))}var Bn="0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3",Fn="0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c",Un="0x60195155f3363d3d373d3d363d602036600436635c60da",zn=0x6100523d8160233d3973n,Dn="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:Hn(r.depositWalletBeacon,o),from:r.depositWalletFactory,salt:Hash.keccak256(o)}))}function jn(e,r){let t=BigInt((r.length-2)/2),o=Mn+(t<<56n);return expectHexString(Hash.keccak256(Bytes.concat(Bytes.fromNumber(o,{size:10}),Bytes.fromHex(e),Bytes.fromHex("0x6009"),Bytes.fromHex(wn),Bytes.fromHex(Ln),Bytes.fromHex(r)),{as:"Hex"}))}function Hn(e,r){let t=BigInt((r.length-2)/2),o=zn+(t<<56n);return expectHexString(Hash.keccak256(Bytes.concat(Bytes.fromNumber(o,{size:10}),Bytes.fromHex(e),Bytes.fromHex(Un),Bytes.fromHex(Fn),Bytes.fromHex(Bn),Bytes.fromHex(r)),{as:"Hex"}))}async function Wn(e,r){try{let t=await e.ethCall({to:r,data:Dn});return Nn(t)}catch(t){if(et(t))return ZERO_ADDRESS;throw t}}async function _n(e,r){let t=await Wn(e,r);return !isSameEvmAddress(t,ZERO_ADDRESS)}async function it(e,r,t){return await _n(e,t.depositWalletFactory)?st(r,t):at(r,t)}function Nn(e){return e.length<66?ZERO_ADDRESS:expectEvmAddress(`0x${e.slice(-40)}`)}function Gn(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,On(r,o)))return WalletType.GNOSIS_SAFE;if(isSameEvmAddress(t,vn(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($n(r))return Vn(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 $n(e){return "format"in e}function Vn(e,r){let t=new URLSearchParams;for(let[o,n]of Object.entries(e)){if(n===void 0)continue;let c=r[o]??Kn(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 Kn(e){return e.replace(/[A-Z]/g,r=>`_${r.toLowerCase()}`)}function fe(e){return String(e)}var bu=k(e,d,j$1,c,b);async function Au(e){return (await unwrap(e.secureClob.get("/auth/ban-status/closed-only").andThen(f(ClosedOnlyModeSchema)))).closedOnly}var ia=z$1.object({tokenId:z$1.string().optional(),cursor:PaginationCursorSchema.optional(),id:z$1.string().optional(),market:z$1.string().optional()}).default({}),Iu=k(e,d,j$1,c,b,a);function qu(e,r){let{cursor:t,...o}=l(r,ia);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 pa=z$1.object({orderId:z$1.string()}),vu=k(e,d,j$1,c,b,a);async function Ou(e,r){let t=l(r,pa);return unwrap(e.secureClob.get(`/data/order/${t.orderId}`).andThen(f(OpenOrderSchema)))}var ca={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()},da=z$1.object(ca).default({}),Lu=k(e,d,j$1,c,b,a);function wu(e,r){let{cursor:t,...o}=l(r,da);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 Mu=k(e,d,j$1,c,b),ua=z$1.object({ids:z$1.array(z$1.string()).min(1)});async function Bu(e){let r=ee(e.account.walletType);return unwrap(e.secureClob.get("/notifications",{params:R({signatureType:r},S())}).andThen(f(NotificationsResponseSchema)))}var Fu=k(e,d,j$1,c,b,a);async function Uu(e,r){let t=l(r,ua),o=ee(e.account.walletType),n=R({ids:t.ids.join(","),signatureType:o},S());await unwrap(e.secureClob.del("/notifications",{params:n}));}var ma=z$1.object({assetType:AssetTypeSchema,tokenId:z$1.string().optional()}),zu=k(e,d,j$1,c,b,a);async function sr(e,r){let t=l(r,ma),o=ee(e.account.walletType);return unwrap(e.secureClob.get("/balance-allowance",{params:R({...t,signatureType:o},S())}).andThen(f(BalanceAllowanceResponseSchema)))}var la=z$1.object({assetType:AssetTypeSchema,tokenId:z$1.string().optional()}),Du=k(e,d,j$1,c,b,a);async function dt(e,r){let t=l(r,la),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 fa=z$1.object({orderId:z$1.string()}),ju=k(e,d,j$1,c,b,a);async function Hu(e,r){let t=l(r,fa);return (await unwrap(e.secureClob.get("/order-scoring",{params:R(t,S())}).andThen(f(OrderScoringResponseSchema)))).scoring}var ya=z$1.object({orderIds:z$1.array(z$1.string())}),Wu=k(e,d,j$1,c,b,a);async function _u(e,r){let o=l(r,ya).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()}),Nu=k(e,d,j$1,c,b,a);function Gu(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 $u=k(e,d,j$1,c,b,a);async function Vu(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 Ea=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()}),Ku=k(e,d,j$1,c,b,a);function Yu(e,r){let{cursor:t,...o}=l(r,Ea),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 Ju=k(e,d,j$1,c,b);async function Qu(e){let r=ee(e.account.walletType);return unwrap(e.secureClob.get("/rewards/user/percentages",{params:R({signatureType:r},S())}).andThen(f(RewardsPercentagesSchema)))}var ha=z$1.enum(["TIMESTAMP","TOKENS","CASH"]),xa=z$1.enum(["ASC","DESC"]),Ta=z$1.enum(["CASH","TOKENS"]),Pa=z$1.object({cursor:PaginationCursorSchema.optional(),pageSize:q.default(20),takerOnly:z$1.boolean().optional(),filterType:Ta.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"]}),Ca=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:ha.optional(),sortDirection:xa.optional(),side:SideSchema.optional()}).refine(e=>!(e.market&&e.eventId),{message:"Provide market or eventId, not both",path:["eventId"]}),im=k(e,d,c,b,a);function pm(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,Pa);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 cm=k(e,d,c,b,a);function dm(e,r){let{cursor:t,pageSize:o,...n}=l(r,Ca);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 ba=64,Aa=/^0x[0-9a-fA-F]{62}$/,Ia=/^0x[0-9a-fA-F]{64}$/,ir="0x0000000000000000000000000000000000000000000000000000000000000000",qa=AbiFunction.from("function approve(address spender, uint256 amount)"),yt=AbiFunction.from("function allowance(address owner, address spender) view returns (uint256)"),va=AbiFunction.from("function transfer(address recipient, uint256 amount)"),Oa=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[])"),La=AbiFunction.from("function splitPosition(address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] partition, uint256 amount)"),wa=AbiFunction.from("function mergePositions(address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] partition, uint256 amount)"),Ma=AbiFunction.from("function redeemPositions(address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] indexSets)"),Ba=AbiFunction.from("function split(bytes31 conditionId, uint256 amount)"),Fa=AbiFunction.from("function merge(bytes31 conditionId, uint256 amount)"),Ua=AbiFunction.from("function redeem(bytes31 conditionId, uint256 outcomeIndex, uint256 amount)"),za=AbiFunction.from("function prepareCondition(uint256[] legs) returns (bytes31)"),Da=AbiFunction.from("function multiSend(bytes)"),ja=AbiFunction.from("function proxy((uint8 typeCode, address to, uint256 value, bytes data)[] calls) returns (bytes[])"),St=[1n,2n],Ha=[1n,2n],$=(1n<<256n)-1n,ym=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:Wa(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:_a(r,t),to:e}}function Tt(e,r,t){return {data:AbiFunction.encodeData(Et,[r,t]),to:e}}function Pt(e){return AbiFunction.decodeResult(Et,e)}function Ct(e,r,t){return {data:AbiFunction.encodeData(gt,[r,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 Em=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:Na(r,t),to:e}}var gm=k(a),Rm=k(a);function bt(e,r,t,o){return {data:Ga(r,t,o),to:e}}var Sm=k(a);function At(e,r,t,o){return {data:$a(r,t,o),to:e}}function It(e,r,t){return {data:Va(r,t),to:e}}var hm=k(a);function qt(e,r,t){return {data:AbiFunction.encodeData(Ba,[mr(r),ie(t,"Split amount")]),to:e}}var xm=k(a);function vt(e,r,t){return {data:AbiFunction.encodeData(Fa,[mr(r),ie(t,"Merge amount")]),to:e}}var Tm=k(a);function Ot(e,r,t,o){return {data:AbiFunction.encodeData(Ua,[mr(r),BigInt(Ka(t)),ie(o,"Redeem amount")]),to:e}}var Pm=k(a);function ur(e,r){return {data:AbiFunction.encodeData(za,[r.map(t=>ie(t,"Leg position ID"))]),to:e}}function Wa(e,r){return invariant(r>=0n,"Approval amount must be non-negative"),AbiFunction.encodeData(qa,[e,r])}function _a(e,r){return AbiFunction.encodeData(Oa,[e,r])}function Na(e,r){return AbiFunction.encodeData(va,[e,r])}function Ga(e,r,t){return AbiFunction.encodeData(La,[e,ir,r,St,ie(t,"Split amount")])}function $a(e,r,t){return AbiFunction.encodeData(wa,[e,ir,r,St,ie(t,"Merge amount")])}function Va(e,r){return AbiFunction.encodeData(Ma,[e,ir,r,Ha])}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(Ia.test(e)){let r=e.toLowerCase();if(r.endsWith("00"))return r.slice(0,ba)}throw new a("Protocol v2 condition ID must be bytes31, or bytes32 with a zero outcome byte")}function Ka(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(ja,[e.map(r=>({typeCode:1,to:r.to,value:r.value??0n,data:r.data}))])}function wt(e){let r=e.map(t=>Ya(t));return AbiFunction.encodeData(Da,[r.length===0?"0x":AbiParameters.encodePacked(Array.from({length:r.length},()=>"bytes"),r)])}function Ya(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 Am=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 Lm(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 ps=[{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],cs=[{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"}],ds="DepositWallet",us="1",ms=600,ls=[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],fs=[{name:"wallet",type:"address"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"},{name:"calls",type:"Call[]"}],ys=z$1.object({address:z$1.string(),type:z$1.enum(RelayerTransactionType)}),Vm=k(e,d,c,b,a);async function Er(e,r){let t=l(r,ys);return unwrap(e.relayer.get("/v1/account/transactions/params",{params:R(t,{address:"address",type:"type"})}).andThen(f(RelayerExecuteParamsSchema)))}var Es=z$1.object({transactionId:TransactionIdSchema}),gs=z$1.object({wallet:EvmAddressSchema,type:z$1.enum(WalletType)}),Km=k(e,d,c,b,a);async function Ym(e,r){let t=await Rs(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 Rs(e,r){if(r!==void 0)return l(r,gs);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,Jm=k(e,d,c,b,a);async function Qm(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 Ss(e,r){let t=l(r,Es);return unwrap(e.relayer.get(`/v1/account/transactions/${t.transactionId}`).andThen(f(GaslessTransactionSchema)))}var hs=z$1.object({data:z$1.custom(isHexString),to:EvmAddressSchema,value:z$1.bigint().optional()}),xs=z$1.object({calls:z$1.array(hs).min(1).transform(e=>expectNonEmptyArray(e)),metadata:j}),Zm=k(e,d,c,b,a);async function G(e,r){let t=l(r,xs);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*Ts(e,t);case WalletType.DEPOSIT_WALLET:return yield*Ps(e,t);case WalletType.GNOSIS_SAFE:return yield*Cs(e,t)}invariant(!1,"Unsupported wallet type for gasless transaction");}catch(c){if(!ks(c)||n===Bt)throw c;await delay(e.environment.relayerPollFrequencyMs);}invariant(false,"Expected gasless transaction retry loop to return");}.call(null)}async function*Ts(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,Ie=ZERO_ADDRESS,Sn=Ls(e.account.signer,o,n,c,a,y,t.nonce,x,Ie),hn=expectEvmSignature(yield zt(Sn));return Ge(e,{data:n,from:e.account.signer,metadata:r.metadata,nonce:t.nonce,proxyWallet:e.account.wallet,signature:hn,signatureParams:{gasLimit:y,gasPrice:a,relay:Ie,relayHub:x,relayerFee:c},to:o,type:RelayerTransactionType.PROXY})}async function*Ps(e,r){let t=await Er(e,{address:e.account.signer,type:RelayerTransactionType.WALLET}),o=r.calls.map(bs),n=`${Math.floor(Date.now()/1e3)+ms}`,c=expectEvmSignature(yield Os(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*Cs(e,r){let t=await Er(e,{address:e.account.signer,type:RelayerTransactionType.SAFE}),o=Is(r.calls,e.environment.safeMultisend),n=vs({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:ws(c),signatureParams:qs(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 ks(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 bs(e){return {data:e.data,target:e.to,value:`${e.value??0n}`}}function As(e){return {domain:{chainId:e.chainId,name:ds,verifyingContract:e.wallet,version:us},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:fs,Call:ls}}}function Is(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 qs(e){return {baseGas:"0",gasPrice:"0",gasToken:ZERO_ADDRESS,operation:`${e}`,refundReceiver:ZERO_ADDRESS,safeTxnGas:"0"}}function vs(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:ps,SafeTx:cs}}}function zt(e){return {kind:"signGaslessMessage",payload:e}}function Os(e){return {kind:"signGaslessTypedData",payload:e}}function Ls(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 ws(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 Xm=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 Ss(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 Ms=z$1.object({amount:z$1.union([z$1.bigint(),z$1.literal("max")]),metadata:j.optional(),spenderAddress:EvmAddressSchema,tokenAddress:EvmAddressSchema}),dl=k(a);async function Bs(e,r){let t=l(r,Ms),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 ul=k(h,e,d,j$1,c,b,a);function Dt(e,r){return Bs(e,r).then(F(e.signer))}var Fs=z$1.object({approved:z$1.boolean().default(true),metadata:j.optional(),operatorAddress:EvmAddressSchema,tokenAddress:EvmAddressSchema}),ml=k(a);async function Us(e,r){let t=l(r,Fs);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 ll=k(h,e,d,j$1,c,b,a);function jt(e,r){return Us(e,r).then(F(e.signer))}var fl=k(d,c,b,a);async function zs(e){let r=await js(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 yl=k(h,e,d,j$1,f$1,g,c,b,a);function El(e){return zs(e).then(F(e.signer)).then(Ds)}function Ds(){return {transactionHash:null,transactionId:null,wait:async()=>{}}}async function js(e){let r=Hs(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 Hs(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 Pl=k(e,d,c,b);async function Gs(e,r){return unwrap(e.clob.post("/auth/api-key",{headers:Gt(r)}).andThen(f(ApiKeyCredsSchema)))}var Cl=k(e,d,c,b);async function $s(e,r){return unwrap(e.clob.get("/auth/derive-api-key",{headers:Gt(r)}).andThen(f(ApiKeyCredsSchema)))}var kl=k(e,d,c,b);async function bl(e,r){try{return await Gs(e,r)}catch(t){if(!(t instanceof d)||t.status!==400)throw t}return $s(e,r)}var Al=k(e,d,j$1,c,b);async function Il(e){return (await unwrap(e.secureClob.get("/auth/api-keys").andThen(f(ApiKeysResponseSchema)))).apiKeys}var ql=k(e,d,j$1,c,b);async function vl(e){await unwrap(e.secureClob.del("/auth/api-key").andThen(f(z$1.literal("OK"))));}var Ol=k(e,d,j$1,c,b);async function Ll(e){return unwrap(e.secureClob.post("/auth/builder-api-key").andThen(f(BuilderApiKeyCredsSchema)))}var wl=k(e,d,j$1,c,b);async function Ml(e){return unwrap(e.secureClob.get("/auth/builder-api-key").andThen(f(BuilderApiKeysResponseSchema)))}var Bl=k(e,d,j$1,c,b);async function Fl(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 Qs=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()}),$l=k(e,d,c,b,a);function Vl(e,r){let{cursor:t,...o}=l(r,Qs);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 Si=z$1.object({tokenId:z$1.string()}),nf=k(e,d,c,b,a);async function af(e,r){let t=l(r,Si);return (await unwrap(e.clob.get("/midpoint",{params:R(t,S())}).andThen(f(MidpointSchema)))).mid}var hi=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),sf=k(e,d,c,b,a);async function pf(e,r){let t=l(r,hi);return unwrap(e.clob.post("midpoints",{json:Ke(t)}).andThen(f(MidpointsSchema)))}var xi=z$1.object({tokenId:z$1.string()}),cf=k(e,d,c,b,a);async function Re(e,r){let t=l(r,xi);return (await unwrap(e.clob.get("/tick-size",{params:R(t,S())}).andThen(f(FetchTickSizeResponseSchema)))).minimumTickSize}var Ti=z$1.object({tokenId:z$1.string()}),df=k(e,d,c,b,a);async function Se(e,r){let t=l(r,Ti);return (await unwrap(e.clob.get("/neg-risk",{params:R(t,S())}).andThen(f(FetchNegRiskResponseSchema)))).negRisk}var Pi=z$1.object({tokenId:TokenIdSchema}),uf=k(e,d,c,b,a);async function Qt(e,r){let t=l(r,Pi);return unwrap(e.clob.get(`/markets-by-token/${t.tokenId}`).andThen(f(ResolveConditionByTokenResponseSchema)))}var Ci=z$1.object({conditionId:ConditionIdSchema}),mf=k(e,d,c,b,a);async function Zt(e,r){let t=l(r,Ci);return unwrap(e.clob.get(`/clob-markets/${t.conditionId}`).andThen(f(FetchMarketInfoResponseSchema)))}var ki=z$1.object({builderCode:BuilderCodeSchema}),lf=k(e,d,c,b,a);async function Xt(e,r){let t=l(r,ki);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 bi=z$1.object({tokenId:z$1.string(),side:OrderSideSchema}),ff=k(e,d,c,b,a);async function yf(e,r){let t=l(r,bi);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),Ef=k(e,d,c,b,a);async function gf(e,r){let t=l(r,Ai);return unwrap(e.clob.post("prices",{json:Ui(t)}).andThen(f(PricesSchema)))}var Ii=z$1.object({tokenId:z$1.string()}),Rf=k(e,d,c,b,a);async function eo(e,r){let t=l(r,Ii);return unwrap(e.clob.get("/book",{params:R(t,S())}).andThen(f(FetchOrderBookResponseSchema)))}var qi=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),Sf=k(e,d,c,b,a);async function hf(e,r){let t=l(r,qi);return unwrap(e.clob.post("books",{json:Ke(t)}).andThen(f(OrderBooksSchema)))}var vi=z$1.object({tokenId:z$1.string()}),xf=k(e,d,c,b,a);async function Tf(e,r){let t=l(r,vi);return (await unwrap(e.clob.get("/spread",{params:R(t,S())}).andThen(f(SpreadSchema)))).spread}var Oi=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),Pf=k(e,d,c,b,a);async function Cf(e,r){let t=l(r,Oi);return unwrap(e.clob.post("spreads",{json:Ke(t)}).andThen(f(SpreadsSchema)))}var Li=z$1.object({tokenId:z$1.string()}),kf=k(e,d,c,b,a);async function bf(e,r){let t=l(r,Li);return unwrap(e.clob.get("/last-trade-price",{params:R(t,S())}).andThen(f(LastTradePriceSchema)))}var wi=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),Af=k(e,d,c,b,a);async function If(e,r){let t=l(r,wi);return unwrap(e.clob.post("last-trades-prices",{json:Ke(t)}).andThen(f(LastTradePricesSchema)))}var Mi=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()}),qf=k(e,d,c,b,a);async function vf(e,r){let t=l(r,Mi);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 Bi=z$1.object({cursor:PaginationCursorSchema.optional(),sponsored:z$1.boolean().optional()}).default({}),Of=k(e,d,c,b,a);function Lf(e,r={}){let{cursor:t,...o}=l(r,Bi);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 Fi=z$1.object({conditionId:ConditionIdSchema,cursor:PaginationCursorSchema.optional(),sponsored:z$1.boolean().optional()}),wf=k(e,d,c,b,a);function Mf(e,r){let{cursor:t,...o}=l(r,Fi);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 Ui(e){return e.map(({tokenId:r,side:t})=>({token_id:r,side:t}))}var _i=z$1.object({ascending:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),pageSize: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}),Ni=z$1.object({getPositions:z$1.boolean().optional(),id:CommentIdSchema}),Gi=z$1.object({address:z$1.string(),ascending:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),order:z$1.string().optional(),pageSize:q.default(20)}),Gf=k(e,d,c,b,a);function $f(e,r){let{cursor:t,pageSize:o,...n}=l(r,_i);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 Vf=k(e,d,c,b,a);async function Kf(e,r){let t=l(r,Ni);return unwrap(e.gamma.get(`comments/${t.id}`,{params:R({getPositions:t.getPositions},S())}).andThen(f(ListCommentsResponseSchema)))}var Yf=k(e,d,c,b,a);function Jf(e,r){let{address:t,cursor:o,pageSize:n,...c}=l(r,Gi);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 Ie=x.length>y.pageSize;return {items:x.slice(0,y.pageSize),hasMore:Ie,nextCursor:Ie?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 Qi=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()}),Zi=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()})]),Xi=z$1.object({id:z$1.string()}),ep=z$1.object({id:z$1.string()}),uy=k(e,d,c,b,a);function my(e,r={}){let t=l(r,Qi);return C(o=>e.gamma.get("/events/keyset",{params:rp({...t,cursor:o??t.cursor})}).andThen(f(ListEventsKeysetResponseSchema)).map(n=>({items:n.items,hasMore:n.nextCursor!==void 0,nextCursor:n.nextCursor})),t.cursor)}var ly=k(e,d,c,b,a);async function fy(e,r){let t=l(r,Zi);if("id"in t)return unwrap(e.gamma.get(`events/${t.id}`,{params:tp(t)}).andThen(f(EventSchema)));let o="url"in t?Ye(t.url,"event"):t.slug;return unwrap(e.gamma.get(`events/slug/${o}`,{params:op(t)}).andThen(f(EventSchema)))}var yy=k(e,d,c,b,a);async function Ey(e,r){let t=l(r,Xi);return unwrap(e.gamma.get(`events/${t.id}/tags`).andThen(f(FetchEventTagsResponseSchema)))}var gy=k(e,d,c,b,a);async function Ry(e,r){let t=l(r,ep);return unwrap(e.data.get("/live-volume",{params:w(t)}).andThen(f(FetchEventLiveVolumeResponseSchema)))}function rp(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 tp(e){return R({includeBestLines:e.includeBestLines,includeChat:e.includeChat,includeTemplate:e.includeTemplate,locale:e.locale},S())}function op(e){return R({includeBestLines:e.includeBestLines,includeChat:e.includeChat,includeTemplate:e.includeTemplate,locale:e.locale},S())}var dp=z$1.object({cursor:PaginationCursorSchema.optional(),pageSize:q.default(20),timePeriod:TimePeriodSchema.optional()}),up=z$1.object({timePeriod:TimePeriodSchema.optional()}),mp=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()}),qy=k(e,d,c,b,a);function vy(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,dp);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 Oy=k(e,d,c,b,a);async function Ly(e,r={}){let t=l(r,up);return unwrap(e.data.get("/v1/builders/volume",{params:w(t)}).andThen(f(ListBuilderVolumeResponseSchema)))}var wy=k(e,d,c,b,a);function My(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,mp);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 hp=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(ConditionIdSchema).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()}),xp=z$1.object({id:z$1.string(),includeTag:z$1.boolean().optional(),locale:z$1.string().optional()}),Tp=z$1.object({slug:z$1.string(),includeTag:z$1.boolean().optional(),locale:z$1.string().optional()}),Pp=z$1.object({url:z$1.string(),includeTag:z$1.boolean().optional(),locale:z$1.string().optional()}),Cp=z$1.union([xp,Tp,Pp]),kp=z$1.object({id:z$1.string()}),bp=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()}),Ip=z$1.enum(["OPEN","CLOSED","ALL"]),qp=z$1.enum(["TOKENS","CASH_PNL","REALIZED_PNL","TOTAL_PNL"]),vp=z$1.enum(["ASC","DESC"]),Op=z$1.object({cursor:PaginationCursorSchema.optional(),market:z$1.string(),pageSize:q.default(20),user:z$1.string().optional(),status:Ip.optional(),sortBy:qp.optional(),sortDirection:vp.optional()}),Vy=k(e,d,c,b,a);function io(e,r={}){let t=l(r,hp);return C(o=>e.gamma.get("/markets/keyset",{params:Lp({...t,cursor:o??t.cursor})}).andThen(f(ListMarketsKeysetResponseSchema)).map(n=>({items:n.items,hasMore:n.nextCursor!==void 0,nextCursor:n.nextCursor})),t.cursor)}var Ky=k(e,d,c,b,a);async function Yy(e,r){let t=l(r,Cp);return "id"in t?wp(e,t):"url"in t?no(e,{includeTag:t.includeTag,locale:t.locale,slug:Ye(t.url,"market")}):no(e,t)}var Jy=k(e,d,c,b,a);async function Qy(e,r){let t=l(r,kp);return unwrap(e.gamma.get(`markets/${t.id}/tags`).andThen(f(FetchMarketTagsResponseSchema)))}var Zy=k(e,d,c,b,a);async function Xy(e,r){let t=l(r,bp);return unwrap(e.data.get("/holders",{params:w(t)}).andThen(f(ListMarketHoldersResponseSchema)))}var eE=k(e,d,c,b,a);async function rE(e,r={}){let t=l(r,Ap);return unwrap(e.data.get("/oi",{params:w(t)}).andThen(f(ListOpenInterestResponseSchema)))}var tE=k(e,d,c,b,a);function oE(e,r){let{cursor:t,pageSize:o,...n}=l(r,Op);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 Lp(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 wp(e,r){return unwrap(e.gamma.get(`markets/${r.id}`,{params:R({includeTag:r.includeTag,locale:r.locale},S())}).andThen(f(MarketSchema)))}var Fp=z$1.object({orderId:z$1.string()}),Up=z$1.object({orderIds:z$1.array(z$1.string()).min(1).max(3e3)}),zp=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"]}),uE=k(d,e,j$1,c,b,a);async function mE(e,r){let t=l(r,Fp);return Ze(e,"/order",{orderID:t.orderId})}var lE=k(d,e,j$1,c,b,a);async function fE(e,r){let t=l(r,Up);return Ze(e,"/orders",t.orderIds)}var yE=k(d,e,j$1,c,b);async function EE(e){return Ze(e,"/cancel-all")}var gE=k(d,e,j$1,c,b,a);async function RE(e,r){let t=l(r,zp);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)}),jp=z$1.discriminatedUnion("side",[co.extend({side:z$1.literal(OrderSide.BUY),amount:PositiveDecimalNumberSchema}),co.extend({side:z$1.literal(OrderSide.SELL),shares:PositiveDecimalNumberSchema})]),bE=k(i,e,d,c,b,a);async function AE(e,r){let t=l(r,jp),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?Wp(t.asks,r.amount,r.orderType):_p(t.bids,r.amount,r.orderType);return invariant(Hp(o,r.tickSize),`Resolved market price fell outside the valid range for tick size ${r.tickSize}.`),o}function Hp(e,r){return e>=r&&e<=1-r}function Wp(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 _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),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 Vp=z$1.array(z$1.custom()).min(1).max(15),FE=k(e,d,j$1,c,b),UE=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 zE(e){return async function(t){let n=l(t,Vp).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 Xp(e,{price:r.price,tokenId:r.tokenId}),o=ec({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 Xp(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:rc(r.price,o),signerAddress:t.signer,tickSize:o}}function ec(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 rc(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 nc(e,r),o=ac({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 nc(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 sc(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 ac(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 sc(e,r){if(r.side!==OrderSide.BUY||r.maxSpend===void 0)return r.amount;let[t,o]=await Promise.all([ic(e,r.tokenId),pc(e,r.builderCode)]);return cc({amount:r.amount,builderTakerFeeRate:o,platformFeeExponent:t.exponent,platformFeeRate:t.rate,maxSpend:r.maxSpend,price:r.price})}async function ic(e,r){let t=await Qt(e,{tokenId:r});return (await Zt(e,{conditionId:t})).feeInfo}async function pc(e,r){return r===void 0?0:(await Xt(e,{builderCode:r})).taker}function cc(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:dc().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 dc(){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",lc="DepositWallet",fc="1",Ar="0x0000000000000000000000000000000000000000000000000000000000000000",Ir="Order(uint256 salt,address maker,address signer,uint256 tokenId,uint256 makerAmount,uint256 takerAmount,uint8 side,uint8 signatureType,uint256 timestamp,bytes32 metadata,bytes32 builder)",yc=Hash.keccak256(Bytes.fromString(Ir),{as:"Hex"}),Ec=Hash.keccak256(Bytes.fromString("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),{as:"Hex"}),gc=Hash.keccak256(Bytes.fromString(ko),{as:"Hex"}),Rc=[{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"}],Sc=[{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 Ao(e){let r=hc(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:lc,salt:Ar,verifyingContract:e.order.signer,version:fc},primaryType:"TypedDataSign",types:{Order:bo,TypedDataSign:Sc}}}function Io(e){if(e.order.signatureType!==SignatureType.POLY_1271)return e.signature;let r=Bytes.toHex(Bytes.fromString(Ir)),t=Ir.length.toString(16).padStart(4,"0");return expectErc1271Signature(`0x${e.signature.slice(2)}${xc(e.domain).slice(2)}${Tc(e.order).slice(2)}${r.slice(2)}${t}`)}function qo(e){return {builder:e.builder??Ar,maker:e.maker,makerAmount:BigInt(e.makerAmount),metadata:e.metadata??Ar,salt:BigInt(e.salt),side:Cc(e.side),signatureType:e.signatureType,signer:e.signer,takerAmount:BigInt(e.takerAmount),timestamp:BigInt(e.timestamp),tokenId:BigInt(e.tokenId)}}function hc(e,r){return {domain:vo(e),message:qo(r),primaryType:"Order",types:{EIP712Domain:Rc,Order:bo}}}function vo(e){return {chainId:e.chainId,name:ko,verifyingContract:e.exchange,version:e.protocolVersion}}function xc(e){return expectHexString(Hash.keccak256(AbiParameters.encode([{type:"bytes32"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"address"}],[Ec,gc,Pc(e.protocolVersion),BigInt(e.chainId),e.exchange]),{as:"Hex"}))}function Tc(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"}],[yc,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 Pc(e){return expectHexString(Hash.keccak256(Bytes.fromString(e),{as:"Hex"}))}function Cc(e){return e===0||e===1?e:e===OrderSide.BUY?0:1}function vr(e){return Ao({domain:Oo(e),order:e})}function Or(e,r){return Io({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 kc=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 bc=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 Pg=kc;async function Cg(e,r){return wo(e,wr(e,r))}var kg=bc;async function bg(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 Ic(o,r.spenderAddress)}function Ic(e,r){return Object.entries(e).find(([o])=>isSameEvmAddress(o,r))?.[1]??0n}var Ng=k(h,i,e,d,j$1,c,b,a);function qc(e,r){return wr(e,r).then(F(e.signer))}var Gg=k(h,i,e,d,j$1,f$1,g,c,b,a);function $g(e,r){return qc(e,r).then(t=>zo(e,t))}var Vg=k(h,e,d,j$1,c,b,a);function vc(e,r){return Mr(e,r).then(F(e.signer))}var Kg=k(h,e,d,j$1,f$1,g,c,b,a);function Yg(e,r){return vc(e,r).then(t=>zo(e,t))}async function zo(e,r){let t=er(e);try{return await t(r)}catch(o){if(!Lc(o))throw o;let n=await Oc(e,r,t);if(n===void 0)throw o;return n}}async function Oc(e,r,t){return await wc(e,r)?t(r):void 0}function Lc(e){return e instanceof d&&e.status===400&&e.message.includes("allowance is not enough")}async function wc(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 jc=z$1.enum(["CURRENT","INITIAL","TOKENS","CASHPNL","PERCENTPNL","TITLE","RESOLVING","PRICE","AVGPRICE"]),Do=z$1.enum(["ASC","DESC"]),Hc=z$1.enum(["REALIZEDPNL","TITLE","PRICE","AVGPRICE","TIMESTAMP"]),Wc=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:jc.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:Hc.optional(),sortDirection:Do.optional()}).refine(e=>!(e.market&&e.eventId),{message:"Provide market or eventId, not both",path:["eventId"]}),Nc=z$1.object({cursor:PaginationCursorSchema.optional(),user:z$1.string(),pageSize:q.default(20),status:ComboPositionStatusSchema.optional(),conditionId:z$1.string().optional(),positionId:z$1.string().optional()}),Gc=z$1.object({user:z$1.string(),market:z$1.array(z$1.string()).optional()}),$c=z$1.object({user:z$1.string()}),Vc=z$1.object({user:z$1.string()}),sR=k(e,d,c,b,a);function iR(e,r){let{cursor:t,pageSize:o,...n}=l(r,Wc);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 pR=k(e,d,c,b,a),cR=k(e,d,c,b,a);function dR(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 uR(e,r){let{cursor:t,pageSize:o,...n}=l(r,Nc);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 mR=k(e,d,c,b,a);async function lR(e,r){let t=l(r,Gc);return unwrap(e.data.get("/value",{params:w(t)}).andThen(f(FetchPortfolioValueResponseSchema)))}var fR=k(e,d,c,b,a);async function yR(e,r){let t=l(r,$c);return unwrap(e.data.get("/traded",{params:w(t)}).andThen(f(TradedSchema)))}var ER=k(e,d,c,b,a);async function gR(e,r){let t=l(r,Vc);return unwrap(e.data.get("/v1/accounting/snapshot",{params:w(t)}).andThen(Jr))}var _o=32,No=3n,Wo=50,Yc=(1n<<256n)-1n;function zr(e){let r=AbiParameters.encode([{name:"legs",type:"uint256[]"}],[e]),o=`0x03${Hash.keccak256(AbiParameters.encode([{name:"moduleId",type:"uint256"},{name:"data",type:"bytes"}],[No,r])).slice(34)}0000000000000000000000000000`;return {conditionId:o,positionIds:[toPositionId(BigInt(`${o}00`).toString()),toPositionId(BigInt(`${o}01`).toString())]}}function Go(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=Vo(t),n=o.toString(16).padStart(_o*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 $o(e){let t=Vo(e).toString(16).padStart(_o*2,"0"),o=BigInt(`0x${t.slice(0,2)}`),n=Number.parseInt(t.slice(-2),16);if(o!==No)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:`0x${t.slice(0,-2)}`,outcomeIndex:n}}function Vo(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>Yc)throw new a("Position ID must be a uint256 value");return t}var Ko=z$1.object({amount:z$1.bigint().min(0n),conditionId:ConditionIdSchema,metadata:j.optional()}),Qc=z$1.object({amount:z$1.bigint().positive(),legs:z$1.array(PositionIdSchema).min(1).max(50),metadata:j.optional()}),Yo=z$1.array(PositionIdSchema).min(1).max(50).transform(Go),Zc=z$1.object({amount:z$1.bigint().positive(),legs:Yo,metadata:j.optional()}),Xc=z$1.union([Ko.extend({legs:z$1.never().optional()}),Qc.extend({conditionId:z$1.never().optional()})]),Jo=k(e,d,c,b,a),UR=Jo,zR=Jo,Qo=k(e,d,c,b,a),DR=Qo,jR=Qo,Zo=k(e,d,c,b,a),HR=Zo,WR=Zo;async function Xo(e,r){let t=l(r,Ko),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 en(e,r){let t=l(r,Zc),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 ed(e,r){let t=l(r,Xc);return t.legs!==void 0?en(e,t):Xo(e,t)}var rn=k(h,e,d,j$1,f$1,g,c,b,a),_R=rn,NR=rn;function GR(e,r){return Xo(e,r).then(F(e.signer))}function $R(e,r){return en(e,r).then(F(e.signer))}function VR(e,r){return ed(e,r).then(F(e.signer))}var tn=z$1.object({amount:z$1.union([z$1.bigint().positive(),z$1.literal("max")]),conditionId:ConditionIdSchema,metadata:j.optional()}),rd=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()}),td=z$1.object({amount:z$1.union([z$1.bigint().positive(),z$1.literal("max")]),legs:Yo,metadata:j.optional()}),od=z$1.union([tn.extend({legs:z$1.never().optional()}),rd.extend({conditionId:z$1.never().optional()})]);async function on(e,r){let t=l(r,tn),o=await Wr(e,{conditionId:t.conditionId}),n=cr(await e.rpc.ethCall(pr(o.positionErc1155Address,e.account.wallet,o.tokenIds))),c=un(o.conditionId,n,t.amount),a=At(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 nn(e,r){let t=l(r,td),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=un(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 nd(e,r){let t=l(r,od);return t.legs!==void 0?nn(e,t):on(e,t)}var an=k(h,e,d,j$1,f$1,g,c,b,a),KR=an,YR=an;function JR(e,r){return on(e,r).then(F(e.signer))}function QR(e,r){return nn(e,r).then(F(e.signer))}function ZR(e,r){return nd(e,r).then(F(e.signer))}var sn=z$1.object({conditionId:ConditionIdSchema,marketId:z$1.never().optional(),amount:z$1.never().optional(),positionId:z$1.never().optional(),metadata:j.optional()}),pn=z$1.object({conditionId:z$1.never().optional(),marketId:MarketIdSchema,amount:z$1.never().optional(),positionId:z$1.never().optional(),metadata:j.optional()}),ad=z$1.union([sn,pn]),cn=z$1.object({positionId:PositionIdSchema,conditionId:z$1.never().optional(),marketId:z$1.never().optional(),metadata:j.optional()}),sd=z$1.union([sn,pn,cn]);async function id(e,r){let t=l(r,ad),o=await Wr(e,t.conditionId!==void 0?{conditionId:t.conditionId}:{marketId:t.marketId}),n=It(o.adapterAddress,e.environment.collateralToken,o.conditionId);return async function*(){return e.account.walletType===WalletType.EOA?z(yield dn(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 pd(e,r){let t=l(r,cn),o=$o(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 dn(D(e.environment.chainId,c))):yield*await G(e,{calls:[c],metadata:t.metadata??`Redeem combo position ${t.positionId}`})}.call(null)}async function cd(e,r){let t=l(r,sd);return t.positionId!==void 0?pd(e,t):id(e,t)}var XR=k(h,e,d,j$1,c,b,a);function eS(e,r){return cd(e,r).then(F(e.signer))}function Dr(e){return {kind:"sendSplitPositionTransaction",request:e}}function jr(e){return {kind:"sendMergePositionsTransaction",request:e}}function dn(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:[dd(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=ud(c,t);return {...a,adapterAddress:a.negRisk?e.environment.negRiskCollateralAdapter:e.environment.collateralAdapter,positionErc1155Address:a.negRisk?e.environment.negRiskAdapter:e.environment.conditionalTokens}}function dd(e){let r=Number(e);if(!Number.isInteger(r))throw new a(`Market ID must be an integer, received ${e}`);return r}function ud(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 un(e,r,t){let o=md(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 md(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 gd=z$1.object({address:z$1.string()}),cS=k(e,d,c,b,a);async function dS(e,r){let t=l(r,gd);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;}},fS=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;}},yS=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;}},ES=k(Gr,f$1,c),gS=k(c);async function RS(e){return e.webSockets.rfqQuoter.connect()}var hd=z$1.object({q:z$1.string().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()}),BS=k(e,d,c,b,a);function FS(e,r){let{cursor:t,pageSize:o,...n}=l(r,hd);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:xd(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 xd(e){return {events:e.events??[],profiles:e.profiles??[],tags:e.tags??[]}}var bd=z$1.object({ascending:z$1.boolean().optional(),closed:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),excludeEvents:z$1.boolean().optional(),locale:z$1.string().optional(),order:z$1.string().optional(),pageSize:q.default(20),recurrence:z$1.enum(["daily","weekly","monthly"]).optional(),slug:z$1.array(z$1.string()).optional()}),Ad=z$1.object({id:z$1.string(),locale:z$1.string().optional()}),VS=k(e,d,c,b,a);function KS(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,bd);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 YS=k(e,d,c,b,a);async function JS(e,r){let t=l(r,Ad);return unwrap(e.gamma.get(`series/${t.id}`,{params:R({locale:t.locale},S())}).andThen(f(SeriesSchema)))}var th=k(e,d,c,b);async function oh(e){return unwrap(e.gamma.get("/sports").andThen(f(ListSportsMetadataResponseSchema)))}var nh=k(e,d,c,b);async function ah(e){return unwrap(e.gamma.get("/sports/market-types").andThen(f(SportsMarketTypesResponseSchema)))}async function ch(e,r){let t=await Promise.all(r.map(o=>Ld(e,o)));return wd(t)}function Ld(e,r){switch(r.topic){case "market":return e.webSockets.clobMarket.subscribe(r);case "sports":return e.webSockets.sports.subscribe(r);case "comments":case "prices.crypto.binance":case "prices.crypto.chainlink":case "prices.equity.pyth":return e.webSockets.rtds.subscribe(r);case "user":return invariant(e.isSecureClient(),"A 'user' subscription requires a secure client instance."),e.webSockets.clobUser.subscribe(r)}}function wd(e){let r;async function t(){r===void 0&&(r=Promise.all(e.map(n=>n.close())).then(()=>{})),await r;}let o=Od(...e);return {close:t,[Symbol.asyncIterator](){return o[Symbol.asyncIterator]()}}}var Fd=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)}),Ud=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()})]),zd=z$1.object({id:z$1.string(),omitEmpty:z$1.boolean().optional(),status:z$1.enum(["active","closed","all"]).optional()}),Dd=z$1.object({slug:z$1.string()}),jd=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()}),Hd=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()}),hh=k(e,d,c,b,a);function xh(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,Fd);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 Th=k(e,d,c,b,a);async function Ph(e,r){let t=l(r,Ud);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 Ch=k(e,d,c,b,a);async function kh(e,r){if("id"in r){let o=l(r,zd);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,Dd);return unwrap(e.gamma.get(`tags/slug/${t.slug}/related-tags`).andThen(f(ListRelatedTagsResponseSchema)))}var bh=k(e,d,c,b,a);async function Ah(e,r){if("id"in r){let o=l(r,jd);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,Hd);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 Nd=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()}),Uh=k(e,d,c,b,a);function zh(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,Nd);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 $d=z$1.object({amount:z$1.bigint(),metadata:j.optional(),recipientAddress:EvmAddressSchema,tokenAddress:EvmAddressSchema}),Yh=k(a);async function Vd(e,r){let t=l(r,$d);return async function*(){return e.account.walletType===WalletType.EOA?z(yield Kd(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 Jh=k(h,e,d,j$1,c,b,a);function Qh(e,r){return Vd(e,r).then(F(e.signer))}function Kd(e){return {kind:"sendErc20TransferTransaction",request:e}}export{Vm as $,zs as $a,Ry as $b,iR as $c,Pm as A,ju as Aa,xf as Ab,bE as Ac,GR as Ad,Yh as Ae,ur as B,Hu as Ba,Tf as Bb,AE as Bc,$R as Bd,Vd as Be,Lt as C,Wu as Ca,Pf as Cb,hr as Cc,VR as Cd,Jh as Ce,wt as D,_u as Da,Cf as Db,FE as Dc,on as Dd,Qh as De,Pl as E,Nu as Ea,kf as Eb,UE as Ec,nn as Ed,Gs as F,Gu as Fa,bf as Fb,er as Fc,nd as Fd,Cl as G,$u as Ga,Af as Gb,zE as Gc,an as Gd,$s as H,Vu as Ha,If as Hb,Ao as Hc,KR as Hd,kl as I,Ku as Ia,qf as Ib,Io as Ic,YR as Id,bl as J,Yu as Ja,vf as Jb,Lr as Jc,JR as Jd,Al as K,Ju as Ka,Of as Kb,kc as Kc,QR as Kd,Il as L,Qu as La,Lf as Lb,wr as Lc,ZR as Ld,ql as M,im as Ma,wf as Mb,bc as Mc,id as Md,vl as N,pm as Na,Mf as Nb,Mr as Nc,pd as Nd,Ol as O,cm as Oa,Gf as Ob,Pg as Oc,cd as Od,Ll as P,dm as Pa,$f as Pb,Cg as Pc,XR as Pd,wl as Q,Am as Qa,Vf as Qb,kg as Qc,eS as Qd,Ml as R,z as Ra,Kf as Rb,bg as Rc,cS as Rd,Bl as S,dl as Sa,Yf as Sb,Ng as Sc,dS as Sd,Fl as T,Bs as Ta,Jf as Tb,qc as Tc,_r as Td,l as U,ul as Ua,uy as Ub,Gg as Uc,fS as Ud,Zr as V,Dt as Va,my as Vb,$g as Vc,Nr as Vd,lu as W,ml as Wa,ly as Wb,Vg as Wc,yS as Wd,nt as X,Us as Xa,fy as Xb,vc as Xc,Gr as Xd,it as Y,ll as Ya,yy as Yb,Kg as Yc,ES as Yd,Lm as Z,jt as Za,Ey as Zb,Yg as Zc,gS as Zd,Mt as _,fl as _a,gy as _b,sR as _c,RS as _d,$ as a,Er as aa,yl as ab,qy as ac,pR as ad,ym as b,Km as ba,El as bb,vy as bc,cR as bd,He as c,Ym as ca,$l as cb,Oy as cc,dR as cd,ht as d,j as da,Vl as db,Ly as dc,uR as dd,xt as e,Jm as ea,nf as eb,wy as ec,mR as ed,We as f,Qm as fa,af as fb,My as fc,lR as fd,BS as fe,Tt as g,Ss as ga,sf as gb,Vy as gc,fR as gd,FS as ge,Pt as h,Zm as ha,pf as hb,io as hc,yR as hd,VS as he,Ct as i,G as ia,cf as ib,Ky as ic,ER as id,KS as ie,kt as j,Xm as ja,Re as jb,Yy as jc,gR as jd,YS as je,pr as k,bu as ka,df as kb,Jy as kc,JS as ke,cr as l,Au as la,Se as lb,Qy as lc,Jo as ld,th as le,Em as m,Iu as ma,uf as mb,Zy as mc,UR as md,oh as me,dr as n,qu as na,Qt as nb,Xy as nc,zR as nd,nh as ne,gm as o,vu as oa,mf as ob,eE as oc,Qo as od,ah as oe,Rm as p,Ou as pa,Zt as pb,rE as pc,DR as pd,ch as pe,bt as q,Lu as qa,lf as qb,tE as qc,jR as qd,hh as qe,Sm as r,wu as ra,Xt as rb,oE as rc,Zo as rd,xh as re,At as s,Mu as sa,ff as sb,uE as sc,HR as sd,Th as se,It as t,Bu as ta,yf as tb,mE as tc,WR as td,Ph as te,hm as u,Fu as ua,Ef as ub,lE as uc,Xo as ud,Ch as ue,qt as v,Uu as va,gf as vb,fE as vc,en as vd,kh as ve,xm as w,zu as wa,Rf as wb,yE as wc,ed as wd,bh as we,vt as x,sr as xa,eo as xb,EE as xc,rn as xd,Ah as xe,Tm as y,Du as ya,Sf as yb,gE as yc,_R as yd,Uh as ye,Ot as z,dt as za,hf as zb,RE as zc,NR as zd,zh as ze};//# sourceMappingURL=chunk-RX3J5EHP.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-RX3J5EHP.js.map
|