@agg-build/sdk 4.19.0 → 4.19.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/dist/{agg-websocket-CE7v1_-O.d.mts → agg-websocket-DC7H1Cdh.d.mts} +2 -0
- package/dist/{agg-websocket-CE7v1_-O.d.ts → agg-websocket-DC7H1Cdh.d.ts} +2 -0
- package/dist/browser.d.mts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/index.d.mts +57 -3
- package/dist/index.d.ts +57 -3
- package/dist/index.js +171 -0
- package/dist/index.mjs +169 -0
- package/dist/market-data.d.mts +2 -2
- package/dist/market-data.d.ts +2 -2
- package/package.json +1 -1
|
@@ -2796,6 +2796,8 @@ interface UpdateBalanceRefillPolicyParams {
|
|
|
2796
2796
|
type WithdrawTokenSymbol = "USDC" | "USDC.e" | "USDT";
|
|
2797
2797
|
type WithdrawalSourceTokenSymbol = WithdrawTokenSymbol | "pUSD" | "USD1";
|
|
2798
2798
|
interface WithdrawManagedParams {
|
|
2799
|
+
/** Idempotency key for exact-amount transfers. Retry the same request, never a new key, after a lost response. Not combined with max. */
|
|
2800
|
+
requestId?: string;
|
|
2799
2801
|
/** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
|
|
2800
2802
|
amountRaw: string;
|
|
2801
2803
|
tokenSymbol: WithdrawTokenSymbol;
|
|
@@ -2796,6 +2796,8 @@ interface UpdateBalanceRefillPolicyParams {
|
|
|
2796
2796
|
type WithdrawTokenSymbol = "USDC" | "USDC.e" | "USDT";
|
|
2797
2797
|
type WithdrawalSourceTokenSymbol = WithdrawTokenSymbol | "pUSD" | "USD1";
|
|
2798
2798
|
interface WithdrawManagedParams {
|
|
2799
|
+
/** Idempotency key for exact-amount transfers. Retry the same request, never a new key, after a lost response. Not combined with max. */
|
|
2800
|
+
requestId?: string;
|
|
2799
2801
|
/** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
|
|
2800
2802
|
amountRaw: string;
|
|
2801
2803
|
tokenSymbol: WithdrawTokenSymbol;
|
package/dist/browser.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AggWebSocket, a as AggWebSocketOptions, C as ChartBarsResponse, b as ChartHistoryManifest, c as ChartCandle, d as AggWebSocketDiagnostics, M as MarketDataEngine, O as OrderbookState, W as WsArbMarketUpdate, e as WsArbFeedBatch, f as AggWebSocketCallbacks } from './agg-websocket-
|
|
1
|
+
import { A as AggWebSocket, a as AggWebSocketOptions, C as ChartBarsResponse, b as ChartHistoryManifest, c as ChartCandle, d as AggWebSocketDiagnostics, M as MarketDataEngine, O as OrderbookState, W as WsArbMarketUpdate, e as WsArbFeedBatch, f as AggWebSocketCallbacks } from './agg-websocket-DC7H1Cdh.mjs';
|
|
2
2
|
|
|
3
3
|
/** The application owns the native module Worker URL so its static bundler fingerprints it. */
|
|
4
4
|
type MarketDataWorkerFactory = () => Worker;
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AggWebSocket, a as AggWebSocketOptions, C as ChartBarsResponse, b as ChartHistoryManifest, c as ChartCandle, d as AggWebSocketDiagnostics, M as MarketDataEngine, O as OrderbookState, W as WsArbMarketUpdate, e as WsArbFeedBatch, f as AggWebSocketCallbacks } from './agg-websocket-
|
|
1
|
+
import { A as AggWebSocket, a as AggWebSocketOptions, C as ChartBarsResponse, b as ChartHistoryManifest, c as ChartCandle, d as AggWebSocketDiagnostics, M as MarketDataEngine, O as OrderbookState, W as WsArbMarketUpdate, e as WsArbFeedBatch, f as AggWebSocketCallbacks } from './agg-websocket-DC7H1Cdh.js';
|
|
2
2
|
|
|
3
3
|
/** The application owns the native module Worker URL so its static bundler fingerprints it. */
|
|
4
4
|
type MarketDataWorkerFactory = () => Worker;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as Venue, U as UserProfile, T as TradeSplit, g as VenueMarket, h as VenueMarketOutcome, i as Orderbook, j as TradeSide, k as AggClientOptions, l as AggClientSessionInput, m as AuthStatus, S as SiweMessageParams, n as SiwsMessageParams, o as AggAuthVerifyBody, p as AggAuthStartBody, q as AggAuthStartResult, r as AggLinkAccountBody, s as AggLinkAccountResult, t as AggLinkAccountWalletConfirmBody, u as AggLinkAccountConfirmResult, v as UpdateUserBody, P as PaginatedResponse, w as UserHolding, x as OrderListQuery, y as TradeExecutorOrderListResponse, E as ExecutionOrdersQuery, z as ExecutionOrderItem, B as ExecutionStatusQuery, D as ExecutionStatusResponse, F as UserActivityQuery, G as UserActivityItem, L as LeaderboardQuery, H as LeaderboardRow, I as ExecutionPositionsQuery, J as ExecutionPositionGroup, K as ManagedBalancesParams, N as UnifiedBalanceResponse, Q as UpsertVenueKey, R as VenueKeySummary, X as VenueKeyStatus, Y as CreatePaperTradingAccountParams, Z as PaperTradingAppOptions, _ as PaperTradingAccount, $ as PaperTradingAccountListParams, a0 as PaperTradingAccountsPage, a1 as SetPaperTradingBalanceParams, a2 as PaperTradingBalanceResponse, a3 as ResetPaperTradingAccountParams, a4 as PlacePaperTradingOrderParams, a5 as PaperTradingOrder, a6 as PaperTradingListParams, a7 as PaperTradingPositionsPage, a8 as PaperTradingOrdersPage, a9 as PaperTradingPortfolio, aa as CancelOrderSignature, ab as CancelManagedExecutionResponse, ac as CancelVenueOrderParams, ad as MatchStatus, ae as MarketStatus, af as RecurrenceFilter, ag as VenueEvent, ah as EventBootstrapResponse, ai as SportsLiveResponse, aj as ListRecurringCryptoMarketsOptions, ak as RecurringCryptoMarketsResponse, al as GetCryptoReferencePricesOptions, am as CryptoReferencePricesResponse, an as Category, ao as AppClientConfigResponse, ap as VenueGeoPolicyResponse, aq as RpcTokenResponse, ar as NewsFeedListResponse, as as NewsFeedPageOptions, at as NewsFeedArticleFeedResponse, au as NewsFeedMarketFeedResponse, av as NewsFeedStatusResponse, aw as NewsFeedMarketNewsParams, ax as NewsFeedMarketNewsResponse, ay as SearchParams, az as SearchResponse, aA as CorrelatedMarketsStatus, aB as CorrelatedMarketSignalBatch, aC as CorrelatedMarketQueryResult, aD as CorrelatedMarketCascadeResponse, aE as ResolveCorrelatedMarketsParams, aF as ResolveCorrelatedMarketsResponse, aG as ChartResolution, C as ChartBarsResponse, b as ChartHistoryManifest, aH as BatchOrderbooksResponse, aI as BatchMidpointsResponse, aJ as OutcomeOrderbookResponse, aK as SmartRouteParams, aL as SmartRouteResponse, f as AggWebSocketCallbacks, A as AggWebSocket, aM as ExecuteManagedParams, aN as ExecuteManagedResponse, aO as PlaceLimitOrderParams, aP as PlaceLimitOrderResponse, aQ as PlaceOrderParams, aR as PlaceOrderResponse, aS as RedeemRequest, aT as RedeemResponse, aU as BalanceRefillPolicy, aV as CreateBalanceRefillPolicyParams, aW as UpdateBalanceRefillPolicyParams, aX as BalanceRefillAttempt, aY as WithdrawManagedParams, aZ as WithdrawManagedResponse, a_ as WithdrawPreviewParams, a$ as WithdrawPreviewResponse, b0 as WithdrawalQuoteParams, b1 as WithdrawalQuoteResponse, b2 as SyncBalancesResponse, b3 as DepositAddressesResponse, b4 as GetPositionsParams, b5 as PositionGroup, b6 as RampQuoteRequest, b7 as RampQuote, b8 as RampSessionRequest, b9 as RampWidgetSession, ba as Candle, c as ChartCandle } from './agg-websocket-
|
|
2
|
-
export { bb as ACTIVE_VENUES, bc as Account, bd as AccountProvider, be as AccountType, bf as AggAuthDeliveryMode, bg as AggAuthPrivyVerifyBody, bh as AggAuthProviderType, bi as AggAuthWalletVerifyBody, bj as AggClientAuthOptions, bk as AggSessionUser, d as AggWebSocketDiagnostics, a as AggWebSocketOptions, bl as AggregatedOrderbookLevel, bm as AggregatedOrderbookResponse, bn as App, bo as AppTradingMode, bp as AttributedOrderbook, bq as AttributedOrderbookLevel, br as AuthCodeResponse, bs as AuthTokenResponse, bt as AuthUser, bu as BalanceCustody, bv as BalanceRefillAttemptStatus, bw as BalanceRefillPolicyStatus, bx as BookQuality, by as CONFIRMED_MATCH_STATUSES, bz as CandleBuilder, bA as CandleInterval, bB as CandleTail, bC as Chain, bD as ChartBarsMeta, bE as ChartVenueCandles, bF as ComputeSplitsRequest, bG as ComputeSplitsResponse, bH as ComputeSplitsSelection, bI as CorrelatedMarketCascadeItem, bJ as CorrelatedMarketSide, bK as CorrelatedMarketSignal, bL as CorrelatedMarketSignalDirection, bM as CreateApp, bN as CryptoReferencePriceError, bO as CryptoReferencePriceExternalMarketInput, bP as CryptoReferencePriceMarketInput, bQ as CryptoReferencePriceResult, bR as CryptoReferencePriceSource, bS as CryptoReferencePriceTarget, bT as DepositAddressesPendingResponse, bU as DepositAddressesReadyResponse, bV as DepositAddressesSupportedChain, bW as DepositAddressesToken, bX as DepositStep, bY as DiagnosticCallback, bZ as DiagnosticEvent, b_ as ExecuteManagedRequest, b$ as ExecuteTradeRequest, c0 as ExecuteTradeResponse, c1 as ExecutionDagProgress, c2 as ExecutionDisplayGroupStatus, c3 as ExecutionDisplayStepKind, c4 as ExecutionMode, c5 as ExecutionOverallState, c6 as ExecutionStatusOrder, c7 as ExecutionStatusStep, c8 as GetBalanceQuery, c9 as GetBalanceResponse, ca as GetHoldingsQuery, cb as GetHoldingsResponse, cc as GetOrdersParams, cd as GetOrdersQuery, ce as GetPositionsQuery, cf as HelloResponse, cg as HistoryRangeRequest, ch as INACTIVE_VENUES, ci as LeaderboardMetric, cj as LimitOrderTimeInForce, ck as MarkSource, cl as MarketPriceHistory, cm as MarketView, cn as MarketViewBatch, co as MatchType, cp as MatchedMidpoint, cq as MatchedMidpointOutcome, cr as MatchedOrderbookMarket, cs as MatchedVenueMarketOutcomeRef, ct as MidpointItem, cu as MidpointRow, cv as NewsFeedArticleFeedItem, cw as NewsFeedArticleWithSummary, cx as NewsFeedLinkedMarket, cy as NewsFeedMarketFeedArticle, cz as NewsFeedMarketFeedItem, cA as NewsFeedMarketNewsResult, cB as NonceResponse, cC as OrderListItem, cD as OrderStatus, cE as OrderType, cF as OrderbookBatchItemError, cG as OrderbookBatchItemErrorCode, cH as OrderbookBatchItemStatus, cI as OrderbookHistoryPoint, cJ as OrderbookHistoryResponse, cK as OrderbookLevel, cL as OrderbookQuoteFill, cM as OrderbookQuoteParams, cN as OrderbookQuoteResponse, cO as OrderbookServiceUnavailableError, O as OrderbookState, cP as OrderbooksOnlyError, cQ as OutcomeMidpoint, cR as OutcomeMidpointRow, cS as PaperTradingBalanceAdjustment, cT as PaperTradingLiquidityStatus, cU as PaperTradingMarkSource, cV as PaperTradingPosition, cW as PersistedAuthSnapshot, cX as PositionRedeemStatus, cY as PricePoint, cZ as PriceSource, c_ as PricesHistoryResponse, c$ as ProphetxExecutionMode, d0 as RECURRENCE_CADENCES, d1 as RecurrenceCadence, d2 as RecurringCryptoComparisonPoint, d3 as RecurringCryptoComparisonPriceSource, d4 as RecurringCryptoDuration, d5 as RecurringCryptoDurationInput, d6 as RecurringCryptoMarketMetrics, d7 as RecurringCryptoOrderbookDepthLevel, d8 as RecurringCryptoOrderbookDepthSide, d9 as RecurringCryptoOutcome, da as RecurringCryptoOutcomeOrderbookDepth, db as RecurringCryptoPriceComparison, dc as RecurringCryptoReferencePrice, dd as RecurringCryptoResolution, de as RecurringCryptoSourceConfidence, df as RecurringCryptoVenueMarket, dg as RecurringCryptoWindowComparisons, dh as RecurringCryptoWindowMarket, di as RedeemLegResult, dj as RedeemLegStatus, dk as RequestedOrderbookMarket, dl as ResolvedCorrelatedMarketsResponse, dm as SELF_CUSTODY_FILL_TIMEOUT_MS, dn as SELF_CUSTODY_POLL_INTERVAL_MS, dp as ServerWallet, dq as SettlementDiff, dr as SettlementDifference, ds as SettlementSource, dt as SetupDepositAddressStep, du as SetupVenueKeyStep, dv as SignatureRequest, dw as SignatureRequestType, dx as SignerFn, dy as SimpleOrderbookLevel, dz as SmartRouteAllocation, dA as SmartRouteBridgeStep, dB as SmartRouteFeeBreakdown, dC as SmartRouteFill, dD as SmartRouteSettlementLeg, dE as SmartRouteSettlementPlan, dF as SmartRouteSetupCostLine, dG as SmartRouteSide, dH as SmartRouteStatus, dI as SmartRouteVenueFill, dJ as SportsGameStatus, dK as SportsLiveParticipant, dL as SportsLiveState, dM as TERMINAL_EXECUTION_STATES, dN as TimeInForce, dO as TradeExecutorOrder, dP as TradeStep, dQ as UserActivityBridge, dR as UserActivityDeposit, dS as UserActivityRedeem, dT as UserActivityRedeemLeg, dU as UserActivityTrade, dV as UserActivityType, dW as UserActivityUserOp, dX as UserActivityWithdrawal, dY as VENUES, dZ as VENUE_CHAIN_IDS, d_ as ValidateBalanceOnClientStep, d$ as ValidateManagedParams, e0 as ValidateManagedRequest, e1 as ValidateManagedResponse, e2 as ValidateTradeRequest, e3 as ValidateTradeResponse, e4 as VenueEventListItem, e5 as VenueEventWithMarkets, e6 as VenueGeoPolicyEntry, e7 as VenueMarketListItem, e8 as VenueMarketRef, e9 as VenueOrderbookEntry, ea as VenueOrderbookLevel, eb as VenuePositionBalance, ec as VenuePriceInfo, ed as VenueSoloQuote, ee as VerifyBody, ef as VerifyResponse, eg as WalletChainBalance, eh as WalletTokenBalance, ei as WithdrawManagedRequest, ej as WithdrawManagedSourceItem, ek as WithdrawTokenSymbol, el as WithdrawalExpected, em as WithdrawalLeg, en as WithdrawalLegStatus, eo as WithdrawalLegType, ep as WithdrawalLifecycleStatus, eq as WithdrawalSource, er as WithdrawalSourceItem, es as WithdrawalSourceStatus, et as WithdrawalSourceTokenSymbol, e as WsArbFeedBatch, eu as WsArbFeedEntry, W as WsArbMarketUpdate, ev as WsAttributedLevel, ew as WsAuthenticated, ex as WsBalanceUpdate, ey as WsCandleInterval, ez as WsClientMessage, eA as WsConnected, eB as WsError, eC as WsHeartbeat, eD as WsMarkSource, eE as WsMarketResolved, eF as WsOrderEvent, eG as WsOrderEventType, eH as WsOrderSubmitted, eI as WsOrderbookDelta, eJ as WsOrderbookSnapshot, eK as WsRedeemEvent, eL as WsServerMessage, eM as WsSubscribed, eN as WsTrade, eO as WsUnsubscribed, eP as WsVenueBook, eQ as WsVenueInfo, eR as WsVenueLevel, eS as WsWithdrawalLegStatus, eT as WsWithdrawalLifecycleEvent, eU as WsWithdrawalLifecycleLeg, eV as WsWithdrawalLifecycleStatus, eW as applyOrderbookDelta, eX as computeChecksum, eY as getEffectiveDisabledVenues, eZ as isVenueActive, e_ as isVenueDataVisible, e$ as isVenueInactive, f0 as snapshotToOrderbook } from './agg-websocket-
|
|
1
|
+
import { V as Venue, U as UserProfile, T as TradeSplit, g as VenueMarket, h as VenueMarketOutcome, i as Orderbook, j as TradeSide, k as AggClientOptions, l as AggClientSessionInput, m as AuthStatus, S as SiweMessageParams, n as SiwsMessageParams, o as AggAuthVerifyBody, p as AggAuthStartBody, q as AggAuthStartResult, r as AggLinkAccountBody, s as AggLinkAccountResult, t as AggLinkAccountWalletConfirmBody, u as AggLinkAccountConfirmResult, v as UpdateUserBody, P as PaginatedResponse, w as UserHolding, x as OrderListQuery, y as TradeExecutorOrderListResponse, E as ExecutionOrdersQuery, z as ExecutionOrderItem, B as ExecutionStatusQuery, D as ExecutionStatusResponse, F as UserActivityQuery, G as UserActivityItem, L as LeaderboardQuery, H as LeaderboardRow, I as ExecutionPositionsQuery, J as ExecutionPositionGroup, K as ManagedBalancesParams, N as UnifiedBalanceResponse, Q as UpsertVenueKey, R as VenueKeySummary, X as VenueKeyStatus, Y as CreatePaperTradingAccountParams, Z as PaperTradingAppOptions, _ as PaperTradingAccount, $ as PaperTradingAccountListParams, a0 as PaperTradingAccountsPage, a1 as SetPaperTradingBalanceParams, a2 as PaperTradingBalanceResponse, a3 as ResetPaperTradingAccountParams, a4 as PlacePaperTradingOrderParams, a5 as PaperTradingOrder, a6 as PaperTradingListParams, a7 as PaperTradingPositionsPage, a8 as PaperTradingOrdersPage, a9 as PaperTradingPortfolio, aa as CancelOrderSignature, ab as CancelManagedExecutionResponse, ac as CancelVenueOrderParams, ad as MatchStatus, ae as MarketStatus, af as RecurrenceFilter, ag as VenueEvent, ah as EventBootstrapResponse, ai as SportsLiveResponse, aj as ListRecurringCryptoMarketsOptions, ak as RecurringCryptoMarketsResponse, al as GetCryptoReferencePricesOptions, am as CryptoReferencePricesResponse, an as Category, ao as AppClientConfigResponse, ap as VenueGeoPolicyResponse, aq as RpcTokenResponse, ar as NewsFeedListResponse, as as NewsFeedPageOptions, at as NewsFeedArticleFeedResponse, au as NewsFeedMarketFeedResponse, av as NewsFeedStatusResponse, aw as NewsFeedMarketNewsParams, ax as NewsFeedMarketNewsResponse, ay as SearchParams, az as SearchResponse, aA as CorrelatedMarketsStatus, aB as CorrelatedMarketSignalBatch, aC as CorrelatedMarketQueryResult, aD as CorrelatedMarketCascadeResponse, aE as ResolveCorrelatedMarketsParams, aF as ResolveCorrelatedMarketsResponse, aG as ChartResolution, C as ChartBarsResponse, b as ChartHistoryManifest, aH as BatchOrderbooksResponse, aI as BatchMidpointsResponse, aJ as OutcomeOrderbookResponse, aK as SmartRouteParams, aL as SmartRouteResponse, f as AggWebSocketCallbacks, A as AggWebSocket, aM as ExecuteManagedParams, aN as ExecuteManagedResponse, aO as PlaceLimitOrderParams, aP as PlaceLimitOrderResponse, aQ as PlaceOrderParams, aR as PlaceOrderResponse, aS as RedeemRequest, aT as RedeemResponse, aU as BalanceRefillPolicy, aV as CreateBalanceRefillPolicyParams, aW as UpdateBalanceRefillPolicyParams, aX as BalanceRefillAttempt, aY as WithdrawManagedParams, aZ as WithdrawManagedResponse, a_ as WithdrawPreviewParams, a$ as WithdrawPreviewResponse, b0 as WithdrawalQuoteParams, b1 as WithdrawalQuoteResponse, b2 as SyncBalancesResponse, b3 as DepositAddressesResponse, b4 as GetPositionsParams, b5 as PositionGroup, b6 as RampQuoteRequest, b7 as RampQuote, b8 as RampSessionRequest, b9 as RampWidgetSession, ba as Candle, c as ChartCandle } from './agg-websocket-DC7H1Cdh.mjs';
|
|
2
|
+
export { bb as ACTIVE_VENUES, bc as Account, bd as AccountProvider, be as AccountType, bf as AggAuthDeliveryMode, bg as AggAuthPrivyVerifyBody, bh as AggAuthProviderType, bi as AggAuthWalletVerifyBody, bj as AggClientAuthOptions, bk as AggSessionUser, d as AggWebSocketDiagnostics, a as AggWebSocketOptions, bl as AggregatedOrderbookLevel, bm as AggregatedOrderbookResponse, bn as App, bo as AppTradingMode, bp as AttributedOrderbook, bq as AttributedOrderbookLevel, br as AuthCodeResponse, bs as AuthTokenResponse, bt as AuthUser, bu as BalanceCustody, bv as BalanceRefillAttemptStatus, bw as BalanceRefillPolicyStatus, bx as BookQuality, by as CONFIRMED_MATCH_STATUSES, bz as CandleBuilder, bA as CandleInterval, bB as CandleTail, bC as Chain, bD as ChartBarsMeta, bE as ChartVenueCandles, bF as ComputeSplitsRequest, bG as ComputeSplitsResponse, bH as ComputeSplitsSelection, bI as CorrelatedMarketCascadeItem, bJ as CorrelatedMarketSide, bK as CorrelatedMarketSignal, bL as CorrelatedMarketSignalDirection, bM as CreateApp, bN as CryptoReferencePriceError, bO as CryptoReferencePriceExternalMarketInput, bP as CryptoReferencePriceMarketInput, bQ as CryptoReferencePriceResult, bR as CryptoReferencePriceSource, bS as CryptoReferencePriceTarget, bT as DepositAddressesPendingResponse, bU as DepositAddressesReadyResponse, bV as DepositAddressesSupportedChain, bW as DepositAddressesToken, bX as DepositStep, bY as DiagnosticCallback, bZ as DiagnosticEvent, b_ as ExecuteManagedRequest, b$ as ExecuteTradeRequest, c0 as ExecuteTradeResponse, c1 as ExecutionDagProgress, c2 as ExecutionDisplayGroupStatus, c3 as ExecutionDisplayStepKind, c4 as ExecutionMode, c5 as ExecutionOverallState, c6 as ExecutionStatusOrder, c7 as ExecutionStatusStep, c8 as GetBalanceQuery, c9 as GetBalanceResponse, ca as GetHoldingsQuery, cb as GetHoldingsResponse, cc as GetOrdersParams, cd as GetOrdersQuery, ce as GetPositionsQuery, cf as HelloResponse, cg as HistoryRangeRequest, ch as INACTIVE_VENUES, ci as LeaderboardMetric, cj as LimitOrderTimeInForce, ck as MarkSource, cl as MarketPriceHistory, cm as MarketView, cn as MarketViewBatch, co as MatchType, cp as MatchedMidpoint, cq as MatchedMidpointOutcome, cr as MatchedOrderbookMarket, cs as MatchedVenueMarketOutcomeRef, ct as MidpointItem, cu as MidpointRow, cv as NewsFeedArticleFeedItem, cw as NewsFeedArticleWithSummary, cx as NewsFeedLinkedMarket, cy as NewsFeedMarketFeedArticle, cz as NewsFeedMarketFeedItem, cA as NewsFeedMarketNewsResult, cB as NonceResponse, cC as OrderListItem, cD as OrderStatus, cE as OrderType, cF as OrderbookBatchItemError, cG as OrderbookBatchItemErrorCode, cH as OrderbookBatchItemStatus, cI as OrderbookHistoryPoint, cJ as OrderbookHistoryResponse, cK as OrderbookLevel, cL as OrderbookQuoteFill, cM as OrderbookQuoteParams, cN as OrderbookQuoteResponse, cO as OrderbookServiceUnavailableError, O as OrderbookState, cP as OrderbooksOnlyError, cQ as OutcomeMidpoint, cR as OutcomeMidpointRow, cS as PaperTradingBalanceAdjustment, cT as PaperTradingLiquidityStatus, cU as PaperTradingMarkSource, cV as PaperTradingPosition, cW as PersistedAuthSnapshot, cX as PositionRedeemStatus, cY as PricePoint, cZ as PriceSource, c_ as PricesHistoryResponse, c$ as ProphetxExecutionMode, d0 as RECURRENCE_CADENCES, d1 as RecurrenceCadence, d2 as RecurringCryptoComparisonPoint, d3 as RecurringCryptoComparisonPriceSource, d4 as RecurringCryptoDuration, d5 as RecurringCryptoDurationInput, d6 as RecurringCryptoMarketMetrics, d7 as RecurringCryptoOrderbookDepthLevel, d8 as RecurringCryptoOrderbookDepthSide, d9 as RecurringCryptoOutcome, da as RecurringCryptoOutcomeOrderbookDepth, db as RecurringCryptoPriceComparison, dc as RecurringCryptoReferencePrice, dd as RecurringCryptoResolution, de as RecurringCryptoSourceConfidence, df as RecurringCryptoVenueMarket, dg as RecurringCryptoWindowComparisons, dh as RecurringCryptoWindowMarket, di as RedeemLegResult, dj as RedeemLegStatus, dk as RequestedOrderbookMarket, dl as ResolvedCorrelatedMarketsResponse, dm as SELF_CUSTODY_FILL_TIMEOUT_MS, dn as SELF_CUSTODY_POLL_INTERVAL_MS, dp as ServerWallet, dq as SettlementDiff, dr as SettlementDifference, ds as SettlementSource, dt as SetupDepositAddressStep, du as SetupVenueKeyStep, dv as SignatureRequest, dw as SignatureRequestType, dx as SignerFn, dy as SimpleOrderbookLevel, dz as SmartRouteAllocation, dA as SmartRouteBridgeStep, dB as SmartRouteFeeBreakdown, dC as SmartRouteFill, dD as SmartRouteSettlementLeg, dE as SmartRouteSettlementPlan, dF as SmartRouteSetupCostLine, dG as SmartRouteSide, dH as SmartRouteStatus, dI as SmartRouteVenueFill, dJ as SportsGameStatus, dK as SportsLiveParticipant, dL as SportsLiveState, dM as TERMINAL_EXECUTION_STATES, dN as TimeInForce, dO as TradeExecutorOrder, dP as TradeStep, dQ as UserActivityBridge, dR as UserActivityDeposit, dS as UserActivityRedeem, dT as UserActivityRedeemLeg, dU as UserActivityTrade, dV as UserActivityType, dW as UserActivityUserOp, dX as UserActivityWithdrawal, dY as VENUES, dZ as VENUE_CHAIN_IDS, d_ as ValidateBalanceOnClientStep, d$ as ValidateManagedParams, e0 as ValidateManagedRequest, e1 as ValidateManagedResponse, e2 as ValidateTradeRequest, e3 as ValidateTradeResponse, e4 as VenueEventListItem, e5 as VenueEventWithMarkets, e6 as VenueGeoPolicyEntry, e7 as VenueMarketListItem, e8 as VenueMarketRef, e9 as VenueOrderbookEntry, ea as VenueOrderbookLevel, eb as VenuePositionBalance, ec as VenuePriceInfo, ed as VenueSoloQuote, ee as VerifyBody, ef as VerifyResponse, eg as WalletChainBalance, eh as WalletTokenBalance, ei as WithdrawManagedRequest, ej as WithdrawManagedSourceItem, ek as WithdrawTokenSymbol, el as WithdrawalExpected, em as WithdrawalLeg, en as WithdrawalLegStatus, eo as WithdrawalLegType, ep as WithdrawalLifecycleStatus, eq as WithdrawalSource, er as WithdrawalSourceItem, es as WithdrawalSourceStatus, et as WithdrawalSourceTokenSymbol, e as WsArbFeedBatch, eu as WsArbFeedEntry, W as WsArbMarketUpdate, ev as WsAttributedLevel, ew as WsAuthenticated, ex as WsBalanceUpdate, ey as WsCandleInterval, ez as WsClientMessage, eA as WsConnected, eB as WsError, eC as WsHeartbeat, eD as WsMarkSource, eE as WsMarketResolved, eF as WsOrderEvent, eG as WsOrderEventType, eH as WsOrderSubmitted, eI as WsOrderbookDelta, eJ as WsOrderbookSnapshot, eK as WsRedeemEvent, eL as WsServerMessage, eM as WsSubscribed, eN as WsTrade, eO as WsUnsubscribed, eP as WsVenueBook, eQ as WsVenueInfo, eR as WsVenueLevel, eS as WsWithdrawalLegStatus, eT as WsWithdrawalLifecycleEvent, eU as WsWithdrawalLifecycleLeg, eV as WsWithdrawalLifecycleStatus, eW as applyOrderbookDelta, eX as computeChecksum, eY as getEffectiveDisabledVenues, eZ as isVenueActive, e_ as isVenueDataVisible, e$ as isVenueInactive, f0 as snapshotToOrderbook } from './agg-websocket-DC7H1Cdh.mjs';
|
|
3
3
|
|
|
4
4
|
declare enum ImageSize {
|
|
5
5
|
sm = 44,
|
|
@@ -1267,6 +1267,60 @@ type LoadImmutableHistoryOptions = {
|
|
|
1267
1267
|
/** Download immutable CDN objects directly. Safe to run in the browser Worker or Node. */
|
|
1268
1268
|
declare function loadImmutableHistory({ manifest, fetch: fetcher, signal, digest, }: LoadImmutableHistoryOptions): Promise<ChartCandle[]>;
|
|
1269
1269
|
|
|
1270
|
+
/** An exact transfer intent survives a page reload before its response arrives.
|
|
1271
|
+
* The normal withdrawal service owns dispatch, bridging and reconciliation. */
|
|
1272
|
+
interface HostedVenueFundingIntent {
|
|
1273
|
+
version: 1;
|
|
1274
|
+
accountId: string;
|
|
1275
|
+
environment: "production";
|
|
1276
|
+
request: WithdrawManagedParams & {
|
|
1277
|
+
requestId: string;
|
|
1278
|
+
};
|
|
1279
|
+
balanceBeforeRaw: string;
|
|
1280
|
+
estimatedFeeRaw: string;
|
|
1281
|
+
withdrawalId?: string;
|
|
1282
|
+
terminal?: boolean;
|
|
1283
|
+
}
|
|
1284
|
+
interface HostedVenueFundingOptions {
|
|
1285
|
+
venue: "betdex";
|
|
1286
|
+
requiredRaw: string;
|
|
1287
|
+
/** Scope this store to the current application/user/venue. */
|
|
1288
|
+
journal: {
|
|
1289
|
+
load(): HostedVenueFundingIntent | null;
|
|
1290
|
+
save(intent: HostedVenueFundingIntent | null): void;
|
|
1291
|
+
};
|
|
1292
|
+
createRequestId(): string;
|
|
1293
|
+
/** Called around every await and before every write. Abort on sign-out/user change. */
|
|
1294
|
+
assertActive(): void;
|
|
1295
|
+
onProgress?: (phase: "preparing" | "transferring" | "confirming") => void;
|
|
1296
|
+
timeoutMs?: number;
|
|
1297
|
+
}
|
|
1298
|
+
type FundingClient = Pick<AggClient, "getHostedVenueAccount" | "provisionHostedVenueAccount" | "getHostedVenueDepositAddress" | "withdrawPreview" | "withdrawManaged" | "getWithdrawalStatus">;
|
|
1299
|
+
/** Prepare the cash required by an order using the existing managed transfer
|
|
1300
|
+
* planner. It selects same-chain cash or bridges supported wallet sources to
|
|
1301
|
+
* the user's verified venue address. No venue order is placed here: callers
|
|
1302
|
+
* obtain a fresh executable quote after native credit and keep their normal
|
|
1303
|
+
* slippage, admission and fill workflow.
|
|
1304
|
+
*
|
|
1305
|
+
* The currently supported hosted-account API is BETDEX; future hosted venues
|
|
1306
|
+
* use the same account/deposit contract and this transfer lifecycle. On-chain
|
|
1307
|
+
* venues retain their existing execution-DAG funding.
|
|
1308
|
+
*/
|
|
1309
|
+
declare function prepareHostedVenueFunding(client: FundingClient, options: HostedVenueFundingOptions): Promise<{
|
|
1310
|
+
availableRaw: string;
|
|
1311
|
+
feeRaw: string;
|
|
1312
|
+
withdrawalId?: string;
|
|
1313
|
+
}>;
|
|
1314
|
+
/** Keep the normal priced order flow after preparing native cash. Requotes
|
|
1315
|
+
* may use only the outcomes the user selected, within the accepted price and
|
|
1316
|
+
* total spend. Transfer fees reduce order spend rather than increasing it. */
|
|
1317
|
+
declare function prepareHostedVenueRoute(client: FundingClient & Pick<AggClient, "getSmartRoute">, options: Omit<HostedVenueFundingOptions, "requiredRaw"> & {
|
|
1318
|
+
quote: SmartRouteResponse;
|
|
1319
|
+
venueMarketOutcomeId: string;
|
|
1320
|
+
maxSpend: number;
|
|
1321
|
+
slipCapBps: number;
|
|
1322
|
+
}): Promise<SmartRouteResponse>;
|
|
1323
|
+
|
|
1270
1324
|
declare function createAggClient(options: AggClientOptions): AggClient;
|
|
1271
1325
|
|
|
1272
|
-
export { AggApiError, type AggApiErrorInit, type AggApiFieldError, AggAuthStartBody, AggAuthStartResult, AggAuthVerifyBody, AggClient, AggClientOptions, AggClientSessionInput, AggLinkAccountBody, AggLinkAccountConfirmResult, AggLinkAccountResult, AggLinkAccountWalletConfirmBody, type AggRateLimitResponse, AggWebSocket, AggWebSocketCallbacks, AppClientConfigResponse, AuthStatus, BalanceRefillAttempt, BalanceRefillPolicy, BatchMidpointsResponse, BatchOrderbooksResponse, type BuildVenueUrlOpts, CancelManagedExecutionResponse, CancelOrderSignature, CancelVenueOrderParams, Candle, Category, ChartBarsResponse, ChartCandle, ChartHistoryManifest, ChartResolution, CorrelatedMarketCascadeResponse, CorrelatedMarketQueryResult, CorrelatedMarketSignalBatch, CorrelatedMarketsStatus, CreateBalanceRefillPolicyParams, CreatePaperTradingAccountParams, CryptoReferencePricesResponse, DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW, DEFAULT_BALANCE_REFILL_MAX_FEE_RAW, DepositAddressesResponse, EventBootstrapResponse, ExecuteManagedParams, ExecuteManagedResponse, ExecutionOrderItem, ExecutionOrdersQuery, ExecutionPositionGroup, ExecutionPositionsQuery, ExecutionStatusQuery, ExecutionStatusResponse, GetCryptoReferencePricesOptions, GetPositionsParams, type HostedVenueAccount, type HostedVenueActivity, type HostedVenueActivityCode, type HostedVenueActivityQuery, type HostedVenueBalance, type HostedVenueDepositAddress, type HostedVenueWithdrawal, type HostedVenueWithdrawalRequest, IMAGE_SIZES, ImageSize, LIMIT_PRICE_RAW_SCALE, LeaderboardQuery, LeaderboardRow, type LimitPriceSide, type LimitPriceTickAdjustment, ListRecurringCryptoMarketsOptions, type LoadImmutableHistoryOptions, ManagedBalancesParams, MarketStatus, MatchStatus, NewsFeedArticleFeedResponse, NewsFeedListResponse, NewsFeedMarketFeedResponse, NewsFeedMarketNewsParams, NewsFeedMarketNewsResponse, NewsFeedPageOptions, NewsFeedStatusResponse, OrderListQuery, Orderbook, OutcomeOrderbookResponse, PaginatedResponse, PaperTradingAccount, PaperTradingAccountsPage, PaperTradingAppOptions, PaperTradingBalanceResponse, PaperTradingListParams, PaperTradingOrder, PaperTradingOrdersPage, PaperTradingPortfolio, PaperTradingPositionsPage, PlaceLimitOrderParams, PlaceLimitOrderResponse, PlacePaperTradingOrderParams, PositionGroup, type ProvisionHostedVenueAccountBody, type QuoteError, type QuoteErrorCode, RETINA_IMAGE_SIZES, RampQuote, RampQuoteRequest, RampSessionRequest, RampWidgetSession, RecurrenceFilter, RecurringCryptoMarketsResponse, RedeemRequest, RedeemResponse, ResetPaperTradingAccountParams, ResolveCorrelatedMarketsParams, ResolveCorrelatedMarketsResponse, RpcTokenResponse, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, SearchParams, SearchResponse, SetPaperTradingBalanceParams, SmartRouteParams, SmartRouteResponse, type SplitsByAmountResult, SportsLiveResponse, SyncBalancesResponse, TradeExecutorOrderListResponse, TradeSide, TradeSplit, TurnstileChallengeError, UnifiedBalanceResponse, UpdateBalanceRefillPolicyParams, UpdateUserBody, UpsertVenueKey, UserActivityItem, UserActivityQuery, UserHolding, UserProfile, Venue, VenueEvent, VenueGeoPolicyResponse, VenueKeyStatus, VenueKeySummary, VenueMarket, type VenueMarketClusterNode, VenueMarketOutcome, WithdrawManagedParams, WithdrawManagedResponse, WithdrawPreviewParams, WithdrawPreviewResponse, WithdrawalQuoteParams, WithdrawalQuoteResponse, adjustLimitPriceRawToTick, aggregateMidpoint, buildVenueUrl, computeBestSplitsByAmount, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getBalanceRefillMaximumRaw, getWalletAddressFromUserProfile, hasShape, isAggApiError, isBalanceRefillWithinDailyCap, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, loadImmutableHistory, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, orderbookCrc32, parse, parseEmail, parseEmailStrict, projectedOrderbookChecksum, retinaImageUrl, safeParse, sortVenues, toChecksumAddress };
|
|
1326
|
+
export { AggApiError, type AggApiErrorInit, type AggApiFieldError, AggAuthStartBody, AggAuthStartResult, AggAuthVerifyBody, AggClient, AggClientOptions, AggClientSessionInput, AggLinkAccountBody, AggLinkAccountConfirmResult, AggLinkAccountResult, AggLinkAccountWalletConfirmBody, type AggRateLimitResponse, AggWebSocket, AggWebSocketCallbacks, AppClientConfigResponse, AuthStatus, BalanceRefillAttempt, BalanceRefillPolicy, BatchMidpointsResponse, BatchOrderbooksResponse, type BuildVenueUrlOpts, CancelManagedExecutionResponse, CancelOrderSignature, CancelVenueOrderParams, Candle, Category, ChartBarsResponse, ChartCandle, ChartHistoryManifest, ChartResolution, CorrelatedMarketCascadeResponse, CorrelatedMarketQueryResult, CorrelatedMarketSignalBatch, CorrelatedMarketsStatus, CreateBalanceRefillPolicyParams, CreatePaperTradingAccountParams, CryptoReferencePricesResponse, DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW, DEFAULT_BALANCE_REFILL_MAX_FEE_RAW, DepositAddressesResponse, EventBootstrapResponse, ExecuteManagedParams, ExecuteManagedResponse, ExecutionOrderItem, ExecutionOrdersQuery, ExecutionPositionGroup, ExecutionPositionsQuery, ExecutionStatusQuery, ExecutionStatusResponse, GetCryptoReferencePricesOptions, GetPositionsParams, type HostedVenueAccount, type HostedVenueActivity, type HostedVenueActivityCode, type HostedVenueActivityQuery, type HostedVenueBalance, type HostedVenueDepositAddress, type HostedVenueFundingIntent, type HostedVenueFundingOptions, type HostedVenueWithdrawal, type HostedVenueWithdrawalRequest, IMAGE_SIZES, ImageSize, LIMIT_PRICE_RAW_SCALE, LeaderboardQuery, LeaderboardRow, type LimitPriceSide, type LimitPriceTickAdjustment, ListRecurringCryptoMarketsOptions, type LoadImmutableHistoryOptions, ManagedBalancesParams, MarketStatus, MatchStatus, NewsFeedArticleFeedResponse, NewsFeedListResponse, NewsFeedMarketFeedResponse, NewsFeedMarketNewsParams, NewsFeedMarketNewsResponse, NewsFeedPageOptions, NewsFeedStatusResponse, OrderListQuery, Orderbook, OutcomeOrderbookResponse, PaginatedResponse, PaperTradingAccount, PaperTradingAccountsPage, PaperTradingAppOptions, PaperTradingBalanceResponse, PaperTradingListParams, PaperTradingOrder, PaperTradingOrdersPage, PaperTradingPortfolio, PaperTradingPositionsPage, PlaceLimitOrderParams, PlaceLimitOrderResponse, PlacePaperTradingOrderParams, PositionGroup, type ProvisionHostedVenueAccountBody, type QuoteError, type QuoteErrorCode, RETINA_IMAGE_SIZES, RampQuote, RampQuoteRequest, RampSessionRequest, RampWidgetSession, RecurrenceFilter, RecurringCryptoMarketsResponse, RedeemRequest, RedeemResponse, ResetPaperTradingAccountParams, ResolveCorrelatedMarketsParams, ResolveCorrelatedMarketsResponse, RpcTokenResponse, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, SearchParams, SearchResponse, SetPaperTradingBalanceParams, SmartRouteParams, SmartRouteResponse, type SplitsByAmountResult, SportsLiveResponse, SyncBalancesResponse, TradeExecutorOrderListResponse, TradeSide, TradeSplit, TurnstileChallengeError, UnifiedBalanceResponse, UpdateBalanceRefillPolicyParams, UpdateUserBody, UpsertVenueKey, UserActivityItem, UserActivityQuery, UserHolding, UserProfile, Venue, VenueEvent, VenueGeoPolicyResponse, VenueKeyStatus, VenueKeySummary, VenueMarket, type VenueMarketClusterNode, VenueMarketOutcome, WithdrawManagedParams, WithdrawManagedResponse, WithdrawPreviewParams, WithdrawPreviewResponse, WithdrawalQuoteParams, WithdrawalQuoteResponse, adjustLimitPriceRawToTick, aggregateMidpoint, buildVenueUrl, computeBestSplitsByAmount, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getBalanceRefillMaximumRaw, getWalletAddressFromUserProfile, hasShape, isAggApiError, isBalanceRefillWithinDailyCap, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, loadImmutableHistory, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, orderbookCrc32, parse, parseEmail, parseEmailStrict, prepareHostedVenueFunding, prepareHostedVenueRoute, projectedOrderbookChecksum, retinaImageUrl, safeParse, sortVenues, toChecksumAddress };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as Venue, U as UserProfile, T as TradeSplit, g as VenueMarket, h as VenueMarketOutcome, i as Orderbook, j as TradeSide, k as AggClientOptions, l as AggClientSessionInput, m as AuthStatus, S as SiweMessageParams, n as SiwsMessageParams, o as AggAuthVerifyBody, p as AggAuthStartBody, q as AggAuthStartResult, r as AggLinkAccountBody, s as AggLinkAccountResult, t as AggLinkAccountWalletConfirmBody, u as AggLinkAccountConfirmResult, v as UpdateUserBody, P as PaginatedResponse, w as UserHolding, x as OrderListQuery, y as TradeExecutorOrderListResponse, E as ExecutionOrdersQuery, z as ExecutionOrderItem, B as ExecutionStatusQuery, D as ExecutionStatusResponse, F as UserActivityQuery, G as UserActivityItem, L as LeaderboardQuery, H as LeaderboardRow, I as ExecutionPositionsQuery, J as ExecutionPositionGroup, K as ManagedBalancesParams, N as UnifiedBalanceResponse, Q as UpsertVenueKey, R as VenueKeySummary, X as VenueKeyStatus, Y as CreatePaperTradingAccountParams, Z as PaperTradingAppOptions, _ as PaperTradingAccount, $ as PaperTradingAccountListParams, a0 as PaperTradingAccountsPage, a1 as SetPaperTradingBalanceParams, a2 as PaperTradingBalanceResponse, a3 as ResetPaperTradingAccountParams, a4 as PlacePaperTradingOrderParams, a5 as PaperTradingOrder, a6 as PaperTradingListParams, a7 as PaperTradingPositionsPage, a8 as PaperTradingOrdersPage, a9 as PaperTradingPortfolio, aa as CancelOrderSignature, ab as CancelManagedExecutionResponse, ac as CancelVenueOrderParams, ad as MatchStatus, ae as MarketStatus, af as RecurrenceFilter, ag as VenueEvent, ah as EventBootstrapResponse, ai as SportsLiveResponse, aj as ListRecurringCryptoMarketsOptions, ak as RecurringCryptoMarketsResponse, al as GetCryptoReferencePricesOptions, am as CryptoReferencePricesResponse, an as Category, ao as AppClientConfigResponse, ap as VenueGeoPolicyResponse, aq as RpcTokenResponse, ar as NewsFeedListResponse, as as NewsFeedPageOptions, at as NewsFeedArticleFeedResponse, au as NewsFeedMarketFeedResponse, av as NewsFeedStatusResponse, aw as NewsFeedMarketNewsParams, ax as NewsFeedMarketNewsResponse, ay as SearchParams, az as SearchResponse, aA as CorrelatedMarketsStatus, aB as CorrelatedMarketSignalBatch, aC as CorrelatedMarketQueryResult, aD as CorrelatedMarketCascadeResponse, aE as ResolveCorrelatedMarketsParams, aF as ResolveCorrelatedMarketsResponse, aG as ChartResolution, C as ChartBarsResponse, b as ChartHistoryManifest, aH as BatchOrderbooksResponse, aI as BatchMidpointsResponse, aJ as OutcomeOrderbookResponse, aK as SmartRouteParams, aL as SmartRouteResponse, f as AggWebSocketCallbacks, A as AggWebSocket, aM as ExecuteManagedParams, aN as ExecuteManagedResponse, aO as PlaceLimitOrderParams, aP as PlaceLimitOrderResponse, aQ as PlaceOrderParams, aR as PlaceOrderResponse, aS as RedeemRequest, aT as RedeemResponse, aU as BalanceRefillPolicy, aV as CreateBalanceRefillPolicyParams, aW as UpdateBalanceRefillPolicyParams, aX as BalanceRefillAttempt, aY as WithdrawManagedParams, aZ as WithdrawManagedResponse, a_ as WithdrawPreviewParams, a$ as WithdrawPreviewResponse, b0 as WithdrawalQuoteParams, b1 as WithdrawalQuoteResponse, b2 as SyncBalancesResponse, b3 as DepositAddressesResponse, b4 as GetPositionsParams, b5 as PositionGroup, b6 as RampQuoteRequest, b7 as RampQuote, b8 as RampSessionRequest, b9 as RampWidgetSession, ba as Candle, c as ChartCandle } from './agg-websocket-
|
|
2
|
-
export { bb as ACTIVE_VENUES, bc as Account, bd as AccountProvider, be as AccountType, bf as AggAuthDeliveryMode, bg as AggAuthPrivyVerifyBody, bh as AggAuthProviderType, bi as AggAuthWalletVerifyBody, bj as AggClientAuthOptions, bk as AggSessionUser, d as AggWebSocketDiagnostics, a as AggWebSocketOptions, bl as AggregatedOrderbookLevel, bm as AggregatedOrderbookResponse, bn as App, bo as AppTradingMode, bp as AttributedOrderbook, bq as AttributedOrderbookLevel, br as AuthCodeResponse, bs as AuthTokenResponse, bt as AuthUser, bu as BalanceCustody, bv as BalanceRefillAttemptStatus, bw as BalanceRefillPolicyStatus, bx as BookQuality, by as CONFIRMED_MATCH_STATUSES, bz as CandleBuilder, bA as CandleInterval, bB as CandleTail, bC as Chain, bD as ChartBarsMeta, bE as ChartVenueCandles, bF as ComputeSplitsRequest, bG as ComputeSplitsResponse, bH as ComputeSplitsSelection, bI as CorrelatedMarketCascadeItem, bJ as CorrelatedMarketSide, bK as CorrelatedMarketSignal, bL as CorrelatedMarketSignalDirection, bM as CreateApp, bN as CryptoReferencePriceError, bO as CryptoReferencePriceExternalMarketInput, bP as CryptoReferencePriceMarketInput, bQ as CryptoReferencePriceResult, bR as CryptoReferencePriceSource, bS as CryptoReferencePriceTarget, bT as DepositAddressesPendingResponse, bU as DepositAddressesReadyResponse, bV as DepositAddressesSupportedChain, bW as DepositAddressesToken, bX as DepositStep, bY as DiagnosticCallback, bZ as DiagnosticEvent, b_ as ExecuteManagedRequest, b$ as ExecuteTradeRequest, c0 as ExecuteTradeResponse, c1 as ExecutionDagProgress, c2 as ExecutionDisplayGroupStatus, c3 as ExecutionDisplayStepKind, c4 as ExecutionMode, c5 as ExecutionOverallState, c6 as ExecutionStatusOrder, c7 as ExecutionStatusStep, c8 as GetBalanceQuery, c9 as GetBalanceResponse, ca as GetHoldingsQuery, cb as GetHoldingsResponse, cc as GetOrdersParams, cd as GetOrdersQuery, ce as GetPositionsQuery, cf as HelloResponse, cg as HistoryRangeRequest, ch as INACTIVE_VENUES, ci as LeaderboardMetric, cj as LimitOrderTimeInForce, ck as MarkSource, cl as MarketPriceHistory, cm as MarketView, cn as MarketViewBatch, co as MatchType, cp as MatchedMidpoint, cq as MatchedMidpointOutcome, cr as MatchedOrderbookMarket, cs as MatchedVenueMarketOutcomeRef, ct as MidpointItem, cu as MidpointRow, cv as NewsFeedArticleFeedItem, cw as NewsFeedArticleWithSummary, cx as NewsFeedLinkedMarket, cy as NewsFeedMarketFeedArticle, cz as NewsFeedMarketFeedItem, cA as NewsFeedMarketNewsResult, cB as NonceResponse, cC as OrderListItem, cD as OrderStatus, cE as OrderType, cF as OrderbookBatchItemError, cG as OrderbookBatchItemErrorCode, cH as OrderbookBatchItemStatus, cI as OrderbookHistoryPoint, cJ as OrderbookHistoryResponse, cK as OrderbookLevel, cL as OrderbookQuoteFill, cM as OrderbookQuoteParams, cN as OrderbookQuoteResponse, cO as OrderbookServiceUnavailableError, O as OrderbookState, cP as OrderbooksOnlyError, cQ as OutcomeMidpoint, cR as OutcomeMidpointRow, cS as PaperTradingBalanceAdjustment, cT as PaperTradingLiquidityStatus, cU as PaperTradingMarkSource, cV as PaperTradingPosition, cW as PersistedAuthSnapshot, cX as PositionRedeemStatus, cY as PricePoint, cZ as PriceSource, c_ as PricesHistoryResponse, c$ as ProphetxExecutionMode, d0 as RECURRENCE_CADENCES, d1 as RecurrenceCadence, d2 as RecurringCryptoComparisonPoint, d3 as RecurringCryptoComparisonPriceSource, d4 as RecurringCryptoDuration, d5 as RecurringCryptoDurationInput, d6 as RecurringCryptoMarketMetrics, d7 as RecurringCryptoOrderbookDepthLevel, d8 as RecurringCryptoOrderbookDepthSide, d9 as RecurringCryptoOutcome, da as RecurringCryptoOutcomeOrderbookDepth, db as RecurringCryptoPriceComparison, dc as RecurringCryptoReferencePrice, dd as RecurringCryptoResolution, de as RecurringCryptoSourceConfidence, df as RecurringCryptoVenueMarket, dg as RecurringCryptoWindowComparisons, dh as RecurringCryptoWindowMarket, di as RedeemLegResult, dj as RedeemLegStatus, dk as RequestedOrderbookMarket, dl as ResolvedCorrelatedMarketsResponse, dm as SELF_CUSTODY_FILL_TIMEOUT_MS, dn as SELF_CUSTODY_POLL_INTERVAL_MS, dp as ServerWallet, dq as SettlementDiff, dr as SettlementDifference, ds as SettlementSource, dt as SetupDepositAddressStep, du as SetupVenueKeyStep, dv as SignatureRequest, dw as SignatureRequestType, dx as SignerFn, dy as SimpleOrderbookLevel, dz as SmartRouteAllocation, dA as SmartRouteBridgeStep, dB as SmartRouteFeeBreakdown, dC as SmartRouteFill, dD as SmartRouteSettlementLeg, dE as SmartRouteSettlementPlan, dF as SmartRouteSetupCostLine, dG as SmartRouteSide, dH as SmartRouteStatus, dI as SmartRouteVenueFill, dJ as SportsGameStatus, dK as SportsLiveParticipant, dL as SportsLiveState, dM as TERMINAL_EXECUTION_STATES, dN as TimeInForce, dO as TradeExecutorOrder, dP as TradeStep, dQ as UserActivityBridge, dR as UserActivityDeposit, dS as UserActivityRedeem, dT as UserActivityRedeemLeg, dU as UserActivityTrade, dV as UserActivityType, dW as UserActivityUserOp, dX as UserActivityWithdrawal, dY as VENUES, dZ as VENUE_CHAIN_IDS, d_ as ValidateBalanceOnClientStep, d$ as ValidateManagedParams, e0 as ValidateManagedRequest, e1 as ValidateManagedResponse, e2 as ValidateTradeRequest, e3 as ValidateTradeResponse, e4 as VenueEventListItem, e5 as VenueEventWithMarkets, e6 as VenueGeoPolicyEntry, e7 as VenueMarketListItem, e8 as VenueMarketRef, e9 as VenueOrderbookEntry, ea as VenueOrderbookLevel, eb as VenuePositionBalance, ec as VenuePriceInfo, ed as VenueSoloQuote, ee as VerifyBody, ef as VerifyResponse, eg as WalletChainBalance, eh as WalletTokenBalance, ei as WithdrawManagedRequest, ej as WithdrawManagedSourceItem, ek as WithdrawTokenSymbol, el as WithdrawalExpected, em as WithdrawalLeg, en as WithdrawalLegStatus, eo as WithdrawalLegType, ep as WithdrawalLifecycleStatus, eq as WithdrawalSource, er as WithdrawalSourceItem, es as WithdrawalSourceStatus, et as WithdrawalSourceTokenSymbol, e as WsArbFeedBatch, eu as WsArbFeedEntry, W as WsArbMarketUpdate, ev as WsAttributedLevel, ew as WsAuthenticated, ex as WsBalanceUpdate, ey as WsCandleInterval, ez as WsClientMessage, eA as WsConnected, eB as WsError, eC as WsHeartbeat, eD as WsMarkSource, eE as WsMarketResolved, eF as WsOrderEvent, eG as WsOrderEventType, eH as WsOrderSubmitted, eI as WsOrderbookDelta, eJ as WsOrderbookSnapshot, eK as WsRedeemEvent, eL as WsServerMessage, eM as WsSubscribed, eN as WsTrade, eO as WsUnsubscribed, eP as WsVenueBook, eQ as WsVenueInfo, eR as WsVenueLevel, eS as WsWithdrawalLegStatus, eT as WsWithdrawalLifecycleEvent, eU as WsWithdrawalLifecycleLeg, eV as WsWithdrawalLifecycleStatus, eW as applyOrderbookDelta, eX as computeChecksum, eY as getEffectiveDisabledVenues, eZ as isVenueActive, e_ as isVenueDataVisible, e$ as isVenueInactive, f0 as snapshotToOrderbook } from './agg-websocket-
|
|
1
|
+
import { V as Venue, U as UserProfile, T as TradeSplit, g as VenueMarket, h as VenueMarketOutcome, i as Orderbook, j as TradeSide, k as AggClientOptions, l as AggClientSessionInput, m as AuthStatus, S as SiweMessageParams, n as SiwsMessageParams, o as AggAuthVerifyBody, p as AggAuthStartBody, q as AggAuthStartResult, r as AggLinkAccountBody, s as AggLinkAccountResult, t as AggLinkAccountWalletConfirmBody, u as AggLinkAccountConfirmResult, v as UpdateUserBody, P as PaginatedResponse, w as UserHolding, x as OrderListQuery, y as TradeExecutorOrderListResponse, E as ExecutionOrdersQuery, z as ExecutionOrderItem, B as ExecutionStatusQuery, D as ExecutionStatusResponse, F as UserActivityQuery, G as UserActivityItem, L as LeaderboardQuery, H as LeaderboardRow, I as ExecutionPositionsQuery, J as ExecutionPositionGroup, K as ManagedBalancesParams, N as UnifiedBalanceResponse, Q as UpsertVenueKey, R as VenueKeySummary, X as VenueKeyStatus, Y as CreatePaperTradingAccountParams, Z as PaperTradingAppOptions, _ as PaperTradingAccount, $ as PaperTradingAccountListParams, a0 as PaperTradingAccountsPage, a1 as SetPaperTradingBalanceParams, a2 as PaperTradingBalanceResponse, a3 as ResetPaperTradingAccountParams, a4 as PlacePaperTradingOrderParams, a5 as PaperTradingOrder, a6 as PaperTradingListParams, a7 as PaperTradingPositionsPage, a8 as PaperTradingOrdersPage, a9 as PaperTradingPortfolio, aa as CancelOrderSignature, ab as CancelManagedExecutionResponse, ac as CancelVenueOrderParams, ad as MatchStatus, ae as MarketStatus, af as RecurrenceFilter, ag as VenueEvent, ah as EventBootstrapResponse, ai as SportsLiveResponse, aj as ListRecurringCryptoMarketsOptions, ak as RecurringCryptoMarketsResponse, al as GetCryptoReferencePricesOptions, am as CryptoReferencePricesResponse, an as Category, ao as AppClientConfigResponse, ap as VenueGeoPolicyResponse, aq as RpcTokenResponse, ar as NewsFeedListResponse, as as NewsFeedPageOptions, at as NewsFeedArticleFeedResponse, au as NewsFeedMarketFeedResponse, av as NewsFeedStatusResponse, aw as NewsFeedMarketNewsParams, ax as NewsFeedMarketNewsResponse, ay as SearchParams, az as SearchResponse, aA as CorrelatedMarketsStatus, aB as CorrelatedMarketSignalBatch, aC as CorrelatedMarketQueryResult, aD as CorrelatedMarketCascadeResponse, aE as ResolveCorrelatedMarketsParams, aF as ResolveCorrelatedMarketsResponse, aG as ChartResolution, C as ChartBarsResponse, b as ChartHistoryManifest, aH as BatchOrderbooksResponse, aI as BatchMidpointsResponse, aJ as OutcomeOrderbookResponse, aK as SmartRouteParams, aL as SmartRouteResponse, f as AggWebSocketCallbacks, A as AggWebSocket, aM as ExecuteManagedParams, aN as ExecuteManagedResponse, aO as PlaceLimitOrderParams, aP as PlaceLimitOrderResponse, aQ as PlaceOrderParams, aR as PlaceOrderResponse, aS as RedeemRequest, aT as RedeemResponse, aU as BalanceRefillPolicy, aV as CreateBalanceRefillPolicyParams, aW as UpdateBalanceRefillPolicyParams, aX as BalanceRefillAttempt, aY as WithdrawManagedParams, aZ as WithdrawManagedResponse, a_ as WithdrawPreviewParams, a$ as WithdrawPreviewResponse, b0 as WithdrawalQuoteParams, b1 as WithdrawalQuoteResponse, b2 as SyncBalancesResponse, b3 as DepositAddressesResponse, b4 as GetPositionsParams, b5 as PositionGroup, b6 as RampQuoteRequest, b7 as RampQuote, b8 as RampSessionRequest, b9 as RampWidgetSession, ba as Candle, c as ChartCandle } from './agg-websocket-DC7H1Cdh.js';
|
|
2
|
+
export { bb as ACTIVE_VENUES, bc as Account, bd as AccountProvider, be as AccountType, bf as AggAuthDeliveryMode, bg as AggAuthPrivyVerifyBody, bh as AggAuthProviderType, bi as AggAuthWalletVerifyBody, bj as AggClientAuthOptions, bk as AggSessionUser, d as AggWebSocketDiagnostics, a as AggWebSocketOptions, bl as AggregatedOrderbookLevel, bm as AggregatedOrderbookResponse, bn as App, bo as AppTradingMode, bp as AttributedOrderbook, bq as AttributedOrderbookLevel, br as AuthCodeResponse, bs as AuthTokenResponse, bt as AuthUser, bu as BalanceCustody, bv as BalanceRefillAttemptStatus, bw as BalanceRefillPolicyStatus, bx as BookQuality, by as CONFIRMED_MATCH_STATUSES, bz as CandleBuilder, bA as CandleInterval, bB as CandleTail, bC as Chain, bD as ChartBarsMeta, bE as ChartVenueCandles, bF as ComputeSplitsRequest, bG as ComputeSplitsResponse, bH as ComputeSplitsSelection, bI as CorrelatedMarketCascadeItem, bJ as CorrelatedMarketSide, bK as CorrelatedMarketSignal, bL as CorrelatedMarketSignalDirection, bM as CreateApp, bN as CryptoReferencePriceError, bO as CryptoReferencePriceExternalMarketInput, bP as CryptoReferencePriceMarketInput, bQ as CryptoReferencePriceResult, bR as CryptoReferencePriceSource, bS as CryptoReferencePriceTarget, bT as DepositAddressesPendingResponse, bU as DepositAddressesReadyResponse, bV as DepositAddressesSupportedChain, bW as DepositAddressesToken, bX as DepositStep, bY as DiagnosticCallback, bZ as DiagnosticEvent, b_ as ExecuteManagedRequest, b$ as ExecuteTradeRequest, c0 as ExecuteTradeResponse, c1 as ExecutionDagProgress, c2 as ExecutionDisplayGroupStatus, c3 as ExecutionDisplayStepKind, c4 as ExecutionMode, c5 as ExecutionOverallState, c6 as ExecutionStatusOrder, c7 as ExecutionStatusStep, c8 as GetBalanceQuery, c9 as GetBalanceResponse, ca as GetHoldingsQuery, cb as GetHoldingsResponse, cc as GetOrdersParams, cd as GetOrdersQuery, ce as GetPositionsQuery, cf as HelloResponse, cg as HistoryRangeRequest, ch as INACTIVE_VENUES, ci as LeaderboardMetric, cj as LimitOrderTimeInForce, ck as MarkSource, cl as MarketPriceHistory, cm as MarketView, cn as MarketViewBatch, co as MatchType, cp as MatchedMidpoint, cq as MatchedMidpointOutcome, cr as MatchedOrderbookMarket, cs as MatchedVenueMarketOutcomeRef, ct as MidpointItem, cu as MidpointRow, cv as NewsFeedArticleFeedItem, cw as NewsFeedArticleWithSummary, cx as NewsFeedLinkedMarket, cy as NewsFeedMarketFeedArticle, cz as NewsFeedMarketFeedItem, cA as NewsFeedMarketNewsResult, cB as NonceResponse, cC as OrderListItem, cD as OrderStatus, cE as OrderType, cF as OrderbookBatchItemError, cG as OrderbookBatchItemErrorCode, cH as OrderbookBatchItemStatus, cI as OrderbookHistoryPoint, cJ as OrderbookHistoryResponse, cK as OrderbookLevel, cL as OrderbookQuoteFill, cM as OrderbookQuoteParams, cN as OrderbookQuoteResponse, cO as OrderbookServiceUnavailableError, O as OrderbookState, cP as OrderbooksOnlyError, cQ as OutcomeMidpoint, cR as OutcomeMidpointRow, cS as PaperTradingBalanceAdjustment, cT as PaperTradingLiquidityStatus, cU as PaperTradingMarkSource, cV as PaperTradingPosition, cW as PersistedAuthSnapshot, cX as PositionRedeemStatus, cY as PricePoint, cZ as PriceSource, c_ as PricesHistoryResponse, c$ as ProphetxExecutionMode, d0 as RECURRENCE_CADENCES, d1 as RecurrenceCadence, d2 as RecurringCryptoComparisonPoint, d3 as RecurringCryptoComparisonPriceSource, d4 as RecurringCryptoDuration, d5 as RecurringCryptoDurationInput, d6 as RecurringCryptoMarketMetrics, d7 as RecurringCryptoOrderbookDepthLevel, d8 as RecurringCryptoOrderbookDepthSide, d9 as RecurringCryptoOutcome, da as RecurringCryptoOutcomeOrderbookDepth, db as RecurringCryptoPriceComparison, dc as RecurringCryptoReferencePrice, dd as RecurringCryptoResolution, de as RecurringCryptoSourceConfidence, df as RecurringCryptoVenueMarket, dg as RecurringCryptoWindowComparisons, dh as RecurringCryptoWindowMarket, di as RedeemLegResult, dj as RedeemLegStatus, dk as RequestedOrderbookMarket, dl as ResolvedCorrelatedMarketsResponse, dm as SELF_CUSTODY_FILL_TIMEOUT_MS, dn as SELF_CUSTODY_POLL_INTERVAL_MS, dp as ServerWallet, dq as SettlementDiff, dr as SettlementDifference, ds as SettlementSource, dt as SetupDepositAddressStep, du as SetupVenueKeyStep, dv as SignatureRequest, dw as SignatureRequestType, dx as SignerFn, dy as SimpleOrderbookLevel, dz as SmartRouteAllocation, dA as SmartRouteBridgeStep, dB as SmartRouteFeeBreakdown, dC as SmartRouteFill, dD as SmartRouteSettlementLeg, dE as SmartRouteSettlementPlan, dF as SmartRouteSetupCostLine, dG as SmartRouteSide, dH as SmartRouteStatus, dI as SmartRouteVenueFill, dJ as SportsGameStatus, dK as SportsLiveParticipant, dL as SportsLiveState, dM as TERMINAL_EXECUTION_STATES, dN as TimeInForce, dO as TradeExecutorOrder, dP as TradeStep, dQ as UserActivityBridge, dR as UserActivityDeposit, dS as UserActivityRedeem, dT as UserActivityRedeemLeg, dU as UserActivityTrade, dV as UserActivityType, dW as UserActivityUserOp, dX as UserActivityWithdrawal, dY as VENUES, dZ as VENUE_CHAIN_IDS, d_ as ValidateBalanceOnClientStep, d$ as ValidateManagedParams, e0 as ValidateManagedRequest, e1 as ValidateManagedResponse, e2 as ValidateTradeRequest, e3 as ValidateTradeResponse, e4 as VenueEventListItem, e5 as VenueEventWithMarkets, e6 as VenueGeoPolicyEntry, e7 as VenueMarketListItem, e8 as VenueMarketRef, e9 as VenueOrderbookEntry, ea as VenueOrderbookLevel, eb as VenuePositionBalance, ec as VenuePriceInfo, ed as VenueSoloQuote, ee as VerifyBody, ef as VerifyResponse, eg as WalletChainBalance, eh as WalletTokenBalance, ei as WithdrawManagedRequest, ej as WithdrawManagedSourceItem, ek as WithdrawTokenSymbol, el as WithdrawalExpected, em as WithdrawalLeg, en as WithdrawalLegStatus, eo as WithdrawalLegType, ep as WithdrawalLifecycleStatus, eq as WithdrawalSource, er as WithdrawalSourceItem, es as WithdrawalSourceStatus, et as WithdrawalSourceTokenSymbol, e as WsArbFeedBatch, eu as WsArbFeedEntry, W as WsArbMarketUpdate, ev as WsAttributedLevel, ew as WsAuthenticated, ex as WsBalanceUpdate, ey as WsCandleInterval, ez as WsClientMessage, eA as WsConnected, eB as WsError, eC as WsHeartbeat, eD as WsMarkSource, eE as WsMarketResolved, eF as WsOrderEvent, eG as WsOrderEventType, eH as WsOrderSubmitted, eI as WsOrderbookDelta, eJ as WsOrderbookSnapshot, eK as WsRedeemEvent, eL as WsServerMessage, eM as WsSubscribed, eN as WsTrade, eO as WsUnsubscribed, eP as WsVenueBook, eQ as WsVenueInfo, eR as WsVenueLevel, eS as WsWithdrawalLegStatus, eT as WsWithdrawalLifecycleEvent, eU as WsWithdrawalLifecycleLeg, eV as WsWithdrawalLifecycleStatus, eW as applyOrderbookDelta, eX as computeChecksum, eY as getEffectiveDisabledVenues, eZ as isVenueActive, e_ as isVenueDataVisible, e$ as isVenueInactive, f0 as snapshotToOrderbook } from './agg-websocket-DC7H1Cdh.js';
|
|
3
3
|
|
|
4
4
|
declare enum ImageSize {
|
|
5
5
|
sm = 44,
|
|
@@ -1267,6 +1267,60 @@ type LoadImmutableHistoryOptions = {
|
|
|
1267
1267
|
/** Download immutable CDN objects directly. Safe to run in the browser Worker or Node. */
|
|
1268
1268
|
declare function loadImmutableHistory({ manifest, fetch: fetcher, signal, digest, }: LoadImmutableHistoryOptions): Promise<ChartCandle[]>;
|
|
1269
1269
|
|
|
1270
|
+
/** An exact transfer intent survives a page reload before its response arrives.
|
|
1271
|
+
* The normal withdrawal service owns dispatch, bridging and reconciliation. */
|
|
1272
|
+
interface HostedVenueFundingIntent {
|
|
1273
|
+
version: 1;
|
|
1274
|
+
accountId: string;
|
|
1275
|
+
environment: "production";
|
|
1276
|
+
request: WithdrawManagedParams & {
|
|
1277
|
+
requestId: string;
|
|
1278
|
+
};
|
|
1279
|
+
balanceBeforeRaw: string;
|
|
1280
|
+
estimatedFeeRaw: string;
|
|
1281
|
+
withdrawalId?: string;
|
|
1282
|
+
terminal?: boolean;
|
|
1283
|
+
}
|
|
1284
|
+
interface HostedVenueFundingOptions {
|
|
1285
|
+
venue: "betdex";
|
|
1286
|
+
requiredRaw: string;
|
|
1287
|
+
/** Scope this store to the current application/user/venue. */
|
|
1288
|
+
journal: {
|
|
1289
|
+
load(): HostedVenueFundingIntent | null;
|
|
1290
|
+
save(intent: HostedVenueFundingIntent | null): void;
|
|
1291
|
+
};
|
|
1292
|
+
createRequestId(): string;
|
|
1293
|
+
/** Called around every await and before every write. Abort on sign-out/user change. */
|
|
1294
|
+
assertActive(): void;
|
|
1295
|
+
onProgress?: (phase: "preparing" | "transferring" | "confirming") => void;
|
|
1296
|
+
timeoutMs?: number;
|
|
1297
|
+
}
|
|
1298
|
+
type FundingClient = Pick<AggClient, "getHostedVenueAccount" | "provisionHostedVenueAccount" | "getHostedVenueDepositAddress" | "withdrawPreview" | "withdrawManaged" | "getWithdrawalStatus">;
|
|
1299
|
+
/** Prepare the cash required by an order using the existing managed transfer
|
|
1300
|
+
* planner. It selects same-chain cash or bridges supported wallet sources to
|
|
1301
|
+
* the user's verified venue address. No venue order is placed here: callers
|
|
1302
|
+
* obtain a fresh executable quote after native credit and keep their normal
|
|
1303
|
+
* slippage, admission and fill workflow.
|
|
1304
|
+
*
|
|
1305
|
+
* The currently supported hosted-account API is BETDEX; future hosted venues
|
|
1306
|
+
* use the same account/deposit contract and this transfer lifecycle. On-chain
|
|
1307
|
+
* venues retain their existing execution-DAG funding.
|
|
1308
|
+
*/
|
|
1309
|
+
declare function prepareHostedVenueFunding(client: FundingClient, options: HostedVenueFundingOptions): Promise<{
|
|
1310
|
+
availableRaw: string;
|
|
1311
|
+
feeRaw: string;
|
|
1312
|
+
withdrawalId?: string;
|
|
1313
|
+
}>;
|
|
1314
|
+
/** Keep the normal priced order flow after preparing native cash. Requotes
|
|
1315
|
+
* may use only the outcomes the user selected, within the accepted price and
|
|
1316
|
+
* total spend. Transfer fees reduce order spend rather than increasing it. */
|
|
1317
|
+
declare function prepareHostedVenueRoute(client: FundingClient & Pick<AggClient, "getSmartRoute">, options: Omit<HostedVenueFundingOptions, "requiredRaw"> & {
|
|
1318
|
+
quote: SmartRouteResponse;
|
|
1319
|
+
venueMarketOutcomeId: string;
|
|
1320
|
+
maxSpend: number;
|
|
1321
|
+
slipCapBps: number;
|
|
1322
|
+
}): Promise<SmartRouteResponse>;
|
|
1323
|
+
|
|
1270
1324
|
declare function createAggClient(options: AggClientOptions): AggClient;
|
|
1271
1325
|
|
|
1272
|
-
export { AggApiError, type AggApiErrorInit, type AggApiFieldError, AggAuthStartBody, AggAuthStartResult, AggAuthVerifyBody, AggClient, AggClientOptions, AggClientSessionInput, AggLinkAccountBody, AggLinkAccountConfirmResult, AggLinkAccountResult, AggLinkAccountWalletConfirmBody, type AggRateLimitResponse, AggWebSocket, AggWebSocketCallbacks, AppClientConfigResponse, AuthStatus, BalanceRefillAttempt, BalanceRefillPolicy, BatchMidpointsResponse, BatchOrderbooksResponse, type BuildVenueUrlOpts, CancelManagedExecutionResponse, CancelOrderSignature, CancelVenueOrderParams, Candle, Category, ChartBarsResponse, ChartCandle, ChartHistoryManifest, ChartResolution, CorrelatedMarketCascadeResponse, CorrelatedMarketQueryResult, CorrelatedMarketSignalBatch, CorrelatedMarketsStatus, CreateBalanceRefillPolicyParams, CreatePaperTradingAccountParams, CryptoReferencePricesResponse, DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW, DEFAULT_BALANCE_REFILL_MAX_FEE_RAW, DepositAddressesResponse, EventBootstrapResponse, ExecuteManagedParams, ExecuteManagedResponse, ExecutionOrderItem, ExecutionOrdersQuery, ExecutionPositionGroup, ExecutionPositionsQuery, ExecutionStatusQuery, ExecutionStatusResponse, GetCryptoReferencePricesOptions, GetPositionsParams, type HostedVenueAccount, type HostedVenueActivity, type HostedVenueActivityCode, type HostedVenueActivityQuery, type HostedVenueBalance, type HostedVenueDepositAddress, type HostedVenueWithdrawal, type HostedVenueWithdrawalRequest, IMAGE_SIZES, ImageSize, LIMIT_PRICE_RAW_SCALE, LeaderboardQuery, LeaderboardRow, type LimitPriceSide, type LimitPriceTickAdjustment, ListRecurringCryptoMarketsOptions, type LoadImmutableHistoryOptions, ManagedBalancesParams, MarketStatus, MatchStatus, NewsFeedArticleFeedResponse, NewsFeedListResponse, NewsFeedMarketFeedResponse, NewsFeedMarketNewsParams, NewsFeedMarketNewsResponse, NewsFeedPageOptions, NewsFeedStatusResponse, OrderListQuery, Orderbook, OutcomeOrderbookResponse, PaginatedResponse, PaperTradingAccount, PaperTradingAccountsPage, PaperTradingAppOptions, PaperTradingBalanceResponse, PaperTradingListParams, PaperTradingOrder, PaperTradingOrdersPage, PaperTradingPortfolio, PaperTradingPositionsPage, PlaceLimitOrderParams, PlaceLimitOrderResponse, PlacePaperTradingOrderParams, PositionGroup, type ProvisionHostedVenueAccountBody, type QuoteError, type QuoteErrorCode, RETINA_IMAGE_SIZES, RampQuote, RampQuoteRequest, RampSessionRequest, RampWidgetSession, RecurrenceFilter, RecurringCryptoMarketsResponse, RedeemRequest, RedeemResponse, ResetPaperTradingAccountParams, ResolveCorrelatedMarketsParams, ResolveCorrelatedMarketsResponse, RpcTokenResponse, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, SearchParams, SearchResponse, SetPaperTradingBalanceParams, SmartRouteParams, SmartRouteResponse, type SplitsByAmountResult, SportsLiveResponse, SyncBalancesResponse, TradeExecutorOrderListResponse, TradeSide, TradeSplit, TurnstileChallengeError, UnifiedBalanceResponse, UpdateBalanceRefillPolicyParams, UpdateUserBody, UpsertVenueKey, UserActivityItem, UserActivityQuery, UserHolding, UserProfile, Venue, VenueEvent, VenueGeoPolicyResponse, VenueKeyStatus, VenueKeySummary, VenueMarket, type VenueMarketClusterNode, VenueMarketOutcome, WithdrawManagedParams, WithdrawManagedResponse, WithdrawPreviewParams, WithdrawPreviewResponse, WithdrawalQuoteParams, WithdrawalQuoteResponse, adjustLimitPriceRawToTick, aggregateMidpoint, buildVenueUrl, computeBestSplitsByAmount, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getBalanceRefillMaximumRaw, getWalletAddressFromUserProfile, hasShape, isAggApiError, isBalanceRefillWithinDailyCap, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, loadImmutableHistory, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, orderbookCrc32, parse, parseEmail, parseEmailStrict, projectedOrderbookChecksum, retinaImageUrl, safeParse, sortVenues, toChecksumAddress };
|
|
1326
|
+
export { AggApiError, type AggApiErrorInit, type AggApiFieldError, AggAuthStartBody, AggAuthStartResult, AggAuthVerifyBody, AggClient, AggClientOptions, AggClientSessionInput, AggLinkAccountBody, AggLinkAccountConfirmResult, AggLinkAccountResult, AggLinkAccountWalletConfirmBody, type AggRateLimitResponse, AggWebSocket, AggWebSocketCallbacks, AppClientConfigResponse, AuthStatus, BalanceRefillAttempt, BalanceRefillPolicy, BatchMidpointsResponse, BatchOrderbooksResponse, type BuildVenueUrlOpts, CancelManagedExecutionResponse, CancelOrderSignature, CancelVenueOrderParams, Candle, Category, ChartBarsResponse, ChartCandle, ChartHistoryManifest, ChartResolution, CorrelatedMarketCascadeResponse, CorrelatedMarketQueryResult, CorrelatedMarketSignalBatch, CorrelatedMarketsStatus, CreateBalanceRefillPolicyParams, CreatePaperTradingAccountParams, CryptoReferencePricesResponse, DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW, DEFAULT_BALANCE_REFILL_MAX_FEE_RAW, DepositAddressesResponse, EventBootstrapResponse, ExecuteManagedParams, ExecuteManagedResponse, ExecutionOrderItem, ExecutionOrdersQuery, ExecutionPositionGroup, ExecutionPositionsQuery, ExecutionStatusQuery, ExecutionStatusResponse, GetCryptoReferencePricesOptions, GetPositionsParams, type HostedVenueAccount, type HostedVenueActivity, type HostedVenueActivityCode, type HostedVenueActivityQuery, type HostedVenueBalance, type HostedVenueDepositAddress, type HostedVenueFundingIntent, type HostedVenueFundingOptions, type HostedVenueWithdrawal, type HostedVenueWithdrawalRequest, IMAGE_SIZES, ImageSize, LIMIT_PRICE_RAW_SCALE, LeaderboardQuery, LeaderboardRow, type LimitPriceSide, type LimitPriceTickAdjustment, ListRecurringCryptoMarketsOptions, type LoadImmutableHistoryOptions, ManagedBalancesParams, MarketStatus, MatchStatus, NewsFeedArticleFeedResponse, NewsFeedListResponse, NewsFeedMarketFeedResponse, NewsFeedMarketNewsParams, NewsFeedMarketNewsResponse, NewsFeedPageOptions, NewsFeedStatusResponse, OrderListQuery, Orderbook, OutcomeOrderbookResponse, PaginatedResponse, PaperTradingAccount, PaperTradingAccountsPage, PaperTradingAppOptions, PaperTradingBalanceResponse, PaperTradingListParams, PaperTradingOrder, PaperTradingOrdersPage, PaperTradingPortfolio, PaperTradingPositionsPage, PlaceLimitOrderParams, PlaceLimitOrderResponse, PlacePaperTradingOrderParams, PositionGroup, type ProvisionHostedVenueAccountBody, type QuoteError, type QuoteErrorCode, RETINA_IMAGE_SIZES, RampQuote, RampQuoteRequest, RampSessionRequest, RampWidgetSession, RecurrenceFilter, RecurringCryptoMarketsResponse, RedeemRequest, RedeemResponse, ResetPaperTradingAccountParams, ResolveCorrelatedMarketsParams, ResolveCorrelatedMarketsResponse, RpcTokenResponse, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, SearchParams, SearchResponse, SetPaperTradingBalanceParams, SmartRouteParams, SmartRouteResponse, type SplitsByAmountResult, SportsLiveResponse, SyncBalancesResponse, TradeExecutorOrderListResponse, TradeSide, TradeSplit, TurnstileChallengeError, UnifiedBalanceResponse, UpdateBalanceRefillPolicyParams, UpdateUserBody, UpsertVenueKey, UserActivityItem, UserActivityQuery, UserHolding, UserProfile, Venue, VenueEvent, VenueGeoPolicyResponse, VenueKeyStatus, VenueKeySummary, VenueMarket, type VenueMarketClusterNode, VenueMarketOutcome, WithdrawManagedParams, WithdrawManagedResponse, WithdrawPreviewParams, WithdrawPreviewResponse, WithdrawalQuoteParams, WithdrawalQuoteResponse, adjustLimitPriceRawToTick, aggregateMidpoint, buildVenueUrl, computeBestSplitsByAmount, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getBalanceRefillMaximumRaw, getWalletAddressFromUserProfile, hasShape, isAggApiError, isBalanceRefillWithinDailyCap, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, loadImmutableHistory, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, orderbookCrc32, parse, parseEmail, parseEmailStrict, prepareHostedVenueFunding, prepareHostedVenueRoute, projectedOrderbookChecksum, retinaImageUrl, safeParse, sortVenues, toChecksumAddress };
|
package/dist/index.js
CHANGED
|
@@ -133,6 +133,8 @@ __export(index_exports, {
|
|
|
133
133
|
parse: () => parse,
|
|
134
134
|
parseEmail: () => parseEmail,
|
|
135
135
|
parseEmailStrict: () => parseEmailStrict,
|
|
136
|
+
prepareHostedVenueFunding: () => prepareHostedVenueFunding,
|
|
137
|
+
prepareHostedVenueRoute: () => prepareHostedVenueRoute,
|
|
136
138
|
projectedOrderbookChecksum: () => projectedOrderbookChecksum,
|
|
137
139
|
retinaImageUrl: () => retinaImageUrl,
|
|
138
140
|
safeParse: () => safeParse,
|
|
@@ -4435,6 +4437,173 @@ function aggregateMidpoint(midpoints) {
|
|
|
4435
4437
|
return valid.reduce((sum, m) => sum + m, 0) / valid.length;
|
|
4436
4438
|
}
|
|
4437
4439
|
|
|
4440
|
+
// src/hosted-venue-funding.ts
|
|
4441
|
+
var SOLANA = 792703809;
|
|
4442
|
+
var atoms = (value) => {
|
|
4443
|
+
if (!/^(0|[1-9][0-9]{0,31})$/.test(value)) throw new Error("Invalid funding amount");
|
|
4444
|
+
return BigInt(value);
|
|
4445
|
+
};
|
|
4446
|
+
var spendable = (account) => {
|
|
4447
|
+
if (account.status !== "active" || !account.accountId || account.environment !== "production" || account.balanceStatus !== "available" || !account.balance || account.balance.asset !== "USDC" || account.balance.decimals !== 6)
|
|
4448
|
+
throw new Error("Venue balance is temporarily unavailable. Please try again.");
|
|
4449
|
+
return atoms(account.balance.availableRaw);
|
|
4450
|
+
};
|
|
4451
|
+
var terminal = (status) => status === "completed" || status === "partial" || status === "failed";
|
|
4452
|
+
function prepareHostedVenueFunding(client, options) {
|
|
4453
|
+
return __async(this, null, function* () {
|
|
4454
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4455
|
+
const { venue, journal, assertActive } = options;
|
|
4456
|
+
const required = atoms(options.requiredRaw);
|
|
4457
|
+
if (required <= BigInt(0)) throw new Error("Invalid funding amount");
|
|
4458
|
+
const deadline = Date.now() + ((_a = options.timeoutMs) != null ? _a : 3e5);
|
|
4459
|
+
const check = () => {
|
|
4460
|
+
assertActive();
|
|
4461
|
+
if (Date.now() >= deadline)
|
|
4462
|
+
throw new Error("Funding is still confirming. Your transfer is saved; retry to resume it.");
|
|
4463
|
+
};
|
|
4464
|
+
const read = (operation) => __async(null, null, function* () {
|
|
4465
|
+
check();
|
|
4466
|
+
const result = yield operation();
|
|
4467
|
+
check();
|
|
4468
|
+
return result;
|
|
4469
|
+
});
|
|
4470
|
+
const pause = () => read(() => new Promise((resolve) => setTimeout(resolve, 1e3)));
|
|
4471
|
+
const save = (intent2) => {
|
|
4472
|
+
check();
|
|
4473
|
+
journal.save(intent2);
|
|
4474
|
+
};
|
|
4475
|
+
(_b = options.onProgress) == null ? void 0 : _b.call(options, "preparing");
|
|
4476
|
+
let account = yield read(() => client.getHostedVenueAccount(venue, { mode: "live" }));
|
|
4477
|
+
if (account.environment !== "production")
|
|
4478
|
+
throw new Error("This venue account does not accept live wallet transfers.");
|
|
4479
|
+
if (account.status === "not_created" && account.provisioningEnabled) {
|
|
4480
|
+
account = yield read(() => client.provisionHostedVenueAccount(venue, { mode: "live" }));
|
|
4481
|
+
}
|
|
4482
|
+
while (account.status === "provisioning") {
|
|
4483
|
+
yield pause();
|
|
4484
|
+
account = yield read(() => client.getHostedVenueAccount(venue, { mode: "live" }));
|
|
4485
|
+
}
|
|
4486
|
+
const before = spendable(account);
|
|
4487
|
+
let intent = journal.load();
|
|
4488
|
+
if (intent == null ? void 0 : intent.terminal) {
|
|
4489
|
+
save(null);
|
|
4490
|
+
intent = null;
|
|
4491
|
+
}
|
|
4492
|
+
if (!intent && before >= required) return { availableRaw: before.toString(), feeRaw: "0" };
|
|
4493
|
+
const address = yield read(() => client.getHostedVenueDepositAddress(venue, { mode: "live" }));
|
|
4494
|
+
if (address.accountId !== account.accountId || address.environment !== account.environment || address.network !== "solana" || address.asset !== "USDC" || !/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(address.address))
|
|
4495
|
+
throw new Error("Venue funding address changed. Refresh and try again.");
|
|
4496
|
+
if (intent) {
|
|
4497
|
+
if (intent.version !== 1 || intent.accountId !== account.accountId || intent.environment !== "production" || intent.request.destinationAddress !== address.address || intent.request.destinationChainId !== SOLANA || intent.request.tokenSymbol !== "USDC" || !intent.request.requestId || intent.request.max || atoms(intent.request.amountRaw) <= BigInt(0) || atoms(intent.balanceBeforeRaw) < BigInt(0) || atoms(intent.estimatedFeeRaw) < BigInt(0))
|
|
4498
|
+
throw new Error("Saved funding does not match this account. No new transfer was sent.");
|
|
4499
|
+
} else {
|
|
4500
|
+
const deficit = required - before;
|
|
4501
|
+
const amountRaw = (deficit < BigInt(1e6) ? BigInt(1e6) : deficit).toString();
|
|
4502
|
+
const request = {
|
|
4503
|
+
requestId: options.createRequestId(),
|
|
4504
|
+
amountRaw,
|
|
4505
|
+
tokenSymbol: "USDC",
|
|
4506
|
+
destinationAddress: address.address,
|
|
4507
|
+
destinationChainId: SOLANA
|
|
4508
|
+
};
|
|
4509
|
+
const preview = yield read(() => client.withdrawPreview(request));
|
|
4510
|
+
if (preview.pricingStatus !== "quoted" || !preview.receiveAmountRaw || atoms(preview.receiveAmountRaw) <= BigInt(0))
|
|
4511
|
+
throw new Error((_c = preview.unviableReason) != null ? _c : "No funding route is currently available.");
|
|
4512
|
+
intent = {
|
|
4513
|
+
version: 1,
|
|
4514
|
+
accountId: account.accountId,
|
|
4515
|
+
environment: "production",
|
|
4516
|
+
request,
|
|
4517
|
+
balanceBeforeRaw: before.toString(),
|
|
4518
|
+
estimatedFeeRaw: (_d = preview.feeRaw) != null ? _d : "0"
|
|
4519
|
+
};
|
|
4520
|
+
save(intent);
|
|
4521
|
+
}
|
|
4522
|
+
(_e = options.onProgress) == null ? void 0 : _e.call(options, "transferring");
|
|
4523
|
+
let transfer = intent.withdrawalId ? yield read(() => client.getWithdrawalStatus(intent.withdrawalId)) : yield read(() => client.withdrawManaged(intent.request));
|
|
4524
|
+
const assertTransfer = () => {
|
|
4525
|
+
if (transfer.requested.amountRaw !== intent.request.amountRaw || transfer.requested.tokenSymbol !== "USDC" || transfer.destination.chainId !== SOLANA || transfer.destination.address !== address.address || transfer.destination.tokenSymbol !== "USDC" || intent.withdrawalId && transfer.withdrawalId !== intent.withdrawalId)
|
|
4526
|
+
throw new Error("Funding response does not match the saved transfer.");
|
|
4527
|
+
};
|
|
4528
|
+
assertTransfer();
|
|
4529
|
+
intent = __spreadProps(__spreadValues({}, intent), { withdrawalId: transfer.withdrawalId });
|
|
4530
|
+
save(intent);
|
|
4531
|
+
while (!terminal(transfer.status)) {
|
|
4532
|
+
yield pause();
|
|
4533
|
+
transfer = yield read(() => client.getWithdrawalStatus(intent.withdrawalId));
|
|
4534
|
+
assertTransfer();
|
|
4535
|
+
}
|
|
4536
|
+
if (transfer.status === "failed") {
|
|
4537
|
+
save(__spreadProps(__spreadValues({}, intent), { terminal: true }));
|
|
4538
|
+
throw new Error((_f = transfer.errorMessage) != null ? _f : "Funding could not complete. No order was placed.");
|
|
4539
|
+
}
|
|
4540
|
+
(_g = options.onProgress) == null ? void 0 : _g.call(options, "confirming");
|
|
4541
|
+
let available = before;
|
|
4542
|
+
while (available <= atoms(intent.balanceBeforeRaw)) {
|
|
4543
|
+
yield pause();
|
|
4544
|
+
const current = yield read(() => client.getHostedVenueAccount(venue, { mode: "live" }));
|
|
4545
|
+
if (current.accountId !== account.accountId || current.environment !== account.environment)
|
|
4546
|
+
throw new Error("Venue account changed while funding. No order was placed.");
|
|
4547
|
+
available = spendable(current);
|
|
4548
|
+
}
|
|
4549
|
+
const fee = atoms((_h = transfer.expected.feeRaw) != null ? _h : intent.estimatedFeeRaw);
|
|
4550
|
+
save(null);
|
|
4551
|
+
return {
|
|
4552
|
+
availableRaw: available.toString(),
|
|
4553
|
+
feeRaw: fee.toString(),
|
|
4554
|
+
withdrawalId: transfer.withdrawalId
|
|
4555
|
+
};
|
|
4556
|
+
});
|
|
4557
|
+
}
|
|
4558
|
+
function prepareHostedVenueRoute(client, options) {
|
|
4559
|
+
return __async(this, null, function* () {
|
|
4560
|
+
var _a;
|
|
4561
|
+
const fills = options.quote.fills;
|
|
4562
|
+
const native = fills.filter((fill) => fill.venue === options.venue);
|
|
4563
|
+
const required = native.reduce((sum, fill) => sum + fill.avgPrice * fill.venueQty, 0);
|
|
4564
|
+
if (!native.length || !Number.isFinite(required) || required <= 0 || !Number.isFinite(options.maxSpend) || options.maxSpend <= 0 || !Number.isFinite(options.slipCapBps) || options.slipCapBps < 0)
|
|
4565
|
+
throw new Error("An available order quote is required before funding.");
|
|
4566
|
+
const funding = yield prepareHostedVenueFunding(client, __spreadProps(__spreadValues({}, options), {
|
|
4567
|
+
requiredRaw: Math.ceil(required * 1e6).toString()
|
|
4568
|
+
}));
|
|
4569
|
+
options.assertActive();
|
|
4570
|
+
const originalBudget = BigInt(Math.floor(options.maxSpend * 1e6));
|
|
4571
|
+
let budget = originalBudget - atoms(funding.feeRaw);
|
|
4572
|
+
if (native.length === fills.length) {
|
|
4573
|
+
const available = atoms(funding.availableRaw);
|
|
4574
|
+
if (available < budget) budget = available;
|
|
4575
|
+
}
|
|
4576
|
+
if (budget <= BigInt(0))
|
|
4577
|
+
throw new Error("Funding fees exceeded the order amount. No order was placed.");
|
|
4578
|
+
const venues = [...new Set(fills.map((fill) => fill.venue))];
|
|
4579
|
+
const allowedVenues = venues.filter(
|
|
4580
|
+
(value) => Object.values(Venue).some((venue) => venue === value)
|
|
4581
|
+
);
|
|
4582
|
+
if (allowedVenues.length !== venues.length) throw new Error("Unknown venue in funding quote");
|
|
4583
|
+
const quote = yield client.getSmartRoute({
|
|
4584
|
+
venueMarketOutcomeId: options.venueMarketOutcomeId,
|
|
4585
|
+
maxSpend: Number(budget) / 1e6,
|
|
4586
|
+
tradeSide: "buy",
|
|
4587
|
+
compareVenues: false,
|
|
4588
|
+
allowedVenues,
|
|
4589
|
+
slipCapBps: options.slipCapBps
|
|
4590
|
+
});
|
|
4591
|
+
options.assertActive();
|
|
4592
|
+
if (quote.status !== "ok" || !quote.quoteId || !quote.fills.length)
|
|
4593
|
+
throw new Error((_a = quote.error) != null ? _a : "Funds are ready. Refresh the quote and try again.");
|
|
4594
|
+
for (const fill of quote.fills) {
|
|
4595
|
+
const original = fills.find(
|
|
4596
|
+
(item) => item.venue === fill.venue && item.venueMarketId === fill.venueMarketId && item.venueMarketOutcomeId === fill.venueMarketOutcomeId
|
|
4597
|
+
);
|
|
4598
|
+
if (!original || !Number.isFinite(fill.avgPrice) || fill.avgPrice <= 0 || fill.avgPrice > original.avgPrice * (1 + options.slipCapBps / 1e4) + 1e-9)
|
|
4599
|
+
throw new Error("The price changed while funding. Funds are ready; review the new quote.");
|
|
4600
|
+
}
|
|
4601
|
+
if (!Number.isFinite(quote.rawExecCost) || quote.rawExecCost * 1e6 > Number(budget) + 1)
|
|
4602
|
+
throw new Error("The new quote exceeds the order amount. No order was placed.");
|
|
4603
|
+
return quote;
|
|
4604
|
+
});
|
|
4605
|
+
}
|
|
4606
|
+
|
|
4438
4607
|
// src/index.ts
|
|
4439
4608
|
function createAggClient(options) {
|
|
4440
4609
|
return new AggClient(options);
|
|
@@ -4505,6 +4674,8 @@ function createAggClient(options) {
|
|
|
4505
4674
|
parse,
|
|
4506
4675
|
parseEmail,
|
|
4507
4676
|
parseEmailStrict,
|
|
4677
|
+
prepareHostedVenueFunding,
|
|
4678
|
+
prepareHostedVenueRoute,
|
|
4508
4679
|
projectedOrderbookChecksum,
|
|
4509
4680
|
retinaImageUrl,
|
|
4510
4681
|
safeParse,
|
package/dist/index.mjs
CHANGED
|
@@ -2204,6 +2204,173 @@ function aggregateMidpoint(midpoints) {
|
|
|
2204
2204
|
return valid.reduce((sum, m) => sum + m, 0) / valid.length;
|
|
2205
2205
|
}
|
|
2206
2206
|
|
|
2207
|
+
// src/hosted-venue-funding.ts
|
|
2208
|
+
var SOLANA = 792703809;
|
|
2209
|
+
var atoms = (value) => {
|
|
2210
|
+
if (!/^(0|[1-9][0-9]{0,31})$/.test(value)) throw new Error("Invalid funding amount");
|
|
2211
|
+
return BigInt(value);
|
|
2212
|
+
};
|
|
2213
|
+
var spendable = (account) => {
|
|
2214
|
+
if (account.status !== "active" || !account.accountId || account.environment !== "production" || account.balanceStatus !== "available" || !account.balance || account.balance.asset !== "USDC" || account.balance.decimals !== 6)
|
|
2215
|
+
throw new Error("Venue balance is temporarily unavailable. Please try again.");
|
|
2216
|
+
return atoms(account.balance.availableRaw);
|
|
2217
|
+
};
|
|
2218
|
+
var terminal = (status) => status === "completed" || status === "partial" || status === "failed";
|
|
2219
|
+
function prepareHostedVenueFunding(client, options) {
|
|
2220
|
+
return __async(this, null, function* () {
|
|
2221
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2222
|
+
const { venue, journal, assertActive } = options;
|
|
2223
|
+
const required = atoms(options.requiredRaw);
|
|
2224
|
+
if (required <= BigInt(0)) throw new Error("Invalid funding amount");
|
|
2225
|
+
const deadline = Date.now() + ((_a = options.timeoutMs) != null ? _a : 3e5);
|
|
2226
|
+
const check = () => {
|
|
2227
|
+
assertActive();
|
|
2228
|
+
if (Date.now() >= deadline)
|
|
2229
|
+
throw new Error("Funding is still confirming. Your transfer is saved; retry to resume it.");
|
|
2230
|
+
};
|
|
2231
|
+
const read = (operation) => __async(null, null, function* () {
|
|
2232
|
+
check();
|
|
2233
|
+
const result = yield operation();
|
|
2234
|
+
check();
|
|
2235
|
+
return result;
|
|
2236
|
+
});
|
|
2237
|
+
const pause = () => read(() => new Promise((resolve) => setTimeout(resolve, 1e3)));
|
|
2238
|
+
const save = (intent2) => {
|
|
2239
|
+
check();
|
|
2240
|
+
journal.save(intent2);
|
|
2241
|
+
};
|
|
2242
|
+
(_b = options.onProgress) == null ? void 0 : _b.call(options, "preparing");
|
|
2243
|
+
let account = yield read(() => client.getHostedVenueAccount(venue, { mode: "live" }));
|
|
2244
|
+
if (account.environment !== "production")
|
|
2245
|
+
throw new Error("This venue account does not accept live wallet transfers.");
|
|
2246
|
+
if (account.status === "not_created" && account.provisioningEnabled) {
|
|
2247
|
+
account = yield read(() => client.provisionHostedVenueAccount(venue, { mode: "live" }));
|
|
2248
|
+
}
|
|
2249
|
+
while (account.status === "provisioning") {
|
|
2250
|
+
yield pause();
|
|
2251
|
+
account = yield read(() => client.getHostedVenueAccount(venue, { mode: "live" }));
|
|
2252
|
+
}
|
|
2253
|
+
const before = spendable(account);
|
|
2254
|
+
let intent = journal.load();
|
|
2255
|
+
if (intent == null ? void 0 : intent.terminal) {
|
|
2256
|
+
save(null);
|
|
2257
|
+
intent = null;
|
|
2258
|
+
}
|
|
2259
|
+
if (!intent && before >= required) return { availableRaw: before.toString(), feeRaw: "0" };
|
|
2260
|
+
const address = yield read(() => client.getHostedVenueDepositAddress(venue, { mode: "live" }));
|
|
2261
|
+
if (address.accountId !== account.accountId || address.environment !== account.environment || address.network !== "solana" || address.asset !== "USDC" || !/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(address.address))
|
|
2262
|
+
throw new Error("Venue funding address changed. Refresh and try again.");
|
|
2263
|
+
if (intent) {
|
|
2264
|
+
if (intent.version !== 1 || intent.accountId !== account.accountId || intent.environment !== "production" || intent.request.destinationAddress !== address.address || intent.request.destinationChainId !== SOLANA || intent.request.tokenSymbol !== "USDC" || !intent.request.requestId || intent.request.max || atoms(intent.request.amountRaw) <= BigInt(0) || atoms(intent.balanceBeforeRaw) < BigInt(0) || atoms(intent.estimatedFeeRaw) < BigInt(0))
|
|
2265
|
+
throw new Error("Saved funding does not match this account. No new transfer was sent.");
|
|
2266
|
+
} else {
|
|
2267
|
+
const deficit = required - before;
|
|
2268
|
+
const amountRaw = (deficit < BigInt(1e6) ? BigInt(1e6) : deficit).toString();
|
|
2269
|
+
const request = {
|
|
2270
|
+
requestId: options.createRequestId(),
|
|
2271
|
+
amountRaw,
|
|
2272
|
+
tokenSymbol: "USDC",
|
|
2273
|
+
destinationAddress: address.address,
|
|
2274
|
+
destinationChainId: SOLANA
|
|
2275
|
+
};
|
|
2276
|
+
const preview = yield read(() => client.withdrawPreview(request));
|
|
2277
|
+
if (preview.pricingStatus !== "quoted" || !preview.receiveAmountRaw || atoms(preview.receiveAmountRaw) <= BigInt(0))
|
|
2278
|
+
throw new Error((_c = preview.unviableReason) != null ? _c : "No funding route is currently available.");
|
|
2279
|
+
intent = {
|
|
2280
|
+
version: 1,
|
|
2281
|
+
accountId: account.accountId,
|
|
2282
|
+
environment: "production",
|
|
2283
|
+
request,
|
|
2284
|
+
balanceBeforeRaw: before.toString(),
|
|
2285
|
+
estimatedFeeRaw: (_d = preview.feeRaw) != null ? _d : "0"
|
|
2286
|
+
};
|
|
2287
|
+
save(intent);
|
|
2288
|
+
}
|
|
2289
|
+
(_e = options.onProgress) == null ? void 0 : _e.call(options, "transferring");
|
|
2290
|
+
let transfer = intent.withdrawalId ? yield read(() => client.getWithdrawalStatus(intent.withdrawalId)) : yield read(() => client.withdrawManaged(intent.request));
|
|
2291
|
+
const assertTransfer = () => {
|
|
2292
|
+
if (transfer.requested.amountRaw !== intent.request.amountRaw || transfer.requested.tokenSymbol !== "USDC" || transfer.destination.chainId !== SOLANA || transfer.destination.address !== address.address || transfer.destination.tokenSymbol !== "USDC" || intent.withdrawalId && transfer.withdrawalId !== intent.withdrawalId)
|
|
2293
|
+
throw new Error("Funding response does not match the saved transfer.");
|
|
2294
|
+
};
|
|
2295
|
+
assertTransfer();
|
|
2296
|
+
intent = __spreadProps(__spreadValues({}, intent), { withdrawalId: transfer.withdrawalId });
|
|
2297
|
+
save(intent);
|
|
2298
|
+
while (!terminal(transfer.status)) {
|
|
2299
|
+
yield pause();
|
|
2300
|
+
transfer = yield read(() => client.getWithdrawalStatus(intent.withdrawalId));
|
|
2301
|
+
assertTransfer();
|
|
2302
|
+
}
|
|
2303
|
+
if (transfer.status === "failed") {
|
|
2304
|
+
save(__spreadProps(__spreadValues({}, intent), { terminal: true }));
|
|
2305
|
+
throw new Error((_f = transfer.errorMessage) != null ? _f : "Funding could not complete. No order was placed.");
|
|
2306
|
+
}
|
|
2307
|
+
(_g = options.onProgress) == null ? void 0 : _g.call(options, "confirming");
|
|
2308
|
+
let available = before;
|
|
2309
|
+
while (available <= atoms(intent.balanceBeforeRaw)) {
|
|
2310
|
+
yield pause();
|
|
2311
|
+
const current = yield read(() => client.getHostedVenueAccount(venue, { mode: "live" }));
|
|
2312
|
+
if (current.accountId !== account.accountId || current.environment !== account.environment)
|
|
2313
|
+
throw new Error("Venue account changed while funding. No order was placed.");
|
|
2314
|
+
available = spendable(current);
|
|
2315
|
+
}
|
|
2316
|
+
const fee = atoms((_h = transfer.expected.feeRaw) != null ? _h : intent.estimatedFeeRaw);
|
|
2317
|
+
save(null);
|
|
2318
|
+
return {
|
|
2319
|
+
availableRaw: available.toString(),
|
|
2320
|
+
feeRaw: fee.toString(),
|
|
2321
|
+
withdrawalId: transfer.withdrawalId
|
|
2322
|
+
};
|
|
2323
|
+
});
|
|
2324
|
+
}
|
|
2325
|
+
function prepareHostedVenueRoute(client, options) {
|
|
2326
|
+
return __async(this, null, function* () {
|
|
2327
|
+
var _a;
|
|
2328
|
+
const fills = options.quote.fills;
|
|
2329
|
+
const native = fills.filter((fill) => fill.venue === options.venue);
|
|
2330
|
+
const required = native.reduce((sum, fill) => sum + fill.avgPrice * fill.venueQty, 0);
|
|
2331
|
+
if (!native.length || !Number.isFinite(required) || required <= 0 || !Number.isFinite(options.maxSpend) || options.maxSpend <= 0 || !Number.isFinite(options.slipCapBps) || options.slipCapBps < 0)
|
|
2332
|
+
throw new Error("An available order quote is required before funding.");
|
|
2333
|
+
const funding = yield prepareHostedVenueFunding(client, __spreadProps(__spreadValues({}, options), {
|
|
2334
|
+
requiredRaw: Math.ceil(required * 1e6).toString()
|
|
2335
|
+
}));
|
|
2336
|
+
options.assertActive();
|
|
2337
|
+
const originalBudget = BigInt(Math.floor(options.maxSpend * 1e6));
|
|
2338
|
+
let budget = originalBudget - atoms(funding.feeRaw);
|
|
2339
|
+
if (native.length === fills.length) {
|
|
2340
|
+
const available = atoms(funding.availableRaw);
|
|
2341
|
+
if (available < budget) budget = available;
|
|
2342
|
+
}
|
|
2343
|
+
if (budget <= BigInt(0))
|
|
2344
|
+
throw new Error("Funding fees exceeded the order amount. No order was placed.");
|
|
2345
|
+
const venues = [...new Set(fills.map((fill) => fill.venue))];
|
|
2346
|
+
const allowedVenues = venues.filter(
|
|
2347
|
+
(value) => Object.values(Venue).some((venue) => venue === value)
|
|
2348
|
+
);
|
|
2349
|
+
if (allowedVenues.length !== venues.length) throw new Error("Unknown venue in funding quote");
|
|
2350
|
+
const quote = yield client.getSmartRoute({
|
|
2351
|
+
venueMarketOutcomeId: options.venueMarketOutcomeId,
|
|
2352
|
+
maxSpend: Number(budget) / 1e6,
|
|
2353
|
+
tradeSide: "buy",
|
|
2354
|
+
compareVenues: false,
|
|
2355
|
+
allowedVenues,
|
|
2356
|
+
slipCapBps: options.slipCapBps
|
|
2357
|
+
});
|
|
2358
|
+
options.assertActive();
|
|
2359
|
+
if (quote.status !== "ok" || !quote.quoteId || !quote.fills.length)
|
|
2360
|
+
throw new Error((_a = quote.error) != null ? _a : "Funds are ready. Refresh the quote and try again.");
|
|
2361
|
+
for (const fill of quote.fills) {
|
|
2362
|
+
const original = fills.find(
|
|
2363
|
+
(item) => item.venue === fill.venue && item.venueMarketId === fill.venueMarketId && item.venueMarketOutcomeId === fill.venueMarketOutcomeId
|
|
2364
|
+
);
|
|
2365
|
+
if (!original || !Number.isFinite(fill.avgPrice) || fill.avgPrice <= 0 || fill.avgPrice > original.avgPrice * (1 + options.slipCapBps / 1e4) + 1e-9)
|
|
2366
|
+
throw new Error("The price changed while funding. Funds are ready; review the new quote.");
|
|
2367
|
+
}
|
|
2368
|
+
if (!Number.isFinite(quote.rawExecCost) || quote.rawExecCost * 1e6 > Number(budget) + 1)
|
|
2369
|
+
throw new Error("The new quote exceeds the order amount. No order was placed.");
|
|
2370
|
+
return quote;
|
|
2371
|
+
});
|
|
2372
|
+
}
|
|
2373
|
+
|
|
2207
2374
|
// src/index.ts
|
|
2208
2375
|
function createAggClient(options) {
|
|
2209
2376
|
return new AggClient(options);
|
|
@@ -2273,6 +2440,8 @@ export {
|
|
|
2273
2440
|
parse,
|
|
2274
2441
|
parseEmail,
|
|
2275
2442
|
parseEmailStrict,
|
|
2443
|
+
prepareHostedVenueFunding,
|
|
2444
|
+
prepareHostedVenueRoute,
|
|
2276
2445
|
projectedOrderbookChecksum,
|
|
2277
2446
|
retinaImageUrl,
|
|
2278
2447
|
safeParse,
|
package/dist/market-data.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ChartBarsResponse } from './agg-websocket-
|
|
2
|
-
export { bB as CandleTail, cg as HistoryRangeRequest, M as MarketDataEngine, cm as MarketView, cn as MarketViewBatch } from './agg-websocket-
|
|
1
|
+
import { C as ChartBarsResponse } from './agg-websocket-DC7H1Cdh.mjs';
|
|
2
|
+
export { bB as CandleTail, cg as HistoryRangeRequest, M as MarketDataEngine, cm as MarketView, cn as MarketViewBatch } from './agg-websocket-DC7H1Cdh.mjs';
|
|
3
3
|
|
|
4
4
|
/** Decode bounded dynamic history where processing lives; retain milliseconds and optional mean. */
|
|
5
5
|
declare function decodeChartHistory(payload: string): ChartBarsResponse;
|
package/dist/market-data.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ChartBarsResponse } from './agg-websocket-
|
|
2
|
-
export { bB as CandleTail, cg as HistoryRangeRequest, M as MarketDataEngine, cm as MarketView, cn as MarketViewBatch } from './agg-websocket-
|
|
1
|
+
import { C as ChartBarsResponse } from './agg-websocket-DC7H1Cdh.js';
|
|
2
|
+
export { bB as CandleTail, cg as HistoryRangeRequest, M as MarketDataEngine, cm as MarketView, cn as MarketViewBatch } from './agg-websocket-DC7H1Cdh.js';
|
|
3
3
|
|
|
4
4
|
/** Decode bounded dynamic history where processing lives; retain milliseconds and optional mean. */
|
|
5
5
|
declare function decodeChartHistory(payload: string): ChartBarsResponse;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agg-build/sdk",
|
|
3
|
-
"version": "4.19.
|
|
3
|
+
"version": "4.19.1",
|
|
4
4
|
"description": "Vanilla TypeScript client for the AGG prediction market aggregator (auth, markets, orderbooks, charts, trading, managed execution, WebSockets). Works in browsers, Node.js, and React Native.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|