@polymarket/client 0.1.0-beta.4 → 0.1.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/index.d.ts +3 -3
- package/dist/actions/index.js +1 -1
- package/dist/chunk-2ZZDFOKL.js +2 -0
- package/dist/chunk-2ZZDFOKL.js.map +1 -0
- package/dist/ethers-v5.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{sports-shrXkDsG.d.ts → sports-DNd7kOz2.d.ts} +1 -1
- package/dist/{types-BHjtOekI.d.ts → types-DLNcPNT6.d.ts} +89 -2
- package/dist/viem.d.ts +1 -1
- package/package.json +2 -2
- package/dist/chunk-76B5WBIO.js +0 -2
- package/dist/chunk-76B5WBIO.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OrderResponse } from '@polymarket/bindings/clob';
|
|
2
|
-
import {
|
|
2
|
+
import { aK as RateLimitError, aM as RequestRejectedError, bn as SigningError, bu as TransportError, bx as UnexpectedResponseError, U as UserInputError, a6 as InsufficientLiquidityError, h as BaseSecureClient, dC as PrepareLimitOrderRequest, dr as OrderWorkflow, dq as OrderPostingWorkflow, dE as PrepareMarketOrderRequest, m as CancelledSigningError, aC as PostOrderError, bp as TimeoutError, bq as TransactionFailedError, ed as SignedOrder, B as BaseClient } from './types-DLNcPNT6.js';
|
|
3
3
|
import { SportsMarketTypesResponse, SportsMetadata } from '@polymarket/bindings/gamma';
|
|
4
4
|
|
|
5
5
|
type PrepareMarketOrderError = InsufficientLiquidityError | RateLimitError | RequestRejectedError | SigningError | TransportError | UnexpectedResponseError | UserInputError;
|
|
@@ -8,7 +8,7 @@ import * as _polymarket_bindings_clob from '@polymarket/bindings/clob';
|
|
|
8
8
|
import { ClobTrade, NotificationsResponse, BuilderTrade, Prices, OrderBook, LastTradePrice, LastTradePriceForToken, PriceHistoryPoint, CurrentReward, MarketReward, OrdersScoringResponse, UserEarning, TotalUserEarning, UserRewardsEarning, RewardsPercentages, CancelOrdersResponse, SignatureType, OrderResponse, OrderResponses, OpenOrder, ApiKeyCreds, BalanceAllowanceResponse, BuilderFeeRates, MarketInfo } from '@polymarket/bindings/clob';
|
|
9
9
|
import * as _polymarket_bindings_data from '@polymarket/bindings/data';
|
|
10
10
|
import { Value, Traded, ClosedPosition, ComboPosition, Position, MetaMarketPosition, Activity, LeaderboardEntry, BuilderVolumeEntry, TraderLeaderboardEntry, LiveVolume, OpenInterest, MetaHolder, Trade } from '@polymarket/bindings/data';
|
|
11
|
-
import { RfqQuoteRequest, RfqRequestedSize, RfqSide, RfqQuoteAck, RfqConfirmationRequest, RfqConfirmationAck as RfqConfirmationAck$1, RfqExecutionUpdate, RfqQuoteCancelAck, RfqErrorCode, RfqId, RfqQuoteId } from '@polymarket/bindings/rfq';
|
|
11
|
+
import { ComboMarket, RfqQuoteRequest, RfqRequestedSize, RfqSide, RfqQuoteAck, RfqConfirmationRequest, RfqConfirmationAck as RfqConfirmationAck$1, RfqExecutionUpdate, RfqQuoteCancelAck, RfqErrorCode, RfqId, RfqQuoteId } from '@polymarket/bindings/rfq';
|
|
12
12
|
import { CommentsEvent, CryptoPricesTopic, EquityPricesTopic, EquityPricesEvent, MarketEvent, StandardMarketEvent, UserEvent, SportsEvent, CryptoPricesBinanceEvent, CryptoPricesChainlinkEvent, CryptoPricesEvent } from '@polymarket/bindings/subscriptions';
|
|
13
13
|
import { Hex } from 'ox';
|
|
14
14
|
|
|
@@ -1381,6 +1381,49 @@ type DiscoveryActions = {
|
|
|
1381
1381
|
* ```
|
|
1382
1382
|
*/
|
|
1383
1383
|
listMarkets(request?: ListMarketsRequest): Paginated<Market[]>;
|
|
1384
|
+
/**
|
|
1385
|
+
* Lists markets available for Combos.
|
|
1386
|
+
*
|
|
1387
|
+
* @throws {@link ListComboMarketsError}
|
|
1388
|
+
* Thrown on failure.
|
|
1389
|
+
*
|
|
1390
|
+
* @example
|
|
1391
|
+
* Fetch the first page of results:
|
|
1392
|
+
* ```ts
|
|
1393
|
+
* const paginator = client.listComboMarkets({
|
|
1394
|
+
* pageSize: 10,
|
|
1395
|
+
* });
|
|
1396
|
+
*
|
|
1397
|
+
* const firstPage = await paginator.firstPage();
|
|
1398
|
+
*
|
|
1399
|
+
* // Optionally, fetch additional pages:
|
|
1400
|
+
* for await (const page of paginator.from(firstPage.nextCursor)) {
|
|
1401
|
+
* // page.items: ComboMarket[]
|
|
1402
|
+
* }
|
|
1403
|
+
* ```
|
|
1404
|
+
*
|
|
1405
|
+
* @example
|
|
1406
|
+
* Loop through all pages with `for await`:
|
|
1407
|
+
* ```ts
|
|
1408
|
+
* const paginator = client.listComboMarkets({
|
|
1409
|
+
* pageSize: 10,
|
|
1410
|
+
* });
|
|
1411
|
+
*
|
|
1412
|
+
* for await (const page of paginator) {
|
|
1413
|
+
* // page.items: ComboMarket[]
|
|
1414
|
+
* }
|
|
1415
|
+
* ```
|
|
1416
|
+
*
|
|
1417
|
+
* @example
|
|
1418
|
+
* Omit markets the caller has already displayed:
|
|
1419
|
+
* ```ts
|
|
1420
|
+
* const paginator = client.listComboMarkets({
|
|
1421
|
+
* exclude: ['0x4cd77d456c83e7d8c569a8fb8f6396c3f40154f657e6d970733e2b1b6a7110ff'],
|
|
1422
|
+
* pageSize: 10,
|
|
1423
|
+
* });
|
|
1424
|
+
* ```
|
|
1425
|
+
*/
|
|
1426
|
+
listComboMarkets(request?: ListComboMarketsRequest): Paginated<ComboMarket[]>;
|
|
1384
1427
|
/**
|
|
1385
1428
|
* Fetches a market.
|
|
1386
1429
|
*
|
|
@@ -5255,6 +5298,50 @@ declare const ListMarketsError: {
|
|
|
5255
5298
|
* ```
|
|
5256
5299
|
*/
|
|
5257
5300
|
declare function listMarkets(client: BaseClient, request?: ListMarketsRequest): Paginated<Market[]>;
|
|
5301
|
+
declare const ListComboMarketsRequestSchema: z.ZodObject<{
|
|
5302
|
+
cursor: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<_polymarket_bindings.PaginationCursor, string>>>;
|
|
5303
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
5304
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<_polymarket_bindings.CtfConditionId, string>>>>;
|
|
5305
|
+
}, z.core.$strip>;
|
|
5306
|
+
type ListComboMarketsRequest = z.input<typeof ListComboMarketsRequestSchema>;
|
|
5307
|
+
type ListComboMarketsError = RateLimitError | RequestRejectedError | TransportError | UnexpectedResponseError | UserInputError;
|
|
5308
|
+
declare const ListComboMarketsError: {
|
|
5309
|
+
isError(error: unknown): error is TransportError | UserInputError | UnexpectedResponseError | RequestRejectedError | RateLimitError;
|
|
5310
|
+
};
|
|
5311
|
+
/**
|
|
5312
|
+
* Lists markets available for Combos.
|
|
5313
|
+
*
|
|
5314
|
+
* @remarks
|
|
5315
|
+
* This is a low-level function. Most SDK consumers should prefer the client instance API.
|
|
5316
|
+
*
|
|
5317
|
+
* @throws {@link ListComboMarketsError}
|
|
5318
|
+
* Thrown on failure.
|
|
5319
|
+
*
|
|
5320
|
+
* @example
|
|
5321
|
+
* Fetch the first page of results:
|
|
5322
|
+
* ```ts
|
|
5323
|
+
* const result = listComboMarkets(client, {
|
|
5324
|
+
* pageSize: 10,
|
|
5325
|
+
* });
|
|
5326
|
+
*
|
|
5327
|
+
* const firstPage = await result.firstPage();
|
|
5328
|
+
*
|
|
5329
|
+
* // Optionally, fetch additional pages:
|
|
5330
|
+
* for await (const page of result.from(firstPage.nextCursor)) {
|
|
5331
|
+
* // page.items: ComboMarket[]
|
|
5332
|
+
* }
|
|
5333
|
+
* ```
|
|
5334
|
+
*
|
|
5335
|
+
* @example
|
|
5336
|
+
* Omit markets the caller has already displayed:
|
|
5337
|
+
* ```ts
|
|
5338
|
+
* const result = listComboMarkets(client, {
|
|
5339
|
+
* exclude: ['0x4cd77d456c83e7d8c569a8fb8f6396c3f40154f657e6d970733e2b1b6a7110ff'],
|
|
5340
|
+
* pageSize: 10,
|
|
5341
|
+
* });
|
|
5342
|
+
* ```
|
|
5343
|
+
*/
|
|
5344
|
+
declare function listComboMarkets(client: BaseClient, request?: ListComboMarketsRequest): Paginated<ComboMarket[]>;
|
|
5258
5345
|
type FetchMarketError = RateLimitError | RequestRejectedError | TransportError | UnexpectedResponseError | UserInputError;
|
|
5259
5346
|
declare const FetchMarketError: {
|
|
5260
5347
|
isError(error: unknown): error is TransportError | UserInputError | UnexpectedResponseError | RequestRejectedError | RateLimitError;
|
|
@@ -6386,4 +6473,4 @@ type Signer = {
|
|
|
6386
6473
|
sendTransaction(request: SignerTransactionRequest): Promise<TransactionHandle>;
|
|
6387
6474
|
};
|
|
6388
6475
|
|
|
6389
|
-
export { FetchRewardPercentagesError as $, type ApiKeyAuthorization as A, type BaseClient as B, CancelAllError as C, type DataActions as D, type EnvironmentConfig as E, FetchClosedOnlyModeError as F, FetchLastTradePricesError as G, FetchMarketError as H, FetchMarketTagsError as I, FetchMidpointError as J, FetchMidpointsError as K, FetchNotificationsError as L, FetchOrderBookError as M, FetchOrderBooksError as N, FetchOrderError as O, FetchOrderScoringError as P, FetchOrdersScoringError as Q, FetchPortfolioValueError as R, type Signer as S, type TypedDataPayload as T, UserInputError as U, FetchPriceError as V, FetchPriceHistoryError as W, FetchPricesError as X, FetchPublicProfileError as Y, FetchRelatedTagResourcesError as Z, FetchRelatedTagsError as _, type TypedData as a, type RfqQuoteResponse as a$, FetchSeriesError as a0, FetchSpreadError as a1, FetchSpreadsError as a2, FetchTagError as a3, FetchTotalEarningsForUserForDayError as a4, FetchTradedMarketCountError as a5, InsufficientLiquidityError as a6, ListAccountTradesError as a7, ListActivityError as a8, ListBuilderLeaderboardError as a9, type Paginated as aA, PostOrderError as aB, PostOrdersError as aC, type PublicAccountActions as aD, type PublicActions as aE, type PublicClient as aF, type PublicClientOptions as aG, type PublicRewardsActions as aH, type PublicSubscriptionsActions as aI, RateLimitError as aJ, RedeemPositionsError as aK, RequestRejectedError as aL, type RequestRejectedErrorOptions as aM, type RfqCancelQuoteAck as aN, RfqCancelQuoteError as aO, RfqCancelQuoteRejectedError as aP, type RfqCancelQuoteRejectedErrorOptions as aQ, type RfqConfirmationAck as aR, RfqConfirmationError as aS, RfqConfirmationRejectedError as aT, type RfqConfirmationRequestEvent as aU, type RfqEvent as aV, RfqQuoteError as aW, type RfqQuoteReference as aX, RfqQuoteRejectedError as aY, type RfqQuoteRejectedErrorOptions as aZ, type RfqQuoteRequestEvent as a_, ListBuilderTradesError as aa, ListBuilderVolumeError as ab, ListClosedPositionsError as ac, ListComboPositionsError as ad, ListCommentsByUserAddressError as ae, ListCommentsError as af, ListCurrentRewardsError as ag, ListEventsError as ah, ListMarketHoldersError as ai, ListMarketPositionsError as aj, ListMarketRewardsError as ak, ListMarketsError as al, ListOpenInterestError as am, ListOpenOrdersError as an, ListPositionsError as ao, ListSeriesError as ap, ListTagsError as aq, ListTeamsError as ar, ListTraderLeaderboardError as as, ListTradesError as at, ListUserEarningsAndMarketsConfigError as au, ListUserEarningsForDayError as av, MergePositionsError as aw, OpenRfqSessionError as ax, type Page as ay, PageSizeSchema as az, type TransactionCall as b, type Erc1155ApprovalForAllWorkflowRequest as b$, type RfqQuoteSource as b0, type RfqSession as b1, SearchError as b2, type SecureAccountActions as b3, type SecureActions as b4, type SecureClient as b5, type SecureClientOptions as b6, type SecureDownloadAccountingSnapshotRequest as b7, type SecureFetchPortfolioValueRequest as b8, type SecureFetchTradedMarketCountRequest as b9, allActions as bA, analyticsActions as bB, createPublicClient as bC, createSecureClient as bD, dataActions as bE, discoveryActions as bF, makeErrorGuard as bG, production as bH, rewardsActions as bI, rfqActions as bJ, subscriptionsActions as bK, tradingActions as bL, walletActions as bM, type CancelMarketOrdersRequest as bN, type CancelOrderRequest as bO, type CancelOrdersRequest as bP, type CommentsEventType as bQ, type CommentsSubscription as bR, type CryptoPricesEventType as bS, type CryptoPricesSubscription as bT, DeployDepositWalletError as bU, type DeprecatedTransactionHandle as bV, type DownloadAccountingSnapshotRequest as bW, type DropNotificationsRequest as bX, type EquityPricesEventType as bY, type EquityPricesSubscription as bZ, type Erc1155ApprovalForAllWorkflow as b_, type SecureListActivityRequest as ba, type SecureListClosedPositionsRequest as bb, type SecureListComboPositionsRequest as bc, type SecureListPositionsRequest as bd, type SecureRewardsActions as be, type SecureRfqActions as bf, type SecureSubscriptionsActions as bg, type SecureTradingActions as bh, type SecureWalletActions as bi, SetupGaslessWalletError as bj, SetupTradingApprovalsError as bk, type SignerTransactionRequest as bl, SigningError as bm, SplitPositionError as bn, TimeoutError as bo, TransactionFailedError as bp, type TransactionHandle as bq, type TransactionOutcome as br, TransferErc20Error as bs, TransportError as bt, type TypedDataDomain as bu, type TypedDataField as bv, UnexpectedResponseError as bw, WaitForTransactionError as bx, type WalletDerivationConfig as by, accountActions as bz, type AccountIdentity as c, type ListCommentsRequest as c$, type Erc20ApprovalWorkflow as c0, type Erc20ApprovalWorkflowRequest as c1, type Erc20TransferWorkflow as c2, type Erc20TransferWorkflowRequest as c3, type EstimateMarketBuyPriceRequest as c4, type EstimateMarketPriceRequest as c5, type EstimateMarketSellPriceRequest as c6, type EventForSubscriptionSpec as c7, type EventForSubscriptionSpecs as c8, FetchBalanceAllowanceError as c9, type FetchPriceHistoryRequest as cA, type FetchPriceRequest as cB, type FetchPricesRequest as cC, type FetchPublicProfileRequest as cD, type FetchRelatedTagResourcesRequest as cE, type FetchRelatedTagsRequest as cF, type FetchSeriesRequest as cG, type FetchSpreadRequest as cH, type FetchSpreadsRequest as cI, type FetchTagRequest as cJ, FetchTickSizeError as cK, type FetchTickSizeRequest as cL, type FetchTotalEarningsForUserForDayRequest as cM, type FetchTradedMarketCountRequest as cN, GaslessTransactionMetadataSchema as cO, type GaslessWorkflow as cP, type GaslessWorkflowRequest as cQ, IsWalletDeployedError as cR, type IsWalletDeployedRequest as cS, type ListAccountTradesRequest as cT, type ListActivityRequest as cU, type ListBuilderLeaderboardRequest as cV, type ListBuilderTradesRequest as cW, type ListBuilderVolumeRequest as cX, type ListClosedPositionsRequest as cY, type ListComboPositionsRequest as cZ, type ListCommentsByUserAddressRequest as c_, type FetchBalanceAllowanceRequest as ca, FetchBuilderFeeRatesError as cb, type FetchBuilderFeeRatesRequest as cc, type FetchCommentsByIdRequest as cd, type FetchEventLiveVolumeRequest as ce, type FetchEventRequest as cf, type FetchEventTagsRequest as cg, FetchExecuteParamsError as ch, type FetchExecuteParamsRequest as ci, type FetchGaslessTransactionRequest as cj, type FetchLastTradePriceRequest as ck, type FetchLastTradePricesRequest as cl, FetchMarketInfoError as cm, type FetchMarketInfoRequest as cn, type FetchMarketRequest as co, type FetchMarketTagsRequest as cp, type FetchMidpointRequest as cq, type FetchMidpointsRequest as cr, FetchNegRiskError as cs, type FetchNegRiskRequest as ct, type FetchOrderBookRequest as cu, type FetchOrderBooksRequest as cv, type FetchOrderRequest as cw, type FetchOrderScoringRequest as cx, type FetchOrdersScoringRequest as cy, type FetchPortfolioValueRequest as cz, type AnalyticsActions as d, type PublicSubscriptionSpec as d$, type ListCurrentRewardsRequest as d0, type ListEventsRequest as d1, type ListMarketHoldersRequest as d2, type ListMarketPositionsRequest as d3, type ListMarketRewardsRequest as d4, type ListMarketsRequest as d5, type ListOpenInterestRequest as d6, type ListOpenOrdersRequest as d7, type ListPositionsRequest as d8, type ListSeriesRequest as d9, type PrepareLimitOrderRequest as dA, type PrepareMarketBuyOrderRequest as dB, type PrepareMarketOrderRequest as dC, type PrepareMarketSellOrderRequest as dD, PrepareMergeComboPositionError as dE, type PrepareMergeComboPositionRequest as dF, PrepareMergeMarketPositionError as dG, type PrepareMergeMarketPositionRequest as dH, PrepareMergePositionsError as dI, type PrepareMergePositionsRequest as dJ, PrepareRedeemComboPositionError as dK, type PrepareRedeemComboPositionRequest as dL, type PrepareRedeemMarketPositionsByConditionIdRequest as dM, type PrepareRedeemMarketPositionsByMarketIdRequest as dN, PrepareRedeemMarketPositionsError as dO, type PrepareRedeemMarketPositionsRequest as dP, PrepareRedeemPositionsError as dQ, type PrepareRedeemPositionsRequest as dR, PrepareSplitComboPositionError as dS, type PrepareSplitComboPositionRequest as dT, PrepareSplitMarketPositionError as dU, type PrepareSplitMarketPositionRequest as dV, PrepareSplitPositionError as dW, type PrepareSplitPositionRequest as dX, PrepareTradingApprovalsError as dY, type PublicRealtimeEvent as dZ, type PublicRealtimeTopic as d_, type ListTagsRequest as da, type ListTeamsRequest as db, type ListTraderLeaderboardRequest as dc, type ListTradesRequest as dd, type ListUserEarningsAndMarketsConfigRequest as de, type ListUserEarningsForDayRequest as df, type MarketEventType as dg, type MarketSubscription as dh, MergeComboPositionError as di, MergeMarketPositionError as dj, type MergePositionsWorkflow as dk, type MergePositionsWorkflowRequest as dl, type OrderDraft as dm, type OrderPostingWorkflow as dn, type OrderWorkflow as dp, type OrderWorkflowRequest as dq, type PostOrdersRequest as dr, PrepareErc1155ApprovalForAllError as ds, type PrepareErc1155ApprovalForAllRequest as dt, PrepareErc20ApprovalError as du, type PrepareErc20ApprovalRequest as dv, PrepareErc20TransferError as dw, type PrepareErc20TransferRequest as dx, PrepareGaslessTransactionError as dy, type PrepareGaslessTransactionRequest as dz, ApproveErc1155ForAllError as e, fetchPrices as e$, type RedeemPositionsWorkflow as e0, type RedeemPositionsWorkflowRequest as e1, ResolveConditionByTokenError as e2, type ResolveConditionByTokenRequest as e3, type RfqConfirmationRejectedErrorOptions as e4, type RfqExecutionUpdateEvent as e5, type SearchRequest as e6, type SearchResults as e7, type SecureRealtimeEvent as e8, type SecureRealtimeTopic as e9, estimateMarketPrice as eA, fetchBalanceAllowance as eB, fetchBuilderFeeRates as eC, fetchBuilderVolume as eD, fetchClosedOnlyMode as eE, fetchCommentsById as eF, fetchEvent as eG, fetchEventLiveVolume as eH, fetchEventTags as eI, fetchExecuteParams as eJ, fetchLastTradePrice as eK, fetchLastTradePrices as eL, fetchMarket as eM, fetchMarketInfo as eN, fetchMarketTags as eO, fetchMidpoint as eP, fetchMidpoints as eQ, fetchNegRisk as eR, fetchNotifications as eS, fetchOrder as eT, fetchOrderBook as eU, fetchOrderBooks as eV, fetchOrderScoring as eW, fetchOrdersScoring as eX, fetchPortfolioValue as eY, fetchPrice as eZ, fetchPriceHistory as e_, type SecureSubscriptionSpec as ea, type SignedOrder as eb, SplitComboPositionError as ec, SplitMarketPositionError as ed, type SplitPositionWorkflow as ee, type SplitPositionWorkflowRequest as ef, type SportsEventType as eg, type SportsSubscription as eh, type SubscribeError as ei, type SubscriptionHandle as ej, type TradingApprovalsWorkflow as ek, type TradingApprovalsWorkflowRequest as el, UpdateBalanceAllowanceError as em, type UpdateBalanceAllowanceRequest as en, type UserEventType as eo, type UserSubscription as ep, WaitForGaslessTransactionError as eq, approveErc1155ForAll as er, approveErc20 as es, cancelAll as et, cancelMarketOrders as eu, cancelOrder as ev, cancelOrders as ew, deployDepositWallet as ex, downloadAccountingSnapshot as ey, dropNotifications as ez, ApproveErc20Error as f, splitPosition as f$, fetchPublicProfile as f0, fetchRelatedTagResources as f1, fetchRelatedTags as f2, fetchRewardPercentages as f3, fetchSeries as f4, fetchSpread as f5, fetchSpreads as f6, fetchTag as f7, fetchTickSize as f8, fetchTotalEarningsForUserForDay as f9, listUserEarningsForDay as fA, mergeComboPosition as fB, mergeMarketPosition as fC, mergePositions as fD, openRfqSession as fE, postOrder as fF, postOrders as fG, prepareErc1155ApprovalForAll as fH, prepareErc20Approval as fI, prepareErc20Transfer as fJ, prepareGaslessTransaction as fK, prepareMergeComboPosition as fL, prepareMergeMarketPosition as fM, prepareMergePositions as fN, prepareRedeemComboPosition as fO, prepareRedeemMarketPositions as fP, prepareRedeemPositions as fQ, prepareSplitComboPosition as fR, prepareSplitMarketPosition as fS, prepareSplitPosition as fT, prepareTradingApprovals as fU, redeemPositions as fV, resolveConditionByToken as fW, search as fX, setupTradingApprovals as fY, splitComboPosition as fZ, splitMarketPosition as f_, fetchTradedMarketCount as fa, fetchTransaction as fb, isWalletDeployed as fc, listAccountTrades as fd, listActivity as fe, listBuilderLeaderboard as ff, listBuilderTrades as fg, listClosedPositions as fh, listComboPositions as fi, listComments as fj, listCommentsByUserAddress as fk, listCurrentRewards as fl, listEvents as fm, listMarketHolders as fn, listMarketPositions as fo, listMarketRewards as fp, listMarkets as fq, listOpenInterest as fr, listOpenOrders as fs, listPositions as ft, listSeries as fu, listTags as fv, listTeams as fw, listTraderLeaderboard as fx, listTrades as fy, listUserEarningsAndMarketsConfig as fz, BasePublicClient as g, subscribe as g0, transferErc20 as g1, updateBalanceAllowance as g2, BaseSecureClient as h, type BeginAuthenticationRequest as i, CancelMarketOrdersError as j, CancelOrderError as k, CancelOrdersError as l, CancelledSigningError as m, type Client as n, type ClientActions as o, type ClientDecorator as p, CreateSecureClientError as q, type DiscoveryActions as r, DownloadAccountingSnapshotError as s, DropNotificationsError as t, EstimateMarketPriceError as u, FetchCommentsByIdError as v, FetchEventError as w, FetchEventLiveVolumeError as x, FetchEventTagsError as y, FetchLastTradePriceError as z };
|
|
6476
|
+
export { FetchRewardPercentagesError as $, type ApiKeyAuthorization as A, type BaseClient as B, CancelAllError as C, type DataActions as D, type EnvironmentConfig as E, FetchClosedOnlyModeError as F, FetchLastTradePricesError as G, FetchMarketError as H, FetchMarketTagsError as I, FetchMidpointError as J, FetchMidpointsError as K, FetchNotificationsError as L, FetchOrderBookError as M, FetchOrderBooksError as N, FetchOrderError as O, FetchOrderScoringError as P, FetchOrdersScoringError as Q, FetchPortfolioValueError as R, type Signer as S, type TypedDataPayload as T, UserInputError as U, FetchPriceError as V, FetchPriceHistoryError as W, FetchPricesError as X, FetchPublicProfileError as Y, FetchRelatedTagResourcesError as Z, FetchRelatedTagsError as _, type TypedData as a, type RfqQuoteRequestEvent as a$, FetchSeriesError as a0, FetchSpreadError as a1, FetchSpreadsError as a2, FetchTagError as a3, FetchTotalEarningsForUserForDayError as a4, FetchTradedMarketCountError as a5, InsufficientLiquidityError as a6, ListAccountTradesError as a7, ListActivityError as a8, ListBuilderLeaderboardError as a9, PageSizeSchema as aA, type Paginated as aB, PostOrderError as aC, PostOrdersError as aD, type PublicAccountActions as aE, type PublicActions as aF, type PublicClient as aG, type PublicClientOptions as aH, type PublicRewardsActions as aI, type PublicSubscriptionsActions as aJ, RateLimitError as aK, RedeemPositionsError as aL, RequestRejectedError as aM, type RequestRejectedErrorOptions as aN, type RfqCancelQuoteAck as aO, RfqCancelQuoteError as aP, RfqCancelQuoteRejectedError as aQ, type RfqCancelQuoteRejectedErrorOptions as aR, type RfqConfirmationAck as aS, RfqConfirmationError as aT, RfqConfirmationRejectedError as aU, type RfqConfirmationRequestEvent as aV, type RfqEvent as aW, RfqQuoteError as aX, type RfqQuoteReference as aY, RfqQuoteRejectedError as aZ, type RfqQuoteRejectedErrorOptions as a_, ListBuilderTradesError as aa, ListBuilderVolumeError as ab, ListClosedPositionsError as ac, ListComboMarketsError as ad, ListComboPositionsError as ae, ListCommentsByUserAddressError as af, ListCommentsError as ag, ListCurrentRewardsError as ah, ListEventsError as ai, ListMarketHoldersError as aj, ListMarketPositionsError as ak, ListMarketRewardsError as al, ListMarketsError as am, ListOpenInterestError as an, ListOpenOrdersError as ao, ListPositionsError as ap, ListSeriesError as aq, ListTagsError as ar, ListTeamsError as as, ListTraderLeaderboardError as at, ListTradesError as au, ListUserEarningsAndMarketsConfigError as av, ListUserEarningsForDayError as aw, MergePositionsError as ax, OpenRfqSessionError as ay, type Page as az, type TransactionCall as b, type Erc1155ApprovalForAllWorkflow as b$, type RfqQuoteResponse as b0, type RfqQuoteSource as b1, type RfqSession as b2, SearchError as b3, type SecureAccountActions as b4, type SecureActions as b5, type SecureClient as b6, type SecureClientOptions as b7, type SecureDownloadAccountingSnapshotRequest as b8, type SecureFetchPortfolioValueRequest as b9, accountActions as bA, allActions as bB, analyticsActions as bC, createPublicClient as bD, createSecureClient as bE, dataActions as bF, discoveryActions as bG, makeErrorGuard as bH, production as bI, rewardsActions as bJ, rfqActions as bK, subscriptionsActions as bL, tradingActions as bM, walletActions as bN, type CancelMarketOrdersRequest as bO, type CancelOrderRequest as bP, type CancelOrdersRequest as bQ, type CommentsEventType as bR, type CommentsSubscription as bS, type CryptoPricesEventType as bT, type CryptoPricesSubscription as bU, DeployDepositWalletError as bV, type DeprecatedTransactionHandle as bW, type DownloadAccountingSnapshotRequest as bX, type DropNotificationsRequest as bY, type EquityPricesEventType as bZ, type EquityPricesSubscription as b_, type SecureFetchTradedMarketCountRequest as ba, type SecureListActivityRequest as bb, type SecureListClosedPositionsRequest as bc, type SecureListComboPositionsRequest as bd, type SecureListPositionsRequest as be, type SecureRewardsActions as bf, type SecureRfqActions as bg, type SecureSubscriptionsActions as bh, type SecureTradingActions as bi, type SecureWalletActions as bj, SetupGaslessWalletError as bk, SetupTradingApprovalsError as bl, type SignerTransactionRequest as bm, SigningError as bn, SplitPositionError as bo, TimeoutError as bp, TransactionFailedError as bq, type TransactionHandle as br, type TransactionOutcome as bs, TransferErc20Error as bt, TransportError as bu, type TypedDataDomain as bv, type TypedDataField as bw, UnexpectedResponseError as bx, WaitForTransactionError as by, type WalletDerivationConfig as bz, type AccountIdentity as c, type ListComboPositionsRequest as c$, type Erc1155ApprovalForAllWorkflowRequest as c0, type Erc20ApprovalWorkflow as c1, type Erc20ApprovalWorkflowRequest as c2, type Erc20TransferWorkflow as c3, type Erc20TransferWorkflowRequest as c4, type EstimateMarketBuyPriceRequest as c5, type EstimateMarketPriceRequest as c6, type EstimateMarketSellPriceRequest as c7, type EventForSubscriptionSpec as c8, type EventForSubscriptionSpecs as c9, type FetchPortfolioValueRequest as cA, type FetchPriceHistoryRequest as cB, type FetchPriceRequest as cC, type FetchPricesRequest as cD, type FetchPublicProfileRequest as cE, type FetchRelatedTagResourcesRequest as cF, type FetchRelatedTagsRequest as cG, type FetchSeriesRequest as cH, type FetchSpreadRequest as cI, type FetchSpreadsRequest as cJ, type FetchTagRequest as cK, FetchTickSizeError as cL, type FetchTickSizeRequest as cM, type FetchTotalEarningsForUserForDayRequest as cN, type FetchTradedMarketCountRequest as cO, GaslessTransactionMetadataSchema as cP, type GaslessWorkflow as cQ, type GaslessWorkflowRequest as cR, IsWalletDeployedError as cS, type IsWalletDeployedRequest as cT, type ListAccountTradesRequest as cU, type ListActivityRequest as cV, type ListBuilderLeaderboardRequest as cW, type ListBuilderTradesRequest as cX, type ListBuilderVolumeRequest as cY, type ListClosedPositionsRequest as cZ, type ListComboMarketsRequest as c_, FetchBalanceAllowanceError as ca, type FetchBalanceAllowanceRequest as cb, FetchBuilderFeeRatesError as cc, type FetchBuilderFeeRatesRequest as cd, type FetchCommentsByIdRequest as ce, type FetchEventLiveVolumeRequest as cf, type FetchEventRequest as cg, type FetchEventTagsRequest as ch, FetchExecuteParamsError as ci, type FetchExecuteParamsRequest as cj, type FetchGaslessTransactionRequest as ck, type FetchLastTradePriceRequest as cl, type FetchLastTradePricesRequest as cm, FetchMarketInfoError as cn, type FetchMarketInfoRequest as co, type FetchMarketRequest as cp, type FetchMarketTagsRequest as cq, type FetchMidpointRequest as cr, type FetchMidpointsRequest as cs, FetchNegRiskError as ct, type FetchNegRiskRequest as cu, type FetchOrderBookRequest as cv, type FetchOrderBooksRequest as cw, type FetchOrderRequest as cx, type FetchOrderScoringRequest as cy, type FetchOrdersScoringRequest as cz, type AnalyticsActions as d, type PublicRealtimeEvent as d$, type ListCommentsByUserAddressRequest as d0, type ListCommentsRequest as d1, type ListCurrentRewardsRequest as d2, type ListEventsRequest as d3, type ListMarketHoldersRequest as d4, type ListMarketPositionsRequest as d5, type ListMarketRewardsRequest as d6, type ListMarketsRequest as d7, type ListOpenInterestRequest as d8, type ListOpenOrdersRequest as d9, PrepareGaslessTransactionError as dA, type PrepareGaslessTransactionRequest as dB, type PrepareLimitOrderRequest as dC, type PrepareMarketBuyOrderRequest as dD, type PrepareMarketOrderRequest as dE, type PrepareMarketSellOrderRequest as dF, PrepareMergeComboPositionError as dG, type PrepareMergeComboPositionRequest as dH, PrepareMergeMarketPositionError as dI, type PrepareMergeMarketPositionRequest as dJ, PrepareMergePositionsError as dK, type PrepareMergePositionsRequest as dL, PrepareRedeemComboPositionError as dM, type PrepareRedeemComboPositionRequest as dN, type PrepareRedeemMarketPositionsByConditionIdRequest as dO, type PrepareRedeemMarketPositionsByMarketIdRequest as dP, PrepareRedeemMarketPositionsError as dQ, type PrepareRedeemMarketPositionsRequest as dR, PrepareRedeemPositionsError as dS, type PrepareRedeemPositionsRequest as dT, PrepareSplitComboPositionError as dU, type PrepareSplitComboPositionRequest as dV, PrepareSplitMarketPositionError as dW, type PrepareSplitMarketPositionRequest as dX, PrepareSplitPositionError as dY, type PrepareSplitPositionRequest as dZ, PrepareTradingApprovalsError as d_, type ListPositionsRequest as da, type ListSeriesRequest as db, type ListTagsRequest as dc, type ListTeamsRequest as dd, type ListTraderLeaderboardRequest as de, type ListTradesRequest as df, type ListUserEarningsAndMarketsConfigRequest as dg, type ListUserEarningsForDayRequest as dh, type MarketEventType as di, type MarketSubscription as dj, MergeComboPositionError as dk, MergeMarketPositionError as dl, type MergePositionsWorkflow as dm, type MergePositionsWorkflowRequest as dn, type OrderDraft as dp, type OrderPostingWorkflow as dq, type OrderWorkflow as dr, type OrderWorkflowRequest as ds, type PostOrdersRequest as dt, PrepareErc1155ApprovalForAllError as du, type PrepareErc1155ApprovalForAllRequest as dv, PrepareErc20ApprovalError as dw, type PrepareErc20ApprovalRequest as dx, PrepareErc20TransferError as dy, type PrepareErc20TransferRequest as dz, ApproveErc1155ForAllError as e, fetchPrice as e$, type PublicRealtimeTopic as e0, type PublicSubscriptionSpec as e1, type RedeemPositionsWorkflow as e2, type RedeemPositionsWorkflowRequest as e3, ResolveConditionByTokenError as e4, type ResolveConditionByTokenRequest as e5, type RfqConfirmationRejectedErrorOptions as e6, type RfqExecutionUpdateEvent as e7, type SearchRequest as e8, type SearchResults as e9, downloadAccountingSnapshot as eA, dropNotifications as eB, estimateMarketPrice as eC, fetchBalanceAllowance as eD, fetchBuilderFeeRates as eE, fetchBuilderVolume as eF, fetchClosedOnlyMode as eG, fetchCommentsById as eH, fetchEvent as eI, fetchEventLiveVolume as eJ, fetchEventTags as eK, fetchExecuteParams as eL, fetchLastTradePrice as eM, fetchLastTradePrices as eN, fetchMarket as eO, fetchMarketInfo as eP, fetchMarketTags as eQ, fetchMidpoint as eR, fetchMidpoints as eS, fetchNegRisk as eT, fetchNotifications as eU, fetchOrder as eV, fetchOrderBook as eW, fetchOrderBooks as eX, fetchOrderScoring as eY, fetchOrdersScoring as eZ, fetchPortfolioValue as e_, type SecureRealtimeEvent as ea, type SecureRealtimeTopic as eb, type SecureSubscriptionSpec as ec, type SignedOrder as ed, SplitComboPositionError as ee, SplitMarketPositionError as ef, type SplitPositionWorkflow as eg, type SplitPositionWorkflowRequest as eh, type SportsEventType as ei, type SportsSubscription as ej, type SubscribeError as ek, type SubscriptionHandle as el, type TradingApprovalsWorkflow as em, type TradingApprovalsWorkflowRequest as en, UpdateBalanceAllowanceError as eo, type UpdateBalanceAllowanceRequest as ep, type UserEventType as eq, type UserSubscription as er, WaitForGaslessTransactionError as es, approveErc1155ForAll as et, approveErc20 as eu, cancelAll as ev, cancelMarketOrders as ew, cancelOrder as ex, cancelOrders as ey, deployDepositWallet as ez, ApproveErc20Error as f, setupTradingApprovals as f$, fetchPriceHistory as f0, fetchPrices as f1, fetchPublicProfile as f2, fetchRelatedTagResources as f3, fetchRelatedTags as f4, fetchRewardPercentages as f5, fetchSeries as f6, fetchSpread as f7, fetchSpreads as f8, fetchTag as f9, listTraderLeaderboard as fA, listTrades as fB, listUserEarningsAndMarketsConfig as fC, listUserEarningsForDay as fD, mergeComboPosition as fE, mergeMarketPosition as fF, mergePositions as fG, openRfqSession as fH, postOrder as fI, postOrders as fJ, prepareErc1155ApprovalForAll as fK, prepareErc20Approval as fL, prepareErc20Transfer as fM, prepareGaslessTransaction as fN, prepareMergeComboPosition as fO, prepareMergeMarketPosition as fP, prepareMergePositions as fQ, prepareRedeemComboPosition as fR, prepareRedeemMarketPositions as fS, prepareRedeemPositions as fT, prepareSplitComboPosition as fU, prepareSplitMarketPosition as fV, prepareSplitPosition as fW, prepareTradingApprovals as fX, redeemPositions as fY, resolveConditionByToken as fZ, search as f_, fetchTickSize as fa, fetchTotalEarningsForUserForDay as fb, fetchTradedMarketCount as fc, fetchTransaction as fd, isWalletDeployed as fe, listAccountTrades as ff, listActivity as fg, listBuilderLeaderboard as fh, listBuilderTrades as fi, listClosedPositions as fj, listComboMarkets as fk, listComboPositions as fl, listComments as fm, listCommentsByUserAddress as fn, listCurrentRewards as fo, listEvents as fp, listMarketHolders as fq, listMarketPositions as fr, listMarketRewards as fs, listMarkets as ft, listOpenInterest as fu, listOpenOrders as fv, listPositions as fw, listSeries as fx, listTags as fy, listTeams as fz, BasePublicClient as g, splitComboPosition as g0, splitMarketPosition as g1, splitPosition as g2, subscribe as g3, transferErc20 as g4, updateBalanceAllowance as g5, BaseSecureClient as h, type BeginAuthenticationRequest as i, CancelMarketOrdersError as j, CancelOrderError as k, CancelOrdersError as l, CancelledSigningError as m, type Client as n, type ClientActions as o, type ClientDecorator as p, CreateSecureClientError as q, type DiscoveryActions as r, DownloadAccountingSnapshotError as s, DropNotificationsError as t, EstimateMarketPriceError as u, FetchCommentsByIdError as v, FetchEventError as w, FetchEventLiveVolumeError as x, FetchEventTagsError as y, FetchLastTradePriceError as z };
|
package/dist/viem.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PrivateKey } from '@polymarket/types';
|
|
2
2
|
import { Chain, Transport, WalletClient } from 'viem';
|
|
3
|
-
import { S as Signer } from './types-
|
|
3
|
+
import { S as Signer } from './types-DLNcPNT6.js';
|
|
4
4
|
import '@polymarket/bindings';
|
|
5
5
|
import '@polymarket/bindings/gamma';
|
|
6
6
|
import '@polymarket/bindings/relayer';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polymarket/client",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.6",
|
|
4
4
|
"description": "The Polymarket TypeScript client",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"ky": "^1.14.3",
|
|
93
93
|
"ox": "^0.14.16",
|
|
94
94
|
"zod": "^4.3.6",
|
|
95
|
-
"@polymarket/bindings": "0.1.0-beta.
|
|
95
|
+
"@polymarket/bindings": "0.1.0-beta.5",
|
|
96
96
|
"@polymarket/types": "0.1.0-beta.3"
|
|
97
97
|
},
|
|
98
98
|
"publishConfig": {
|
package/dist/chunk-76B5WBIO.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {k,e,d,j as j$1,c,b,a,f as f$1,g,h,i}from'./chunk-E2CLUN5M.js';import {PaginationCursorSchema,TransactionIdSchema,EvmAddressSchema,BuilderCodeSchema,TokenIdSchema,CtfConditionIdSchema,OrderSideSchema,CommentParentEntityTypeSchema,EventIdSchema,CommentIdSchema,IsoDateTimeStringSchema,IsoCalendarDateStringSchema,PositionIdSchema,OrderType,PositiveDecimalNumberSchema,OrderSide,ComboConditionIdSchema,MarketIdSchema,toComboConditionId,toPositionId,toPaginationCursor}from'@polymarket/bindings';import {AssetTypeSchema,PriceHistoryIntervalSchema,SignatureType,AssetType,ClosedOnlyModeSchema,OpenOrdersPageSchema,END_CURSOR,OpenOrderSchema,ClobTradesPageSchema,NotificationsResponseSchema,BalanceAllowanceResponseSchema,OrderScoringResponseSchema,OrdersScoringResponseSchema,UserEarningsPageSchema,TotalUserEarningsResponseSchema,UserRewardsEarningsPageSchema,RewardsPercentagesSchema,ApiKeyCredsSchema,ApiKeysResponseSchema,BuilderApiKeyCredsSchema,BuilderApiKeysResponseSchema,PaginatedBuilderTradesSchema,MidpointSchema,MidpointsSchema,FetchTickSizeResponseSchema,FetchNegRiskResponseSchema,ResolveConditionByTokenResponseSchema,FetchMarketInfoResponseSchema,FetchBuilderFeeRatesResponseSchema,PriceSchema,PricesSchema,FetchOrderBookResponseSchema,OrderBooksSchema,SpreadSchema,SpreadsSchema,LastTradePriceSchema,LastTradePricesSchema,PriceHistorySchema,PaginatedCurrentRewardsSchema,PaginatedMarketRewardsSchema,CancelOrdersResponseSchema,OrderResponseSchema,OrderResponsesSchema}from'@polymarket/bindings/clob';import {isHexString,expectNonEmptyArray,PolymarketError,isSameEvmAddress,never,unwrap,invariant,expectEvmAddress,delay,expectEvmSignature,expectHexString,ZERO_ADDRESS,expectErc1271Signature,isPresent,ok,err,ResultAsync}from'@polymarket/types';import {z as z$1}from'zod';import {WalletType,SeriesIdSchema,ListCommentsResponseSchema,ListEventsKeysetResponseSchema,EventSchema,FetchEventTagsResponseSchema,ListMarketsKeysetResponseSchema,FetchMarketTagsResponseSchema,MarketSchema,PublicProfileSchema,PublicSearchResponseSchema,ListSeriesResponseSchema,SeriesSchema,ListSportsMetadataResponseSchema,SportsMarketTypesResponseSchema,ListTagsResponseSchema,TagSchema,ListRelatedTagsResponseSchema,ListRelatedTagResourcesResponseSchema,ListTeamsResponseSchema}from'@polymarket/bindings/gamma';import {AbiFunction,Hash,Bytes,AbiParameters,TypedData,ContractAddress}from'ox';import Qr from'ky';import {SideSchema,ActivityTypeSchema,TimePeriodSchema,LeaderboardOrderBySchema,LeaderboardCategorySchema,ComboPositionStatusSchema,ListTradesResponseSchema,ListActivityResponseSchema,FetchEventLiveVolumeResponseSchema,ListBuilderLeaderboardResponseSchema,ListBuilderVolumeResponseSchema,ListTraderLeaderboardResponseSchema,ListMarketHoldersResponseSchema,ListOpenInterestResponseSchema,ListMarketPositionsResponseSchema,ListPositionsResponseSchema,ListClosedPositionsResponseSchema,ListComboPositionsResponseSchema,FetchPortfolioValueResponseSchema,TradedSchema}from'@polymarket/bindings/data';export{ComboPositionStatus as kd}from'@polymarket/bindings/data';import {RelayerTransactionType,RelayerExecuteRequestSchema,RelayerTransactionState,RelayerExecuteParamsSchema,RelayerDeployedResponseSchema,GaslessTransactionSchema,RelayerExecuteResponseSchema}from'@polymarket/bindings/relayer';export{RfqConfirmationDecision as $d,RfqDirection as ae,RfqErrorCode as be,RfqExecutionStatus as ce,RfqRequestedSizeUnit as de,RfqSide as ee}from'@polymarket/bindings/rfq';import Md from'it-merge';function l(e,r){let t=r.safeParse(e);if(t.success)return t.data;throw a.fromZodError(t.error)}var q=z$1.number().int().positive(),Kr=z$1.object({offset:z$1.number().int().min(0),pageSize:q});function C(e,r,t=[]){function o(){return {async firstPage(){return {items:t,hasMore:false}},from(){return o()},async*[Symbol.asyncIterator](){}}}function n(c=r){return {firstPage(){return unwrap(e(c))},from(a){return a===void 0?o():n(a)},async*[Symbol.asyncIterator](){let a=c;for(;;){let y=await unwrap(e(a));if(yield y,!y.hasMore)return;a=y.nextCursor;}}}}return n()}function v(e){return toPaginationCursor(btoa(JSON.stringify(Kr.parse(e))))}function O(e,r){if(e===void 0)return {offset:0,pageSize:r};try{return Kr.parse(JSON.parse(atob(e)))}catch(t){throw new a("Invalid pagination cursor",{cause:t})}}function f(e){return function(t){return ResultAsync.fromPromise(t.json(),()=>new b(`Received non-JSON response from ${t.url}`)).andThen(o=>kn(t.url,e,o))}}function Jr(e){return ResultAsync.fromPromise(e.blob(),()=>new b(`Received unreadable binary response from ${e.url}`))}function kn(e,r,t){let o=r.safeParse(t);return o.success?ok(o.data):err(b.fromZodError(o.error,{endpoint:e}))}var Zr=class{#e;constructor({url:r}){this.#e=r;}async ethCall(r){let t=await this.#r({jsonrpc:"2.0",id:1,method:"eth_call",params:[{to:r.to,data:r.data},"latest"]});if("error"in t)throw new d(`JSON-RPC eth_call failed: ${t.error.message}`,{cause:t.error,status:200});if(typeof t.result!="string")throw new b("Expected JSON-RPC eth_call result to be a hex string");if(!ot(t.result))throw new b("Expected JSON-RPC eth_call result to be a hex string");return t.result}async ethCallBatch(r){if(r.length===0)return [];let t=await this.#t(r.map((n,c)=>({jsonrpc:"2.0",id:c+1,method:"eth_call",params:[{to:n.to,data:n.data},"latest"]}))),o=new Map;for(let n of t){if("error"in n&&n.id===null)throw new d(`JSON-RPC eth_call failed: ${n.error.message}`,{cause:n.error,status:200});n.id!==null&&o.set(n.id,n);}return r.map((n,c)=>{let a=c+1,y=o.get(a);if(y===void 0)throw new b("Expected JSON-RPC batch response for every request");if("error"in y)throw new d(`JSON-RPC eth_call failed: ${y.error.message}`,{cause:y.error,status:200});return bn(y.result)})}async#r(r){let t;try{t=await Qr.post(this.#e,{json:r,throwHttpErrors:!1});}catch(n){throw c.fromError(n)}if(!t.ok)throw new d(`JSON-RPC request to ${this.#e} failed with status ${t.status}`,{status:t.status});let o;try{o=await t.json();}catch(n){throw new b("Expected JSON-RPC response body to be JSON",{cause:n})}if(!Xr(o))throw new b("Unexpected JSON-RPC response shape");return o}async#t(r){let t;try{t=await Qr.post(this.#e,{json:r,throwHttpErrors:!1});}catch(n){throw c.fromError(n)}if(!t.ok)throw new d(`JSON-RPC request to ${this.#e} failed with status ${t.status}`,{status:t.status});let o;try{o=await t.json();}catch(n){throw new b("Expected JSON-RPC response body to be JSON",{cause:n})}if(!Array.isArray(o)||!o.every(n=>Xr(n)))throw new b("Unexpected JSON-RPC response shape");return o}};function et(e){if(!(e instanceof d)||!rt(e.cause))return false;let r=[e.cause.message,In(e.cause.data)].join(" ").toLowerCase();return (e.cause.code===3||e.cause.code===-32e3||e.cause.code===-32003||e.cause.code===-32015||e.cause.code===-32603)&&(r.includes("execution reverted")||r.includes("revert")||r.includes("invalid opcode"))}function Xr(e){return !tt(e)||e.jsonrpc!=="2.0"?false:"error"in e?rt(e.error):"result"in e}function rt(e){return tt(e)&&typeof e.code=="number"&&typeof e.message=="string"}function tt(e){return typeof e=="object"&&e!==null}function ot(e){return /^0x[a-fA-F0-9]*$/.test(e)}function bn(e){if(typeof e!="string"||!ot(e))throw new b("Expected JSON-RPC eth_call result to be a hex string");return e}function In(e){if(e===void 0)return "";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return ""}}function Eu(e,r,t){return {signer:r,wallet:t,walletType:$n(e,r,t)}}function ee(e){switch(e){case WalletType.EOA:return SignatureType.EOA;case WalletType.POLY_PROXY:return SignatureType.POLY_PROXY;case WalletType.GNOSIS_SAFE:return SignatureType.POLY_GNOSIS_SAFE;case WalletType.DEPOSIT_WALLET:return SignatureType.POLY_1271}}function nt(e){let r=ee(e.walletType);return {maker:e.wallet,signatureType:r,signer:r===SignatureType.POLY_1271?e.wallet:e.signer}}var qn="3d3d606380380380913d393d73%s5af4602a57600080fd5b602d8060366000396000f3363d3d373d3d3d363d73%s5af43d82803e903d91602b57fd5bf352e831dd00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000";function vn(e){let r=qn.replace("%s",e.proxyFactory.slice(2).toLowerCase()).replace("%s",e.proxyImplementation.slice(2).toLowerCase());return expectHexString(Hash.keccak256(`0x${r}`))}function On(e,r){return expectEvmAddress(ContractAddress.fromCreate2({bytecodeHash:vn(r),from:r.proxyFactory,salt:Hash.keccak256(AbiParameters.encodePacked(["address"],[e]))}))}function Ln(e,r){return expectEvmAddress(ContractAddress.fromCreate2({bytecodeHash:r.safeInitCodeHash,from:r.safeFactory,salt:Hash.keccak256(AbiParameters.encode([{name:"address",type:"address"}],[e]))}))}var wn="0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3",Mn="0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076",Bn=0x61003d3d8160233d3973n;function at(e,r){let t=expectHexString(`0x${e.slice(2).padStart(64,"0")}`),o=AbiParameters.encode([{type:"address"},{type:"bytes32"}],[r.depositWalletFactory,t]);return expectEvmAddress(ContractAddress.fromCreate2({bytecodeHash:Hn(r.depositWalletImplementation,o),from:r.depositWalletFactory,salt:Hash.keccak256(o)}))}var Fn="0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3",Un="0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c",zn="0x60195155f3363d3d373d3d363d602036600436635c60da",Dn=0x6100523d8160233d3973n,jn="0x49493a4d";function st(e,r){let t=expectHexString(`0x${e.slice(2).padStart(64,"0")}`),o=AbiParameters.encode([{type:"address"},{type:"bytes32"}],[r.depositWalletFactory,t]);return expectEvmAddress(ContractAddress.fromCreate2({bytecodeHash:Wn(r.depositWalletBeacon,o),from:r.depositWalletFactory,salt:Hash.keccak256(o)}))}function Hn(e,r){let t=BigInt((r.length-2)/2),o=Bn+(t<<56n);return expectHexString(Hash.keccak256(Bytes.concat(Bytes.fromNumber(o,{size:10}),Bytes.fromHex(e),Bytes.fromHex("0x6009"),Bytes.fromHex(Mn),Bytes.fromHex(wn),Bytes.fromHex(r)),{as:"Hex"}))}function Wn(e,r){let t=BigInt((r.length-2)/2),o=Dn+(t<<56n);return expectHexString(Hash.keccak256(Bytes.concat(Bytes.fromNumber(o,{size:10}),Bytes.fromHex(e),Bytes.fromHex(zn),Bytes.fromHex(Un),Bytes.fromHex(Fn),Bytes.fromHex(r)),{as:"Hex"}))}async function _n(e,r){try{let t=await e.ethCall({to:r,data:jn});return Gn(t)}catch(t){if(et(t))return ZERO_ADDRESS;throw t}}async function Nn(e,r){let t=await _n(e,r);return !isSameEvmAddress(t,ZERO_ADDRESS)}async function it(e,r,t){return await Nn(e,t.depositWalletFactory)?st(r,t):at(r,t)}function Gn(e){return e.length<66?ZERO_ADDRESS:expectEvmAddress(`0x${e.slice(-40)}`)}function $n(e,r,t){if(isSameEvmAddress(t,r))return WalletType.EOA;let o=e.walletDerivation;if(isSameEvmAddress(t,st(r,o)))return WalletType.DEPOSIT_WALLET;if(isSameEvmAddress(t,at(r,o)))return WalletType.DEPOSIT_WALLET;if(isSameEvmAddress(t,Ln(r,o)))return WalletType.GNOSIS_SAFE;if(isSameEvmAddress(t,On(r,o)))return WalletType.POLY_PROXY;never(`Wallet ${t} does not match the signer ${r} or any supported deterministic wallet address.`);}function R(e,r){if(Vn(r))return Kn(e,r.exceptions);let t=new URLSearchParams;for(let[o,n]of Object.entries(r)){let c=e[o];if(c!==void 0){if(pt(c)){for(let a of c)t.append(n,fe(a));continue}t.append(n,fe(c));}}return t}function S(e={}){return {format:"snake_case",exceptions:e}}function w(e){let r=new URLSearchParams;for(let[t,o]of Object.entries(e))if(o!==void 0){if(Array.isArray(o)){r.append(t,o.map(fe).join(","));continue}r.append(t,fe(o));}return r}function Vn(e){return "format"in e}function Kn(e,r){let t=new URLSearchParams;for(let[o,n]of Object.entries(e)){if(n===void 0)continue;let c=r[o]??Yn(o);if(pt(n)){for(let a of n)t.append(c,fe(a));continue}t.append(c,fe(n));}return t}function pt(e){return Array.isArray(e)}function Yn(e){return e.replace(/[A-Z]/g,r=>`_${r.toLowerCase()}`)}function fe(e){return String(e)}var qu=k(e,d,j$1,c,b);async function vu(e){return (await unwrap(e.secureClob.get("/auth/ban-status/closed-only").andThen(f(ClosedOnlyModeSchema)))).closedOnly}var pa=z$1.object({tokenId:z$1.string().optional(),cursor:PaginationCursorSchema.optional(),id:z$1.string().optional(),market:z$1.string().optional()}).default({}),Ou=k(e,d,j$1,c,b,a);function Lu(e,r){let{cursor:t,...o}=l(r,pa);return C(n=>e.secureClob.get("/data/orders",{params:R({...o,nextCursor:n},S({tokenId:"asset_id"}))}).andThen(f(OpenOrdersPageSchema)).map(c=>({items:c.data,hasMore:c.nextCursor!==END_CURSOR,nextCursor:c.nextCursor===END_CURSOR?void 0:toPaginationCursor(c.nextCursor),totalCount:c.count})),t)}var ca=z$1.object({orderId:z$1.string()}),wu=k(e,d,j$1,c,b,a);async function Mu(e,r){let t=l(r,ca);return unwrap(e.secureClob.get(`/data/order/${t.orderId}`).andThen(f(OpenOrderSchema)))}var da={after:z$1.string().optional(),tokenId:z$1.string().optional(),before:z$1.string().optional(),cursor:PaginationCursorSchema.optional(),id:z$1.string().optional(),makerAddress:z$1.string().optional(),market:z$1.string().optional()},ua=z$1.object(da).default({}),Bu=k(e,d,j$1,c,b,a);function Fu(e,r){let{cursor:t,...o}=l(r,ua);return C(n=>e.secureClob.get("/data/trades",{params:R({...o,nextCursor:n},S({tokenId:"asset_id"}))}).andThen(f(ClobTradesPageSchema)).map(c=>({items:c.data,hasMore:c.nextCursor!==END_CURSOR,nextCursor:c.nextCursor===END_CURSOR?void 0:toPaginationCursor(c.nextCursor),totalCount:c.count})),t)}var Uu=k(e,d,j$1,c,b),ma=z$1.object({ids:z$1.array(z$1.string()).min(1)});async function zu(e){let r=ee(e.account.walletType);return unwrap(e.secureClob.get("/notifications",{params:R({signatureType:r},S())}).andThen(f(NotificationsResponseSchema)))}var Du=k(e,d,j$1,c,b,a);async function ju(e,r){let t=l(r,ma),o=ee(e.account.walletType),n=R({ids:t.ids.join(","),signatureType:o},S());await unwrap(e.secureClob.del("/notifications",{params:n}));}var la=z$1.object({assetType:AssetTypeSchema,tokenId:z$1.string().optional()}),Hu=k(e,d,j$1,c,b,a);async function sr(e,r){let t=l(r,la),o=ee(e.account.walletType);return unwrap(e.secureClob.get("/balance-allowance",{params:R({...t,signatureType:o},S())}).andThen(f(BalanceAllowanceResponseSchema)))}var fa=z$1.object({assetType:AssetTypeSchema,tokenId:z$1.string().optional()}),Wu=k(e,d,j$1,c,b,a);async function dt(e,r){let t=l(r,fa),o=ee(e.account.walletType),n=R({...t,signatureType:o},S());return await unwrap(e.secureClob.get("/balance-allowance/update",{params:n})),sr(e,t)}var ya=z$1.object({orderId:z$1.string()}),_u=k(e,d,j$1,c,b,a);async function Nu(e,r){let t=l(r,ya);return (await unwrap(e.secureClob.get("/order-scoring",{params:R(t,S())}).andThen(f(OrderScoringResponseSchema)))).scoring}var Ea=z$1.object({orderIds:z$1.array(z$1.string())}),Gu=k(e,d,j$1,c,b,a);async function $u(e,r){let o=l(r,Ea).orderIds;return unwrap(e.secureClob.post("/orders-scoring",{json:o}).andThen(f(OrdersScoringResponseSchema)))}var ut=z$1.object({cursor:PaginationCursorSchema.optional(),date:z$1.string()}),Vu=k(e,d,j$1,c,b,a);function Ku(e,r){let{cursor:t,...o}=l(r,ut),n=ee(e.account.walletType);return C(c=>e.secureClob.get("/rewards/user",{params:R({...o,nextCursor:c,signatureType:n},S())}).andThen(f(UserEarningsPageSchema)).map(a=>({items:a.data,hasMore:a.nextCursor!==END_CURSOR,nextCursor:a.nextCursor===END_CURSOR?void 0:toPaginationCursor(a.nextCursor),totalCount:a.count})),t)}var Yu=k(e,d,j$1,c,b,a);async function Ju(e,r){let t=l(r,ut),o=ee(e.account.walletType);return unwrap(e.secureClob.get("/rewards/user/total",{params:R({...t,signatureType:o},S())}).andThen(f(TotalUserEarningsResponseSchema)))}var ga=z$1.object({cursor:PaginationCursorSchema.optional(),date:z$1.string(),noCompetition:z$1.boolean().optional(),orderBy:z$1.string().optional(),pageSize:q.max(500).default(100),position:z$1.string().optional()}),Qu=k(e,d,j$1,c,b,a);function Zu(e,r){let{cursor:t,...o}=l(r,ga),n=ee(e.account.walletType);return C(c=>e.secureClob.get("/rewards/user/markets",{params:R({...o,nextCursor:c,signatureType:n},S())}).andThen(f(UserRewardsEarningsPageSchema)).map(a=>({items:a.data,hasMore:a.nextCursor!==END_CURSOR,nextCursor:a.nextCursor===END_CURSOR?void 0:toPaginationCursor(a.nextCursor),totalCount:a.count})),t)}var Xu=k(e,d,j$1,c,b);async function em(e){let r=ee(e.account.walletType);return unwrap(e.secureClob.get("/rewards/user/percentages",{params:R({signatureType:r},S())}).andThen(f(RewardsPercentagesSchema)))}var xa=z$1.enum(["TIMESTAMP","TOKENS","CASH"]),Ta=z$1.enum(["ASC","DESC"]),Pa=z$1.enum(["CASH","TOKENS"]),Ca=z$1.object({cursor:PaginationCursorSchema.optional(),pageSize:q.default(20),takerOnly:z$1.boolean().optional(),filterType:Pa.optional(),filterAmount:z$1.number().optional(),market:z$1.array(z$1.string()).optional(),eventId:z$1.array(z$1.number().int()).optional(),user:z$1.string().optional(),side:SideSchema.optional()}).refine(e=>!(e.market&&e.eventId),{message:"Provide market or eventId, not both",path:["eventId"]}).refine(e=>e.filterType===void 0==(e.filterAmount===void 0),{message:"Provide filterType and filterAmount together",path:["filterAmount"]}),ka=z$1.object({cursor:PaginationCursorSchema.optional(),pageSize:q.default(20),user:z$1.string(),market:z$1.array(z$1.string()).optional(),eventId:z$1.array(z$1.number().int()).optional(),type:z$1.array(ActivityTypeSchema).optional(),start:z$1.number().int().optional(),end:z$1.number().int().optional(),sortBy:xa.optional(),sortDirection:Ta.optional(),side:SideSchema.optional()}).refine(e=>!(e.market&&e.eventId),{message:"Provide market or eventId, not both",path:["eventId"]}),dm=k(e,d,c,b,a);function um(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,Ca);return C(c=>{let a=O(c,o);return e.data.get("/trades",{params:w({...n,limit:a.pageSize+1,offset:a.offset})}).andThen(f(ListTradesResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var mm=k(e,d,c,b,a);function lm(e,r){let{cursor:t,pageSize:o,...n}=l(r,ka);return C(c=>{let a=O(c,o);return e.data.get("/activity",{params:w({...n,limit:a.pageSize+1,offset:a.offset})}).andThen(f(ListActivityResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var Ia=64,Aa=/^0x[0-9a-fA-F]{62}$/,qa=/^0x[0-9a-fA-F]{64}$/,ir="0x0000000000000000000000000000000000000000000000000000000000000000",va=AbiFunction.from("function approve(address spender, uint256 amount)"),yt=AbiFunction.from("function allowance(address owner, address spender) view returns (uint256)"),Oa=AbiFunction.from("function transfer(address recipient, uint256 amount)"),La=AbiFunction.from("function setApprovalForAll(address operator, bool approved)"),Et=AbiFunction.from("function isApprovedForAll(address account, address operator) view returns (bool)"),gt=AbiFunction.from("function balanceOf(address account, uint256 id) view returns (uint256)"),Rt=AbiFunction.from("function balanceOfBatch(address[] accounts, uint256[] ids) view returns (uint256[])"),wa=AbiFunction.from("function splitPosition(address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] partition, uint256 amount)"),Ma=AbiFunction.from("function mergePositions(address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] partition, uint256 amount)"),Ba=AbiFunction.from("function redeemPositions(address collateralToken, bytes32 parentCollectionId, bytes32 conditionId, uint256[] indexSets)"),Fa=AbiFunction.from("function split(bytes31 conditionId, uint256 amount)"),Ua=AbiFunction.from("function merge(bytes31 conditionId, uint256 amount)"),za=AbiFunction.from("function redeem(bytes31 conditionId, uint256 outcomeIndex, uint256 amount)"),Da=AbiFunction.from("function prepareCondition(uint256[] legs) returns (bytes31)"),ja=AbiFunction.from("function multiSend(bytes)"),Ha=AbiFunction.from("function proxy((uint8 typeCode, address to, uint256 value, bytes data)[] calls) returns (bytes[])"),St=[1n,2n],Wa=[1n,2n],$=(1n<<256n)-1n,Rm=k(a);function He(e,r,t){if(t<0n)throw new a("Approval amount must be non-negative");if(t>$)throw new a("Approval amount exceeds uint256 range");return {data:_a(r,t),to:e}}function ht(e,r,t){return {data:AbiFunction.encodeData(yt,[r,t]),to:e}}function xt(e){return AbiFunction.decodeResult(yt,e)}function We(e,r,t){return {data:Na(r,t),to:e}}function Tt(e,r,t){return {data:AbiFunction.encodeData(Et,[r,t]),to:e}}function Pt(e){return AbiFunction.decodeResult(Et,e)}function Ct(e,r,t){return {data:AbiFunction.encodeData(gt,[r,ie(BigInt(t),"Position ID")]),to:e}}function kt(e){return AbiFunction.decodeResult(gt,e)}function pr(e,r,t){return {data:AbiFunction.encodeData(Rt,[t.map(()=>r),t.map(o=>ie(BigInt(o),"id"))]),to:e}}function cr(e){return AbiFunction.decodeResult(Rt,e)}var Sm=k(a);function dr(e,r,t){if(t<0n)throw new a("Transfer amount must be non-negative");if(t>$)throw new a("Transfer amount exceeds uint256 range");return {data:Ga(r,t),to:e}}var hm=k(a),xm=k(a);function bt(e,r,t,o){return {data:$a(r,t,o),to:e}}var Tm=k(a);function It(e,r,t,o){return {data:Va(r,t,o),to:e}}function At(e,r,t){return {data:Ka(r,t),to:e}}var Pm=k(a);function qt(e,r,t){return {data:AbiFunction.encodeData(Fa,[mr(r),ie(t,"Split amount")]),to:e}}var Cm=k(a);function vt(e,r,t){return {data:AbiFunction.encodeData(Ua,[mr(r),ie(t,"Merge amount")]),to:e}}var km=k(a);function Ot(e,r,t,o){return {data:AbiFunction.encodeData(za,[mr(r),BigInt(Ya(t)),ie(o,"Redeem amount")]),to:e}}var bm=k(a);function ur(e,r){return {data:AbiFunction.encodeData(Da,[r.map(t=>ie(t,"Leg position ID"))]),to:e}}function _a(e,r){return invariant(r>=0n,"Approval amount must be non-negative"),AbiFunction.encodeData(va,[e,r])}function Na(e,r){return AbiFunction.encodeData(La,[e,r])}function Ga(e,r){return AbiFunction.encodeData(Oa,[e,r])}function $a(e,r,t){return AbiFunction.encodeData(wa,[e,ir,r,St,ie(t,"Split amount")])}function Va(e,r,t){return AbiFunction.encodeData(Ma,[e,ir,r,St,ie(t,"Merge amount")])}function Ka(e,r){return AbiFunction.encodeData(Ba,[e,ir,r,Wa])}function ie(e,r){if(e<0n)throw new a(`${r} must be non-negative`);if(e>$)throw new a(`${r} exceeds uint256 range`);return e}function mr(e){if(Aa.test(e))return e.toLowerCase();if(qa.test(e)){let r=e.toLowerCase();if(r.endsWith("00")||r.endsWith("01"))return r.slice(0,Ia)}throw new a("Protocol v2 condition ID must be bytes31, or bytes32 with a binary outcome byte")}function Ya(e){if(e!==0&&e!==1)throw new a("Protocol v2 outcome index must be 0 or 1");return e}function Lt(e){return AbiFunction.encodeData(Ha,[e.map(r=>({typeCode:1,to:r.to,value:r.value??0n,data:r.data}))])}function wt(e){let r=e.map(t=>Ja(t));return AbiFunction.encodeData(ja,[r.length===0?"0x":AbiParameters.encodePacked(Array.from({length:r.length},()=>"bytes"),r)])}function Ja(e){let r=e.value??0n;return AbiParameters.encodePacked(["uint8","address","uint256","uint256","bytes"],[0,e.to,r,BigInt((e.data.length-2)/2),e.data])}var vm=k(e,d,f$1,g,c,b,a);function z(e,r="Expected a TransactionHandle"){return invariant(typeof e=="object"&&e!==null&&"transactionHash"in e&&"transactionId"in e&&"wait"in e&&typeof e.wait=="function",r),e}k(h,j$1);k(h,j$1);function Bm(e){return async function(t){let o=await t.next();for(;!o.done;)try{switch(o.value.kind){case "requestAddress":o=await t.next(await e.getAddress());break;case "signAuthMessage":o=await t.next(await e.signTypedData(o.value.payload));break}}catch(n){o=await t.throw(n);}return o.value}}function F(e){return async function(t){let o=await t.next();for(;!o.done;)try{switch(o.value.kind){case "requestAddress":o=await t.next(await e.getAddress());break;case "signGaslessTypedData":case "signOrder":o=await t.next(await e.signTypedData(o.value.payload));break;case "signGaslessMessage":o=await t.next(await e.signMessage(o.value.payload));break;case "sendErc20ApprovalTransaction":case "sendErc1155ApprovalForAllTransaction":case "sendErc20TransferTransaction":case "sendMergePositionsTransaction":case "sendRedeemPositionsTransaction":case "sendSplitPositionTransaction":o=await t.next(await e.sendTransaction(o.value.request));break}}catch(n){o=await t.throw(n);}return o.value}}function Mt(){return {kind:"requestAddress"}}function D(e,r){return {chainId:e,...r}}var cs=[{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],ds=[{name:"to",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"},{name:"operation",type:"uint8"},{name:"safeTxGas",type:"uint256"},{name:"baseGas",type:"uint256"},{name:"gasPrice",type:"uint256"},{name:"gasToken",type:"address"},{name:"refundReceiver",type:"address"},{name:"nonce",type:"uint256"}],us="DepositWallet",ms="1",ls=600,fs=[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],ys=[{name:"wallet",type:"address"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"},{name:"calls",type:"Call[]"}],Es=z$1.object({address:z$1.string(),type:z$1.enum(RelayerTransactionType)}),Jm=k(e,d,c,b,a);async function Er(e,r){let t=l(r,Es);return unwrap(e.relayer.get("/v1/account/transactions/params",{params:R(t,{address:"address",type:"type"})}).andThen(f(RelayerExecuteParamsSchema)))}var gs=z$1.object({transactionId:TransactionIdSchema}),Rs=z$1.object({wallet:EvmAddressSchema,type:z$1.enum(WalletType)}),Qm=k(e,d,c,b,a);async function Zm(e,r){let t=await Ss(e,r);return t.type===WalletType.EOA?false:unwrap(e.relayer.get("/deployed",{params:R({address:t.wallet,type:t.type===WalletType.DEPOSIT_WALLET?RelayerTransactionType.WALLET:void 0},{address:"address",type:"type"})}).andThen(f(RelayerDeployedResponseSchema)).map(({deployed:o})=>o))}async function Ss(e,r){if(r!==void 0)return l(r,Rs);if(!e.isSecureClient())throw new a("Gasless readiness inference requires a secure client. Pass a wallet and type when using a public client.");return e.account.walletType!==WalletType.EOA?{wallet:e.account.wallet,type:e.account.walletType}:{wallet:await it(e.rpc,e.account.signer,e.environment.walletDerivation),type:WalletType.DEPOSIT_WALLET}}var j=z$1.string().max(500),Bt=10,Xm=k(e,d,c,b,a);async function el(e){return invariant(e.supportsGasless,"Deposit Wallet deployment requires a Relayer API Key or Builder API Key in the client configuration."),Ge(e,{from:e.account.signer,metadata:"Deploy Deposit Wallet",to:e.environment.walletDerivation.depositWalletFactory,type:RelayerTransactionType.WALLET_CREATE})}async function hs(e,r){let t=l(r,gs);return unwrap(e.relayer.get(`/v1/account/transactions/${t.transactionId}`).andThen(f(GaslessTransactionSchema)))}var xs=z$1.object({data:z$1.custom(isHexString),to:EvmAddressSchema,value:z$1.bigint().optional()}),Ts=z$1.object({calls:z$1.array(xs).min(1).transform(e=>expectNonEmptyArray(e)),metadata:j}),rl=k(e,d,c,b,a);async function G(e,r){let t=l(r,Ts);return invariant(e.supportsGasless,"Gasless transactions require a Relayer API Key or Builder API Key in the client configuration."),invariant(e.account.walletType===WalletType.GNOSIS_SAFE||e.account.walletType===WalletType.POLY_PROXY||e.account.walletType===WalletType.DEPOSIT_WALLET,"Gasless transaction preparation supports Deposit Wallet, Safe-backed, and proxy-backed accounts"),async function*(){let o=expectEvmAddress(yield Mt());invariant(o===e.account.signer,"Wallet client address does not match the authenticated signer");for(let n=0;n<=Bt;n+=1)try{switch(e.account.walletType){case WalletType.POLY_PROXY:return yield*Ps(e,t);case WalletType.DEPOSIT_WALLET:return yield*Cs(e,t);case WalletType.GNOSIS_SAFE:return yield*ks(e,t)}invariant(!1,"Unsupported wallet type for gasless transaction");}catch(c){if(!bs(c)||n===Bt)throw c;await delay(e.environment.relayerPollFrequencyMs);}invariant(false,"Expected gasless transaction retry loop to return");}.call(null)}async function*Ps(e,r){let t=await Er(e,{address:e.account.signer,type:RelayerTransactionType.PROXY}),o=e.environment.walletDerivation.proxyFactory,n=Lt(r.calls),c="0",a="0",y="10000000",x=e.environment.relayHub,Ae=ZERO_ADDRESS,hn=ws(e.account.signer,o,n,c,a,y,t.nonce,x,Ae),xn=expectEvmSignature(yield zt(hn));return Ge(e,{data:n,from:e.account.signer,metadata:r.metadata,nonce:t.nonce,proxyWallet:e.account.wallet,signature:xn,signatureParams:{gasLimit:y,gasPrice:a,relay:Ae,relayHub:x,relayerFee:c},to:o,type:RelayerTransactionType.PROXY})}async function*Cs(e,r){let t=await Er(e,{address:e.account.signer,type:RelayerTransactionType.WALLET}),o=r.calls.map(Is),n=`${Math.floor(Date.now()/1e3)+ls}`,c=expectEvmSignature(yield Ls(As({calls:o,chainId:e.environment.chainId,deadline:n,nonce:t.nonce,wallet:e.account.wallet}))),a={depositWalletParams:{calls:o,deadline:n,depositWallet:e.account.wallet},from:e.account.signer,metadata:r.metadata,nonce:t.nonce,signature:c,to:e.environment.walletDerivation.depositWalletFactory,type:RelayerTransactionType.WALLET};return Ge(e,a)}async function*ks(e,r){let t=await Er(e,{address:e.account.signer,type:RelayerTransactionType.SAFE}),o=qs(r.calls,e.environment.safeMultisend),n=Os({chainId:e.environment.chainId,data:o.data,nonce:t.nonce,operation:o.operation,safeAddress:e.account.wallet,to:o.to,value:o.value}),c=expectEvmSignature(yield zt(expectHexString(TypedData.getSignPayload(n))));return Ge(e,{data:o.data,from:e.account.signer,metadata:r.metadata,nonce:t.nonce,proxyWallet:e.account.wallet,signature:Ms(c),signatureParams:vs(o.operation),to:o.to,type:RelayerTransactionType.SAFE,value:o.value>0n?`${o.value}`:void 0})}async function Ge(e,r){let t=l(r,RelayerExecuteRequestSchema),o=await unwrap(e.relayer.post("/submit",{json:t}).andThen(f(RelayerExecuteResponseSchema)));return new lr(e,o)}function bs(e$1){if(e$1 instanceof e)return true;if(!(e$1 instanceof d)||e$1.status!==400)return false;if(/wallet busy/i.test(e$1.message)&&/active action/i.test(e$1.message)||/wallet has in-flight action/i.test(e$1.message))return true;let r=/batch nonce\s+(\d+)\s+does not match on-chain nonce\s+(\d+)/i.exec(e$1.message);if(r===null)return false;let t=r[1],o=r[2];return t===void 0||o===void 0?false:BigInt(t)<BigInt(o)}function Is(e){return {data:e.data,target:e.to,value:`${e.value??0n}`}}function As(e){return {domain:{chainId:e.chainId,name:us,verifyingContract:e.wallet,version:ms},message:{calls:e.calls.map(r=>({data:r.data,target:r.target,value:BigInt(r.value)})),deadline:BigInt(e.deadline),nonce:BigInt(e.nonce),wallet:e.wallet},primaryType:"Batch",types:{Batch:ys,Call:fs}}}function qs(e,r){if(e.length===1){let[t]=e;return {data:t.data,operation:0,to:t.to,value:t.value??0n}}return {data:wt(e),operation:1,to:r,value:0n}}function vs(e){return {baseGas:"0",gasPrice:"0",gasToken:ZERO_ADDRESS,operation:`${e}`,refundReceiver:ZERO_ADDRESS,safeTxnGas:"0"}}function Os(e){return {domain:{chainId:e.chainId,verifyingContract:e.safeAddress},message:{baseGas:0n,data:e.data,gasPrice:0n,gasToken:ZERO_ADDRESS,nonce:BigInt(e.nonce),operation:e.operation,refundReceiver:ZERO_ADDRESS,safeTxGas:0n,to:e.to,value:e.value},primaryType:"SafeTx",types:{EIP712Domain:cs,SafeTx:ds}}}function zt(e){return {kind:"signGaslessMessage",payload:e}}function Ls(e){return {kind:"signGaslessTypedData",payload:e}}function ws(e,r,t,o,n,c,a,y,x){return expectHexString(Hash.keccak256(Bytes.concat(Bytes.fromString("rlx:"),Bytes.fromHex(e),Bytes.fromHex(r),Bytes.fromHex(t),Bytes.fromNumber(BigInt(o),{size:32}),Bytes.fromNumber(BigInt(n),{size:32}),Bytes.fromNumber(BigInt(c),{size:32}),Bytes.fromNumber(BigInt(a),{size:32}),Bytes.fromHex(y),Bytes.fromHex(x)),{as:"Hex"}))}function Ms(e){let r=e.slice(2),t=Number.parseInt(r.slice(128,130),16),o=t===0||t===1?t+31:t===27||t===28?t+4:t;return expectHexString(`0x${r.slice(0,128)}${o.toString(16).padStart(2,"0")}`)}var tl=k(e,d,c,b,a,f$1,g),lr=class{#e;transactionHash;transactionId;constructor(r,t){this.#e=r,this.transactionHash=t.transactionHash,this.transactionId=t.transactionId;}async wait(){let r=0;for(;r<this.#e.environment.relayerMaxPolls;){let t=await hs(this.#e,{transactionId:this.transactionId});if(t.state===RelayerTransactionState.STATE_MINED||t.state===RelayerTransactionState.STATE_CONFIRMED){let o=t.transactionHash??this.transactionHash;if(o===null)throw new b("Expected submitted transaction to have a transaction hash once settled");return {transactionHash:o,transactionId:t.transactionId}}if(t.state===RelayerTransactionState.STATE_FAILED||t.state===RelayerTransactionState.STATE_INVALID)throw new g(t.errorMsg??`Transaction ${t.transactionId} reached terminal state ${t.state}`);r+=1,await delay(this.#e.environment.relayerPollFrequencyMs);}throw new f$1(`Timed out waiting for transaction ${this.transactionId} to settle`)}};var Bs=z$1.object({amount:z$1.union([z$1.bigint(),z$1.literal("max")]),metadata:j.optional(),spenderAddress:EvmAddressSchema,tokenAddress:EvmAddressSchema}),ll=k(a);async function Fs(e,r){let t=l(r,Bs),o=t.amount==="max"?$:t.amount;return async function*(){return e.account.walletType===WalletType.EOA?z(yield Ht(D(e.environment.chainId,He(t.tokenAddress,t.spenderAddress,o)))):yield*await G(e,{calls:[He(t.tokenAddress,t.spenderAddress,o)],metadata:t.metadata??`Approve ${t.amount} of ${t.tokenAddress} to ${t.spenderAddress}`})}.call(null)}var fl=k(h,e,d,j$1,c,b,a);function Dt(e,r){return Fs(e,r).then(F(e.signer))}var Us=z$1.object({approved:z$1.boolean().default(true),metadata:j.optional(),operatorAddress:EvmAddressSchema,tokenAddress:EvmAddressSchema}),yl=k(a);async function zs(e,r){let t=l(r,Us);return async function*(){return e.account.walletType===WalletType.EOA?z(yield Wt(D(e.environment.chainId,We(t.tokenAddress,t.operatorAddress,t.approved)))):yield*await G(e,{calls:[We(t.tokenAddress,t.operatorAddress,t.approved)],metadata:t.metadata??`${t.approved?"Approve":"Revoke"} ${t.operatorAddress} on ${t.tokenAddress}`})}.call(null)}var El=k(h,e,d,j$1,c,b,a);function jt(e,r){return zs(e,r).then(F(e.signer))}var gl=k(d,c,b,a);async function Ds(e){let r=await Hs(e),t=r.erc20.map(n=>He(n.tokenAddress,n.spenderAddress,n.amount)),o=r.erc1155.map(n=>We(n.tokenAddress,n.operatorAddress,true));return async function*(){if(t.length===0&&o.length===0)return;if(e.account.walletType===WalletType.EOA){for(let c of t)await z(yield Ht(D(e.environment.chainId,c))).wait();for(let c of o)await z(yield Wt(D(e.environment.chainId,c))).wait();return}await(yield*await G(e,{calls:[...t,...o],metadata:"Trading setup approvals"})).wait();}.call(null)}var Rl=k(h,e,d,j$1,f$1,g,c,b,a);function Sl(e){return Ds(e).then(F(e.signer)).then(js)}function js(){return {transactionHash:null,transactionId:null,wait:async()=>{}}}async function Hs(e){let r=Ws(e),t=[...r.erc20.map(a=>ht(a.tokenAddress,e.account.wallet,a.spenderAddress)),...r.erc1155.map(a=>Tt(a.tokenAddress,e.account.wallet,a.operatorAddress))],o=await e.rpc.ethCallBatch(t),n=o.slice(0,r.erc20.length),c=o.slice(r.erc20.length);return {erc20:r.erc20.filter((a,y)=>xt(n[y])<a.amount),erc1155:r.erc1155.filter((a,y)=>!Pt(c[y]))}}function Ws(e){return {erc20:[{amount:$,spenderAddress:e.environment.standardExchange,tokenAddress:e.environment.collateralToken},{amount:$,spenderAddress:e.environment.negRiskExchange,tokenAddress:e.environment.collateralToken},{amount:$,spenderAddress:e.environment.negRiskAdapter,tokenAddress:e.environment.collateralToken},{amount:$,spenderAddress:e.environment.collateralAdapter,tokenAddress:e.environment.collateralToken},{amount:$,spenderAddress:e.environment.negRiskCollateralAdapter,tokenAddress:e.environment.collateralToken},{amount:$,spenderAddress:e.environment.protocolV2Router,tokenAddress:e.environment.collateralToken},{amount:$,spenderAddress:e.environment.exchangeV3,tokenAddress:e.environment.collateralToken}],erc1155:[{operatorAddress:e.environment.standardExchange,tokenAddress:e.environment.conditionalTokens},{operatorAddress:e.environment.negRiskExchange,tokenAddress:e.environment.conditionalTokens},{operatorAddress:e.environment.negRiskAdapter,tokenAddress:e.environment.conditionalTokens},{operatorAddress:e.environment.collateralAdapter,tokenAddress:e.environment.conditionalTokens},{operatorAddress:e.environment.negRiskCollateralAdapter,tokenAddress:e.environment.conditionalTokens},{operatorAddress:e.environment.autoRedeemOperator,tokenAddress:e.environment.conditionalTokens},{operatorAddress:e.environment.protocolV2Router,tokenAddress:e.environment.positionManager},{operatorAddress:e.environment.exchangeV3,tokenAddress:e.environment.positionManager},{operatorAddress:e.environment.autoRedeemOperator,tokenAddress:e.environment.positionManager}]}}function Ht(e){return {kind:"sendErc20ApprovalTransaction",request:e}}function Wt(e){return {kind:"sendErc1155ApprovalForAllTransaction",request:e}}var bl=k(e,d,c,b);async function $s(e,r){return unwrap(e.clob.post("/auth/api-key",{headers:Gt(r)}).andThen(f(ApiKeyCredsSchema)))}var Il=k(e,d,c,b);async function Vs(e,r){return unwrap(e.clob.get("/auth/derive-api-key",{headers:Gt(r)}).andThen(f(ApiKeyCredsSchema)))}var Al=k(e,d,c,b);async function ql(e,r){try{return await $s(e,r)}catch(t){if(!(t instanceof d)||t.status!==400)throw t}return Vs(e,r)}var vl=k(e,d,j$1,c,b);async function Ol(e){return (await unwrap(e.secureClob.get("/auth/api-keys").andThen(f(ApiKeysResponseSchema)))).apiKeys}var Ll=k(e,d,j$1,c,b);async function wl(e){await unwrap(e.secureClob.del("/auth/api-key").andThen(f(z$1.literal("OK"))));}var Ml=k(e,d,j$1,c,b);async function Bl(e){return unwrap(e.secureClob.post("/auth/builder-api-key").andThen(f(BuilderApiKeyCredsSchema)))}var Fl=k(e,d,j$1,c,b);async function Ul(e){return unwrap(e.secureClob.get("/auth/builder-api-key").andThen(f(BuilderApiKeysResponseSchema)))}var zl=k(e,d,j$1,c,b);async function Dl(e){await unwrap(e.clob.del("/auth/builder-api-key").andThen(f(z$1.literal("OK"))));}function Gt(e){return {POLY_ADDRESS:e.address,POLY_NONCE:`${e.nonce}`,POLY_SIGNATURE:e.signature,POLY_TIMESTAMP:`${e.timestamp}`}}var Zs=z$1.object({after:z$1.string().optional(),before:z$1.string().optional(),builderCode:BuilderCodeSchema,cursor:PaginationCursorSchema.optional(),id:z$1.string().optional(),market:z$1.string().optional(),tokenId:z$1.string().optional()}),Yl=k(e,d,c,b,a);function Jl(e,r){let{cursor:t,...o}=l(r,Zs);return C(n=>e.clob.get("/builder/trades",{params:R({...o,nextCursor:n},S({builderCode:"builder_code",tokenId:"asset_id"}))}).andThen(f(PaginatedBuilderTradesSchema)).map(c=>({items:c.data,hasMore:c.nextCursor!==END_CURSOR,nextCursor:c.nextCursor===END_CURSOR?void 0:toPaginationCursor(c.nextCursor),totalCount:c.count})),t)}var hi=z$1.object({tokenId:z$1.string()}),pf=k(e,d,c,b,a);async function cf(e,r){let t=l(r,hi);return (await unwrap(e.clob.get("/midpoint",{params:R(t,S())}).andThen(f(MidpointSchema)))).mid}var xi=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),df=k(e,d,c,b,a);async function uf(e,r){let t=l(r,xi);return unwrap(e.clob.post("midpoints",{json:Ke(t)}).andThen(f(MidpointsSchema)))}var Ti=z$1.object({tokenId:z$1.string()}),mf=k(e,d,c,b,a);async function Re(e,r){let t=l(r,Ti);return (await unwrap(e.clob.get("/tick-size",{params:R(t,S())}).andThen(f(FetchTickSizeResponseSchema)))).minimumTickSize}var Pi=z$1.object({tokenId:z$1.string()}),lf=k(e,d,c,b,a);async function Se(e,r){let t=l(r,Pi);return (await unwrap(e.clob.get("/neg-risk",{params:R(t,S())}).andThen(f(FetchNegRiskResponseSchema)))).negRisk}var Ci=z$1.object({tokenId:TokenIdSchema}),ff=k(e,d,c,b,a);async function Qt(e,r){let t=l(r,Ci);return unwrap(e.clob.get(`/markets-by-token/${t.tokenId}`).andThen(f(ResolveConditionByTokenResponseSchema)))}var ki=z$1.object({conditionId:CtfConditionIdSchema}),yf=k(e,d,c,b,a);async function Zt(e,r){let t=l(r,ki);return unwrap(e.clob.get(`/clob-markets/${t.conditionId}`).andThen(f(FetchMarketInfoResponseSchema)))}var bi=z$1.object({builderCode:BuilderCodeSchema}),Ef=k(e,d,c,b,a);async function Xt(e,r){let t=l(r,bi);return unwrap(e.clob.get(`/fees/builder-fees/${t.builderCode}`).andThen(f(FetchBuilderFeeRatesResponseSchema)).mapErr(o=>o instanceof d&&o.status===404?new a(`Unknown builder code: ${t.builderCode}`,{cause:o}):o))}var Ii=z$1.object({tokenId:z$1.string(),side:OrderSideSchema}),gf=k(e,d,c,b,a);async function Rf(e,r){let t=l(r,Ii);return (await unwrap(e.clob.get("/price",{params:R(t,S())}).andThen(f(PriceSchema)))).price}var Ai=z$1.array(z$1.object({tokenId:z$1.string(),side:OrderSideSchema})).min(1),Sf=k(e,d,c,b,a);async function hf(e,r){let t=l(r,Ai);return unwrap(e.clob.post("prices",{json:zi(t)}).andThen(f(PricesSchema)))}var qi=z$1.object({tokenId:z$1.string()}),xf=k(e,d,c,b,a);async function eo(e,r){let t=l(r,qi);return unwrap(e.clob.get("/book",{params:R(t,S())}).andThen(f(FetchOrderBookResponseSchema)))}var vi=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),Tf=k(e,d,c,b,a);async function Pf(e,r){let t=l(r,vi);return unwrap(e.clob.post("books",{json:Ke(t)}).andThen(f(OrderBooksSchema)))}var Oi=z$1.object({tokenId:z$1.string()}),Cf=k(e,d,c,b,a);async function kf(e,r){let t=l(r,Oi);return (await unwrap(e.clob.get("/spread",{params:R(t,S())}).andThen(f(SpreadSchema)))).spread}var Li=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),bf=k(e,d,c,b,a);async function If(e,r){let t=l(r,Li);return unwrap(e.clob.post("spreads",{json:Ke(t)}).andThen(f(SpreadsSchema)))}var wi=z$1.object({tokenId:z$1.string()}),Af=k(e,d,c,b,a);async function qf(e,r){let t=l(r,wi);return unwrap(e.clob.get("/last-trade-price",{params:R(t,S())}).andThen(f(LastTradePriceSchema)))}var Mi=z$1.array(z$1.object({tokenId:z$1.string()})).min(1),vf=k(e,d,c,b,a);async function Of(e,r){let t=l(r,Mi);return unwrap(e.clob.post("last-trades-prices",{json:Ke(t)}).andThen(f(LastTradePricesSchema)))}var Bi=z$1.object({tokenId:z$1.string(),startTs:z$1.number().int().optional(),endTs:z$1.number().int().optional(),fidelity:z$1.number().int().positive().optional(),interval:PriceHistoryIntervalSchema.optional()}),Lf=k(e,d,c,b,a);async function wf(e,r){let t=l(r,Bi);return (await unwrap(e.clob.get("/prices-history",{params:R(t,{tokenId:"market",startTs:"startTs",endTs:"endTs",fidelity:"fidelity",interval:"interval"})}).andThen(f(PriceHistorySchema)))).history}var Fi=z$1.object({cursor:PaginationCursorSchema.optional(),sponsored:z$1.boolean().optional()}).default({}),Mf=k(e,d,c,b,a);function Bf(e,r={}){let{cursor:t,...o}=l(r,Fi);return C(n=>e.clob.get("/rewards/markets/current",{params:R({...o,nextCursor:n},S())}).andThen(f(PaginatedCurrentRewardsSchema)).map(c=>({items:c.data,hasMore:c.nextCursor!==END_CURSOR,nextCursor:c.nextCursor===END_CURSOR?void 0:toPaginationCursor(c.nextCursor),totalCount:c.count})),t)}var Ui=z$1.object({conditionId:CtfConditionIdSchema,cursor:PaginationCursorSchema.optional(),sponsored:z$1.boolean().optional()}),Ff=k(e,d,c,b,a);function Uf(e,r){let{cursor:t,...o}=l(r,Ui);return C(n=>e.clob.get(`rewards/markets/${o.conditionId}`,{params:R({nextCursor:n,sponsored:o.sponsored},S())}).andThen(f(PaginatedMarketRewardsSchema)).map(c=>({items:c.data,hasMore:c.nextCursor!==END_CURSOR,nextCursor:c.nextCursor===END_CURSOR?void 0:toPaginationCursor(c.nextCursor),totalCount:c.count})),t)}function Ke(e){return e.map(({tokenId:r})=>({token_id:r}))}function zi(e){return e.map(({tokenId:r,side:t})=>({token_id:r,side:t}))}var Ni=z$1.object({ascending:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),pageSize:q.default(20),getPositions:z$1.boolean().optional(),holdersOnly:z$1.boolean().optional(),order:z$1.string().optional(),parentEntityId:z$1.union([EventIdSchema,SeriesIdSchema]),parentEntityType:CommentParentEntityTypeSchema}),Gi=z$1.object({getPositions:z$1.boolean().optional(),id:CommentIdSchema}),$i=z$1.object({address:z$1.string(),ascending:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),order:z$1.string().optional(),pageSize:q.default(20)}),Kf=k(e,d,c,b,a);function Yf(e,r){let{cursor:t,pageSize:o,...n}=l(r,Ni);return C(c=>{let a=O(c,o);return e.gamma.get("/comments",{params:R({ascending:n.ascending,getPositions:n.getPositions,holdersOnly:n.holdersOnly,limit:a.pageSize+1,offset:a.offset,order:n.order,parentEntityId:n.parentEntityId,parentEntityType:n.parentEntityType},S())}).andThen(f(ListCommentsResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var Jf=k(e,d,c,b,a);async function Qf(e,r){let t=l(r,Gi);return unwrap(e.gamma.get(`comments/${t.id}`,{params:R({getPositions:t.getPositions},S())}).andThen(f(ListCommentsResponseSchema)))}var Zf=k(e,d,c,b,a);function Xf(e,r){let{address:t,cursor:o,pageSize:n,...c}=l(r,$i);return C(a=>{let y=O(a,n);return e.gamma.get(`comments/user_address/${t}`,{params:R({ascending:c.ascending,limit:y.pageSize+1,offset:y.offset,order:c.order},S())}).andThen(f(ListCommentsResponseSchema)).map(x=>{let Ae=x.length>y.pageSize;return {items:x.slice(0,y.pageSize),hasMore:Ae,nextCursor:Ae?v({offset:y.offset+y.pageSize,pageSize:y.pageSize}):void 0}})},o)}function Ye(e,r){let t;try{t=new URL(e);}catch(y){throw new a("Expected a valid Polymarket URL.",{cause:y})}if(t.protocol!=="https:"||t.hostname!=="polymarket.com"&&t.hostname!=="www.polymarket.com")throw new a("Expected a valid Polymarket URL.");let[o,n,...c]=t.pathname.split("/").filter(Boolean),a$1=c[0];if(r==="market"&&o==="event"&&n!==void 0&&c.length<=1)return a$1??n;if(o!==r||n===void 0||c.length>0)throw new a(`Expected a Polymarket ${r} URL.`);return n}var Zi=z$1.object({ascending:z$1.boolean().optional(),closed:z$1.boolean().default(false),cursor:PaginationCursorSchema.optional(),pageSize:q.optional(),cyom:z$1.boolean().optional(),endDateMax:IsoDateTimeStringSchema.optional(),endDateMin:IsoDateTimeStringSchema.optional(),ended:z$1.boolean().optional(),eventDate:IsoCalendarDateStringSchema.optional(),eventWeek:z$1.number().int().optional(),excludeTagIds:z$1.array(z$1.number().int()).optional(),featured:z$1.boolean().optional(),featuredOrder:z$1.boolean().optional(),gameIds:z$1.array(z$1.number().int()).optional(),ids:z$1.array(z$1.number().int()).optional(),includeBestLines:z$1.boolean().optional(),includeChat:z$1.boolean().optional(),includeChildren:z$1.boolean().optional(),includeTemplate:z$1.boolean().optional(),liquidityMax:z$1.number().optional(),liquidityMin:z$1.number().optional(),live:z$1.boolean().optional(),locale:z$1.string().optional(),order:z$1.string().optional(),parentEventId:z$1.number().int().optional(),partnerSlug:z$1.string().optional(),recurrence:z$1.enum(["daily","weekly","monthly"]).optional(),relatedTags:z$1.boolean().optional(),seriesIds:z$1.array(z$1.number().int()).optional(),slug:z$1.array(z$1.string()).optional(),startDateMax:IsoDateTimeStringSchema.optional(),startDateMin:IsoDateTimeStringSchema.optional(),startTimeMax:IsoDateTimeStringSchema.optional(),startTimeMin:IsoDateTimeStringSchema.optional(),tagIds:z$1.array(z$1.number().int()).optional(),tagMatch:z$1.enum(["any","all"]).optional(),tagSlug:z$1.string().optional(),titleSearch:z$1.string().optional(),volumeMax:z$1.number().optional(),volumeMin:z$1.number().optional()}),Xi=z$1.union([z$1.object({id:z$1.string(),includeBestLines:z$1.boolean().optional(),includeChat:z$1.boolean().optional(),includeTemplate:z$1.boolean().optional(),locale:z$1.string().optional()}),z$1.object({slug:z$1.string(),includeBestLines:z$1.boolean().optional(),includeChat:z$1.boolean().optional(),includeTemplate:z$1.boolean().optional(),locale:z$1.string().optional()}),z$1.object({url:z$1.string(),includeBestLines:z$1.boolean().optional(),includeChat:z$1.boolean().optional(),includeTemplate:z$1.boolean().optional(),locale:z$1.string().optional()})]),ep=z$1.object({id:z$1.string()}),rp=z$1.object({id:z$1.string()}),fy=k(e,d,c,b,a);function yy(e,r={}){let t=l(r,Zi);return C(o=>e.gamma.get("/events/keyset",{params:tp({...t,cursor:o??t.cursor})}).andThen(f(ListEventsKeysetResponseSchema)).map(n=>({items:n.items,hasMore:n.nextCursor!==void 0,nextCursor:n.nextCursor})),t.cursor)}var Ey=k(e,d,c,b,a);async function gy(e,r){let t=l(r,Xi);if("id"in t)return unwrap(e.gamma.get(`events/${t.id}`,{params:op(t)}).andThen(f(EventSchema)));let o="url"in t?Ye(t.url,"event"):t.slug;return unwrap(e.gamma.get(`events/slug/${o}`,{params:np(t)}).andThen(f(EventSchema)))}var Ry=k(e,d,c,b,a);async function Sy(e,r){let t=l(r,ep);return unwrap(e.gamma.get(`events/${t.id}/tags`).andThen(f(FetchEventTagsResponseSchema)))}var hy=k(e,d,c,b,a);async function xy(e,r){let t=l(r,rp);return unwrap(e.data.get("/live-volume",{params:w(t)}).andThen(f(FetchEventLiveVolumeResponseSchema)))}function tp(e){return R(e,S({cursor:"after_cursor",excludeTagIds:"exclude_tag_id",gameIds:"game_id",ids:"id",pageSize:"limit",seriesIds:"series_id",tagIds:"tag_id"}))}function op(e){return R({includeBestLines:e.includeBestLines,includeChat:e.includeChat,includeTemplate:e.includeTemplate,locale:e.locale},S())}function np(e){return R({includeBestLines:e.includeBestLines,includeChat:e.includeChat,includeTemplate:e.includeTemplate,locale:e.locale},S())}var up=z$1.object({cursor:PaginationCursorSchema.optional(),pageSize:q.default(20),timePeriod:TimePeriodSchema.optional()}),mp=z$1.object({timePeriod:TimePeriodSchema.optional()}),lp=z$1.object({category:LeaderboardCategorySchema.optional(),cursor:PaginationCursorSchema.optional(),pageSize:q.default(20),timePeriod:TimePeriodSchema.optional(),orderBy:LeaderboardOrderBySchema.optional(),user:z$1.string().optional(),userName:z$1.string().optional()}),Ly=k(e,d,c,b,a);function wy(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,up);return C(c=>{let a=O(c,o);return e.data.get("/v1/builders/leaderboard",{params:w({...n,limit:a.pageSize+1,offset:a.offset})}).andThen(f(ListBuilderLeaderboardResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var My=k(e,d,c,b,a);async function By(e,r={}){let t=l(r,mp);return unwrap(e.data.get("/v1/builders/volume",{params:w(t)}).andThen(f(ListBuilderVolumeResponseSchema)))}var Fy=k(e,d,c,b,a);function Uy(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,lp);return C(c=>{let a=O(c,o);return e.data.get("/v1/leaderboard",{params:w({...n,limit:a.pageSize+1,offset:a.offset})}).andThen(f(ListTraderLeaderboardResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var xp=z$1.object({ascending:z$1.boolean().optional(),closed:z$1.boolean().optional(),clobTokenIds:z$1.array(z$1.string()).optional(),cursor:PaginationCursorSchema.optional(),pageSize:q.optional(),conditionIds:z$1.array(CtfConditionIdSchema).optional(),cyom:z$1.boolean().optional(),decimalized:z$1.boolean().optional(),endDateMax:IsoDateTimeStringSchema.optional(),endDateMin:IsoDateTimeStringSchema.optional(),gameId:z$1.string().optional(),ids:z$1.array(z$1.number().int()).optional(),includeTag:z$1.boolean().optional(),liquidityNumMax:z$1.number().optional(),liquidityNumMin:z$1.number().optional(),locale:z$1.string().optional(),marketMakerAddresses:z$1.array(z$1.string()).optional(),order:z$1.string().optional(),positionIds:z$1.array(PositionIdSchema).optional(),questionIds:z$1.array(z$1.string()).optional(),relatedTags:z$1.boolean().optional(),rfqEnabled:z$1.boolean().optional(),rewardsMinSize:z$1.number().optional(),slug:z$1.array(z$1.string()).optional(),sportsMarketTypes:z$1.array(z$1.string()).optional(),startDateMax:IsoDateTimeStringSchema.optional(),startDateMin:IsoDateTimeStringSchema.optional(),tagId:z$1.number().int().optional(),tagMatch:z$1.enum(["any","all"]).optional(),umaResolutionStatus:z$1.string().optional(),volumeNumMax:z$1.number().optional(),volumeNumMin:z$1.number().optional()}),Tp=z$1.object({id:z$1.string(),includeTag:z$1.boolean().optional(),locale:z$1.string().optional()}),Pp=z$1.object({slug:z$1.string(),includeTag:z$1.boolean().optional(),locale:z$1.string().optional()}),Cp=z$1.object({url:z$1.string(),includeTag:z$1.boolean().optional(),locale:z$1.string().optional()}),kp=z$1.union([Tp,Pp,Cp]),bp=z$1.object({id:z$1.string()}),Ip=z$1.object({limit:z$1.number().int().optional(),market:z$1.array(z$1.string()),minBalance:z$1.number().int().optional()}),Ap=z$1.object({market:z$1.array(z$1.string()).optional()}),qp=z$1.enum(["OPEN","CLOSED","ALL"]),vp=z$1.enum(["TOKENS","CASH_PNL","REALIZED_PNL","TOTAL_PNL"]),Op=z$1.enum(["ASC","DESC"]),Lp=z$1.object({cursor:PaginationCursorSchema.optional(),market:z$1.string(),pageSize:q.default(20),user:z$1.string().optional(),status:qp.optional(),sortBy:vp.optional(),sortDirection:Op.optional()}),Jy=k(e,d,c,b,a);function io(e,r={}){let t=l(r,xp);return C(o=>e.gamma.get("/markets/keyset",{params:wp({...t,cursor:o??t.cursor})}).andThen(f(ListMarketsKeysetResponseSchema)).map(n=>({items:n.items,hasMore:n.nextCursor!==void 0,nextCursor:n.nextCursor})),t.cursor)}var Qy=k(e,d,c,b,a);async function Zy(e,r){let t=l(r,kp);return "id"in t?Mp(e,t):"url"in t?no(e,{includeTag:t.includeTag,locale:t.locale,slug:Ye(t.url,"market")}):no(e,t)}var Xy=k(e,d,c,b,a);async function eE(e,r){let t=l(r,bp);return unwrap(e.gamma.get(`markets/${t.id}/tags`).andThen(f(FetchMarketTagsResponseSchema)))}var rE=k(e,d,c,b,a);async function tE(e,r){let t=l(r,Ip);return unwrap(e.data.get("/holders",{params:w(t)}).andThen(f(ListMarketHoldersResponseSchema)))}var oE=k(e,d,c,b,a);async function nE(e,r={}){let t=l(r,Ap);return unwrap(e.data.get("/oi",{params:w(t)}).andThen(f(ListOpenInterestResponseSchema)))}var aE=k(e,d,c,b,a);function sE(e,r){let{cursor:t,pageSize:o,...n}=l(r,Lp);return C(c=>{let a=O(c,o);return e.data.get("/v1/market-positions",{params:w({...n,limit:a.pageSize+1,offset:a.offset})}).andThen(f(ListMarketPositionsResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}function wp(e){return R(e,S({cursor:"after_cursor",ids:"id",marketMakerAddresses:"market_maker_address",pageSize:"limit"}))}async function no(e,r){return unwrap(e.gamma.get(`markets/slug/${r.slug}`,{params:R({includeTag:r.includeTag,locale:r.locale},S())}).andThen(f(MarketSchema)))}async function Mp(e,r){return unwrap(e.gamma.get(`markets/${r.id}`,{params:R({includeTag:r.includeTag,locale:r.locale},S())}).andThen(f(MarketSchema)))}var Up=z$1.object({orderId:z$1.string()}),zp=z$1.object({orderIds:z$1.array(z$1.string()).min(1).max(3e3)}),Dp=z$1.object({tokenId:z$1.string().optional(),market:z$1.string().optional()}).refine(e=>e.market!==void 0||e.tokenId!==void 0,{message:"At least one of market or tokenId is required.",path:["market"]}),fE=k(d,e,j$1,c,b,a);async function yE(e,r){let t=l(r,Up);return Ze(e,"/order",{orderID:t.orderId})}var EE=k(d,e,j$1,c,b,a);async function gE(e,r){let t=l(r,zp);return Ze(e,"/orders",t.orderIds)}var RE=k(d,e,j$1,c,b);async function SE(e){return Ze(e,"/cancel-all")}var hE=k(d,e,j$1,c,b,a);async function xE(e,r){let t=l(r,Dp);return Ze(e,"/cancel-market-orders",{asset_id:t.tokenId,market:t.market})}async function Ze(e,r,t){return unwrap(e.secureClob.del(r,{json:t}).andThen(f(CancelOrdersResponseSchema)))}var co=z$1.object({tokenId:z$1.string(),orderType:z$1.union([z$1.literal(OrderType.FAK),z$1.literal(OrderType.FOK)]).default(OrderType.FOK)}),Hp=z$1.discriminatedUnion("side",[co.extend({side:z$1.literal(OrderSide.BUY),amount:PositiveDecimalNumberSchema}),co.extend({side:z$1.literal(OrderSide.SELL),shares:PositiveDecimalNumberSchema})]),qE=k(i,e,d,c,b,a);async function vE(e,r){let t=l(r,Hp),o=await Re(e,{tokenId:t.tokenId}),n=t.side===OrderSide.BUY?t.amount:t.shares;return hr(e,{amount:n,orderType:t.orderType,side:t.side,tickSize:o,tokenId:t.tokenId})}async function hr(e,r){let t=await eo(e,{tokenId:r.tokenId}),o=r.side===OrderSide.BUY?_p(t.asks,r.amount,r.orderType):Np(t.bids,r.amount,r.orderType);return invariant(Wp(o,r.tickSize),`Resolved market price fell outside the valid range for tick size ${r.tickSize}.`),o}function Wp(e,r){return e>=r&&e<=1-r}function _p(e,r,t){if(e.length===0)throw new i("No resting liquidity.");let o=0;for(let c=e.length-1;c>=0;c-=1){let a=e[c];if(a!==void 0&&(o+=Number.parseFloat(a.size)*Number.parseFloat(a.price),o>=r))return Number.parseFloat(a.price)}if(t===OrderType.FOK)throw new i("Insufficient liquidity for full fill.");let n=e[0];return Number.parseFloat(n.price)}function Np(e,r,t){if(e.length===0)throw new i("No resting liquidity.");let o=0;for(let c=e.length-1;c>=0;c-=1){let a=e[c];if(a!==void 0&&(o+=Number.parseFloat(a.size),o>=r))return Number.parseFloat(a.price)}if(t===OrderType.FOK)throw new i("Insufficient liquidity for full fill.");let n=e[0];return Number.parseFloat(n.price)}var Kp=z$1.array(z$1.custom()).min(1).max(15),DE=k(e,d,j$1,c,b),jE=k(e,d,j$1,c,b,a);function er(e){return async function(t){let o=fo(e,t);return unwrap(e.secureClob.post("/order",{json:o}).andThen(f(OrderResponseSchema)))}}function HE(e){return async function(t){let n=l(t,Kp).map(c=>fo(e,c));return unwrap(e.secureClob.post("/orders",{json:n}).andThen(f(OrderResponsesSchema)))}}function fo(e,r){return invariant(r.postOnly!==true||r.orderType===OrderType.GTC||r.orderType===OrderType.GTD,"Post-only orders are only supported for GTC and GTD order types."),{deferExec:false,order:{builder:r.builder,expiration:`${r.expiration}`,maker:r.maker,makerAmount:r.makerAmount,metadata:r.metadata,salt:Number.parseInt(r.salt,10),side:r.side,signature:r.signature,signatureType:r.signatureType,signer:r.signer,takerAmount:r.takerAmount,timestamp:r.timestamp,tokenId:r.tokenId},orderType:r.orderType,owner:e.credentials.key,...r.postOnly===true?{postOnly:true}:{}}}function Fe(e){switch(e){case .1:return {amount:3,price:1,size:2};case .01:return {amount:4,price:2,size:2};case .001:return {amount:5,price:3,size:2};case 1e-4:return {amount:6,price:4,size:2}}invariant(false,`Unsupported tick size: ${e}`);}function xe(e,r){return r?e.environment.negRiskExchange:e.environment.standardExchange}function te(e){return BigInt(Math.round(e*10**6))}function oe(e,r){return _(e)<=r?e:Math.floor(e*10**r)/10**r}function Te(e,r){return _(e)<=r?e:Math.ceil(e*10**r)/10**r}function xr(e,r){return _(e)<=r?e:Math.round(e*10**r)/10**r}function _(e){if(typeof e=="number"&&Number.isInteger(e))return 0;let[r="",t]=e.toString().toLowerCase().split("e"),[,o=""]=r.split("."),n=o.length;if(t===void 0)return n;let c=Number.parseInt(t,10);return Math.max(0,n-c)}var go=z$1.strictObject({tokenId:TokenIdSchema,price:PositiveDecimalNumberSchema,size:PositiveDecimalNumberSchema,side:OrderSideSchema,builderCode:BuilderCodeSchema.optional(),postOnly:z$1.boolean().default(false),expiration:z$1.number().int().nonnegative().optional()}).superRefine((e,r)=>{if(e.expiration!==void 0){let t=Math.floor(Date.now()/1e3)+60;e.expiration<t&&r.addIssue({code:"custom",message:"Expiration must be at least 60 seconds in the future.",path:["expiration"]});}});async function Ro(e,r){let t=await ec(e,{price:r.price,tokenId:r.tokenId}),o=rc({price:t.price,side:r.side,size:r.size,tickSize:t.tickSize});return {builderCode:r.builderCode,chainId:e.environment.chainId,exchangeAddress:t.exchangeAddress,expiration:r.expiration??0,funderAddress:t.funderAddress,offeredAmount:o.offeredAmount,orderType:r.expiration===void 0?OrderType.GTC:OrderType.GTD,side:r.side,signer:t.signerAddress,requestedAmount:o.requestedAmount,tokenId:r.tokenId}}async function ec(e,r){let t=e.account,o=await Re(e,{tokenId:r.tokenId}),n=await Se(e,{tokenId:r.tokenId});return {exchangeAddress:xe(e,n),funderAddress:t.wallet,negRisk:n,price:tc(r.price,o),signerAddress:t.signer,tickSize:o}}function rc(e){let r=Fe(e.tickSize),t=xr(e.price,r.price);if(e.side===OrderSide.BUY){let c=oe(e.size,r.size),a=c*t;return _(a)>r.amount&&(a=Te(a,r.amount+4),_(a)>r.amount&&(a=oe(a,r.amount))),{offeredAmount:te(a),requestedAmount:te(c)}}let o=oe(e.size,r.size),n=o*t;return _(n)>r.amount&&(n=Te(n,r.amount+4),_(n)>r.amount&&(n=oe(n,r.amount))),{offeredAmount:te(o),requestedAmount:te(n)}}function tc(e,r){let t=Fe(r);if(e<r||e>1-r)throw new a(`Price must be between ${r} and ${1-r} for tick size ${r}.`);if(_(e)>t.price)throw new a(`Price must conform to tick size ${r} with at most ${t.price} decimal places.`);return xr(e,t.price)}var So=z$1.object({tokenId:TokenIdSchema,builderCode:BuilderCodeSchema.optional(),orderType:z$1.union([z$1.literal(OrderType.FAK),z$1.literal(OrderType.FOK)]).default(OrderType.FAK)}),ho=z$1.discriminatedUnion("side",[So.extend({side:z$1.literal(OrderSide.BUY),amount:PositiveDecimalNumberSchema,maxSpend:PositiveDecimalNumberSchema.optional()}),So.extend({side:z$1.literal(OrderSide.SELL),shares:PositiveDecimalNumberSchema})]);async function xo(e,r){let t=await ac(e,r),o=sc({amount:t.resolvedAmount,price:t.price,side:r.side,tickSize:t.tickSize});return {builderCode:r.builderCode,chainId:e.environment.chainId,exchangeAddress:t.exchangeAddress,expiration:0,funderAddress:t.funderAddress,offeredAmount:o.offeredAmount,orderType:r.orderType,side:r.side,signer:t.signerAddress,requestedAmount:o.requestedAmount,tokenId:r.tokenId}}async function ac(e,r){let t=e.account,o=await Re(e,{tokenId:r.tokenId}),n=r.side===OrderSide.BUY?r.amount:r.shares,c=await hr(e,{amount:n,orderType:r.orderType,side:r.side,tickSize:o,tokenId:r.tokenId}),a=await Se(e,{tokenId:r.tokenId}),y=await ic(e,{amount:n,builderCode:r.builderCode,maxSpend:r.side===OrderSide.BUY?r.maxSpend:void 0,price:c,side:r.side,tokenId:r.tokenId});return {exchangeAddress:xe(e,a),funderAddress:t.wallet,negRisk:a,price:c,resolvedAmount:y,signerAddress:t.signer,tickSize:o}}function sc(e){let r=Fe(e.tickSize),t=oe(e.price,r.price),o=oe(e.amount,r.size);if(e.side===OrderSide.BUY){let c=o/t;return _(c)>r.amount&&(c=Te(c,r.amount+4),_(c)>r.amount&&(c=oe(c,r.amount))),{offeredAmount:te(o),requestedAmount:te(c)}}let n=o*t;return _(n)>r.amount&&(n=Te(n,r.amount+4),_(n)>r.amount&&(n=oe(n,r.amount))),{offeredAmount:te(o),requestedAmount:te(n)}}async function ic(e,r){if(r.side!==OrderSide.BUY||r.maxSpend===void 0)return r.amount;let[t,o]=await Promise.all([pc(e,r.tokenId),cc(e,r.builderCode)]);return dc({amount:r.amount,builderTakerFeeRate:o,platformFeeExponent:t.exponent,platformFeeRate:t.rate,maxSpend:r.maxSpend,price:r.price})}async function pc(e,r){let t=await Qt(e,{tokenId:r});return (await Zt(e,{conditionId:t})).feeInfo}async function cc(e,r){return r===void 0?0:(await Xt(e,{builderCode:r})).taker}function dc(e){let r=e.platformFeeRate*(e.price*(1-e.price))**e.platformFeeExponent,t=e.amount/e.price*r,o=e.amount+t+e.amount*e.builderTakerFeeRate;return e.maxSpend<=o?e.maxSpend/(1+r/e.price+e.builderTakerFeeRate):e.amount}var To="0x0000000000000000000000000000000000000000000000000000000000000000";function kr(e,r){let t=nt(r);return {builder:e.builderCode??To,chainId:e.chainId,exchangeAddress:e.exchangeAddress,expiration:e.expiration,maker:t.maker,makerAmount:e.offeredAmount.toString(),metadata:To,orderType:e.orderType,salt:uc().toString(),side:e.side,signatureType:t.signatureType,signer:t.signer,takerAmount:e.requestedAmount.toString(),timestamp:Date.now().toString(),tokenId:e.tokenId}}function br(e,r){let{chainId:t,exchangeAddress:o,...n}=e;return {...n,signature:r}}function uc(){let e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),BigInt(`0x${Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}`)&(1n<<53n)-1n}var ko="Polymarket CTF Exchange",fc="DepositWallet",yc="1",Ir="0x0000000000000000000000000000000000000000000000000000000000000000",Ar="Order(uint256 salt,address maker,address signer,uint256 tokenId,uint256 makerAmount,uint256 takerAmount,uint8 side,uint8 signatureType,uint256 timestamp,bytes32 metadata,bytes32 builder)",Ec=Hash.keccak256(Bytes.fromString(Ar),{as:"Hex"}),gc=Hash.keccak256(Bytes.fromString("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),{as:"Hex"}),Rc=Hash.keccak256(Bytes.fromString(ko),{as:"Hex"}),Sc=[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],bo=[{name:"salt",type:"uint256"},{name:"maker",type:"address"},{name:"signer",type:"address"},{name:"tokenId",type:"uint256"},{name:"makerAmount",type:"uint256"},{name:"takerAmount",type:"uint256"},{name:"side",type:"uint8"},{name:"signatureType",type:"uint8"},{name:"timestamp",type:"uint256"},{name:"metadata",type:"bytes32"},{name:"builder",type:"bytes32"}],hc=[{name:"contents",type:"Order"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"}];function Io(e){let r=xc(e.domain,e.order);return e.order.signatureType!==SignatureType.POLY_1271?r:{domain:vo(e.domain),message:{chainId:e.domain.chainId,contents:r.message,name:fc,salt:Ir,verifyingContract:e.order.signer,version:yc},primaryType:"TypedDataSign",types:{Order:bo,TypedDataSign:hc}}}function Ao(e){if(e.order.signatureType!==SignatureType.POLY_1271)return e.signature;let r=Bytes.toHex(Bytes.fromString(Ar)),t=Ar.length.toString(16).padStart(4,"0");return expectErc1271Signature(`0x${e.signature.slice(2)}${Tc(e.domain).slice(2)}${Pc(e.order).slice(2)}${r.slice(2)}${t}`)}function qo(e){return {builder:e.builder??Ir,maker:e.maker,makerAmount:BigInt(e.makerAmount),metadata:e.metadata??Ir,salt:BigInt(e.salt),side:kc(e.side),signatureType:e.signatureType,signer:e.signer,takerAmount:BigInt(e.takerAmount),timestamp:BigInt(e.timestamp),tokenId:BigInt(e.tokenId)}}function xc(e,r){return {domain:vo(e),message:qo(r),primaryType:"Order",types:{EIP712Domain:Sc,Order:bo}}}function vo(e){return {chainId:e.chainId,name:ko,verifyingContract:e.exchange,version:e.protocolVersion}}function Tc(e){return expectHexString(Hash.keccak256(AbiParameters.encode([{type:"bytes32"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"address"}],[gc,Rc,Cc(e.protocolVersion),BigInt(e.chainId),e.exchange]),{as:"Hex"}))}function Pc(e){let r=qo(e);return expectHexString(Hash.keccak256(AbiParameters.encode([{type:"bytes32"},{type:"uint256"},{type:"address"},{type:"address"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint8"},{type:"uint8"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"}],[Ec,r.salt,r.maker,r.signer,r.tokenId,r.makerAmount,r.takerAmount,r.side,r.signatureType,r.timestamp,r.metadata,r.builder]),{as:"Hex"}))}function Cc(e){return expectHexString(Hash.keccak256(Bytes.fromString(e),{as:"Hex"}))}function kc(e){return e===0||e===1?e:e===OrderSide.BUY?0:1}function vr(e){return Io({domain:Oo(e),order:e})}function Or(e,r){return Ao({domain:Oo(e),order:e,signature:r})}function Oo(e){return {chainId:e.chainId,exchange:e.exchangeAddress,protocolVersion:"2"}}function Lr(e){return {kind:"signOrder",payload:e}}var bc=k(i,e,d,j$1,c,b,a);async function wr(e,r){let t=l(r,ho);return async function*(){let o=await xo(e,t),n=kr(o,e.account),c=expectEvmSignature(yield Lr(vr(n)));return br(n,Or(n,c))}.call(null)}var Ic=k(e,d,j$1,c,b,a);async function Mr(e,r){let t=l(r,go);return async function*(){let o=await Ro(e,t),n=kr(o,e.account),c=expectEvmSignature(yield Lr(vr(n))),a=br(n,Or(n,c));return t.postOnly===true?{...a,postOnly:true}:a}.call(null)}var bg=bc;async function Ig(e,r){return wo(e,wr(e,r))}var Ag=Ic;async function qg(e,r){return wo(e,Mr(e,r))}async function wo(e,r){let t=await r;return async function*(){let o=yield*t;return er(e)(o)}.call(null)}async function Fo(e,r){let t=r.side===OrderSide.BUY?AssetType.COLLATERAL:AssetType.CONDITIONAL,{allowances:o}=await sr(e,r.side===OrderSide.BUY?{assetType:t}:{assetType:t,tokenId:r.tokenId});return qc(o,r.spenderAddress)}function qc(e,r){return Object.entries(e).find(([o])=>isSameEvmAddress(o,r))?.[1]??0n}var Vg=k(h,i,e,d,j$1,c,b,a);function vc(e,r){return wr(e,r).then(F(e.signer))}var Kg=k(h,i,e,d,j$1,f$1,g,c,b,a);function Yg(e,r){return vc(e,r).then(t=>zo(e,t))}var Jg=k(h,e,d,j$1,c,b,a);function Oc(e,r){return Mr(e,r).then(F(e.signer))}var Qg=k(h,e,d,j$1,f$1,g,c,b,a);function Zg(e,r){return Oc(e,r).then(t=>zo(e,t))}async function zo(e,r){let t=er(e);try{return await t(r)}catch(o){if(!wc(o))throw o;let n=await Lc(e,r,t);if(n===void 0)throw o;return n}}async function Lc(e,r,t){return await Mc(e,r)?t(r):void 0}function wc(e){return e instanceof d&&e.status===400&&e.message.includes("allowance is not enough")}async function Mc(e,r){let t=await Se(e,{tokenId:r.tokenId}),o=xe(e,t),n=BigInt(r.makerAmount);return await Fo(e,{spenderAddress:o,side:r.side,tokenId:r.tokenId})>=n?false:(await(r.side===OrderSide.BUY?await Dt(e,{amount:"max",spenderAddress:o,tokenAddress:e.environment.collateralToken}):await jt(e,{operatorAddress:o,tokenAddress:e.environment.conditionalTokens})).wait(),await dt(e,{assetType:r.side===OrderSide.BUY?AssetType.COLLATERAL:AssetType.CONDITIONAL,tokenId:r.side===OrderSide.SELL?r.tokenId:void 0}),true)}var _c=z$1.enum(["CURRENT","INITIAL","TOKENS","CASHPNL","PERCENTPNL","TITLE","RESOLVING","PRICE","AVGPRICE"]),Do=z$1.enum(["ASC","DESC"]),Nc=z$1.enum(["REALIZEDPNL","TITLE","PRICE","AVGPRICE","TIMESTAMP"]),Gc=z$1.object({cursor:PaginationCursorSchema.optional(),user:z$1.string(),market:z$1.array(z$1.string()).optional(),eventId:z$1.array(z$1.number().int()).optional(),sizeThreshold:z$1.number().optional(),redeemable:z$1.boolean().optional(),mergeable:z$1.boolean().optional(),pageSize:q.default(20),sortBy:_c.optional(),sortDirection:Do.optional(),title:z$1.string().max(100).optional()}).refine(e=>!(e.market&&e.eventId),{message:"Provide market or eventId, not both",path:["eventId"]}),$c=z$1.object({cursor:PaginationCursorSchema.optional(),user:z$1.string(),market:z$1.array(z$1.string()).optional(),title:z$1.string().max(100).optional(),eventId:z$1.array(z$1.number().int()).optional(),pageSize:q.default(20),sortBy:Nc.optional(),sortDirection:Do.optional()}).refine(e=>!(e.market&&e.eventId),{message:"Provide market or eventId, not both",path:["eventId"]}),Vc=z$1.object({cursor:PaginationCursorSchema.optional(),user:z$1.string(),pageSize:q.default(20),status:ComboPositionStatusSchema.optional(),conditionId:ComboConditionIdSchema.optional(),positionId:PositionIdSchema.optional()}),Kc=z$1.object({user:z$1.string(),market:z$1.array(z$1.string()).optional()}),Yc=z$1.object({user:z$1.string()}),Jc=z$1.object({user:z$1.string()}),cR=k(e,d,c,b,a);function dR(e,r){let{cursor:t,pageSize:o,...n}=l(r,Gc);return C(c=>{let a=O(c,o);return e.data.get("/positions",{params:w({...n,limit:a.pageSize+1,offset:a.offset})}).andThen(f(ListPositionsResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var uR=k(e,d,c,b,a),mR=k(e,d,c,b,a);function lR(e,r){let{cursor:t,pageSize:o,...n}=l(r,$c);return C(c=>{let a=O(c,o);return e.data.get("/closed-positions",{params:w({...n,limit:a.pageSize+1,offset:a.offset})}).andThen(f(ListClosedPositionsResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}function fR(e,r){let{cursor:t,pageSize:o,...n}=l(r,Vc);return C(c=>{let a=O(c,o);return e.data.get("/v1/positions/combos",{params:R({...n,limit:a.pageSize+1,offset:a.offset},S({conditionId:"combo_condition_id",positionId:"combo_position_id"}))}).andThen(f(ListComboPositionsResponseSchema)).map(y=>{let x=y.combos.length>a.pageSize;return {items:y.combos.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var yR=k(e,d,c,b,a);async function ER(e,r){let t=l(r,Kc);return unwrap(e.data.get("/value",{params:w(t)}).andThen(f(FetchPortfolioValueResponseSchema)))}var gR=k(e,d,c,b,a);async function RR(e,r){let t=l(r,Yc);return unwrap(e.data.get("/traded",{params:w(t)}).andThen(f(TradedSchema)))}var SR=k(e,d,c,b,a);async function hR(e,r){let t=l(r,Jc);return unwrap(e.data.get("/v1/accounting/snapshot",{params:w(t)}).andThen(Jr))}var No=32,Go=3n,Wo=50,Zc=(1n<<256n)-1n;function zr(e){let r=AbiParameters.encode([{name:"legs",type:"uint256[]"}],[e]),t=Hash.keccak256(AbiParameters.encode([{name:"moduleId",type:"uint256"},{name:"data",type:"bytes"}],[Go,r])),o=toComboConditionId(`0x03${t.slice(34)}0000000000000000000000000000`);return {conditionId:o,positionIds:[toPositionId(BigInt(`${o}00`).toString()),toPositionId(BigInt(`${o}01`).toString())]}}function $o(e){if(e.length===0||e.length>Wo)throw new a(`Combo legs must include 1 to ${Wo} position IDs`);let r=e.map(t=>{let o=Ko(t),n=o.toString(16).padStart(No*2,"0"),c=Number.parseInt(n.slice(0,2),16),a$1=Number.parseInt(n.slice(-2),16);if(c!==1&&c!==2||a$1>1)throw new a("Combo legs must be binary or neg-risk YES/NO position IDs");return {value:o,conditionId:n.slice(0,-2)}});r.sort((t,o)=>t.value<o.value?-1:t.value>o.value?1:0);for(let t=1;t<r.length;t+=1){let o=r[t-1],n=r[t];if(o===void 0||n===void 0)throw new a("Invalid combo leg set");if(o.value===n.value)throw new a("Combo legs must not contain duplicate position IDs");if(o.conditionId===n.conditionId)throw new a("Combo legs must not contain both outcomes for the same condition")}return r.map(t=>t.value)}function Vo(e){let t=Ko(e).toString(16).padStart(No*2,"0"),o=BigInt(`0x${t.slice(0,2)}`),n=Number.parseInt(t.slice(-2),16);if(o!==Go)throw new a("Combo position ID must use the combinatorial module");if(n!==0&&n!==1)throw new a("Combo position ID must be a YES/NO position ID");return {conditionId:toComboConditionId(`0x${t.slice(0,-2)}`),outcomeIndex:n}}function Ko(e){let r=e.trim(),t;if(r.length===0)throw new a("Position ID must be a uint256 value");try{t=BigInt(r);}catch{throw new a("Position ID must be a uint256 value")}if(t<0n||t>Zc)throw new a("Position ID must be a uint256 value");return t}var Yo=z$1.object({amount:z$1.bigint().min(0n),conditionId:CtfConditionIdSchema,metadata:j.optional()}),ed=z$1.object({amount:z$1.bigint().positive(),legs:z$1.array(PositionIdSchema).min(1).max(50),metadata:j.optional()}),Jo=z$1.array(PositionIdSchema).min(1).max(50).transform($o),rd=z$1.object({amount:z$1.bigint().positive(),legs:Jo,metadata:j.optional()}),td=z$1.union([Yo.extend({legs:z$1.never().optional()}),ed.extend({conditionId:z$1.never().optional()})]),Qo=k(e,d,c,b,a),jR=Qo,HR=Qo,Zo=k(e,d,c,b,a),WR=Zo,_R=Zo,Xo=k(e,d,c,b,a),NR=Xo,GR=Xo;async function en(e,r){let t=l(r,Yo),o=await Wr(e,{conditionId:t.conditionId}),n=bt(o.adapterAddress,e.environment.collateralToken,o.conditionId,t.amount);return async function*(){return e.account.walletType===WalletType.EOA?z(yield Dr(D(e.environment.chainId,n))):yield*await G(e,{calls:[n],metadata:t.metadata??`Split ${t.amount} positions for market ${o.marketId} (condition ${o.conditionId})`})}.call(null)}async function rn(e,r){let t=l(r,rd),o=ur(e.environment.combinatorialModule,t.legs),n=zr(t.legs),c=qt(e.environment.protocolV2Router,n.conditionId,t.amount);return async function*(){return e.account.walletType===WalletType.EOA?(await z(yield Dr(D(e.environment.chainId,o))).wait(),z(yield Dr(D(e.environment.chainId,c)))):yield*await G(e,{calls:[o,c],metadata:t.metadata??`Split ${t.amount} combo positions for condition ${n.conditionId}`})}.call(null)}async function od(e,r){let t=l(r,td);return t.legs!==void 0?rn(e,t):en(e,t)}var tn=k(h,e,d,j$1,f$1,g,c,b,a),$R=tn,VR=tn;function KR(e,r){return en(e,r).then(F(e.signer))}function YR(e,r){return rn(e,r).then(F(e.signer))}function JR(e,r){return od(e,r).then(F(e.signer))}var on=z$1.object({amount:z$1.union([z$1.bigint().positive(),z$1.literal("max")]),conditionId:CtfConditionIdSchema,metadata:j.optional()}),nd=z$1.object({amount:z$1.union([z$1.bigint().positive(),z$1.literal("max")]),legs:z$1.array(PositionIdSchema).min(1).max(50),metadata:j.optional()}),ad=z$1.object({amount:z$1.union([z$1.bigint().positive(),z$1.literal("max")]),legs:Jo,metadata:j.optional()}),sd=z$1.union([on.extend({legs:z$1.never().optional()}),nd.extend({conditionId:z$1.never().optional()})]);async function nn(e,r){let t=l(r,on),o=await Wr(e,{conditionId:t.conditionId}),n=cr(await e.rpc.ethCall(pr(o.positionErc1155Address,e.account.wallet,o.tokenIds))),c=mn(o.conditionId,n,t.amount),a=It(o.adapterAddress,e.environment.collateralToken,o.conditionId,c);return async function*(){return e.account.walletType===WalletType.EOA?z(yield jr(D(e.environment.chainId,a))):yield*await G(e,{calls:[a],metadata:t.metadata??`Merge ${c} positions for market ${o.marketId} (condition ${o.conditionId})`})}.call(null)}async function an(e,r){let t=l(r,ad),o=ur(e.environment.combinatorialModule,t.legs),n=zr(t.legs),c=cr(await e.rpc.ethCall(pr(e.environment.positionManager,e.account.wallet,n.positionIds))),a=mn(n.conditionId,c,t.amount),y=vt(e.environment.protocolV2Router,n.conditionId,a);return async function*(){return e.account.walletType===WalletType.EOA?(await z(yield jr(D(e.environment.chainId,o))).wait(),z(yield jr(D(e.environment.chainId,y)))):yield*await G(e,{calls:[o,y],metadata:t.metadata??`Merge ${a} combo positions for condition ${n.conditionId}`})}.call(null)}async function id(e,r){let t=l(r,sd);return t.legs!==void 0?an(e,t):nn(e,t)}var sn=k(h,e,d,j$1,f$1,g,c,b,a),QR=sn,ZR=sn;function XR(e,r){return nn(e,r).then(F(e.signer))}function eS(e,r){return an(e,r).then(F(e.signer))}function rS(e,r){return id(e,r).then(F(e.signer))}var pn=z$1.object({conditionId:CtfConditionIdSchema,marketId:z$1.never().optional(),amount:z$1.never().optional(),positionId:z$1.never().optional(),metadata:j.optional()}),cn=z$1.object({conditionId:z$1.never().optional(),marketId:MarketIdSchema,amount:z$1.never().optional(),positionId:z$1.never().optional(),metadata:j.optional()}),pd=z$1.union([pn,cn]),dn=z$1.object({positionId:PositionIdSchema,conditionId:z$1.never().optional(),marketId:z$1.never().optional(),metadata:j.optional()}),cd=z$1.union([pn,cn,dn]);async function dd(e,r){let t=l(r,pd),o=await Wr(e,t.conditionId!==void 0?{conditionId:t.conditionId}:{marketId:t.marketId}),n=At(o.adapterAddress,e.environment.collateralToken,o.conditionId);return async function*(){return e.account.walletType===WalletType.EOA?z(yield un(D(e.environment.chainId,n))):yield*await G(e,{calls:[n],metadata:t.metadata??`Redeem positions for market ${o.marketId} (condition ${o.conditionId})`})}.call(null)}async function ud(e,r){let t=l(r,dn),o=Vo(t.positionId),n=kt(await e.rpc.ethCall(Ct(e.environment.positionManager,e.account.wallet,t.positionId)));if(n===0n)throw new a("Combo position has no balance to redeem");let c=Ot(e.environment.protocolV2Router,o.conditionId,o.outcomeIndex,n);return async function*(){return e.account.walletType===WalletType.EOA?z(yield un(D(e.environment.chainId,c))):yield*await G(e,{calls:[c],metadata:t.metadata??`Redeem combo position ${t.positionId}`})}.call(null)}async function md(e,r){let t=l(r,cd);return t.positionId!==void 0?ud(e,t):dd(e,t)}var tS=k(h,e,d,j$1,c,b,a);function oS(e,r){return md(e,r).then(F(e.signer))}function Dr(e){return {kind:"sendSplitPositionTransaction",request:e}}function jr(e){return {kind:"sendMergePositionsTransaction",request:e}}function un(e){return {kind:"sendRedeemPositionsTransaction",request:e}}async function Wr(e,r){let t=r.conditionId!==void 0?`condition ${r.conditionId}`:`market ${r.marketId}`,n=(await io(e,r.conditionId!==void 0?{conditionIds:[r.conditionId],pageSize:1}:{ids:[ld(r.marketId)],pageSize:1}).firstPage()).items;invariant(n.length===1,`Expected exactly one ${t}`);let c=n[0];invariant(c!==void 0,`No market found for ${t}`);let a=fd(c,t);return {...a,adapterAddress:a.negRisk?e.environment.negRiskCollateralAdapter:e.environment.collateralAdapter,positionErc1155Address:a.negRisk?e.environment.negRiskAdapter:e.environment.conditionalTokens}}function ld(e){let r=Number(e);if(!Number.isInteger(r))throw new a(`Market ID must be an integer, received ${e}`);return r}function fd(e,r){if(!isPresent(e.conditionId))throw new b(`Missing condition ID for ${r}`);if(!isPresent(e.state.negRisk))throw new b(`Missing negative-risk flag for ${r}`);let t=e.outcomes.yes.tokenId,o=e.outcomes.no.tokenId;if(!isPresent(t)||!isPresent(o))throw new b(`Missing market token IDs for ${r}`);return {marketId:e.id,conditionId:e.conditionId,negRisk:e.state.negRisk,tokenIds:[t,o]}}function mn(e,r,t){let o=yd(r);if(o===0n)throw new a(`You have no complementary positions to merge for condition ${e}`);if(t==="max")return o;if(t>o)throw new a(`Requested merge amount ${t} exceeds the maximum mergeable amount ${o} for condition ${e}`);return t}function yd(e){if(e.length!==2)throw new b("Expected two position balances");let[r,t]=e;return invariant(r!==void 0,"Expected YES position balance"),invariant(t!==void 0,"Expected NO position balance"),r<t?r:t}var hd=z$1.object({address:z$1.string()}),mS=k(e,d,c,b,a);async function lS(e,r){let t=l(r,hd);return unwrap(e.gamma.get("/public-profile",{params:R(t,S())}).andThen(f(PublicProfileSchema)).orElse(o=>o instanceof d&&o.status===404?ok(null):err(o)))}var _r=class extends PolymarketError{name="RfqQuoteRejectedError";code;rfqId;constructor(r,t){super(r,t),this.code=t.code,this.rfqId=t.rfqId;}},gS=k(_r,j$1,f$1,c,a),Nr=class extends PolymarketError{name="RfqCancelQuoteRejectedError";code;rfqId;quoteId;constructor(r,t){super(r,t),this.code=t.code,this.rfqId=t.rfqId,this.quoteId=t.quoteId;}},RS=k(Nr,f$1,c),Gr=class extends PolymarketError{name="RfqConfirmationRejectedError";code;rfqId;quoteId;constructor(r,t){super(r,t),this.code=t.code,this.rfqId=t.rfqId,this.quoteId=t.quoteId;}},SS=k(Gr,f$1,c),hS=k(c);async function xS(e){return e.webSockets.rfqQuoter.connect()}var Pd=z$1.object({q:z$1.string().trim().min(1),ascending:z$1.boolean().optional(),cache:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),eventsStatus:z$1.string().min(1).optional(),eventsTag:z$1.array(z$1.string()).optional(),excludeTagIds:z$1.array(z$1.number().int()).optional(),keepClosedMarkets:z$1.number().int().optional(),optimized:z$1.boolean().optional(),pageSize:q.default(10),presets:z$1.array(z$1.string()).optional(),recurrence:z$1.enum(["daily","weekly","monthly"]).optional(),searchProfiles:z$1.boolean().optional(),searchTags:z$1.boolean().optional(),sort:z$1.string().min(1).optional()}),zS=k(e,d,c,b,a);function DS(e,r){let{cursor:t,pageSize:o,...n}=l(r,Pd);return C(c=>{let a=O(c,o);return e.gamma.get("/public-search",{params:R({...n,limitPerType:a.pageSize,page:a.offset},S({excludeTagIds:"exclude_tag_id"}))}).andThen(f(PublicSearchResponseSchema)).map(y=>({items:Cd(y),hasMore:y.pagination?.hasMore??false,totalCount:y.pagination?.totalResults??void 0,nextCursor:y.pagination?.hasMore?v({offset:a.offset+1,pageSize:a.pageSize}):void 0}))},t??v({offset:1,pageSize:o}),{events:[],profiles:[],tags:[]})}function Cd(e){return {events:e.events??[],profiles:e.profiles??[],tags:e.tags??[]}}var qd=z$1.object({ascending:z$1.boolean().optional(),closed:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),excludeEvents:z$1.boolean().optional(),locale:z$1.string().optional(),order:z$1.string().optional(),pageSize:q.default(20),recurrence:z$1.enum(["daily","weekly","monthly"]).optional(),slug:z$1.array(z$1.string()).optional()}),vd=z$1.object({id:z$1.string(),locale:z$1.string().optional()}),JS=k(e,d,c,b,a);function QS(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,qd);return C(c=>{let a=O(c,o);return e.gamma.get("/series",{params:R({...n,limit:a.pageSize+1,offset:a.offset},S())}).andThen(f(ListSeriesResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var ZS=k(e,d,c,b,a);async function XS(e,r){let t=l(r,vd);return unwrap(e.gamma.get(`series/${t.id}`,{params:R({locale:t.locale},S())}).andThen(f(SeriesSchema)))}var ah=k(e,d,c,b);async function sh(e){return unwrap(e.gamma.get("/sports").andThen(f(ListSportsMetadataResponseSchema)))}var ih=k(e,d,c,b);async function ph(e){return unwrap(e.gamma.get("/sports/market-types").andThen(f(SportsMarketTypesResponseSchema)))}async function mh(e,r){let t=await Promise.all(r.map(o=>Bd(e,o)));return Fd(t)}function Bd(e,r){switch(r.topic){case "market":return e.webSockets.clobMarket.subscribe(r);case "sports":return e.webSockets.sports.subscribe(r);case "comments":case "prices.crypto.binance":case "prices.crypto.chainlink":case "prices.equity.pyth":return e.webSockets.rtds.subscribe(r);case "user":return invariant(e.isSecureClient(),"A 'user' subscription requires a secure client instance."),e.webSockets.clobUser.subscribe(r)}}function Fd(e){let r;async function t(){r===void 0&&(r=Promise.all(e.map(n=>n.close())).then(()=>{})),await r;}let o=Md(...e);return {close:t,[Symbol.asyncIterator](){return o[Symbol.asyncIterator]()}}}var Dd=z$1.object({ascending:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),includeTemplate:z$1.boolean().optional(),isCarousel:z$1.boolean().optional(),locale:z$1.string().optional(),order:z$1.string().optional(),pageSize:q.default(20)}),jd=z$1.union([z$1.object({id:z$1.string(),includeTemplate:z$1.boolean().optional(),locale:z$1.string().optional()}),z$1.object({slug:z$1.string(),locale:z$1.string().optional()})]),Hd=z$1.object({id:z$1.string(),omitEmpty:z$1.boolean().optional(),status:z$1.enum(["active","closed","all"]).optional()}),Wd=z$1.object({slug:z$1.string()}),_d=z$1.object({id:z$1.string(),locale:z$1.string().optional(),omitEmpty:z$1.boolean().optional(),status:z$1.enum(["active","closed","all"]).optional()}),Nd=z$1.object({locale:z$1.string().optional(),slug:z$1.string(),omitEmpty:z$1.boolean().optional(),status:z$1.enum(["active","closed","all"]).optional()}),Ph=k(e,d,c,b,a);function Ch(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,Dd);return C(c=>{let a=O(c,o);return e.gamma.get("/tags",{params:R({...n,limit:a.pageSize+1,offset:a.offset},S())}).andThen(f(ListTagsResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var kh=k(e,d,c,b,a);async function bh(e,r){let t=l(r,jd);return "id"in t?unwrap(e.gamma.get(`tags/${t.id}`,{params:R({includeTemplate:t.includeTemplate,locale:t.locale},S())}).andThen(f(TagSchema))):unwrap(e.gamma.get(`tags/slug/${t.slug}`,{params:R({locale:t.locale},S())}).andThen(f(TagSchema)))}var Ih=k(e,d,c,b,a);async function Ah(e,r){if("id"in r){let o=l(r,Hd);return unwrap(e.gamma.get(`tags/${o.id}/related-tags`,{params:R({omitEmpty:o.omitEmpty,status:o.status},S())}).andThen(f(ListRelatedTagsResponseSchema)))}let t=l(r,Wd);return unwrap(e.gamma.get(`tags/slug/${t.slug}/related-tags`).andThen(f(ListRelatedTagsResponseSchema)))}var qh=k(e,d,c,b,a);async function vh(e,r){if("id"in r){let o=l(r,_d);return unwrap(e.gamma.get(`tags/${o.id}/related-tags/tags`,{params:R({locale:o.locale,omitEmpty:o.omitEmpty,status:o.status},S())}).andThen(f(ListRelatedTagResourcesResponseSchema)))}let t=l(r,Nd);return unwrap(e.gamma.get(`tags/slug/${t.slug}/related-tags/tags`,{params:R({locale:t.locale,omitEmpty:t.omitEmpty,status:t.status},S())}).andThen(f(ListRelatedTagResourcesResponseSchema)))}var Vd=z$1.object({abbreviation:z$1.array(z$1.string()).optional(),ascending:z$1.boolean().optional(),cursor:PaginationCursorSchema.optional(),league:z$1.array(z$1.string()).optional(),name:z$1.array(z$1.string()).optional(),order:z$1.string().optional(),pageSize:q.default(20),providerId:z$1.array(z$1.number().int()).optional()}),jh=k(e,d,c,b,a);function Hh(e,r={}){let{cursor:t,pageSize:o,...n}=l(r,Vd);return C(c=>{let a=O(c,o);return e.gamma.get("/teams",{params:R({...n,limit:a.pageSize+1,offset:a.offset},S({providerId:"provider_id"}))}).andThen(f(ListTeamsResponseSchema)).map(y=>{let x=y.length>a.pageSize;return {items:y.slice(0,a.pageSize),hasMore:x,nextCursor:x?v({offset:a.offset+a.pageSize,pageSize:a.pageSize}):void 0}})},t)}var Yd=z$1.object({amount:z$1.bigint(),metadata:j.optional(),recipientAddress:EvmAddressSchema,tokenAddress:EvmAddressSchema}),Zh=k(a);async function Jd(e,r){let t=l(r,Yd);return async function*(){return e.account.walletType===WalletType.EOA?z(yield Qd(D(e.environment.chainId,dr(t.tokenAddress,t.recipientAddress,t.amount)))):yield*await G(e,{calls:[dr(t.tokenAddress,t.recipientAddress,t.amount)],metadata:t.metadata??`Transfer ${t.amount} of ${t.tokenAddress} to ${t.recipientAddress}`})}.call(null)}var Xh=k(h,e,d,j$1,c,b,a);function ex(e,r){return Jd(e,r).then(F(e.signer))}function Qd(e){return {kind:"sendErc20TransferTransaction",request:e}}export{Jm as $,Ds as $a,xy as $b,dR as $c,bm as A,_u as Aa,Cf as Ab,qE as Ac,KR as Ad,Zh as Ae,ur as B,Nu as Ba,kf as Bb,vE as Bc,YR as Bd,Jd as Be,Lt as C,Gu as Ca,bf as Cb,hr as Cc,JR as Cd,Xh as Ce,wt as D,$u as Da,If as Db,DE as Dc,nn as Dd,ex as De,bl as E,Vu as Ea,Af as Eb,jE as Ec,an as Ed,$s as F,Ku as Fa,qf as Fb,er as Fc,id as Fd,Il as G,Yu as Ga,vf as Gb,HE as Gc,sn as Gd,Vs as H,Ju as Ha,Of as Hb,Io as Hc,QR as Hd,Al as I,Qu as Ia,Lf as Ib,Ao as Ic,ZR as Id,ql as J,Zu as Ja,wf as Jb,Lr as Jc,XR as Jd,vl as K,Xu as Ka,Mf as Kb,bc as Kc,eS as Kd,Ol as L,em as La,Bf as Lb,wr as Lc,rS as Ld,Ll as M,dm as Ma,Ff as Mb,Ic as Mc,dd as Md,wl as N,um as Na,Uf as Nb,Mr as Nc,ud as Nd,Ml as O,mm as Oa,Kf as Ob,bg as Oc,md as Od,Bl as P,lm as Pa,Yf as Pb,Ig as Pc,tS as Pd,Fl as Q,vm as Qa,Jf as Qb,Ag as Qc,oS as Qd,Ul as R,z as Ra,Qf as Rb,qg as Rc,mS as Rd,zl as S,ll as Sa,Zf as Sb,Vg as Sc,lS as Sd,Dl as T,Fs as Ta,Xf as Tb,vc as Tc,_r as Td,l as U,fl as Ua,fy as Ub,Kg as Uc,gS as Ud,Zr as V,Dt as Va,yy as Vb,Yg as Vc,Nr as Vd,Eu as W,yl as Wa,Ey as Wb,Jg as Wc,RS as Wd,nt as X,zs as Xa,gy as Xb,Oc as Xc,Gr as Xd,it as Y,El as Ya,Ry as Yb,Qg as Yc,SS as Yd,Bm as Z,jt as Za,Sy as Zb,Zg as Zc,hS as Zd,Mt as _,gl as _a,hy as _b,cR as _c,xS as _d,$ as a,Er as aa,Rl as ab,Ly as ac,uR as ad,Rm as b,Qm as ba,Sl as bb,wy as bc,mR as bd,He as c,Zm as ca,Yl as cb,My as cc,lR as cd,ht as d,j as da,Jl as db,By as dc,fR as dd,xt as e,Xm as ea,pf as eb,Fy as ec,yR as ed,We as f,el as fa,cf as fb,Uy as fc,ER as fd,zS as fe,Tt as g,hs as ga,df as gb,Jy as gc,gR as gd,DS as ge,Pt as h,rl as ha,uf as hb,io as hc,RR as hd,JS as he,Ct as i,G as ia,mf as ib,Qy as ic,SR as id,QS as ie,kt as j,tl as ja,Re as jb,Zy as jc,hR as jd,ZS as je,pr as k,qu as ka,lf as kb,Xy as kc,XS as ke,cr as l,vu as la,Se as lb,eE as lc,Qo as ld,ah as le,Sm as m,Ou as ma,ff as mb,rE as mc,jR as md,sh as me,dr as n,Lu as na,Qt as nb,tE as nc,HR as nd,ih as ne,hm as o,wu as oa,yf as ob,oE as oc,Zo as od,ph as oe,xm as p,Mu as pa,Zt as pb,nE as pc,WR as pd,mh as pe,bt as q,Bu as qa,Ef as qb,aE as qc,_R as qd,Ph as qe,Tm as r,Fu as ra,Xt as rb,sE as rc,Xo as rd,Ch as re,It as s,Uu as sa,gf as sb,fE as sc,NR as sd,kh as se,At as t,zu as ta,Rf as tb,yE as tc,GR as td,bh as te,Pm as u,Du as ua,Sf as ub,EE as uc,en as ud,Ih as ue,qt as v,ju as va,hf as vb,gE as vc,rn as vd,Ah as ve,Cm as w,Hu as wa,xf as wb,RE as wc,od as wd,qh as we,vt as x,sr as xa,eo as xb,SE as xc,tn as xd,vh as xe,km as y,Wu as ya,Tf as yb,hE as yc,$R as yd,jh as ye,Ot as z,dt as za,Pf as zb,xE as zc,VR as zd,Hh as ze};//# sourceMappingURL=chunk-76B5WBIO.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-76B5WBIO.js.map
|