@agg-build/sdk 2.5.1 → 2.8.2

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/index.d.mts CHANGED
@@ -231,6 +231,12 @@ type VenueKeySummary = {
231
231
  updatedAt: string;
232
232
  venue: Venue;
233
233
  };
234
+ type VenueKeyStatus = {
235
+ venue: Venue;
236
+ connected: boolean;
237
+ validatedAt: string | null;
238
+ kycStatus: string;
239
+ };
234
240
  type TradeSplit = {
235
241
  venue: Venue;
236
242
  venueMarketOutcomeId: string;
@@ -491,6 +497,12 @@ type UnifiedBalanceResponse = {
491
497
  unrealizedPnl: number;
492
498
  realizedPnl: number;
493
499
  }[];
500
+ venueCash?: {
501
+ venue: Venue;
502
+ balanceCents: number;
503
+ portfolioValueCents?: number | undefined;
504
+ updatedAt: string;
505
+ }[];
494
506
  };
495
507
  type UserHolding = {
496
508
  venue: Venue;
@@ -1008,7 +1020,7 @@ type ValidateManagedRequest = {
1008
1020
  amount: number;
1009
1021
  };
1010
1022
  type WithdrawTokenSymbol$1 = "USDC" | "USDC.e" | "USDT";
1011
- type WithdrawalSourceTokenSymbol$1 = WithdrawTokenSymbol$1 | "pUSD";
1023
+ type WithdrawalSourceTokenSymbol$1 = WithdrawTokenSymbol$1 | "pUSD" | "USD1";
1012
1024
  type WithdrawManagedRequest = {
1013
1025
  /** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
1014
1026
  amountRaw: string;
@@ -2552,8 +2564,67 @@ interface ValidateManagedResponse {
2552
2564
  bridgeSourceChainId?: number;
2553
2565
  bridgeAmountRaw?: string;
2554
2566
  }
2567
+ type BalanceRefillPolicyStatus = "enabled" | "paused";
2568
+ type BalanceRefillAttemptStatus = "reserved" | "executing" | "completed" | "failed";
2569
+ interface BalanceRefillAttempt {
2570
+ id: string;
2571
+ policyId: string;
2572
+ status: BalanceRefillAttemptStatus;
2573
+ /** Target-chain balance when the threshold was crossed, in 6-decimal USD units. */
2574
+ triggerBalanceRaw: string;
2575
+ /** Minimum amount the refill must deliver, in 6-decimal USD units. */
2576
+ requestedDeliveryRaw: string;
2577
+ /** Reserved source amount, in 6-decimal USD units. */
2578
+ sourceAmountRaw: string;
2579
+ completedAmountRaw: string | null;
2580
+ sourceChainId: number;
2581
+ targetChainId: number;
2582
+ feeRaw: string | null;
2583
+ errorMessage: string | null;
2584
+ startedAt: string | null;
2585
+ completedAt: string | null;
2586
+ createdAt: string;
2587
+ }
2588
+ interface BalanceRefillPolicy {
2589
+ id: string;
2590
+ targetChainId: number;
2591
+ targetTokenAddress: string;
2592
+ targetTokenSymbol: "USDC";
2593
+ /** Balance floor, in 6-decimal USD units. */
2594
+ minimumRaw: string;
2595
+ /** Minimum delivered amount per refill, in 6-decimal USD units. */
2596
+ refillAmountRaw: string;
2597
+ dailyCapRaw: string;
2598
+ maxFeeRaw: string;
2599
+ status: BalanceRefillPolicyStatus;
2600
+ cooldownSeconds: number;
2601
+ lastObservedRaw: string | null;
2602
+ lastEvaluatedAt: string | null;
2603
+ nextEligibleAt: string | null;
2604
+ consentedAt: string;
2605
+ createdAt: string;
2606
+ updatedAt: string;
2607
+ latestAttempt: BalanceRefillAttempt | null;
2608
+ }
2609
+ interface CreateBalanceRefillPolicyParams {
2610
+ targetChainId: number;
2611
+ targetTokenSymbol?: "USDC";
2612
+ minimumRaw: string;
2613
+ refillAmountRaw: string;
2614
+ /** Optional daily refill limit. Defaults to $250 in 6-decimal USD units. */
2615
+ dailyCapRaw?: string;
2616
+ /** Optional per-refill fee limit. Defaults to $2 in 6-decimal USD units. */
2617
+ maxFeeRaw?: string;
2618
+ }
2619
+ interface UpdateBalanceRefillPolicyParams {
2620
+ minimumRaw?: string;
2621
+ refillAmountRaw?: string;
2622
+ dailyCapRaw?: string;
2623
+ maxFeeRaw?: string;
2624
+ status?: BalanceRefillPolicyStatus;
2625
+ }
2555
2626
  type WithdrawTokenSymbol = "USDC" | "USDC.e" | "USDT";
2556
- type WithdrawalSourceTokenSymbol = WithdrawTokenSymbol | "pUSD";
2627
+ type WithdrawalSourceTokenSymbol = WithdrawTokenSymbol | "pUSD" | "USD1";
2557
2628
  interface WithdrawManagedParams {
2558
2629
  /** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
2559
2630
  amountRaw: string;
@@ -3261,6 +3332,17 @@ interface SmartRouteSettlementPlan {
3261
3332
  totalSellShares: number;
3262
3333
  redeemLegs: SmartRouteSettlementLeg[];
3263
3334
  }
3335
+ /** Slippage metrics for the route. Mirrors `SmartRouteResponseTB.slippage`. */
3336
+ interface SmartRouteSlippage {
3337
+ /** Volume-weighted average price. */
3338
+ vwap: number;
3339
+ /** Reference midpoint used by the optimizer. */
3340
+ refMidpoint: number;
3341
+ /** Route slippage = max(0, VWAP - refMidpoint). */
3342
+ slippage: number;
3343
+ /** Slippage in basis points relative to ref midpoint. */
3344
+ slippageBps: number;
3345
+ }
3264
3346
  interface SmartRouteResponse {
3265
3347
  quoteId: string;
3266
3348
  venueMarketOutcomeId: string;
@@ -3294,6 +3376,12 @@ interface SmartRouteResponse {
3294
3376
  venueSoloQuotes?: VenueSoloQuote[];
3295
3377
  allocations?: SmartRouteAllocation[];
3296
3378
  bridgeSteps?: SmartRouteBridgeStep[];
3379
+ /**
3380
+ * Route slippage metrics. Present on the wire (`SmartRouteResponseTB`) but
3381
+ * missing from this mirror until now — `@agg-build/hooks` already reads
3382
+ * `slippage.slippageBps` to flag thin liquidity.
3383
+ */
3384
+ slippage?: SmartRouteSlippage;
3297
3385
  /** Estimated payout if the outcome wins (= totalFilled shares × $1). */
3298
3386
  estimatedPayout?: number;
3299
3387
  /** Total cost including all fees (rawExecCost + venueFees + bridgeFees +
@@ -3762,6 +3850,14 @@ declare class AggClient {
3762
3850
  getExecutionPositions(params?: ExecutionPositionsQuery): Promise<PaginatedResponse<ExecutionPositionGroup>>;
3763
3851
  /** Get managed wallet balances, including per-chain cash balances and per-venue position balances. */
3764
3852
  getManagedBalances(params?: ManagedBalancesParams): Promise<UnifiedBalanceResponse>;
3853
+ /** Store or replace encrypted credentials for a venue. Secrets are never returned. */
3854
+ upsertVenueKey(body: UpsertVenueKey): Promise<VenueKeySummary>;
3855
+ /** List venues with stored credentials. */
3856
+ listVenueKeys(): Promise<VenueKeySummary[]>;
3857
+ /** Fetch connection and verification status for stored venue credentials. */
3858
+ getVenueKeyStatus(venue: Venue): Promise<VenueKeyStatus>;
3859
+ /** Remove stored credentials for a venue. */
3860
+ deleteVenueKey(venue: Venue): Promise<void>;
3765
3861
  /** Create a server-managed paper trading account for an app. Requires adminKey or apiKey. */
3766
3862
  createPaperTradingAccount(params: CreatePaperTradingAccountParams, options?: PaperTradingAppOptions): Promise<PaperTradingAccount>;
3767
3863
  /** List server-managed paper trading accounts for an app. Requires adminKey or apiKey. */
@@ -3973,6 +4069,14 @@ declare class AggClient {
3973
4069
  placeLimitOrder(params: PlaceLimitOrderParams): Promise<PlaceLimitOrderResponse>;
3974
4070
  /** Redeem resolved winning positions by venue market outcome ids. */
3975
4071
  redeem(body: RedeemRequest): Promise<RedeemResponse>;
4072
+ /** List the authenticated user's managed balance refill policies. */
4073
+ getBalanceRefillPolicies(): Promise<BalanceRefillPolicy[]>;
4074
+ /** Create a managed-USDC refill policy for a target chain. */
4075
+ createBalanceRefillPolicy(params: CreateBalanceRefillPolicyParams): Promise<BalanceRefillPolicy>;
4076
+ /** Update thresholds or pause/resume an existing balance refill policy. */
4077
+ updateBalanceRefillPolicy(policyId: string, params: UpdateBalanceRefillPolicyParams): Promise<BalanceRefillPolicy>;
4078
+ /** Return the 25 most recent attempts for a refill policy. */
4079
+ getBalanceRefillAttempts(policyId: string): Promise<BalanceRefillAttempt[]>;
3976
4080
  /** Withdraw funds from managed wallets to an external address. */
3977
4081
  withdrawManaged(params: WithdrawManagedParams): Promise<WithdrawManagedResponse>;
3978
4082
  /**
@@ -4095,4 +4199,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
4095
4199
 
4096
4200
  declare function createAggClient(options: AggClientOptions): AggClient;
4097
4201
 
4098
- export { ACTIVE_VENUES, type Account, AccountProvider, AccountType, type AggAuthDeliveryMode, type AggAuthProviderType, type AggAuthStartBody, type AggAuthStartResult, type AggAuthVerifyBody, AggClient, type AggClientAuthOptions, type AggClientSessionInput, type AggLinkAccountBody, type AggLinkAccountConfirmResult, type AggLinkAccountResult, type AggSessionUser, AggWebSocket, type AggWebSocketCallbacks, type AggWebSocketOptions, type AggregatedOrderbookLevel, type AggregatedOrderbookResponse, type App, type AppClientConfigResponse, type AttributedOrderbook, type AttributedOrderbookLevel, type AuthCodeResponse, type AuthStatus, type AuthTokenResponse, type AuthUser, type BatchMidpointsResponse, type BatchOrderbooksResponse, type BookQuality, type BuildVenueUrlOpts, CONFIRMED_MATCH_STATUSES, type CancelManagedExecutionResponse, type Candle, CandleBuilder, type CandleInterval, type Category, Chain, type ChartBarsResponse, type ChartCandle, type ChartResolution, type ChartVenueCandles, type ComputeSplitsRequest, type ComputeSplitsResponse, type ComputeSplitsSelection, type CorrelatedMarketCascadeItem, type CorrelatedMarketCascadeResponse, type CorrelatedMarketQueryResult, type CorrelatedMarketSide, type CorrelatedMarketSignal, type CorrelatedMarketSignalBatch, type CorrelatedMarketSignalDirection, type CorrelatedMarketsStatus, type CreateApp, type CreatePaperTradingAccountParams, type CryptoReferencePriceError, type CryptoReferencePriceExternalMarketInput, type CryptoReferencePriceMarketInput, type CryptoReferencePriceResult, type CryptoReferencePriceSource, type CryptoReferencePriceTarget, type CryptoReferencePricesResponse, type DepositAddressesPendingResponse, type DepositAddressesReadyResponse, type DepositAddressesResponse, type DepositAddressesSupportedChain, type DepositAddressesToken, type DepositStep, type DiagnosticCallback, type DiagnosticEvent, type ExecuteManagedParams, type ExecuteManagedRequest, type ExecuteManagedResponse, type ExecuteTradeRequest, type ExecuteTradeResponse, type ExecutionDagProgress, type ExecutionMode, type ExecutionOrderItem, type ExecutionOrdersQuery, type ExecutionOverallState, type ExecutionPositionGroup, type ExecutionPositionsQuery, type ExecutionStatusOrder, type ExecutionStatusQuery, type ExecutionStatusResponse, type ExecutionStatusStep, type GetBalanceQuery, type GetBalanceResponse, type GetCryptoReferencePricesOptions, type GetHoldingsQuery, type GetHoldingsResponse, type GetOrdersParams, type GetOrdersQuery, type GetPositionsParams, type GetPositionsQuery, type HelloResponse, IMAGE_SIZES, INACTIVE_VENUES, ImageSize, type LimitOrderTimeInForce, type ListRecurringCryptoMarketsOptions, type ManagedBalancesParams, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedMidpointOutcome, type MatchedOrderbookMarket, type MatchedVenueMarketOutcomeRef, type MidpointItem, type MidpointRow, type NewsFeedArticleFeedItem, type NewsFeedArticleFeedResponse, type NewsFeedArticleWithSummary, type NewsFeedLinkedMarket, type NewsFeedListResponse, type NewsFeedMarketFeedArticle, type NewsFeedMarketFeedItem, type NewsFeedMarketFeedResponse, type NewsFeedMarketNewsParams, type NewsFeedMarketNewsResponse, type NewsFeedMarketNewsResult, type NewsFeedPageOptions, type NewsFeedStatusResponse, type NonceResponse, type OrderListItem, type OrderListQuery, OrderStatus, OrderType, type Orderbook, type OrderbookBatchItemError, type OrderbookBatchItemErrorCode, type OrderbookBatchItemStatus, type OrderbookHistoryPoint, type OrderbookHistoryResponse, type OrderbookLevel, type OrderbookQuoteFill, type OrderbookQuoteParams, type OrderbookQuoteResponse, type OrderbookServiceUnavailableError, type OrderbookState, type OrderbooksOnlyError, type OutcomeMidpoint, type OutcomeMidpointRow, type OutcomeOrderbookResponse, type PaginatedResponse, type PaperTradingAccount, type PaperTradingAccountsPage, type PaperTradingAppOptions, type PaperTradingBalanceAdjustment, type PaperTradingBalanceResponse, type PaperTradingLiquidityStatus, type PaperTradingListParams, type PaperTradingMarkSource, type PaperTradingOrder, type PaperTradingOrdersPage, type PaperTradingPortfolio, type PaperTradingPosition, type PaperTradingPositionsPage, type PersistedAuthSnapshot, type PlaceLimitOrderParams, type PlaceLimitOrderResponse, type PlacePaperTradingOrderParams, type PositionGroup, type PositionRedeemStatus, type PricePoint, type PriceSource, type PricesHistoryResponse, type QuoteManagedParams, type QuoteManagedRequest, type QuoteManagedResponse, type QuoteManagedSplit, type QuoteManagedStep, type QuoteSplit, type QuoteStep, RECURRENCE_CADENCES, type RampQuote, type RampQuoteRequest, type RampSessionRequest, type RampWidgetSession, type RecurrenceCadence, type RecurrenceFilter, type RecurringCryptoComparisonPoint, type RecurringCryptoComparisonPriceSource, type RecurringCryptoDuration, type RecurringCryptoDurationInput, type RecurringCryptoMarketMetrics, type RecurringCryptoMarketsResponse, type RecurringCryptoOrderbookDepthLevel, type RecurringCryptoOrderbookDepthSide, type RecurringCryptoOutcome, type RecurringCryptoOutcomeOrderbookDepth, type RecurringCryptoPriceComparison, type RecurringCryptoReferencePrice, type RecurringCryptoResolution, type RecurringCryptoSourceConfidence, type RecurringCryptoVenueMarket, type RecurringCryptoWindowComparisons, type RecurringCryptoWindowMarket, type RedeemLegResult, type RedeemLegStatus, type RedeemRequest, type RedeemResponse, type RequestedOrderbookMarket, type ResetPaperTradingAccountParams, type ResolveCorrelatedMarketsParams, type ResolveCorrelatedMarketsResponse, type ResolvedCorrelatedMarketsResponse, type RpcTokenResponse, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, type ServerWallet, type SetPaperTradingBalanceParams, type SettlementDiff, type SettlementDifference, type SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SimpleOrderbookLevel, type SmartRouteAllocation, type SmartRouteBridgeStep, type SmartRouteFeeBreakdown, type SmartRouteFill, type SmartRouteParams, type SmartRouteResponse, type SmartRouteSettlementLeg, type SmartRouteSettlementPlan, type SmartRouteSetupCostLine, type SmartRouteSide, type SmartRouteStatus, type SmartRouteVenueFill, type SplitsByAmountResult, type SyncBalancesResponse, TimeInForce, type TradeExecutorOrder, type TradeExecutorOrderListResponse, TradeSide$1 as TradeSide, type TradeSplit, type TradeStep, TurnstileChallengeError, type UnifiedBalanceResponse, type UpdateUserBody, type UpsertVenueKey, type UserActivityBridge, type UserActivityDeposit, type UserActivityItem, type UserActivityQuery, type UserActivityRedeem, type UserActivityRedeemLeg, type UserActivityTrade, type UserActivityType, type UserActivityUserOp, type UserActivityWithdrawal, type UserHolding, type UserProfile, VENUES, type ValidateBalanceOnClientStep, type ValidateManagedParams, type ValidateManagedRequest, type ValidateManagedResponse, type ValidateTradeRequest, type ValidateTradeResponse, Venue, type VenueEvent, type VenueEventListItem, type VenueEventWithMarkets, type VenueKeySummary, type VenueMarket, type VenueMarketClusterNode, type VenueMarketListItem, type VenueMarketOutcome, type VenueMarketRef, type VenueOrderbookEntry, type VenueOrderbookLevel, type VenuePositionBalance, type VenuePriceInfo, type VenueSoloQuote, type VerifyBody, type VerifyResponse, type WalletChainBalance, type WalletTokenBalance, type WithdrawManagedParams, type WithdrawManagedRequest, type WithdrawManagedResponse, type WithdrawManagedSourceItem, type WithdrawPreviewParams, type WithdrawPreviewResponse, type WithdrawTokenSymbol, type WithdrawalExpected, type WithdrawalLeg, type WithdrawalLegStatus, type WithdrawalLegType, type WithdrawalLifecycleStatus, type WithdrawalQuoteParams, type WithdrawalQuoteResponse, type WithdrawalSource, type WithdrawalSourceItem, type WithdrawalSourceStatus, type WithdrawalSourceTokenSymbol, type WsArbFeedBatch, type WsArbFeedEntry, type WsArbMarketUpdate, type WsAttributedLevel, type WsAuthenticated, type WsBalanceUpdate, type WsCandleInterval, type WsClientMessage, type WsConnected, type WsError, type WsHeartbeat, type WsMarkSource, type WsMarketResolved, type WsOrderEvent, type WsOrderEventType, type WsOrderSubmitted, type WsOrderbookDelta, type WsOrderbookSnapshot, type WsRedeemEvent, type WsServerMessage, type WsSubscribed, type WsTrade, type WsUnsubscribed, type WsVenueBook, type WsVenueInfo, type WsVenueLevel, type WsWithdrawalLegStatus, type WsWithdrawalLifecycleEvent, type WsWithdrawalLifecycleLeg, type WsWithdrawalLifecycleStatus, aggregateMidpoint, applyOrderbookDelta, buildVenueUrl, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getEffectiveDisabledVenues, getWalletAddressFromUserProfile, hasShape, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, isVenueActive, isVenueDataVisible, isVenueInactive, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
4202
+ export { ACTIVE_VENUES, type Account, AccountProvider, AccountType, type AggAuthDeliveryMode, type AggAuthProviderType, type AggAuthStartBody, type AggAuthStartResult, type AggAuthVerifyBody, AggClient, type AggClientAuthOptions, type AggClientSessionInput, type AggLinkAccountBody, type AggLinkAccountConfirmResult, type AggLinkAccountResult, type AggSessionUser, AggWebSocket, type AggWebSocketCallbacks, type AggWebSocketOptions, type AggregatedOrderbookLevel, type AggregatedOrderbookResponse, type App, type AppClientConfigResponse, type AttributedOrderbook, type AttributedOrderbookLevel, type AuthCodeResponse, type AuthStatus, type AuthTokenResponse, type AuthUser, type BalanceRefillAttempt, type BalanceRefillAttemptStatus, type BalanceRefillPolicy, type BalanceRefillPolicyStatus, type BatchMidpointsResponse, type BatchOrderbooksResponse, type BookQuality, type BuildVenueUrlOpts, CONFIRMED_MATCH_STATUSES, type CancelManagedExecutionResponse, type Candle, CandleBuilder, type CandleInterval, type Category, Chain, type ChartBarsResponse, type ChartCandle, type ChartResolution, type ChartVenueCandles, type ComputeSplitsRequest, type ComputeSplitsResponse, type ComputeSplitsSelection, type CorrelatedMarketCascadeItem, type CorrelatedMarketCascadeResponse, type CorrelatedMarketQueryResult, type CorrelatedMarketSide, type CorrelatedMarketSignal, type CorrelatedMarketSignalBatch, type CorrelatedMarketSignalDirection, type CorrelatedMarketsStatus, type CreateApp, type CreateBalanceRefillPolicyParams, type CreatePaperTradingAccountParams, type CryptoReferencePriceError, type CryptoReferencePriceExternalMarketInput, type CryptoReferencePriceMarketInput, type CryptoReferencePriceResult, type CryptoReferencePriceSource, type CryptoReferencePriceTarget, type CryptoReferencePricesResponse, type DepositAddressesPendingResponse, type DepositAddressesReadyResponse, type DepositAddressesResponse, type DepositAddressesSupportedChain, type DepositAddressesToken, type DepositStep, type DiagnosticCallback, type DiagnosticEvent, type ExecuteManagedParams, type ExecuteManagedRequest, type ExecuteManagedResponse, type ExecuteTradeRequest, type ExecuteTradeResponse, type ExecutionDagProgress, type ExecutionMode, type ExecutionOrderItem, type ExecutionOrdersQuery, type ExecutionOverallState, type ExecutionPositionGroup, type ExecutionPositionsQuery, type ExecutionStatusOrder, type ExecutionStatusQuery, type ExecutionStatusResponse, type ExecutionStatusStep, type GetBalanceQuery, type GetBalanceResponse, type GetCryptoReferencePricesOptions, type GetHoldingsQuery, type GetHoldingsResponse, type GetOrdersParams, type GetOrdersQuery, type GetPositionsParams, type GetPositionsQuery, type HelloResponse, IMAGE_SIZES, INACTIVE_VENUES, ImageSize, type LimitOrderTimeInForce, type ListRecurringCryptoMarketsOptions, type ManagedBalancesParams, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedMidpointOutcome, type MatchedOrderbookMarket, type MatchedVenueMarketOutcomeRef, type MidpointItem, type MidpointRow, type NewsFeedArticleFeedItem, type NewsFeedArticleFeedResponse, type NewsFeedArticleWithSummary, type NewsFeedLinkedMarket, type NewsFeedListResponse, type NewsFeedMarketFeedArticle, type NewsFeedMarketFeedItem, type NewsFeedMarketFeedResponse, type NewsFeedMarketNewsParams, type NewsFeedMarketNewsResponse, type NewsFeedMarketNewsResult, type NewsFeedPageOptions, type NewsFeedStatusResponse, type NonceResponse, type OrderListItem, type OrderListQuery, OrderStatus, OrderType, type Orderbook, type OrderbookBatchItemError, type OrderbookBatchItemErrorCode, type OrderbookBatchItemStatus, type OrderbookHistoryPoint, type OrderbookHistoryResponse, type OrderbookLevel, type OrderbookQuoteFill, type OrderbookQuoteParams, type OrderbookQuoteResponse, type OrderbookServiceUnavailableError, type OrderbookState, type OrderbooksOnlyError, type OutcomeMidpoint, type OutcomeMidpointRow, type OutcomeOrderbookResponse, type PaginatedResponse, type PaperTradingAccount, type PaperTradingAccountsPage, type PaperTradingAppOptions, type PaperTradingBalanceAdjustment, type PaperTradingBalanceResponse, type PaperTradingLiquidityStatus, type PaperTradingListParams, type PaperTradingMarkSource, type PaperTradingOrder, type PaperTradingOrdersPage, type PaperTradingPortfolio, type PaperTradingPosition, type PaperTradingPositionsPage, type PersistedAuthSnapshot, type PlaceLimitOrderParams, type PlaceLimitOrderResponse, type PlacePaperTradingOrderParams, type PositionGroup, type PositionRedeemStatus, type PricePoint, type PriceSource, type PricesHistoryResponse, type QuoteManagedParams, type QuoteManagedRequest, type QuoteManagedResponse, type QuoteManagedSplit, type QuoteManagedStep, type QuoteSplit, type QuoteStep, RECURRENCE_CADENCES, type RampQuote, type RampQuoteRequest, type RampSessionRequest, type RampWidgetSession, type RecurrenceCadence, type RecurrenceFilter, type RecurringCryptoComparisonPoint, type RecurringCryptoComparisonPriceSource, type RecurringCryptoDuration, type RecurringCryptoDurationInput, type RecurringCryptoMarketMetrics, type RecurringCryptoMarketsResponse, type RecurringCryptoOrderbookDepthLevel, type RecurringCryptoOrderbookDepthSide, type RecurringCryptoOutcome, type RecurringCryptoOutcomeOrderbookDepth, type RecurringCryptoPriceComparison, type RecurringCryptoReferencePrice, type RecurringCryptoResolution, type RecurringCryptoSourceConfidence, type RecurringCryptoVenueMarket, type RecurringCryptoWindowComparisons, type RecurringCryptoWindowMarket, type RedeemLegResult, type RedeemLegStatus, type RedeemRequest, type RedeemResponse, type RequestedOrderbookMarket, type ResetPaperTradingAccountParams, type ResolveCorrelatedMarketsParams, type ResolveCorrelatedMarketsResponse, type ResolvedCorrelatedMarketsResponse, type RpcTokenResponse, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, type ServerWallet, type SetPaperTradingBalanceParams, type SettlementDiff, type SettlementDifference, type SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SimpleOrderbookLevel, type SmartRouteAllocation, type SmartRouteBridgeStep, type SmartRouteFeeBreakdown, type SmartRouteFill, type SmartRouteParams, type SmartRouteResponse, type SmartRouteSettlementLeg, type SmartRouteSettlementPlan, type SmartRouteSetupCostLine, type SmartRouteSide, type SmartRouteStatus, type SmartRouteVenueFill, type SplitsByAmountResult, type SyncBalancesResponse, TimeInForce, type TradeExecutorOrder, type TradeExecutorOrderListResponse, TradeSide$1 as TradeSide, type TradeSplit, type TradeStep, TurnstileChallengeError, type UnifiedBalanceResponse, type UpdateBalanceRefillPolicyParams, type UpdateUserBody, type UpsertVenueKey, type UserActivityBridge, type UserActivityDeposit, type UserActivityItem, type UserActivityQuery, type UserActivityRedeem, type UserActivityRedeemLeg, type UserActivityTrade, type UserActivityType, type UserActivityUserOp, type UserActivityWithdrawal, type UserHolding, type UserProfile, VENUES, type ValidateBalanceOnClientStep, type ValidateManagedParams, type ValidateManagedRequest, type ValidateManagedResponse, type ValidateTradeRequest, type ValidateTradeResponse, Venue, type VenueEvent, type VenueEventListItem, type VenueEventWithMarkets, type VenueKeyStatus, type VenueKeySummary, type VenueMarket, type VenueMarketClusterNode, type VenueMarketListItem, type VenueMarketOutcome, type VenueMarketRef, type VenueOrderbookEntry, type VenueOrderbookLevel, type VenuePositionBalance, type VenuePriceInfo, type VenueSoloQuote, type VerifyBody, type VerifyResponse, type WalletChainBalance, type WalletTokenBalance, type WithdrawManagedParams, type WithdrawManagedRequest, type WithdrawManagedResponse, type WithdrawManagedSourceItem, type WithdrawPreviewParams, type WithdrawPreviewResponse, type WithdrawTokenSymbol, type WithdrawalExpected, type WithdrawalLeg, type WithdrawalLegStatus, type WithdrawalLegType, type WithdrawalLifecycleStatus, type WithdrawalQuoteParams, type WithdrawalQuoteResponse, type WithdrawalSource, type WithdrawalSourceItem, type WithdrawalSourceStatus, type WithdrawalSourceTokenSymbol, type WsArbFeedBatch, type WsArbFeedEntry, type WsArbMarketUpdate, type WsAttributedLevel, type WsAuthenticated, type WsBalanceUpdate, type WsCandleInterval, type WsClientMessage, type WsConnected, type WsError, type WsHeartbeat, type WsMarkSource, type WsMarketResolved, type WsOrderEvent, type WsOrderEventType, type WsOrderSubmitted, type WsOrderbookDelta, type WsOrderbookSnapshot, type WsRedeemEvent, type WsServerMessage, type WsSubscribed, type WsTrade, type WsUnsubscribed, type WsVenueBook, type WsVenueInfo, type WsVenueLevel, type WsWithdrawalLegStatus, type WsWithdrawalLifecycleEvent, type WsWithdrawalLifecycleLeg, type WsWithdrawalLifecycleStatus, aggregateMidpoint, applyOrderbookDelta, buildVenueUrl, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getEffectiveDisabledVenues, getWalletAddressFromUserProfile, hasShape, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, isVenueActive, isVenueDataVisible, isVenueInactive, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
package/dist/index.d.ts CHANGED
@@ -231,6 +231,12 @@ type VenueKeySummary = {
231
231
  updatedAt: string;
232
232
  venue: Venue;
233
233
  };
234
+ type VenueKeyStatus = {
235
+ venue: Venue;
236
+ connected: boolean;
237
+ validatedAt: string | null;
238
+ kycStatus: string;
239
+ };
234
240
  type TradeSplit = {
235
241
  venue: Venue;
236
242
  venueMarketOutcomeId: string;
@@ -491,6 +497,12 @@ type UnifiedBalanceResponse = {
491
497
  unrealizedPnl: number;
492
498
  realizedPnl: number;
493
499
  }[];
500
+ venueCash?: {
501
+ venue: Venue;
502
+ balanceCents: number;
503
+ portfolioValueCents?: number | undefined;
504
+ updatedAt: string;
505
+ }[];
494
506
  };
495
507
  type UserHolding = {
496
508
  venue: Venue;
@@ -1008,7 +1020,7 @@ type ValidateManagedRequest = {
1008
1020
  amount: number;
1009
1021
  };
1010
1022
  type WithdrawTokenSymbol$1 = "USDC" | "USDC.e" | "USDT";
1011
- type WithdrawalSourceTokenSymbol$1 = WithdrawTokenSymbol$1 | "pUSD";
1023
+ type WithdrawalSourceTokenSymbol$1 = WithdrawTokenSymbol$1 | "pUSD" | "USD1";
1012
1024
  type WithdrawManagedRequest = {
1013
1025
  /** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
1014
1026
  amountRaw: string;
@@ -2552,8 +2564,67 @@ interface ValidateManagedResponse {
2552
2564
  bridgeSourceChainId?: number;
2553
2565
  bridgeAmountRaw?: string;
2554
2566
  }
2567
+ type BalanceRefillPolicyStatus = "enabled" | "paused";
2568
+ type BalanceRefillAttemptStatus = "reserved" | "executing" | "completed" | "failed";
2569
+ interface BalanceRefillAttempt {
2570
+ id: string;
2571
+ policyId: string;
2572
+ status: BalanceRefillAttemptStatus;
2573
+ /** Target-chain balance when the threshold was crossed, in 6-decimal USD units. */
2574
+ triggerBalanceRaw: string;
2575
+ /** Minimum amount the refill must deliver, in 6-decimal USD units. */
2576
+ requestedDeliveryRaw: string;
2577
+ /** Reserved source amount, in 6-decimal USD units. */
2578
+ sourceAmountRaw: string;
2579
+ completedAmountRaw: string | null;
2580
+ sourceChainId: number;
2581
+ targetChainId: number;
2582
+ feeRaw: string | null;
2583
+ errorMessage: string | null;
2584
+ startedAt: string | null;
2585
+ completedAt: string | null;
2586
+ createdAt: string;
2587
+ }
2588
+ interface BalanceRefillPolicy {
2589
+ id: string;
2590
+ targetChainId: number;
2591
+ targetTokenAddress: string;
2592
+ targetTokenSymbol: "USDC";
2593
+ /** Balance floor, in 6-decimal USD units. */
2594
+ minimumRaw: string;
2595
+ /** Minimum delivered amount per refill, in 6-decimal USD units. */
2596
+ refillAmountRaw: string;
2597
+ dailyCapRaw: string;
2598
+ maxFeeRaw: string;
2599
+ status: BalanceRefillPolicyStatus;
2600
+ cooldownSeconds: number;
2601
+ lastObservedRaw: string | null;
2602
+ lastEvaluatedAt: string | null;
2603
+ nextEligibleAt: string | null;
2604
+ consentedAt: string;
2605
+ createdAt: string;
2606
+ updatedAt: string;
2607
+ latestAttempt: BalanceRefillAttempt | null;
2608
+ }
2609
+ interface CreateBalanceRefillPolicyParams {
2610
+ targetChainId: number;
2611
+ targetTokenSymbol?: "USDC";
2612
+ minimumRaw: string;
2613
+ refillAmountRaw: string;
2614
+ /** Optional daily refill limit. Defaults to $250 in 6-decimal USD units. */
2615
+ dailyCapRaw?: string;
2616
+ /** Optional per-refill fee limit. Defaults to $2 in 6-decimal USD units. */
2617
+ maxFeeRaw?: string;
2618
+ }
2619
+ interface UpdateBalanceRefillPolicyParams {
2620
+ minimumRaw?: string;
2621
+ refillAmountRaw?: string;
2622
+ dailyCapRaw?: string;
2623
+ maxFeeRaw?: string;
2624
+ status?: BalanceRefillPolicyStatus;
2625
+ }
2555
2626
  type WithdrawTokenSymbol = "USDC" | "USDC.e" | "USDT";
2556
- type WithdrawalSourceTokenSymbol = WithdrawTokenSymbol | "pUSD";
2627
+ type WithdrawalSourceTokenSymbol = WithdrawTokenSymbol | "pUSD" | "USD1";
2557
2628
  interface WithdrawManagedParams {
2558
2629
  /** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
2559
2630
  amountRaw: string;
@@ -3261,6 +3332,17 @@ interface SmartRouteSettlementPlan {
3261
3332
  totalSellShares: number;
3262
3333
  redeemLegs: SmartRouteSettlementLeg[];
3263
3334
  }
3335
+ /** Slippage metrics for the route. Mirrors `SmartRouteResponseTB.slippage`. */
3336
+ interface SmartRouteSlippage {
3337
+ /** Volume-weighted average price. */
3338
+ vwap: number;
3339
+ /** Reference midpoint used by the optimizer. */
3340
+ refMidpoint: number;
3341
+ /** Route slippage = max(0, VWAP - refMidpoint). */
3342
+ slippage: number;
3343
+ /** Slippage in basis points relative to ref midpoint. */
3344
+ slippageBps: number;
3345
+ }
3264
3346
  interface SmartRouteResponse {
3265
3347
  quoteId: string;
3266
3348
  venueMarketOutcomeId: string;
@@ -3294,6 +3376,12 @@ interface SmartRouteResponse {
3294
3376
  venueSoloQuotes?: VenueSoloQuote[];
3295
3377
  allocations?: SmartRouteAllocation[];
3296
3378
  bridgeSteps?: SmartRouteBridgeStep[];
3379
+ /**
3380
+ * Route slippage metrics. Present on the wire (`SmartRouteResponseTB`) but
3381
+ * missing from this mirror until now — `@agg-build/hooks` already reads
3382
+ * `slippage.slippageBps` to flag thin liquidity.
3383
+ */
3384
+ slippage?: SmartRouteSlippage;
3297
3385
  /** Estimated payout if the outcome wins (= totalFilled shares × $1). */
3298
3386
  estimatedPayout?: number;
3299
3387
  /** Total cost including all fees (rawExecCost + venueFees + bridgeFees +
@@ -3762,6 +3850,14 @@ declare class AggClient {
3762
3850
  getExecutionPositions(params?: ExecutionPositionsQuery): Promise<PaginatedResponse<ExecutionPositionGroup>>;
3763
3851
  /** Get managed wallet balances, including per-chain cash balances and per-venue position balances. */
3764
3852
  getManagedBalances(params?: ManagedBalancesParams): Promise<UnifiedBalanceResponse>;
3853
+ /** Store or replace encrypted credentials for a venue. Secrets are never returned. */
3854
+ upsertVenueKey(body: UpsertVenueKey): Promise<VenueKeySummary>;
3855
+ /** List venues with stored credentials. */
3856
+ listVenueKeys(): Promise<VenueKeySummary[]>;
3857
+ /** Fetch connection and verification status for stored venue credentials. */
3858
+ getVenueKeyStatus(venue: Venue): Promise<VenueKeyStatus>;
3859
+ /** Remove stored credentials for a venue. */
3860
+ deleteVenueKey(venue: Venue): Promise<void>;
3765
3861
  /** Create a server-managed paper trading account for an app. Requires adminKey or apiKey. */
3766
3862
  createPaperTradingAccount(params: CreatePaperTradingAccountParams, options?: PaperTradingAppOptions): Promise<PaperTradingAccount>;
3767
3863
  /** List server-managed paper trading accounts for an app. Requires adminKey or apiKey. */
@@ -3973,6 +4069,14 @@ declare class AggClient {
3973
4069
  placeLimitOrder(params: PlaceLimitOrderParams): Promise<PlaceLimitOrderResponse>;
3974
4070
  /** Redeem resolved winning positions by venue market outcome ids. */
3975
4071
  redeem(body: RedeemRequest): Promise<RedeemResponse>;
4072
+ /** List the authenticated user's managed balance refill policies. */
4073
+ getBalanceRefillPolicies(): Promise<BalanceRefillPolicy[]>;
4074
+ /** Create a managed-USDC refill policy for a target chain. */
4075
+ createBalanceRefillPolicy(params: CreateBalanceRefillPolicyParams): Promise<BalanceRefillPolicy>;
4076
+ /** Update thresholds or pause/resume an existing balance refill policy. */
4077
+ updateBalanceRefillPolicy(policyId: string, params: UpdateBalanceRefillPolicyParams): Promise<BalanceRefillPolicy>;
4078
+ /** Return the 25 most recent attempts for a refill policy. */
4079
+ getBalanceRefillAttempts(policyId: string): Promise<BalanceRefillAttempt[]>;
3976
4080
  /** Withdraw funds from managed wallets to an external address. */
3977
4081
  withdrawManaged(params: WithdrawManagedParams): Promise<WithdrawManagedResponse>;
3978
4082
  /**
@@ -4095,4 +4199,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
4095
4199
 
4096
4200
  declare function createAggClient(options: AggClientOptions): AggClient;
4097
4201
 
4098
- export { ACTIVE_VENUES, type Account, AccountProvider, AccountType, type AggAuthDeliveryMode, type AggAuthProviderType, type AggAuthStartBody, type AggAuthStartResult, type AggAuthVerifyBody, AggClient, type AggClientAuthOptions, type AggClientSessionInput, type AggLinkAccountBody, type AggLinkAccountConfirmResult, type AggLinkAccountResult, type AggSessionUser, AggWebSocket, type AggWebSocketCallbacks, type AggWebSocketOptions, type AggregatedOrderbookLevel, type AggregatedOrderbookResponse, type App, type AppClientConfigResponse, type AttributedOrderbook, type AttributedOrderbookLevel, type AuthCodeResponse, type AuthStatus, type AuthTokenResponse, type AuthUser, type BatchMidpointsResponse, type BatchOrderbooksResponse, type BookQuality, type BuildVenueUrlOpts, CONFIRMED_MATCH_STATUSES, type CancelManagedExecutionResponse, type Candle, CandleBuilder, type CandleInterval, type Category, Chain, type ChartBarsResponse, type ChartCandle, type ChartResolution, type ChartVenueCandles, type ComputeSplitsRequest, type ComputeSplitsResponse, type ComputeSplitsSelection, type CorrelatedMarketCascadeItem, type CorrelatedMarketCascadeResponse, type CorrelatedMarketQueryResult, type CorrelatedMarketSide, type CorrelatedMarketSignal, type CorrelatedMarketSignalBatch, type CorrelatedMarketSignalDirection, type CorrelatedMarketsStatus, type CreateApp, type CreatePaperTradingAccountParams, type CryptoReferencePriceError, type CryptoReferencePriceExternalMarketInput, type CryptoReferencePriceMarketInput, type CryptoReferencePriceResult, type CryptoReferencePriceSource, type CryptoReferencePriceTarget, type CryptoReferencePricesResponse, type DepositAddressesPendingResponse, type DepositAddressesReadyResponse, type DepositAddressesResponse, type DepositAddressesSupportedChain, type DepositAddressesToken, type DepositStep, type DiagnosticCallback, type DiagnosticEvent, type ExecuteManagedParams, type ExecuteManagedRequest, type ExecuteManagedResponse, type ExecuteTradeRequest, type ExecuteTradeResponse, type ExecutionDagProgress, type ExecutionMode, type ExecutionOrderItem, type ExecutionOrdersQuery, type ExecutionOverallState, type ExecutionPositionGroup, type ExecutionPositionsQuery, type ExecutionStatusOrder, type ExecutionStatusQuery, type ExecutionStatusResponse, type ExecutionStatusStep, type GetBalanceQuery, type GetBalanceResponse, type GetCryptoReferencePricesOptions, type GetHoldingsQuery, type GetHoldingsResponse, type GetOrdersParams, type GetOrdersQuery, type GetPositionsParams, type GetPositionsQuery, type HelloResponse, IMAGE_SIZES, INACTIVE_VENUES, ImageSize, type LimitOrderTimeInForce, type ListRecurringCryptoMarketsOptions, type ManagedBalancesParams, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedMidpointOutcome, type MatchedOrderbookMarket, type MatchedVenueMarketOutcomeRef, type MidpointItem, type MidpointRow, type NewsFeedArticleFeedItem, type NewsFeedArticleFeedResponse, type NewsFeedArticleWithSummary, type NewsFeedLinkedMarket, type NewsFeedListResponse, type NewsFeedMarketFeedArticle, type NewsFeedMarketFeedItem, type NewsFeedMarketFeedResponse, type NewsFeedMarketNewsParams, type NewsFeedMarketNewsResponse, type NewsFeedMarketNewsResult, type NewsFeedPageOptions, type NewsFeedStatusResponse, type NonceResponse, type OrderListItem, type OrderListQuery, OrderStatus, OrderType, type Orderbook, type OrderbookBatchItemError, type OrderbookBatchItemErrorCode, type OrderbookBatchItemStatus, type OrderbookHistoryPoint, type OrderbookHistoryResponse, type OrderbookLevel, type OrderbookQuoteFill, type OrderbookQuoteParams, type OrderbookQuoteResponse, type OrderbookServiceUnavailableError, type OrderbookState, type OrderbooksOnlyError, type OutcomeMidpoint, type OutcomeMidpointRow, type OutcomeOrderbookResponse, type PaginatedResponse, type PaperTradingAccount, type PaperTradingAccountsPage, type PaperTradingAppOptions, type PaperTradingBalanceAdjustment, type PaperTradingBalanceResponse, type PaperTradingLiquidityStatus, type PaperTradingListParams, type PaperTradingMarkSource, type PaperTradingOrder, type PaperTradingOrdersPage, type PaperTradingPortfolio, type PaperTradingPosition, type PaperTradingPositionsPage, type PersistedAuthSnapshot, type PlaceLimitOrderParams, type PlaceLimitOrderResponse, type PlacePaperTradingOrderParams, type PositionGroup, type PositionRedeemStatus, type PricePoint, type PriceSource, type PricesHistoryResponse, type QuoteManagedParams, type QuoteManagedRequest, type QuoteManagedResponse, type QuoteManagedSplit, type QuoteManagedStep, type QuoteSplit, type QuoteStep, RECURRENCE_CADENCES, type RampQuote, type RampQuoteRequest, type RampSessionRequest, type RampWidgetSession, type RecurrenceCadence, type RecurrenceFilter, type RecurringCryptoComparisonPoint, type RecurringCryptoComparisonPriceSource, type RecurringCryptoDuration, type RecurringCryptoDurationInput, type RecurringCryptoMarketMetrics, type RecurringCryptoMarketsResponse, type RecurringCryptoOrderbookDepthLevel, type RecurringCryptoOrderbookDepthSide, type RecurringCryptoOutcome, type RecurringCryptoOutcomeOrderbookDepth, type RecurringCryptoPriceComparison, type RecurringCryptoReferencePrice, type RecurringCryptoResolution, type RecurringCryptoSourceConfidence, type RecurringCryptoVenueMarket, type RecurringCryptoWindowComparisons, type RecurringCryptoWindowMarket, type RedeemLegResult, type RedeemLegStatus, type RedeemRequest, type RedeemResponse, type RequestedOrderbookMarket, type ResetPaperTradingAccountParams, type ResolveCorrelatedMarketsParams, type ResolveCorrelatedMarketsResponse, type ResolvedCorrelatedMarketsResponse, type RpcTokenResponse, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, type ServerWallet, type SetPaperTradingBalanceParams, type SettlementDiff, type SettlementDifference, type SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SimpleOrderbookLevel, type SmartRouteAllocation, type SmartRouteBridgeStep, type SmartRouteFeeBreakdown, type SmartRouteFill, type SmartRouteParams, type SmartRouteResponse, type SmartRouteSettlementLeg, type SmartRouteSettlementPlan, type SmartRouteSetupCostLine, type SmartRouteSide, type SmartRouteStatus, type SmartRouteVenueFill, type SplitsByAmountResult, type SyncBalancesResponse, TimeInForce, type TradeExecutorOrder, type TradeExecutorOrderListResponse, TradeSide$1 as TradeSide, type TradeSplit, type TradeStep, TurnstileChallengeError, type UnifiedBalanceResponse, type UpdateUserBody, type UpsertVenueKey, type UserActivityBridge, type UserActivityDeposit, type UserActivityItem, type UserActivityQuery, type UserActivityRedeem, type UserActivityRedeemLeg, type UserActivityTrade, type UserActivityType, type UserActivityUserOp, type UserActivityWithdrawal, type UserHolding, type UserProfile, VENUES, type ValidateBalanceOnClientStep, type ValidateManagedParams, type ValidateManagedRequest, type ValidateManagedResponse, type ValidateTradeRequest, type ValidateTradeResponse, Venue, type VenueEvent, type VenueEventListItem, type VenueEventWithMarkets, type VenueKeySummary, type VenueMarket, type VenueMarketClusterNode, type VenueMarketListItem, type VenueMarketOutcome, type VenueMarketRef, type VenueOrderbookEntry, type VenueOrderbookLevel, type VenuePositionBalance, type VenuePriceInfo, type VenueSoloQuote, type VerifyBody, type VerifyResponse, type WalletChainBalance, type WalletTokenBalance, type WithdrawManagedParams, type WithdrawManagedRequest, type WithdrawManagedResponse, type WithdrawManagedSourceItem, type WithdrawPreviewParams, type WithdrawPreviewResponse, type WithdrawTokenSymbol, type WithdrawalExpected, type WithdrawalLeg, type WithdrawalLegStatus, type WithdrawalLegType, type WithdrawalLifecycleStatus, type WithdrawalQuoteParams, type WithdrawalQuoteResponse, type WithdrawalSource, type WithdrawalSourceItem, type WithdrawalSourceStatus, type WithdrawalSourceTokenSymbol, type WsArbFeedBatch, type WsArbFeedEntry, type WsArbMarketUpdate, type WsAttributedLevel, type WsAuthenticated, type WsBalanceUpdate, type WsCandleInterval, type WsClientMessage, type WsConnected, type WsError, type WsHeartbeat, type WsMarkSource, type WsMarketResolved, type WsOrderEvent, type WsOrderEventType, type WsOrderSubmitted, type WsOrderbookDelta, type WsOrderbookSnapshot, type WsRedeemEvent, type WsServerMessage, type WsSubscribed, type WsTrade, type WsUnsubscribed, type WsVenueBook, type WsVenueInfo, type WsVenueLevel, type WsWithdrawalLegStatus, type WsWithdrawalLifecycleEvent, type WsWithdrawalLifecycleLeg, type WsWithdrawalLifecycleStatus, aggregateMidpoint, applyOrderbookDelta, buildVenueUrl, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getEffectiveDisabledVenues, getWalletAddressFromUserProfile, hasShape, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, isVenueActive, isVenueDataVisible, isVenueInactive, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
4202
+ export { ACTIVE_VENUES, type Account, AccountProvider, AccountType, type AggAuthDeliveryMode, type AggAuthProviderType, type AggAuthStartBody, type AggAuthStartResult, type AggAuthVerifyBody, AggClient, type AggClientAuthOptions, type AggClientSessionInput, type AggLinkAccountBody, type AggLinkAccountConfirmResult, type AggLinkAccountResult, type AggSessionUser, AggWebSocket, type AggWebSocketCallbacks, type AggWebSocketOptions, type AggregatedOrderbookLevel, type AggregatedOrderbookResponse, type App, type AppClientConfigResponse, type AttributedOrderbook, type AttributedOrderbookLevel, type AuthCodeResponse, type AuthStatus, type AuthTokenResponse, type AuthUser, type BalanceRefillAttempt, type BalanceRefillAttemptStatus, type BalanceRefillPolicy, type BalanceRefillPolicyStatus, type BatchMidpointsResponse, type BatchOrderbooksResponse, type BookQuality, type BuildVenueUrlOpts, CONFIRMED_MATCH_STATUSES, type CancelManagedExecutionResponse, type Candle, CandleBuilder, type CandleInterval, type Category, Chain, type ChartBarsResponse, type ChartCandle, type ChartResolution, type ChartVenueCandles, type ComputeSplitsRequest, type ComputeSplitsResponse, type ComputeSplitsSelection, type CorrelatedMarketCascadeItem, type CorrelatedMarketCascadeResponse, type CorrelatedMarketQueryResult, type CorrelatedMarketSide, type CorrelatedMarketSignal, type CorrelatedMarketSignalBatch, type CorrelatedMarketSignalDirection, type CorrelatedMarketsStatus, type CreateApp, type CreateBalanceRefillPolicyParams, type CreatePaperTradingAccountParams, type CryptoReferencePriceError, type CryptoReferencePriceExternalMarketInput, type CryptoReferencePriceMarketInput, type CryptoReferencePriceResult, type CryptoReferencePriceSource, type CryptoReferencePriceTarget, type CryptoReferencePricesResponse, type DepositAddressesPendingResponse, type DepositAddressesReadyResponse, type DepositAddressesResponse, type DepositAddressesSupportedChain, type DepositAddressesToken, type DepositStep, type DiagnosticCallback, type DiagnosticEvent, type ExecuteManagedParams, type ExecuteManagedRequest, type ExecuteManagedResponse, type ExecuteTradeRequest, type ExecuteTradeResponse, type ExecutionDagProgress, type ExecutionMode, type ExecutionOrderItem, type ExecutionOrdersQuery, type ExecutionOverallState, type ExecutionPositionGroup, type ExecutionPositionsQuery, type ExecutionStatusOrder, type ExecutionStatusQuery, type ExecutionStatusResponse, type ExecutionStatusStep, type GetBalanceQuery, type GetBalanceResponse, type GetCryptoReferencePricesOptions, type GetHoldingsQuery, type GetHoldingsResponse, type GetOrdersParams, type GetOrdersQuery, type GetPositionsParams, type GetPositionsQuery, type HelloResponse, IMAGE_SIZES, INACTIVE_VENUES, ImageSize, type LimitOrderTimeInForce, type ListRecurringCryptoMarketsOptions, type ManagedBalancesParams, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedMidpointOutcome, type MatchedOrderbookMarket, type MatchedVenueMarketOutcomeRef, type MidpointItem, type MidpointRow, type NewsFeedArticleFeedItem, type NewsFeedArticleFeedResponse, type NewsFeedArticleWithSummary, type NewsFeedLinkedMarket, type NewsFeedListResponse, type NewsFeedMarketFeedArticle, type NewsFeedMarketFeedItem, type NewsFeedMarketFeedResponse, type NewsFeedMarketNewsParams, type NewsFeedMarketNewsResponse, type NewsFeedMarketNewsResult, type NewsFeedPageOptions, type NewsFeedStatusResponse, type NonceResponse, type OrderListItem, type OrderListQuery, OrderStatus, OrderType, type Orderbook, type OrderbookBatchItemError, type OrderbookBatchItemErrorCode, type OrderbookBatchItemStatus, type OrderbookHistoryPoint, type OrderbookHistoryResponse, type OrderbookLevel, type OrderbookQuoteFill, type OrderbookQuoteParams, type OrderbookQuoteResponse, type OrderbookServiceUnavailableError, type OrderbookState, type OrderbooksOnlyError, type OutcomeMidpoint, type OutcomeMidpointRow, type OutcomeOrderbookResponse, type PaginatedResponse, type PaperTradingAccount, type PaperTradingAccountsPage, type PaperTradingAppOptions, type PaperTradingBalanceAdjustment, type PaperTradingBalanceResponse, type PaperTradingLiquidityStatus, type PaperTradingListParams, type PaperTradingMarkSource, type PaperTradingOrder, type PaperTradingOrdersPage, type PaperTradingPortfolio, type PaperTradingPosition, type PaperTradingPositionsPage, type PersistedAuthSnapshot, type PlaceLimitOrderParams, type PlaceLimitOrderResponse, type PlacePaperTradingOrderParams, type PositionGroup, type PositionRedeemStatus, type PricePoint, type PriceSource, type PricesHistoryResponse, type QuoteManagedParams, type QuoteManagedRequest, type QuoteManagedResponse, type QuoteManagedSplit, type QuoteManagedStep, type QuoteSplit, type QuoteStep, RECURRENCE_CADENCES, type RampQuote, type RampQuoteRequest, type RampSessionRequest, type RampWidgetSession, type RecurrenceCadence, type RecurrenceFilter, type RecurringCryptoComparisonPoint, type RecurringCryptoComparisonPriceSource, type RecurringCryptoDuration, type RecurringCryptoDurationInput, type RecurringCryptoMarketMetrics, type RecurringCryptoMarketsResponse, type RecurringCryptoOrderbookDepthLevel, type RecurringCryptoOrderbookDepthSide, type RecurringCryptoOutcome, type RecurringCryptoOutcomeOrderbookDepth, type RecurringCryptoPriceComparison, type RecurringCryptoReferencePrice, type RecurringCryptoResolution, type RecurringCryptoSourceConfidence, type RecurringCryptoVenueMarket, type RecurringCryptoWindowComparisons, type RecurringCryptoWindowMarket, type RedeemLegResult, type RedeemLegStatus, type RedeemRequest, type RedeemResponse, type RequestedOrderbookMarket, type ResetPaperTradingAccountParams, type ResolveCorrelatedMarketsParams, type ResolveCorrelatedMarketsResponse, type ResolvedCorrelatedMarketsResponse, type RpcTokenResponse, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, type ServerWallet, type SetPaperTradingBalanceParams, type SettlementDiff, type SettlementDifference, type SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SimpleOrderbookLevel, type SmartRouteAllocation, type SmartRouteBridgeStep, type SmartRouteFeeBreakdown, type SmartRouteFill, type SmartRouteParams, type SmartRouteResponse, type SmartRouteSettlementLeg, type SmartRouteSettlementPlan, type SmartRouteSetupCostLine, type SmartRouteSide, type SmartRouteStatus, type SmartRouteVenueFill, type SplitsByAmountResult, type SyncBalancesResponse, TimeInForce, type TradeExecutorOrder, type TradeExecutorOrderListResponse, TradeSide$1 as TradeSide, type TradeSplit, type TradeStep, TurnstileChallengeError, type UnifiedBalanceResponse, type UpdateBalanceRefillPolicyParams, type UpdateUserBody, type UpsertVenueKey, type UserActivityBridge, type UserActivityDeposit, type UserActivityItem, type UserActivityQuery, type UserActivityRedeem, type UserActivityRedeemLeg, type UserActivityTrade, type UserActivityType, type UserActivityUserOp, type UserActivityWithdrawal, type UserHolding, type UserProfile, VENUES, type ValidateBalanceOnClientStep, type ValidateManagedParams, type ValidateManagedRequest, type ValidateManagedResponse, type ValidateTradeRequest, type ValidateTradeResponse, Venue, type VenueEvent, type VenueEventListItem, type VenueEventWithMarkets, type VenueKeyStatus, type VenueKeySummary, type VenueMarket, type VenueMarketClusterNode, type VenueMarketListItem, type VenueMarketOutcome, type VenueMarketRef, type VenueOrderbookEntry, type VenueOrderbookLevel, type VenuePositionBalance, type VenuePriceInfo, type VenueSoloQuote, type VerifyBody, type VerifyResponse, type WalletChainBalance, type WalletTokenBalance, type WithdrawManagedParams, type WithdrawManagedRequest, type WithdrawManagedResponse, type WithdrawManagedSourceItem, type WithdrawPreviewParams, type WithdrawPreviewResponse, type WithdrawTokenSymbol, type WithdrawalExpected, type WithdrawalLeg, type WithdrawalLegStatus, type WithdrawalLegType, type WithdrawalLifecycleStatus, type WithdrawalQuoteParams, type WithdrawalQuoteResponse, type WithdrawalSource, type WithdrawalSourceItem, type WithdrawalSourceStatus, type WithdrawalSourceTokenSymbol, type WsArbFeedBatch, type WsArbFeedEntry, type WsArbMarketUpdate, type WsAttributedLevel, type WsAuthenticated, type WsBalanceUpdate, type WsCandleInterval, type WsClientMessage, type WsConnected, type WsError, type WsHeartbeat, type WsMarkSource, type WsMarketResolved, type WsOrderEvent, type WsOrderEventType, type WsOrderSubmitted, type WsOrderbookDelta, type WsOrderbookSnapshot, type WsRedeemEvent, type WsServerMessage, type WsSubscribed, type WsTrade, type WsUnsubscribed, type WsVenueBook, type WsVenueInfo, type WsVenueLevel, type WsWithdrawalLegStatus, type WsWithdrawalLifecycleEvent, type WsWithdrawalLifecycleLeg, type WsWithdrawalLifecycleStatus, aggregateMidpoint, applyOrderbookDelta, buildVenueUrl, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getEffectiveDisabledVenues, getWalletAddressFromUserProfile, hasShape, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, isVenueActive, isVenueDataVisible, isVenueInactive, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
package/dist/index.js CHANGED
@@ -1869,6 +1869,7 @@ var AggClient = class {
1869
1869
  if (!retryResponse.ok) {
1870
1870
  return this.throwResponseError(retryResponse);
1871
1871
  }
1872
+ if (retryResponse.status === 204) return void 0;
1872
1873
  return retryResponse.json();
1873
1874
  } catch (e) {
1874
1875
  this.clearAccessToken();
@@ -1878,14 +1879,13 @@ var AggClient = class {
1878
1879
  if (!response.ok) {
1879
1880
  return this.throwResponseError(response);
1880
1881
  }
1882
+ if (response.status === 204) return void 0;
1881
1883
  return response.json();
1882
1884
  });
1883
1885
  }
1884
1886
  rawFetch(path, init) {
1885
1887
  return __async(this, null, function* () {
1886
- const headers = {
1887
- "Content-Type": "application/json"
1888
- };
1888
+ const headers = (init == null ? void 0 : init.body) != null ? { "Content-Type": "application/json" } : {};
1889
1889
  if (this.appId) {
1890
1890
  headers["x-app-id"] = this.appId;
1891
1891
  }
@@ -2407,6 +2407,33 @@ Issued At: ${issuedAt}`;
2407
2407
  });
2408
2408
  });
2409
2409
  }
2410
+ /** Store or replace encrypted credentials for a venue. Secrets are never returned. */
2411
+ upsertVenueKey(body) {
2412
+ return __async(this, null, function* () {
2413
+ return this.request("/venue-keys", {
2414
+ method: "PUT",
2415
+ body: JSON.stringify(body)
2416
+ });
2417
+ });
2418
+ }
2419
+ /** List venues with stored credentials. */
2420
+ listVenueKeys() {
2421
+ return __async(this, null, function* () {
2422
+ return this.request("/venue-keys");
2423
+ });
2424
+ }
2425
+ /** Fetch connection and verification status for stored venue credentials. */
2426
+ getVenueKeyStatus(venue) {
2427
+ return __async(this, null, function* () {
2428
+ return this.request(`/venue-keys/${encodeURIComponent(venue)}/status`);
2429
+ });
2430
+ }
2431
+ /** Remove stored credentials for a venue. */
2432
+ deleteVenueKey(venue) {
2433
+ return __async(this, null, function* () {
2434
+ yield this.request(`/venue-keys/${encodeURIComponent(venue)}`, { method: "DELETE" });
2435
+ });
2436
+ }
2410
2437
  /** Create a server-managed paper trading account for an app. Requires adminKey or apiKey. */
2411
2438
  createPaperTradingAccount(params, options) {
2412
2439
  return __async(this, null, function* () {
@@ -3000,6 +3027,40 @@ Issued At: ${issuedAt}`;
3000
3027
  });
3001
3028
  });
3002
3029
  }
3030
+ /** List the authenticated user's managed balance refill policies. */
3031
+ getBalanceRefillPolicies() {
3032
+ return __async(this, null, function* () {
3033
+ return this.request("/execution/balance-refill-policies");
3034
+ });
3035
+ }
3036
+ /** Create a managed-USDC refill policy for a target chain. */
3037
+ createBalanceRefillPolicy(params) {
3038
+ return __async(this, null, function* () {
3039
+ return this.request("/execution/balance-refill-policies", {
3040
+ method: "POST",
3041
+ body: JSON.stringify(params)
3042
+ });
3043
+ });
3044
+ }
3045
+ /** Update thresholds or pause/resume an existing balance refill policy. */
3046
+ updateBalanceRefillPolicy(policyId, params) {
3047
+ return __async(this, null, function* () {
3048
+ if (!policyId) throw new Error("policyId is required");
3049
+ return this.request(
3050
+ `/execution/balance-refill-policies/${encodeURIComponent(policyId)}`,
3051
+ { method: "PATCH", body: JSON.stringify(params) }
3052
+ );
3053
+ });
3054
+ }
3055
+ /** Return the 25 most recent attempts for a refill policy. */
3056
+ getBalanceRefillAttempts(policyId) {
3057
+ return __async(this, null, function* () {
3058
+ if (!policyId) throw new Error("policyId is required");
3059
+ return this.request(
3060
+ `/execution/balance-refill-policies/${encodeURIComponent(policyId)}/attempts`
3061
+ );
3062
+ });
3063
+ }
3003
3064
  /** Withdraw funds from managed wallets to an external address. */
3004
3065
  withdrawManaged(params) {
3005
3066
  return __async(this, null, function* () {
package/dist/index.mjs CHANGED
@@ -1750,6 +1750,7 @@ var AggClient = class {
1750
1750
  if (!retryResponse.ok) {
1751
1751
  return this.throwResponseError(retryResponse);
1752
1752
  }
1753
+ if (retryResponse.status === 204) return void 0;
1753
1754
  return retryResponse.json();
1754
1755
  } catch (e) {
1755
1756
  this.clearAccessToken();
@@ -1759,14 +1760,13 @@ var AggClient = class {
1759
1760
  if (!response.ok) {
1760
1761
  return this.throwResponseError(response);
1761
1762
  }
1763
+ if (response.status === 204) return void 0;
1762
1764
  return response.json();
1763
1765
  });
1764
1766
  }
1765
1767
  rawFetch(path, init) {
1766
1768
  return __async(this, null, function* () {
1767
- const headers = {
1768
- "Content-Type": "application/json"
1769
- };
1769
+ const headers = (init == null ? void 0 : init.body) != null ? { "Content-Type": "application/json" } : {};
1770
1770
  if (this.appId) {
1771
1771
  headers["x-app-id"] = this.appId;
1772
1772
  }
@@ -2288,6 +2288,33 @@ Issued At: ${issuedAt}`;
2288
2288
  });
2289
2289
  });
2290
2290
  }
2291
+ /** Store or replace encrypted credentials for a venue. Secrets are never returned. */
2292
+ upsertVenueKey(body) {
2293
+ return __async(this, null, function* () {
2294
+ return this.request("/venue-keys", {
2295
+ method: "PUT",
2296
+ body: JSON.stringify(body)
2297
+ });
2298
+ });
2299
+ }
2300
+ /** List venues with stored credentials. */
2301
+ listVenueKeys() {
2302
+ return __async(this, null, function* () {
2303
+ return this.request("/venue-keys");
2304
+ });
2305
+ }
2306
+ /** Fetch connection and verification status for stored venue credentials. */
2307
+ getVenueKeyStatus(venue) {
2308
+ return __async(this, null, function* () {
2309
+ return this.request(`/venue-keys/${encodeURIComponent(venue)}/status`);
2310
+ });
2311
+ }
2312
+ /** Remove stored credentials for a venue. */
2313
+ deleteVenueKey(venue) {
2314
+ return __async(this, null, function* () {
2315
+ yield this.request(`/venue-keys/${encodeURIComponent(venue)}`, { method: "DELETE" });
2316
+ });
2317
+ }
2291
2318
  /** Create a server-managed paper trading account for an app. Requires adminKey or apiKey. */
2292
2319
  createPaperTradingAccount(params, options) {
2293
2320
  return __async(this, null, function* () {
@@ -2881,6 +2908,40 @@ Issued At: ${issuedAt}`;
2881
2908
  });
2882
2909
  });
2883
2910
  }
2911
+ /** List the authenticated user's managed balance refill policies. */
2912
+ getBalanceRefillPolicies() {
2913
+ return __async(this, null, function* () {
2914
+ return this.request("/execution/balance-refill-policies");
2915
+ });
2916
+ }
2917
+ /** Create a managed-USDC refill policy for a target chain. */
2918
+ createBalanceRefillPolicy(params) {
2919
+ return __async(this, null, function* () {
2920
+ return this.request("/execution/balance-refill-policies", {
2921
+ method: "POST",
2922
+ body: JSON.stringify(params)
2923
+ });
2924
+ });
2925
+ }
2926
+ /** Update thresholds or pause/resume an existing balance refill policy. */
2927
+ updateBalanceRefillPolicy(policyId, params) {
2928
+ return __async(this, null, function* () {
2929
+ if (!policyId) throw new Error("policyId is required");
2930
+ return this.request(
2931
+ `/execution/balance-refill-policies/${encodeURIComponent(policyId)}`,
2932
+ { method: "PATCH", body: JSON.stringify(params) }
2933
+ );
2934
+ });
2935
+ }
2936
+ /** Return the 25 most recent attempts for a refill policy. */
2937
+ getBalanceRefillAttempts(policyId) {
2938
+ return __async(this, null, function* () {
2939
+ if (!policyId) throw new Error("policyId is required");
2940
+ return this.request(
2941
+ `/execution/balance-refill-policies/${encodeURIComponent(policyId)}/attempts`
2942
+ );
2943
+ });
2944
+ }
2884
2945
  /** Withdraw funds from managed wallets to an external address. */
2885
2946
  withdrawManaged(params) {
2886
2947
  return __async(this, null, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/sdk",
3
- "version": "2.5.1",
3
+ "version": "2.8.2",
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",