@agg-build/sdk 2.9.0 → 4.0.0
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 +37 -52
- package/dist/index.d.ts +37 -52
- package/dist/index.js +28 -24
- package/dist/index.mjs +26 -24
- package/package.json +1 -7
package/dist/index.d.mts
CHANGED
|
@@ -991,26 +991,6 @@ type SettlementDiff = {
|
|
|
991
991
|
sharedSummary: string;
|
|
992
992
|
differences: SettlementDifference[];
|
|
993
993
|
};
|
|
994
|
-
type QuoteManagedRequest = {
|
|
995
|
-
venueMarketOutcomeIds: string[];
|
|
996
|
-
side: "buy" | "sell";
|
|
997
|
-
amount: number;
|
|
998
|
-
slippageBps?: number | undefined;
|
|
999
|
-
};
|
|
1000
|
-
type QuoteStep = {
|
|
1001
|
-
type: string;
|
|
1002
|
-
description: string;
|
|
1003
|
-
estimatedDurationMs: number;
|
|
1004
|
-
};
|
|
1005
|
-
type QuoteSplit = {
|
|
1006
|
-
venue: Venue;
|
|
1007
|
-
venueMarketId: string;
|
|
1008
|
-
venueMarketOutcomeId: string;
|
|
1009
|
-
tokenId: string;
|
|
1010
|
-
price: string;
|
|
1011
|
-
size: string;
|
|
1012
|
-
costRaw: string;
|
|
1013
|
-
};
|
|
1014
994
|
type ExecuteManagedRequest = {
|
|
1015
995
|
quoteId: string;
|
|
1016
996
|
};
|
|
@@ -2482,34 +2462,6 @@ interface AggregatedOrderbookResponse {
|
|
|
2482
2462
|
venueMarketId: string;
|
|
2483
2463
|
}>;
|
|
2484
2464
|
}
|
|
2485
|
-
interface QuoteManagedParams {
|
|
2486
|
-
venueMarketOutcomeIds: string[];
|
|
2487
|
-
side: "buy" | "sell";
|
|
2488
|
-
amount: number;
|
|
2489
|
-
slippageBps?: number;
|
|
2490
|
-
}
|
|
2491
|
-
interface QuoteManagedStep {
|
|
2492
|
-
type: string;
|
|
2493
|
-
description: string;
|
|
2494
|
-
estimatedDurationMs: number;
|
|
2495
|
-
}
|
|
2496
|
-
interface QuoteManagedSplit {
|
|
2497
|
-
venue: string;
|
|
2498
|
-
venueMarketId: string;
|
|
2499
|
-
venueMarketOutcomeId: string;
|
|
2500
|
-
tokenId: string;
|
|
2501
|
-
price: string;
|
|
2502
|
-
size: string;
|
|
2503
|
-
costRaw: string;
|
|
2504
|
-
}
|
|
2505
|
-
interface QuoteManagedResponse {
|
|
2506
|
-
quoteId: string;
|
|
2507
|
-
canExecute: boolean;
|
|
2508
|
-
estimatedCostRaw: string;
|
|
2509
|
-
steps: QuoteManagedStep[];
|
|
2510
|
-
splits: QuoteManagedSplit[];
|
|
2511
|
-
expiresAt: string;
|
|
2512
|
-
}
|
|
2513
2465
|
interface ExecuteManagedParams {
|
|
2514
2466
|
quoteId: string;
|
|
2515
2467
|
/** Trading mode. Defaults to live. */
|
|
@@ -3956,7 +3908,7 @@ declare class AggClient {
|
|
|
3956
3908
|
marketGroup?: string[];
|
|
3957
3909
|
limit?: number;
|
|
3958
3910
|
cursor?: string;
|
|
3959
|
-
sortBy?: "volume" | "volume24hr" | "createdAt" | "
|
|
3911
|
+
sortBy?: "volume" | "volume24hr" | "createdAt" | "updatedAt";
|
|
3960
3912
|
sortDir?: "asc" | "desc";
|
|
3961
3913
|
context?: "list" | "detail";
|
|
3962
3914
|
}): Promise<PaginatedResponse<VenueMarket>>;
|
|
@@ -4095,8 +4047,6 @@ declare class AggClient {
|
|
|
4095
4047
|
createWebSocket(callbacks?: AggWebSocketCallbacks, options?: {
|
|
4096
4048
|
enableLogs?: boolean;
|
|
4097
4049
|
}): AggWebSocket;
|
|
4098
|
-
/** Request a quote for a managed trade. Returns quoteId (2-min TTL), execution steps, and splits. */
|
|
4099
|
-
quoteManaged(params: QuoteManagedParams): Promise<QuoteManagedResponse>;
|
|
4100
4050
|
/** Execute a previously quoted managed trade. Returns pending order IDs. */
|
|
4101
4051
|
executeManaged(params: ExecuteManagedParams): Promise<ExecuteManagedResponse>;
|
|
4102
4052
|
/** Place a managed limit order. Returns the venue-backed order state. */
|
|
@@ -4166,6 +4116,41 @@ declare class TurnstileChallengeError extends Error {
|
|
|
4166
4116
|
readonly siteKey: string;
|
|
4167
4117
|
constructor(siteKey: string);
|
|
4168
4118
|
}
|
|
4119
|
+
/** Field-level validation detail returned by the API on 400 responses. */
|
|
4120
|
+
interface AggApiFieldError {
|
|
4121
|
+
field: string;
|
|
4122
|
+
message: string;
|
|
4123
|
+
}
|
|
4124
|
+
interface AggApiErrorInit {
|
|
4125
|
+
code?: string;
|
|
4126
|
+
retryable?: boolean;
|
|
4127
|
+
errors?: AggApiFieldError[];
|
|
4128
|
+
}
|
|
4129
|
+
/**
|
|
4130
|
+
* Thrown for every non-2xx response from the AGG API.
|
|
4131
|
+
*
|
|
4132
|
+
* Branch on `status` and `code` rather than matching `message` text —
|
|
4133
|
+
* messages are human-facing and may be reworded without a major bump.
|
|
4134
|
+
*
|
|
4135
|
+
* ```ts
|
|
4136
|
+
* try {
|
|
4137
|
+
* await client.getPositions();
|
|
4138
|
+
* } catch (err) {
|
|
4139
|
+
* if (isAggApiError(err) && err.status === 401) {
|
|
4140
|
+
* // session lapsed — prompt reconnect
|
|
4141
|
+
* }
|
|
4142
|
+
* }
|
|
4143
|
+
* ```
|
|
4144
|
+
*/
|
|
4145
|
+
declare class AggApiError extends Error {
|
|
4146
|
+
readonly status: number;
|
|
4147
|
+
readonly code?: string;
|
|
4148
|
+
readonly retryable?: boolean;
|
|
4149
|
+
readonly errors?: AggApiFieldError[];
|
|
4150
|
+
constructor(message: string, status: number, init?: AggApiErrorInit);
|
|
4151
|
+
}
|
|
4152
|
+
/** Type guard for {@link AggApiError}, safe across bundle boundaries. */
|
|
4153
|
+
declare function isAggApiError(value: unknown): value is AggApiError;
|
|
4169
4154
|
|
|
4170
4155
|
type CandleInterval = "1m" | "5m" | "1h" | "1d";
|
|
4171
4156
|
/** Universal OHLCV candle. Chart-library-agnostic. */
|
|
@@ -4233,4 +4218,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
|
|
|
4233
4218
|
|
|
4234
4219
|
declare function createAggClient(options: AggClientOptions): AggClient;
|
|
4235
4220
|
|
|
4236
|
-
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 ExecutionDisplayGroupStatus, type ExecutionDisplayStepKind, 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,
|
|
4221
|
+
export { ACTIVE_VENUES, type Account, AccountProvider, AccountType, AggApiError, type AggApiErrorInit, type AggApiFieldError, 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 ExecutionDisplayGroupStatus, type ExecutionDisplayStepKind, 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, 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 VenueGeoPolicyEntry, type VenueGeoPolicyResponse, 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, isAggApiError, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, isVenueActive, isVenueDataVisible, isVenueInactive, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
|
package/dist/index.d.ts
CHANGED
|
@@ -991,26 +991,6 @@ type SettlementDiff = {
|
|
|
991
991
|
sharedSummary: string;
|
|
992
992
|
differences: SettlementDifference[];
|
|
993
993
|
};
|
|
994
|
-
type QuoteManagedRequest = {
|
|
995
|
-
venueMarketOutcomeIds: string[];
|
|
996
|
-
side: "buy" | "sell";
|
|
997
|
-
amount: number;
|
|
998
|
-
slippageBps?: number | undefined;
|
|
999
|
-
};
|
|
1000
|
-
type QuoteStep = {
|
|
1001
|
-
type: string;
|
|
1002
|
-
description: string;
|
|
1003
|
-
estimatedDurationMs: number;
|
|
1004
|
-
};
|
|
1005
|
-
type QuoteSplit = {
|
|
1006
|
-
venue: Venue;
|
|
1007
|
-
venueMarketId: string;
|
|
1008
|
-
venueMarketOutcomeId: string;
|
|
1009
|
-
tokenId: string;
|
|
1010
|
-
price: string;
|
|
1011
|
-
size: string;
|
|
1012
|
-
costRaw: string;
|
|
1013
|
-
};
|
|
1014
994
|
type ExecuteManagedRequest = {
|
|
1015
995
|
quoteId: string;
|
|
1016
996
|
};
|
|
@@ -2482,34 +2462,6 @@ interface AggregatedOrderbookResponse {
|
|
|
2482
2462
|
venueMarketId: string;
|
|
2483
2463
|
}>;
|
|
2484
2464
|
}
|
|
2485
|
-
interface QuoteManagedParams {
|
|
2486
|
-
venueMarketOutcomeIds: string[];
|
|
2487
|
-
side: "buy" | "sell";
|
|
2488
|
-
amount: number;
|
|
2489
|
-
slippageBps?: number;
|
|
2490
|
-
}
|
|
2491
|
-
interface QuoteManagedStep {
|
|
2492
|
-
type: string;
|
|
2493
|
-
description: string;
|
|
2494
|
-
estimatedDurationMs: number;
|
|
2495
|
-
}
|
|
2496
|
-
interface QuoteManagedSplit {
|
|
2497
|
-
venue: string;
|
|
2498
|
-
venueMarketId: string;
|
|
2499
|
-
venueMarketOutcomeId: string;
|
|
2500
|
-
tokenId: string;
|
|
2501
|
-
price: string;
|
|
2502
|
-
size: string;
|
|
2503
|
-
costRaw: string;
|
|
2504
|
-
}
|
|
2505
|
-
interface QuoteManagedResponse {
|
|
2506
|
-
quoteId: string;
|
|
2507
|
-
canExecute: boolean;
|
|
2508
|
-
estimatedCostRaw: string;
|
|
2509
|
-
steps: QuoteManagedStep[];
|
|
2510
|
-
splits: QuoteManagedSplit[];
|
|
2511
|
-
expiresAt: string;
|
|
2512
|
-
}
|
|
2513
2465
|
interface ExecuteManagedParams {
|
|
2514
2466
|
quoteId: string;
|
|
2515
2467
|
/** Trading mode. Defaults to live. */
|
|
@@ -3956,7 +3908,7 @@ declare class AggClient {
|
|
|
3956
3908
|
marketGroup?: string[];
|
|
3957
3909
|
limit?: number;
|
|
3958
3910
|
cursor?: string;
|
|
3959
|
-
sortBy?: "volume" | "volume24hr" | "createdAt" | "
|
|
3911
|
+
sortBy?: "volume" | "volume24hr" | "createdAt" | "updatedAt";
|
|
3960
3912
|
sortDir?: "asc" | "desc";
|
|
3961
3913
|
context?: "list" | "detail";
|
|
3962
3914
|
}): Promise<PaginatedResponse<VenueMarket>>;
|
|
@@ -4095,8 +4047,6 @@ declare class AggClient {
|
|
|
4095
4047
|
createWebSocket(callbacks?: AggWebSocketCallbacks, options?: {
|
|
4096
4048
|
enableLogs?: boolean;
|
|
4097
4049
|
}): AggWebSocket;
|
|
4098
|
-
/** Request a quote for a managed trade. Returns quoteId (2-min TTL), execution steps, and splits. */
|
|
4099
|
-
quoteManaged(params: QuoteManagedParams): Promise<QuoteManagedResponse>;
|
|
4100
4050
|
/** Execute a previously quoted managed trade. Returns pending order IDs. */
|
|
4101
4051
|
executeManaged(params: ExecuteManagedParams): Promise<ExecuteManagedResponse>;
|
|
4102
4052
|
/** Place a managed limit order. Returns the venue-backed order state. */
|
|
@@ -4166,6 +4116,41 @@ declare class TurnstileChallengeError extends Error {
|
|
|
4166
4116
|
readonly siteKey: string;
|
|
4167
4117
|
constructor(siteKey: string);
|
|
4168
4118
|
}
|
|
4119
|
+
/** Field-level validation detail returned by the API on 400 responses. */
|
|
4120
|
+
interface AggApiFieldError {
|
|
4121
|
+
field: string;
|
|
4122
|
+
message: string;
|
|
4123
|
+
}
|
|
4124
|
+
interface AggApiErrorInit {
|
|
4125
|
+
code?: string;
|
|
4126
|
+
retryable?: boolean;
|
|
4127
|
+
errors?: AggApiFieldError[];
|
|
4128
|
+
}
|
|
4129
|
+
/**
|
|
4130
|
+
* Thrown for every non-2xx response from the AGG API.
|
|
4131
|
+
*
|
|
4132
|
+
* Branch on `status` and `code` rather than matching `message` text —
|
|
4133
|
+
* messages are human-facing and may be reworded without a major bump.
|
|
4134
|
+
*
|
|
4135
|
+
* ```ts
|
|
4136
|
+
* try {
|
|
4137
|
+
* await client.getPositions();
|
|
4138
|
+
* } catch (err) {
|
|
4139
|
+
* if (isAggApiError(err) && err.status === 401) {
|
|
4140
|
+
* // session lapsed — prompt reconnect
|
|
4141
|
+
* }
|
|
4142
|
+
* }
|
|
4143
|
+
* ```
|
|
4144
|
+
*/
|
|
4145
|
+
declare class AggApiError extends Error {
|
|
4146
|
+
readonly status: number;
|
|
4147
|
+
readonly code?: string;
|
|
4148
|
+
readonly retryable?: boolean;
|
|
4149
|
+
readonly errors?: AggApiFieldError[];
|
|
4150
|
+
constructor(message: string, status: number, init?: AggApiErrorInit);
|
|
4151
|
+
}
|
|
4152
|
+
/** Type guard for {@link AggApiError}, safe across bundle boundaries. */
|
|
4153
|
+
declare function isAggApiError(value: unknown): value is AggApiError;
|
|
4169
4154
|
|
|
4170
4155
|
type CandleInterval = "1m" | "5m" | "1h" | "1d";
|
|
4171
4156
|
/** Universal OHLCV candle. Chart-library-agnostic. */
|
|
@@ -4233,4 +4218,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
|
|
|
4233
4218
|
|
|
4234
4219
|
declare function createAggClient(options: AggClientOptions): AggClient;
|
|
4235
4220
|
|
|
4236
|
-
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 ExecutionDisplayGroupStatus, type ExecutionDisplayStepKind, 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,
|
|
4221
|
+
export { ACTIVE_VENUES, type Account, AccountProvider, AccountType, AggApiError, type AggApiErrorInit, type AggApiFieldError, 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 ExecutionDisplayGroupStatus, type ExecutionDisplayStepKind, 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, 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 VenueGeoPolicyEntry, type VenueGeoPolicyResponse, 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, isAggApiError, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, isVenueActive, isVenueDataVisible, isVenueInactive, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
|
package/dist/index.js
CHANGED
|
@@ -72,6 +72,7 @@ __export(index_exports, {
|
|
|
72
72
|
ACTIVE_VENUES: () => ACTIVE_VENUES,
|
|
73
73
|
AccountProvider: () => AccountProvider,
|
|
74
74
|
AccountType: () => AccountType,
|
|
75
|
+
AggApiError: () => AggApiError,
|
|
75
76
|
AggClient: () => AggClient,
|
|
76
77
|
AggWebSocket: () => AggWebSocket,
|
|
77
78
|
CONFIRMED_MATCH_STATUSES: () => CONFIRMED_MATCH_STATUSES,
|
|
@@ -104,6 +105,7 @@ __export(index_exports, {
|
|
|
104
105
|
getEffectiveDisabledVenues: () => getEffectiveDisabledVenues,
|
|
105
106
|
getWalletAddressFromUserProfile: () => getWalletAddressFromUserProfile,
|
|
106
107
|
hasShape: () => hasShape,
|
|
108
|
+
isAggApiError: () => isAggApiError,
|
|
107
109
|
isEmail: () => isEmail,
|
|
108
110
|
isEnum: () => isEnum,
|
|
109
111
|
isFiniteNonNeg: () => isFiniteNonNeg,
|
|
@@ -708,6 +710,29 @@ function buildVenueUrl(venue, opts) {
|
|
|
708
710
|
}
|
|
709
711
|
}
|
|
710
712
|
|
|
713
|
+
// src/errors.ts
|
|
714
|
+
var TurnstileChallengeError = class extends Error {
|
|
715
|
+
constructor(siteKey) {
|
|
716
|
+
super("Bot protection challenge required. Render Turnstile widget and retry.");
|
|
717
|
+
this.name = "TurnstileChallengeError";
|
|
718
|
+
this.siteKey = siteKey;
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
var AggApiError = class _AggApiError extends Error {
|
|
722
|
+
constructor(message, status, init = {}) {
|
|
723
|
+
super(message);
|
|
724
|
+
this.name = "AggApiError";
|
|
725
|
+
this.status = status;
|
|
726
|
+
if (init.code !== void 0) this.code = init.code;
|
|
727
|
+
if (init.retryable !== void 0) this.retryable = init.retryable;
|
|
728
|
+
if (init.errors !== void 0) this.errors = init.errors;
|
|
729
|
+
Object.setPrototypeOf(this, _AggApiError.prototype);
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
function isAggApiError(value) {
|
|
733
|
+
return value instanceof AggApiError;
|
|
734
|
+
}
|
|
735
|
+
|
|
711
736
|
// src/orderbook-utils.ts
|
|
712
737
|
var PRICE_KEY_SCALE = 1e9;
|
|
713
738
|
function crc32(str) {
|
|
@@ -1941,12 +1966,7 @@ var AggClient = class {
|
|
|
1941
1966
|
}
|
|
1942
1967
|
} catch (e) {
|
|
1943
1968
|
}
|
|
1944
|
-
|
|
1945
|
-
error.status = response.status;
|
|
1946
|
-
if (code) error.code = code;
|
|
1947
|
-
if (retryable !== void 0) error.retryable = retryable;
|
|
1948
|
-
if (errors) error.errors = errors;
|
|
1949
|
-
throw error;
|
|
1969
|
+
throw new AggApiError(message, response.status, { code, retryable, errors });
|
|
1950
1970
|
});
|
|
1951
1971
|
}
|
|
1952
1972
|
/**
|
|
@@ -3002,15 +3022,6 @@ Issued At: ${issuedAt}`;
|
|
|
3002
3022
|
enableLogs: (_a = options == null ? void 0 : options.enableLogs) != null ? _a : false
|
|
3003
3023
|
});
|
|
3004
3024
|
}
|
|
3005
|
-
/** Request a quote for a managed trade. Returns quoteId (2-min TTL), execution steps, and splits. */
|
|
3006
|
-
quoteManaged(params) {
|
|
3007
|
-
return __async(this, null, function* () {
|
|
3008
|
-
return this.request("/execution/quote", {
|
|
3009
|
-
method: "POST",
|
|
3010
|
-
body: JSON.stringify(params)
|
|
3011
|
-
});
|
|
3012
|
-
});
|
|
3013
|
-
}
|
|
3014
3025
|
/** Execute a previously quoted managed trade. Returns pending order IDs. */
|
|
3015
3026
|
executeManaged(params) {
|
|
3016
3027
|
return __async(this, null, function* () {
|
|
@@ -3206,15 +3217,6 @@ var RECURRENCE_CADENCES = [
|
|
|
3206
3217
|
"P1Y"
|
|
3207
3218
|
];
|
|
3208
3219
|
|
|
3209
|
-
// src/errors.ts
|
|
3210
|
-
var TurnstileChallengeError = class extends Error {
|
|
3211
|
-
constructor(siteKey) {
|
|
3212
|
-
super("Bot protection challenge required. Render Turnstile widget and retry.");
|
|
3213
|
-
this.name = "TurnstileChallengeError";
|
|
3214
|
-
this.siteKey = siteKey;
|
|
3215
|
-
}
|
|
3216
|
-
};
|
|
3217
|
-
|
|
3218
3220
|
// src/candle-builder.ts
|
|
3219
3221
|
var INTERVAL_SECS = {
|
|
3220
3222
|
"1m": 60,
|
|
@@ -3408,6 +3410,7 @@ function createAggClient(options) {
|
|
|
3408
3410
|
ACTIVE_VENUES,
|
|
3409
3411
|
AccountProvider,
|
|
3410
3412
|
AccountType,
|
|
3413
|
+
AggApiError,
|
|
3411
3414
|
AggClient,
|
|
3412
3415
|
AggWebSocket,
|
|
3413
3416
|
CONFIRMED_MATCH_STATUSES,
|
|
@@ -3440,6 +3443,7 @@ function createAggClient(options) {
|
|
|
3440
3443
|
getEffectiveDisabledVenues,
|
|
3441
3444
|
getWalletAddressFromUserProfile,
|
|
3442
3445
|
hasShape,
|
|
3446
|
+
isAggApiError,
|
|
3443
3447
|
isEmail,
|
|
3444
3448
|
isEnum,
|
|
3445
3449
|
isFiniteNonNeg,
|
package/dist/index.mjs
CHANGED
|
@@ -589,6 +589,29 @@ function buildVenueUrl(venue, opts) {
|
|
|
589
589
|
}
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
+
// src/errors.ts
|
|
593
|
+
var TurnstileChallengeError = class extends Error {
|
|
594
|
+
constructor(siteKey) {
|
|
595
|
+
super("Bot protection challenge required. Render Turnstile widget and retry.");
|
|
596
|
+
this.name = "TurnstileChallengeError";
|
|
597
|
+
this.siteKey = siteKey;
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
var AggApiError = class _AggApiError extends Error {
|
|
601
|
+
constructor(message, status, init = {}) {
|
|
602
|
+
super(message);
|
|
603
|
+
this.name = "AggApiError";
|
|
604
|
+
this.status = status;
|
|
605
|
+
if (init.code !== void 0) this.code = init.code;
|
|
606
|
+
if (init.retryable !== void 0) this.retryable = init.retryable;
|
|
607
|
+
if (init.errors !== void 0) this.errors = init.errors;
|
|
608
|
+
Object.setPrototypeOf(this, _AggApiError.prototype);
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
function isAggApiError(value) {
|
|
612
|
+
return value instanceof AggApiError;
|
|
613
|
+
}
|
|
614
|
+
|
|
592
615
|
// src/orderbook-utils.ts
|
|
593
616
|
var PRICE_KEY_SCALE = 1e9;
|
|
594
617
|
function crc32(str) {
|
|
@@ -1822,12 +1845,7 @@ var AggClient = class {
|
|
|
1822
1845
|
}
|
|
1823
1846
|
} catch (e) {
|
|
1824
1847
|
}
|
|
1825
|
-
|
|
1826
|
-
error.status = response.status;
|
|
1827
|
-
if (code) error.code = code;
|
|
1828
|
-
if (retryable !== void 0) error.retryable = retryable;
|
|
1829
|
-
if (errors) error.errors = errors;
|
|
1830
|
-
throw error;
|
|
1848
|
+
throw new AggApiError(message, response.status, { code, retryable, errors });
|
|
1831
1849
|
});
|
|
1832
1850
|
}
|
|
1833
1851
|
/**
|
|
@@ -2883,15 +2901,6 @@ Issued At: ${issuedAt}`;
|
|
|
2883
2901
|
enableLogs: (_a = options == null ? void 0 : options.enableLogs) != null ? _a : false
|
|
2884
2902
|
});
|
|
2885
2903
|
}
|
|
2886
|
-
/** Request a quote for a managed trade. Returns quoteId (2-min TTL), execution steps, and splits. */
|
|
2887
|
-
quoteManaged(params) {
|
|
2888
|
-
return __async(this, null, function* () {
|
|
2889
|
-
return this.request("/execution/quote", {
|
|
2890
|
-
method: "POST",
|
|
2891
|
-
body: JSON.stringify(params)
|
|
2892
|
-
});
|
|
2893
|
-
});
|
|
2894
|
-
}
|
|
2895
2904
|
/** Execute a previously quoted managed trade. Returns pending order IDs. */
|
|
2896
2905
|
executeManaged(params) {
|
|
2897
2906
|
return __async(this, null, function* () {
|
|
@@ -3087,15 +3096,6 @@ var RECURRENCE_CADENCES = [
|
|
|
3087
3096
|
"P1Y"
|
|
3088
3097
|
];
|
|
3089
3098
|
|
|
3090
|
-
// src/errors.ts
|
|
3091
|
-
var TurnstileChallengeError = class extends Error {
|
|
3092
|
-
constructor(siteKey) {
|
|
3093
|
-
super("Bot protection challenge required. Render Turnstile widget and retry.");
|
|
3094
|
-
this.name = "TurnstileChallengeError";
|
|
3095
|
-
this.siteKey = siteKey;
|
|
3096
|
-
}
|
|
3097
|
-
};
|
|
3098
|
-
|
|
3099
3099
|
// src/candle-builder.ts
|
|
3100
3100
|
var INTERVAL_SECS = {
|
|
3101
3101
|
"1m": 60,
|
|
@@ -3288,6 +3288,7 @@ export {
|
|
|
3288
3288
|
ACTIVE_VENUES,
|
|
3289
3289
|
AccountProvider,
|
|
3290
3290
|
AccountType,
|
|
3291
|
+
AggApiError,
|
|
3291
3292
|
AggClient,
|
|
3292
3293
|
AggWebSocket,
|
|
3293
3294
|
CONFIRMED_MATCH_STATUSES,
|
|
@@ -3320,6 +3321,7 @@ export {
|
|
|
3320
3321
|
getEffectiveDisabledVenues,
|
|
3321
3322
|
getWalletAddressFromUserProfile,
|
|
3322
3323
|
hasShape,
|
|
3324
|
+
isAggApiError,
|
|
3323
3325
|
isEmail,
|
|
3324
3326
|
isEnum,
|
|
3325
3327
|
isFiniteNonNeg,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agg-build/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
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",
|
|
@@ -61,12 +61,6 @@
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
-
"dependencies": {
|
|
65
|
-
"@polymarket/builder-signing-sdk": "^1.0.0",
|
|
66
|
-
"@polymarket/clob-client": "^5.8.1",
|
|
67
|
-
"ethers": "^5.7.2",
|
|
68
|
-
"viem": "^2.46.2"
|
|
69
|
-
},
|
|
70
64
|
"publishConfig": {
|
|
71
65
|
"access": "public"
|
|
72
66
|
},
|