@kuest/sdk 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/actions/index.d.ts +3 -3
- package/dist/ethers-v5.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{sports-DTAVbnv-.d.ts → sports-Bt7NXBWp.d.ts} +1 -1
- package/dist/{types-BGprBegM.d.ts → types-CI9Rwzhy.d.ts} +0 -31
- package/dist/viem.d.ts +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Unified TypeScript client
|
|
2
2
|
|
|
3
|
-
The `@kuest/sdk` package provides market data, authenticated CLOB orders, and Deposit Wallet relayer workflows.
|
|
3
|
+
The `@kuest/sdk` package provides market data, authenticated CLOB orders, and Deposit Wallet relayer workflows. Live trading has not been verified.
|
|
4
4
|
|
|
5
5
|
Configure approved CLOB, WebSocket, relayer, Gamma, Data, and Polygon RPC endpoints with `forkEnvironmentConfig`. Network defaults are unconfigured. Orders use Deposit Wallet signature type 3 and the `CTF Exchange` version 2 signing domain. Position-backed V3 orders, combo RFQ, protocol V2 collateral return, and Safe/Proxy relayer submissions are rejected locally.
|
|
6
6
|
|
|
7
|
-
See the
|
|
7
|
+
See the source repository README for a read-only example. The included [LICENSE](./LICENSE) retains the upstream MIT terms; the repository's `UPSTREAM.md` records the source revision and adaptation.
|
package/dist/actions/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { di as RateLimitError, dt as RequestRejectedError, eT as TransportError, eW as UnexpectedResponseError, eE as SigningError, dn as RequestAbortedError, U as UserInputError, B as BaseClient, t as BaseSecureClient, ds as RequestOptions } from '../types-
|
|
2
|
-
export { d as AcceptComboQuoteError, e as AcceptComboQuoteParams, f as AcceptComboQuoteResult, i as ApproveErc1155ForAllError, j as ApproveErc20Error, k as ApprovePerpsBuilderFeeError, l as ApprovePerpsBuilderFeeRequest, m as ArmPerpsAutoCancelError, n as ArmPerpsAutoCancelRequest, o as AuthorizeSessionKeyError, p as AuthorizeSessionKeyRequest, q as AuthorizeSessionKeyResult, C as CancelAllError, v as CancelAllPerpsOrdersRequest, w as CancelMarketOrdersError, fu as CancelMarketOrdersRequest, x as CancelOrderError, fv as CancelOrderRequest, y as CancelOrdersError, fw as CancelOrdersRequest, z as CancelPerpsChaseError, D as CancelPerpsChaseRequest, E as CancelPerpsOrderRequest, F as CancelPerpsOrdersRequest, G as CancelPerpsTwapError, H as CancelPerpsTwapRequest, fx as CollateralReturnExecutionWorkflow, N as ComboPositionStatusFilter, O as ComboQuote, fy as CommentsEventType, Q as CommentsSubscription, W as ConvertError, X as ConvertWorkflow, Y as CreatePerpsChaseError, Z as CreatePerpsChaseRequest, _ as CreatePerpsSessionRequest, $ as CreatePerpsTwapError, a0 as CreatePerpsTwapRequest, a2 as CryptoPriceSubscription, a3 as CryptoPricesChainlinkTwapSubscription, fz as CryptoPricesEventType, a4 as CryptoPricesSubscription, a5 as CryptoTwapPriceSubscription, fA as DeployDepositWalletError, a8 as DepositToPerpsError, a9 as DepositToPerpsRequest, aa as DisarmPerpsAutoCancelRequest, ac as DownloadAccountingSnapshotError, fB as DownloadAccountingSnapshotRequest, ad as DropNotificationsError, fC as DropNotificationsRequest, ah as EquityPriceSubscription, fD as EquityPricesEventType, ai as EquityPricesSubscription, aj as EquityTwapPriceSubscription, fE as Erc1155ApprovalForAllWorkflow, fF as Erc1155ApprovalForAllWorkflowRequest, ak as Erc1155TradingApproval, fG as Erc20ApprovalWorkflow, fH as Erc20ApprovalWorkflowRequest, al as Erc20TradingApproval, fI as Erc20TransferWorkflow, fJ as Erc20TransferWorkflowRequest, fK as EstimateMarketBuyPriceRequest, am as EstimateMarketPriceError, fL as EstimateMarketPriceRequest, fM as EstimateMarketSellPriceRequest, fN as EventForSubscriptionSpec, fO as EventForSubscriptionSpecs, an as ExecuteCollateralReturnPlanError, ao as ExecuteCollateralReturnPlanRequest, fP as FetchBalanceAllowanceError, fQ as FetchBalanceAllowanceRequest, fR as FetchBuilderFeeRatesError, fS as FetchBuilderFeeRatesRequest, aq as FetchBuilderVolumeError, fT as FetchBuilderVolumeRequest, ar as FetchClosedOnlyModeError, as as FetchCommentsByIdError, fU as FetchCommentsByIdRequest, at as FetchCurrentRebatesError, au as FetchCurrentRebatesRequest, av as FetchEventError, aw as FetchEventLiveVolumeError, fV as FetchEventLiveVolumeRequest, fW as FetchEventRequest, ax as FetchEventTagsError, fX as FetchEventTagsRequest, fY as FetchExecuteParamsError, fZ as FetchExecuteParamsRequest, f_ as FetchGaslessTransactionError, f$ as FetchGaslessTransactionRequest, ay as FetchLastTradePriceError, g0 as FetchLastTradePriceRequest, az as FetchLastTradePricesError, g1 as FetchLastTradePricesRequest, aA as FetchMarketError, g2 as FetchMarketInfoError, g3 as FetchMarketInfoRequest, g4 as FetchMarketRequest, aB as FetchMarketTagsError, g5 as FetchMarketTagsRequest, aC as FetchMidpointError, g6 as FetchMidpointRequest, aD as FetchMidpointsError, g7 as FetchMidpointsRequest, g8 as FetchNegRiskError, g9 as FetchNegRiskRequest, aE as FetchNotificationsError, aF as FetchOpenInterestError, ga as FetchOpenInterestRequest, aG as FetchOrderBookError, gb as FetchOrderBookRequest, aH as FetchOrderBooksError, gc as FetchOrderBooksRequest, aI as FetchOrderError, gd as FetchOrderRequest, aJ as FetchOrderScoringError, ge as FetchOrderScoringRequest, aK as FetchOrdersScoringError, gf as FetchOrdersScoringRequest, aL as FetchPerpsAccountConfigRequest, aM as FetchPerpsBookError, aN as FetchPerpsBookRequest, aO as FetchPerpsBuilderApprovalsError, aP as FetchPerpsBuilderApprovalsRequest, aQ as FetchPerpsBuilderEarningsSummaryError, aR as FetchPerpsBuilderEarningsSummaryRequest, aS as FetchPerpsBuilderStatusError, aT as FetchPerpsBuilderStatusRequest, aU as FetchPerpsChasesError, aV as FetchPerpsFeesError, aW as FetchPerpsInstrumentsError, aX as FetchPerpsInstrumentsRequest, aY as FetchPerpsOpenOrdersRequest, aZ as FetchPerpsOrdersRequest, a_ as FetchPerpsPositionSnapshotsError, a$ as FetchPerpsPositionSnapshotsRequest, b0 as FetchPerpsRegistrationError, b1 as FetchPerpsRegistrationRequest, b2 as FetchPerpsTickerError, b3 as FetchPerpsTickerRequest, b4 as FetchPerpsTickersError, b5 as FetchPerpsTickersRequest, b6 as FetchPerpsTwapsError, b7 as FetchPortfolioValueError, gg as FetchPortfolioValueRequest, b8 as FetchPriceError, gh as FetchPriceRequest, b9 as FetchPricesError, gi as FetchPricesRequest, ba as FetchPublicProfileError, gj as FetchPublicProfileRequest, bb as FetchRelatedTagResourcesError, gk as FetchRelatedTagResourcesRequest, bc as FetchRelatedTagsError, gl as FetchRelatedTagsRequest, gm as FetchResolutionsByConditionRequest, gn as FetchResolutionsByEventRequest, go as FetchResolutionsByQuestionRequest, bd as FetchResolutionsError, gp as FetchResolutionsRequest, be as FetchRewardPercentagesError, bf as FetchRfqStatusError, bg as FetchRfqStatusParams, bh as FetchSeriesError, gq as FetchSeriesRequest, bi as FetchSessionKeysError, bj as FetchSpreadError, gr as FetchSpreadRequest, bk as FetchSpreadsError, gs as FetchSpreadsRequest, bl as FetchTagError, gt as FetchTagRequest, gu as FetchTickSizeError, gv as FetchTickSizeRequest, bm as FetchTokenReferencesError, bn as FetchTokenReferencesRequest, bo as FetchTotalEarningsForUserForDayError, gw as FetchTotalEarningsForUserForDayRequest, bp as FetchTraderLeaderboardStandingError, gx as FetchTraderLeaderboardStandingRequest, bq as FetchTradingApprovalsStateError, br as FetchTradingApprovalsStateRequest, bs as FetchUserPnlError, gy as FetchUserPnlRequest, bt as FetchUserStatsError, gz as FetchUserStatsRequest, bu as FetchUserVolumeError, gA as FetchUserVolumeRequest, gB as GaslessTransactionMetadataSchema, gC as GaslessWorkflow, gD as GaslessWorkflowRequest, bv as HorizontalMergeError, bw as HorizontalMergeWorkflow, bx as HorizontalSplitError, by as HorizontalSplitWorkflow, gE as IsWalletDeployedError, gF as IsWalletDeployedRequest, bA as ListAccountTradesError, gG as ListAccountTradesRequest, bB as ListActivityError, gH as ListActivityRequest, bC as ListBiggestWinnersError, gI as ListBiggestWinnersRequest, bD as ListBuilderLeaderboardError, gJ as ListBuilderLeaderboardRequest, bE as ListBuilderTradesError, gK as ListBuilderTradesRequest, bF as ListComboActivityError, gL as ListComboActivityRequest, bG as ListComboMarketsError, gM as ListComboMarketsRequest, bH as ListComboPositionsError, gN as ListComboPositionsRequest, bI as ListCommentsByUserAddressError, gO as ListCommentsByUserAddressRequest, bJ as ListCommentsError, gP as ListCommentsRequest, bK as ListCurrentRewardsError, gQ as ListCurrentRewardsRequest, bL as ListEventsError, gR as ListEventsRequest, gS as ListMarketClarificationsError, gT as ListMarketClarificationsRequest, bM as ListMarketHoldersError, gU as ListMarketHoldersRequest, bN as ListMarketRewardsError, gV as ListMarketRewardsRequest, bO as ListMarketsError, gW as ListMarketsRequest, bP as ListOpenOrdersError, gX as ListOpenOrdersRequest, bQ as ListPerpsBuilderEarningsError, bR as ListPerpsBuilderEarningsRequest, bS as ListPerpsCandlesError, bT as ListPerpsCandlesRequest, bU as ListPerpsDepositsRequest, bV as ListPerpsEquityHistoryRequest, bW as ListPerpsFillsRequest, bX as ListPerpsFundingHistoryError, bY as ListPerpsFundingHistoryRequest, bZ as ListPerpsFundingPaymentsRequest, b_ as ListPerpsInternalTransfersRequest, b$ as ListPerpsNotificationsRequest, c0 as ListPerpsPnlHistoryRequest, c1 as ListPerpsTradesError, c2 as ListPerpsTradesRequest, c3 as ListPerpsWithdrawalsRequest, c4 as ListPositionsError, gY as ListPositionsRequest, c5 as ListPriceHistoryError, gZ as ListPriceHistoryRequest, c6 as ListRewardMarketsError, c7 as ListRewardMarketsRequest, c8 as ListSeriesError, g_ as ListSeriesRequest, c9 as ListTagsError, g$ as ListTagsRequest, ca as ListTeamsError, h0 as ListTeamsRequest, cb as ListTraderLeaderboardError, h1 as ListTraderLeaderboardRequest, cc as ListTradesError, h2 as ListTradesRequest, cd as ListUserEarningsAndMarketsConfigError, h3 as ListUserEarningsAndMarketsConfigRequest, ce as ListUserEarningsForDayError, h4 as ListUserEarningsForDayRequest, cf as MarkPerpsNotificationsReadRequest, h5 as MarketEventType, h6 as MarketSubscription, h7 as MergeComboPositionError, h8 as MergeMarketPositionError, cg as MergePositionsError, h9 as MergePositionsWorkflow, ha as MergePositionsWorkflowRequest, ch as NegRiskWorkflow, ci as OpenPerpsSessionError, cj as OpenPerpsSessionRequest, ck as OpenRfqSessionError, hb as OrderPostingWorkflow, cn as OrderSignature, hc as OrderWorkflow, hd as OrderWorkflowRequest, cs as PausePerpsTwapError, ct as PausePerpsTwapRequest, he as PerpsBboSubscription, cv as PerpsBookDepth, hf as PerpsBookSubscription, cw as PerpsBuilderTermsInput, cx as PerpsCancelOptions, cA as PerpsCancelRetryOptions, hg as PerpsCandlesSubscription, hh as PerpsDepositWorkflow, hi as PerpsDepositWorkflowRequest, hj as PerpsMarketDataEventType, hk as PerpsMarketDataSubscription, cC as PerpsOrderRequest, cD as PerpsPlaceFokOrderRequest, cE as PerpsPlaceGtcOrderRequest, cF as PerpsPlaceGtdOrderRequest, cG as PerpsPlaceIocOrderRequest, cH as PerpsPlacedTpSlOrder, cI as PerpsPlacedTpSlOrders, cJ as PerpsPositionSnapshotFill, cK as PerpsPositionSnapshotSelection, cL as PerpsPositionTpSlTrigger, cM as PerpsPositionTrailingStop, cN as PerpsSession, cO as PerpsSessionAccountError, cP as PerpsSessionLifecycleError, cQ as PerpsSessionTradingError, hl as PerpsStatisticsSubscription, hm as PerpsStreamingCandleInterval, hn as PerpsTickersSubscription, cR as PerpsTpSlTrigger, ho as PerpsTradesSubscription, cS as PerpsTrailingStop, cT as PlacePerpsOrderRequest, cU as PlacePerpsOrderResult, cV as PlacePerpsOrderWithTpSlRequest, cW as PlacePerpsOrderWithTpSlResult, cX as PlacePerpsPositionTpSlRequest, cY as PlacePerpsPositionTpSlResult, cZ as PlanCollateralReturnError, c_ as PostOrderError, c$ as PostOrdersError, hp as PostOrdersRequest, d0 as PostPerpsOrdersRequest, hq as PrepareCollateralReturnExecutionError, d1 as PrepareConvertError, d2 as PrepareConvertRequest, hr as PrepareErc1155ApprovalForAllError, hs as PrepareErc1155ApprovalForAllRequest, ht as PrepareErc20ApprovalError, hu as PrepareErc20ApprovalRequest, hv as PrepareErc20TransferError, hw as PrepareErc20TransferRequest, hx as PrepareGaslessTransactionError, hy as PrepareGaslessTransactionRequest, d3 as PrepareHorizontalMergeError, d4 as PrepareHorizontalMergeRequest, d5 as PrepareHorizontalSplitError, d6 as PrepareHorizontalSplitRequest, hz as PrepareLimitOrderRequest, hA as PrepareMarketBuyOrderRequest, hB as PrepareMarketOrderRequest, hC as PrepareMarketSellOrderRequest, hD as PrepareMergeComboPositionError, hE as PrepareMergeComboPositionRequest, hF as PrepareMergeMarketPositionError, hG as PrepareMergeMarketPositionRequest, hH as PrepareMergePositionsError, hI as PrepareMergePositionsRequest, hJ as PreparePerpsDepositError, hK as PrepareRedeemComboPositionError, hL as PrepareRedeemComboPositionRequest, hM as PrepareRedeemMarketPositionsByConditionIdRequest, hN as PrepareRedeemMarketPositionsByMarketIdRequest, hO as PrepareRedeemMarketPositionsError, hP as PrepareRedeemMarketPositionsRequest, hQ as PrepareRedeemPositionRequest, hR as PrepareRedeemPositionsError, hS as PrepareRedeemPositionsRequest, hT as PrepareSplitComboPositionError, hU as PrepareSplitComboPositionRequest, hV as PrepareSplitMarketPositionError, hW as PrepareSplitMarketPositionRequest, hX as PrepareSplitPositionError, hY as PrepareSplitPositionRequest, hZ as PrepareTradingApprovalsError, d7 as PriceSubscription, d8 as PriceSubscriptionConfirmation, h_ as PublicRealtimeEvent, h$ as PublicRealtimeTopic, i0 as PublicSubscriptionSpec, dm as RedeemPositionsError, i1 as RedeemPositionsWorkflow, i2 as RedeemPositionsWorkflowRequest, dp as RequestComboQuoteError, dq as RequestComboQuoteParams, dr as RequestComboQuoteResult, i3 as ResolveConditionByTokenError, i4 as ResolveConditionByTokenRequest, dw as ResumePerpsSessionRequest, dx as ResumePerpsTwapError, dy as ResumePerpsTwapRequest, dz as RevokePerpsBuilderFeeError, dA as RevokePerpsCredentialsError, dB as RevokePerpsCredentialsRequest, dC as RevokeSessionKeyError, dD as RevokeSessionKeyRequest, dE as RfqCancelQuoteAck, dF as RfqCancelQuoteError, dG as RfqCancelQuoteRejectedError, dH as RfqCancelQuoteRejectedErrorOptions, dI as RfqConfirmationAck, dJ as RfqConfirmationError, dK as RfqConfirmationRejectedError, i5 as RfqConfirmationRejectedErrorOptions, dL as RfqConfirmationRequestEvent, dM as RfqEvent, i6 as RfqExecutionUpdateEvent, dN as RfqQuoteError, dO as RfqQuoteReference, dP as RfqQuoteRejectedError, dQ as RfqQuoteRejectedErrorOptions, dR as RfqQuoteRequestEvent, dS as RfqQuoteResponse, dT as RfqQuoteSource, dU as RfqRequestRejectedError, dV as RfqRequestRejectedErrorOptions, dW as RfqSession, dX as RfqStatusResult, dY as RfqTradeEvent, dZ as SearchError, i7 as SearchRequest, i8 as SearchResults, d_ as SearchSort, i9 as SecureRealtimeEvent, ia as SecureRealtimeTopic, ib as SecureSubscriptionSpec, ej as SendOrderHeartbeatError, ek as SendOrderHeartbeatRequest, ex as SessionKey, eA as SetupTradingApprovalsError, eB as SignedOrder, ic as SplitComboPositionError, id as SplitMarketPositionError, eG as SplitPositionError, ie as SplitPositionWorkflow, ig as SplitPositionWorkflowRequest, ih as SportsEventType, ii as SportsSubscription, eH as SubscribeError, eI as SubscriptionHandle, eK as TradingApprovalRequirements, eL as TradingApprovalsState, ij as TradingApprovalsWorkflow, ik as TradingApprovalsWorkflowRequest, eQ as TransferErc20Error, eR as TransferPerpsCollateralError, eS as TransferPerpsCollateralRequest, il as UpdateBalanceAllowanceError, im as UpdateBalanceAllowanceRequest, eX as UpdatePerpsLeverageError, eY as UpdatePerpsLeverageRequest, eZ as UpdatePerpsLeveragesError, e_ as UpdatePerpsLeveragesRequest, e$ as UpdatePerpsMarginError, f0 as UpdatePerpsMarginRequest, io as UserEventType, ip as UserSubscription, f1 as WaitForComboFillError, f2 as WaitForComboFillParams, f3 as WaitForComboFillResult, iq as WaitForGaslessTransactionError, f4 as WaitForOrderFillSettlementError, ir as WaitForOrderFillSettlementRequest, fa as WithdrawFromPerpsError, fb as WithdrawFromPerpsRequest, is as acceptComboQuote, it as approveErc1155ForAll, iu as approveErc20, iv as authorizeSessionKey, iw as cancelAll, ix as cancelMarketOrders, iy as cancelOrder, iz as cancelOrders, iA as convert, iB as deployDepositWallet, iC as depositToPerps, iD as downloadAccountingSnapshot, iE as dropNotifications, iF as estimateMarketPrice, iG as executeCollateralReturnPlan, iH as fetchBalanceAllowance, iI as fetchBuilderFeeRates, iJ as fetchBuilderVolume, iK as fetchClosedOnlyMode, iL as fetchCommentsById, iM as fetchCurrentRebates, iN as fetchEvent, iO as fetchEventLiveVolume, iP as fetchEventTags, iQ as fetchExecuteParams, iR as fetchLastTradePrice, iS as fetchLastTradePrices, iT as fetchMarket, iU as fetchMarketInfo, iV as fetchMarketTags, iW as fetchMidpoint, iX as fetchMidpoints, iY as fetchNegRisk, iZ as fetchNotifications, i_ as fetchOpenInterest, i$ as fetchOrder, j0 as fetchOrderBook, j1 as fetchOrderBooks, j2 as fetchOrderScoring, j3 as fetchOrdersScoring, j4 as fetchPerpsBook, j5 as fetchPerpsBuilderStatus, j6 as fetchPerpsFees, j7 as fetchPerpsInstruments, j8 as fetchPerpsPositionSnapshots, j9 as fetchPerpsRegistration, ja as fetchPerpsTicker, jb as fetchPerpsTickers, jc as fetchPortfolioValue, jd as fetchPrice, je as fetchPrices, jf as fetchPublicProfile, jg as fetchRelatedTagResources, jh as fetchRelatedTags, ji as fetchResolutions, jj as fetchRewardPercentages, jk as fetchRfqStatus, jl as fetchSeries, jm as fetchSessionKeys, jn as fetchSpread, jo as fetchSpreads, jp as fetchTag, jq as fetchTickSize, jr as fetchTokenReferences, js as fetchTotalEarningsForUserForDay, jt as fetchTraderLeaderboardStanding, ju as fetchTradingApprovalsState, jv as fetchTransaction, jw as fetchUserPnl, jx as fetchUserStats, jy as fetchUserVolume, jz as horizontalMerge, jA as horizontalSplit, jB as isWalletDeployed, jC as listAccountTrades, jD as listActivity, jE as listBiggestWinners, jF as listBuilderLeaderboard, jG as listBuilderTrades, jH as listComboActivity, jI as listComboMarkets, jJ as listComboPositions, jK as listComments, jL as listCommentsByUserAddress, jM as listCurrentRewards, jN as listEvents, jO as listMarketClarifications, jP as listMarketHolders, jQ as listMarketRewards, jR as listMarkets, jS as listOpenOrders, jT as listPerpsCandles, jU as listPerpsFundingHistory, jV as listPerpsTrades, jW as listPositions, jX as listPriceHistory, jY as listRewardMarkets, jZ as listSeries, j_ as listTags, j$ as listTeams, k0 as listTraderLeaderboard, k1 as listTrades, k2 as listUserEarningsAndMarketsConfig, k3 as listUserEarningsForDay, k4 as mergeComboPosition, k5 as mergeMarketPosition, k6 as mergePositions, k7 as openPerpsSession, k8 as openRfqSession, k9 as planCollateralReturn, ka as postOrder, kb as postOrders, kc as prepareCollateralReturnExecution, kd as prepareConvert, ke as prepareErc1155ApprovalForAll, kf as prepareErc20Approval, kg as prepareErc20Transfer, kh as prepareGaslessTransaction, ki as prepareHorizontalMerge, kj as prepareHorizontalSplit, kk as prepareMergeComboPosition, kl as prepareMergeMarketPosition, km as prepareMergePositions, kn as preparePerpsDeposit, ko as prepareRedeemComboPosition, kp as prepareRedeemMarketPositions, kq as prepareRedeemPosition, kr as prepareRedeemPositions, ks as prepareSplitComboPosition, kt as prepareSplitMarketPosition, ku as prepareSplitPosition, kv as prepareTradingApprovals, kw as redeemPositions, kx as requestComboQuote, ky as resolveConditionByToken, kz as revokePerpsCredentials, kA as revokeSessionKey, kB as search, kC as sendOrderHeartbeat, kD as setupTradingApprovals, kE as splitComboPosition, kF as splitMarketPosition, kG as splitPosition, kH as subscribe, kI as transferErc20, kJ as transferPerpsCollateral, kK as updateBalanceAllowance, kL as waitForComboFill, kM as waitForOrderFillSettlement, kN as withdrawFromPerps } from '../types-BGprBegM.js';
|
|
1
|
+
import { di as RateLimitError, dt as RequestRejectedError, eT as TransportError, eW as UnexpectedResponseError, eE as SigningError, dn as RequestAbortedError, U as UserInputError, B as BaseClient, t as BaseSecureClient, ds as RequestOptions } from '../types-CI9Rwzhy.js';
|
|
2
|
+
export { d as AcceptComboQuoteError, e as AcceptComboQuoteParams, f as AcceptComboQuoteResult, i as ApproveErc1155ForAllError, j as ApproveErc20Error, k as ApprovePerpsBuilderFeeError, l as ApprovePerpsBuilderFeeRequest, m as ArmPerpsAutoCancelError, n as ArmPerpsAutoCancelRequest, o as AuthorizeSessionKeyError, p as AuthorizeSessionKeyRequest, q as AuthorizeSessionKeyResult, C as CancelAllError, v as CancelAllPerpsOrdersRequest, w as CancelMarketOrdersError, fu as CancelMarketOrdersRequest, x as CancelOrderError, fv as CancelOrderRequest, y as CancelOrdersError, fw as CancelOrdersRequest, z as CancelPerpsChaseError, D as CancelPerpsChaseRequest, E as CancelPerpsOrderRequest, F as CancelPerpsOrdersRequest, G as CancelPerpsTwapError, H as CancelPerpsTwapRequest, fx as CollateralReturnExecutionWorkflow, N as ComboPositionStatusFilter, O as ComboQuote, fy as CommentsEventType, Q as CommentsSubscription, W as ConvertError, X as ConvertWorkflow, Y as CreatePerpsChaseError, Z as CreatePerpsChaseRequest, _ as CreatePerpsSessionRequest, $ as CreatePerpsTwapError, a0 as CreatePerpsTwapRequest, a2 as CryptoPriceSubscription, a3 as CryptoPricesChainlinkTwapSubscription, fz as CryptoPricesEventType, a4 as CryptoPricesSubscription, a5 as CryptoTwapPriceSubscription, fA as DeployDepositWalletError, a8 as DepositToPerpsError, a9 as DepositToPerpsRequest, aa as DisarmPerpsAutoCancelRequest, ac as DownloadAccountingSnapshotError, fB as DownloadAccountingSnapshotRequest, ad as DropNotificationsError, fC as DropNotificationsRequest, ah as EquityPriceSubscription, fD as EquityPricesEventType, ai as EquityPricesSubscription, aj as EquityTwapPriceSubscription, fE as Erc1155ApprovalForAllWorkflow, fF as Erc1155ApprovalForAllWorkflowRequest, ak as Erc1155TradingApproval, fG as Erc20ApprovalWorkflow, fH as Erc20ApprovalWorkflowRequest, al as Erc20TradingApproval, fI as Erc20TransferWorkflow, fJ as Erc20TransferWorkflowRequest, fK as EstimateMarketBuyPriceRequest, am as EstimateMarketPriceError, fL as EstimateMarketPriceRequest, fM as EstimateMarketSellPriceRequest, fN as EventForSubscriptionSpec, fO as EventForSubscriptionSpecs, an as ExecuteCollateralReturnPlanError, ao as ExecuteCollateralReturnPlanRequest, fP as FetchBalanceAllowanceError, fQ as FetchBalanceAllowanceRequest, fR as FetchBuilderFeeRatesError, fS as FetchBuilderFeeRatesRequest, aq as FetchBuilderVolumeError, fT as FetchBuilderVolumeRequest, ar as FetchClosedOnlyModeError, as as FetchCommentsByIdError, fU as FetchCommentsByIdRequest, at as FetchCurrentRebatesError, au as FetchCurrentRebatesRequest, av as FetchEventError, aw as FetchEventLiveVolumeError, fV as FetchEventLiveVolumeRequest, fW as FetchEventRequest, ax as FetchEventTagsError, fX as FetchEventTagsRequest, fY as FetchExecuteParamsError, fZ as FetchExecuteParamsRequest, f_ as FetchGaslessTransactionError, f$ as FetchGaslessTransactionRequest, ay as FetchLastTradePriceError, g0 as FetchLastTradePriceRequest, az as FetchLastTradePricesError, g1 as FetchLastTradePricesRequest, aA as FetchMarketError, g2 as FetchMarketInfoError, g3 as FetchMarketInfoRequest, g4 as FetchMarketRequest, aB as FetchMarketTagsError, g5 as FetchMarketTagsRequest, aC as FetchMidpointError, g6 as FetchMidpointRequest, aD as FetchMidpointsError, g7 as FetchMidpointsRequest, g8 as FetchNegRiskError, g9 as FetchNegRiskRequest, aE as FetchNotificationsError, aF as FetchOpenInterestError, ga as FetchOpenInterestRequest, aG as FetchOrderBookError, gb as FetchOrderBookRequest, aH as FetchOrderBooksError, gc as FetchOrderBooksRequest, aI as FetchOrderError, gd as FetchOrderRequest, aJ as FetchOrderScoringError, ge as FetchOrderScoringRequest, aK as FetchOrdersScoringError, gf as FetchOrdersScoringRequest, aL as FetchPerpsAccountConfigRequest, aM as FetchPerpsBookError, aN as FetchPerpsBookRequest, aO as FetchPerpsBuilderApprovalsError, aP as FetchPerpsBuilderApprovalsRequest, aQ as FetchPerpsBuilderEarningsSummaryError, aR as FetchPerpsBuilderEarningsSummaryRequest, aS as FetchPerpsBuilderStatusError, aT as FetchPerpsBuilderStatusRequest, aU as FetchPerpsChasesError, aV as FetchPerpsFeesError, aW as FetchPerpsInstrumentsError, aX as FetchPerpsInstrumentsRequest, aY as FetchPerpsOpenOrdersRequest, aZ as FetchPerpsOrdersRequest, a_ as FetchPerpsPositionSnapshotsError, a$ as FetchPerpsPositionSnapshotsRequest, b0 as FetchPerpsRegistrationError, b1 as FetchPerpsRegistrationRequest, b2 as FetchPerpsTickerError, b3 as FetchPerpsTickerRequest, b4 as FetchPerpsTickersError, b5 as FetchPerpsTickersRequest, b6 as FetchPerpsTwapsError, b7 as FetchPortfolioValueError, gg as FetchPortfolioValueRequest, b8 as FetchPriceError, gh as FetchPriceRequest, b9 as FetchPricesError, gi as FetchPricesRequest, ba as FetchPublicProfileError, gj as FetchPublicProfileRequest, bb as FetchRelatedTagResourcesError, gk as FetchRelatedTagResourcesRequest, bc as FetchRelatedTagsError, gl as FetchRelatedTagsRequest, gm as FetchResolutionsByConditionRequest, gn as FetchResolutionsByEventRequest, go as FetchResolutionsByQuestionRequest, bd as FetchResolutionsError, gp as FetchResolutionsRequest, be as FetchRewardPercentagesError, bf as FetchRfqStatusError, bg as FetchRfqStatusParams, bh as FetchSeriesError, gq as FetchSeriesRequest, bi as FetchSessionKeysError, bj as FetchSpreadError, gr as FetchSpreadRequest, bk as FetchSpreadsError, gs as FetchSpreadsRequest, bl as FetchTagError, gt as FetchTagRequest, gu as FetchTickSizeError, gv as FetchTickSizeRequest, bm as FetchTokenReferencesError, bn as FetchTokenReferencesRequest, bo as FetchTotalEarningsForUserForDayError, gw as FetchTotalEarningsForUserForDayRequest, bp as FetchTraderLeaderboardStandingError, gx as FetchTraderLeaderboardStandingRequest, bq as FetchTradingApprovalsStateError, br as FetchTradingApprovalsStateRequest, bs as FetchUserPnlError, gy as FetchUserPnlRequest, bt as FetchUserStatsError, gz as FetchUserStatsRequest, bu as FetchUserVolumeError, gA as FetchUserVolumeRequest, gB as GaslessTransactionMetadataSchema, gC as GaslessWorkflow, gD as GaslessWorkflowRequest, bv as HorizontalMergeError, bw as HorizontalMergeWorkflow, bx as HorizontalSplitError, by as HorizontalSplitWorkflow, gE as IsWalletDeployedError, gF as IsWalletDeployedRequest, bA as ListAccountTradesError, gG as ListAccountTradesRequest, bB as ListActivityError, gH as ListActivityRequest, bC as ListBiggestWinnersError, gI as ListBiggestWinnersRequest, bD as ListBuilderLeaderboardError, gJ as ListBuilderLeaderboardRequest, bE as ListBuilderTradesError, gK as ListBuilderTradesRequest, bF as ListComboActivityError, gL as ListComboActivityRequest, bG as ListComboMarketsError, gM as ListComboMarketsRequest, bH as ListComboPositionsError, gN as ListComboPositionsRequest, bI as ListCommentsByUserAddressError, gO as ListCommentsByUserAddressRequest, bJ as ListCommentsError, gP as ListCommentsRequest, bK as ListCurrentRewardsError, gQ as ListCurrentRewardsRequest, bL as ListEventsError, gR as ListEventsRequest, gS as ListMarketClarificationsError, gT as ListMarketClarificationsRequest, bM as ListMarketHoldersError, gU as ListMarketHoldersRequest, bN as ListMarketRewardsError, gV as ListMarketRewardsRequest, bO as ListMarketsError, gW as ListMarketsRequest, bP as ListOpenOrdersError, gX as ListOpenOrdersRequest, bQ as ListPerpsBuilderEarningsError, bR as ListPerpsBuilderEarningsRequest, bS as ListPerpsCandlesError, bT as ListPerpsCandlesRequest, bU as ListPerpsDepositsRequest, bV as ListPerpsEquityHistoryRequest, bW as ListPerpsFillsRequest, bX as ListPerpsFundingHistoryError, bY as ListPerpsFundingHistoryRequest, bZ as ListPerpsFundingPaymentsRequest, b_ as ListPerpsInternalTransfersRequest, b$ as ListPerpsNotificationsRequest, c0 as ListPerpsPnlHistoryRequest, c1 as ListPerpsTradesError, c2 as ListPerpsTradesRequest, c3 as ListPerpsWithdrawalsRequest, c4 as ListPositionsError, gY as ListPositionsRequest, c5 as ListPriceHistoryError, gZ as ListPriceHistoryRequest, c6 as ListRewardMarketsError, c7 as ListRewardMarketsRequest, c8 as ListSeriesError, g_ as ListSeriesRequest, c9 as ListTagsError, g$ as ListTagsRequest, ca as ListTeamsError, h0 as ListTeamsRequest, cb as ListTraderLeaderboardError, h1 as ListTraderLeaderboardRequest, cc as ListTradesError, h2 as ListTradesRequest, cd as ListUserEarningsAndMarketsConfigError, h3 as ListUserEarningsAndMarketsConfigRequest, ce as ListUserEarningsForDayError, h4 as ListUserEarningsForDayRequest, cf as MarkPerpsNotificationsReadRequest, h5 as MarketEventType, h6 as MarketSubscription, h7 as MergeComboPositionError, h8 as MergeMarketPositionError, cg as MergePositionsError, h9 as MergePositionsWorkflow, ha as MergePositionsWorkflowRequest, ch as NegRiskWorkflow, ci as OpenPerpsSessionError, cj as OpenPerpsSessionRequest, ck as OpenRfqSessionError, hb as OrderPostingWorkflow, cn as OrderSignature, hc as OrderWorkflow, hd as OrderWorkflowRequest, cs as PausePerpsTwapError, ct as PausePerpsTwapRequest, he as PerpsBboSubscription, cv as PerpsBookDepth, hf as PerpsBookSubscription, cw as PerpsBuilderTermsInput, cx as PerpsCancelOptions, cA as PerpsCancelRetryOptions, hg as PerpsCandlesSubscription, hh as PerpsDepositWorkflow, hi as PerpsDepositWorkflowRequest, hj as PerpsMarketDataEventType, hk as PerpsMarketDataSubscription, cC as PerpsOrderRequest, cD as PerpsPlaceFokOrderRequest, cE as PerpsPlaceGtcOrderRequest, cF as PerpsPlaceGtdOrderRequest, cG as PerpsPlaceIocOrderRequest, cH as PerpsPlacedTpSlOrder, cI as PerpsPlacedTpSlOrders, cJ as PerpsPositionSnapshotFill, cK as PerpsPositionSnapshotSelection, cL as PerpsPositionTpSlTrigger, cM as PerpsPositionTrailingStop, cN as PerpsSession, cO as PerpsSessionAccountError, cP as PerpsSessionLifecycleError, cQ as PerpsSessionTradingError, hl as PerpsStatisticsSubscription, hm as PerpsStreamingCandleInterval, hn as PerpsTickersSubscription, cR as PerpsTpSlTrigger, ho as PerpsTradesSubscription, cS as PerpsTrailingStop, cT as PlacePerpsOrderRequest, cU as PlacePerpsOrderResult, cV as PlacePerpsOrderWithTpSlRequest, cW as PlacePerpsOrderWithTpSlResult, cX as PlacePerpsPositionTpSlRequest, cY as PlacePerpsPositionTpSlResult, cZ as PlanCollateralReturnError, c_ as PostOrderError, c$ as PostOrdersError, hp as PostOrdersRequest, d0 as PostPerpsOrdersRequest, hq as PrepareCollateralReturnExecutionError, d1 as PrepareConvertError, d2 as PrepareConvertRequest, hr as PrepareErc1155ApprovalForAllError, hs as PrepareErc1155ApprovalForAllRequest, ht as PrepareErc20ApprovalError, hu as PrepareErc20ApprovalRequest, hv as PrepareErc20TransferError, hw as PrepareErc20TransferRequest, hx as PrepareGaslessTransactionError, hy as PrepareGaslessTransactionRequest, d3 as PrepareHorizontalMergeError, d4 as PrepareHorizontalMergeRequest, d5 as PrepareHorizontalSplitError, d6 as PrepareHorizontalSplitRequest, hz as PrepareLimitOrderRequest, hA as PrepareMarketBuyOrderRequest, hB as PrepareMarketOrderRequest, hC as PrepareMarketSellOrderRequest, hD as PrepareMergeComboPositionError, hE as PrepareMergeComboPositionRequest, hF as PrepareMergeMarketPositionError, hG as PrepareMergeMarketPositionRequest, hH as PrepareMergePositionsError, hI as PrepareMergePositionsRequest, hJ as PreparePerpsDepositError, hK as PrepareRedeemComboPositionError, hL as PrepareRedeemComboPositionRequest, hM as PrepareRedeemMarketPositionsByConditionIdRequest, hN as PrepareRedeemMarketPositionsByMarketIdRequest, hO as PrepareRedeemMarketPositionsError, hP as PrepareRedeemMarketPositionsRequest, hQ as PrepareRedeemPositionRequest, hR as PrepareRedeemPositionsError, hS as PrepareRedeemPositionsRequest, hT as PrepareSplitComboPositionError, hU as PrepareSplitComboPositionRequest, hV as PrepareSplitMarketPositionError, hW as PrepareSplitMarketPositionRequest, hX as PrepareSplitPositionError, hY as PrepareSplitPositionRequest, hZ as PrepareTradingApprovalsError, d7 as PriceSubscription, d8 as PriceSubscriptionConfirmation, h_ as PublicRealtimeEvent, h$ as PublicRealtimeTopic, i0 as PublicSubscriptionSpec, dm as RedeemPositionsError, i1 as RedeemPositionsWorkflow, i2 as RedeemPositionsWorkflowRequest, dp as RequestComboQuoteError, dq as RequestComboQuoteParams, dr as RequestComboQuoteResult, i3 as ResolveConditionByTokenError, i4 as ResolveConditionByTokenRequest, dw as ResumePerpsSessionRequest, dx as ResumePerpsTwapError, dy as ResumePerpsTwapRequest, dz as RevokePerpsBuilderFeeError, dA as RevokePerpsCredentialsError, dB as RevokePerpsCredentialsRequest, dC as RevokeSessionKeyError, dD as RevokeSessionKeyRequest, dE as RfqCancelQuoteAck, dF as RfqCancelQuoteError, dG as RfqCancelQuoteRejectedError, dH as RfqCancelQuoteRejectedErrorOptions, dI as RfqConfirmationAck, dJ as RfqConfirmationError, dK as RfqConfirmationRejectedError, i5 as RfqConfirmationRejectedErrorOptions, dL as RfqConfirmationRequestEvent, dM as RfqEvent, i6 as RfqExecutionUpdateEvent, dN as RfqQuoteError, dO as RfqQuoteReference, dP as RfqQuoteRejectedError, dQ as RfqQuoteRejectedErrorOptions, dR as RfqQuoteRequestEvent, dS as RfqQuoteResponse, dT as RfqQuoteSource, dU as RfqRequestRejectedError, dV as RfqRequestRejectedErrorOptions, dW as RfqSession, dX as RfqStatusResult, dY as RfqTradeEvent, dZ as SearchError, i7 as SearchRequest, i8 as SearchResults, d_ as SearchSort, i9 as SecureRealtimeEvent, ia as SecureRealtimeTopic, ib as SecureSubscriptionSpec, ej as SendOrderHeartbeatError, ek as SendOrderHeartbeatRequest, ex as SessionKey, eA as SetupTradingApprovalsError, eB as SignedOrder, ic as SplitComboPositionError, id as SplitMarketPositionError, eG as SplitPositionError, ie as SplitPositionWorkflow, ig as SplitPositionWorkflowRequest, ih as SportsEventType, ii as SportsSubscription, eH as SubscribeError, eI as SubscriptionHandle, eK as TradingApprovalRequirements, eL as TradingApprovalsState, ij as TradingApprovalsWorkflow, ik as TradingApprovalsWorkflowRequest, eQ as TransferErc20Error, eR as TransferPerpsCollateralError, eS as TransferPerpsCollateralRequest, il as UpdateBalanceAllowanceError, im as UpdateBalanceAllowanceRequest, eX as UpdatePerpsLeverageError, eY as UpdatePerpsLeverageRequest, eZ as UpdatePerpsLeveragesError, e_ as UpdatePerpsLeveragesRequest, e$ as UpdatePerpsMarginError, f0 as UpdatePerpsMarginRequest, io as UserEventType, ip as UserSubscription, f1 as WaitForComboFillError, f2 as WaitForComboFillParams, f3 as WaitForComboFillResult, iq as WaitForGaslessTransactionError, f4 as WaitForOrderFillSettlementError, ir as WaitForOrderFillSettlementRequest, fa as WithdrawFromPerpsError, fb as WithdrawFromPerpsRequest, is as acceptComboQuote, it as approveErc1155ForAll, iu as approveErc20, iv as authorizeSessionKey, iw as cancelAll, ix as cancelMarketOrders, iy as cancelOrder, iz as cancelOrders, iA as convert, iB as deployDepositWallet, iC as depositToPerps, iD as downloadAccountingSnapshot, iE as dropNotifications, iF as estimateMarketPrice, iG as executeCollateralReturnPlan, iH as fetchBalanceAllowance, iI as fetchBuilderFeeRates, iJ as fetchBuilderVolume, iK as fetchClosedOnlyMode, iL as fetchCommentsById, iM as fetchCurrentRebates, iN as fetchEvent, iO as fetchEventLiveVolume, iP as fetchEventTags, iQ as fetchExecuteParams, iR as fetchLastTradePrice, iS as fetchLastTradePrices, iT as fetchMarket, iU as fetchMarketInfo, iV as fetchMarketTags, iW as fetchMidpoint, iX as fetchMidpoints, iY as fetchNegRisk, iZ as fetchNotifications, i_ as fetchOpenInterest, i$ as fetchOrder, j0 as fetchOrderBook, j1 as fetchOrderBooks, j2 as fetchOrderScoring, j3 as fetchOrdersScoring, j4 as fetchPerpsBook, j5 as fetchPerpsBuilderStatus, j6 as fetchPerpsFees, j7 as fetchPerpsInstruments, j8 as fetchPerpsPositionSnapshots, j9 as fetchPerpsRegistration, ja as fetchPerpsTicker, jb as fetchPerpsTickers, jc as fetchPortfolioValue, jd as fetchPrice, je as fetchPrices, jf as fetchPublicProfile, jg as fetchRelatedTagResources, jh as fetchRelatedTags, ji as fetchResolutions, jj as fetchRewardPercentages, jk as fetchRfqStatus, jl as fetchSeries, jm as fetchSessionKeys, jn as fetchSpread, jo as fetchSpreads, jp as fetchTag, jq as fetchTickSize, jr as fetchTokenReferences, js as fetchTotalEarningsForUserForDay, jt as fetchTraderLeaderboardStanding, ju as fetchTradingApprovalsState, jv as fetchTransaction, jw as fetchUserPnl, jx as fetchUserStats, jy as fetchUserVolume, jz as horizontalMerge, jA as horizontalSplit, jB as isWalletDeployed, jC as listAccountTrades, jD as listActivity, jE as listBiggestWinners, jF as listBuilderLeaderboard, jG as listBuilderTrades, jH as listComboActivity, jI as listComboMarkets, jJ as listComboPositions, jK as listComments, jL as listCommentsByUserAddress, jM as listCurrentRewards, jN as listEvents, jO as listMarketClarifications, jP as listMarketHolders, jQ as listMarketRewards, jR as listMarkets, jS as listOpenOrders, jT as listPerpsCandles, jU as listPerpsFundingHistory, jV as listPerpsTrades, jW as listPositions, jX as listPriceHistory, jY as listRewardMarkets, jZ as listSeries, j_ as listTags, j$ as listTeams, k0 as listTraderLeaderboard, k1 as listTrades, k2 as listUserEarningsAndMarketsConfig, k3 as listUserEarningsForDay, k4 as mergeComboPosition, k5 as mergeMarketPosition, k6 as mergePositions, k7 as openPerpsSession, k8 as openRfqSession, k9 as planCollateralReturn, ka as postOrder, kb as postOrders, kc as prepareCollateralReturnExecution, kd as prepareConvert, ke as prepareErc1155ApprovalForAll, kf as prepareErc20Approval, kg as prepareErc20Transfer, kh as prepareGaslessTransaction, ki as prepareHorizontalMerge, kj as prepareHorizontalSplit, kk as prepareMergeComboPosition, kl as prepareMergeMarketPosition, km as prepareMergePositions, kn as preparePerpsDeposit, ko as prepareRedeemComboPosition, kp as prepareRedeemMarketPositions, kq as prepareRedeemPosition, kr as prepareRedeemPositions, ks as prepareSplitComboPosition, kt as prepareSplitMarketPosition, ku as prepareSplitPosition, kv as prepareTradingApprovals, kw as redeemPositions, kx as requestComboQuote, ky as resolveConditionByToken, kz as revokePerpsCredentials, kA as revokeSessionKey, kB as search, kC as sendOrderHeartbeat, kD as setupTradingApprovals, kE as splitComboPosition, kF as splitMarketPosition, kG as splitPosition, kH as subscribe, kI as transferErc20, kJ as transferPerpsCollateral, kK as updateBalanceAllowance, kL as waitForComboFill, kM as waitForOrderFillSettlement, kN as withdrawFromPerps } from '../types-CI9Rwzhy.js';
|
|
3
3
|
import { ApiKey } from '@kuest/bindings';
|
|
4
4
|
export { SessionSignerKnownScope as SessionKeyKnownScope, SessionSignerScope as SessionKeyScope } from '@kuest/bindings';
|
|
5
5
|
import { ApiKeyCreds, BuilderApiKeyCreds, BuilderApiKey } from '@kuest/bindings/clob';
|
|
6
6
|
import { EvmAddress, EvmSignature } from '@kuest/types';
|
|
7
|
-
export { C as CreateLimitOrderError, a as CreateMarketOrderError, F as FetchSportsMarketTypesError, L as ListSportsError, P as PlaceLimitOrderError, b as PlaceMarketOrderError, c as PrepareLimitOrderError, d as PrepareLimitOrderPostingError, e as PrepareMarketOrderError, f as PrepareMarketOrderPostingError, g as createLimitOrder, h as createMarketOrder, i as fetchSportsMarketTypes, l as listSports, p as placeLimitOrder, j as placeMarketOrder, k as prepareLimitOrder, m as prepareLimitOrderPosting, n as prepareMarketOrder, o as prepareMarketOrderPosting } from '../sports-
|
|
7
|
+
export { C as CreateLimitOrderError, a as CreateMarketOrderError, F as FetchSportsMarketTypesError, L as ListSportsError, P as PlaceLimitOrderError, b as PlaceMarketOrderError, c as PrepareLimitOrderError, d as PrepareLimitOrderPostingError, e as PrepareMarketOrderError, f as PrepareMarketOrderPostingError, g as createLimitOrder, h as createMarketOrder, i as fetchSportsMarketTypes, l as listSports, p as placeLimitOrder, j as placeMarketOrder, k as prepareLimitOrder, m as prepareLimitOrderPosting, n as prepareMarketOrder, o as prepareMarketOrderPosting } from '../sports-Bt7NXBWp.js';
|
|
8
8
|
export { BiggestWinnerKind, BuilderVolumeInterval, ComboActivityType, ComboPositionSortBy, ComboPositionStatus, LeaderboardWindow, PositionFilterType, PositionSortBy, PositionStatus, PriceHistoryInterval, ResolutionMarketType, ResolutionReporter, ResolutionSettlementTimeBasis, ResolutionSource, ResolutionStatus, SortDirection, TipSide, TradeFilterType, TraderLeaderboardSort, UserPnlFidelity, UserPnlInterval } from '@kuest/bindings/data';
|
|
9
9
|
export { BuilderRfqError, CollateralReturnKnownOperationKind, CollateralReturnOperation, CollateralReturnOperationKind, CollateralReturnPlanResponse, CollateralReturnPositionAmount, CollateralReturnPositionSummary, CollateralReturnRouterCall, ComboAcceptFailureReason, ComboQuoteUnavailableReason, RfqConfirmationDecision, RfqConfirmationRequest, RfqDirection, RfqErrorCode, RfqExecutionStatus, RfqExecutionUpdate, RfqId, RfqKnownErrorCode, RfqQuoteId, RfqQuoteRequest, RfqRejectionCode, RfqRequestedSize, RfqRequestedSizeUnit, RfqRequestorPublicId, RfqSide, RfqStatus, RfqTrade } from '@kuest/bindings/combos';
|
|
10
10
|
export { CommentsEvent, CryptoPriceEvent, CryptoPriceSnapshotEvent, CryptoPricesBinanceEvent, CryptoPricesChainlinkEvent, CryptoPricesChainlinkTwapEvent, CryptoPricesChainlinkTwapSixtyEvent, CryptoPricesChainlinkTwapThirtyEvent, CryptoPricesChainlinkTwapWindowSeconds, CryptoPricesEvent, CryptoTwapPriceEvent, CryptoTwapPriceSnapshotEvent, CustomMarketEvent, EquityPriceEvent, EquityPricesEvent, EquityTwapPriceEvent, EquityTwapPriceSnapshotEvent, KnownPriceSource, MarketEvent, PerpsBboEvent, PerpsBookEvent, PerpsBuilderFillUpdateEvent, PerpsCandleEvent, PerpsMarketDataEvent, PerpsSessionEvent, PerpsStatisticEvent, PerpsTickerEvent, PerpsTradeEvent, PriceProvider, PriceSource, SportsEvent, StandardMarketEvent, UserEvent } from '@kuest/bindings/subscriptions';
|
package/dist/ethers-v5.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ethers } from 'ethers-v5';
|
|
2
|
-
import { T as TypedDataPayload, a as TypedData, S as Signer } from './types-
|
|
2
|
+
import { T as TypedDataPayload, a as TypedData, S as Signer } from './types-CI9Rwzhy.js';
|
|
3
3
|
import '@kuest/bindings';
|
|
4
4
|
import '@kuest/types';
|
|
5
5
|
import '@kuest/bindings/gamma';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { U as UserInputError, b as TransactionCall, A as ApiKeyAuthorization, c as ServiceClient$1 } from './types-
|
|
2
|
-
export { d as AcceptComboQuoteError, e as AcceptComboQuoteParams, f as AcceptComboQuoteResult, g as AccountIdentity, h as AnalyticsActions, i as ApproveErc1155ForAllError, j as ApproveErc20Error, k as ApprovePerpsBuilderFeeError, l as ApprovePerpsBuilderFeeRequest, m as ArmPerpsAutoCancelError, n as ArmPerpsAutoCancelRequest, o as AuthorizeSessionKeyError, p as AuthorizeSessionKeyRequest, q as AuthorizeSessionKeyResult, r as AutoCancelDailyLimitError, B as BaseClient, s as BasePublicClient, t as BaseSecureClient, u as BeginAuthenticationRequest, C as CancelAllError, v as CancelAllPerpsOrdersRequest, w as CancelMarketOrdersError, x as CancelOrderError, y as CancelOrdersError, z as CancelPerpsChaseError, D as CancelPerpsChaseRequest, E as CancelPerpsOrderRequest, F as CancelPerpsOrdersRequest, G as CancelPerpsTwapError, H as CancelPerpsTwapRequest, I as CancelledSigningError, J as Client, K as ClientActions, L as ClientDecorator, M as ClobEndpoints, N as ComboPositionStatusFilter, O as ComboQuote, P as CombosEndpoints, Q as CommentsSubscription, R as ConnectionLostError, V as ConnectionLostErrorOptions, W as ConvertError, X as ConvertWorkflow, Y as CreatePerpsChaseError, Z as CreatePerpsChaseRequest, _ as CreatePerpsSessionRequest, $ as CreatePerpsTwapError, a0 as CreatePerpsTwapRequest, a1 as CreateSecureClientError, a2 as CryptoPriceSubscription, a3 as CryptoPricesChainlinkTwapSubscription, a4 as CryptoPricesSubscription, a5 as CryptoTwapPriceSubscription, a6 as DEFAULT_SITE_CONFIG, a7 as DataActions, a8 as DepositToPerpsError, a9 as DepositToPerpsRequest, aa as DisarmPerpsAutoCancelRequest, ab as DiscoveryActions, ac as DownloadAccountingSnapshotError, ad as DropNotificationsError, ae as EnvironmentConfig, af as EnvironmentConfigFork, ag as EnvironmentContracts, ah as EquityPriceSubscription, ai as EquityPricesSubscription, aj as EquityTwapPriceSubscription, ak as Erc1155TradingApproval, al as Erc20TradingApproval, am as EstimateMarketPriceError, an as ExecuteCollateralReturnPlanError, ao as ExecuteCollateralReturnPlanRequest, ap as Fetch, aq as FetchBuilderVolumeError, ar as FetchClosedOnlyModeError, as as FetchCommentsByIdError, at as FetchCurrentRebatesError, au as FetchCurrentRebatesRequest, av as FetchEventError, aw as FetchEventLiveVolumeError, ax as FetchEventTagsError, ay as FetchLastTradePriceError, az as FetchLastTradePricesError, aA as FetchMarketError, aB as FetchMarketTagsError, aC as FetchMidpointError, aD as FetchMidpointsError, aE as FetchNotificationsError, aF as FetchOpenInterestError, aG as FetchOrderBookError, aH as FetchOrderBooksError, aI as FetchOrderError, aJ as FetchOrderScoringError, aK as FetchOrdersScoringError, aL as FetchPerpsAccountConfigRequest, aM as FetchPerpsBookError, aN as FetchPerpsBookRequest, aO as FetchPerpsBuilderApprovalsError, aP as FetchPerpsBuilderApprovalsRequest, aQ as FetchPerpsBuilderEarningsSummaryError, aR as FetchPerpsBuilderEarningsSummaryRequest, aS as FetchPerpsBuilderStatusError, aT as FetchPerpsBuilderStatusRequest, aU as FetchPerpsChasesError, aV as FetchPerpsFeesError, aW as FetchPerpsInstrumentsError, aX as FetchPerpsInstrumentsRequest, aY as FetchPerpsOpenOrdersRequest, aZ as FetchPerpsOrdersRequest, a_ as FetchPerpsPositionSnapshotsError, a$ as FetchPerpsPositionSnapshotsRequest, b0 as FetchPerpsRegistrationError, b1 as FetchPerpsRegistrationRequest, b2 as FetchPerpsTickerError, b3 as FetchPerpsTickerRequest, b4 as FetchPerpsTickersError, b5 as FetchPerpsTickersRequest, b6 as FetchPerpsTwapsError, b7 as FetchPortfolioValueError, b8 as FetchPriceError, b9 as FetchPricesError, ba as FetchPublicProfileError, bb as FetchRelatedTagResourcesError, bc as FetchRelatedTagsError, bd as FetchResolutionsError, be as FetchRewardPercentagesError, bf as FetchRfqStatusError, bg as FetchRfqStatusParams, bh as FetchSeriesError, bi as FetchSessionKeysError, bj as FetchSpreadError, bk as FetchSpreadsError, bl as FetchTagError, bm as FetchTokenReferencesError, bn as FetchTokenReferencesRequest, bo as FetchTotalEarningsForUserForDayError, bp as FetchTraderLeaderboardStandingError, bq as FetchTradingApprovalsStateError, br as FetchTradingApprovalsStateRequest, bs as FetchUserPnlError, bt as FetchUserStatsError, bu as FetchUserVolumeError, bv as HorizontalMergeError, bw as HorizontalMergeWorkflow, bx as HorizontalSplitError, by as HorizontalSplitWorkflow, bz as InsufficientLiquidityError, bA as ListAccountTradesError, bB as ListActivityError, bC as ListBiggestWinnersError, bD as ListBuilderLeaderboardError, bE as ListBuilderTradesError, bF as ListComboActivityError, bG as ListComboMarketsError, bH as ListComboPositionsError, bI as ListCommentsByUserAddressError, bJ as ListCommentsError, bK as ListCurrentRewardsError, bL as ListEventsError, bM as ListMarketHoldersError, bN as ListMarketRewardsError, bO as ListMarketsError, bP as ListOpenOrdersError, bQ as ListPerpsBuilderEarningsError, bR as ListPerpsBuilderEarningsRequest, bS as ListPerpsCandlesError, bT as ListPerpsCandlesRequest, bU as ListPerpsDepositsRequest, bV as ListPerpsEquityHistoryRequest, bW as ListPerpsFillsRequest, bX as ListPerpsFundingHistoryError, bY as ListPerpsFundingHistoryRequest, bZ as ListPerpsFundingPaymentsRequest, b_ as ListPerpsInternalTransfersRequest, b$ as ListPerpsNotificationsRequest, c0 as ListPerpsPnlHistoryRequest, c1 as ListPerpsTradesError, c2 as ListPerpsTradesRequest, c3 as ListPerpsWithdrawalsRequest, c4 as ListPositionsError, c5 as ListPriceHistoryError, c6 as ListRewardMarketsError, c7 as ListRewardMarketsRequest, c8 as ListSeriesError, c9 as ListTagsError, ca as ListTeamsError, cb as ListTraderLeaderboardError, cc as ListTradesError, cd as ListUserEarningsAndMarketsConfigError, ce as ListUserEarningsForDayError, cf as MarkPerpsNotificationsReadRequest, cg as MergePositionsError, ch as NegRiskWorkflow, ci as OpenPerpsSessionError, cj as OpenPerpsSessionRequest, ck as OpenRfqSessionError, cl as OperationAbortedError, cm as OrderHeartbeatMismatchError, cn as OrderSignature, co as Page, cp as PageSizeSchema, cq as Paginated, cr as PaginationLimitError, cs as PausePerpsTwapError, ct as PausePerpsTwapRequest, cu as PerpsActions, cv as PerpsBookDepth, cw as PerpsBuilderTermsInput, cx as PerpsCancelOptions, cy as PerpsCancelRetryError, cz as PerpsCancelRetryErrorOptions, cA as PerpsCancelRetryOptions, cB as PerpsEndpoints, cC as PerpsOrderRequest, cD as PerpsPlaceFokOrderRequest, cE as PerpsPlaceGtcOrderRequest, cF as PerpsPlaceGtdOrderRequest, cG as PerpsPlaceIocOrderRequest, cH as PerpsPlacedTpSlOrder, cI as PerpsPlacedTpSlOrders, cJ as PerpsPositionSnapshotFill, cK as PerpsPositionSnapshotSelection, cL as PerpsPositionTpSlTrigger, cM as PerpsPositionTrailingStop, cN as PerpsSession, cO as PerpsSessionAccountError, cP as PerpsSessionLifecycleError, cQ as PerpsSessionTradingError, cR as PerpsTpSlTrigger, cS as PerpsTrailingStop, cT as PlacePerpsOrderRequest, cU as PlacePerpsOrderResult, cV as PlacePerpsOrderWithTpSlRequest, cW as PlacePerpsOrderWithTpSlResult, cX as PlacePerpsPositionTpSlRequest, cY as PlacePerpsPositionTpSlResult, cZ as PlanCollateralReturnError, c_ as PostOrderError, c$ as PostOrdersError, d0 as PostPerpsOrdersRequest, d1 as PrepareConvertError, d2 as PrepareConvertRequest, d3 as PrepareHorizontalMergeError, d4 as PrepareHorizontalMergeRequest, d5 as PrepareHorizontalSplitError, d6 as PrepareHorizontalSplitRequest, d7 as PriceSubscription, d8 as PriceSubscriptionConfirmation, d9 as PublicAccountActions, da as PublicActions, db as PublicClient, dc as PublicClientOptions, dd as PublicPerpsActions, de as PublicRewardsActions, df as PublicSubscriptionsActions, dg as PublicWalletActions, dh as RateLimitBucket, di as RateLimitError, dj as RateLimitErrorOptions, dk as RateLimitUpdate, dl as RateLimitUpdateListener, dm as RedeemPositionsError, dn as RequestAbortedError, dp as RequestComboQuoteError, dq as RequestComboQuoteParams, dr as RequestComboQuoteResult, ds as RequestOptions, dt as RequestRejectedError, du as RequestRejectedErrorOptions, dv as RestEndpoint, dw as ResumePerpsSessionRequest, dx as ResumePerpsTwapError, dy as ResumePerpsTwapRequest, dz as RevokePerpsBuilderFeeError, dA as RevokePerpsCredentialsError, dB as RevokePerpsCredentialsRequest, dC as RevokeSessionKeyError, dD as RevokeSessionKeyRequest, dE as RfqCancelQuoteAck, dF as RfqCancelQuoteError, dG as RfqCancelQuoteRejectedError, dH as RfqCancelQuoteRejectedErrorOptions, dI as RfqConfirmationAck, dJ as RfqConfirmationError, dK as RfqConfirmationRejectedError, dL as RfqConfirmationRequestEvent, dM as RfqEvent, dN as RfqQuoteError, dO as RfqQuoteReference, dP as RfqQuoteRejectedError, dQ as RfqQuoteRejectedErrorOptions, dR as RfqQuoteRequestEvent, dS as RfqQuoteResponse, dT as RfqQuoteSource, dU as RfqRequestRejectedError, dV as RfqRequestRejectedErrorOptions, dW as RfqSession, dX as RfqStatusResult, dY as RfqTradeEvent, dZ as SearchError, d_ as SearchSort, d$ as SecureAccountActions, e0 as SecureActions, e1 as SecureClient, e2 as SecureClientOptions, e3 as SecureDownloadAccountingSnapshotRequest, e4 as SecureFetchPortfolioValueRequest, e5 as SecureFetchTraderLeaderboardStandingRequest, e6 as SecureFetchUserPnlRequest, e7 as SecureFetchUserStatsRequest, e8 as SecureFetchUserVolumeRequest, e9 as SecureListActivityRequest, ea as SecureListComboActivityRequest, eb as SecureListComboPositionsRequest, ec as SecureListPositionsRequest, ed as SecurePerpsActions, ee as SecureRewardsActions, ef as SecureRfqActions, eg as SecureSubscriptionsActions, eh as SecureTradingActions, ei as SecureWalletActions, ej as SendOrderHeartbeatError, ek as SendOrderHeartbeatRequest, el as ServiceClientDeleteOptions, em as ServiceClientGetOptions, en as ServiceClientJsonResponseOptions, eo as ServiceClientNonJsonResponseOptions, ep as ServiceClientNonJsonResponseType, eq as ServiceClientPatchOptions, er as ServiceClientPostOptions, es as ServiceClientRequestError, et as ServiceClientRequestOptions, eu as ServiceClientResponse, ev as ServiceClientResponseOptions, ew as ServiceClientResponseType, ex as SessionKey, ey as SessionKeyActions, ez as SetupGaslessWalletError, eA as SetupTradingApprovalsError, eB as SignedOrder, S as Signer, eC as SignerTransactionRequest, eD as SignerType, eE as SigningError, eF as SiteConfig, eG as SplitPositionError, eH as SubscribeError, eI as SubscriptionHandle, eJ as TimeoutError, eK as TradingApprovalRequirements, eL as TradingApprovalsState, eM as TradingRestriction, eN as TransactionFailedError, eO as TransactionHandle, eP as TransactionOutcome, eQ as TransferErc20Error, eR as TransferPerpsCollateralError, eS as TransferPerpsCollateralRequest, eT as TransportError, a as TypedData, eU as TypedDataDomain, eV as TypedDataField, T as TypedDataPayload, eW as UnexpectedResponseError, eX as UpdatePerpsLeverageError, eY as UpdatePerpsLeverageRequest, eZ as UpdatePerpsLeveragesError, e_ as UpdatePerpsLeveragesRequest, e$ as UpdatePerpsMarginError, f0 as UpdatePerpsMarginRequest, f1 as WaitForComboFillError, f2 as WaitForComboFillParams, f3 as WaitForComboFillResult, f4 as WaitForOrderFillSettlementError, f5 as WaitForTransactionError, f6 as WalletDerivationConfig, f7 as WebSocketCloseCode, f8 as WebSocketEndpoint, f9 as WebSocketKnownCloseCode, fa as WithdrawFromPerpsError, fb as WithdrawFromPerpsRequest, fc as accountActions, fd as allActions, fe as analyticsActions, ff as createPublicClient, fg as createSecureClient, fh as dataActions, fi as discoveryActions, fj as forkEnvironmentConfig, fk as makeErrorGuard, fl as parseSiteConfig, fm as perpsActions, fn as production, fo as rewardsActions, fp as rfqActions, fq as sessionKeyActions, fr as subscriptionsActions, fs as tradingActions, ft as walletActions } from './types-BGprBegM.js';
|
|
1
|
+
import { U as UserInputError, b as TransactionCall, A as ApiKeyAuthorization, c as ServiceClient$1 } from './types-CI9Rwzhy.js';
|
|
2
|
+
export { d as AcceptComboQuoteError, e as AcceptComboQuoteParams, f as AcceptComboQuoteResult, g as AccountIdentity, h as AnalyticsActions, i as ApproveErc1155ForAllError, j as ApproveErc20Error, k as ApprovePerpsBuilderFeeError, l as ApprovePerpsBuilderFeeRequest, m as ArmPerpsAutoCancelError, n as ArmPerpsAutoCancelRequest, o as AuthorizeSessionKeyError, p as AuthorizeSessionKeyRequest, q as AuthorizeSessionKeyResult, r as AutoCancelDailyLimitError, B as BaseClient, s as BasePublicClient, t as BaseSecureClient, u as BeginAuthenticationRequest, C as CancelAllError, v as CancelAllPerpsOrdersRequest, w as CancelMarketOrdersError, x as CancelOrderError, y as CancelOrdersError, z as CancelPerpsChaseError, D as CancelPerpsChaseRequest, E as CancelPerpsOrderRequest, F as CancelPerpsOrdersRequest, G as CancelPerpsTwapError, H as CancelPerpsTwapRequest, I as CancelledSigningError, J as Client, K as ClientActions, L as ClientDecorator, M as ClobEndpoints, N as ComboPositionStatusFilter, O as ComboQuote, P as CombosEndpoints, Q as CommentsSubscription, R as ConnectionLostError, V as ConnectionLostErrorOptions, W as ConvertError, X as ConvertWorkflow, Y as CreatePerpsChaseError, Z as CreatePerpsChaseRequest, _ as CreatePerpsSessionRequest, $ as CreatePerpsTwapError, a0 as CreatePerpsTwapRequest, a1 as CreateSecureClientError, a2 as CryptoPriceSubscription, a3 as CryptoPricesChainlinkTwapSubscription, a4 as CryptoPricesSubscription, a5 as CryptoTwapPriceSubscription, a6 as DEFAULT_SITE_CONFIG, a7 as DataActions, a8 as DepositToPerpsError, a9 as DepositToPerpsRequest, aa as DisarmPerpsAutoCancelRequest, ab as DiscoveryActions, ac as DownloadAccountingSnapshotError, ad as DropNotificationsError, ae as EnvironmentConfig, af as EnvironmentConfigFork, ag as EnvironmentContracts, ah as EquityPriceSubscription, ai as EquityPricesSubscription, aj as EquityTwapPriceSubscription, ak as Erc1155TradingApproval, al as Erc20TradingApproval, am as EstimateMarketPriceError, an as ExecuteCollateralReturnPlanError, ao as ExecuteCollateralReturnPlanRequest, ap as Fetch, aq as FetchBuilderVolumeError, ar as FetchClosedOnlyModeError, as as FetchCommentsByIdError, at as FetchCurrentRebatesError, au as FetchCurrentRebatesRequest, av as FetchEventError, aw as FetchEventLiveVolumeError, ax as FetchEventTagsError, ay as FetchLastTradePriceError, az as FetchLastTradePricesError, aA as FetchMarketError, aB as FetchMarketTagsError, aC as FetchMidpointError, aD as FetchMidpointsError, aE as FetchNotificationsError, aF as FetchOpenInterestError, aG as FetchOrderBookError, aH as FetchOrderBooksError, aI as FetchOrderError, aJ as FetchOrderScoringError, aK as FetchOrdersScoringError, aL as FetchPerpsAccountConfigRequest, aM as FetchPerpsBookError, aN as FetchPerpsBookRequest, aO as FetchPerpsBuilderApprovalsError, aP as FetchPerpsBuilderApprovalsRequest, aQ as FetchPerpsBuilderEarningsSummaryError, aR as FetchPerpsBuilderEarningsSummaryRequest, aS as FetchPerpsBuilderStatusError, aT as FetchPerpsBuilderStatusRequest, aU as FetchPerpsChasesError, aV as FetchPerpsFeesError, aW as FetchPerpsInstrumentsError, aX as FetchPerpsInstrumentsRequest, aY as FetchPerpsOpenOrdersRequest, aZ as FetchPerpsOrdersRequest, a_ as FetchPerpsPositionSnapshotsError, a$ as FetchPerpsPositionSnapshotsRequest, b0 as FetchPerpsRegistrationError, b1 as FetchPerpsRegistrationRequest, b2 as FetchPerpsTickerError, b3 as FetchPerpsTickerRequest, b4 as FetchPerpsTickersError, b5 as FetchPerpsTickersRequest, b6 as FetchPerpsTwapsError, b7 as FetchPortfolioValueError, b8 as FetchPriceError, b9 as FetchPricesError, ba as FetchPublicProfileError, bb as FetchRelatedTagResourcesError, bc as FetchRelatedTagsError, bd as FetchResolutionsError, be as FetchRewardPercentagesError, bf as FetchRfqStatusError, bg as FetchRfqStatusParams, bh as FetchSeriesError, bi as FetchSessionKeysError, bj as FetchSpreadError, bk as FetchSpreadsError, bl as FetchTagError, bm as FetchTokenReferencesError, bn as FetchTokenReferencesRequest, bo as FetchTotalEarningsForUserForDayError, bp as FetchTraderLeaderboardStandingError, bq as FetchTradingApprovalsStateError, br as FetchTradingApprovalsStateRequest, bs as FetchUserPnlError, bt as FetchUserStatsError, bu as FetchUserVolumeError, bv as HorizontalMergeError, bw as HorizontalMergeWorkflow, bx as HorizontalSplitError, by as HorizontalSplitWorkflow, bz as InsufficientLiquidityError, bA as ListAccountTradesError, bB as ListActivityError, bC as ListBiggestWinnersError, bD as ListBuilderLeaderboardError, bE as ListBuilderTradesError, bF as ListComboActivityError, bG as ListComboMarketsError, bH as ListComboPositionsError, bI as ListCommentsByUserAddressError, bJ as ListCommentsError, bK as ListCurrentRewardsError, bL as ListEventsError, bM as ListMarketHoldersError, bN as ListMarketRewardsError, bO as ListMarketsError, bP as ListOpenOrdersError, bQ as ListPerpsBuilderEarningsError, bR as ListPerpsBuilderEarningsRequest, bS as ListPerpsCandlesError, bT as ListPerpsCandlesRequest, bU as ListPerpsDepositsRequest, bV as ListPerpsEquityHistoryRequest, bW as ListPerpsFillsRequest, bX as ListPerpsFundingHistoryError, bY as ListPerpsFundingHistoryRequest, bZ as ListPerpsFundingPaymentsRequest, b_ as ListPerpsInternalTransfersRequest, b$ as ListPerpsNotificationsRequest, c0 as ListPerpsPnlHistoryRequest, c1 as ListPerpsTradesError, c2 as ListPerpsTradesRequest, c3 as ListPerpsWithdrawalsRequest, c4 as ListPositionsError, c5 as ListPriceHistoryError, c6 as ListRewardMarketsError, c7 as ListRewardMarketsRequest, c8 as ListSeriesError, c9 as ListTagsError, ca as ListTeamsError, cb as ListTraderLeaderboardError, cc as ListTradesError, cd as ListUserEarningsAndMarketsConfigError, ce as ListUserEarningsForDayError, cf as MarkPerpsNotificationsReadRequest, cg as MergePositionsError, ch as NegRiskWorkflow, ci as OpenPerpsSessionError, cj as OpenPerpsSessionRequest, ck as OpenRfqSessionError, cl as OperationAbortedError, cm as OrderHeartbeatMismatchError, cn as OrderSignature, co as Page, cp as PageSizeSchema, cq as Paginated, cr as PaginationLimitError, cs as PausePerpsTwapError, ct as PausePerpsTwapRequest, cu as PerpsActions, cv as PerpsBookDepth, cw as PerpsBuilderTermsInput, cx as PerpsCancelOptions, cy as PerpsCancelRetryError, cz as PerpsCancelRetryErrorOptions, cA as PerpsCancelRetryOptions, cB as PerpsEndpoints, cC as PerpsOrderRequest, cD as PerpsPlaceFokOrderRequest, cE as PerpsPlaceGtcOrderRequest, cF as PerpsPlaceGtdOrderRequest, cG as PerpsPlaceIocOrderRequest, cH as PerpsPlacedTpSlOrder, cI as PerpsPlacedTpSlOrders, cJ as PerpsPositionSnapshotFill, cK as PerpsPositionSnapshotSelection, cL as PerpsPositionTpSlTrigger, cM as PerpsPositionTrailingStop, cN as PerpsSession, cO as PerpsSessionAccountError, cP as PerpsSessionLifecycleError, cQ as PerpsSessionTradingError, cR as PerpsTpSlTrigger, cS as PerpsTrailingStop, cT as PlacePerpsOrderRequest, cU as PlacePerpsOrderResult, cV as PlacePerpsOrderWithTpSlRequest, cW as PlacePerpsOrderWithTpSlResult, cX as PlacePerpsPositionTpSlRequest, cY as PlacePerpsPositionTpSlResult, cZ as PlanCollateralReturnError, c_ as PostOrderError, c$ as PostOrdersError, d0 as PostPerpsOrdersRequest, d1 as PrepareConvertError, d2 as PrepareConvertRequest, d3 as PrepareHorizontalMergeError, d4 as PrepareHorizontalMergeRequest, d5 as PrepareHorizontalSplitError, d6 as PrepareHorizontalSplitRequest, d7 as PriceSubscription, d8 as PriceSubscriptionConfirmation, d9 as PublicAccountActions, da as PublicActions, db as PublicClient, dc as PublicClientOptions, dd as PublicPerpsActions, de as PublicRewardsActions, df as PublicSubscriptionsActions, dg as PublicWalletActions, dh as RateLimitBucket, di as RateLimitError, dj as RateLimitErrorOptions, dk as RateLimitUpdate, dl as RateLimitUpdateListener, dm as RedeemPositionsError, dn as RequestAbortedError, dp as RequestComboQuoteError, dq as RequestComboQuoteParams, dr as RequestComboQuoteResult, ds as RequestOptions, dt as RequestRejectedError, du as RequestRejectedErrorOptions, dv as RestEndpoint, dw as ResumePerpsSessionRequest, dx as ResumePerpsTwapError, dy as ResumePerpsTwapRequest, dz as RevokePerpsBuilderFeeError, dA as RevokePerpsCredentialsError, dB as RevokePerpsCredentialsRequest, dC as RevokeSessionKeyError, dD as RevokeSessionKeyRequest, dE as RfqCancelQuoteAck, dF as RfqCancelQuoteError, dG as RfqCancelQuoteRejectedError, dH as RfqCancelQuoteRejectedErrorOptions, dI as RfqConfirmationAck, dJ as RfqConfirmationError, dK as RfqConfirmationRejectedError, dL as RfqConfirmationRequestEvent, dM as RfqEvent, dN as RfqQuoteError, dO as RfqQuoteReference, dP as RfqQuoteRejectedError, dQ as RfqQuoteRejectedErrorOptions, dR as RfqQuoteRequestEvent, dS as RfqQuoteResponse, dT as RfqQuoteSource, dU as RfqRequestRejectedError, dV as RfqRequestRejectedErrorOptions, dW as RfqSession, dX as RfqStatusResult, dY as RfqTradeEvent, dZ as SearchError, d_ as SearchSort, d$ as SecureAccountActions, e0 as SecureActions, e1 as SecureClient, e2 as SecureClientOptions, e3 as SecureDownloadAccountingSnapshotRequest, e4 as SecureFetchPortfolioValueRequest, e5 as SecureFetchTraderLeaderboardStandingRequest, e6 as SecureFetchUserPnlRequest, e7 as SecureFetchUserStatsRequest, e8 as SecureFetchUserVolumeRequest, e9 as SecureListActivityRequest, ea as SecureListComboActivityRequest, eb as SecureListComboPositionsRequest, ec as SecureListPositionsRequest, ed as SecurePerpsActions, ee as SecureRewardsActions, ef as SecureRfqActions, eg as SecureSubscriptionsActions, eh as SecureTradingActions, ei as SecureWalletActions, ej as SendOrderHeartbeatError, ek as SendOrderHeartbeatRequest, el as ServiceClientDeleteOptions, em as ServiceClientGetOptions, en as ServiceClientJsonResponseOptions, eo as ServiceClientNonJsonResponseOptions, ep as ServiceClientNonJsonResponseType, eq as ServiceClientPatchOptions, er as ServiceClientPostOptions, es as ServiceClientRequestError, et as ServiceClientRequestOptions, eu as ServiceClientResponse, ev as ServiceClientResponseOptions, ew as ServiceClientResponseType, ex as SessionKey, ey as SessionKeyActions, ez as SetupGaslessWalletError, eA as SetupTradingApprovalsError, eB as SignedOrder, S as Signer, eC as SignerTransactionRequest, eD as SignerType, eE as SigningError, eF as SiteConfig, eG as SplitPositionError, eH as SubscribeError, eI as SubscriptionHandle, eJ as TimeoutError, eK as TradingApprovalRequirements, eL as TradingApprovalsState, eM as TradingRestriction, eN as TransactionFailedError, eO as TransactionHandle, eP as TransactionOutcome, eQ as TransferErc20Error, eR as TransferPerpsCollateralError, eS as TransferPerpsCollateralRequest, eT as TransportError, a as TypedData, eU as TypedDataDomain, eV as TypedDataField, T as TypedDataPayload, eW as UnexpectedResponseError, eX as UpdatePerpsLeverageError, eY as UpdatePerpsLeverageRequest, eZ as UpdatePerpsLeveragesError, e_ as UpdatePerpsLeveragesRequest, e$ as UpdatePerpsMarginError, f0 as UpdatePerpsMarginRequest, f1 as WaitForComboFillError, f2 as WaitForComboFillParams, f3 as WaitForComboFillResult, f4 as WaitForOrderFillSettlementError, f5 as WaitForTransactionError, f6 as WalletDerivationConfig, f7 as WebSocketCloseCode, f8 as WebSocketEndpoint, f9 as WebSocketKnownCloseCode, fa as WithdrawFromPerpsError, fb as WithdrawFromPerpsRequest, fc as accountActions, fd as allActions, fe as analyticsActions, ff as createPublicClient, fg as createSecureClient, fh as dataActions, fi as discoveryActions, fj as forkEnvironmentConfig, fk as makeErrorGuard, fl as parseSiteConfig, fm as perpsActions, fn as production, fo as rewardsActions, fp as rfqActions, fq as sessionKeyActions, fr as subscriptionsActions, fs as tradingActions, ft as walletActions } from './types-CI9Rwzhy.js';
|
|
3
3
|
import { ConditionId, ComboConditionId } from '@kuest/bindings';
|
|
4
4
|
export * from '@kuest/bindings';
|
|
5
5
|
export { CommentParentEntityType, GatewayErrorCode, GatewayKnownErrorCode, OrderSide, OrderType, SessionSignerKnownScope as SessionKeyKnownScope, SessionSignerScope as SessionKeyScope } from '@kuest/bindings';
|
|
@@ -13,7 +13,7 @@ export * from '@kuest/bindings/perps';
|
|
|
13
13
|
export { PerpsAutoCancelStatus, PerpsCancelOrderResult, PerpsChase, PerpsChaseAccepted, PerpsChaseId, PerpsDepositStatus, PerpsInstrumentCategory, PerpsInstrumentType, PerpsInternalTransferDirection, PerpsKlineInterval, PerpsKnownCancelOrderErrorCode, PerpsKnownInternalTransferType, PerpsKnownWithdrawalStatus, PerpsLiquidationMethod, PerpsLiquidityRole, PerpsMarginType, PerpsNotificationOrderType, PerpsNotificationType, PerpsOrderStatus, PerpsPositionSnapshotMarkerKind, PerpsPositionSnapshotStatus, PerpsPostOrderAck, PerpsSide, PerpsSortDirection, PerpsTimeInForce, PerpsTwap, PerpsTwapAccepted, PerpsTwapId, PerpsTwapStatus, PerpsUpdateLeverageBatchResult, PerpsUpdateLeverageRejection, PerpsUpdateLeverageResult } from '@kuest/bindings/perps';
|
|
14
14
|
export * from '@kuest/bindings/relayer';
|
|
15
15
|
import { Tagged, EvmAddress } from '@kuest/types';
|
|
16
|
-
export { C as CreateLimitOrderError, a as CreateMarketOrderError, F as FetchSportsMarketTypesError, L as ListSportsError, P as PlaceLimitOrderError, b as PlaceMarketOrderError } from './sports-
|
|
16
|
+
export { C as CreateLimitOrderError, a as CreateMarketOrderError, F as FetchSportsMarketTypesError, L as ListSportsError, P as PlaceLimitOrderError, b as PlaceMarketOrderError } from './sports-Bt7NXBWp.js';
|
|
17
17
|
export { BuilderRfqError, CollateralReturnKnownOperationKind, CollateralReturnOperation, CollateralReturnOperationKind, CollateralReturnPlanResponse, CollateralReturnPositionAmount, CollateralReturnPositionSummary, CollateralReturnRouterCall, ComboAcceptFailureReason, ComboQuoteUnavailableReason, RfqConfirmationDecision, RfqConfirmationRequest, RfqDirection, RfqErrorCode, RfqExecutionStatus, RfqExecutionUpdate, RfqId, RfqKnownErrorCode, RfqQuoteId, RfqQuoteRequest, RfqRejectionCode, RfqRequestedSize, RfqRequestedSizeUnit, RfqRequestorPublicId, RfqSide, RfqStatus, RfqTrade } from '@kuest/bindings/combos';
|
|
18
18
|
export { CommentsEvent, CryptoPriceEvent, CryptoPriceSnapshotEvent, CryptoPricesBinanceEvent, CryptoPricesChainlinkEvent, CryptoPricesChainlinkTwapEvent, CryptoPricesChainlinkTwapSixtyEvent, CryptoPricesChainlinkTwapThirtyEvent, CryptoPricesChainlinkTwapWindowSeconds, CryptoPricesEvent, CryptoTwapPriceEvent, CryptoTwapPriceSnapshotEvent, EquityPriceEvent, EquityPricesEvent, EquityTwapPriceEvent, EquityTwapPriceSnapshotEvent, KnownPriceSource, PerpsBuilderFillUpdateEvent, PerpsSessionEvent, PriceProvider, PriceSource, RealtimeErrorCode, RealtimeKnownErrorCode } from '@kuest/bindings/subscriptions';
|
|
19
19
|
import 'zod';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {Q as Q$1,R as R$1,Z as Z$1,ha,fa,da,Da as Da$1,Ba,Xf,Vf,Tf,Rf,bd,Pf,Nf,Lf,dd as dd$1,$c,Zc,Xc,Jb,za as za$1,ud,yd,Wd,wd,lc as lc$1,jc,hc as hc$1,fc,dc as dc$1,bc as bc$1,$b,Zb,Nb,Lb,Oc,Qc as Qc$1,Sh,Gc,Ec as Ec$1,Cc as Cc$1,Lg,Qh,Ch,Ah,nh,Oh,Mh,Kh,Ih,jd,rh,ph,sd,qd,od,md,Mc,Kc as Kc$1,Ic,sf,qf,of,kf,if as _if,gf,uf,mf,De,Jf,Ge,Ff,Gf,Cf,Bf,Ef,xa,va,ta,ra,pa,na,_g,Yg,Wg,Tg,yh,uh,wh,Eh,ba,$,Ud,Sd,Qd,Od,te as te$1,ae,$d,Be as Be$1,ze,xe as xe$1,ve,Md,zc,vc as vc$1,Jg,Ag,og,Id,Kd,Ed,Gd,Ad,Cd,Wh,kb,gb,qb,nb,ce,Ka as Ka$1,Pa,W,X as X$1,Sa,pc as pc$1,nc,rc,tc,S,Ie as Ie$1,a as a$1,La as La$1,U as U$1,zb,xb,Pe,Me as Me$1,Oe as Oe$1,Ke as Ke$1,Le as Le$1,Je,Bb,rb,ef,Mg,Og,Qg,Ne,V,fe,he,ie,ge,de,ee as ee$1}from'./chunk-3QTVWIZS.js';export{Xg as AcceptComboQuoteError,jb as ApproveErc1155ForAllError,fb as ApproveErc20Error,Ee as ApprovePerpsBuilderFeeError,We as ArmPerpsAutoCancelError,vh as AuthorizeSessionKeyError,ed as BiggestWinnerKind,fd as BuilderVolumeInterval,Rd as CancelAllError,Td as CancelMarketOrdersError,Nd as CancelOrderError,Pd as CancelOrdersError,Ve as CancelPerpsChaseError,cf as CancelPerpsTwapError,Ac as CollateralReturnKnownOperationKind,M as CombinatorialPrepareConditionCallError,bh as ComboAcceptFailureReason,Ea as ComboActivityType,Yf as ComboPositionSortBy,Zf as ComboPositionStatus,ch as ComboQuoteUnavailableReason,Bd as ConvertError,ye as CreateLimitOrderError,ue as CreateMarketOrderError,Te as CreatePerpsChaseError,_e as CreatePerpsTwapError,v as CtfMergePositionsCallError,x as CtfRedeemPositionsCallError,t as CtfSplitPositionCallError,be as DEFAULT_SITE_CONFIG,yf as DepositToPerpsError,Wf as DownloadAccountingSnapshotError,ga as DropNotificationsError,c as Erc20ApprovalCallError,n as Erc20TransferCallError,Vd as EstimateMarketPriceError,yc as ExecuteCollateralReturnPlanError,Yc as FetchBuilderVolumeError,Y as FetchClosedOnlyModeError,Dc as FetchCommentsByIdError,sc as FetchCurrentRebatesError,Jc as FetchEventError,Pc as FetchEventLiveVolumeError,Lc as FetchEventTagsError,ic as FetchLastTradePriceError,kc as FetchLastTradePricesError,pd as FetchMarketError,rd as FetchMarketTagsError,Kb as FetchMidpointError,Mb as FetchMidpointsError,ea as FetchNotificationsError,xd as FetchOpenInterestError,ac as FetchOrderBookError,cc as FetchOrderBooksError,aa as FetchOrderError,ma as FetchOrderScoringError,oa as FetchOrdersScoringError,lf as FetchPerpsBookError,Qe as FetchPerpsBuilderApprovalsError,Se as FetchPerpsBuilderEarningsSummaryError,Ce as FetchPerpsBuilderStatusError,Ue as FetchPerpsChasesError,tf as FetchPerpsFeesError,ff as FetchPerpsInstrumentsError,Fe as FetchPerpsPositionSnapshotsError,If as FetchPerpsRegistrationError,hf as FetchPerpsTickerError,jf as FetchPerpsTickersError,$e as FetchPerpsTwapsError,Of as FetchPortfolioValueError,Yb as FetchPriceError,_b as FetchPricesError,Kg as FetchPublicProfileError,Nh as FetchRelatedTagResourcesError,Lh as FetchRelatedTagsError,Nc as FetchResolutionsError,wa as FetchRewardPercentagesError,$g as FetchRfqStatusError,qh as FetchSeriesError,th as FetchSessionKeysError,Bh as FetchSportsMarketTypesError,ec as FetchSpreadError,gc as FetchSpreadsError,Jh as FetchTagError,Rh as FetchTokenReferencesError,sa as FetchTotalEarningsForUserForDayError,ad as FetchTraderLeaderboardStandingError,mb as FetchTradingApprovalsStateError,Sf as FetchUserPnlError,Qf as FetchUserStatsError,Uf as FetchUserVolumeError,Jd as HorizontalMergeError,Fd as HorizontalSplitError,Fh as KnownPriceSource,gd as LeaderboardWindow,ca as ListAccountTradesError,Aa as ListActivityError,cd as ListBiggestWinnersError,Wc as ListBuilderLeaderboardError,Ib as ListBuilderTradesError,Ca as ListComboActivityError,nd as ListComboMarketsError,Mf as ListComboPositionsError,Fc as ListCommentsByUserAddressError,Bc as ListCommentsError,mc as ListCurrentRewardsError,Hc as ListEventsError,td as ListMarketHoldersError,oc as ListMarketRewardsError,ld as ListMarketsError,_ as ListOpenOrdersError,Re as ListPerpsBuilderEarningsError,nf as ListPerpsCandlesError,pf as ListPerpsFundingHistoryError,rf as ListPerpsTradesError,Kf as ListPositionsError,vd as ListPriceHistoryError,qc as ListRewardMarketsError,oh as ListSeriesError,zh as ListSportsError,Hh as ListTagsError,Ph as ListTeamsError,_c as ListTraderLeaderboardError,ya as ListTradesError,ua as ListUserEarningsAndMarketsConfigError,qa as ListUserEarningsForDayError,b as MAX_UINT256,vg as MergePositionsError,vf as OpenPerpsSessionError,Sg as OpenRfqSessionError,af as PausePerpsTwapError,r as PerpsDepositCallError,Ae as PlaceLimitOrderError,we as PlaceMarketOrderError,uc as PlanCollateralReturnError,_f as PositionFilterType,$f as PositionSortBy,ag as PositionStatus,Zd as PostOrderError,_d as PostOrdersError,zd as PrepareConvertError,Hd as PrepareHorizontalMergeError,Dd as PrepareHorizontalSplitError,kd as PriceHistoryInterval,Gh as PriceProvider,Ig as RedeemPositionsError,Vg as RequestComboQuoteError,Rc as ResolutionMarketType,Sc as ResolutionReporter,Tc as ResolutionSettlementTimeBasis,Uc as ResolutionSource,Vc as ResolutionStatus,bf as ResumePerpsTwapError,df as RevokePerpsBuilderFeeError,wf as RevokePerpsCredentialsError,xh as RevokeSessionKeyError,Pg as RfqCancelQuoteError,Og as RfqCancelQuoteRejectedError,dh as RfqConfirmationDecision,Rg as RfqConfirmationError,Qg as RfqConfirmationRejectedError,eh as RfqDirection,fh as RfqExecutionStatus,gh as RfqKnownErrorCode,Ng as RfqQuoteError,Mg as RfqQuoteRejectedError,hh as RfqRejectionCode,Ug as RfqRequestRejectedError,ih as RfqRequestedSizeUnit,jh as RfqSide,kh as RfqStatus,A as RouterConvertCallError,E as RouterHorizontalMergeCallError,C as RouterHorizontalSplitCallError,I as RouterMergeCallError,K as RouterRedeemCallError,G as RouterSplitCallError,mh as SearchError,lh as SearchSort,Ld as SendOrderHeartbeatError,He as ServiceClientRequestError,sh as SessionKeyKnownScope,pb as SetupTradingApprovalsError,T as SignerType,Fa as SortDirection,jg as SplitPositionError,Dh as SubscribeError,Ga as TipSide,Ha as TradeFilterType,hd as TraderLeaderboardSort,Vh as TransferErc20Error,Af as TransferPerpsCollateralError,Xe as UpdatePerpsLeverageError,Ye as UpdatePerpsLeveragesError,Ze as UpdatePerpsMarginError,bg as UserPnlFidelity,cg as UserPnlInterval,Zg as WaitForComboFillError,se as WaitForOrderFillSettlementError,Ia as WaitForTransactionError,zf as WithdrawFromPerpsError,p as authorizeSessionSignerCall,rb as buildHmacSignature,N as combinatorialPrepareConditionCall,w as ctfMergePositionsCall,y as ctfRedeemPositionsCall,u as ctfSplitPositionCall,m as decodeErc1155BalanceOfBatchResult,k as decodeErc1155BalanceOfResult,i as decodeErc1155IsApprovedForAllResult,f as decodeErc20AllowanceResult,O as encodeProxyCall,P as encodeSafeMultisendCall,g as erc1155ApprovalForAllCall,l as erc1155BalanceOfBatchCall,j as erc1155BalanceOfCall,h as erc1155IsApprovedForAllCall,e as erc20AllowanceCall,d as erc20ApprovalCall,o as erc20TransferCall,Ja as expectTransactionHandle,z as negRiskRedeemPositionsCall,ce as parseSiteConfig,s as perpsDepositCall,q as revokeSessionSignerCall,B as routerConvertCall,F as routerHorizontalMergeCall,D as routerHorizontalSplitCall,J as routerMergeCall,L as routerRedeemCall,H as routerSplitCall}from'./chunk-3QTVWIZS.js';import {a,t,o,k as k$1,i,s,l,n,d,c,e,g as g$1}from'./chunk-LDEY5CK7.js';export{q as AutoCancelDailyLimitError,o as CancelledSigningError,g as ConnectionLostError,u as GatewayKnownErrorCode,p as InsufficientLiquidityError,m as OperationAbortedError,j as OrderHeartbeatMismatchError,b as PaginationLimitError,r as PerpsCancelRetryError,k as RateLimitError,v as RealtimeKnownErrorCode,e as RequestAbortedError,i as RequestRejectedError,s as SigningError,l as TimeoutError,h as TradingRestriction,n as TransactionFailedError,d as TransportError,c as UnexpectedResponseError,a as UserInputError,f as WebSocketKnownCloseCode,t as makeErrorGuard}from'./chunk-LDEY5CK7.js';import {DecimalishSchema,ApiKeySchema,EvmAddressSchema,toBaseUnits,OrderSide}from'@kuest/bindings';export{CommentParentEntityType,OrderSide,OrderType}from'@kuest/bindings';export{AssetType,NotificationType,OrderPostStatus,OrderResponseErrorCode,RewardMarketSort,SignatureType}from'@kuest/bindings/clob';export{ActivityType,TokenModule}from'@kuest/bindings/data';import {WalletType}from'@kuest/bindings/gamma';export{ComboKnownStatus,MarketResolutionStatus,ProtocolVersion,TeamOrdering,WalletType}from'@kuest/bindings/gamma';export{PerpsDepositStatus,PerpsInstrumentCategory,PerpsInstrumentType,PerpsInternalTransferDirection,PerpsKlineInterval,PerpsKnownCancelOrderErrorCode,PerpsKnownInternalTransferType,PerpsKnownWithdrawalStatus,PerpsLiquidationMethod,PerpsLiquidityRole,PerpsMarginType,PerpsNotificationOrderType,PerpsNotificationType,PerpsOrderStatus,PerpsPositionSnapshotMarkerKind,PerpsPositionSnapshotStatus,PerpsSide,PerpsSortDirection,PerpsTimeInForce,PerpsTwapStatus}from'@kuest/bindings/perps';import {z}from'zod';import {expectEvmAddress,isSameEvmAddress,expectEvmSignature,invariant,setNonBlockingTimeout}from'@kuest/types';import {TypedData}from'ox';import {PerpsMarketDataEventSchema,RealtimeEventSchema,SportsResultEventSchema,MarketEventSchema,UserEventSchema,RealtimeKnownErrorCode,PolyboltAckOp,PolyboltAckSchema,PolyboltEnvelopeSchema,parsePolyboltEvent,PolyboltChannel}from'@kuest/bindings/subscriptions';import {pushable}from'it-pushable';import {RfqQuoterInboundMessageSchema,RfqConfirmationDecision,RfqRequestedSizeUnit,RfqDirection}from'@kuest/bindings/combos';var Ma=z.object({KUEST_BUILDER_API_KEY:z.string().min(1),KUEST_BUILDER_TIMESTAMP:z.string().min(1),KUEST_BUILDER_PASSPHRASE:z.string().min(1),KUEST_BUILDER_SIGNATURE:z.string().min(1)});function Ia(t){return new Ce(t)}function La(t){return new Ee(t)}var Ce=class{#e;constructor(e){this.#e=e;}get isBuilderKey(){return true}get supportGasless(){return true}async authorize(e$1,r){try{return Q$1(r?.signal),await this.#t(e$1,r)}catch(s$1){throw s$1 instanceof e?s$1:s.fromError(s$1,"Could not authorize the builder-authenticated request")}}async#r(e){let r=this.#e.headers,s=typeof r=="function"?await R$1(Promise.resolve(r()),e):r,i=new Headers(s);return i.set("content-type","application/json"),i}async#t(e,r){let s=await this.#r(r?.signal);Q$1(r?.signal);let i=r?.fetch??globalThis.fetch,n=await R$1(i(this.#e.url,{body:JSON.stringify({body:e.body,method:e.method,path:e.path}),credentials:this.#e.credentials,headers:s,method:"POST",mode:"cors",signal:r?.signal}),r?.signal);if(!n.ok)throw new Error(`Remote signer rejected request with status ${n.status}`);let o=await R$1(n.json(),r?.signal);return Ma.parse(o)}},Ee=class{#e;constructor(e){this.#e=e;}get isBuilderKey(){return false}get supportGasless(){return true}authorize(){return Promise.resolve({RELAYER_API_KEY:this.#e.key,RELAYER_API_KEY_ADDRESS:this.#e.address})}};function Ps(t){let e={chainId:t.chainId,name:"ClobAuthDomain",version:"1"};return {domain:e,message:{address:t.address,message:"This message attests that I control the given wallet",nonce:t.nonce??0,timestamp:`${t.timestamp}`},primaryType:"ClobAuth",types:{EIP712Domain:TypedData.extractEip712DomainTypes(e),ClobAuth:[{name:"address",type:"address"},{name:"timestamp",type:"string"},{name:"nonce",type:"uint256"},{name:"message",type:"string"}]}}}var Ua="0.13.0";function gs(){return `@kuest/sdk@${Ua}:${Da()}`}function Da(){try{let t=globalThis;if(t.Bun!==void 0)return `bun@${U(t.Bun.version)}`;if(t.Deno!==void 0)return `deno@${U(t.Deno.version?.deno)}`;if(t.process?.versions?.node!==void 0||t.process?.release?.name==="node")return `nodejs@${U(t.process?.versions?.node)}`;let e=t.navigator?.userAgent;if(typeof e=="string"){let r=[["edge",/\bEdg(?:e|A|iOS)?(?:\/([\d.]+))?/],["chrome",/\b(?:HeadlessChrome|Chrome|Chromium|CriOS)(?:\/([\d.]+))?/],["firefox",/\b(?:Firefox|FxiOS)(?:\/([\d.]+))?/]];for(let[s,i]of r){let n=i.exec(e);if(n!==null)return `${s}@${U(n[1])}`}if(/\bSafari\//.test(e))return `safari@${U(/\bVersion\/([\d.]+)/.exec(e)?.[1])}`}if(t.window!==void 0)return "browser@unknown";if(t.self!==void 0||typeof t.importScripts=="function")return "worker@unknown";if(t.navigator!==void 0)return "browser@unknown"}catch{}return "unknown@unknown"}function U(t){return typeof t=="string"&&/^[0-9][0-9A-Za-z.+_-]{0,63}$/.test(t)?t:"unknown"}function Wa(t){return {listPositions:Lf.bind(null,t),listComboPositions:Nf.bind(null,t),fetchPortfolioValue:Pf.bind(null,t),fetchTraderLeaderboardStanding:bd.bind(null,t),fetchUserStats:Rf.bind(null,t),fetchUserPnl:Tf.bind(null,t),fetchUserVolume:Vf.bind(null,t),downloadAccountingSnapshot:Xf.bind(null,t),listActivity:Ba.bind(null,t),listComboActivity:Da$1.bind(null,t)}}function P(t,e={}){return e===null||typeof e!="object"||Array.isArray(e)?e:{...e,user:e.user===void 0?t.account.wallet:e.user}}function Ae(t){let e=Wa(t);return t.isPublicClient()?e:{...e,listPositions:(r,s)=>Lf(t,P(t,r),s),listComboPositions:(r,s)=>Nf(t,P(t,r),s),fetchPortfolioValue:(r,s)=>Pf(t,P(t,r),s),fetchTraderLeaderboardStanding:(r,s)=>bd(t,P(t,r),s),fetchUserStats:(r,s)=>Rf(t,P(t,r),s),fetchUserPnl:(r,s)=>Tf(t,P(t,r),s),fetchUserVolume:(r,s)=>Vf(t,P(t,r),s),downloadAccountingSnapshot:(r,s)=>Xf(t,P(t,r),s),listActivity:(r,s)=>Ba(t,P(t,r),s),listComboActivity:(r,s)=>Da$1(t,P(t,r),s),listAccountTrades:da.bind(null,t),fetchNotifications:fa.bind(null,t),dropNotifications:ha.bind(null,t),fetchClosedOnlyMode:Z$1.bind(null,t)}}function we(t){return {listBuilderTrades:Jb.bind(null,t),listBuilderLeaderboard:Xc.bind(null,t),fetchBuilderVolume:Zc.bind(null,t),listTraderLeaderboard:$c.bind(null,t),listBiggestWinners:dd$1.bind(null,t)}}function ke(t){return {fetchTokenReferences:Sh.bind(null,t),fetchEventLiveVolume:Qc$1.bind(null,t),fetchResolutions:Oc.bind(null,t),fetchMidpoint:Lb.bind(null,t),fetchMidpoints:Nb.bind(null,t),fetchPrice:Zb.bind(null,t),fetchPrices:$b.bind(null,t),fetchOrderBook:bc$1.bind(null,t),fetchOrderBooks:dc$1.bind(null,t),fetchSpread:fc.bind(null,t),fetchSpreads:hc$1.bind(null,t),fetchLastTradePrice:jc.bind(null,t),fetchLastTradePrices:lc$1.bind(null,t),listPriceHistory:wd.bind(null,t),estimateMarketPrice:Wd.bind(null,t),fetchOpenInterest:yd.bind(null,t),listMarketHolders:ud.bind(null,t),listTrades:za$1.bind(null,t)}}function Te(t){return {listEvents:Ic.bind(null,t),fetchEvent:Kc$1.bind(null,t),fetchEventTags:Mc.bind(null,t),listMarkets:md.bind(null,t),listComboMarkets:od.bind(null,t),fetchMarket:qd.bind(null,t),fetchMarketTags:sd.bind(null,t),listSeries:ph.bind(null,t),fetchSeries:rh.bind(null,t),listMarketClarifications:jd.bind(null,t),listTags:Ih.bind(null,t),fetchTag:Kh.bind(null,t),fetchRelatedTags:Mh.bind(null,t),fetchRelatedTagResources:Oh.bind(null,t),search:nh.bind(null,t),listSports:Ah.bind(null,t),fetchSportsMarketTypes:Ch.bind(null,t),listTeams:Qh.bind(null,t),fetchPublicProfile:Lg.bind(null,t),listComments:Cc$1.bind(null,t),fetchCommentsById:Ec$1.bind(null,t),listCommentsByUserAddress:Gc.bind(null,t)}}function Oe(t){let e={fetchPerpsPositionSnapshots:Ge.bind(null,t),fetchPerpsRegistration:Jf.bind(null,t),fetchPerpsBuilderStatus:De.bind(null,t),fetchPerpsBook:mf.bind(null,t),fetchPerpsFees:uf.bind(null,t),fetchPerpsInstruments:gf.bind(null,t),fetchPerpsTicker:_if.bind(null,t),fetchPerpsTickers:kf.bind(null,t),listPerpsCandles:of.bind(null,t),listPerpsFundingHistory:qf.bind(null,t),listPerpsTrades:sf.bind(null,t)};return t.isSecureClient()?{...e,depositToPerps:r=>Ef(t,r),openPerpsSession:r=>Bf(t,r),revokePerpsCredentials:r=>Cf(t,r),transferPerpsCollateral:Gf.bind(null,t),withdrawFromPerps:r=>Ff(t,r)}:e}function Ka(t){return {fetchCurrentRebates:tc.bind(null,t),listRewardMarkets:rc.bind(null,t),listCurrentRewards:nc.bind(null,t),listMarketRewards:pc$1.bind(null,t)}}function xe(t){let e=Ka(t);return t.isPublicClient()?e:{...e,fetchOrderScoring:na.bind(null,t),fetchOrdersScoring:pa.bind(null,t),listUserEarningsForDay:ra.bind(null,t),fetchTotalEarningsForUserForDay:ta.bind(null,t),listUserEarningsAndMarketsConfig:va.bind(null,t),fetchRewardPercentages:xa.bind(null,t)}}function qs(t){return {openRfqSession(){return Tg(t)},requestComboQuote(e){return Wg(t,e)},acceptComboQuote(e){return Yg(t,e)},waitForComboFill(e){return _g(t,e)}}}function vs(t){return {authorizeSessionKey:wh.bind(null,t),fetchSessionKeys:uh.bind(null,t),revokeSessionKey:yh.bind(null,t)}}function Fe(t){return t.isSecureClient()?{subscribe(e){return Eh(t,e)}}:{subscribe(e){return Eh(t,e)}}}function Cs(t){return {sendOrderHeartbeat:Md.bind(null,t),createMarketOrder:ve.bind(null,t),placeMarketOrder:xe$1.bind(null,t),createLimitOrder:ze.bind(null,t),placeLimitOrder:Be$1.bind(null,t),postOrder:$d(t),postOrders:ae(t),waitForOrderFillSettlement:te$1.bind(null,t),cancelOrder:Od.bind(null,t),cancelOrders:Qd.bind(null,t),cancelAll:Sd.bind(null,t),cancelMarketOrders:Ud.bind(null,t),listOpenOrders:$.bind(null,t),fetchOrder:ba.bind(null,t)}}function Qa(t){return {fetchTradingApprovalsState:nb.bind(null,t)}}function Me(t){let e=Qa(t);return t.isPublicClient()?e:{...e,fetchTradingApprovalsState:r=>nb(t,{user:t.account.wallet},r),setupTradingApprovals:qb.bind(null,t),approveErc20:gb.bind(null,t),approveErc1155ForAll:kb.bind(null,t),transferErc20:Wh.bind(null,t),convert:Cd.bind(null,t),prepareConvert:Ad.bind(null,t),horizontalSplit:Gd.bind(null,t),prepareHorizontalSplit:Ed.bind(null,t),horizontalMerge:Kd.bind(null,t),prepareHorizontalMerge:Id.bind(null,t),splitPosition:og.bind(null,t),mergePositions:Ag.bind(null,t),redeemPositions:Jg.bind(null,t),planCollateralReturn:vc$1.bind(null,t),executeCollateralReturnPlan:zc.bind(null,t)}}function Es(t){return t.isSecureClient()?{...Ae(t),...we(t),...ke(t),...Te(t),...Oe(t),...xe(t),...qs(t),...vs(t),...Fe(t),...Cs(t),...Me(t)}:{...Ae(t),...we(t),...ke(t),...Te(t),...Oe(t),...xe(t),...Fe(t),...Me(t)}}var Ie={name:"production",chainId:137,rpc:"https://unconfigured.invalid",walletDerivation:{depositWalletFactory:expectEvmAddress("0x2CcdC6C5dDcd895aFcCD259F291de9b618A5cA6c"),depositWalletBeacon:expectEvmAddress("0x74a618eBdd62Ff8579A8FE94f5B888d7623b9C35"),depositWalletImplementation:expectEvmAddress("0x65507Fa36589B3b2ceD54E77999909e843691e44"),proxyFactory:expectEvmAddress("0xaB45c5A4B0c941a2F231C04C3f49182e1A254052"),proxyImplementation:expectEvmAddress("0x44e999d5c2F66Ef0861317f9A4805AC2e90aEB4f"),safeFactory:expectEvmAddress("0xaacFeEa03eb1561C4e67d661e40682Bd20E3541b"),safeInitCodeHash:"0x2bce2127ff07fb632d16c8347c4ebf501f4841168bed00d9e6ef715ddb6fcecf"},contracts:{collateralToken:expectEvmAddress("0x3c499c542cef5e3811e1192ce70d8cc03d5c3359"),conditionalTokens:expectEvmAddress("0x4682048725865bf17067bd85fF518527A262A9C7"),negRiskAdapter:expectEvmAddress("0xd9416E904e1ab925ad72F03F6D6ce0Aa80fd2dC5"),collateralAdapter:expectEvmAddress("0xAdA100Db00Ca00073811820692005400218FcE1f"),negRiskCollateralAdapter:expectEvmAddress("0xadA2005600Dec949baf300f4C6120000bDB6eAab"),standardExchange:expectEvmAddress("0xaa1b8dE834E16eC69C044F5300041673C968c9eF"),negRiskExchange:expectEvmAddress("0xe7FA09cA716FDf498d74AFF618d32AFeacc310aB"),exchangeV3:expectEvmAddress("0xe3333700cA9d93003F00f0F71f8515005F6c00Aa"),protocolV2Router:expectEvmAddress("0x12121212006e4CD160D18e3f00711DA5c3372600"),binaryModule:expectEvmAddress("0x1000008dD9001B968442c1000017eaE6E0dA00Ba"),negRiskModule:expectEvmAddress("0x200000900045e3B6259600682756002200028933"),combinatorialModule:expectEvmAddress("0x30000034706c7d8e12009dab006be20000c031a8"),positionManager:expectEvmAddress("0x006F54F7f9A22e0000CC2AB60031000000ae9fEF"),autoRedeemOperator:expectEvmAddress("0xa1200000d0002264C9a1698e001292D00E1b00af"),safeMultisend:expectEvmAddress("0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761"),relayHub:expectEvmAddress("0xE2a6dC9a931538adB7efFA2E1D9eC60a65735117"),perpsDepositContract:expectEvmAddress("0xDCa4af75705dbB50f62437045afF9921947917d2")},predictions:{rest:"https://unconfigured.invalid"},clob:{rest:"https://unconfigured.invalid",market:{ws:"wss://unconfigured.invalid/ws/market"},user:{ws:"wss://unconfigured.invalid/ws/user"}},relayer:{rest:"https://unconfigured.invalid"},gamma:{rest:"https://unconfigured.invalid"},data:{rest:"https://unconfigured.invalid"},combos:{rest:"https://unconfigured.invalid",ws:"wss://unconfigured.invalid/ws/rfq",builderGateway:{rest:"https://unconfigured.invalid"},collateralReturn:{rest:"https://unconfigured.invalid"}},perps:{rest:"https://unconfigured.invalid",ws:"wss://unconfigured.invalid/v1/ws"},realtime:{ws:"wss://unconfigured.invalid/ws"},rtds:{ws:"wss://unconfigured.invalid"},sports:{ws:"wss://unconfigured.invalid/ws"},relayerMaxPolls:100,relayerPollFrequencyMs:2e3};function Ha(t,e=Ie){return {...e,...t,walletDerivation:{...e.walletDerivation,...t.walletDerivation},contracts:{...e.contracts,...t.contracts},clob:{...A(e.clob,t.clob),market:D(e.clob.market,t.clob?.market),user:D(e.clob.user,t.clob?.user)},predictions:A(e.predictions,t.predictions),relayer:A(e.relayer,t.relayer),gamma:A(e.gamma,t.gamma),data:A(e.data,t.data),combos:{...As(e.combos,t.combos),builderGateway:A(e.combos.builderGateway,t.combos?.builderGateway),collateralReturn:A(e.combos.collateralReturn,t.combos?.collateralReturn)},perps:As(e.perps,t.perps),realtime:D(e.realtime,t.realtime),rtds:D(e.rtds,t.rtds),sports:D(e.sports,t.sports)}}function A(t,e){return {...t,...e,headers:Le(t.headers,e?.headers)}}function D(t,e){return {...t,...e,headers:Le(t.headers,e?.headers)}}function As(t,e){return {...t,...e,headers:Le(t.headers,e?.headers)}}function Le(t,e){if(!(t===void 0&&e===void 0))return {...t,...e}}var dd=Ha({name:"preproduction",predictions:{rest:"https://unconfigured.invalid"},clob:{rest:"https://unconfigured.invalid"},data:{rest:"https://unconfigured.invalid"},gamma:{rest:"https://unconfigured.invalid"},relayer:{rest:"https://unconfigured.invalid"}});function g(t,e){let r;return {close:()=>(r===void 0&&(r=Promise.resolve(t.return()).then(()=>e())),r),[Symbol.asyncIterator](){return t[Symbol.asyncIterator]()}}}var R=class{#e=new Set;#r;constructor(e){this.#r=e?.deriveServerState??(()=>{});}add(e,r={}){let s={queue:pushable({objectMode:true})};r.matches!==void 0&&(s.matches=r.matches);let i={subscription:e,subscriber:s};return {change:this.#t(i),entry:i}}#t(e){let r=this.serverState();return this.#e.add(e),{before:r,after:this.serverState()}}remove(e){let r=this.serverState();return this.#e.delete(e),e.subscriber.queue.end(),{before:r,after:this.serverState()}}dispatch(e){for(let{subscriber:r}of this.#e)(r.matches===void 0||r.matches(e))&&r.queue.push(e);}hasActiveSubscriptions(){return this.#e.size>0}endAll(e){for(let{subscriber:r}of this.#e)r.queue.end(e);this.#e.clear();}serverState(){return this.#r(this.#e)}};function Be(t,e,r){let s=N(r.assetsIds,e.assetsIds),i=N(e.assetsIds,r.assetsIds);s.length>0&&t(ws(s,r.customFeatureEnabled));let n=r.assetsIds[0];s.length===0&&e.customFeatureEnabled!==r.customFeatureEnabled&&n!==void 0&&t(ws([n],r.customFeatureEnabled)),i.length>0&&t(za(i));}function Ue(t,e,r){if(r.includeAllMarkets){!e.includeAllMarkets&&e.markets.length>0&&t(Ts(e.markets));return}if(e.includeAllMarkets){r.markets.length>0&&t(ks(r.markets));return}let s=N(r.markets,e.markets),i=N(e.markets,r.markets);s.length>0&&t(ks(s)),i.length>0&&t(Ts(i));}function Os(t){let e=new Set,r=false;for(let{subscription:s}of t){for(let i of s.assetIds??s.tokenIds)e.add(i);r||=s.customFeatureEnabled===true;}return {assetsIds:Array.from(e),customFeatureEnabled:r}}function xs(t){let e=false,r=new Set;for(let{subscription:s}of t){if(Bs(s)){e=true;continue}for(let i of s.markets??[])r.add(i);}return {includeAllMarkets:e,markets:e?[]:Array.from(r)}}function Fs(t){return {assets_ids:t.assetsIds,custom_feature_enabled:t.customFeatureEnabled,type:"market"}}function ws(t,e){return {assets_ids:t,custom_feature_enabled:e,operation:"subscribe"}}function za(t){return {assets_ids:t,operation:"unsubscribe"}}function Ms(t,e){let r={auth:{apiKey:e.key,passphrase:e.passphrase,secret:e.secret},type:"user"};return t.includeAllMarkets||(r.markets=t.markets),r}function ks(t){return {markets:t,operation:"subscribe"}}function Ts(t){return {markets:t,operation:"unsubscribe"}}function Is(t){let e=t.assetIds??t.tokenIds;return r=>{switch(r.type){case "price_change":return r.payload.priceChanges.some(s=>e.includes(s.assetId));case "new_market":return t.customFeatureEnabled===true;case "market_resolved":return t.customFeatureEnabled===true&&(r.payload.assetIds??[]).some(s=>e.includes(s));case "best_bid_ask":return t.customFeatureEnabled===true&&e.includes(r.payload.assetId);default:return e.includes(r.payload.assetId)}}}function Ls(t){if(Bs(t))return ()=>true;let e=new Set((t.markets??[]).map(r=>r.toLowerCase()));return r=>e.has(r.payload.market.toLowerCase())}function Bs(t){return (t.markets?.length??0)===0}function N(t,e){let r=new Set(e);return t.filter(s=>!r.has(s))}var w=class{#e;#r;#t;#o=new Pe({heartbeat:new Je});#a=new Oe$1;#s=new R({deriveServerState:Os});constructor(e){this.#e=e.headers,this.#r=e.url;}async subscribe(e){let{change:r,entry:s}=this.#s.add(e,{matches:Is(e)});return await this.#i(s,r),g(s.subscriber.queue,()=>this.#n(s))}async#i(e,r){let{before:s,after:i}=r;try{(await this.#c()).reusedOpenSocket&&Be(o=>this.#o.send(o),s,i);}catch(n){throw await this.#n(e),n}}async#n(e){let{before:r,after:s}=this.#s.remove(e);if(!this.#s.hasActiveSubscriptions()){await this.close();return}Be(i=>this.#o.send(i),r,s);}async close(){this.#t===void 0&&(this.#t=this.#p().finally(()=>{this.#t=void 0;})),await this.#t;}async#p(){this.#a.stop(),this.#s.endAll(),await this.#o.close();}#c(){return this.#o.connect({onConnectionLost:()=>this.#l(),onError:()=>this.#m(),onMessage:e=>this.#d(e),onOpen:()=>this.#u(),headers:this.#e,url:this.#r})}#u(){this.#a.resetBackoff(),this.#f();}#d(e){let r=Array.isArray(e)?e:[e];for(let s of r){let i=MarketEventSchema.safeParse(s);i.success&&this.#s.dispatch(i.data);}}#l(){this.#s.hasActiveSubscriptions()&&this.#h();}#m(){}#f(){this.#o.send(Fs(this.#s.serverState()));}#h(){this.#a.schedule({reconnect:()=>this.#c(),shouldReconnect:()=>this.#s.hasActiveSubscriptions()});}};var O=class{#e;#r;#t;#o;#a=new Pe({heartbeat:new Je});#s=new Oe$1;#i=new R({deriveServerState:xs});constructor(e){this.#e=e.credentials,this.#r=e.headers,this.#t=e.url;}async subscribe(e){let{change:r,entry:s}=this.#i.add(e,{matches:Ls(e)});return await this.#n(s,r),g(s.subscriber.queue,()=>this.#p(s))}async#n(e,r){let{before:s,after:i}=r;try{(await this.#u()).reusedOpenSocket&&Ue(o=>this.#a.send(o),s,i);}catch(n){throw await this.#p(e),n}}async#p(e){let{before:r,after:s}=this.#i.remove(e);if(!this.#i.hasActiveSubscriptions()){await this.close();return}Ue(i=>this.#a.send(i),r,s);}async close(){this.#o===void 0&&(this.#o=this.#c().finally(()=>{this.#o=void 0;})),await this.#o;}async#c(){this.#s.stop(),this.#i.endAll(),await this.#a.close();}#u(){return this.#a.connect({onConnectionLost:()=>this.#m(),onError:()=>this.#f(),onMessage:e=>this.#l(e),onOpen:e=>this.#d(e),prepare:()=>this.#e,headers:this.#r,url:this.#t})}#d(e){this.#s.resetBackoff(),this.#h(e);}#l(e){let r=Array.isArray(e)?e:[e];for(let s of r){let i=UserEventSchema.safeParse(s);i.success&&this.#i.dispatch(i.data);}}#m(){this.#i.hasActiveSubscriptions()&&this.#y();}#f(){}#h(e){this.#a.send(Ms(this.#i.serverState(),e));}#y(){this.#s.schedule({reconnect:()=>this.#u(),shouldReconnect:()=>this.#i.hasActiveSubscriptions()});}};var x=class{#e;#r;#t;#o;#a;#s=new Set;#i=new Set;#n=new Set;#p=false;constructor(e){this.#e=e.chainId,this.#r=e.fetch,this.#t=e.headers,this.#o=e.restUrl,this.#a=e.wsUrl;}connect(e,r,s,i){if(this.#p)return Promise.reject(new d("Perps session manager has been shut down."));let n=new ef({builderAttribution:r,approveBuilderFee:s,includeBuilderFills:i,chainId:this.#e,credentials:e,fetch:this.#r,headers:this.#t,onClose:a=>this.#c(a),restUrl:this.#o,wsUrl:this.#a});this.#i.add(n);let o;return o=(async()=>{try{if(await n.connect(),this.#p)throw await n.close(),new d("Perps session manager has been shut down.");return this.#s.add(n),n}catch(a){throw await n.close(),a}finally{this.#n.delete(o),this.#i.delete(n);}})(),this.#n.add(o),o}async shutdown(){this.#p=true;let e=Array.from(this.#s),r=Array.from(this.#i),s=Array.from(this.#n);this.#s.clear(),this.#i.clear(),this.#n.clear(),await Promise.allSettled([...e.map(i=>i.close()),...r.map(i=>i.close()),...s.map(i=>i.catch(()=>{}))]).then(()=>{});}#c(e){this.#s.delete(e),this.#i.delete(e);}};var k=class{#e;#r;#t;#o=1;#a=new Pe({heartbeat:new Me$1});#s=new Oe$1;#i=new R({deriveServerState:$a});constructor(e){this.#e=e.headers,this.#r=e.url;}async subscribe(e){let{change:r,entry:s}=this.#i.add(e,{matches:Ja(e)});return await this.#n(s,r),g(s.subscriber.queue,()=>this.#p(s))}async#n(e,r){try{(await this.#u()).reusedOpenSocket&&(this.#h(Us(r.before,r.after)),this.#y(Ds(r.before,r.after)));}catch(s){throw await this.#p(e),s}}async#p(e){let{before:r,after:s}=this.#i.remove(e);this.#h(Us(r,s)),this.#y(Ds(r,s)),this.#i.hasActiveSubscriptions()||await this.close();}async close(){this.#t===void 0&&(this.#t=this.#c().finally(()=>{this.#t=void 0;})),await this.#t;}async#c(){this.#s.stop(),this.#i.endAll(),await this.#a.close();}#u(){return this.#a.connect({onConnectionLost:()=>this.#m(),onError:()=>this.#f(),onMessage:e=>this.#l(e),onOpen:()=>this.#d(),headers:this.#e,url:this.#r})}#d(){this.#s.resetBackoff(),this.#h(Array.from(this.#i.serverState()));}#l(e){let r=PerpsMarketDataEventSchema.safeParse(e);r.success&&this.#i.dispatch(r.data);}#m(){this.#i.hasActiveSubscriptions()&&this.#b();}#f(){}#h(e){e.length!==0&&this.#a.send(this.#S("sub",e));}#y(e){e.length!==0&&this.#a.send(this.#S("unsub",e));}#S(e,r){return {id:this.#o++,req:e,chs:r}}#b(){this.#s.schedule({reconnect:()=>this.#u(),shouldReconnect:()=>this.#i.hasActiveSubscriptions()});}};function $a(t){let e=new Set,r=new Set,s=new Set,i=false,n=false;for(let{subscription:o}of t)switch(o.topic){case "perps.tickers":o.instrumentId===void 0?i=true:r.add(o.instrumentId);break;case "perps.statistics":o.instrumentId===void 0?n=true:s.add(o.instrumentId);break;default:e.add(Ga(o));}if(i)e.add("tickers::all");else for(let o of r)e.add(`tickers::${o}`);if(n)e.add("statistics::all");else for(let o of s)e.add(`statistics::${o}`);return e}function Us(t,e){return Array.from(e).filter(r=>!t.has(r))}function Ds(t,e){return Array.from(t).filter(r=>!e.has(r))}function Ga(t){switch(t.topic){case "perps.trades":return `trades::${t.instrumentId}`;case "perps.bbo":return `bbo::${t.instrumentId}`;case "perps.book":return `book::${t.instrumentId}`;case "perps.candles":return `klines::${t.instrumentId}::${t.interval}`;case "perps.tickers":return t.instrumentId===void 0?"tickers::all":`tickers::${t.instrumentId}`;case "perps.statistics":return t.instrumentId===void 0?"statistics::all":`statistics::${t.instrumentId}`;default:invariant(false,`Unknown Perps topic: ${String(t)}`);}}function Ja(t){switch(t.topic){case "perps.trades":return e=>e.topic==="perps.trades"&&e.channel===`trades::${t.instrumentId}`;case "perps.bbo":case "perps.book":return e=>e.topic===t.topic&&e.payload.instrumentId===t.instrumentId;case "perps.candles":return e=>e.topic==="perps.candles"&&e.payload.instrumentId===t.instrumentId&&e.payload.interval===t.interval;case "perps.tickers":case "perps.statistics":return e=>e.topic===t.topic&&(t.instrumentId===void 0||e.payload.instrumentId===t.instrumentId);default:invariant(false,`Unknown Perps topic: ${String(t)}`);}}function Ks(t){let e="symbol"in t?[t.symbol.toLowerCase()]:t.symbols,{provider:r}=t;return e.map(s=>t.topic==="prices.crypto.twap"||t.topic==="prices.equity.twap"?{key:JSON.stringify([t.topic,s,60,r]),topic:t.topic,symbol:s,windowSeconds:60,provider:r}:{key:JSON.stringify([t.topic,s,r]),topic:t.topic,symbol:s,provider:r})}function Qs(t,e){return Math.random()*(t===4003?1e4:Math.min(1e3*2**e,3e4))}var G=class{#e;#r=new Oe$1;#t=new Map;#o=[];#a;#s;#i=false;#n=false;#p=false;#c=false;#u;#d=0;#l=64;#m=Number.NEGATIVE_INFINITY;constructor(e){this.#e=e;}get size(){return this.#t.size}has(e){return this.#t.has(e)}get closed(){return this.#n}get keyTarget(){return Date.now()-this.#m>=6e4?64:this.#l}add(e,r){clearTimeout(this.#s);let s=this.#t.get(e.key);if(s===void 0){let{promise:i,resolve:n,reject:o}=Promise.withResolvers();i.catch(()=>{}),s={subscription:e,listeners:new Set,ready:i,resolve:n,reject:o,subscribed:false,accepted:false},this.#t.set(e.key,s),this.#i&&this.#y("subscribe",[s]);}return s.listeners.add(r),s.confirmation!==void 0&&r.subscribed?.({...s.confirmation}),s.snapshot!==void 0&&r.event(s.snapshot),!this.#i&&!this.#c&&this.#u===void 0&&!this.#r.isScheduled&&this.#f(),Za(s.ready)}remove(e,r){let s=this.#t.get(e);s!==void 0&&(s.listeners.delete(r),!(s.listeners.size>0)&&(this.#t.delete(e),s.reject(new d("Realtime subscription closed.")),this.#i&&this.#y("unsubscribe",[s]),this.#t.size===0&&(this.#s=setNonBlockingTimeout(()=>{this.close();},1e3))));}#f(){if(this.#n||this.#c)return Promise.resolve();if(this.#u!==void 0)return this.#u;let e=this.#h().catch(r=>{this.#C([...this.#t.values()].filter(s=>!s.accepted),d.fromError(r));}).finally(()=>{this.#u===e&&(this.#u=void 0),this.#i||this.#v(1006);});return this.#u=e,e}async#h(){let e=this.#d;if(await this.#e.open({subscribed:(r,s)=>this.#P(r,s),event:r=>this.#g(r),dropped:()=>this.#q(),disconnected:r=>this.#w(r)}),!(this.#n||e!==this.#d))try{if(await this.#e.authorize(),this.#n||e!==this.#d)return;this.#i=!0,this.#y("subscribe",[...this.#t.values()]);}catch(r){if(this.#n||e!==this.#d)return;r instanceof i&&r.code!==RealtimeKnownErrorCode.AuthUnavailable?this.#A(r):await this.#E(1006);}}#y(e,r){if(r.length===0)return;let s=this.#o.at(-1);s?.op===e?s.keys.push(...r):this.#o.push({op:e,keys:r}),this.#S();}#S(){this.#a!==void 0||this.#p||!this.#i||this.#n||(this.#a=setNonBlockingTimeout(()=>{this.#a=void 0,this.#b();},10));}async#b(){if(!this.#i||this.#n)return;let e=this.#o.shift();if(e===void 0)return;let r=[...new Set(e.keys)].filter(i=>e.op==="unsubscribe"||this.#t.get(i.subscription.key)===i);if(r.length===0){this.#S();return}let s=this.#d;this.#p=true;try{let i=await this.#e.change(e.op,r.map(({subscription:n})=>n));if(s!==this.#d||this.#n)return;if(e.op==="unsubscribe"&&i.length>0){let n=i[0];if(n!==void 0)throw n.error}if(e.op==="subscribe"){this.#r.resetBackoff();let n=new Set(i.map(o=>o.key));for(let o of r)n.has(o.subscription.key)||(o.subscribed=!0,o.accepted=!0,o.resolve());for(let{key:o,error:a}of i){let u=r.find(d=>d.subscription.key===o);u!==void 0&&this.#C([u],a,!1);}}}catch(i$1){if(s!==this.#d||this.#n)return;i$1 instanceof i&&e.op==="subscribe"?this.#C(r,i$1):await this.#E(1006);}finally{this.#p=false,this.#S();}}#P(e,r){let s=this.#t.get(e.key);if(s?.subscription===e){s.confirmation={...r};for(let i of [...s.listeners])i.subscribed?.({...r});}}#g(e){for(let r of this.#t.values()){let s=r.subscription;if(s.topic!==e.topic)continue;let i=e.payload;if(i.symbol.toLowerCase()===s.symbol&&!((s.topic==="prices.crypto.twap"||s.topic==="prices.equity.twap")&&(!("windowSeconds"in i)||i.windowSeconds!==s.windowSeconds))){r.snapshot=Xa(r.snapshot,e);for(let n of r.listeners)n.event(e);}}}#q(){let e=Date.now();e-this.#m<5e3||(this.#l=Math.max(1,Math.floor(this.keyTarget/2)),this.#m=e);}#R(){this.#d++,this.#i=false,this.#o=[],clearTimeout(this.#a),this.#a=void 0;for(let e of this.#t.values()){if(e.snapshot=void 0,e.confirmation=void 0,!e.subscribed)continue;let{promise:r,resolve:s,reject:i}=Promise.withResolvers();r.catch(()=>{}),e.ready=r,e.resolve=s,e.reject=i,e.subscribed=false;}}#w(e){let r=new g$1("Realtime connection closed.",e);this.#R(),e.code===4001||e.code===4008?this.#A(r):this.#v(e.code);}async#E(e){this.#c=true,this.#R();try{await this.#e.close();}finally{this.#c=false,this.#v(e);}}#v(e){this.#r.schedule({delayPolicy:r=>Qs(e,r),shouldReconnect:()=>!this.#n&&this.#t.size>0,reconnect:()=>this.#f()});}#A(e){let r=[...this.#t.values()],s=new Set(r.flatMap(i=>[...i.listeners]));for(let i of r)i.reject(e);for(let i of s)i.end(e);this.close();}#C(e,r,s=true){let i=e.filter(o=>this.#t.get(o.subscription.key)===o),n=new Set(i.flatMap(o=>[...o.listeners]));for(let o of i)this.#t.delete(o.subscription.key),o.reject(r);s&&this.#i&&this.#y("unsubscribe",i);for(let o of n)o.end(r);this.#t.size===0&&(this.#s=setNonBlockingTimeout(()=>{this.close();},1e3));}async close(){if(this.#n)return;this.#n=true,this.#r.stop(),clearTimeout(this.#s);let e=new d("Realtime connection closed.");this.#R();for(let r of this.#t.values())r.reject(e);this.#t.clear(),await this.#e.close();}};function Za(t){return new Promise((e,r)=>{let s=setNonBlockingTimeout(()=>{r(new d("Realtime subscription was not accepted within 30 seconds."));},3e4);t.then(()=>{clearTimeout(s),e();},i=>{clearTimeout(s),r(i);});})}function Xa(t,e){if(e.type==="subscribe")return e;let{symbol:r,source:s,timestamp:i,value:n}=e.payload,o=t?.type==="subscribe"&&t.payload.source===s?t.payload.data:[];if((o.at(-1)?.timestamp??0)>i)return t;let a=[...o.filter(u=>u.timestamp>i-12e4&&u.timestamp<i),{timestamp:i,value:n}];return e.topic==="prices.crypto.twap"||e.topic==="prices.equity.twap"?{...e,type:"subscribe",payload:{symbol:r,source:s,data:a,windowSeconds:e.payload.windowSeconds}}:{...e,type:"subscribe",payload:{symbol:r,source:s,data:a}}}var Y=class{#e;#r=new Pe({heartbeat:new Ne,connectTimeoutMs:1e4,closeTimeoutMs:1e3});#t=new Map;#o;#a=0;#s=0;#i=0;constructor(e){this.#e=e;}async open(e){this.#o=e;let r=this.#i;await this.#r.connect({url:this.#e.url,headers:this.#e.headers,onOpen:()=>{},onError:()=>{},onConnectionLost:s=>{r===this.#i&&(this.#c(new g$1("Realtime connection closed.",s)),e.disconnected(s));},onMessage:s=>{r===this.#i&&this.#p(s);}});}async authorize(){let{key:e,secret:r,passphrase:s}=this.#e.credentials;await this.#n({op:"auth",auth:{apiKey:e,secret:r,passphrase:s}},PolyboltAckOp.Authed,[]);}async change(e,r){let s=[],i=0;for(;i<r.length;){let n=[];for(;i+n.length<r.length;){let a=r[i+n.length];if(a===void 0)break;let u=sc(a),d={op:e,subscriptions:[...n,u],rid:String(this.#a+1)};if(n.length>0&&new TextEncoder().encode(JSON.stringify(d)).length>6e4)break;n.push(u);}let o=await this.#n({op:e,subscriptions:n},e==="subscribe"?PolyboltAckOp.Subscribed:PolyboltAckOp.Unsubscribed,n.map(({channel:a})=>a),r.slice(i,i+n.length));for(let{index:a,error:u}of o){let d=r[i+a];d!==void 0&&s.push({key:d.key,error:u});}i+=n.length;}return s}#n(e,r,s,i=[]){let n=String(++this.#a);return new Promise((o,a)=>{let u={op:r,channels:[...s],subscriptions:i,rejections:[],resolve:o,reject:a};this.#t.set(n,u),u.sendTimer=setNonBlockingTimeout(()=>{u.timer=setNonBlockingTimeout(()=>{this.#t.delete(n),a(new d("Realtime acknowledgement timed out after 10 seconds."));},1e4),this.#s=Date.now();try{if(!this.#r.send({...e,rid:n}))throw new d("Realtime connection is not open.")}catch(d$1){clearTimeout(u.timer),this.#t.delete(n),a(d.fromError(d$1));}},Math.max(0,110-(Date.now()-this.#s)));})}#p(e){let r=PolyboltAckSchema.safeParse(e);if(r.success){let{op:n,rid:o,code:a,channel:u,provider:d}=r.data,c=o===void 0?void 0:this.#t.get(o);if(c===void 0)return;if(n===PolyboltAckOp.Error&&a!==void 0){let S=new i(`Realtime subscription rejected: ${a}`,{status:200,code:a}),f=c.channels.flatMap((m,C)=>m===u?[C]:[]);if(u===void 0||f.length!==1)c.reject(S);else {let m=f[0];if(m===void 0||(c.channels[m]=void 0,c.rejections.push({index:m,error:S}),c.channels.some(C=>C!==void 0)))return;c.resolve(c.rejections);}}else if(n===c.op){if(c.channels.length>0){let S=c.channels.findIndex(m=>m!==void 0);if(S<0||c.channels[S]!==u)return;c.channels[S]=void 0;let f=c.subscriptions[S];if(n===PolyboltAckOp.Subscribed&&f!==void 0&&this.#o?.subscribed(f,{symbol:f.symbol,provider:d}),c.channels.some(m=>m!==void 0))return}c.resolve(c.rejections);}else return;clearTimeout(c.timer),o!==void 0&&this.#t.delete(o);return}let s=PolyboltEnvelopeSchema.safeParse(e);if(!s.success)return;let i$1=parsePolyboltEvent(s.data);i$1!==void 0&&this.#o?.event(i$1),(s.data.dropped??0)>0&&this.#o?.dropped();}#c(e){for(let r of this.#t.values())clearTimeout(r.sendTimer),clearTimeout(r.timer),r.reject(e);this.#t.clear();}async close(){this.#i++,this.#o=void 0,this.#c(new d("Realtime connection closed.")),await this.#r.close();}};function sc(t){switch(t.topic){case "prices.crypto":return {channel:PolyboltChannel.Crypto,filter:{symbol:t.symbol,provider:t.provider}};case "prices.crypto.twap":return {channel:PolyboltChannel.Twap,filter:{symbol:t.symbol,window_seconds:t.windowSeconds,provider:t.provider}};case "prices.equity":return {channel:PolyboltChannel.Equity,filter:{symbol:t.symbol,provider:t.provider}};case "prices.equity.twap":return {channel:PolyboltChannel.EquityTwap,filter:{symbol:t.symbol,window_seconds:t.windowSeconds,provider:t.provider}}}}var Z=class{#e;#r=new Map;#t=new Set;constructor(e){this.#e=e;}async subscribe(e){let r=[...new Map(Ks(e).map(d=>[d.key,d])).values()],s=pushable({objectMode:true}),i=[],n=false,o,a=async()=>{if(!n){n=true;for(let d of i)d();o===void 0?await s.return():s.end(o),this.#t.delete(a);}};this.#t.add(a);let u=d$1=>{n||(o=d.fromError(d$1),s.end(o),a());};try{let d=r.map(c=>{if(n)return Promise.resolve();let S=this.#o(c.key,c.provider),f={subscribed(m){if(!(n||!("onSubscribed"in e)))try{Promise.resolve(e.onSubscribed?.(m)).catch(u);}catch(C){u(C);}},event(m){if(n||"types"in e&&e.types!==void 0&&e.types.length>0&&!e.types.includes(m.type))return;let C="symbol"in m.payload?{...m.payload,symbol:"symbol"in c?c.symbol:m.payload.symbol}:m.payload;s.push({...m,payload:C});},end(m){o=m,s.end(m),a();}};return i.push(()=>S.remove(c.key,f)),S.add(c,f)});for(let c of d)c.catch(()=>{});if(await Promise.all(d),o!==void 0)throw o}catch(d){throw await a(),o??d}return {close:a,async*[Symbol.asyncIterator](){try{yield*s;}finally{await a();}}}}#o(e,r){for(let i of this.#r.keys())if(i.closed)this.#r.delete(i);else if(i.has(e))return i;for(let[i,n]of this.#r)if(n===r&&i.size<i.keyTarget)return i;let s=new G(new Y(this.#e));return this.#r.set(s,r),s}async close(){await Promise.all([...this.#t].map(r=>r()));let e=[...this.#r.keys()];this.#r.clear(),await Promise.all(e.map(r=>r.close()));}};var K=class{#e;constructor(e){this.#e=new Z(e);}async subscribe(e){return this.#e.subscribe(e)}async close(){await this.#e.close();}};function zs(t,e){return {...e,quote:r=>t.quote(e,r)}}function js(t,e){let r=e.rfqId,s=e.quoteId;return {...e,confirm:()=>t.respondToConfirmation(r,s,RfqConfirmationDecision.Confirm),decline:()=>t.respondToConfirmation(r,s,RfqConfirmationDecision.Decline)}}function Vs(t){return {quoteId:t.quoteId,rfqId:t.rfqId}}function Ns(t){return {quoteId:t.quoteId,rfqId:t.rfqId}}function $s(t){return {quoteId:t.quoteId,rfqId:t.rfqId}}function Gs(t,e){let r=V(t);return {auth:{apiKey:e.key,passphrase:e.passphrase,secret:e.secret},identity:{maker_address:r.maker,signature_type:r.signatureType,signer_address:r.signer},type:"auth"}}function Js(t,e){return {price_e6:e.price.toString(),rfq_id:t.rfqId,signed_order:e.signedOrder,size_e6:e.size.toString(),type:"RFQ_QUOTE"}}function Ys(t,e,r){let s=V(t);return {maker_address:s.maker,quote_id:r,rfq_id:e,signer_address:s.signer,type:"RFQ_QUOTE_CANCEL"}}function Zs(t,e,r){return {decision:r,quote_id:e,rfq_id:t,type:"RFQ_CONFIRMATION_RESPONSE"}}var X=class{#e=new Map;#r;constructor(e){this.#r=e;}waitFor(e,r){let s=oc(),i,n=setNonBlockingTimeout(()=>{this.remove(e,i),s.reject(new l(r));},this.#r);i=s.promise.finally(()=>clearTimeout(n));let o=this.#e.get(e)??[];return o.push({...s,promise:i}),this.#e.set(e,o),i}resolve(e,r){let s=this.#e.get(e),i=s?.shift();i!==void 0&&(s!==void 0&&s.length===0&&this.#e.delete(e),i.resolve(r));}reject(e,r){let s=this.#e.get(e),i=s?.shift();i!==void 0&&(s!==void 0&&s.length===0&&this.#e.delete(e),i.reject(r));}remove(e,r){let s=this.#e.get(e);if(s===void 0)return;let i=s.filter(n=>n.promise!==r);i.length===0?this.#e.delete(e):this.#e.set(e,i);}rejectAll(e){for(let r of this.#e.values())for(let s of r)s.reject(e);this.#e.clear();}};function oc(){let t,e;return {promise:new Promise((s,i)=>{t=s,e=i;}),reject:e,resolve:t}}var ei="0x0000000000000000000000000000000000000000000000000000000000000000";async function ti(t){let e=V(t.account),r=fe({chainId:t.chainId,exchange:t.exchange}),s$1={builder:ei,maker:e.maker,makerAmount:toBaseUnits(ge(t.orderSide,t.orderPrice,t.size)),metadata:ei,salt:ac().toString(),side:ie(t.orderSide),signatureType:e.signatureType,signer:e.signer,takerAmount:toBaseUnits(he(t.orderSide,t.orderPrice,t.size)),timestamp:Math.floor(Date.now()/1e3).toString(),tokenId:t.tokenId},i;try{i=await t.signer.signTypedData(de({domain:r,order:s$1}));}catch(n){throw s.fromError(n,"Could not sign the RFQ quote order.")}return {...s$1,signature:ee$1({domain:r,order:s$1,signature:i})}}function ac(){let t=new Uint8Array(8);return globalThis.crypto.getRandomValues(t),BigInt(`0x${Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}`)}var ii=DecimalishSchema.transform(t=>ai(t)).refine(t=>t<=BigInt(Number.MAX_SAFE_INTEGER),{message:"Value exceeds the temporary numeric wire limit."}),pc=z.strictObject({price:ii.refine(t=>t<1000000n,{message:"Price must be less than 1."}),size:ii.optional(),source:z.enum(["collateral","inventory"]).default("collateral")});function ni(t){return a$1(t,pc)}async function oi(t){let e=t.response.price,r=t.response.size===void 0?hc(t.request.requestedSize,e):t.response.size,s=await ti({account:t.account,chainId:t.chainId,exchange:t.exchange,orderPrice:lc(t.request,t.response.source,e),orderSide:mc(t.response.source),signer:t.signer,size:r,tokenId:dc(t.request,t.response.source)});return {price:e,signedOrder:s,size:r}}function dc(t,e){return t.direction===RfqDirection.Buy?e==="collateral"?t.noPositionId:t.yesPositionId:e==="collateral"?t.yesPositionId:t.noPositionId}function lc(t,e,r){return t.direction===RfqDirection.Buy&&e==="collateral"||t.direction===RfqDirection.Sell&&e==="inventory"?1000000n-r:r}function mc(t){return t==="collateral"?OrderSide.BUY:OrderSide.SELL}function hc(t,e){let r=ai(t.value);return t.unit===RfqRequestedSizeUnit.Shares?r:r*1000000n/e}function ai(t){let e=/^(\d+)(?:\.(\d*))?$/.exec(t);if(e===null)throw new a("Value must be a valid decimal.");let[,r="",s=""]=e;if(s.length>6)throw new a("Value must have at most 6 decimal places.");let i=BigInt(r)*1000000n+BigInt(s.padEnd(6,"0"));if(i<=0n)throw new a("Value must be greater than 0.");return i}var bc=3e4,Rc=3e4,F=class{#e;#r;#t;#o;#a;#s;#i;#n;#p;#c;#u=false;constructor(e){this.#e=e.account,this.#r=e.chainId,this.#t=e.credentials,this.#o=e.exchange,this.#a=e.headers,this.#s=e.signer,this.#i=e.url;}async connect(){if(this.#u)throw new d("RFQ quoter manager has been shut down.");if(this.#n!==void 0){if(!this.#n.closed)return this.#n;this.#n=void 0;}if(this.#c!==void 0)return this.#c;let e=new Qe({account:this.#e,chainId:this.#r,credentials:this.#t,exchange:this.#o,headers:this.#a,onClose:()=>this.#d(e),signer:this.#s,url:this.#i});this.#p=e;let r;return r=(async()=>{try{if(await e.connect(),this.#u)throw await e.close(),new d("RFQ quoter manager has been shut down.");return this.#n=e,e}catch(s){throw await e.close(),s}finally{this.#c===r&&(this.#c=void 0),this.#p===e&&(this.#p=void 0);}})(),this.#c=r,r}async shutdown(){this.#u=true;let e=this.#n,r=this.#p,s=this.#c;this.#n=void 0,this.#p=void 0,this.#c=void 0,await Promise.allSettled([e?.close(),r?.close(),s?.catch(()=>{})]).then(()=>{});}#d(e){this.#n===e&&(this.#n=void 0),this.#p===e&&(this.#p=void 0);}},Qe=class{#e;#r;#t;#o;#a;#s;#i;#n;#p=new Pe;#c=pushable({objectMode:true});#u=new X(Rc);#d;#l;constructor(e){this.#e=e.account,this.#r=e.chainId,this.#t=e.credentials,this.#o=e.exchange,this.#a=e.headers,this.#s=e.onClose,this.#i=e.signer,this.#n=e.url;}get closed(){return this.#d!==void 0}async connect(){let e=Pc();this.#l=e;let r=setNonBlockingTimeout(()=>{e.reject(new d("RFQ quoter authentication timed out."));},bc);try{await this.#p.connect({headers:this.#a,onConnectionLost:s=>this.#q(s),onError:()=>{},onMessage:s=>this.#P(s),onOpen:()=>this.#b(),url:this.#n}),await e.promise;}finally{clearTimeout(r),this.#l=void 0;}}async#m(e){if(!this.#p.send(e))throw new d("RFQ quoter websocket is not open.")}async close(){this.#d===void 0&&(this.#d=this.#f()),await this.#d;}[Symbol.asyncIterator](){return this.#c[Symbol.asyncIterator]()}async#f(){let e=new d("RFQ quoter websocket closed.");this.#S(e),this.#c.end(),await this.#p.close(),this.#s();}async#h(e){this.#d===void 0&&(this.#d=this.#y(e)),await this.#d;}async#y(e){this.#S(e),this.#c.end(e),await this.#p.close(),this.#s();}#S(e){this.#l?.reject(e),this.#u.rejectAll(e);}#b(){this.#p.send(Gs(this.#e,this.#t));}#P(e){if(this.#d!==void 0)return;let r=RfqQuoterInboundMessageSchema.safeParse(e);if(!r.success)return;let s=r.data;switch(s.type){case "auth":this.#g(s);return;case "quote_request":this.#c.push(zs(this,s));return;case "quote_ack":this.#u.resolve(ee(s.rfqId),Vs(s));return;case "quote_cancel_ack":this.#u.resolve(We(s.rfqId,s.quoteId),Ns(s));return;case "confirmation_request":this.#c.push(js(this,s));return;case "confirmation_ack":this.#u.resolve(Ke(s.rfqId,s.quoteId),$s(s));return;case "execution_update":this.#c.push(s);return;case "trade":this.#c.push(s);return;case "rfq_error":this.#R(s);return}}#g(e){if(e.success===true){this.#l?.resolve(void 0);return}this.#l?.reject(new d(`RFQ quoter authentication failed: ${e.error}`));}#q(e){this.#h(new g$1("RFQ quoter connection lost.",e));}#R(e){if(e.requestType==="RFQ_QUOTE"){if(e.rfqId===void 0){this.#h(new d("Uncorrelated RFQ quoter error."));return}this.#u.reject(ee(e.rfqId),new Mg(e.message,{code:e.code,errorId:e.errorId,rfqId:e.rfqId}));return}if(e.requestType==="RFQ_QUOTE_CANCEL"){if(e.rfqId===void 0||e.quoteId===void 0){this.#h(new d("Uncorrelated RFQ quoter error."));return}this.#u.reject(We(e.rfqId,e.quoteId),new Og(e.message,{code:e.code,errorId:e.errorId,quoteId:e.quoteId,rfqId:e.rfqId}));return}if(e.requestType==="RFQ_CONFIRMATION_RESPONSE"){if(e.rfqId===void 0||e.quoteId===void 0){this.#h(new d("Uncorrelated RFQ quoter error."));return}this.#u.reject(Ke(e.rfqId,e.quoteId),new Qg(e.message,{code:e.code,errorId:e.errorId,quoteId:e.quoteId,rfqId:e.rfqId}));}}async quote(e,r){let s=ni(r),i=await oi({account:this.#e,chainId:this.#r,exchange:this.#o,request:e,response:s,signer:this.#i}),n=this.#u.waitFor(ee(e.rfqId),`Timed out waiting for RFQ quote acknowledgement for ${e.rfqId}.`);try{return await this.#m(Js(e,i)),await n}catch(o){throw this.#u.remove(ee(e.rfqId),n),o}}async cancelQuote(e){let r=We(e.rfqId,e.quoteId),s=this.#u.waitFor(r,`Timed out waiting for RFQ quote cancellation acknowledgement for ${e.rfqId}.`);try{return await this.#m(Ys(this.#e,e.rfqId,e.quoteId)),await s}catch(i){throw this.#u.remove(r,s),i}}async respondToConfirmation(e,r,s){let i=Ke(e,r),n=this.#u.waitFor(i,`Timed out waiting for RFQ confirmation acknowledgement for ${e}.`);try{return await this.#m(Zs(e,r,s)),await n}catch(o){throw this.#u.remove(i,n),o}}};function ee(t){return `ACK_RFQ_QUOTE:${t}`}function We(t,e){return `ACK_RFQ_QUOTE_CANCEL:${t}:${e}`}function Ke(t,e){return `ACK_RFQ_CONFIRMATION_RESPONSE:${t}:${e}`}function Pc(){let t,e;return {promise:new Promise((s,i)=>{t=s,e=i;}),reject:e,resolve:t}}var M=class{#e;#r;#t;#o=new Pe({heartbeat:new Ke$1});#a=new Oe$1;#s=new R({deriveServerState:Cc});constructor(e){this.#e=e.headers,this.#r=e.url;}async subscribe(e){let{change:r,entry:s}=this.#s.add(e,{matches:Tc(e)});return await this.#i(s,r),g(s.subscriber.queue,()=>this.#n(s))}async#i(e,r){try{if((await this.#c()).reusedOpenSocket){let{before:i,after:n}=r,o=qc(i,n);this.#h(o);}}catch(s){throw await this.#n(e),s}}async#n(e){let{before:r,after:s}=this.#s.remove(e),i=vc(r,s);this.#y(i),this.#s.hasActiveSubscriptions()||await this.close();}async close(){this.#t===void 0&&(this.#t=this.#p().finally(()=>{this.#t=void 0;})),await this.#t;}async#p(){this.#a.stop(),this.#s.endAll(),await this.#o.close();}#c(){return this.#o.connect({onConnectionLost:()=>this.#l(),onError:()=>this.#m(),onMessage:e=>this.#d(e),onOpen:()=>this.#u(),headers:this.#e,url:this.#r})}#u(){this.#a.resetBackoff(),this.#f();}#d(e){let r=RealtimeEventSchema.safeParse(e);r.success&&this.#s.dispatch(r.data);}#l(){this.#s.hasActiveSubscriptions()&&this.#S();}#m(){}#f(){this.#h(Array.from(this.#s.serverState().values()));}#h(e){e.length!==0&&this.#o.send(Ec(e));}#y(e){e.length!==0&&this.#o.send(Ac(e));}#S(){this.#a.schedule({reconnect:()=>this.#c(),shouldReconnect:()=>this.#s.hasActiveSubscriptions()});}};function qc(t,e){return Array.from(e).flatMap(([r,s])=>t.has(r)?[]:[s])}function vc(t,e){return Array.from(t).flatMap(([r,s])=>e.has(r)?[]:[s])}function Cc(t){let e=new Map;for(let{subscription:r}of t)for(let s of wc(r))e.has(s.key)||e.set(s.key,s);return e}function Ec(t){return {action:"subscribe",subscriptions:t.map(({topic:e,type:r})=>({topic:e,type:r}))}}function Ac(t){return {action:"unsubscribe",subscriptions:t.map(({topic:e,type:r})=>({topic:e,type:r}))}}function wc(t){switch(t.topic){case "comments":return (t.types??["comment_created"]).map(e=>Q("comments",e));case "prices.crypto.binance":return [Q("crypto_prices","update")];case "prices.crypto.chainlink":return [Q("crypto_prices_chainlink","update")];case "prices.crypto.chainlink.twap":return [Q(kc(t.windowSeconds),"update")];case "prices.equity.pyth":return [Q("equity_prices","update")];default:invariant(false,`Unknown RTDS topic: ${String(t)}`);}}function kc(t){switch(t){case 30:return "crypto_prices_twap_thirty";case 60:return "crypto_prices_twap_sixty";default:invariant(false,`Unknown TWAP window: ${String(t)}`);}}function Q(t,e){return {key:`${t}:${e}`,topic:t,type:e}}function Tc(t){switch(t.topic){case "comments":return e=>!(e.topic!=="comments"||t.types!==void 0&&t.types.length>0&&!t.types.includes(e.type)||(t.parentEntityId!==void 0||t.parentEntityType!==void 0)&&(!(e.type==="comment_created"||e.type==="comment_removed")||t.parentEntityId!==void 0&&e.payload.parentEntityID!==t.parentEntityId||t.parentEntityType!==void 0&&e.payload.parentEntityType!==t.parentEntityType));case "prices.crypto.binance":return e=>e.topic==="prices.crypto.binance"&&(t.symbols===void 0||t.symbols.length===0||t.symbols.includes(e.payload.symbol));case "prices.crypto.chainlink":return e=>e.topic==="prices.crypto.chainlink"&&(t.symbols===void 0||t.symbols.length===0||t.symbols.includes(e.payload.symbol));case "prices.crypto.chainlink.twap":return e=>e.topic==="prices.crypto.chainlink.twap"&&e.payload.windowSeconds===t.windowSeconds&&(t.symbols===void 0||t.symbols.length===0||t.symbols.includes(e.payload.symbol));case "prices.equity.pyth":return e=>e.topic==="prices.equity.pyth"&&e.payload.symbol.toLowerCase()===t.symbol.toLowerCase()&&(t.types===void 0||t.types.length===0||t.types.includes(e.type));default:invariant(false,`Unknown RTDS topic: ${String(t)}`);}}var I=class{#e;#r;#t;#o=new Pe({heartbeat:new Le$1});#a=new Oe$1;#s=new R;constructor(e){this.#e=e.headers,this.#r=e.url;}async subscribe(e){let{entry:r}=this.#s.add(e);return await this.#i(r),g(r.subscriber.queue,()=>this.#n(r))}async#i(e){try{await this.#c();}catch(r){throw await this.#n(e),r}}async#n(e){this.#s.remove(e),this.#s.hasActiveSubscriptions()||await this.close();}async close(){this.#t===void 0&&(this.#t=this.#p().finally(()=>{this.#t=void 0;})),await this.#t;}async#p(){this.#a.stop(),this.#s.endAll(),await this.#o.close();}#c(){return this.#o.connect({onConnectionLost:()=>this.#l(),onError:()=>this.#m(),onMessage:e=>this.#d(e),onOpen:()=>this.#u(),headers:this.#e,url:this.#r})}#u(){this.#a.resetBackoff();}#d(e){let r=SportsResultEventSchema.safeParse(e);r.success&&this.#s.dispatch(r.data);}#l(){this.#s.hasActiveSubscriptions()&&this.#f();}#m(){}#f(){this.#a.schedule({reconnect:()=>this.#c(),shouldReconnect:()=>this.#s.hasActiveSubscriptions()});}};var te=class{#e;#r;get context(){return this.#e}get decorators(){return this.#r}get environment(){return this.context.environment}get siteConfig(){return this.context.siteConfig}get predictions(){return this.context.predictions}get clob(){return this.context.clob}get relayer(){return this.context.relayer}get rpc(){return this.context.rpc}get gamma(){return this.context.gamma}get data(){return this.context.data}get rfq(){return this.context.rfq}get perps(){return this.context.perps}get webSockets(){return this.context.webSockets}get supportsGasless(){return this.context.apiKey?.supportGasless??false}get hasBuilderApiKey(){return this.context.apiKey?.isBuilderKey??false}constructor(e){this.#e=e,this.#r=[];}async resolveClobHeaders(e){return this.context.apiKey?.isBuilderKey?this.context.apiKey.authorize(e,{fetch:this.context.fetch,signal:e.signal}):Promise.resolve({})}async resolveRelayerHeaders(e){return this.context.apiKey?.supportGasless?this.context.apiKey.authorize(e,{fetch:this.context.fetch,signal:e.signal}):Promise.resolve({})}rememberDecorator(e){this.#r.push(e);}},Bc=z.object({key:ApiKeySchema,passphrase:z.string(),secret:z.string()}),Uc=z.object({wallet:EvmAddressSchema,credentials:Bc.optional(),nonce:z.number().int().nonnegative().optional()}).superRefine((t,e)=>{t.credentials!==void 0&&t.nonce!==void 0&&e.addIssue({code:"custom",message:"`credentials` and `nonce` are mutually exclusive.",path:["nonce"]});}).transform(t=>t.credentials!==void 0?{wallet:t.wallet,credentials:t.credentials}:t.nonce!==void 0?{wallet:t.wallet,nonce:t.nonce}:{wallet:t.wallet});function ci(t){let e=gs();return new Ie$1({fetch:t.fetch,retryMutations:false,headers:t.environment.predictions.headers,root:t.environment.predictions.rest,resolveHeaders:async()=>({KUEST_CLIENT:e})})}var re=class extends te{constructor(e){super({apiKey:e.apiKey,environment:e.environment,siteConfig:e.siteConfig,fetch:e.fetch,onRateLimitUpdate:e.onRateLimitUpdate,predictions:ci(e),data:new Ie$1({fetch:e.fetch,headers:e.environment.data.headers,root:e.environment.data.rest}),gamma:new Ie$1({fetch:e.fetch,headers:e.environment.gamma.headers,root:e.environment.gamma.rest}),clob:new Ie$1({fetch:e.fetch,headers:e.environment.clob.headers,onRateLimitUpdate:e.onRateLimitUpdate,root:e.environment.clob.rest,resolveHeaders:r=>this.resolveClobHeaders(r)}),relayer:new Ie$1({fetch:e.fetch,headers:e.environment.relayer.headers,root:e.environment.relayer.rest,resolveHeaders:r=>this.resolveRelayerHeaders(r)}),rfq:new Ie$1({fetch:e.fetch,headers:e.environment.combos.headers,root:e.environment.combos.rest}),perps:new Ie$1({fetch:e.fetch,headers:e.environment.perps.headers,root:e.environment.perps.rest}),rpc:new S({url:e.environment.rpc,fetch:e.fetch}),webSockets:{clobMarket:new w({headers:e.environment.clob.market.headers,url:e.environment.clob.market.ws}),sports:new I({headers:e.environment.sports.headers,url:e.environment.sports.ws}),rtds:new M({headers:e.environment.rtds.headers,url:e.environment.rtds.ws}),perpsSubscriptions:new k({headers:e.environment.perps.headers,url:e.environment.perps.ws})}});}isSecureClient(){return false}isPublicClient(){return true}async closeSubscriptions(){await Promise.all([this.webSockets.clobMarket.close(),this.webSockets.rtds.close(),this.webSockets.sports.close(),this.webSockets.perpsSubscriptions.close()]).then(()=>{});}extend(e){return this.rememberDecorator(e),Object.assign(this,e(this)),this}beginAuthentication(e,r){let s=a$1(e,Uc);return Promise.resolve(async function*(){let i$1=Math.floor(Date.now()/1e3),n=s?.nonce??0,o=expectEvmAddress(yield La$1()),a=expectEvmAddress(s.wallet),u=U$1(this.environment,o,a);if(s.credentials!==void 0){let S=this.#e(s.credentials,u,r);try{if((await zb(S)).includes(s.credentials.key))return S}catch(f){if(!(f instanceof i)||f.status!==401)throw f}}let d=yield {kind:"signAuthMessage",payload:Ps({address:o,chainId:this.environment.chainId,nonce:n,timestamp:i$1})},c=await xb(this,{address:o,nonce:n,signature:expectEvmSignature(d),timestamp:i$1});return this.#e(c,u,r)}.call(this))}#e(e,r,s){let i=new je({account:r,apiKey:this.context.apiKey,credentials:e,environment:this.environment,siteConfig:this.siteConfig,onRateLimitUpdate:this.context.onRateLimitUpdate,fetch:this.context.fetch,signer:s});for(let n of this.decorators)i.extend(n);return i}},je=class extends te{#e=false;get context(){return invariant(!this.#e,"This client has ended authentication and can no longer be used."),super.context}endAuthenticationLifecycle(){this.#e=true;}constructor(e){let r=new K({url:e.environment.realtime.ws,headers:e.environment.realtime.headers,credentials:e.credentials});super({account:e.account,credentials:e.credentials,apiKey:e.apiKey,environment:e.environment,siteConfig:e.siteConfig,fetch:e.fetch,onRateLimitUpdate:e.onRateLimitUpdate,signer:e.signer,predictions:ci(e),clob:new Ie$1({fetch:e.fetch,headers:e.environment.clob.headers,onRateLimitUpdate:e.onRateLimitUpdate,root:e.environment.clob.rest,resolveHeaders:s=>this.resolveClobHeaders(s)}),relayer:new Ie$1({fetch:e.fetch,headers:e.environment.relayer.headers,root:e.environment.relayer.rest,resolveHeaders:s=>this.resolveRelayerHeaders(s)}),rpc:new S({url:e.environment.rpc,fetch:e.fetch}),gamma:new Ie$1({fetch:e.fetch,headers:e.environment.gamma.headers,root:e.environment.gamma.rest}),data:new Ie$1({fetch:e.fetch,headers:e.environment.data.headers,root:e.environment.data.rest}),rfq:new Ie$1({fetch:e.fetch,headers:e.environment.combos.headers,root:e.environment.combos.rest}),perps:new Ie$1({fetch:e.fetch,headers:e.environment.perps.headers,root:e.environment.perps.rest}),secureClob:new Ie$1({fetch:e.fetch,headers:e.environment.clob.headers,onRateLimitUpdate:e.onRateLimitUpdate,resolveHeaders:async s=>({...await this.resolveClobHeaders(s),...await this.#t(s)}),root:e.environment.clob.rest}),combos:new Ie$1({fetch:e.fetch,headers:e.environment.combos.collateralReturn.headers,resolveHeaders:s=>this.resolveRelayerHeaders(s),root:e.environment.combos.collateralReturn.rest}),builderGateway:new Ie$1({fetch:e.fetch,headers:e.environment.combos.builderGateway.headers,resolveHeaders:async s=>({...await this.#r(s),...await this.#t(s)}),root:e.environment.combos.builderGateway.rest}),webSockets:{clobMarket:new w({headers:e.environment.clob.market.headers,url:e.environment.clob.market.ws}),clobUser:new O({credentials:e.credentials,headers:e.environment.clob.user.headers,url:e.environment.clob.user.ws}),rfqQuoter:new F({account:e.account,chainId:e.environment.chainId,credentials:e.credentials,exchange:e.environment.contracts.exchangeV3,headers:e.environment.combos.headers,signer:e.signer,url:e.environment.combos.ws}),sports:new I({headers:e.environment.sports.headers,url:e.environment.sports.ws}),realtime:r,rtds:new M({headers:e.environment.rtds.headers,url:e.environment.rtds.ws}),perpsSubscriptions:new k({headers:e.environment.perps.headers,url:e.environment.perps.ws}),perpsSession:new x({fetch:e.fetch,chainId:e.environment.chainId,headers:e.environment.perps.headers,restUrl:e.environment.perps.rest,wsUrl:e.environment.perps.ws})}});}get credentials(){return this.context.credentials}get account(){return this.context.account}get signer(){return this.context.signer}get secureClob(){return this.context.secureClob}get combos(){return this.context.combos}get builderGateway(){return this.context.builderGateway}get webSockets(){return this.context.webSockets}async closeSubscriptions(){await Promise.allSettled([this.webSockets.clobMarket.close(),this.webSockets.realtime.close(),this.webSockets.rtds.close(),this.webSockets.sports.close(),this.webSockets.perpsSubscriptions.close(),this.webSockets.clobUser.close()]).then(()=>{});}isSecureClient(){return true}isPublicClient(){return false}extend(e){return this.rememberDecorator(e),Object.assign(this,e(this)),this}async endAuthentication(){let e=this.closeSubscriptions(),r=this.webSockets.perpsSession.shutdown(),s=this.webSockets.rfqQuoter.shutdown(),{apiKey:i,environment:n,onRateLimitUpdate:o,fetch:a}=this.context;try{await Bb(this);}finally{this.endAuthenticationLifecycle(),await Promise.allSettled([e,r,s]).then(()=>{});}let u=new re({apiKey:i,environment:n,onRateLimitUpdate:o,fetch:a});for(let d of this.decorators)u.extend(d);return u}async#r(e){return e.method!=="GET"&&this.context.apiKey?.isBuilderKey?this.context.apiKey.authorize(e,{fetch:this.context.fetch,signal:e.signal}):{}}async#t(e){try{let r=Math.floor(Date.now()/1e3);return {KUEST_ADDRESS:this.account.signer,KUEST_API_KEY:this.credentials.key,KUEST_PASSPHRASE:this.credentials.passphrase,KUEST_SIGNATURE:await rb(this.credentials.secret,r,e.method,e.path,e.body),KUEST_TIMESTAMP:`${r}`}}catch(r){throw s.fromError(r,"Could not sign the L2-authenticated request")}}};function ui(t={}){return new re({environment:t.environment??Ie,siteConfig:t.siteConfig?ce(t.siteConfig):void 0,apiKey:t.apiKey,onRateLimitUpdate:t.onRateLimitUpdate,fetch:t.fetch}).extend(Es)}var Dc=t(o,k$1,i,s,l,n,d,c,a),Wc=t(a);async function Kc(t){let e=ui({environment:t.environment,siteConfig:t.siteConfig,apiKey:t.apiKey,onRateLimitUpdate:t.onRateLimitUpdate,fetch:t.fetch}),r=await Qc(e,t),s=await e.beginAuthentication({wallet:r,credentials:t.credentials,nonce:t.nonce},t.signer).then(Ka$1(t.signer));if(s.account.walletType===WalletType.EOA||await Pa(s,{wallet:s.account.wallet,type:s.account.walletType}))return s;if(s.account.walletType===WalletType.DEPOSIT_WALLET)return await Hc(s),s;throw new a(`Wallet ${s.account.wallet} does not exist. Provide an existing wallet address, or omit wallet to use the default Deposit Wallet flow.`)}async function Qc(t,e){if(e.wallet!==void 0)return e.wallet;let r=expectEvmAddress(await e.signer.getAddress()),s=W(r,t.environment.walletDerivation);return await Pa(t,{wallet:s,type:WalletType.DEPOSIT_WALLET})?s:X$1(r,t.environment.walletDerivation)}async function Hc(t){let e=X$1(t.account.signer,t.environment.walletDerivation);if(!isSameEvmAddress(t.account.wallet,e))throw new a(`Wallet ${t.account.wallet} does not match the expected Deposit Wallet ${e} for this signer, nor a deployed wallet address.`);await(await Sa(t)).wait();}
|
|
1
|
+
import {Q as Q$1,R as R$1,Z as Z$1,ha,fa,da,Da as Da$1,Ba,Xf,Vf,Tf,Rf,bd,Pf,Nf,Lf,dd as dd$1,$c,Zc,Xc,Jb,za as za$1,ud,yd,Wd,wd,lc as lc$1,jc,hc as hc$1,fc,dc as dc$1,bc as bc$1,$b,Zb,Nb,Lb,Oc,Qc as Qc$1,Sh,Gc,Ec as Ec$1,Cc as Cc$1,Lg,Qh,Ch,Ah,nh,Oh,Mh,Kh,Ih,jd,rh,ph,sd,qd,od,md,Mc,Kc as Kc$1,Ic,sf,qf,of,kf,if as _if,gf,uf,mf,De,Jf,Ge,Ff,Gf,Cf,Bf,Ef,xa,va,ta,ra,pa,na,_g,Yg,Wg,Tg,yh,uh,wh,Eh,ba,$,Ud,Sd,Qd,Od,te as te$1,ae,$d,Be as Be$1,ze,xe as xe$1,ve,Md,zc,vc as vc$1,Jg,Ag,og,Id,Kd,Ed,Gd,Ad,Cd,Wh,kb,gb,qb,nb,ce,Ka as Ka$1,Pa,W,X as X$1,Sa,pc as pc$1,nc,rc,tc,S,Ie as Ie$1,a as a$1,La as La$1,U as U$1,zb,xb,Pe,Me as Me$1,Oe as Oe$1,Ke as Ke$1,Le as Le$1,Je,Bb,rb,ef,Mg,Og,Qg,Ne,V,fe,he,ie,ge,de,ee as ee$1}from'./chunk-3QTVWIZS.js';export{Xg as AcceptComboQuoteError,jb as ApproveErc1155ForAllError,fb as ApproveErc20Error,Ee as ApprovePerpsBuilderFeeError,We as ArmPerpsAutoCancelError,vh as AuthorizeSessionKeyError,ed as BiggestWinnerKind,fd as BuilderVolumeInterval,Rd as CancelAllError,Td as CancelMarketOrdersError,Nd as CancelOrderError,Pd as CancelOrdersError,Ve as CancelPerpsChaseError,cf as CancelPerpsTwapError,Ac as CollateralReturnKnownOperationKind,M as CombinatorialPrepareConditionCallError,bh as ComboAcceptFailureReason,Ea as ComboActivityType,Yf as ComboPositionSortBy,Zf as ComboPositionStatus,ch as ComboQuoteUnavailableReason,Bd as ConvertError,ye as CreateLimitOrderError,ue as CreateMarketOrderError,Te as CreatePerpsChaseError,_e as CreatePerpsTwapError,v as CtfMergePositionsCallError,x as CtfRedeemPositionsCallError,t as CtfSplitPositionCallError,be as DEFAULT_SITE_CONFIG,yf as DepositToPerpsError,Wf as DownloadAccountingSnapshotError,ga as DropNotificationsError,c as Erc20ApprovalCallError,n as Erc20TransferCallError,Vd as EstimateMarketPriceError,yc as ExecuteCollateralReturnPlanError,Yc as FetchBuilderVolumeError,Y as FetchClosedOnlyModeError,Dc as FetchCommentsByIdError,sc as FetchCurrentRebatesError,Jc as FetchEventError,Pc as FetchEventLiveVolumeError,Lc as FetchEventTagsError,ic as FetchLastTradePriceError,kc as FetchLastTradePricesError,pd as FetchMarketError,rd as FetchMarketTagsError,Kb as FetchMidpointError,Mb as FetchMidpointsError,ea as FetchNotificationsError,xd as FetchOpenInterestError,ac as FetchOrderBookError,cc as FetchOrderBooksError,aa as FetchOrderError,ma as FetchOrderScoringError,oa as FetchOrdersScoringError,lf as FetchPerpsBookError,Qe as FetchPerpsBuilderApprovalsError,Se as FetchPerpsBuilderEarningsSummaryError,Ce as FetchPerpsBuilderStatusError,Ue as FetchPerpsChasesError,tf as FetchPerpsFeesError,ff as FetchPerpsInstrumentsError,Fe as FetchPerpsPositionSnapshotsError,If as FetchPerpsRegistrationError,hf as FetchPerpsTickerError,jf as FetchPerpsTickersError,$e as FetchPerpsTwapsError,Of as FetchPortfolioValueError,Yb as FetchPriceError,_b as FetchPricesError,Kg as FetchPublicProfileError,Nh as FetchRelatedTagResourcesError,Lh as FetchRelatedTagsError,Nc as FetchResolutionsError,wa as FetchRewardPercentagesError,$g as FetchRfqStatusError,qh as FetchSeriesError,th as FetchSessionKeysError,Bh as FetchSportsMarketTypesError,ec as FetchSpreadError,gc as FetchSpreadsError,Jh as FetchTagError,Rh as FetchTokenReferencesError,sa as FetchTotalEarningsForUserForDayError,ad as FetchTraderLeaderboardStandingError,mb as FetchTradingApprovalsStateError,Sf as FetchUserPnlError,Qf as FetchUserStatsError,Uf as FetchUserVolumeError,Jd as HorizontalMergeError,Fd as HorizontalSplitError,Fh as KnownPriceSource,gd as LeaderboardWindow,ca as ListAccountTradesError,Aa as ListActivityError,cd as ListBiggestWinnersError,Wc as ListBuilderLeaderboardError,Ib as ListBuilderTradesError,Ca as ListComboActivityError,nd as ListComboMarketsError,Mf as ListComboPositionsError,Fc as ListCommentsByUserAddressError,Bc as ListCommentsError,mc as ListCurrentRewardsError,Hc as ListEventsError,td as ListMarketHoldersError,oc as ListMarketRewardsError,ld as ListMarketsError,_ as ListOpenOrdersError,Re as ListPerpsBuilderEarningsError,nf as ListPerpsCandlesError,pf as ListPerpsFundingHistoryError,rf as ListPerpsTradesError,Kf as ListPositionsError,vd as ListPriceHistoryError,qc as ListRewardMarketsError,oh as ListSeriesError,zh as ListSportsError,Hh as ListTagsError,Ph as ListTeamsError,_c as ListTraderLeaderboardError,ya as ListTradesError,ua as ListUserEarningsAndMarketsConfigError,qa as ListUserEarningsForDayError,b as MAX_UINT256,vg as MergePositionsError,vf as OpenPerpsSessionError,Sg as OpenRfqSessionError,af as PausePerpsTwapError,r as PerpsDepositCallError,Ae as PlaceLimitOrderError,we as PlaceMarketOrderError,uc as PlanCollateralReturnError,_f as PositionFilterType,$f as PositionSortBy,ag as PositionStatus,Zd as PostOrderError,_d as PostOrdersError,zd as PrepareConvertError,Hd as PrepareHorizontalMergeError,Dd as PrepareHorizontalSplitError,kd as PriceHistoryInterval,Gh as PriceProvider,Ig as RedeemPositionsError,Vg as RequestComboQuoteError,Rc as ResolutionMarketType,Sc as ResolutionReporter,Tc as ResolutionSettlementTimeBasis,Uc as ResolutionSource,Vc as ResolutionStatus,bf as ResumePerpsTwapError,df as RevokePerpsBuilderFeeError,wf as RevokePerpsCredentialsError,xh as RevokeSessionKeyError,Pg as RfqCancelQuoteError,Og as RfqCancelQuoteRejectedError,dh as RfqConfirmationDecision,Rg as RfqConfirmationError,Qg as RfqConfirmationRejectedError,eh as RfqDirection,fh as RfqExecutionStatus,gh as RfqKnownErrorCode,Ng as RfqQuoteError,Mg as RfqQuoteRejectedError,hh as RfqRejectionCode,Ug as RfqRequestRejectedError,ih as RfqRequestedSizeUnit,jh as RfqSide,kh as RfqStatus,A as RouterConvertCallError,E as RouterHorizontalMergeCallError,C as RouterHorizontalSplitCallError,I as RouterMergeCallError,K as RouterRedeemCallError,G as RouterSplitCallError,mh as SearchError,lh as SearchSort,Ld as SendOrderHeartbeatError,He as ServiceClientRequestError,sh as SessionKeyKnownScope,pb as SetupTradingApprovalsError,T as SignerType,Fa as SortDirection,jg as SplitPositionError,Dh as SubscribeError,Ga as TipSide,Ha as TradeFilterType,hd as TraderLeaderboardSort,Vh as TransferErc20Error,Af as TransferPerpsCollateralError,Xe as UpdatePerpsLeverageError,Ye as UpdatePerpsLeveragesError,Ze as UpdatePerpsMarginError,bg as UserPnlFidelity,cg as UserPnlInterval,Zg as WaitForComboFillError,se as WaitForOrderFillSettlementError,Ia as WaitForTransactionError,zf as WithdrawFromPerpsError,p as authorizeSessionSignerCall,rb as buildHmacSignature,N as combinatorialPrepareConditionCall,w as ctfMergePositionsCall,y as ctfRedeemPositionsCall,u as ctfSplitPositionCall,m as decodeErc1155BalanceOfBatchResult,k as decodeErc1155BalanceOfResult,i as decodeErc1155IsApprovedForAllResult,f as decodeErc20AllowanceResult,O as encodeProxyCall,P as encodeSafeMultisendCall,g as erc1155ApprovalForAllCall,l as erc1155BalanceOfBatchCall,j as erc1155BalanceOfCall,h as erc1155IsApprovedForAllCall,e as erc20AllowanceCall,d as erc20ApprovalCall,o as erc20TransferCall,Ja as expectTransactionHandle,z as negRiskRedeemPositionsCall,ce as parseSiteConfig,s as perpsDepositCall,q as revokeSessionSignerCall,B as routerConvertCall,F as routerHorizontalMergeCall,D as routerHorizontalSplitCall,J as routerMergeCall,L as routerRedeemCall,H as routerSplitCall}from'./chunk-3QTVWIZS.js';import {a,t,o,k as k$1,i,s,l,n,d,c,e,g as g$1}from'./chunk-LDEY5CK7.js';export{q as AutoCancelDailyLimitError,o as CancelledSigningError,g as ConnectionLostError,u as GatewayKnownErrorCode,p as InsufficientLiquidityError,m as OperationAbortedError,j as OrderHeartbeatMismatchError,b as PaginationLimitError,r as PerpsCancelRetryError,k as RateLimitError,v as RealtimeKnownErrorCode,e as RequestAbortedError,i as RequestRejectedError,s as SigningError,l as TimeoutError,h as TradingRestriction,n as TransactionFailedError,d as TransportError,c as UnexpectedResponseError,a as UserInputError,f as WebSocketKnownCloseCode,t as makeErrorGuard}from'./chunk-LDEY5CK7.js';import {DecimalishSchema,ApiKeySchema,EvmAddressSchema,toBaseUnits,OrderSide}from'@kuest/bindings';export{CommentParentEntityType,OrderSide,OrderType}from'@kuest/bindings';export{AssetType,NotificationType,OrderPostStatus,OrderResponseErrorCode,RewardMarketSort,SignatureType}from'@kuest/bindings/clob';export{ActivityType,TokenModule}from'@kuest/bindings/data';import {WalletType}from'@kuest/bindings/gamma';export{ComboKnownStatus,MarketResolutionStatus,ProtocolVersion,TeamOrdering,WalletType}from'@kuest/bindings/gamma';export{PerpsDepositStatus,PerpsInstrumentCategory,PerpsInstrumentType,PerpsInternalTransferDirection,PerpsKlineInterval,PerpsKnownCancelOrderErrorCode,PerpsKnownInternalTransferType,PerpsKnownWithdrawalStatus,PerpsLiquidationMethod,PerpsLiquidityRole,PerpsMarginType,PerpsNotificationOrderType,PerpsNotificationType,PerpsOrderStatus,PerpsPositionSnapshotMarkerKind,PerpsPositionSnapshotStatus,PerpsSide,PerpsSortDirection,PerpsTimeInForce,PerpsTwapStatus}from'@kuest/bindings/perps';import {z}from'zod';import {expectEvmAddress,isSameEvmAddress,expectEvmSignature,invariant,setNonBlockingTimeout}from'@kuest/types';import {TypedData}from'ox';import {PerpsMarketDataEventSchema,RealtimeEventSchema,SportsResultEventSchema,MarketEventSchema,UserEventSchema,RealtimeKnownErrorCode,PolyboltAckOp,PolyboltAckSchema,PolyboltEnvelopeSchema,parsePolyboltEvent,PolyboltChannel}from'@kuest/bindings/subscriptions';import {pushable}from'it-pushable';import {RfqQuoterInboundMessageSchema,RfqConfirmationDecision,RfqRequestedSizeUnit,RfqDirection}from'@kuest/bindings/combos';var Ma=z.object({KUEST_BUILDER_API_KEY:z.string().min(1),KUEST_BUILDER_TIMESTAMP:z.string().min(1),KUEST_BUILDER_PASSPHRASE:z.string().min(1),KUEST_BUILDER_SIGNATURE:z.string().min(1)});function Ia(t){return new Ce(t)}function La(t){return new Ee(t)}var Ce=class{#e;constructor(e){this.#e=e;}get isBuilderKey(){return true}get supportGasless(){return true}async authorize(e$1,r){try{return Q$1(r?.signal),await this.#t(e$1,r)}catch(s$1){throw s$1 instanceof e?s$1:s.fromError(s$1,"Could not authorize the builder-authenticated request")}}async#r(e){let r=this.#e.headers,s=typeof r=="function"?await R$1(Promise.resolve(r()),e):r,i=new Headers(s);return i.set("content-type","application/json"),i}async#t(e,r){let s=await this.#r(r?.signal);Q$1(r?.signal);let i=r?.fetch??globalThis.fetch,n=await R$1(i(this.#e.url,{body:JSON.stringify({body:e.body,method:e.method,path:e.path}),credentials:this.#e.credentials,headers:s,method:"POST",mode:"cors",signal:r?.signal}),r?.signal);if(!n.ok)throw new Error(`Remote signer rejected request with status ${n.status}`);let o=await R$1(n.json(),r?.signal);return Ma.parse(o)}},Ee=class{#e;constructor(e){this.#e=e;}get isBuilderKey(){return false}get supportGasless(){return true}authorize(){return Promise.resolve({RELAYER_API_KEY:this.#e.key,RELAYER_API_KEY_ADDRESS:this.#e.address})}};function Ps(t){let e={chainId:t.chainId,name:"ClobAuthDomain",version:"1"};return {domain:e,message:{address:t.address,message:"This message attests that I control the given wallet",nonce:t.nonce??0,timestamp:`${t.timestamp}`},primaryType:"ClobAuth",types:{EIP712Domain:TypedData.extractEip712DomainTypes(e),ClobAuth:[{name:"address",type:"address"},{name:"timestamp",type:"string"},{name:"nonce",type:"uint256"},{name:"message",type:"string"}]}}}var Ua="0.13.1";function gs(){return `@kuest/sdk@${Ua}:${Da()}`}function Da(){try{let t=globalThis;if(t.Bun!==void 0)return `bun@${U(t.Bun.version)}`;if(t.Deno!==void 0)return `deno@${U(t.Deno.version?.deno)}`;if(t.process?.versions?.node!==void 0||t.process?.release?.name==="node")return `nodejs@${U(t.process?.versions?.node)}`;let e=t.navigator?.userAgent;if(typeof e=="string"){let r=[["edge",/\bEdg(?:e|A|iOS)?(?:\/([\d.]+))?/],["chrome",/\b(?:HeadlessChrome|Chrome|Chromium|CriOS)(?:\/([\d.]+))?/],["firefox",/\b(?:Firefox|FxiOS)(?:\/([\d.]+))?/]];for(let[s,i]of r){let n=i.exec(e);if(n!==null)return `${s}@${U(n[1])}`}if(/\bSafari\//.test(e))return `safari@${U(/\bVersion\/([\d.]+)/.exec(e)?.[1])}`}if(t.window!==void 0)return "browser@unknown";if(t.self!==void 0||typeof t.importScripts=="function")return "worker@unknown";if(t.navigator!==void 0)return "browser@unknown"}catch{}return "unknown@unknown"}function U(t){return typeof t=="string"&&/^[0-9][0-9A-Za-z.+_-]{0,63}$/.test(t)?t:"unknown"}function Wa(t){return {listPositions:Lf.bind(null,t),listComboPositions:Nf.bind(null,t),fetchPortfolioValue:Pf.bind(null,t),fetchTraderLeaderboardStanding:bd.bind(null,t),fetchUserStats:Rf.bind(null,t),fetchUserPnl:Tf.bind(null,t),fetchUserVolume:Vf.bind(null,t),downloadAccountingSnapshot:Xf.bind(null,t),listActivity:Ba.bind(null,t),listComboActivity:Da$1.bind(null,t)}}function P(t,e={}){return e===null||typeof e!="object"||Array.isArray(e)?e:{...e,user:e.user===void 0?t.account.wallet:e.user}}function Ae(t){let e=Wa(t);return t.isPublicClient()?e:{...e,listPositions:(r,s)=>Lf(t,P(t,r),s),listComboPositions:(r,s)=>Nf(t,P(t,r),s),fetchPortfolioValue:(r,s)=>Pf(t,P(t,r),s),fetchTraderLeaderboardStanding:(r,s)=>bd(t,P(t,r),s),fetchUserStats:(r,s)=>Rf(t,P(t,r),s),fetchUserPnl:(r,s)=>Tf(t,P(t,r),s),fetchUserVolume:(r,s)=>Vf(t,P(t,r),s),downloadAccountingSnapshot:(r,s)=>Xf(t,P(t,r),s),listActivity:(r,s)=>Ba(t,P(t,r),s),listComboActivity:(r,s)=>Da$1(t,P(t,r),s),listAccountTrades:da.bind(null,t),fetchNotifications:fa.bind(null,t),dropNotifications:ha.bind(null,t),fetchClosedOnlyMode:Z$1.bind(null,t)}}function we(t){return {listBuilderTrades:Jb.bind(null,t),listBuilderLeaderboard:Xc.bind(null,t),fetchBuilderVolume:Zc.bind(null,t),listTraderLeaderboard:$c.bind(null,t),listBiggestWinners:dd$1.bind(null,t)}}function ke(t){return {fetchTokenReferences:Sh.bind(null,t),fetchEventLiveVolume:Qc$1.bind(null,t),fetchResolutions:Oc.bind(null,t),fetchMidpoint:Lb.bind(null,t),fetchMidpoints:Nb.bind(null,t),fetchPrice:Zb.bind(null,t),fetchPrices:$b.bind(null,t),fetchOrderBook:bc$1.bind(null,t),fetchOrderBooks:dc$1.bind(null,t),fetchSpread:fc.bind(null,t),fetchSpreads:hc$1.bind(null,t),fetchLastTradePrice:jc.bind(null,t),fetchLastTradePrices:lc$1.bind(null,t),listPriceHistory:wd.bind(null,t),estimateMarketPrice:Wd.bind(null,t),fetchOpenInterest:yd.bind(null,t),listMarketHolders:ud.bind(null,t),listTrades:za$1.bind(null,t)}}function Te(t){return {listEvents:Ic.bind(null,t),fetchEvent:Kc$1.bind(null,t),fetchEventTags:Mc.bind(null,t),listMarkets:md.bind(null,t),listComboMarkets:od.bind(null,t),fetchMarket:qd.bind(null,t),fetchMarketTags:sd.bind(null,t),listSeries:ph.bind(null,t),fetchSeries:rh.bind(null,t),listMarketClarifications:jd.bind(null,t),listTags:Ih.bind(null,t),fetchTag:Kh.bind(null,t),fetchRelatedTags:Mh.bind(null,t),fetchRelatedTagResources:Oh.bind(null,t),search:nh.bind(null,t),listSports:Ah.bind(null,t),fetchSportsMarketTypes:Ch.bind(null,t),listTeams:Qh.bind(null,t),fetchPublicProfile:Lg.bind(null,t),listComments:Cc$1.bind(null,t),fetchCommentsById:Ec$1.bind(null,t),listCommentsByUserAddress:Gc.bind(null,t)}}function Oe(t){let e={fetchPerpsPositionSnapshots:Ge.bind(null,t),fetchPerpsRegistration:Jf.bind(null,t),fetchPerpsBuilderStatus:De.bind(null,t),fetchPerpsBook:mf.bind(null,t),fetchPerpsFees:uf.bind(null,t),fetchPerpsInstruments:gf.bind(null,t),fetchPerpsTicker:_if.bind(null,t),fetchPerpsTickers:kf.bind(null,t),listPerpsCandles:of.bind(null,t),listPerpsFundingHistory:qf.bind(null,t),listPerpsTrades:sf.bind(null,t)};return t.isSecureClient()?{...e,depositToPerps:r=>Ef(t,r),openPerpsSession:r=>Bf(t,r),revokePerpsCredentials:r=>Cf(t,r),transferPerpsCollateral:Gf.bind(null,t),withdrawFromPerps:r=>Ff(t,r)}:e}function Ka(t){return {fetchCurrentRebates:tc.bind(null,t),listRewardMarkets:rc.bind(null,t),listCurrentRewards:nc.bind(null,t),listMarketRewards:pc$1.bind(null,t)}}function xe(t){let e=Ka(t);return t.isPublicClient()?e:{...e,fetchOrderScoring:na.bind(null,t),fetchOrdersScoring:pa.bind(null,t),listUserEarningsForDay:ra.bind(null,t),fetchTotalEarningsForUserForDay:ta.bind(null,t),listUserEarningsAndMarketsConfig:va.bind(null,t),fetchRewardPercentages:xa.bind(null,t)}}function qs(t){return {openRfqSession(){return Tg(t)},requestComboQuote(e){return Wg(t,e)},acceptComboQuote(e){return Yg(t,e)},waitForComboFill(e){return _g(t,e)}}}function vs(t){return {authorizeSessionKey:wh.bind(null,t),fetchSessionKeys:uh.bind(null,t),revokeSessionKey:yh.bind(null,t)}}function Fe(t){return t.isSecureClient()?{subscribe(e){return Eh(t,e)}}:{subscribe(e){return Eh(t,e)}}}function Cs(t){return {sendOrderHeartbeat:Md.bind(null,t),createMarketOrder:ve.bind(null,t),placeMarketOrder:xe$1.bind(null,t),createLimitOrder:ze.bind(null,t),placeLimitOrder:Be$1.bind(null,t),postOrder:$d(t),postOrders:ae(t),waitForOrderFillSettlement:te$1.bind(null,t),cancelOrder:Od.bind(null,t),cancelOrders:Qd.bind(null,t),cancelAll:Sd.bind(null,t),cancelMarketOrders:Ud.bind(null,t),listOpenOrders:$.bind(null,t),fetchOrder:ba.bind(null,t)}}function Qa(t){return {fetchTradingApprovalsState:nb.bind(null,t)}}function Me(t){let e=Qa(t);return t.isPublicClient()?e:{...e,fetchTradingApprovalsState:r=>nb(t,{user:t.account.wallet},r),setupTradingApprovals:qb.bind(null,t),approveErc20:gb.bind(null,t),approveErc1155ForAll:kb.bind(null,t),transferErc20:Wh.bind(null,t),convert:Cd.bind(null,t),prepareConvert:Ad.bind(null,t),horizontalSplit:Gd.bind(null,t),prepareHorizontalSplit:Ed.bind(null,t),horizontalMerge:Kd.bind(null,t),prepareHorizontalMerge:Id.bind(null,t),splitPosition:og.bind(null,t),mergePositions:Ag.bind(null,t),redeemPositions:Jg.bind(null,t),planCollateralReturn:vc$1.bind(null,t),executeCollateralReturnPlan:zc.bind(null,t)}}function Es(t){return t.isSecureClient()?{...Ae(t),...we(t),...ke(t),...Te(t),...Oe(t),...xe(t),...qs(t),...vs(t),...Fe(t),...Cs(t),...Me(t)}:{...Ae(t),...we(t),...ke(t),...Te(t),...Oe(t),...xe(t),...Fe(t),...Me(t)}}var Ie={name:"production",chainId:137,rpc:"https://unconfigured.invalid",walletDerivation:{depositWalletFactory:expectEvmAddress("0x2CcdC6C5dDcd895aFcCD259F291de9b618A5cA6c"),depositWalletBeacon:expectEvmAddress("0x74a618eBdd62Ff8579A8FE94f5B888d7623b9C35"),depositWalletImplementation:expectEvmAddress("0x65507Fa36589B3b2ceD54E77999909e843691e44"),proxyFactory:expectEvmAddress("0xaB45c5A4B0c941a2F231C04C3f49182e1A254052"),proxyImplementation:expectEvmAddress("0x44e999d5c2F66Ef0861317f9A4805AC2e90aEB4f"),safeFactory:expectEvmAddress("0xaacFeEa03eb1561C4e67d661e40682Bd20E3541b"),safeInitCodeHash:"0x2bce2127ff07fb632d16c8347c4ebf501f4841168bed00d9e6ef715ddb6fcecf"},contracts:{collateralToken:expectEvmAddress("0x3c499c542cef5e3811e1192ce70d8cc03d5c3359"),conditionalTokens:expectEvmAddress("0x4682048725865bf17067bd85fF518527A262A9C7"),negRiskAdapter:expectEvmAddress("0xd9416E904e1ab925ad72F03F6D6ce0Aa80fd2dC5"),collateralAdapter:expectEvmAddress("0xAdA100Db00Ca00073811820692005400218FcE1f"),negRiskCollateralAdapter:expectEvmAddress("0xadA2005600Dec949baf300f4C6120000bDB6eAab"),standardExchange:expectEvmAddress("0xaa1b8dE834E16eC69C044F5300041673C968c9eF"),negRiskExchange:expectEvmAddress("0xe7FA09cA716FDf498d74AFF618d32AFeacc310aB"),exchangeV3:expectEvmAddress("0xe3333700cA9d93003F00f0F71f8515005F6c00Aa"),protocolV2Router:expectEvmAddress("0x12121212006e4CD160D18e3f00711DA5c3372600"),binaryModule:expectEvmAddress("0x1000008dD9001B968442c1000017eaE6E0dA00Ba"),negRiskModule:expectEvmAddress("0x200000900045e3B6259600682756002200028933"),combinatorialModule:expectEvmAddress("0x30000034706c7d8e12009dab006be20000c031a8"),positionManager:expectEvmAddress("0x006F54F7f9A22e0000CC2AB60031000000ae9fEF"),autoRedeemOperator:expectEvmAddress("0xa1200000d0002264C9a1698e001292D00E1b00af"),safeMultisend:expectEvmAddress("0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761"),relayHub:expectEvmAddress("0xE2a6dC9a931538adB7efFA2E1D9eC60a65735117"),perpsDepositContract:expectEvmAddress("0xDCa4af75705dbB50f62437045afF9921947917d2")},predictions:{rest:"https://unconfigured.invalid"},clob:{rest:"https://unconfigured.invalid",market:{ws:"wss://unconfigured.invalid/ws/market"},user:{ws:"wss://unconfigured.invalid/ws/user"}},relayer:{rest:"https://unconfigured.invalid"},gamma:{rest:"https://unconfigured.invalid"},data:{rest:"https://unconfigured.invalid"},combos:{rest:"https://unconfigured.invalid",ws:"wss://unconfigured.invalid/ws/rfq",builderGateway:{rest:"https://unconfigured.invalid"},collateralReturn:{rest:"https://unconfigured.invalid"}},perps:{rest:"https://unconfigured.invalid",ws:"wss://unconfigured.invalid/v1/ws"},realtime:{ws:"wss://unconfigured.invalid/ws"},rtds:{ws:"wss://unconfigured.invalid"},sports:{ws:"wss://unconfigured.invalid/ws"},relayerMaxPolls:100,relayerPollFrequencyMs:2e3};function Ha(t,e=Ie){return {...e,...t,walletDerivation:{...e.walletDerivation,...t.walletDerivation},contracts:{...e.contracts,...t.contracts},clob:{...A(e.clob,t.clob),market:D(e.clob.market,t.clob?.market),user:D(e.clob.user,t.clob?.user)},predictions:A(e.predictions,t.predictions),relayer:A(e.relayer,t.relayer),gamma:A(e.gamma,t.gamma),data:A(e.data,t.data),combos:{...As(e.combos,t.combos),builderGateway:A(e.combos.builderGateway,t.combos?.builderGateway),collateralReturn:A(e.combos.collateralReturn,t.combos?.collateralReturn)},perps:As(e.perps,t.perps),realtime:D(e.realtime,t.realtime),rtds:D(e.rtds,t.rtds),sports:D(e.sports,t.sports)}}function A(t,e){return {...t,...e,headers:Le(t.headers,e?.headers)}}function D(t,e){return {...t,...e,headers:Le(t.headers,e?.headers)}}function As(t,e){return {...t,...e,headers:Le(t.headers,e?.headers)}}function Le(t,e){if(!(t===void 0&&e===void 0))return {...t,...e}}var dd=Ha({name:"preproduction",predictions:{rest:"https://unconfigured.invalid"},clob:{rest:"https://unconfigured.invalid"},data:{rest:"https://unconfigured.invalid"},gamma:{rest:"https://unconfigured.invalid"},relayer:{rest:"https://unconfigured.invalid"}});function g(t,e){let r;return {close:()=>(r===void 0&&(r=Promise.resolve(t.return()).then(()=>e())),r),[Symbol.asyncIterator](){return t[Symbol.asyncIterator]()}}}var R=class{#e=new Set;#r;constructor(e){this.#r=e?.deriveServerState??(()=>{});}add(e,r={}){let s={queue:pushable({objectMode:true})};r.matches!==void 0&&(s.matches=r.matches);let i={subscription:e,subscriber:s};return {change:this.#t(i),entry:i}}#t(e){let r=this.serverState();return this.#e.add(e),{before:r,after:this.serverState()}}remove(e){let r=this.serverState();return this.#e.delete(e),e.subscriber.queue.end(),{before:r,after:this.serverState()}}dispatch(e){for(let{subscriber:r}of this.#e)(r.matches===void 0||r.matches(e))&&r.queue.push(e);}hasActiveSubscriptions(){return this.#e.size>0}endAll(e){for(let{subscriber:r}of this.#e)r.queue.end(e);this.#e.clear();}serverState(){return this.#r(this.#e)}};function Be(t,e,r){let s=N(r.assetsIds,e.assetsIds),i=N(e.assetsIds,r.assetsIds);s.length>0&&t(ws(s,r.customFeatureEnabled));let n=r.assetsIds[0];s.length===0&&e.customFeatureEnabled!==r.customFeatureEnabled&&n!==void 0&&t(ws([n],r.customFeatureEnabled)),i.length>0&&t(za(i));}function Ue(t,e,r){if(r.includeAllMarkets){!e.includeAllMarkets&&e.markets.length>0&&t(Ts(e.markets));return}if(e.includeAllMarkets){r.markets.length>0&&t(ks(r.markets));return}let s=N(r.markets,e.markets),i=N(e.markets,r.markets);s.length>0&&t(ks(s)),i.length>0&&t(Ts(i));}function Os(t){let e=new Set,r=false;for(let{subscription:s}of t){for(let i of s.assetIds??s.tokenIds)e.add(i);r||=s.customFeatureEnabled===true;}return {assetsIds:Array.from(e),customFeatureEnabled:r}}function xs(t){let e=false,r=new Set;for(let{subscription:s}of t){if(Bs(s)){e=true;continue}for(let i of s.markets??[])r.add(i);}return {includeAllMarkets:e,markets:e?[]:Array.from(r)}}function Fs(t){return {assets_ids:t.assetsIds,custom_feature_enabled:t.customFeatureEnabled,type:"market"}}function ws(t,e){return {assets_ids:t,custom_feature_enabled:e,operation:"subscribe"}}function za(t){return {assets_ids:t,operation:"unsubscribe"}}function Ms(t,e){let r={auth:{apiKey:e.key,passphrase:e.passphrase,secret:e.secret},type:"user"};return t.includeAllMarkets||(r.markets=t.markets),r}function ks(t){return {markets:t,operation:"subscribe"}}function Ts(t){return {markets:t,operation:"unsubscribe"}}function Is(t){let e=t.assetIds??t.tokenIds;return r=>{switch(r.type){case "price_change":return r.payload.priceChanges.some(s=>e.includes(s.assetId));case "new_market":return t.customFeatureEnabled===true;case "market_resolved":return t.customFeatureEnabled===true&&(r.payload.assetIds??[]).some(s=>e.includes(s));case "best_bid_ask":return t.customFeatureEnabled===true&&e.includes(r.payload.assetId);default:return e.includes(r.payload.assetId)}}}function Ls(t){if(Bs(t))return ()=>true;let e=new Set((t.markets??[]).map(r=>r.toLowerCase()));return r=>e.has(r.payload.market.toLowerCase())}function Bs(t){return (t.markets?.length??0)===0}function N(t,e){let r=new Set(e);return t.filter(s=>!r.has(s))}var w=class{#e;#r;#t;#o=new Pe({heartbeat:new Je});#a=new Oe$1;#s=new R({deriveServerState:Os});constructor(e){this.#e=e.headers,this.#r=e.url;}async subscribe(e){let{change:r,entry:s}=this.#s.add(e,{matches:Is(e)});return await this.#i(s,r),g(s.subscriber.queue,()=>this.#n(s))}async#i(e,r){let{before:s,after:i}=r;try{(await this.#c()).reusedOpenSocket&&Be(o=>this.#o.send(o),s,i);}catch(n){throw await this.#n(e),n}}async#n(e){let{before:r,after:s}=this.#s.remove(e);if(!this.#s.hasActiveSubscriptions()){await this.close();return}Be(i=>this.#o.send(i),r,s);}async close(){this.#t===void 0&&(this.#t=this.#p().finally(()=>{this.#t=void 0;})),await this.#t;}async#p(){this.#a.stop(),this.#s.endAll(),await this.#o.close();}#c(){return this.#o.connect({onConnectionLost:()=>this.#l(),onError:()=>this.#m(),onMessage:e=>this.#d(e),onOpen:()=>this.#u(),headers:this.#e,url:this.#r})}#u(){this.#a.resetBackoff(),this.#f();}#d(e){let r=Array.isArray(e)?e:[e];for(let s of r){let i=MarketEventSchema.safeParse(s);i.success&&this.#s.dispatch(i.data);}}#l(){this.#s.hasActiveSubscriptions()&&this.#h();}#m(){}#f(){this.#o.send(Fs(this.#s.serverState()));}#h(){this.#a.schedule({reconnect:()=>this.#c(),shouldReconnect:()=>this.#s.hasActiveSubscriptions()});}};var O=class{#e;#r;#t;#o;#a=new Pe({heartbeat:new Je});#s=new Oe$1;#i=new R({deriveServerState:xs});constructor(e){this.#e=e.credentials,this.#r=e.headers,this.#t=e.url;}async subscribe(e){let{change:r,entry:s}=this.#i.add(e,{matches:Ls(e)});return await this.#n(s,r),g(s.subscriber.queue,()=>this.#p(s))}async#n(e,r){let{before:s,after:i}=r;try{(await this.#u()).reusedOpenSocket&&Ue(o=>this.#a.send(o),s,i);}catch(n){throw await this.#p(e),n}}async#p(e){let{before:r,after:s}=this.#i.remove(e);if(!this.#i.hasActiveSubscriptions()){await this.close();return}Ue(i=>this.#a.send(i),r,s);}async close(){this.#o===void 0&&(this.#o=this.#c().finally(()=>{this.#o=void 0;})),await this.#o;}async#c(){this.#s.stop(),this.#i.endAll(),await this.#a.close();}#u(){return this.#a.connect({onConnectionLost:()=>this.#m(),onError:()=>this.#f(),onMessage:e=>this.#l(e),onOpen:e=>this.#d(e),prepare:()=>this.#e,headers:this.#r,url:this.#t})}#d(e){this.#s.resetBackoff(),this.#h(e);}#l(e){let r=Array.isArray(e)?e:[e];for(let s of r){let i=UserEventSchema.safeParse(s);i.success&&this.#i.dispatch(i.data);}}#m(){this.#i.hasActiveSubscriptions()&&this.#y();}#f(){}#h(e){this.#a.send(Ms(this.#i.serverState(),e));}#y(){this.#s.schedule({reconnect:()=>this.#u(),shouldReconnect:()=>this.#i.hasActiveSubscriptions()});}};var x=class{#e;#r;#t;#o;#a;#s=new Set;#i=new Set;#n=new Set;#p=false;constructor(e){this.#e=e.chainId,this.#r=e.fetch,this.#t=e.headers,this.#o=e.restUrl,this.#a=e.wsUrl;}connect(e,r,s,i){if(this.#p)return Promise.reject(new d("Perps session manager has been shut down."));let n=new ef({builderAttribution:r,approveBuilderFee:s,includeBuilderFills:i,chainId:this.#e,credentials:e,fetch:this.#r,headers:this.#t,onClose:a=>this.#c(a),restUrl:this.#o,wsUrl:this.#a});this.#i.add(n);let o;return o=(async()=>{try{if(await n.connect(),this.#p)throw await n.close(),new d("Perps session manager has been shut down.");return this.#s.add(n),n}catch(a){throw await n.close(),a}finally{this.#n.delete(o),this.#i.delete(n);}})(),this.#n.add(o),o}async shutdown(){this.#p=true;let e=Array.from(this.#s),r=Array.from(this.#i),s=Array.from(this.#n);this.#s.clear(),this.#i.clear(),this.#n.clear(),await Promise.allSettled([...e.map(i=>i.close()),...r.map(i=>i.close()),...s.map(i=>i.catch(()=>{}))]).then(()=>{});}#c(e){this.#s.delete(e),this.#i.delete(e);}};var k=class{#e;#r;#t;#o=1;#a=new Pe({heartbeat:new Me$1});#s=new Oe$1;#i=new R({deriveServerState:$a});constructor(e){this.#e=e.headers,this.#r=e.url;}async subscribe(e){let{change:r,entry:s}=this.#i.add(e,{matches:Ja(e)});return await this.#n(s,r),g(s.subscriber.queue,()=>this.#p(s))}async#n(e,r){try{(await this.#u()).reusedOpenSocket&&(this.#h(Us(r.before,r.after)),this.#y(Ds(r.before,r.after)));}catch(s){throw await this.#p(e),s}}async#p(e){let{before:r,after:s}=this.#i.remove(e);this.#h(Us(r,s)),this.#y(Ds(r,s)),this.#i.hasActiveSubscriptions()||await this.close();}async close(){this.#t===void 0&&(this.#t=this.#c().finally(()=>{this.#t=void 0;})),await this.#t;}async#c(){this.#s.stop(),this.#i.endAll(),await this.#a.close();}#u(){return this.#a.connect({onConnectionLost:()=>this.#m(),onError:()=>this.#f(),onMessage:e=>this.#l(e),onOpen:()=>this.#d(),headers:this.#e,url:this.#r})}#d(){this.#s.resetBackoff(),this.#h(Array.from(this.#i.serverState()));}#l(e){let r=PerpsMarketDataEventSchema.safeParse(e);r.success&&this.#i.dispatch(r.data);}#m(){this.#i.hasActiveSubscriptions()&&this.#b();}#f(){}#h(e){e.length!==0&&this.#a.send(this.#S("sub",e));}#y(e){e.length!==0&&this.#a.send(this.#S("unsub",e));}#S(e,r){return {id:this.#o++,req:e,chs:r}}#b(){this.#s.schedule({reconnect:()=>this.#u(),shouldReconnect:()=>this.#i.hasActiveSubscriptions()});}};function $a(t){let e=new Set,r=new Set,s=new Set,i=false,n=false;for(let{subscription:o}of t)switch(o.topic){case "perps.tickers":o.instrumentId===void 0?i=true:r.add(o.instrumentId);break;case "perps.statistics":o.instrumentId===void 0?n=true:s.add(o.instrumentId);break;default:e.add(Ga(o));}if(i)e.add("tickers::all");else for(let o of r)e.add(`tickers::${o}`);if(n)e.add("statistics::all");else for(let o of s)e.add(`statistics::${o}`);return e}function Us(t,e){return Array.from(e).filter(r=>!t.has(r))}function Ds(t,e){return Array.from(t).filter(r=>!e.has(r))}function Ga(t){switch(t.topic){case "perps.trades":return `trades::${t.instrumentId}`;case "perps.bbo":return `bbo::${t.instrumentId}`;case "perps.book":return `book::${t.instrumentId}`;case "perps.candles":return `klines::${t.instrumentId}::${t.interval}`;case "perps.tickers":return t.instrumentId===void 0?"tickers::all":`tickers::${t.instrumentId}`;case "perps.statistics":return t.instrumentId===void 0?"statistics::all":`statistics::${t.instrumentId}`;default:invariant(false,`Unknown Perps topic: ${String(t)}`);}}function Ja(t){switch(t.topic){case "perps.trades":return e=>e.topic==="perps.trades"&&e.channel===`trades::${t.instrumentId}`;case "perps.bbo":case "perps.book":return e=>e.topic===t.topic&&e.payload.instrumentId===t.instrumentId;case "perps.candles":return e=>e.topic==="perps.candles"&&e.payload.instrumentId===t.instrumentId&&e.payload.interval===t.interval;case "perps.tickers":case "perps.statistics":return e=>e.topic===t.topic&&(t.instrumentId===void 0||e.payload.instrumentId===t.instrumentId);default:invariant(false,`Unknown Perps topic: ${String(t)}`);}}function Ks(t){let e="symbol"in t?[t.symbol.toLowerCase()]:t.symbols,{provider:r}=t;return e.map(s=>t.topic==="prices.crypto.twap"||t.topic==="prices.equity.twap"?{key:JSON.stringify([t.topic,s,60,r]),topic:t.topic,symbol:s,windowSeconds:60,provider:r}:{key:JSON.stringify([t.topic,s,r]),topic:t.topic,symbol:s,provider:r})}function Qs(t,e){return Math.random()*(t===4003?1e4:Math.min(1e3*2**e,3e4))}var G=class{#e;#r=new Oe$1;#t=new Map;#o=[];#a;#s;#i=false;#n=false;#p=false;#c=false;#u;#d=0;#l=64;#m=Number.NEGATIVE_INFINITY;constructor(e){this.#e=e;}get size(){return this.#t.size}has(e){return this.#t.has(e)}get closed(){return this.#n}get keyTarget(){return Date.now()-this.#m>=6e4?64:this.#l}add(e,r){clearTimeout(this.#s);let s=this.#t.get(e.key);if(s===void 0){let{promise:i,resolve:n,reject:o}=Promise.withResolvers();i.catch(()=>{}),s={subscription:e,listeners:new Set,ready:i,resolve:n,reject:o,subscribed:false,accepted:false},this.#t.set(e.key,s),this.#i&&this.#y("subscribe",[s]);}return s.listeners.add(r),s.confirmation!==void 0&&r.subscribed?.({...s.confirmation}),s.snapshot!==void 0&&r.event(s.snapshot),!this.#i&&!this.#c&&this.#u===void 0&&!this.#r.isScheduled&&this.#f(),Za(s.ready)}remove(e,r){let s=this.#t.get(e);s!==void 0&&(s.listeners.delete(r),!(s.listeners.size>0)&&(this.#t.delete(e),s.reject(new d("Realtime subscription closed.")),this.#i&&this.#y("unsubscribe",[s]),this.#t.size===0&&(this.#s=setNonBlockingTimeout(()=>{this.close();},1e3))));}#f(){if(this.#n||this.#c)return Promise.resolve();if(this.#u!==void 0)return this.#u;let e=this.#h().catch(r=>{this.#C([...this.#t.values()].filter(s=>!s.accepted),d.fromError(r));}).finally(()=>{this.#u===e&&(this.#u=void 0),this.#i||this.#v(1006);});return this.#u=e,e}async#h(){let e=this.#d;if(await this.#e.open({subscribed:(r,s)=>this.#P(r,s),event:r=>this.#g(r),dropped:()=>this.#q(),disconnected:r=>this.#w(r)}),!(this.#n||e!==this.#d))try{if(await this.#e.authorize(),this.#n||e!==this.#d)return;this.#i=!0,this.#y("subscribe",[...this.#t.values()]);}catch(r){if(this.#n||e!==this.#d)return;r instanceof i&&r.code!==RealtimeKnownErrorCode.AuthUnavailable?this.#A(r):await this.#E(1006);}}#y(e,r){if(r.length===0)return;let s=this.#o.at(-1);s?.op===e?s.keys.push(...r):this.#o.push({op:e,keys:r}),this.#S();}#S(){this.#a!==void 0||this.#p||!this.#i||this.#n||(this.#a=setNonBlockingTimeout(()=>{this.#a=void 0,this.#b();},10));}async#b(){if(!this.#i||this.#n)return;let e=this.#o.shift();if(e===void 0)return;let r=[...new Set(e.keys)].filter(i=>e.op==="unsubscribe"||this.#t.get(i.subscription.key)===i);if(r.length===0){this.#S();return}let s=this.#d;this.#p=true;try{let i=await this.#e.change(e.op,r.map(({subscription:n})=>n));if(s!==this.#d||this.#n)return;if(e.op==="unsubscribe"&&i.length>0){let n=i[0];if(n!==void 0)throw n.error}if(e.op==="subscribe"){this.#r.resetBackoff();let n=new Set(i.map(o=>o.key));for(let o of r)n.has(o.subscription.key)||(o.subscribed=!0,o.accepted=!0,o.resolve());for(let{key:o,error:a}of i){let u=r.find(d=>d.subscription.key===o);u!==void 0&&this.#C([u],a,!1);}}}catch(i$1){if(s!==this.#d||this.#n)return;i$1 instanceof i&&e.op==="subscribe"?this.#C(r,i$1):await this.#E(1006);}finally{this.#p=false,this.#S();}}#P(e,r){let s=this.#t.get(e.key);if(s?.subscription===e){s.confirmation={...r};for(let i of [...s.listeners])i.subscribed?.({...r});}}#g(e){for(let r of this.#t.values()){let s=r.subscription;if(s.topic!==e.topic)continue;let i=e.payload;if(i.symbol.toLowerCase()===s.symbol&&!((s.topic==="prices.crypto.twap"||s.topic==="prices.equity.twap")&&(!("windowSeconds"in i)||i.windowSeconds!==s.windowSeconds))){r.snapshot=Xa(r.snapshot,e);for(let n of r.listeners)n.event(e);}}}#q(){let e=Date.now();e-this.#m<5e3||(this.#l=Math.max(1,Math.floor(this.keyTarget/2)),this.#m=e);}#R(){this.#d++,this.#i=false,this.#o=[],clearTimeout(this.#a),this.#a=void 0;for(let e of this.#t.values()){if(e.snapshot=void 0,e.confirmation=void 0,!e.subscribed)continue;let{promise:r,resolve:s,reject:i}=Promise.withResolvers();r.catch(()=>{}),e.ready=r,e.resolve=s,e.reject=i,e.subscribed=false;}}#w(e){let r=new g$1("Realtime connection closed.",e);this.#R(),e.code===4001||e.code===4008?this.#A(r):this.#v(e.code);}async#E(e){this.#c=true,this.#R();try{await this.#e.close();}finally{this.#c=false,this.#v(e);}}#v(e){this.#r.schedule({delayPolicy:r=>Qs(e,r),shouldReconnect:()=>!this.#n&&this.#t.size>0,reconnect:()=>this.#f()});}#A(e){let r=[...this.#t.values()],s=new Set(r.flatMap(i=>[...i.listeners]));for(let i of r)i.reject(e);for(let i of s)i.end(e);this.close();}#C(e,r,s=true){let i=e.filter(o=>this.#t.get(o.subscription.key)===o),n=new Set(i.flatMap(o=>[...o.listeners]));for(let o of i)this.#t.delete(o.subscription.key),o.reject(r);s&&this.#i&&this.#y("unsubscribe",i);for(let o of n)o.end(r);this.#t.size===0&&(this.#s=setNonBlockingTimeout(()=>{this.close();},1e3));}async close(){if(this.#n)return;this.#n=true,this.#r.stop(),clearTimeout(this.#s);let e=new d("Realtime connection closed.");this.#R();for(let r of this.#t.values())r.reject(e);this.#t.clear(),await this.#e.close();}};function Za(t){return new Promise((e,r)=>{let s=setNonBlockingTimeout(()=>{r(new d("Realtime subscription was not accepted within 30 seconds."));},3e4);t.then(()=>{clearTimeout(s),e();},i=>{clearTimeout(s),r(i);});})}function Xa(t,e){if(e.type==="subscribe")return e;let{symbol:r,source:s,timestamp:i,value:n}=e.payload,o=t?.type==="subscribe"&&t.payload.source===s?t.payload.data:[];if((o.at(-1)?.timestamp??0)>i)return t;let a=[...o.filter(u=>u.timestamp>i-12e4&&u.timestamp<i),{timestamp:i,value:n}];return e.topic==="prices.crypto.twap"||e.topic==="prices.equity.twap"?{...e,type:"subscribe",payload:{symbol:r,source:s,data:a,windowSeconds:e.payload.windowSeconds}}:{...e,type:"subscribe",payload:{symbol:r,source:s,data:a}}}var Y=class{#e;#r=new Pe({heartbeat:new Ne,connectTimeoutMs:1e4,closeTimeoutMs:1e3});#t=new Map;#o;#a=0;#s=0;#i=0;constructor(e){this.#e=e;}async open(e){this.#o=e;let r=this.#i;await this.#r.connect({url:this.#e.url,headers:this.#e.headers,onOpen:()=>{},onError:()=>{},onConnectionLost:s=>{r===this.#i&&(this.#c(new g$1("Realtime connection closed.",s)),e.disconnected(s));},onMessage:s=>{r===this.#i&&this.#p(s);}});}async authorize(){let{key:e,secret:r,passphrase:s}=this.#e.credentials;await this.#n({op:"auth",auth:{apiKey:e,secret:r,passphrase:s}},PolyboltAckOp.Authed,[]);}async change(e,r){let s=[],i=0;for(;i<r.length;){let n=[];for(;i+n.length<r.length;){let a=r[i+n.length];if(a===void 0)break;let u=sc(a),d={op:e,subscriptions:[...n,u],rid:String(this.#a+1)};if(n.length>0&&new TextEncoder().encode(JSON.stringify(d)).length>6e4)break;n.push(u);}let o=await this.#n({op:e,subscriptions:n},e==="subscribe"?PolyboltAckOp.Subscribed:PolyboltAckOp.Unsubscribed,n.map(({channel:a})=>a),r.slice(i,i+n.length));for(let{index:a,error:u}of o){let d=r[i+a];d!==void 0&&s.push({key:d.key,error:u});}i+=n.length;}return s}#n(e,r,s,i=[]){let n=String(++this.#a);return new Promise((o,a)=>{let u={op:r,channels:[...s],subscriptions:i,rejections:[],resolve:o,reject:a};this.#t.set(n,u),u.sendTimer=setNonBlockingTimeout(()=>{u.timer=setNonBlockingTimeout(()=>{this.#t.delete(n),a(new d("Realtime acknowledgement timed out after 10 seconds."));},1e4),this.#s=Date.now();try{if(!this.#r.send({...e,rid:n}))throw new d("Realtime connection is not open.")}catch(d$1){clearTimeout(u.timer),this.#t.delete(n),a(d.fromError(d$1));}},Math.max(0,110-(Date.now()-this.#s)));})}#p(e){let r=PolyboltAckSchema.safeParse(e);if(r.success){let{op:n,rid:o,code:a,channel:u,provider:d}=r.data,c=o===void 0?void 0:this.#t.get(o);if(c===void 0)return;if(n===PolyboltAckOp.Error&&a!==void 0){let S=new i(`Realtime subscription rejected: ${a}`,{status:200,code:a}),f=c.channels.flatMap((m,C)=>m===u?[C]:[]);if(u===void 0||f.length!==1)c.reject(S);else {let m=f[0];if(m===void 0||(c.channels[m]=void 0,c.rejections.push({index:m,error:S}),c.channels.some(C=>C!==void 0)))return;c.resolve(c.rejections);}}else if(n===c.op){if(c.channels.length>0){let S=c.channels.findIndex(m=>m!==void 0);if(S<0||c.channels[S]!==u)return;c.channels[S]=void 0;let f=c.subscriptions[S];if(n===PolyboltAckOp.Subscribed&&f!==void 0&&this.#o?.subscribed(f,{symbol:f.symbol,provider:d}),c.channels.some(m=>m!==void 0))return}c.resolve(c.rejections);}else return;clearTimeout(c.timer),o!==void 0&&this.#t.delete(o);return}let s=PolyboltEnvelopeSchema.safeParse(e);if(!s.success)return;let i$1=parsePolyboltEvent(s.data);i$1!==void 0&&this.#o?.event(i$1),(s.data.dropped??0)>0&&this.#o?.dropped();}#c(e){for(let r of this.#t.values())clearTimeout(r.sendTimer),clearTimeout(r.timer),r.reject(e);this.#t.clear();}async close(){this.#i++,this.#o=void 0,this.#c(new d("Realtime connection closed.")),await this.#r.close();}};function sc(t){switch(t.topic){case "prices.crypto":return {channel:PolyboltChannel.Crypto,filter:{symbol:t.symbol,provider:t.provider}};case "prices.crypto.twap":return {channel:PolyboltChannel.Twap,filter:{symbol:t.symbol,window_seconds:t.windowSeconds,provider:t.provider}};case "prices.equity":return {channel:PolyboltChannel.Equity,filter:{symbol:t.symbol,provider:t.provider}};case "prices.equity.twap":return {channel:PolyboltChannel.EquityTwap,filter:{symbol:t.symbol,window_seconds:t.windowSeconds,provider:t.provider}}}}var Z=class{#e;#r=new Map;#t=new Set;constructor(e){this.#e=e;}async subscribe(e){let r=[...new Map(Ks(e).map(d=>[d.key,d])).values()],s=pushable({objectMode:true}),i=[],n=false,o,a=async()=>{if(!n){n=true;for(let d of i)d();o===void 0?await s.return():s.end(o),this.#t.delete(a);}};this.#t.add(a);let u=d$1=>{n||(o=d.fromError(d$1),s.end(o),a());};try{let d=r.map(c=>{if(n)return Promise.resolve();let S=this.#o(c.key,c.provider),f={subscribed(m){if(!(n||!("onSubscribed"in e)))try{Promise.resolve(e.onSubscribed?.(m)).catch(u);}catch(C){u(C);}},event(m){if(n||"types"in e&&e.types!==void 0&&e.types.length>0&&!e.types.includes(m.type))return;let C="symbol"in m.payload?{...m.payload,symbol:"symbol"in c?c.symbol:m.payload.symbol}:m.payload;s.push({...m,payload:C});},end(m){o=m,s.end(m),a();}};return i.push(()=>S.remove(c.key,f)),S.add(c,f)});for(let c of d)c.catch(()=>{});if(await Promise.all(d),o!==void 0)throw o}catch(d){throw await a(),o??d}return {close:a,async*[Symbol.asyncIterator](){try{yield*s;}finally{await a();}}}}#o(e,r){for(let i of this.#r.keys())if(i.closed)this.#r.delete(i);else if(i.has(e))return i;for(let[i,n]of this.#r)if(n===r&&i.size<i.keyTarget)return i;let s=new G(new Y(this.#e));return this.#r.set(s,r),s}async close(){await Promise.all([...this.#t].map(r=>r()));let e=[...this.#r.keys()];this.#r.clear(),await Promise.all(e.map(r=>r.close()));}};var K=class{#e;constructor(e){this.#e=new Z(e);}async subscribe(e){return this.#e.subscribe(e)}async close(){await this.#e.close();}};function zs(t,e){return {...e,quote:r=>t.quote(e,r)}}function js(t,e){let r=e.rfqId,s=e.quoteId;return {...e,confirm:()=>t.respondToConfirmation(r,s,RfqConfirmationDecision.Confirm),decline:()=>t.respondToConfirmation(r,s,RfqConfirmationDecision.Decline)}}function Vs(t){return {quoteId:t.quoteId,rfqId:t.rfqId}}function Ns(t){return {quoteId:t.quoteId,rfqId:t.rfqId}}function $s(t){return {quoteId:t.quoteId,rfqId:t.rfqId}}function Gs(t,e){let r=V(t);return {auth:{apiKey:e.key,passphrase:e.passphrase,secret:e.secret},identity:{maker_address:r.maker,signature_type:r.signatureType,signer_address:r.signer},type:"auth"}}function Js(t,e){return {price_e6:e.price.toString(),rfq_id:t.rfqId,signed_order:e.signedOrder,size_e6:e.size.toString(),type:"RFQ_QUOTE"}}function Ys(t,e,r){let s=V(t);return {maker_address:s.maker,quote_id:r,rfq_id:e,signer_address:s.signer,type:"RFQ_QUOTE_CANCEL"}}function Zs(t,e,r){return {decision:r,quote_id:e,rfq_id:t,type:"RFQ_CONFIRMATION_RESPONSE"}}var X=class{#e=new Map;#r;constructor(e){this.#r=e;}waitFor(e,r){let s=oc(),i,n=setNonBlockingTimeout(()=>{this.remove(e,i),s.reject(new l(r));},this.#r);i=s.promise.finally(()=>clearTimeout(n));let o=this.#e.get(e)??[];return o.push({...s,promise:i}),this.#e.set(e,o),i}resolve(e,r){let s=this.#e.get(e),i=s?.shift();i!==void 0&&(s!==void 0&&s.length===0&&this.#e.delete(e),i.resolve(r));}reject(e,r){let s=this.#e.get(e),i=s?.shift();i!==void 0&&(s!==void 0&&s.length===0&&this.#e.delete(e),i.reject(r));}remove(e,r){let s=this.#e.get(e);if(s===void 0)return;let i=s.filter(n=>n.promise!==r);i.length===0?this.#e.delete(e):this.#e.set(e,i);}rejectAll(e){for(let r of this.#e.values())for(let s of r)s.reject(e);this.#e.clear();}};function oc(){let t,e;return {promise:new Promise((s,i)=>{t=s,e=i;}),reject:e,resolve:t}}var ei="0x0000000000000000000000000000000000000000000000000000000000000000";async function ti(t){let e=V(t.account),r=fe({chainId:t.chainId,exchange:t.exchange}),s$1={builder:ei,maker:e.maker,makerAmount:toBaseUnits(ge(t.orderSide,t.orderPrice,t.size)),metadata:ei,salt:ac().toString(),side:ie(t.orderSide),signatureType:e.signatureType,signer:e.signer,takerAmount:toBaseUnits(he(t.orderSide,t.orderPrice,t.size)),timestamp:Math.floor(Date.now()/1e3).toString(),tokenId:t.tokenId},i;try{i=await t.signer.signTypedData(de({domain:r,order:s$1}));}catch(n){throw s.fromError(n,"Could not sign the RFQ quote order.")}return {...s$1,signature:ee$1({domain:r,order:s$1,signature:i})}}function ac(){let t=new Uint8Array(8);return globalThis.crypto.getRandomValues(t),BigInt(`0x${Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}`)}var ii=DecimalishSchema.transform(t=>ai(t)).refine(t=>t<=BigInt(Number.MAX_SAFE_INTEGER),{message:"Value exceeds the temporary numeric wire limit."}),pc=z.strictObject({price:ii.refine(t=>t<1000000n,{message:"Price must be less than 1."}),size:ii.optional(),source:z.enum(["collateral","inventory"]).default("collateral")});function ni(t){return a$1(t,pc)}async function oi(t){let e=t.response.price,r=t.response.size===void 0?hc(t.request.requestedSize,e):t.response.size,s=await ti({account:t.account,chainId:t.chainId,exchange:t.exchange,orderPrice:lc(t.request,t.response.source,e),orderSide:mc(t.response.source),signer:t.signer,size:r,tokenId:dc(t.request,t.response.source)});return {price:e,signedOrder:s,size:r}}function dc(t,e){return t.direction===RfqDirection.Buy?e==="collateral"?t.noPositionId:t.yesPositionId:e==="collateral"?t.yesPositionId:t.noPositionId}function lc(t,e,r){return t.direction===RfqDirection.Buy&&e==="collateral"||t.direction===RfqDirection.Sell&&e==="inventory"?1000000n-r:r}function mc(t){return t==="collateral"?OrderSide.BUY:OrderSide.SELL}function hc(t,e){let r=ai(t.value);return t.unit===RfqRequestedSizeUnit.Shares?r:r*1000000n/e}function ai(t){let e=/^(\d+)(?:\.(\d*))?$/.exec(t);if(e===null)throw new a("Value must be a valid decimal.");let[,r="",s=""]=e;if(s.length>6)throw new a("Value must have at most 6 decimal places.");let i=BigInt(r)*1000000n+BigInt(s.padEnd(6,"0"));if(i<=0n)throw new a("Value must be greater than 0.");return i}var bc=3e4,Rc=3e4,F=class{#e;#r;#t;#o;#a;#s;#i;#n;#p;#c;#u=false;constructor(e){this.#e=e.account,this.#r=e.chainId,this.#t=e.credentials,this.#o=e.exchange,this.#a=e.headers,this.#s=e.signer,this.#i=e.url;}async connect(){if(this.#u)throw new d("RFQ quoter manager has been shut down.");if(this.#n!==void 0){if(!this.#n.closed)return this.#n;this.#n=void 0;}if(this.#c!==void 0)return this.#c;let e=new Qe({account:this.#e,chainId:this.#r,credentials:this.#t,exchange:this.#o,headers:this.#a,onClose:()=>this.#d(e),signer:this.#s,url:this.#i});this.#p=e;let r;return r=(async()=>{try{if(await e.connect(),this.#u)throw await e.close(),new d("RFQ quoter manager has been shut down.");return this.#n=e,e}catch(s){throw await e.close(),s}finally{this.#c===r&&(this.#c=void 0),this.#p===e&&(this.#p=void 0);}})(),this.#c=r,r}async shutdown(){this.#u=true;let e=this.#n,r=this.#p,s=this.#c;this.#n=void 0,this.#p=void 0,this.#c=void 0,await Promise.allSettled([e?.close(),r?.close(),s?.catch(()=>{})]).then(()=>{});}#d(e){this.#n===e&&(this.#n=void 0),this.#p===e&&(this.#p=void 0);}},Qe=class{#e;#r;#t;#o;#a;#s;#i;#n;#p=new Pe;#c=pushable({objectMode:true});#u=new X(Rc);#d;#l;constructor(e){this.#e=e.account,this.#r=e.chainId,this.#t=e.credentials,this.#o=e.exchange,this.#a=e.headers,this.#s=e.onClose,this.#i=e.signer,this.#n=e.url;}get closed(){return this.#d!==void 0}async connect(){let e=Pc();this.#l=e;let r=setNonBlockingTimeout(()=>{e.reject(new d("RFQ quoter authentication timed out."));},bc);try{await this.#p.connect({headers:this.#a,onConnectionLost:s=>this.#q(s),onError:()=>{},onMessage:s=>this.#P(s),onOpen:()=>this.#b(),url:this.#n}),await e.promise;}finally{clearTimeout(r),this.#l=void 0;}}async#m(e){if(!this.#p.send(e))throw new d("RFQ quoter websocket is not open.")}async close(){this.#d===void 0&&(this.#d=this.#f()),await this.#d;}[Symbol.asyncIterator](){return this.#c[Symbol.asyncIterator]()}async#f(){let e=new d("RFQ quoter websocket closed.");this.#S(e),this.#c.end(),await this.#p.close(),this.#s();}async#h(e){this.#d===void 0&&(this.#d=this.#y(e)),await this.#d;}async#y(e){this.#S(e),this.#c.end(e),await this.#p.close(),this.#s();}#S(e){this.#l?.reject(e),this.#u.rejectAll(e);}#b(){this.#p.send(Gs(this.#e,this.#t));}#P(e){if(this.#d!==void 0)return;let r=RfqQuoterInboundMessageSchema.safeParse(e);if(!r.success)return;let s=r.data;switch(s.type){case "auth":this.#g(s);return;case "quote_request":this.#c.push(zs(this,s));return;case "quote_ack":this.#u.resolve(ee(s.rfqId),Vs(s));return;case "quote_cancel_ack":this.#u.resolve(We(s.rfqId,s.quoteId),Ns(s));return;case "confirmation_request":this.#c.push(js(this,s));return;case "confirmation_ack":this.#u.resolve(Ke(s.rfqId,s.quoteId),$s(s));return;case "execution_update":this.#c.push(s);return;case "trade":this.#c.push(s);return;case "rfq_error":this.#R(s);return}}#g(e){if(e.success===true){this.#l?.resolve(void 0);return}this.#l?.reject(new d(`RFQ quoter authentication failed: ${e.error}`));}#q(e){this.#h(new g$1("RFQ quoter connection lost.",e));}#R(e){if(e.requestType==="RFQ_QUOTE"){if(e.rfqId===void 0){this.#h(new d("Uncorrelated RFQ quoter error."));return}this.#u.reject(ee(e.rfqId),new Mg(e.message,{code:e.code,errorId:e.errorId,rfqId:e.rfqId}));return}if(e.requestType==="RFQ_QUOTE_CANCEL"){if(e.rfqId===void 0||e.quoteId===void 0){this.#h(new d("Uncorrelated RFQ quoter error."));return}this.#u.reject(We(e.rfqId,e.quoteId),new Og(e.message,{code:e.code,errorId:e.errorId,quoteId:e.quoteId,rfqId:e.rfqId}));return}if(e.requestType==="RFQ_CONFIRMATION_RESPONSE"){if(e.rfqId===void 0||e.quoteId===void 0){this.#h(new d("Uncorrelated RFQ quoter error."));return}this.#u.reject(Ke(e.rfqId,e.quoteId),new Qg(e.message,{code:e.code,errorId:e.errorId,quoteId:e.quoteId,rfqId:e.rfqId}));}}async quote(e,r){let s=ni(r),i=await oi({account:this.#e,chainId:this.#r,exchange:this.#o,request:e,response:s,signer:this.#i}),n=this.#u.waitFor(ee(e.rfqId),`Timed out waiting for RFQ quote acknowledgement for ${e.rfqId}.`);try{return await this.#m(Js(e,i)),await n}catch(o){throw this.#u.remove(ee(e.rfqId),n),o}}async cancelQuote(e){let r=We(e.rfqId,e.quoteId),s=this.#u.waitFor(r,`Timed out waiting for RFQ quote cancellation acknowledgement for ${e.rfqId}.`);try{return await this.#m(Ys(this.#e,e.rfqId,e.quoteId)),await s}catch(i){throw this.#u.remove(r,s),i}}async respondToConfirmation(e,r,s){let i=Ke(e,r),n=this.#u.waitFor(i,`Timed out waiting for RFQ confirmation acknowledgement for ${e}.`);try{return await this.#m(Zs(e,r,s)),await n}catch(o){throw this.#u.remove(i,n),o}}};function ee(t){return `ACK_RFQ_QUOTE:${t}`}function We(t,e){return `ACK_RFQ_QUOTE_CANCEL:${t}:${e}`}function Ke(t,e){return `ACK_RFQ_CONFIRMATION_RESPONSE:${t}:${e}`}function Pc(){let t,e;return {promise:new Promise((s,i)=>{t=s,e=i;}),reject:e,resolve:t}}var M=class{#e;#r;#t;#o=new Pe({heartbeat:new Ke$1});#a=new Oe$1;#s=new R({deriveServerState:Cc});constructor(e){this.#e=e.headers,this.#r=e.url;}async subscribe(e){let{change:r,entry:s}=this.#s.add(e,{matches:Tc(e)});return await this.#i(s,r),g(s.subscriber.queue,()=>this.#n(s))}async#i(e,r){try{if((await this.#c()).reusedOpenSocket){let{before:i,after:n}=r,o=qc(i,n);this.#h(o);}}catch(s){throw await this.#n(e),s}}async#n(e){let{before:r,after:s}=this.#s.remove(e),i=vc(r,s);this.#y(i),this.#s.hasActiveSubscriptions()||await this.close();}async close(){this.#t===void 0&&(this.#t=this.#p().finally(()=>{this.#t=void 0;})),await this.#t;}async#p(){this.#a.stop(),this.#s.endAll(),await this.#o.close();}#c(){return this.#o.connect({onConnectionLost:()=>this.#l(),onError:()=>this.#m(),onMessage:e=>this.#d(e),onOpen:()=>this.#u(),headers:this.#e,url:this.#r})}#u(){this.#a.resetBackoff(),this.#f();}#d(e){let r=RealtimeEventSchema.safeParse(e);r.success&&this.#s.dispatch(r.data);}#l(){this.#s.hasActiveSubscriptions()&&this.#S();}#m(){}#f(){this.#h(Array.from(this.#s.serverState().values()));}#h(e){e.length!==0&&this.#o.send(Ec(e));}#y(e){e.length!==0&&this.#o.send(Ac(e));}#S(){this.#a.schedule({reconnect:()=>this.#c(),shouldReconnect:()=>this.#s.hasActiveSubscriptions()});}};function qc(t,e){return Array.from(e).flatMap(([r,s])=>t.has(r)?[]:[s])}function vc(t,e){return Array.from(t).flatMap(([r,s])=>e.has(r)?[]:[s])}function Cc(t){let e=new Map;for(let{subscription:r}of t)for(let s of wc(r))e.has(s.key)||e.set(s.key,s);return e}function Ec(t){return {action:"subscribe",subscriptions:t.map(({topic:e,type:r})=>({topic:e,type:r}))}}function Ac(t){return {action:"unsubscribe",subscriptions:t.map(({topic:e,type:r})=>({topic:e,type:r}))}}function wc(t){switch(t.topic){case "comments":return (t.types??["comment_created"]).map(e=>Q("comments",e));case "prices.crypto.binance":return [Q("crypto_prices","update")];case "prices.crypto.chainlink":return [Q("crypto_prices_chainlink","update")];case "prices.crypto.chainlink.twap":return [Q(kc(t.windowSeconds),"update")];case "prices.equity.pyth":return [Q("equity_prices","update")];default:invariant(false,`Unknown RTDS topic: ${String(t)}`);}}function kc(t){switch(t){case 30:return "crypto_prices_twap_thirty";case 60:return "crypto_prices_twap_sixty";default:invariant(false,`Unknown TWAP window: ${String(t)}`);}}function Q(t,e){return {key:`${t}:${e}`,topic:t,type:e}}function Tc(t){switch(t.topic){case "comments":return e=>!(e.topic!=="comments"||t.types!==void 0&&t.types.length>0&&!t.types.includes(e.type)||(t.parentEntityId!==void 0||t.parentEntityType!==void 0)&&(!(e.type==="comment_created"||e.type==="comment_removed")||t.parentEntityId!==void 0&&e.payload.parentEntityID!==t.parentEntityId||t.parentEntityType!==void 0&&e.payload.parentEntityType!==t.parentEntityType));case "prices.crypto.binance":return e=>e.topic==="prices.crypto.binance"&&(t.symbols===void 0||t.symbols.length===0||t.symbols.includes(e.payload.symbol));case "prices.crypto.chainlink":return e=>e.topic==="prices.crypto.chainlink"&&(t.symbols===void 0||t.symbols.length===0||t.symbols.includes(e.payload.symbol));case "prices.crypto.chainlink.twap":return e=>e.topic==="prices.crypto.chainlink.twap"&&e.payload.windowSeconds===t.windowSeconds&&(t.symbols===void 0||t.symbols.length===0||t.symbols.includes(e.payload.symbol));case "prices.equity.pyth":return e=>e.topic==="prices.equity.pyth"&&e.payload.symbol.toLowerCase()===t.symbol.toLowerCase()&&(t.types===void 0||t.types.length===0||t.types.includes(e.type));default:invariant(false,`Unknown RTDS topic: ${String(t)}`);}}var I=class{#e;#r;#t;#o=new Pe({heartbeat:new Le$1});#a=new Oe$1;#s=new R;constructor(e){this.#e=e.headers,this.#r=e.url;}async subscribe(e){let{entry:r}=this.#s.add(e);return await this.#i(r),g(r.subscriber.queue,()=>this.#n(r))}async#i(e){try{await this.#c();}catch(r){throw await this.#n(e),r}}async#n(e){this.#s.remove(e),this.#s.hasActiveSubscriptions()||await this.close();}async close(){this.#t===void 0&&(this.#t=this.#p().finally(()=>{this.#t=void 0;})),await this.#t;}async#p(){this.#a.stop(),this.#s.endAll(),await this.#o.close();}#c(){return this.#o.connect({onConnectionLost:()=>this.#l(),onError:()=>this.#m(),onMessage:e=>this.#d(e),onOpen:()=>this.#u(),headers:this.#e,url:this.#r})}#u(){this.#a.resetBackoff();}#d(e){let r=SportsResultEventSchema.safeParse(e);r.success&&this.#s.dispatch(r.data);}#l(){this.#s.hasActiveSubscriptions()&&this.#f();}#m(){}#f(){this.#a.schedule({reconnect:()=>this.#c(),shouldReconnect:()=>this.#s.hasActiveSubscriptions()});}};var te=class{#e;#r;get context(){return this.#e}get decorators(){return this.#r}get environment(){return this.context.environment}get siteConfig(){return this.context.siteConfig}get predictions(){return this.context.predictions}get clob(){return this.context.clob}get relayer(){return this.context.relayer}get rpc(){return this.context.rpc}get gamma(){return this.context.gamma}get data(){return this.context.data}get rfq(){return this.context.rfq}get perps(){return this.context.perps}get webSockets(){return this.context.webSockets}get supportsGasless(){return this.context.apiKey?.supportGasless??false}get hasBuilderApiKey(){return this.context.apiKey?.isBuilderKey??false}constructor(e){this.#e=e,this.#r=[];}async resolveClobHeaders(e){return this.context.apiKey?.isBuilderKey?this.context.apiKey.authorize(e,{fetch:this.context.fetch,signal:e.signal}):Promise.resolve({})}async resolveRelayerHeaders(e){return this.context.apiKey?.supportGasless?this.context.apiKey.authorize(e,{fetch:this.context.fetch,signal:e.signal}):Promise.resolve({})}rememberDecorator(e){this.#r.push(e);}},Bc=z.object({key:ApiKeySchema,passphrase:z.string(),secret:z.string()}),Uc=z.object({wallet:EvmAddressSchema,credentials:Bc.optional(),nonce:z.number().int().nonnegative().optional()}).superRefine((t,e)=>{t.credentials!==void 0&&t.nonce!==void 0&&e.addIssue({code:"custom",message:"`credentials` and `nonce` are mutually exclusive.",path:["nonce"]});}).transform(t=>t.credentials!==void 0?{wallet:t.wallet,credentials:t.credentials}:t.nonce!==void 0?{wallet:t.wallet,nonce:t.nonce}:{wallet:t.wallet});function ci(t){let e=gs();return new Ie$1({fetch:t.fetch,retryMutations:false,headers:t.environment.predictions.headers,root:t.environment.predictions.rest,resolveHeaders:async()=>({KUEST_CLIENT:e})})}var re=class extends te{constructor(e){super({apiKey:e.apiKey,environment:e.environment,siteConfig:e.siteConfig,fetch:e.fetch,onRateLimitUpdate:e.onRateLimitUpdate,predictions:ci(e),data:new Ie$1({fetch:e.fetch,headers:e.environment.data.headers,root:e.environment.data.rest}),gamma:new Ie$1({fetch:e.fetch,headers:e.environment.gamma.headers,root:e.environment.gamma.rest}),clob:new Ie$1({fetch:e.fetch,headers:e.environment.clob.headers,onRateLimitUpdate:e.onRateLimitUpdate,root:e.environment.clob.rest,resolveHeaders:r=>this.resolveClobHeaders(r)}),relayer:new Ie$1({fetch:e.fetch,headers:e.environment.relayer.headers,root:e.environment.relayer.rest,resolveHeaders:r=>this.resolveRelayerHeaders(r)}),rfq:new Ie$1({fetch:e.fetch,headers:e.environment.combos.headers,root:e.environment.combos.rest}),perps:new Ie$1({fetch:e.fetch,headers:e.environment.perps.headers,root:e.environment.perps.rest}),rpc:new S({url:e.environment.rpc,fetch:e.fetch}),webSockets:{clobMarket:new w({headers:e.environment.clob.market.headers,url:e.environment.clob.market.ws}),sports:new I({headers:e.environment.sports.headers,url:e.environment.sports.ws}),rtds:new M({headers:e.environment.rtds.headers,url:e.environment.rtds.ws}),perpsSubscriptions:new k({headers:e.environment.perps.headers,url:e.environment.perps.ws})}});}isSecureClient(){return false}isPublicClient(){return true}async closeSubscriptions(){await Promise.all([this.webSockets.clobMarket.close(),this.webSockets.rtds.close(),this.webSockets.sports.close(),this.webSockets.perpsSubscriptions.close()]).then(()=>{});}extend(e){return this.rememberDecorator(e),Object.assign(this,e(this)),this}beginAuthentication(e,r){let s=a$1(e,Uc);return Promise.resolve(async function*(){let i$1=Math.floor(Date.now()/1e3),n=s?.nonce??0,o=expectEvmAddress(yield La$1()),a=expectEvmAddress(s.wallet),u=U$1(this.environment,o,a);if(s.credentials!==void 0){let S=this.#e(s.credentials,u,r);try{if((await zb(S)).includes(s.credentials.key))return S}catch(f){if(!(f instanceof i)||f.status!==401)throw f}}let d=yield {kind:"signAuthMessage",payload:Ps({address:o,chainId:this.environment.chainId,nonce:n,timestamp:i$1})},c=await xb(this,{address:o,nonce:n,signature:expectEvmSignature(d),timestamp:i$1});return this.#e(c,u,r)}.call(this))}#e(e,r,s){let i=new je({account:r,apiKey:this.context.apiKey,credentials:e,environment:this.environment,siteConfig:this.siteConfig,onRateLimitUpdate:this.context.onRateLimitUpdate,fetch:this.context.fetch,signer:s});for(let n of this.decorators)i.extend(n);return i}},je=class extends te{#e=false;get context(){return invariant(!this.#e,"This client has ended authentication and can no longer be used."),super.context}endAuthenticationLifecycle(){this.#e=true;}constructor(e){let r=new K({url:e.environment.realtime.ws,headers:e.environment.realtime.headers,credentials:e.credentials});super({account:e.account,credentials:e.credentials,apiKey:e.apiKey,environment:e.environment,siteConfig:e.siteConfig,fetch:e.fetch,onRateLimitUpdate:e.onRateLimitUpdate,signer:e.signer,predictions:ci(e),clob:new Ie$1({fetch:e.fetch,headers:e.environment.clob.headers,onRateLimitUpdate:e.onRateLimitUpdate,root:e.environment.clob.rest,resolveHeaders:s=>this.resolveClobHeaders(s)}),relayer:new Ie$1({fetch:e.fetch,headers:e.environment.relayer.headers,root:e.environment.relayer.rest,resolveHeaders:s=>this.resolveRelayerHeaders(s)}),rpc:new S({url:e.environment.rpc,fetch:e.fetch}),gamma:new Ie$1({fetch:e.fetch,headers:e.environment.gamma.headers,root:e.environment.gamma.rest}),data:new Ie$1({fetch:e.fetch,headers:e.environment.data.headers,root:e.environment.data.rest}),rfq:new Ie$1({fetch:e.fetch,headers:e.environment.combos.headers,root:e.environment.combos.rest}),perps:new Ie$1({fetch:e.fetch,headers:e.environment.perps.headers,root:e.environment.perps.rest}),secureClob:new Ie$1({fetch:e.fetch,headers:e.environment.clob.headers,onRateLimitUpdate:e.onRateLimitUpdate,resolveHeaders:async s=>({...await this.resolveClobHeaders(s),...await this.#t(s)}),root:e.environment.clob.rest}),combos:new Ie$1({fetch:e.fetch,headers:e.environment.combos.collateralReturn.headers,resolveHeaders:s=>this.resolveRelayerHeaders(s),root:e.environment.combos.collateralReturn.rest}),builderGateway:new Ie$1({fetch:e.fetch,headers:e.environment.combos.builderGateway.headers,resolveHeaders:async s=>({...await this.#r(s),...await this.#t(s)}),root:e.environment.combos.builderGateway.rest}),webSockets:{clobMarket:new w({headers:e.environment.clob.market.headers,url:e.environment.clob.market.ws}),clobUser:new O({credentials:e.credentials,headers:e.environment.clob.user.headers,url:e.environment.clob.user.ws}),rfqQuoter:new F({account:e.account,chainId:e.environment.chainId,credentials:e.credentials,exchange:e.environment.contracts.exchangeV3,headers:e.environment.combos.headers,signer:e.signer,url:e.environment.combos.ws}),sports:new I({headers:e.environment.sports.headers,url:e.environment.sports.ws}),realtime:r,rtds:new M({headers:e.environment.rtds.headers,url:e.environment.rtds.ws}),perpsSubscriptions:new k({headers:e.environment.perps.headers,url:e.environment.perps.ws}),perpsSession:new x({fetch:e.fetch,chainId:e.environment.chainId,headers:e.environment.perps.headers,restUrl:e.environment.perps.rest,wsUrl:e.environment.perps.ws})}});}get credentials(){return this.context.credentials}get account(){return this.context.account}get signer(){return this.context.signer}get secureClob(){return this.context.secureClob}get combos(){return this.context.combos}get builderGateway(){return this.context.builderGateway}get webSockets(){return this.context.webSockets}async closeSubscriptions(){await Promise.allSettled([this.webSockets.clobMarket.close(),this.webSockets.realtime.close(),this.webSockets.rtds.close(),this.webSockets.sports.close(),this.webSockets.perpsSubscriptions.close(),this.webSockets.clobUser.close()]).then(()=>{});}isSecureClient(){return true}isPublicClient(){return false}extend(e){return this.rememberDecorator(e),Object.assign(this,e(this)),this}async endAuthentication(){let e=this.closeSubscriptions(),r=this.webSockets.perpsSession.shutdown(),s=this.webSockets.rfqQuoter.shutdown(),{apiKey:i,environment:n,onRateLimitUpdate:o,fetch:a}=this.context;try{await Bb(this);}finally{this.endAuthenticationLifecycle(),await Promise.allSettled([e,r,s]).then(()=>{});}let u=new re({apiKey:i,environment:n,onRateLimitUpdate:o,fetch:a});for(let d of this.decorators)u.extend(d);return u}async#r(e){return e.method!=="GET"&&this.context.apiKey?.isBuilderKey?this.context.apiKey.authorize(e,{fetch:this.context.fetch,signal:e.signal}):{}}async#t(e){try{let r=Math.floor(Date.now()/1e3);return {KUEST_ADDRESS:this.account.signer,KUEST_API_KEY:this.credentials.key,KUEST_PASSPHRASE:this.credentials.passphrase,KUEST_SIGNATURE:await rb(this.credentials.secret,r,e.method,e.path,e.body),KUEST_TIMESTAMP:`${r}`}}catch(r){throw s.fromError(r,"Could not sign the L2-authenticated request")}}};function ui(t={}){return new re({environment:t.environment??Ie,siteConfig:t.siteConfig?ce(t.siteConfig):void 0,apiKey:t.apiKey,onRateLimitUpdate:t.onRateLimitUpdate,fetch:t.fetch}).extend(Es)}var Dc=t(o,k$1,i,s,l,n,d,c,a),Wc=t(a);async function Kc(t){let e=ui({environment:t.environment,siteConfig:t.siteConfig,apiKey:t.apiKey,onRateLimitUpdate:t.onRateLimitUpdate,fetch:t.fetch}),r=await Qc(e,t),s=await e.beginAuthentication({wallet:r,credentials:t.credentials,nonce:t.nonce},t.signer).then(Ka$1(t.signer));if(s.account.walletType===WalletType.EOA||await Pa(s,{wallet:s.account.wallet,type:s.account.walletType}))return s;if(s.account.walletType===WalletType.DEPOSIT_WALLET)return await Hc(s),s;throw new a(`Wallet ${s.account.wallet} does not exist. Provide an existing wallet address, or omit wallet to use the default Deposit Wallet flow.`)}async function Qc(t,e){if(e.wallet!==void 0)return e.wallet;let r=expectEvmAddress(await e.signer.getAddress()),s=W(r,t.environment.walletDerivation);return await Pa(t,{wallet:s,type:WalletType.DEPOSIT_WALLET})?s:X$1(r,t.environment.walletDerivation)}async function Hc(t){let e=X$1(t.account.signer,t.environment.walletDerivation);if(!isSameEvmAddress(t.account.wallet,e))throw new a(`Wallet ${t.account.wallet} does not match the expected Deposit Wallet ${e} for this signer, nor a deployed wallet address.`);await(await Sa(t)).wait();}
|
|
2
2
|
export{Dc as CreateSecureClientError,Wc as SetupGaslessWalletError,Ae as accountActions,Es as allActions,we as analyticsActions,ui as createPublicClient,Kc as createSecureClient,ke as dataActions,Te as discoveryActions,Ha as forkEnvironmentConfig,Oe as perpsActions,dd as preproduction,Ie as production,La as relayerApiKey,Ia as remoteBuilderSigning,xe as rewardsActions,qs as rfqActions,vs as sessionKeyActions,Fe as subscriptionsActions,Cs as tradingActions,Me as walletActions};//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|