@agg-build/sdk 4.8.0 → 4.9.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 +67 -32
- package/dist/index.d.ts +67 -32
- package/dist/index.js +35 -12
- package/dist/index.mjs +35 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -23,37 +23,14 @@ declare const VENUE_CHAIN_IDS: Partial<Record<Venue, number>>;
|
|
|
23
23
|
* Re-activating a venue is therefore an intentional code change here rather
|
|
24
24
|
* than a runtime configuration toggle.
|
|
25
25
|
*/
|
|
26
|
-
declare const ACTIVE_VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.probable, Venue.myriad, Venue.hyperliquid, Venue.novig];
|
|
26
|
+
declare const ACTIVE_VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.probable, Venue.myriad, Venue.hyperliquid, Venue.novig, Venue.prophetx];
|
|
27
27
|
/**
|
|
28
|
-
* Venues excluded from new user-facing activity.
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* - `prophetx` — NOT YET LAUNCHED, and SANDBOX-ONLY: production `/auth/login`
|
|
33
|
-
* rejects our credentials, so every ProphetX row is sandbox data. It now has
|
|
34
|
-
* a live orderbook feed and a live aggKey extractor, so it DOES join
|
|
35
|
-
* cross-venue clusters and can reach `VenueEvent.arbReturn`, which is public
|
|
36
|
-
* and sortable. Membership here is therefore load-bearing rather than
|
|
37
|
-
* cosmetic, and it must not reach end users until real credentials exist.
|
|
38
|
-
* `PROPHET_X_DATA_VISIBLE=true` un-hides it on staging for API verification
|
|
39
|
-
* (see `dataVisibleVenues` in `@app/runtime-config`).
|
|
40
|
-
*
|
|
41
|
-
* NOTE this set only applies where there is NO app context. An App row is
|
|
42
|
-
* authoritative, and its `disabledVenues` is stamped from this constant at
|
|
43
|
-
* CREATE time only — an app created before a venue joined this list keeps a
|
|
44
|
-
* list without it, and no restart repairs that (bootstrap deliberately does
|
|
45
|
-
* not clobber an existing row). Adding a venue here needs a one-time
|
|
46
|
-
* `UPDATE "App" SET "disabledVenues" = array_append(...)` to match.
|
|
47
|
-
*
|
|
48
|
-
* Membership here does NOT stop ingestion: the Rust engine gates discovery on
|
|
49
|
-
* credentials, so Novig data keeps flowing into `VenueEvent`/`VenueMarket` and
|
|
50
|
-
* keeps being matched. This set governs the API read layer and execution only.
|
|
51
|
-
*
|
|
52
|
-
* Global activity is separate from partner access: Novig remains in
|
|
53
|
-
* DEFAULT_DISABLED_VENUES and is enabled only by a super-admin removing it
|
|
54
|
-
* from one App.disabledVenues list.
|
|
28
|
+
* Venues excluded from new user-facing activity. The set is currently empty:
|
|
29
|
+
* ProphetX has discovery, live books, and a sandbox clearinghouse execution
|
|
30
|
+
* provider. Partner rollout is controlled separately through
|
|
31
|
+
* DEFAULT_DISABLED_VENUES and App.disabledVenues.
|
|
55
32
|
*/
|
|
56
|
-
declare const INACTIVE_VENUES: readonly [
|
|
33
|
+
declare const INACTIVE_VENUES: readonly [];
|
|
57
34
|
/** Whether a venue may participate in new user-facing activity. */
|
|
58
35
|
declare function isVenueActive(venue: string): boolean;
|
|
59
36
|
/** Whether a venue is intentionally retained only for wind-down/history flows. */
|
|
@@ -535,6 +512,21 @@ type UnifiedBalanceResponse = {
|
|
|
535
512
|
portfolioValueCents?: number | undefined;
|
|
536
513
|
updatedAt: string;
|
|
537
514
|
}[];
|
|
515
|
+
/**
|
|
516
|
+
* Paper-account summary. Present only when the request resolved to paper
|
|
517
|
+
* mode; absent in a live response. Mirrors `UnifiedBalanceResponseSchemaTB`
|
|
518
|
+
* in `typebox/schemas/trading.ts` — keep the two in sync. All dollars.
|
|
519
|
+
*/
|
|
520
|
+
paper?: {
|
|
521
|
+
startingBalance: number;
|
|
522
|
+
cashBalance: number;
|
|
523
|
+
positionsValue: number;
|
|
524
|
+
/** Banked P&L from closed trades — account-level, not summable from positions. */
|
|
525
|
+
realizedPnl: number;
|
|
526
|
+
unrealizedPnl: number;
|
|
527
|
+
/** realized + unrealized. */
|
|
528
|
+
earnings: number;
|
|
529
|
+
};
|
|
538
530
|
};
|
|
539
531
|
type UserHolding = {
|
|
540
532
|
venue: Venue;
|
|
@@ -2021,11 +2013,24 @@ declare class AggWebSocket {
|
|
|
2021
2013
|
private isOrderbookDebugEnabled;
|
|
2022
2014
|
}
|
|
2023
2015
|
|
|
2016
|
+
/** App-level paper/live mode. An app is one or the other, never both. */
|
|
2017
|
+
type AppTradingMode = "live" | "paper";
|
|
2024
2018
|
interface AppClientConfigResponse {
|
|
2025
2019
|
disabledVenues: Venue[];
|
|
2026
2020
|
disabledCategoryPresets: string[];
|
|
2027
2021
|
earlyAccessEnabled: boolean;
|
|
2028
2022
|
authOptions: AppClientAuthOption[];
|
|
2023
|
+
/**
|
|
2024
|
+
* Server-owned execution mode. Prefer this over any locally-configured
|
|
2025
|
+
* `trading.executionMode` — the API enforces it regardless of what the
|
|
2026
|
+
* client sends, and end users cannot change it.
|
|
2027
|
+
*/
|
|
2028
|
+
tradingMode: AppTradingMode;
|
|
2029
|
+
/**
|
|
2030
|
+
* One-time simulated balance granted on first paper use, in dollars.
|
|
2031
|
+
* Interpolate this into paper copy rather than hardcoding a figure.
|
|
2032
|
+
*/
|
|
2033
|
+
paperStartingBalance: number;
|
|
2029
2034
|
}
|
|
2030
2035
|
interface VenueGeoPolicyEntry {
|
|
2031
2036
|
venue: Venue;
|
|
@@ -3640,6 +3645,9 @@ interface SmartRouteVenueFill {
|
|
|
3640
3645
|
noPrice: number;
|
|
3641
3646
|
fills: SmartRouteFill[];
|
|
3642
3647
|
venueQty: number;
|
|
3648
|
+
/** Inclusive fee/reserve funding budget. For fee display, use the route's
|
|
3649
|
+
* feeBreakdown.venueFees and executionReserve instead. */
|
|
3650
|
+
venueFee?: number;
|
|
3643
3651
|
}
|
|
3644
3652
|
interface SmartRouteAllocation {
|
|
3645
3653
|
sourceChainId: string;
|
|
@@ -3669,6 +3677,13 @@ interface VenueSoloQuote {
|
|
|
3669
3677
|
/** Why this venue cannot execute when quoteId is null (or execution is geo-gated). */
|
|
3670
3678
|
unavailableReason?: string;
|
|
3671
3679
|
venue: string;
|
|
3680
|
+
/**
|
|
3681
|
+
* The outcome this solo is bound to. `venue` alone is NOT unique — one venue
|
|
3682
|
+
* can list the same matched outcome more than once (e.g. two Hyperliquid
|
|
3683
|
+
* deployers listing the same game), producing two solo cards with the same
|
|
3684
|
+
* `venue`. Key on this alongside `venue` when identifying a card.
|
|
3685
|
+
*/
|
|
3686
|
+
venueMarketOutcomeId?: string;
|
|
3672
3687
|
avgPrice: number | null;
|
|
3673
3688
|
filledQty: number;
|
|
3674
3689
|
rawExecCost: number;
|
|
@@ -3767,6 +3782,10 @@ interface SmartRouteSetupCostLine {
|
|
|
3767
3782
|
interface SmartRouteFeeBreakdown {
|
|
3768
3783
|
rawExecCost: number;
|
|
3769
3784
|
venueFees: number;
|
|
3785
|
+
/** Additional CH funding reserve for slippage or possible venue charges.
|
|
3786
|
+
* Excluded from venueFees and totalCost; included in funding allocations.
|
|
3787
|
+
* Only the unused portion is released after execution. */
|
|
3788
|
+
executionReserve?: number;
|
|
3770
3789
|
bridgeFees: number;
|
|
3771
3790
|
executionGas: number;
|
|
3772
3791
|
totalCost: number;
|
|
@@ -3906,6 +3925,12 @@ interface RedeemLegResult {
|
|
|
3906
3925
|
}
|
|
3907
3926
|
interface RedeemRequest {
|
|
3908
3927
|
venueMarketOutcomeIds: string[];
|
|
3928
|
+
/**
|
|
3929
|
+
* Trading mode. Defaults to live, matching the other execution methods.
|
|
3930
|
+
* Honoured on a live app; ignored on a paper app, which has no real-money
|
|
3931
|
+
* path and always settles on paper.
|
|
3932
|
+
*/
|
|
3933
|
+
mode?: ExecutionMode;
|
|
3909
3934
|
}
|
|
3910
3935
|
interface RedeemResponse {
|
|
3911
3936
|
redeemId: string;
|
|
@@ -4178,7 +4203,7 @@ type UserAuthResult = {
|
|
|
4178
4203
|
user: UserProfile;
|
|
4179
4204
|
};
|
|
4180
4205
|
declare class AggClient {
|
|
4181
|
-
private
|
|
4206
|
+
private _appId?;
|
|
4182
4207
|
private adminKey?;
|
|
4183
4208
|
private apiKey?;
|
|
4184
4209
|
private baseUrl;
|
|
@@ -4236,6 +4261,12 @@ declare class AggClient {
|
|
|
4236
4261
|
/** Clear the user access token, refresh token, and user info. Broadcasts cross-tab logout. */
|
|
4237
4262
|
clearAccessToken(): void;
|
|
4238
4263
|
private broadcastAuth;
|
|
4264
|
+
/**
|
|
4265
|
+
* The App this client speaks for, or `undefined` for an admin-key-only
|
|
4266
|
+
* client. Exposed so callers can scope per-app caches by it — app config is
|
|
4267
|
+
* app-scoped data, and two clients sharing one cache must not share entries.
|
|
4268
|
+
*/
|
|
4269
|
+
get appId(): string | undefined;
|
|
4239
4270
|
/** Current auth lifecycle status. */
|
|
4240
4271
|
get authStatus(): AuthStatus;
|
|
4241
4272
|
/** Whether a user access token is currently set. */
|
|
@@ -4670,7 +4701,11 @@ declare class AggClient {
|
|
|
4670
4701
|
getRampQuotes(params: RampQuoteRequest): Promise<RampQuote[]>;
|
|
4671
4702
|
/** Create a ramp widget session for checkout. */
|
|
4672
4703
|
createRampSession(params: RampSessionRequest): Promise<RampWidgetSession>;
|
|
4673
|
-
/**
|
|
4704
|
+
/** Authoritative shared Novig/ProphetX KYC status for the current managed wallet. */
|
|
4705
|
+
getSharedKycStatus(): Promise<{
|
|
4706
|
+
verified: boolean;
|
|
4707
|
+
}>;
|
|
4708
|
+
/** Start shared KYC; already-verified wallets need no redirect. Kalshi v2 is not applicable. */
|
|
4674
4709
|
initiateKyc(venue: string, redirectUri: string): Promise<{
|
|
4675
4710
|
status: string;
|
|
4676
4711
|
kycUrl?: string;
|
|
@@ -4801,4 +4836,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
|
|
|
4801
4836
|
|
|
4802
4837
|
declare function createAggClient(options: AggClientOptions): AggClient;
|
|
4803
4838
|
|
|
4804
|
-
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 AggClientOptions, type AggClientSessionInput, type AggLinkAccountBody, type AggLinkAccountConfirmResult, type AggLinkAccountResult, type AggLinkAccountWalletConfirmBody, 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, DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW, DEFAULT_BALANCE_REFILL_MAX_FEE_RAW, 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, LIMIT_PRICE_RAW_SCALE, type LimitOrderTimeInForce, type LimitPriceSide, type LimitPriceTickAdjustment, type ListRecurringCryptoMarketsOptions, type ManagedBalancesParams, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedMidpointOutcome, type MatchedOrderbookMarket, type MatchedVenueMarketOutcomeRef, type MidpointItem, type MidpointRow, type NewsFeedArticleFeedItem, type NewsFeedArticleFeedResponse, type NewsFeedArticleWithSummary, type NewsFeedLinkedMarket, type NewsFeedListResponse, type NewsFeedMarketFeedArticle, type NewsFeedMarketFeedItem, type NewsFeedMarketFeedResponse, type NewsFeedMarketNewsParams, type NewsFeedMarketNewsResponse, type NewsFeedMarketNewsResult, type NewsFeedPageOptions, type NewsFeedStatusResponse, type NonceResponse, type OrderListItem, type OrderListQuery, OrderStatus, OrderType, type Orderbook, type OrderbookBatchItemError, type OrderbookBatchItemErrorCode, type OrderbookBatchItemStatus, type OrderbookHistoryPoint, type OrderbookHistoryResponse, type OrderbookLevel, type OrderbookQuoteFill, type OrderbookQuoteParams, type OrderbookQuoteResponse, type OrderbookServiceUnavailableError, type OrderbookState, type OrderbooksOnlyError, type OutcomeMidpoint, type OutcomeMidpointRow, type OutcomeOrderbookResponse, type PaginatedResponse, type PaperTradingAccount, type PaperTradingAccountsPage, type PaperTradingAppOptions, type PaperTradingBalanceAdjustment, type PaperTradingBalanceResponse, type PaperTradingLiquidityStatus, type PaperTradingListParams, type PaperTradingMarkSource, type PaperTradingOrder, type PaperTradingOrdersPage, type PaperTradingPortfolio, type PaperTradingPosition, type PaperTradingPositionsPage, type PersistedAuthSnapshot, type PlaceLimitOrderParams, type PlaceLimitOrderResponse, type PlacePaperTradingOrderParams, type PositionGroup, type PositionRedeemStatus, type PricePoint, type PriceSource, type PricesHistoryResponse, type QuoteError, type QuoteErrorCode, 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, SELF_CUSTODY_FILL_TIMEOUT_MS, SELF_CUSTODY_POLL_INTERVAL_MS, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, type ServerWallet, type SetPaperTradingBalanceParams, type SettlementDiff, type SettlementDifference, type SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SignatureRequest, type SignatureRequestType, type SignerFn, 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 SportsGameStatus, type SportsLiveParticipant, type SportsLiveResponse, type SportsLiveState, type SyncBalancesResponse, TERMINAL_EXECUTION_STATES, 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, VENUE_CHAIN_IDS, 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, adjustLimitPriceRawToTick, aggregateMidpoint, applyOrderbookDelta, buildVenueUrl, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getBalanceRefillMaximumRaw, getEffectiveDisabledVenues, getWalletAddressFromUserProfile, hasShape, isAggApiError, isBalanceRefillWithinDailyCap, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, isVenueActive, isVenueDataVisible, isVenueInactive, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues, toChecksumAddress };
|
|
4839
|
+
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 AggClientOptions, type AggClientSessionInput, type AggLinkAccountBody, type AggLinkAccountConfirmResult, type AggLinkAccountResult, type AggLinkAccountWalletConfirmBody, type AggSessionUser, AggWebSocket, type AggWebSocketCallbacks, type AggWebSocketOptions, type AggregatedOrderbookLevel, type AggregatedOrderbookResponse, type App, type AppClientConfigResponse, type AppTradingMode, 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, DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW, DEFAULT_BALANCE_REFILL_MAX_FEE_RAW, 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, LIMIT_PRICE_RAW_SCALE, type LimitOrderTimeInForce, type LimitPriceSide, type LimitPriceTickAdjustment, type ListRecurringCryptoMarketsOptions, type ManagedBalancesParams, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedMidpointOutcome, type MatchedOrderbookMarket, type MatchedVenueMarketOutcomeRef, type MidpointItem, type MidpointRow, type NewsFeedArticleFeedItem, type NewsFeedArticleFeedResponse, type NewsFeedArticleWithSummary, type NewsFeedLinkedMarket, type NewsFeedListResponse, type NewsFeedMarketFeedArticle, type NewsFeedMarketFeedItem, type NewsFeedMarketFeedResponse, type NewsFeedMarketNewsParams, type NewsFeedMarketNewsResponse, type NewsFeedMarketNewsResult, type NewsFeedPageOptions, type NewsFeedStatusResponse, type NonceResponse, type OrderListItem, type OrderListQuery, OrderStatus, OrderType, type Orderbook, type OrderbookBatchItemError, type OrderbookBatchItemErrorCode, type OrderbookBatchItemStatus, type OrderbookHistoryPoint, type OrderbookHistoryResponse, type OrderbookLevel, type OrderbookQuoteFill, type OrderbookQuoteParams, type OrderbookQuoteResponse, type OrderbookServiceUnavailableError, type OrderbookState, type OrderbooksOnlyError, type OutcomeMidpoint, type OutcomeMidpointRow, type OutcomeOrderbookResponse, type PaginatedResponse, type PaperTradingAccount, type PaperTradingAccountsPage, type PaperTradingAppOptions, type PaperTradingBalanceAdjustment, type PaperTradingBalanceResponse, type PaperTradingLiquidityStatus, type PaperTradingListParams, type PaperTradingMarkSource, type PaperTradingOrder, type PaperTradingOrdersPage, type PaperTradingPortfolio, type PaperTradingPosition, type PaperTradingPositionsPage, type PersistedAuthSnapshot, type PlaceLimitOrderParams, type PlaceLimitOrderResponse, type PlacePaperTradingOrderParams, type PositionGroup, type PositionRedeemStatus, type PricePoint, type PriceSource, type PricesHistoryResponse, type QuoteError, type QuoteErrorCode, 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, SELF_CUSTODY_FILL_TIMEOUT_MS, SELF_CUSTODY_POLL_INTERVAL_MS, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, type ServerWallet, type SetPaperTradingBalanceParams, type SettlementDiff, type SettlementDifference, type SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SignatureRequest, type SignatureRequestType, type SignerFn, 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 SportsGameStatus, type SportsLiveParticipant, type SportsLiveResponse, type SportsLiveState, type SyncBalancesResponse, TERMINAL_EXECUTION_STATES, 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, VENUE_CHAIN_IDS, 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, adjustLimitPriceRawToTick, aggregateMidpoint, applyOrderbookDelta, buildVenueUrl, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getBalanceRefillMaximumRaw, getEffectiveDisabledVenues, getWalletAddressFromUserProfile, hasShape, isAggApiError, isBalanceRefillWithinDailyCap, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, isVenueActive, isVenueDataVisible, isVenueInactive, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues, toChecksumAddress };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,37 +23,14 @@ declare const VENUE_CHAIN_IDS: Partial<Record<Venue, number>>;
|
|
|
23
23
|
* Re-activating a venue is therefore an intentional code change here rather
|
|
24
24
|
* than a runtime configuration toggle.
|
|
25
25
|
*/
|
|
26
|
-
declare const ACTIVE_VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.probable, Venue.myriad, Venue.hyperliquid, Venue.novig];
|
|
26
|
+
declare const ACTIVE_VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.probable, Venue.myriad, Venue.hyperliquid, Venue.novig, Venue.prophetx];
|
|
27
27
|
/**
|
|
28
|
-
* Venues excluded from new user-facing activity.
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* - `prophetx` — NOT YET LAUNCHED, and SANDBOX-ONLY: production `/auth/login`
|
|
33
|
-
* rejects our credentials, so every ProphetX row is sandbox data. It now has
|
|
34
|
-
* a live orderbook feed and a live aggKey extractor, so it DOES join
|
|
35
|
-
* cross-venue clusters and can reach `VenueEvent.arbReturn`, which is public
|
|
36
|
-
* and sortable. Membership here is therefore load-bearing rather than
|
|
37
|
-
* cosmetic, and it must not reach end users until real credentials exist.
|
|
38
|
-
* `PROPHET_X_DATA_VISIBLE=true` un-hides it on staging for API verification
|
|
39
|
-
* (see `dataVisibleVenues` in `@app/runtime-config`).
|
|
40
|
-
*
|
|
41
|
-
* NOTE this set only applies where there is NO app context. An App row is
|
|
42
|
-
* authoritative, and its `disabledVenues` is stamped from this constant at
|
|
43
|
-
* CREATE time only — an app created before a venue joined this list keeps a
|
|
44
|
-
* list without it, and no restart repairs that (bootstrap deliberately does
|
|
45
|
-
* not clobber an existing row). Adding a venue here needs a one-time
|
|
46
|
-
* `UPDATE "App" SET "disabledVenues" = array_append(...)` to match.
|
|
47
|
-
*
|
|
48
|
-
* Membership here does NOT stop ingestion: the Rust engine gates discovery on
|
|
49
|
-
* credentials, so Novig data keeps flowing into `VenueEvent`/`VenueMarket` and
|
|
50
|
-
* keeps being matched. This set governs the API read layer and execution only.
|
|
51
|
-
*
|
|
52
|
-
* Global activity is separate from partner access: Novig remains in
|
|
53
|
-
* DEFAULT_DISABLED_VENUES and is enabled only by a super-admin removing it
|
|
54
|
-
* from one App.disabledVenues list.
|
|
28
|
+
* Venues excluded from new user-facing activity. The set is currently empty:
|
|
29
|
+
* ProphetX has discovery, live books, and a sandbox clearinghouse execution
|
|
30
|
+
* provider. Partner rollout is controlled separately through
|
|
31
|
+
* DEFAULT_DISABLED_VENUES and App.disabledVenues.
|
|
55
32
|
*/
|
|
56
|
-
declare const INACTIVE_VENUES: readonly [
|
|
33
|
+
declare const INACTIVE_VENUES: readonly [];
|
|
57
34
|
/** Whether a venue may participate in new user-facing activity. */
|
|
58
35
|
declare function isVenueActive(venue: string): boolean;
|
|
59
36
|
/** Whether a venue is intentionally retained only for wind-down/history flows. */
|
|
@@ -535,6 +512,21 @@ type UnifiedBalanceResponse = {
|
|
|
535
512
|
portfolioValueCents?: number | undefined;
|
|
536
513
|
updatedAt: string;
|
|
537
514
|
}[];
|
|
515
|
+
/**
|
|
516
|
+
* Paper-account summary. Present only when the request resolved to paper
|
|
517
|
+
* mode; absent in a live response. Mirrors `UnifiedBalanceResponseSchemaTB`
|
|
518
|
+
* in `typebox/schemas/trading.ts` — keep the two in sync. All dollars.
|
|
519
|
+
*/
|
|
520
|
+
paper?: {
|
|
521
|
+
startingBalance: number;
|
|
522
|
+
cashBalance: number;
|
|
523
|
+
positionsValue: number;
|
|
524
|
+
/** Banked P&L from closed trades — account-level, not summable from positions. */
|
|
525
|
+
realizedPnl: number;
|
|
526
|
+
unrealizedPnl: number;
|
|
527
|
+
/** realized + unrealized. */
|
|
528
|
+
earnings: number;
|
|
529
|
+
};
|
|
538
530
|
};
|
|
539
531
|
type UserHolding = {
|
|
540
532
|
venue: Venue;
|
|
@@ -2021,11 +2013,24 @@ declare class AggWebSocket {
|
|
|
2021
2013
|
private isOrderbookDebugEnabled;
|
|
2022
2014
|
}
|
|
2023
2015
|
|
|
2016
|
+
/** App-level paper/live mode. An app is one or the other, never both. */
|
|
2017
|
+
type AppTradingMode = "live" | "paper";
|
|
2024
2018
|
interface AppClientConfigResponse {
|
|
2025
2019
|
disabledVenues: Venue[];
|
|
2026
2020
|
disabledCategoryPresets: string[];
|
|
2027
2021
|
earlyAccessEnabled: boolean;
|
|
2028
2022
|
authOptions: AppClientAuthOption[];
|
|
2023
|
+
/**
|
|
2024
|
+
* Server-owned execution mode. Prefer this over any locally-configured
|
|
2025
|
+
* `trading.executionMode` — the API enforces it regardless of what the
|
|
2026
|
+
* client sends, and end users cannot change it.
|
|
2027
|
+
*/
|
|
2028
|
+
tradingMode: AppTradingMode;
|
|
2029
|
+
/**
|
|
2030
|
+
* One-time simulated balance granted on first paper use, in dollars.
|
|
2031
|
+
* Interpolate this into paper copy rather than hardcoding a figure.
|
|
2032
|
+
*/
|
|
2033
|
+
paperStartingBalance: number;
|
|
2029
2034
|
}
|
|
2030
2035
|
interface VenueGeoPolicyEntry {
|
|
2031
2036
|
venue: Venue;
|
|
@@ -3640,6 +3645,9 @@ interface SmartRouteVenueFill {
|
|
|
3640
3645
|
noPrice: number;
|
|
3641
3646
|
fills: SmartRouteFill[];
|
|
3642
3647
|
venueQty: number;
|
|
3648
|
+
/** Inclusive fee/reserve funding budget. For fee display, use the route's
|
|
3649
|
+
* feeBreakdown.venueFees and executionReserve instead. */
|
|
3650
|
+
venueFee?: number;
|
|
3643
3651
|
}
|
|
3644
3652
|
interface SmartRouteAllocation {
|
|
3645
3653
|
sourceChainId: string;
|
|
@@ -3669,6 +3677,13 @@ interface VenueSoloQuote {
|
|
|
3669
3677
|
/** Why this venue cannot execute when quoteId is null (or execution is geo-gated). */
|
|
3670
3678
|
unavailableReason?: string;
|
|
3671
3679
|
venue: string;
|
|
3680
|
+
/**
|
|
3681
|
+
* The outcome this solo is bound to. `venue` alone is NOT unique — one venue
|
|
3682
|
+
* can list the same matched outcome more than once (e.g. two Hyperliquid
|
|
3683
|
+
* deployers listing the same game), producing two solo cards with the same
|
|
3684
|
+
* `venue`. Key on this alongside `venue` when identifying a card.
|
|
3685
|
+
*/
|
|
3686
|
+
venueMarketOutcomeId?: string;
|
|
3672
3687
|
avgPrice: number | null;
|
|
3673
3688
|
filledQty: number;
|
|
3674
3689
|
rawExecCost: number;
|
|
@@ -3767,6 +3782,10 @@ interface SmartRouteSetupCostLine {
|
|
|
3767
3782
|
interface SmartRouteFeeBreakdown {
|
|
3768
3783
|
rawExecCost: number;
|
|
3769
3784
|
venueFees: number;
|
|
3785
|
+
/** Additional CH funding reserve for slippage or possible venue charges.
|
|
3786
|
+
* Excluded from venueFees and totalCost; included in funding allocations.
|
|
3787
|
+
* Only the unused portion is released after execution. */
|
|
3788
|
+
executionReserve?: number;
|
|
3770
3789
|
bridgeFees: number;
|
|
3771
3790
|
executionGas: number;
|
|
3772
3791
|
totalCost: number;
|
|
@@ -3906,6 +3925,12 @@ interface RedeemLegResult {
|
|
|
3906
3925
|
}
|
|
3907
3926
|
interface RedeemRequest {
|
|
3908
3927
|
venueMarketOutcomeIds: string[];
|
|
3928
|
+
/**
|
|
3929
|
+
* Trading mode. Defaults to live, matching the other execution methods.
|
|
3930
|
+
* Honoured on a live app; ignored on a paper app, which has no real-money
|
|
3931
|
+
* path and always settles on paper.
|
|
3932
|
+
*/
|
|
3933
|
+
mode?: ExecutionMode;
|
|
3909
3934
|
}
|
|
3910
3935
|
interface RedeemResponse {
|
|
3911
3936
|
redeemId: string;
|
|
@@ -4178,7 +4203,7 @@ type UserAuthResult = {
|
|
|
4178
4203
|
user: UserProfile;
|
|
4179
4204
|
};
|
|
4180
4205
|
declare class AggClient {
|
|
4181
|
-
private
|
|
4206
|
+
private _appId?;
|
|
4182
4207
|
private adminKey?;
|
|
4183
4208
|
private apiKey?;
|
|
4184
4209
|
private baseUrl;
|
|
@@ -4236,6 +4261,12 @@ declare class AggClient {
|
|
|
4236
4261
|
/** Clear the user access token, refresh token, and user info. Broadcasts cross-tab logout. */
|
|
4237
4262
|
clearAccessToken(): void;
|
|
4238
4263
|
private broadcastAuth;
|
|
4264
|
+
/**
|
|
4265
|
+
* The App this client speaks for, or `undefined` for an admin-key-only
|
|
4266
|
+
* client. Exposed so callers can scope per-app caches by it — app config is
|
|
4267
|
+
* app-scoped data, and two clients sharing one cache must not share entries.
|
|
4268
|
+
*/
|
|
4269
|
+
get appId(): string | undefined;
|
|
4239
4270
|
/** Current auth lifecycle status. */
|
|
4240
4271
|
get authStatus(): AuthStatus;
|
|
4241
4272
|
/** Whether a user access token is currently set. */
|
|
@@ -4670,7 +4701,11 @@ declare class AggClient {
|
|
|
4670
4701
|
getRampQuotes(params: RampQuoteRequest): Promise<RampQuote[]>;
|
|
4671
4702
|
/** Create a ramp widget session for checkout. */
|
|
4672
4703
|
createRampSession(params: RampSessionRequest): Promise<RampWidgetSession>;
|
|
4673
|
-
/**
|
|
4704
|
+
/** Authoritative shared Novig/ProphetX KYC status for the current managed wallet. */
|
|
4705
|
+
getSharedKycStatus(): Promise<{
|
|
4706
|
+
verified: boolean;
|
|
4707
|
+
}>;
|
|
4708
|
+
/** Start shared KYC; already-verified wallets need no redirect. Kalshi v2 is not applicable. */
|
|
4674
4709
|
initiateKyc(venue: string, redirectUri: string): Promise<{
|
|
4675
4710
|
status: string;
|
|
4676
4711
|
kycUrl?: string;
|
|
@@ -4801,4 +4836,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
|
|
|
4801
4836
|
|
|
4802
4837
|
declare function createAggClient(options: AggClientOptions): AggClient;
|
|
4803
4838
|
|
|
4804
|
-
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 AggClientOptions, type AggClientSessionInput, type AggLinkAccountBody, type AggLinkAccountConfirmResult, type AggLinkAccountResult, type AggLinkAccountWalletConfirmBody, 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, DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW, DEFAULT_BALANCE_REFILL_MAX_FEE_RAW, 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, LIMIT_PRICE_RAW_SCALE, type LimitOrderTimeInForce, type LimitPriceSide, type LimitPriceTickAdjustment, type ListRecurringCryptoMarketsOptions, type ManagedBalancesParams, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedMidpointOutcome, type MatchedOrderbookMarket, type MatchedVenueMarketOutcomeRef, type MidpointItem, type MidpointRow, type NewsFeedArticleFeedItem, type NewsFeedArticleFeedResponse, type NewsFeedArticleWithSummary, type NewsFeedLinkedMarket, type NewsFeedListResponse, type NewsFeedMarketFeedArticle, type NewsFeedMarketFeedItem, type NewsFeedMarketFeedResponse, type NewsFeedMarketNewsParams, type NewsFeedMarketNewsResponse, type NewsFeedMarketNewsResult, type NewsFeedPageOptions, type NewsFeedStatusResponse, type NonceResponse, type OrderListItem, type OrderListQuery, OrderStatus, OrderType, type Orderbook, type OrderbookBatchItemError, type OrderbookBatchItemErrorCode, type OrderbookBatchItemStatus, type OrderbookHistoryPoint, type OrderbookHistoryResponse, type OrderbookLevel, type OrderbookQuoteFill, type OrderbookQuoteParams, type OrderbookQuoteResponse, type OrderbookServiceUnavailableError, type OrderbookState, type OrderbooksOnlyError, type OutcomeMidpoint, type OutcomeMidpointRow, type OutcomeOrderbookResponse, type PaginatedResponse, type PaperTradingAccount, type PaperTradingAccountsPage, type PaperTradingAppOptions, type PaperTradingBalanceAdjustment, type PaperTradingBalanceResponse, type PaperTradingLiquidityStatus, type PaperTradingListParams, type PaperTradingMarkSource, type PaperTradingOrder, type PaperTradingOrdersPage, type PaperTradingPortfolio, type PaperTradingPosition, type PaperTradingPositionsPage, type PersistedAuthSnapshot, type PlaceLimitOrderParams, type PlaceLimitOrderResponse, type PlacePaperTradingOrderParams, type PositionGroup, type PositionRedeemStatus, type PricePoint, type PriceSource, type PricesHistoryResponse, type QuoteError, type QuoteErrorCode, 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, SELF_CUSTODY_FILL_TIMEOUT_MS, SELF_CUSTODY_POLL_INTERVAL_MS, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, type ServerWallet, type SetPaperTradingBalanceParams, type SettlementDiff, type SettlementDifference, type SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SignatureRequest, type SignatureRequestType, type SignerFn, 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 SportsGameStatus, type SportsLiveParticipant, type SportsLiveResponse, type SportsLiveState, type SyncBalancesResponse, TERMINAL_EXECUTION_STATES, 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, VENUE_CHAIN_IDS, 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, adjustLimitPriceRawToTick, aggregateMidpoint, applyOrderbookDelta, buildVenueUrl, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getBalanceRefillMaximumRaw, getEffectiveDisabledVenues, getWalletAddressFromUserProfile, hasShape, isAggApiError, isBalanceRefillWithinDailyCap, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, isVenueActive, isVenueDataVisible, isVenueInactive, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues, toChecksumAddress };
|
|
4839
|
+
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 AggClientOptions, type AggClientSessionInput, type AggLinkAccountBody, type AggLinkAccountConfirmResult, type AggLinkAccountResult, type AggLinkAccountWalletConfirmBody, type AggSessionUser, AggWebSocket, type AggWebSocketCallbacks, type AggWebSocketOptions, type AggregatedOrderbookLevel, type AggregatedOrderbookResponse, type App, type AppClientConfigResponse, type AppTradingMode, 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, DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW, DEFAULT_BALANCE_REFILL_MAX_FEE_RAW, 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, LIMIT_PRICE_RAW_SCALE, type LimitOrderTimeInForce, type LimitPriceSide, type LimitPriceTickAdjustment, type ListRecurringCryptoMarketsOptions, type ManagedBalancesParams, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedMidpointOutcome, type MatchedOrderbookMarket, type MatchedVenueMarketOutcomeRef, type MidpointItem, type MidpointRow, type NewsFeedArticleFeedItem, type NewsFeedArticleFeedResponse, type NewsFeedArticleWithSummary, type NewsFeedLinkedMarket, type NewsFeedListResponse, type NewsFeedMarketFeedArticle, type NewsFeedMarketFeedItem, type NewsFeedMarketFeedResponse, type NewsFeedMarketNewsParams, type NewsFeedMarketNewsResponse, type NewsFeedMarketNewsResult, type NewsFeedPageOptions, type NewsFeedStatusResponse, type NonceResponse, type OrderListItem, type OrderListQuery, OrderStatus, OrderType, type Orderbook, type OrderbookBatchItemError, type OrderbookBatchItemErrorCode, type OrderbookBatchItemStatus, type OrderbookHistoryPoint, type OrderbookHistoryResponse, type OrderbookLevel, type OrderbookQuoteFill, type OrderbookQuoteParams, type OrderbookQuoteResponse, type OrderbookServiceUnavailableError, type OrderbookState, type OrderbooksOnlyError, type OutcomeMidpoint, type OutcomeMidpointRow, type OutcomeOrderbookResponse, type PaginatedResponse, type PaperTradingAccount, type PaperTradingAccountsPage, type PaperTradingAppOptions, type PaperTradingBalanceAdjustment, type PaperTradingBalanceResponse, type PaperTradingLiquidityStatus, type PaperTradingListParams, type PaperTradingMarkSource, type PaperTradingOrder, type PaperTradingOrdersPage, type PaperTradingPortfolio, type PaperTradingPosition, type PaperTradingPositionsPage, type PersistedAuthSnapshot, type PlaceLimitOrderParams, type PlaceLimitOrderResponse, type PlacePaperTradingOrderParams, type PositionGroup, type PositionRedeemStatus, type PricePoint, type PriceSource, type PricesHistoryResponse, type QuoteError, type QuoteErrorCode, 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, SELF_CUSTODY_FILL_TIMEOUT_MS, SELF_CUSTODY_POLL_INTERVAL_MS, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, type ServerWallet, type SetPaperTradingBalanceParams, type SettlementDiff, type SettlementDifference, type SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SignatureRequest, type SignatureRequestType, type SignerFn, 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 SportsGameStatus, type SportsLiveParticipant, type SportsLiveResponse, type SportsLiveState, type SyncBalancesResponse, TERMINAL_EXECUTION_STATES, 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, VENUE_CHAIN_IDS, 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, adjustLimitPriceRawToTick, aggregateMidpoint, applyOrderbookDelta, buildVenueUrl, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getBalanceRefillMaximumRaw, getEffectiveDisabledVenues, getWalletAddressFromUserProfile, hasShape, isAggApiError, isBalanceRefillWithinDailyCap, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, isVenueActive, isVenueDataVisible, isVenueInactive, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues, toChecksumAddress };
|
package/dist/index.js
CHANGED
|
@@ -170,7 +170,8 @@ var VENUE_CHAIN_IDS = {
|
|
|
170
170
|
["predict" /* predict */]: 56,
|
|
171
171
|
["myriad" /* myriad */]: 56,
|
|
172
172
|
["hyperliquid" /* hyperliquid */]: 1337,
|
|
173
|
-
["novig" /* novig */]: 792703809
|
|
173
|
+
["novig" /* novig */]: 792703809,
|
|
174
|
+
["prophetx" /* prophetx */]: 792703809
|
|
174
175
|
};
|
|
175
176
|
var ACTIVE_VENUES = [
|
|
176
177
|
"kalshi" /* kalshi */,
|
|
@@ -181,9 +182,10 @@ var ACTIVE_VENUES = [
|
|
|
181
182
|
"probable" /* probable */,
|
|
182
183
|
"myriad" /* myriad */,
|
|
183
184
|
"hyperliquid" /* hyperliquid */,
|
|
184
|
-
"novig" /* novig
|
|
185
|
+
"novig" /* novig */,
|
|
186
|
+
"prophetx" /* prophetx */
|
|
185
187
|
];
|
|
186
|
-
var INACTIVE_VENUES = [
|
|
188
|
+
var INACTIVE_VENUES = [];
|
|
187
189
|
var DEFAULT_DISABLED_VENUES = ["novig" /* novig */, "prophetx" /* prophetx */];
|
|
188
190
|
var ACTIVE_VENUE_SET = new Set(ACTIVE_VENUES);
|
|
189
191
|
var INACTIVE_VENUE_SET = new Set(INACTIVE_VENUES);
|
|
@@ -1901,6 +1903,8 @@ var COOKIE_REFRESH_DELIVERY = "cookie-refresh";
|
|
|
1901
1903
|
var DEFAULT_MIDPOINT_IDS_PER_REQUEST = 75;
|
|
1902
1904
|
var MAX_MIDPOINT_IDS_PER_REQUEST = 75;
|
|
1903
1905
|
var MAX_SPORTS_EVENT_IDS_PER_REQUEST = 25;
|
|
1906
|
+
var MIN_POLL_INTERVAL_MS = 250;
|
|
1907
|
+
var MAX_POLL_INTERVAL_MS = 3e4;
|
|
1904
1908
|
var isUserProfile = (user) => {
|
|
1905
1909
|
return "accounts" in user && "wallets" in user && "avatarUrl" in user;
|
|
1906
1910
|
};
|
|
@@ -1988,21 +1992,21 @@ var AggClient = class {
|
|
|
1988
1992
|
if (!options.appId && !options.adminKey) {
|
|
1989
1993
|
throw new Error("AggClient requires at least one of appId or adminKey");
|
|
1990
1994
|
}
|
|
1991
|
-
this.
|
|
1995
|
+
this._appId = options.appId;
|
|
1992
1996
|
this.adminKey = options.adminKey;
|
|
1993
1997
|
this.apiKey = options.apiKey;
|
|
1994
1998
|
this.signer = options.signer;
|
|
1995
1999
|
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
1996
2000
|
this.wsUrl = options.wsUrl;
|
|
1997
2001
|
this.authOptions = options.auth;
|
|
1998
|
-
this.storageKey = `agg_auth_${(_a = this.
|
|
2002
|
+
this.storageKey = `agg_auth_${(_a = this._appId) != null ? _a : "default"}`;
|
|
1999
2003
|
this.authDelivery = (_b = options.authDelivery) != null ? _b : "body";
|
|
2000
2004
|
this.shouldPersistSession = options.persistSession !== false;
|
|
2001
2005
|
this.restoreSession();
|
|
2002
2006
|
this.initAuthChannel();
|
|
2003
2007
|
}
|
|
2004
2008
|
resolvePaperTradingAppId(appId) {
|
|
2005
|
-
const resolvedAppId = appId != null ? appId : this.
|
|
2009
|
+
const resolvedAppId = appId != null ? appId : this._appId;
|
|
2006
2010
|
if (!resolvedAppId) {
|
|
2007
2011
|
throw new Error(
|
|
2008
2012
|
"Paper trading account methods require appId in client options or method options"
|
|
@@ -2090,7 +2094,7 @@ var AggClient = class {
|
|
|
2090
2094
|
var _a;
|
|
2091
2095
|
if (typeof globalThis.BroadcastChannel === "undefined") return;
|
|
2092
2096
|
try {
|
|
2093
|
-
this.authChannel = new BroadcastChannel(`agg_auth_${(_a = this.
|
|
2097
|
+
this.authChannel = new BroadcastChannel(`agg_auth_${(_a = this._appId) != null ? _a : "default"}`);
|
|
2094
2098
|
this.authChannel.onmessage = (event) => {
|
|
2095
2099
|
var _a2;
|
|
2096
2100
|
const { type } = (_a2 = event.data) != null ? _a2 : {};
|
|
@@ -2151,8 +2155,8 @@ var AggClient = class {
|
|
|
2151
2155
|
rawFetch(path, init) {
|
|
2152
2156
|
return __async(this, null, function* () {
|
|
2153
2157
|
const headers = (init == null ? void 0 : init.body) != null ? { "Content-Type": "application/json" } : {};
|
|
2154
|
-
if (this.
|
|
2155
|
-
headers["x-app-id"] = this.
|
|
2158
|
+
if (this._appId) {
|
|
2159
|
+
headers["x-app-id"] = this._appId;
|
|
2156
2160
|
}
|
|
2157
2161
|
if (this.adminKey) {
|
|
2158
2162
|
headers["x-admin-key"] = this.adminKey;
|
|
@@ -2291,6 +2295,14 @@ var AggClient = class {
|
|
|
2291
2295
|
} catch (e) {
|
|
2292
2296
|
}
|
|
2293
2297
|
}
|
|
2298
|
+
/**
|
|
2299
|
+
* The App this client speaks for, or `undefined` for an admin-key-only
|
|
2300
|
+
* client. Exposed so callers can scope per-app caches by it — app config is
|
|
2301
|
+
* app-scoped data, and two clients sharing one cache must not share entries.
|
|
2302
|
+
*/
|
|
2303
|
+
get appId() {
|
|
2304
|
+
return this._appId;
|
|
2305
|
+
}
|
|
2294
2306
|
/** Current auth lifecycle status. */
|
|
2295
2307
|
get authStatus() {
|
|
2296
2308
|
return this._authStatus;
|
|
@@ -3303,7 +3315,7 @@ Issued At: ${issuedAt}`;
|
|
|
3303
3315
|
throw new Error("AggClient.createWebSocket() requires wsUrl to be set in client options");
|
|
3304
3316
|
}
|
|
3305
3317
|
const url = new URL(this.wsUrl);
|
|
3306
|
-
if (this.
|
|
3318
|
+
if (this._appId) url.searchParams.set("appId", this._appId);
|
|
3307
3319
|
return new AggWebSocket({
|
|
3308
3320
|
url: url.toString(),
|
|
3309
3321
|
callbacks,
|
|
@@ -3361,13 +3373,18 @@ Issued At: ${issuedAt}`;
|
|
|
3361
3373
|
let pending = (_a = first.pendingSignatures) != null ? _a : [];
|
|
3362
3374
|
let lastKey = "";
|
|
3363
3375
|
const deadline = Date.now() + SELF_CUSTODY_FILL_TIMEOUT_MS;
|
|
3376
|
+
let nextPollMs = MIN_POLL_INTERVAL_MS;
|
|
3364
3377
|
for (; ; ) {
|
|
3365
3378
|
if (Date.now() > deadline) {
|
|
3366
3379
|
throw new Error(`Fill for quote ${quoteId} did not finish within the timeout.`);
|
|
3367
3380
|
}
|
|
3368
3381
|
if (pending.length === 0) {
|
|
3369
|
-
yield new Promise((r) => setTimeout(r,
|
|
3382
|
+
yield new Promise((r) => setTimeout(r, nextPollMs));
|
|
3370
3383
|
const polled = yield this.getExecutionStatus({ quoteId });
|
|
3384
|
+
nextPollMs = Number.isFinite(polled.pollAfterMs) ? Math.min(
|
|
3385
|
+
Math.max(polled.pollAfterMs, MIN_POLL_INTERVAL_MS),
|
|
3386
|
+
MAX_POLL_INTERVAL_MS
|
|
3387
|
+
) : SELF_CUSTODY_POLL_INTERVAL_MS;
|
|
3371
3388
|
if (TERMINAL_EXECUTION_STATES.has(polled.overallState)) {
|
|
3372
3389
|
if (polled.overallState !== "filled" && polled.overallState !== "partially_filled") {
|
|
3373
3390
|
throw new Error(`Fill for quote ${quoteId} ended as ${polled.overallState}.`);
|
|
@@ -3575,7 +3592,13 @@ Issued At: ${issuedAt}`;
|
|
|
3575
3592
|
});
|
|
3576
3593
|
});
|
|
3577
3594
|
}
|
|
3578
|
-
/**
|
|
3595
|
+
/** Authoritative shared Novig/ProphetX KYC status for the current managed wallet. */
|
|
3596
|
+
getSharedKycStatus() {
|
|
3597
|
+
return __async(this, null, function* () {
|
|
3598
|
+
return this.request("/kyc/status");
|
|
3599
|
+
});
|
|
3600
|
+
}
|
|
3601
|
+
/** Start shared KYC; already-verified wallets need no redirect. Kalshi v2 is not applicable. */
|
|
3579
3602
|
initiateKyc(venue, redirectUri) {
|
|
3580
3603
|
return __async(this, null, function* () {
|
|
3581
3604
|
return this.request(`/kyc/${venue}`, {
|
package/dist/index.mjs
CHANGED
|
@@ -38,7 +38,8 @@ var VENUE_CHAIN_IDS = {
|
|
|
38
38
|
["predict" /* predict */]: 56,
|
|
39
39
|
["myriad" /* myriad */]: 56,
|
|
40
40
|
["hyperliquid" /* hyperliquid */]: 1337,
|
|
41
|
-
["novig" /* novig */]: 792703809
|
|
41
|
+
["novig" /* novig */]: 792703809,
|
|
42
|
+
["prophetx" /* prophetx */]: 792703809
|
|
42
43
|
};
|
|
43
44
|
var ACTIVE_VENUES = [
|
|
44
45
|
"kalshi" /* kalshi */,
|
|
@@ -49,9 +50,10 @@ var ACTIVE_VENUES = [
|
|
|
49
50
|
"probable" /* probable */,
|
|
50
51
|
"myriad" /* myriad */,
|
|
51
52
|
"hyperliquid" /* hyperliquid */,
|
|
52
|
-
"novig" /* novig
|
|
53
|
+
"novig" /* novig */,
|
|
54
|
+
"prophetx" /* prophetx */
|
|
53
55
|
];
|
|
54
|
-
var INACTIVE_VENUES = [
|
|
56
|
+
var INACTIVE_VENUES = [];
|
|
55
57
|
var DEFAULT_DISABLED_VENUES = ["novig" /* novig */, "prophetx" /* prophetx */];
|
|
56
58
|
var ACTIVE_VENUE_SET = new Set(ACTIVE_VENUES);
|
|
57
59
|
var INACTIVE_VENUE_SET = new Set(INACTIVE_VENUES);
|
|
@@ -1769,6 +1771,8 @@ var COOKIE_REFRESH_DELIVERY = "cookie-refresh";
|
|
|
1769
1771
|
var DEFAULT_MIDPOINT_IDS_PER_REQUEST = 75;
|
|
1770
1772
|
var MAX_MIDPOINT_IDS_PER_REQUEST = 75;
|
|
1771
1773
|
var MAX_SPORTS_EVENT_IDS_PER_REQUEST = 25;
|
|
1774
|
+
var MIN_POLL_INTERVAL_MS = 250;
|
|
1775
|
+
var MAX_POLL_INTERVAL_MS = 3e4;
|
|
1772
1776
|
var isUserProfile = (user) => {
|
|
1773
1777
|
return "accounts" in user && "wallets" in user && "avatarUrl" in user;
|
|
1774
1778
|
};
|
|
@@ -1856,21 +1860,21 @@ var AggClient = class {
|
|
|
1856
1860
|
if (!options.appId && !options.adminKey) {
|
|
1857
1861
|
throw new Error("AggClient requires at least one of appId or adminKey");
|
|
1858
1862
|
}
|
|
1859
|
-
this.
|
|
1863
|
+
this._appId = options.appId;
|
|
1860
1864
|
this.adminKey = options.adminKey;
|
|
1861
1865
|
this.apiKey = options.apiKey;
|
|
1862
1866
|
this.signer = options.signer;
|
|
1863
1867
|
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
1864
1868
|
this.wsUrl = options.wsUrl;
|
|
1865
1869
|
this.authOptions = options.auth;
|
|
1866
|
-
this.storageKey = `agg_auth_${(_a = this.
|
|
1870
|
+
this.storageKey = `agg_auth_${(_a = this._appId) != null ? _a : "default"}`;
|
|
1867
1871
|
this.authDelivery = (_b = options.authDelivery) != null ? _b : "body";
|
|
1868
1872
|
this.shouldPersistSession = options.persistSession !== false;
|
|
1869
1873
|
this.restoreSession();
|
|
1870
1874
|
this.initAuthChannel();
|
|
1871
1875
|
}
|
|
1872
1876
|
resolvePaperTradingAppId(appId) {
|
|
1873
|
-
const resolvedAppId = appId != null ? appId : this.
|
|
1877
|
+
const resolvedAppId = appId != null ? appId : this._appId;
|
|
1874
1878
|
if (!resolvedAppId) {
|
|
1875
1879
|
throw new Error(
|
|
1876
1880
|
"Paper trading account methods require appId in client options or method options"
|
|
@@ -1958,7 +1962,7 @@ var AggClient = class {
|
|
|
1958
1962
|
var _a;
|
|
1959
1963
|
if (typeof globalThis.BroadcastChannel === "undefined") return;
|
|
1960
1964
|
try {
|
|
1961
|
-
this.authChannel = new BroadcastChannel(`agg_auth_${(_a = this.
|
|
1965
|
+
this.authChannel = new BroadcastChannel(`agg_auth_${(_a = this._appId) != null ? _a : "default"}`);
|
|
1962
1966
|
this.authChannel.onmessage = (event) => {
|
|
1963
1967
|
var _a2;
|
|
1964
1968
|
const { type } = (_a2 = event.data) != null ? _a2 : {};
|
|
@@ -2019,8 +2023,8 @@ var AggClient = class {
|
|
|
2019
2023
|
rawFetch(path, init) {
|
|
2020
2024
|
return __async(this, null, function* () {
|
|
2021
2025
|
const headers = (init == null ? void 0 : init.body) != null ? { "Content-Type": "application/json" } : {};
|
|
2022
|
-
if (this.
|
|
2023
|
-
headers["x-app-id"] = this.
|
|
2026
|
+
if (this._appId) {
|
|
2027
|
+
headers["x-app-id"] = this._appId;
|
|
2024
2028
|
}
|
|
2025
2029
|
if (this.adminKey) {
|
|
2026
2030
|
headers["x-admin-key"] = this.adminKey;
|
|
@@ -2159,6 +2163,14 @@ var AggClient = class {
|
|
|
2159
2163
|
} catch (e) {
|
|
2160
2164
|
}
|
|
2161
2165
|
}
|
|
2166
|
+
/**
|
|
2167
|
+
* The App this client speaks for, or `undefined` for an admin-key-only
|
|
2168
|
+
* client. Exposed so callers can scope per-app caches by it — app config is
|
|
2169
|
+
* app-scoped data, and two clients sharing one cache must not share entries.
|
|
2170
|
+
*/
|
|
2171
|
+
get appId() {
|
|
2172
|
+
return this._appId;
|
|
2173
|
+
}
|
|
2162
2174
|
/** Current auth lifecycle status. */
|
|
2163
2175
|
get authStatus() {
|
|
2164
2176
|
return this._authStatus;
|
|
@@ -3171,7 +3183,7 @@ Issued At: ${issuedAt}`;
|
|
|
3171
3183
|
throw new Error("AggClient.createWebSocket() requires wsUrl to be set in client options");
|
|
3172
3184
|
}
|
|
3173
3185
|
const url = new URL(this.wsUrl);
|
|
3174
|
-
if (this.
|
|
3186
|
+
if (this._appId) url.searchParams.set("appId", this._appId);
|
|
3175
3187
|
return new AggWebSocket({
|
|
3176
3188
|
url: url.toString(),
|
|
3177
3189
|
callbacks,
|
|
@@ -3229,13 +3241,18 @@ Issued At: ${issuedAt}`;
|
|
|
3229
3241
|
let pending = (_a = first.pendingSignatures) != null ? _a : [];
|
|
3230
3242
|
let lastKey = "";
|
|
3231
3243
|
const deadline = Date.now() + SELF_CUSTODY_FILL_TIMEOUT_MS;
|
|
3244
|
+
let nextPollMs = MIN_POLL_INTERVAL_MS;
|
|
3232
3245
|
for (; ; ) {
|
|
3233
3246
|
if (Date.now() > deadline) {
|
|
3234
3247
|
throw new Error(`Fill for quote ${quoteId} did not finish within the timeout.`);
|
|
3235
3248
|
}
|
|
3236
3249
|
if (pending.length === 0) {
|
|
3237
|
-
yield new Promise((r) => setTimeout(r,
|
|
3250
|
+
yield new Promise((r) => setTimeout(r, nextPollMs));
|
|
3238
3251
|
const polled = yield this.getExecutionStatus({ quoteId });
|
|
3252
|
+
nextPollMs = Number.isFinite(polled.pollAfterMs) ? Math.min(
|
|
3253
|
+
Math.max(polled.pollAfterMs, MIN_POLL_INTERVAL_MS),
|
|
3254
|
+
MAX_POLL_INTERVAL_MS
|
|
3255
|
+
) : SELF_CUSTODY_POLL_INTERVAL_MS;
|
|
3239
3256
|
if (TERMINAL_EXECUTION_STATES.has(polled.overallState)) {
|
|
3240
3257
|
if (polled.overallState !== "filled" && polled.overallState !== "partially_filled") {
|
|
3241
3258
|
throw new Error(`Fill for quote ${quoteId} ended as ${polled.overallState}.`);
|
|
@@ -3443,7 +3460,13 @@ Issued At: ${issuedAt}`;
|
|
|
3443
3460
|
});
|
|
3444
3461
|
});
|
|
3445
3462
|
}
|
|
3446
|
-
/**
|
|
3463
|
+
/** Authoritative shared Novig/ProphetX KYC status for the current managed wallet. */
|
|
3464
|
+
getSharedKycStatus() {
|
|
3465
|
+
return __async(this, null, function* () {
|
|
3466
|
+
return this.request("/kyc/status");
|
|
3467
|
+
});
|
|
3468
|
+
}
|
|
3469
|
+
/** Start shared KYC; already-verified wallets need no redirect. Kalshi v2 is not applicable. */
|
|
3447
3470
|
initiateKyc(venue, redirectUri) {
|
|
3448
3471
|
return __async(this, null, function* () {
|
|
3449
3472
|
return this.request(`/kyc/${venue}`, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agg-build/sdk",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.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",
|