@agg-build/sdk 2.1.3 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +83 -10
- package/dist/index.d.ts +83 -10
- package/dist/index.js +17 -2
- package/dist/index.mjs +17 -2
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -586,7 +586,8 @@ type VenueMarket = {
|
|
|
586
586
|
question: string;
|
|
587
587
|
venueMarketOutcomes: {
|
|
588
588
|
id: string;
|
|
589
|
-
|
|
589
|
+
/** REMOVED — no longer returned; use GET /midpoints for live prices. */
|
|
590
|
+
price?: number | undefined;
|
|
590
591
|
venueMarketId: string;
|
|
591
592
|
label: string;
|
|
592
593
|
title?: string | null | undefined;
|
|
@@ -640,7 +641,8 @@ type VenueMarket = {
|
|
|
640
641
|
conditionId?: string | null | undefined;
|
|
641
642
|
venueMarketOutcomes?: {
|
|
642
643
|
id: string;
|
|
643
|
-
|
|
644
|
+
/** REMOVED — no longer returned; use GET /midpoints for live prices. */
|
|
645
|
+
price?: number | undefined;
|
|
644
646
|
venueMarketId: string;
|
|
645
647
|
label: string;
|
|
646
648
|
winner?: boolean | null | undefined;
|
|
@@ -812,7 +814,12 @@ type MatchedVenueMarketOutcomeRef = {
|
|
|
812
814
|
};
|
|
813
815
|
type VenueMarketOutcome = {
|
|
814
816
|
id: string;
|
|
815
|
-
|
|
817
|
+
/**
|
|
818
|
+
* REMOVED — /venue-events and /venue-markets no longer return outcome
|
|
819
|
+
* prices. Fetch live prices from GET /midpoints (or the live-price hooks),
|
|
820
|
+
* keyed by this outcome's `id`.
|
|
821
|
+
*/
|
|
822
|
+
price?: number | undefined;
|
|
816
823
|
venueMarketId: string;
|
|
817
824
|
label: string;
|
|
818
825
|
title?: string | null | undefined;
|
|
@@ -864,6 +871,7 @@ type MidpointItem = {
|
|
|
864
871
|
timestamp: number | null;
|
|
865
872
|
outcomes: OutcomeMidpoint[];
|
|
866
873
|
matched: MatchedMidpoint[];
|
|
874
|
+
arbReturn?: number | null | undefined;
|
|
867
875
|
};
|
|
868
876
|
type ComputeSplitsRequest = {
|
|
869
877
|
side: TradeSide$1;
|
|
@@ -1321,13 +1329,21 @@ interface WsTrade {
|
|
|
1321
1329
|
type WsCandleInterval = "1m" | "5m" | "1h" | "1d";
|
|
1322
1330
|
interface WsSubscribed {
|
|
1323
1331
|
type: "subscribed";
|
|
1332
|
+
/** Confirmed ids. For `orderbook`/`trades` these are venueMarketOutcomeIds.
|
|
1333
|
+
* For `arb` this historically mirrors the marketIds — prefer `marketIds`. */
|
|
1324
1334
|
outcomeIds: string[];
|
|
1325
|
-
|
|
1335
|
+
/** Confirmed marketIds — only set on `arb` confirmations, whose
|
|
1336
|
+
* subscriptions are keyed by marketIds, not outcomeIds. */
|
|
1337
|
+
marketIds?: string[];
|
|
1338
|
+
channel: "orderbook" | "trades" | "arb" | "arb-feed";
|
|
1326
1339
|
}
|
|
1327
1340
|
interface WsUnsubscribed {
|
|
1328
1341
|
type: "unsubscribed";
|
|
1342
|
+
/** See {@link WsSubscribed.outcomeIds}. */
|
|
1329
1343
|
outcomeIds: string[];
|
|
1330
|
-
|
|
1344
|
+
/** Confirmed marketIds — only set on `arb` confirmations. */
|
|
1345
|
+
marketIds?: string[];
|
|
1346
|
+
channel: "orderbook" | "trades" | "arb" | "arb-feed";
|
|
1331
1347
|
}
|
|
1332
1348
|
interface WsConnected {
|
|
1333
1349
|
type: "connected";
|
|
@@ -1615,8 +1631,10 @@ declare function applyOrderbookDelta(state: OrderbookState, delta: WsOrderbookDe
|
|
|
1615
1631
|
/**
|
|
1616
1632
|
* Agg platform WebSocket client.
|
|
1617
1633
|
*
|
|
1618
|
-
* Single connection, refcounted subscriptions
|
|
1619
|
-
*
|
|
1634
|
+
* Single connection, refcounted subscriptions. Orderbook/trades subscriptions
|
|
1635
|
+
* are keyed by venueMarketOutcomeId (the `outcomes[].id` on REST market
|
|
1636
|
+
* responses — NOT a venueMarketId); arb subscriptions are keyed by marketId.
|
|
1637
|
+
* Maintains in-memory orderbook state per subscribed outcome id.
|
|
1620
1638
|
* All timestamps converted from server ms to seconds before invoking callbacks.
|
|
1621
1639
|
*
|
|
1622
1640
|
* Recovery: seq gap or checksum mismatch → resnapshot request.
|
|
@@ -1625,8 +1643,10 @@ declare function applyOrderbookDelta(state: OrderbookState, delta: WsOrderbookDe
|
|
|
1625
1643
|
*/
|
|
1626
1644
|
|
|
1627
1645
|
interface AggWebSocketCallbacks {
|
|
1628
|
-
|
|
1629
|
-
|
|
1646
|
+
/** Invoked with the venueMarketOutcomeId the snapshot belongs to. */
|
|
1647
|
+
onSnapshot?: (outcomeId: string, book: OrderbookState) => void;
|
|
1648
|
+
/** Invoked with the venueMarketOutcomeId the delta belongs to. */
|
|
1649
|
+
onDelta?: (outcomeId: string, book: OrderbookState) => void;
|
|
1630
1650
|
onTrade?: (trade: WsTrade) => void;
|
|
1631
1651
|
onHeartbeat?: (hb: WsHeartbeat) => void;
|
|
1632
1652
|
onSubscribed?: (msg: WsSubscribed) => void;
|
|
@@ -2295,6 +2315,7 @@ interface MidpointRow {
|
|
|
2295
2315
|
midpoint: number | null;
|
|
2296
2316
|
spread: number | null;
|
|
2297
2317
|
timestamp: number | null;
|
|
2318
|
+
arbReturn?: number | null;
|
|
2298
2319
|
/** Provenance of `midpoint`. */
|
|
2299
2320
|
markSource?: MarkSource;
|
|
2300
2321
|
/**
|
|
@@ -2303,6 +2324,10 @@ interface MidpointRow {
|
|
|
2303
2324
|
* without re-running the matching logic.
|
|
2304
2325
|
*/
|
|
2305
2326
|
siblingVenueMarketId?: string;
|
|
2327
|
+
/** Top-of-book buy-side price. Only present when `bestPrice=true`. */
|
|
2328
|
+
bestBid?: number | null;
|
|
2329
|
+
/** Top-of-book sell-side price. Only present when `bestPrice=true`. */
|
|
2330
|
+
bestAsk?: number | null;
|
|
2306
2331
|
}
|
|
2307
2332
|
/** Per-outcome midpoint from a live orderbook. */
|
|
2308
2333
|
interface OutcomeMidpointRow {
|
|
@@ -2311,12 +2336,39 @@ interface OutcomeMidpointRow {
|
|
|
2311
2336
|
midpoint: number | null;
|
|
2312
2337
|
/** Provenance of `midpoint`. */
|
|
2313
2338
|
markSource?: MarkSource;
|
|
2339
|
+
/** Top-of-book buy-side price. Only present when `bestPrice=true`. */
|
|
2340
|
+
bestBid?: number | null;
|
|
2341
|
+
/** Top-of-book sell-side price. Only present when `bestPrice=true`. */
|
|
2342
|
+
bestAsk?: number | null;
|
|
2314
2343
|
}
|
|
2315
2344
|
/** Response from GET /midpoints (batch). */
|
|
2316
2345
|
interface BatchMidpointsResponse {
|
|
2317
2346
|
data: Array<MidpointRow & {
|
|
2318
2347
|
outcomes: OutcomeMidpointRow[];
|
|
2319
2348
|
matched: MidpointRow[];
|
|
2349
|
+
/**
|
|
2350
|
+
* Live, quality-gated cross-venue arbitrage return for this market's
|
|
2351
|
+
* cluster as a decimal fraction (`0.0085` = 0.85%), computed fresh by
|
|
2352
|
+
* the engine on this request. Prefer it over the `arbReturn` embedded
|
|
2353
|
+
* in venue-event listings, which a background sync can leave stale.
|
|
2354
|
+
* Only present when the request set `bestPrice=true`.
|
|
2355
|
+
*/
|
|
2356
|
+
arbReturn?: number | null;
|
|
2357
|
+
/**
|
|
2358
|
+
* DB status of the requested market. Present whenever the id resolves
|
|
2359
|
+
* to a known market. Resolved markets never serve a price (see `error`).
|
|
2360
|
+
*/
|
|
2361
|
+
marketStatus?: MarketStatus;
|
|
2362
|
+
/**
|
|
2363
|
+
* Structured refusal, mirroring GET /orderbooks per-item errors:
|
|
2364
|
+
* `market_resolved` for settled markets (prices are nulled instead of
|
|
2365
|
+
* serving a stale mark), `market_not_found` for unknown ids.
|
|
2366
|
+
*/
|
|
2367
|
+
error?: {
|
|
2368
|
+
code: "market_resolved" | "market_not_found";
|
|
2369
|
+
message: string;
|
|
2370
|
+
retryable: boolean;
|
|
2371
|
+
};
|
|
2320
2372
|
}>;
|
|
2321
2373
|
}
|
|
2322
2374
|
/** Response from GET /orderbook/outcome/:id (single outcome). */
|
|
@@ -2471,6 +2523,8 @@ interface ExecuteManagedResponse {
|
|
|
2471
2523
|
quoteId: string;
|
|
2472
2524
|
orderIds: string[];
|
|
2473
2525
|
status: "pending";
|
|
2526
|
+
redeemId?: string;
|
|
2527
|
+
message?: string;
|
|
2474
2528
|
}
|
|
2475
2529
|
interface ValidateManagedParams {
|
|
2476
2530
|
venueMarketOutcomeIds: string[];
|
|
@@ -3175,6 +3229,24 @@ interface SmartRouteFeeBreakdown {
|
|
|
3175
3229
|
appFeeCategory?: string;
|
|
3176
3230
|
}
|
|
3177
3231
|
/** Response from GET /orderbook/:venueMarketOutcomeId/route. */
|
|
3232
|
+
interface SmartRouteSettlementLeg {
|
|
3233
|
+
action: "redeem";
|
|
3234
|
+
venue: string;
|
|
3235
|
+
venueMarketId: string;
|
|
3236
|
+
venueMarketOutcomeId: string;
|
|
3237
|
+
positionId: string;
|
|
3238
|
+
size: string;
|
|
3239
|
+
redeemPath: "evm" | "svm";
|
|
3240
|
+
}
|
|
3241
|
+
interface SmartRouteSettlementPlan {
|
|
3242
|
+
redeemId: string;
|
|
3243
|
+
status: "redeem_only" | "partial_redeem";
|
|
3244
|
+
message: string;
|
|
3245
|
+
totalRedeemableShares: number;
|
|
3246
|
+
totalRedeemShares: number;
|
|
3247
|
+
totalSellShares: number;
|
|
3248
|
+
redeemLegs: SmartRouteSettlementLeg[];
|
|
3249
|
+
}
|
|
3178
3250
|
interface SmartRouteResponse {
|
|
3179
3251
|
quoteId: string;
|
|
3180
3252
|
venueMarketOutcomeId: string;
|
|
@@ -3199,6 +3271,7 @@ interface SmartRouteResponse {
|
|
|
3199
3271
|
}>;
|
|
3200
3272
|
error?: string;
|
|
3201
3273
|
message?: string;
|
|
3274
|
+
settlementPlan?: SmartRouteSettlementPlan;
|
|
3202
3275
|
warnings?: Array<{
|
|
3203
3276
|
venue: string;
|
|
3204
3277
|
venueMarketOutcomeId: string;
|
|
@@ -3999,4 +4072,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
|
|
|
3999
4072
|
|
|
4000
4073
|
declare function createAggClient(options: AggClientOptions): AggClient;
|
|
4001
4074
|
|
|
4002
|
-
export { 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 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, ImageSize, type ListRecurringCryptoMarketsOptions, type ManagedBalancesParams, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedMidpointOutcome, type MatchedOrderbookMarket, type MatchedVenueMarketOutcomeRef, type MatchingReport, 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 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 SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SimpleOrderbookLevel, type SmartRouteAllocation, type SmartRouteBridgeStep, type SmartRouteFeeBreakdown, type SmartRouteFill, type SmartRouteParams, type SmartRouteResponse, 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, getWalletAddressFromUserProfile, hasShape, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
|
|
4075
|
+
export { 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 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, ImageSize, type ListRecurringCryptoMarketsOptions, type ManagedBalancesParams, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedMidpointOutcome, type MatchedOrderbookMarket, type MatchedVenueMarketOutcomeRef, type MatchingReport, 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 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 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, getWalletAddressFromUserProfile, hasShape, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
|
package/dist/index.d.ts
CHANGED
|
@@ -586,7 +586,8 @@ type VenueMarket = {
|
|
|
586
586
|
question: string;
|
|
587
587
|
venueMarketOutcomes: {
|
|
588
588
|
id: string;
|
|
589
|
-
|
|
589
|
+
/** REMOVED — no longer returned; use GET /midpoints for live prices. */
|
|
590
|
+
price?: number | undefined;
|
|
590
591
|
venueMarketId: string;
|
|
591
592
|
label: string;
|
|
592
593
|
title?: string | null | undefined;
|
|
@@ -640,7 +641,8 @@ type VenueMarket = {
|
|
|
640
641
|
conditionId?: string | null | undefined;
|
|
641
642
|
venueMarketOutcomes?: {
|
|
642
643
|
id: string;
|
|
643
|
-
|
|
644
|
+
/** REMOVED — no longer returned; use GET /midpoints for live prices. */
|
|
645
|
+
price?: number | undefined;
|
|
644
646
|
venueMarketId: string;
|
|
645
647
|
label: string;
|
|
646
648
|
winner?: boolean | null | undefined;
|
|
@@ -812,7 +814,12 @@ type MatchedVenueMarketOutcomeRef = {
|
|
|
812
814
|
};
|
|
813
815
|
type VenueMarketOutcome = {
|
|
814
816
|
id: string;
|
|
815
|
-
|
|
817
|
+
/**
|
|
818
|
+
* REMOVED — /venue-events and /venue-markets no longer return outcome
|
|
819
|
+
* prices. Fetch live prices from GET /midpoints (or the live-price hooks),
|
|
820
|
+
* keyed by this outcome's `id`.
|
|
821
|
+
*/
|
|
822
|
+
price?: number | undefined;
|
|
816
823
|
venueMarketId: string;
|
|
817
824
|
label: string;
|
|
818
825
|
title?: string | null | undefined;
|
|
@@ -864,6 +871,7 @@ type MidpointItem = {
|
|
|
864
871
|
timestamp: number | null;
|
|
865
872
|
outcomes: OutcomeMidpoint[];
|
|
866
873
|
matched: MatchedMidpoint[];
|
|
874
|
+
arbReturn?: number | null | undefined;
|
|
867
875
|
};
|
|
868
876
|
type ComputeSplitsRequest = {
|
|
869
877
|
side: TradeSide$1;
|
|
@@ -1321,13 +1329,21 @@ interface WsTrade {
|
|
|
1321
1329
|
type WsCandleInterval = "1m" | "5m" | "1h" | "1d";
|
|
1322
1330
|
interface WsSubscribed {
|
|
1323
1331
|
type: "subscribed";
|
|
1332
|
+
/** Confirmed ids. For `orderbook`/`trades` these are venueMarketOutcomeIds.
|
|
1333
|
+
* For `arb` this historically mirrors the marketIds — prefer `marketIds`. */
|
|
1324
1334
|
outcomeIds: string[];
|
|
1325
|
-
|
|
1335
|
+
/** Confirmed marketIds — only set on `arb` confirmations, whose
|
|
1336
|
+
* subscriptions are keyed by marketIds, not outcomeIds. */
|
|
1337
|
+
marketIds?: string[];
|
|
1338
|
+
channel: "orderbook" | "trades" | "arb" | "arb-feed";
|
|
1326
1339
|
}
|
|
1327
1340
|
interface WsUnsubscribed {
|
|
1328
1341
|
type: "unsubscribed";
|
|
1342
|
+
/** See {@link WsSubscribed.outcomeIds}. */
|
|
1329
1343
|
outcomeIds: string[];
|
|
1330
|
-
|
|
1344
|
+
/** Confirmed marketIds — only set on `arb` confirmations. */
|
|
1345
|
+
marketIds?: string[];
|
|
1346
|
+
channel: "orderbook" | "trades" | "arb" | "arb-feed";
|
|
1331
1347
|
}
|
|
1332
1348
|
interface WsConnected {
|
|
1333
1349
|
type: "connected";
|
|
@@ -1615,8 +1631,10 @@ declare function applyOrderbookDelta(state: OrderbookState, delta: WsOrderbookDe
|
|
|
1615
1631
|
/**
|
|
1616
1632
|
* Agg platform WebSocket client.
|
|
1617
1633
|
*
|
|
1618
|
-
* Single connection, refcounted subscriptions
|
|
1619
|
-
*
|
|
1634
|
+
* Single connection, refcounted subscriptions. Orderbook/trades subscriptions
|
|
1635
|
+
* are keyed by venueMarketOutcomeId (the `outcomes[].id` on REST market
|
|
1636
|
+
* responses — NOT a venueMarketId); arb subscriptions are keyed by marketId.
|
|
1637
|
+
* Maintains in-memory orderbook state per subscribed outcome id.
|
|
1620
1638
|
* All timestamps converted from server ms to seconds before invoking callbacks.
|
|
1621
1639
|
*
|
|
1622
1640
|
* Recovery: seq gap or checksum mismatch → resnapshot request.
|
|
@@ -1625,8 +1643,10 @@ declare function applyOrderbookDelta(state: OrderbookState, delta: WsOrderbookDe
|
|
|
1625
1643
|
*/
|
|
1626
1644
|
|
|
1627
1645
|
interface AggWebSocketCallbacks {
|
|
1628
|
-
|
|
1629
|
-
|
|
1646
|
+
/** Invoked with the venueMarketOutcomeId the snapshot belongs to. */
|
|
1647
|
+
onSnapshot?: (outcomeId: string, book: OrderbookState) => void;
|
|
1648
|
+
/** Invoked with the venueMarketOutcomeId the delta belongs to. */
|
|
1649
|
+
onDelta?: (outcomeId: string, book: OrderbookState) => void;
|
|
1630
1650
|
onTrade?: (trade: WsTrade) => void;
|
|
1631
1651
|
onHeartbeat?: (hb: WsHeartbeat) => void;
|
|
1632
1652
|
onSubscribed?: (msg: WsSubscribed) => void;
|
|
@@ -2295,6 +2315,7 @@ interface MidpointRow {
|
|
|
2295
2315
|
midpoint: number | null;
|
|
2296
2316
|
spread: number | null;
|
|
2297
2317
|
timestamp: number | null;
|
|
2318
|
+
arbReturn?: number | null;
|
|
2298
2319
|
/** Provenance of `midpoint`. */
|
|
2299
2320
|
markSource?: MarkSource;
|
|
2300
2321
|
/**
|
|
@@ -2303,6 +2324,10 @@ interface MidpointRow {
|
|
|
2303
2324
|
* without re-running the matching logic.
|
|
2304
2325
|
*/
|
|
2305
2326
|
siblingVenueMarketId?: string;
|
|
2327
|
+
/** Top-of-book buy-side price. Only present when `bestPrice=true`. */
|
|
2328
|
+
bestBid?: number | null;
|
|
2329
|
+
/** Top-of-book sell-side price. Only present when `bestPrice=true`. */
|
|
2330
|
+
bestAsk?: number | null;
|
|
2306
2331
|
}
|
|
2307
2332
|
/** Per-outcome midpoint from a live orderbook. */
|
|
2308
2333
|
interface OutcomeMidpointRow {
|
|
@@ -2311,12 +2336,39 @@ interface OutcomeMidpointRow {
|
|
|
2311
2336
|
midpoint: number | null;
|
|
2312
2337
|
/** Provenance of `midpoint`. */
|
|
2313
2338
|
markSource?: MarkSource;
|
|
2339
|
+
/** Top-of-book buy-side price. Only present when `bestPrice=true`. */
|
|
2340
|
+
bestBid?: number | null;
|
|
2341
|
+
/** Top-of-book sell-side price. Only present when `bestPrice=true`. */
|
|
2342
|
+
bestAsk?: number | null;
|
|
2314
2343
|
}
|
|
2315
2344
|
/** Response from GET /midpoints (batch). */
|
|
2316
2345
|
interface BatchMidpointsResponse {
|
|
2317
2346
|
data: Array<MidpointRow & {
|
|
2318
2347
|
outcomes: OutcomeMidpointRow[];
|
|
2319
2348
|
matched: MidpointRow[];
|
|
2349
|
+
/**
|
|
2350
|
+
* Live, quality-gated cross-venue arbitrage return for this market's
|
|
2351
|
+
* cluster as a decimal fraction (`0.0085` = 0.85%), computed fresh by
|
|
2352
|
+
* the engine on this request. Prefer it over the `arbReturn` embedded
|
|
2353
|
+
* in venue-event listings, which a background sync can leave stale.
|
|
2354
|
+
* Only present when the request set `bestPrice=true`.
|
|
2355
|
+
*/
|
|
2356
|
+
arbReturn?: number | null;
|
|
2357
|
+
/**
|
|
2358
|
+
* DB status of the requested market. Present whenever the id resolves
|
|
2359
|
+
* to a known market. Resolved markets never serve a price (see `error`).
|
|
2360
|
+
*/
|
|
2361
|
+
marketStatus?: MarketStatus;
|
|
2362
|
+
/**
|
|
2363
|
+
* Structured refusal, mirroring GET /orderbooks per-item errors:
|
|
2364
|
+
* `market_resolved` for settled markets (prices are nulled instead of
|
|
2365
|
+
* serving a stale mark), `market_not_found` for unknown ids.
|
|
2366
|
+
*/
|
|
2367
|
+
error?: {
|
|
2368
|
+
code: "market_resolved" | "market_not_found";
|
|
2369
|
+
message: string;
|
|
2370
|
+
retryable: boolean;
|
|
2371
|
+
};
|
|
2320
2372
|
}>;
|
|
2321
2373
|
}
|
|
2322
2374
|
/** Response from GET /orderbook/outcome/:id (single outcome). */
|
|
@@ -2471,6 +2523,8 @@ interface ExecuteManagedResponse {
|
|
|
2471
2523
|
quoteId: string;
|
|
2472
2524
|
orderIds: string[];
|
|
2473
2525
|
status: "pending";
|
|
2526
|
+
redeemId?: string;
|
|
2527
|
+
message?: string;
|
|
2474
2528
|
}
|
|
2475
2529
|
interface ValidateManagedParams {
|
|
2476
2530
|
venueMarketOutcomeIds: string[];
|
|
@@ -3175,6 +3229,24 @@ interface SmartRouteFeeBreakdown {
|
|
|
3175
3229
|
appFeeCategory?: string;
|
|
3176
3230
|
}
|
|
3177
3231
|
/** Response from GET /orderbook/:venueMarketOutcomeId/route. */
|
|
3232
|
+
interface SmartRouteSettlementLeg {
|
|
3233
|
+
action: "redeem";
|
|
3234
|
+
venue: string;
|
|
3235
|
+
venueMarketId: string;
|
|
3236
|
+
venueMarketOutcomeId: string;
|
|
3237
|
+
positionId: string;
|
|
3238
|
+
size: string;
|
|
3239
|
+
redeemPath: "evm" | "svm";
|
|
3240
|
+
}
|
|
3241
|
+
interface SmartRouteSettlementPlan {
|
|
3242
|
+
redeemId: string;
|
|
3243
|
+
status: "redeem_only" | "partial_redeem";
|
|
3244
|
+
message: string;
|
|
3245
|
+
totalRedeemableShares: number;
|
|
3246
|
+
totalRedeemShares: number;
|
|
3247
|
+
totalSellShares: number;
|
|
3248
|
+
redeemLegs: SmartRouteSettlementLeg[];
|
|
3249
|
+
}
|
|
3178
3250
|
interface SmartRouteResponse {
|
|
3179
3251
|
quoteId: string;
|
|
3180
3252
|
venueMarketOutcomeId: string;
|
|
@@ -3199,6 +3271,7 @@ interface SmartRouteResponse {
|
|
|
3199
3271
|
}>;
|
|
3200
3272
|
error?: string;
|
|
3201
3273
|
message?: string;
|
|
3274
|
+
settlementPlan?: SmartRouteSettlementPlan;
|
|
3202
3275
|
warnings?: Array<{
|
|
3203
3276
|
venue: string;
|
|
3204
3277
|
venueMarketOutcomeId: string;
|
|
@@ -3999,4 +4072,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
|
|
|
3999
4072
|
|
|
4000
4073
|
declare function createAggClient(options: AggClientOptions): AggClient;
|
|
4001
4074
|
|
|
4002
|
-
export { 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 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, ImageSize, type ListRecurringCryptoMarketsOptions, type ManagedBalancesParams, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedMidpointOutcome, type MatchedOrderbookMarket, type MatchedVenueMarketOutcomeRef, type MatchingReport, 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 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 SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SimpleOrderbookLevel, type SmartRouteAllocation, type SmartRouteBridgeStep, type SmartRouteFeeBreakdown, type SmartRouteFill, type SmartRouteParams, type SmartRouteResponse, 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, getWalletAddressFromUserProfile, hasShape, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
|
|
4075
|
+
export { 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 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, ImageSize, type ListRecurringCryptoMarketsOptions, type ManagedBalancesParams, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedMidpointOutcome, type MatchedOrderbookMarket, type MatchedVenueMarketOutcomeRef, type MatchingReport, 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 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 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, getWalletAddressFromUserProfile, hasShape, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
|
package/dist/index.js
CHANGED
|
@@ -1593,7 +1593,7 @@ var AggWebSocket = class {
|
|
|
1593
1593
|
// src/client.ts
|
|
1594
1594
|
var COOKIE_REFRESH_DELIVERY = "cookie-refresh";
|
|
1595
1595
|
var DEFAULT_MIDPOINT_IDS_PER_REQUEST = 75;
|
|
1596
|
-
var MAX_MIDPOINT_IDS_PER_REQUEST =
|
|
1596
|
+
var MAX_MIDPOINT_IDS_PER_REQUEST = 75;
|
|
1597
1597
|
var isUserProfile = (user) => {
|
|
1598
1598
|
return "accounts" in user && "wallets" in user && "avatarUrl" in user;
|
|
1599
1599
|
};
|
|
@@ -1638,6 +1638,17 @@ var chunkArray = (items, size) => {
|
|
|
1638
1638
|
}
|
|
1639
1639
|
return chunks;
|
|
1640
1640
|
};
|
|
1641
|
+
var normalizeRequestedVenueMarketIds = (venueMarketIds) => {
|
|
1642
|
+
const normalizedIds = [];
|
|
1643
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
1644
|
+
for (const venueMarketId of venueMarketIds) {
|
|
1645
|
+
const normalizedVenueMarketId = venueMarketId.trim();
|
|
1646
|
+
if (!normalizedVenueMarketId || seenIds.has(normalizedVenueMarketId)) continue;
|
|
1647
|
+
seenIds.add(normalizedVenueMarketId);
|
|
1648
|
+
normalizedIds.push(normalizedVenueMarketId);
|
|
1649
|
+
}
|
|
1650
|
+
return normalizedIds;
|
|
1651
|
+
};
|
|
1641
1652
|
var mapChartResolution = (resolution) => {
|
|
1642
1653
|
switch (resolution) {
|
|
1643
1654
|
case void 0:
|
|
@@ -2811,7 +2822,8 @@ Issued At: ${issuedAt}`;
|
|
|
2811
2822
|
getMidpoints(paramsOrVenueMarketIds, options) {
|
|
2812
2823
|
return __async(this, null, function* () {
|
|
2813
2824
|
var _a;
|
|
2814
|
-
const
|
|
2825
|
+
const requestedVenueMarketIds = Array.isArray(paramsOrVenueMarketIds) ? paramsOrVenueMarketIds : paramsOrVenueMarketIds.venueMarketIds;
|
|
2826
|
+
const venueMarketIds = normalizeRequestedVenueMarketIds(requestedVenueMarketIds);
|
|
2815
2827
|
const bestPrice = !Array.isArray(paramsOrVenueMarketIds) ? paramsOrVenueMarketIds.bestPrice : options == null ? void 0 : options.bestPrice;
|
|
2816
2828
|
const maxMidpointIdsPerRequest = resolveMidpointIdsPerRequest(
|
|
2817
2829
|
(_a = options == null ? void 0 : options.maxMidpointIdsPerRequest) != null ? _a : Array.isArray(paramsOrVenueMarketIds) ? void 0 : paramsOrVenueMarketIds.maxMidpointIdsPerRequest
|
|
@@ -2824,6 +2836,9 @@ Issued At: ${issuedAt}`;
|
|
|
2824
2836
|
signal: options == null ? void 0 : options.signal
|
|
2825
2837
|
});
|
|
2826
2838
|
};
|
|
2839
|
+
if (venueMarketIds.length === 0) {
|
|
2840
|
+
return { data: [] };
|
|
2841
|
+
}
|
|
2827
2842
|
if (venueMarketIds.length <= maxMidpointIdsPerRequest) {
|
|
2828
2843
|
return requestBatch(venueMarketIds);
|
|
2829
2844
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1480,7 +1480,7 @@ var AggWebSocket = class {
|
|
|
1480
1480
|
// src/client.ts
|
|
1481
1481
|
var COOKIE_REFRESH_DELIVERY = "cookie-refresh";
|
|
1482
1482
|
var DEFAULT_MIDPOINT_IDS_PER_REQUEST = 75;
|
|
1483
|
-
var MAX_MIDPOINT_IDS_PER_REQUEST =
|
|
1483
|
+
var MAX_MIDPOINT_IDS_PER_REQUEST = 75;
|
|
1484
1484
|
var isUserProfile = (user) => {
|
|
1485
1485
|
return "accounts" in user && "wallets" in user && "avatarUrl" in user;
|
|
1486
1486
|
};
|
|
@@ -1525,6 +1525,17 @@ var chunkArray = (items, size) => {
|
|
|
1525
1525
|
}
|
|
1526
1526
|
return chunks;
|
|
1527
1527
|
};
|
|
1528
|
+
var normalizeRequestedVenueMarketIds = (venueMarketIds) => {
|
|
1529
|
+
const normalizedIds = [];
|
|
1530
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
1531
|
+
for (const venueMarketId of venueMarketIds) {
|
|
1532
|
+
const normalizedVenueMarketId = venueMarketId.trim();
|
|
1533
|
+
if (!normalizedVenueMarketId || seenIds.has(normalizedVenueMarketId)) continue;
|
|
1534
|
+
seenIds.add(normalizedVenueMarketId);
|
|
1535
|
+
normalizedIds.push(normalizedVenueMarketId);
|
|
1536
|
+
}
|
|
1537
|
+
return normalizedIds;
|
|
1538
|
+
};
|
|
1528
1539
|
var mapChartResolution = (resolution) => {
|
|
1529
1540
|
switch (resolution) {
|
|
1530
1541
|
case void 0:
|
|
@@ -2698,7 +2709,8 @@ Issued At: ${issuedAt}`;
|
|
|
2698
2709
|
getMidpoints(paramsOrVenueMarketIds, options) {
|
|
2699
2710
|
return __async(this, null, function* () {
|
|
2700
2711
|
var _a;
|
|
2701
|
-
const
|
|
2712
|
+
const requestedVenueMarketIds = Array.isArray(paramsOrVenueMarketIds) ? paramsOrVenueMarketIds : paramsOrVenueMarketIds.venueMarketIds;
|
|
2713
|
+
const venueMarketIds = normalizeRequestedVenueMarketIds(requestedVenueMarketIds);
|
|
2702
2714
|
const bestPrice = !Array.isArray(paramsOrVenueMarketIds) ? paramsOrVenueMarketIds.bestPrice : options == null ? void 0 : options.bestPrice;
|
|
2703
2715
|
const maxMidpointIdsPerRequest = resolveMidpointIdsPerRequest(
|
|
2704
2716
|
(_a = options == null ? void 0 : options.maxMidpointIdsPerRequest) != null ? _a : Array.isArray(paramsOrVenueMarketIds) ? void 0 : paramsOrVenueMarketIds.maxMidpointIdsPerRequest
|
|
@@ -2711,6 +2723,9 @@ Issued At: ${issuedAt}`;
|
|
|
2711
2723
|
signal: options == null ? void 0 : options.signal
|
|
2712
2724
|
});
|
|
2713
2725
|
};
|
|
2726
|
+
if (venueMarketIds.length === 0) {
|
|
2727
|
+
return { data: [] };
|
|
2728
|
+
}
|
|
2714
2729
|
if (venueMarketIds.length <= maxMidpointIdsPerRequest) {
|
|
2715
2730
|
return requestBatch(venueMarketIds);
|
|
2716
2731
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agg-build/sdk",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Vanilla TypeScript client for the AGG prediction market aggregator (auth, markets, orderbooks, charts, trading, managed execution, WebSockets). Works in browsers, Node.js, and React Native.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@polymarket/builder-signing-sdk": "^0.0
|
|
66
|
-
"@polymarket/clob-client": "^5.
|
|
65
|
+
"@polymarket/builder-signing-sdk": "^1.0.0",
|
|
66
|
+
"@polymarket/clob-client": "^5.8.1",
|
|
67
67
|
"ethers": "^5.7.2",
|
|
68
68
|
"viem": "^2.46.2"
|
|
69
69
|
},
|