@agg-build/sdk 4.1.0 → 4.3.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.ts CHANGED
@@ -7,10 +7,13 @@ declare enum Venue {
7
7
  predict = "predict",
8
8
  probable = "probable",
9
9
  myriad = "myriad",
10
- hyperliquid = "hyperliquid"
10
+ hyperliquid = "hyperliquid",
11
+ novig = "novig"
11
12
  }
12
13
  /** Single source of truth for venue identifiers. */
13
- declare const VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.probable, Venue.myriad, Venue.hyperliquid];
14
+ declare const VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.probable, Venue.myriad, Venue.hyperliquid, Venue.novig];
15
+ /** Canonical destination chain for venues with on-chain funding or settlement. */
16
+ declare const VENUE_CHAIN_IDS: Partial<Record<Venue, number>>;
14
17
  /**
15
18
  * Venues that participate in new discovery, market-data, and execution flows.
16
19
  *
@@ -19,9 +22,32 @@ declare const VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless,
19
22
  * Re-activating a venue is therefore an intentional code change here rather
20
23
  * than a runtime configuration toggle.
21
24
  */
22
- declare const ACTIVE_VENUES: readonly [Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.probable, Venue.myriad, Venue.hyperliquid];
23
- /** Venues retained for historical/wind-down flows but unavailable for new activity. */
24
- declare const INACTIVE_VENUES: readonly [Venue.kalshi];
25
+ declare const ACTIVE_VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.probable, Venue.myriad, Venue.hyperliquid];
26
+ /**
27
+ * Venues excluded from new user-facing activity. Kalshi has left this set —
28
+ * it is fully active again (data + execution) — leaving Novig as the only
29
+ * member.
30
+ *
31
+ * - `novig` — NOT YET LAUNCHED. Discovery, matching and the orderbook feed are
32
+ * built and running, but there is no execution path, so it must not reach
33
+ * end users. Listing it here is what makes prod hide it by default while
34
+ * `NOVIG_DATA_VISIBLE=true` un-hides it on staging for API verification
35
+ * (see `dataVisibleVenues` in `@app/runtime-config`).
36
+ *
37
+ * Membership here does NOT stop ingestion: the Rust engine gates discovery on
38
+ * credentials, so Novig data keeps flowing into `VenueEvent`/`VenueMarket` and
39
+ * keeps being matched. This set governs the API read layer and execution only.
40
+ *
41
+ * Novig must NOT be added to `ACTIVE_VENUES` before it is in
42
+ * `SUPPORTED_FILL_VENUES` (`orderbook.service.ts`). Active now implies
43
+ * executable outright — `isVenueExecutable` and its override are gone, so
44
+ * `isVenueActive` is the only gate — and an active venue absent from that set
45
+ * passes every gate and is then silently dropped at fill time, producing an
46
+ * empty executionPlan and a false `quote_unfillable`. Kalshi satisfies the
47
+ * invariant: it was added to `SUPPORTED_FILL_VENUES` unconditionally in the
48
+ * same change that made it active.
49
+ */
50
+ declare const INACTIVE_VENUES: readonly [Venue.novig];
25
51
  /** Whether a venue may participate in new user-facing activity. */
26
52
  declare function isVenueActive(venue: string): boolean;
27
53
  /** Whether a venue is intentionally retained only for wind-down/history flows. */
@@ -538,9 +564,12 @@ type GetHoldingsQuery = {
538
564
  };
539
565
  type GetOrdersQuery = {
540
566
  status?: OrderStatus | undefined;
567
+ orderType?: "market" | "limit" | undefined;
541
568
  orderId?: string | undefined;
542
569
  /** Filter to all legs of one quote (multi-venue split routes). */
543
570
  quoteId?: string | undefined;
571
+ /** Filter to the order(s) carrying this partner trade id. */
572
+ externalId?: string | undefined;
544
573
  cursor?: string | undefined;
545
574
  limit?: number | undefined;
546
575
  };
@@ -558,6 +587,10 @@ type OrderListItem = {
558
587
  * standalone orders without a Quote row.
559
588
  */
560
589
  quoteId: string | null;
590
+ /** Partner-supplied trade id from POST /execution/orders. */
591
+ externalId: string | null;
592
+ /** Partner-supplied order id from POST /execution/limit-orders. */
593
+ clientOrderId: string | null;
561
594
  createdAt: Date;
562
595
  updatedAt: Date;
563
596
  venue: Venue;
@@ -1193,11 +1226,11 @@ interface TSchema extends TKind, SchemaOptions {
1193
1226
  * Always carry a human-readable `message` alongside; the code is additive and
1194
1227
  * may be absent on rejections that pre-date this addition.
1195
1228
  */
1196
- declare const QuoteErrorCodeTB: TUnion<[TLiteral<"quote_not_found">, TLiteral<"quote_expired">, TLiteral<"quote_already_executed">, TLiteral<"quote_cancelled">, TLiteral<"quote_user_mismatch">, TLiteral<"quote_app_blocked">, TLiteral<"quote_unfillable">, TLiteral<"quote_min_order_size">, TLiteral<"quote_stale_status">, TLiteral<"quote_stale_price">, TLiteral<"quote_insufficient_balance">, TLiteral<"quote_market_inactive">]>;
1229
+ declare const QuoteErrorCodeTB: TUnion<[TLiteral<"quote_not_found">, TLiteral<"quote_expired">, TLiteral<"quote_already_executed">, TLiteral<"quote_cancelled">, TLiteral<"quote_user_mismatch">, TLiteral<"quote_app_blocked">, TLiteral<"quote_unfillable">, TLiteral<"quote_min_order_size">, TLiteral<"quote_stale_status">, TLiteral<"quote_stale_price">, TLiteral<"quote_insufficient_balance">, TLiteral<"quote_market_inactive">, TLiteral<"venue_not_executable">, TLiteral<"outcome_ambiguous">]>;
1197
1230
  type QuoteErrorCode = Static<typeof QuoteErrorCodeTB>;
1198
1231
  declare const QuoteErrorTB: TObject<{
1199
1232
  message: TString;
1200
- code: TOptional<TUnion<[TLiteral<"quote_not_found">, TLiteral<"quote_expired">, TLiteral<"quote_already_executed">, TLiteral<"quote_cancelled">, TLiteral<"quote_user_mismatch">, TLiteral<"quote_app_blocked">, TLiteral<"quote_unfillable">, TLiteral<"quote_min_order_size">, TLiteral<"quote_stale_status">, TLiteral<"quote_stale_price">, TLiteral<"quote_insufficient_balance">, TLiteral<"quote_market_inactive">]>>;
1233
+ code: TOptional<TUnion<[TLiteral<"quote_not_found">, TLiteral<"quote_expired">, TLiteral<"quote_already_executed">, TLiteral<"quote_cancelled">, TLiteral<"quote_user_mismatch">, TLiteral<"quote_app_blocked">, TLiteral<"quote_unfillable">, TLiteral<"quote_min_order_size">, TLiteral<"quote_stale_status">, TLiteral<"quote_stale_price">, TLiteral<"quote_insufficient_balance">, TLiteral<"quote_market_inactive">, TLiteral<"venue_not_executable">, TLiteral<"outcome_ambiguous">]>>;
1201
1234
  }>;
1202
1235
  type QuoteError = Static<typeof QuoteErrorTB>;
1203
1236
 
@@ -1386,9 +1419,54 @@ interface BuildVenueUrlOpts {
1386
1419
  seriesExternalId?: string | null;
1387
1420
  /** VenueMarket.conditionId — used as a fallback for Polymarket when slug is missing. */
1388
1421
  conditionId?: string | null;
1422
+ /**
1423
+ * Novig outcome id — the per-side (Yes/No) id, e.g.
1424
+ * `DiscoveredOutcome.external_identifier` / `o.id` in
1425
+ * agg-venue-novig/src/convert.rs. NOT the same id as `eventExternalId`
1426
+ * (Novig's event id, `ev.id`) or a market id (`m.id`) — Novig's deeplink
1427
+ * template takes the outcome, one level more specific than either. Not
1428
+ * currently plumbed from any caller.
1429
+ */
1430
+ outcomeExternalId?: string | null;
1431
+ /**
1432
+ * Novig-issued partner id, required by Novig's deeplink URL structure for
1433
+ * attribution tracking (https://docs.novig.com/llms-full.txt,
1434
+ * "Deeplinking"). Not currently plumbed from any caller — no Novig case
1435
+ * builds a URL without it, so pass it explicitly once we have one.
1436
+ */
1437
+ partnerId?: string | null;
1438
+ /**
1439
+ * Which of Novig's two documented deeplink schemes to build — Novig's docs
1440
+ * say to detect the caller's platform via User-Agent and pick accordingly.
1441
+ * Defaults to `"web"`. Ignored by every other venue.
1442
+ */
1443
+ platform?: "web" | "native";
1389
1444
  }
1390
1445
  declare function buildVenueUrl(venue: string, opts: BuildVenueUrlOpts): string | null;
1391
1446
 
1447
+ declare const LIMIT_PRICE_RAW_SCALE: bigint;
1448
+ type LimitPriceSide = "buy" | "sell";
1449
+ type LimitPriceTickAdjustment = {
1450
+ adjusted: boolean;
1451
+ adjustedPriceRaw: string;
1452
+ originalPriceRaw: string;
1453
+ tickSizeRaw: string | null;
1454
+ };
1455
+ /**
1456
+ * Aligns a six-decimal limit price to a venue tick in the user's favor.
1457
+ * All rounding is performed with integers after the venue tick is scaled.
1458
+ */
1459
+ declare const adjustLimitPriceRawToTick: ({ limitPriceRaw, side, tickSize, }: {
1460
+ limitPriceRaw: string;
1461
+ side: LimitPriceSide;
1462
+ tickSize?: number | null;
1463
+ }) => LimitPriceTickAdjustment;
1464
+
1465
+ declare const DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW = "1002000000";
1466
+ declare const DEFAULT_BALANCE_REFILL_MAX_FEE_RAW = "2000000";
1467
+ declare const getBalanceRefillMaximumRaw: (dailyCapRaw: string, maxFeeRaw: string) => string;
1468
+ declare const isBalanceRefillWithinDailyCap: (minimumRaw: string, refillAmountRaw: string, dailyCapRaw: string, maxFeeRaw: string) => boolean;
1469
+
1392
1470
  /**
1393
1471
  * WebSocket protocol types for the Agg platform.
1394
1472
  * All callback timestamps are in **seconds** (converted from server ms at SDK dispatch).
@@ -1542,6 +1620,8 @@ interface WsOrderEvent {
1542
1620
  event: WsOrderEventType;
1543
1621
  userId: string;
1544
1622
  orderId: string;
1623
+ /** Partner trade id from `placeOrder()`, when the order carried one. */
1624
+ externalId?: string;
1545
1625
  venue: string;
1546
1626
  dagRunId?: string;
1547
1627
  stepId?: string;
@@ -1945,6 +2025,15 @@ interface VenueGeoPolicyEntry {
1945
2025
  venue: Venue;
1946
2026
  /** ISO 3166-1 alpha-2, upper-case. Empty means no country restriction. */
1947
2027
  blockedCountries: string[];
2028
+ /**
2029
+ * ISO 3166-1 alpha-2, upper-case. When present, this venue is ALLOWLIST
2030
+ * mode: ONLY these countries are permitted (`blockedCountries` is always
2031
+ * `[]` alongside this and must be ignored). Absent/undefined ⇒ ordinary
2032
+ * denylist mode, use `blockedCountries` as before. Only Novig uses this
2033
+ * today — a client that reads only `blockedCountries` sees an allowlisted
2034
+ * venue as unrestricted, which is exactly the misread this field closes.
2035
+ */
2036
+ allowedCountries?: string[];
1948
2037
  }
1949
2038
  interface VenueGeoPolicyResponse {
1950
2039
  venues: VenueGeoPolicyEntry[];
@@ -2054,6 +2143,27 @@ interface PersistedAuthSnapshot {
2054
2143
  }
2055
2144
  /** Auth lifecycle status for UI state machines. */
2056
2145
  type AuthStatus = "unknown" | "authenticated" | "unauthenticated";
2146
+ type SportsGameStatus = "scheduled" | "live" | "paused" | "finished" | "cancelled" | "postponed" | "unknown";
2147
+ interface SportsLiveParticipant {
2148
+ position: "first" | "second";
2149
+ name: string;
2150
+ shortName: string | null;
2151
+ imageUrl: string | null;
2152
+ score: string | null;
2153
+ }
2154
+ interface SportsLiveState {
2155
+ eventId: string;
2156
+ sport: string;
2157
+ status: SportsGameStatus;
2158
+ participants: [SportsLiveParticipant, SportsLiveParticipant];
2159
+ period: string | null;
2160
+ clock: string | null;
2161
+ updatedAt: string | null;
2162
+ }
2163
+ interface SportsLiveResponse {
2164
+ data: SportsLiveState[];
2165
+ missingEventIds: string[];
2166
+ }
2057
2167
  interface AggClientOptions {
2058
2168
  baseUrl: string;
2059
2169
  /** Public App ID — sent as x-app-id header. For client-side partner usage. */
@@ -2184,6 +2294,13 @@ interface MatchedOrderbookMarket extends VenueMarketRef {
2184
2294
  marketStatus: "open" | "closed" | "resolved" | "unopened" | "paused";
2185
2295
  tickSize: number | null;
2186
2296
  hasOrderbook: boolean;
2297
+ /**
2298
+ * Hyperliquid HIP-4 deployer namespace this member belongs to (e.g. "ap").
2299
+ * `null` for every other venue and for Hyperliquid members without one.
2300
+ * Names which deployer this cluster member is — distinct from whether its
2301
+ * book was published (see `hasOrderbook`).
2302
+ */
2303
+ deployerVenue?: string | null;
2187
2304
  }
2188
2305
  /**
2189
2306
  * Provenance of a published `midpoint`. Mirrors the engine's `MarkSource`.
@@ -2444,6 +2561,14 @@ interface VenueOrderbookEntry {
2444
2561
  tick?: number | null;
2445
2562
  /** Provenance of this venue book's published midpoint. See {@link MarkSource}. */
2446
2563
  markSource?: MarkSource;
2564
+ /**
2565
+ * Hyperliquid HIP-4 deployer namespace whose book this entry publishes
2566
+ * (e.g. "ap"). `null` for every other venue. When a cluster has more than
2567
+ * one Hyperliquid deployer member, only one member's book is published per
2568
+ * request — this names which one, so a caller never pairs this entry's depth
2569
+ * with a different member's `venueMarketId`.
2570
+ */
2571
+ deployerVenue?: string | null;
2447
2572
  }
2448
2573
  /** Response from GET /orderbooks (batch). */
2449
2574
  interface BatchOrderbooksResponse {
@@ -2571,6 +2696,8 @@ interface TradeExecutorOrder {
2571
2696
  side: string;
2572
2697
  amountRaw: string;
2573
2698
  quoteId: string | null;
2699
+ externalId: string | null;
2700
+ clientOrderId: string | null;
2574
2701
  dagRunId: string | null;
2575
2702
  filledAmountRaw: string | null;
2576
2703
  executionPrice: string | null;
@@ -2674,6 +2801,35 @@ interface PlaceLimitOrderResponse {
2674
2801
  filledSizeRaw: string;
2675
2802
  remainingSizeRaw: string;
2676
2803
  }
2804
+ interface PlaceOrderParams {
2805
+ venue: Venue;
2806
+ venueMarketOutcomeId: string;
2807
+ side: "buy" | "sell";
2808
+ /** Buy only. Maximum all-in USD spend, inclusive of app fee. */
2809
+ maxSpend?: number;
2810
+ /** Sell only. Number of contracts to sell. */
2811
+ sellShares?: number;
2812
+ /**
2813
+ * Your trade id. Required, unique within your app — two different users of
2814
+ * the same app cannot share one. A repeat returns 409 instead of trading twice.
2815
+ */
2816
+ externalId: string;
2817
+ /** Slippage cap in bps. Defaults to 500 (5%). Set explicitly on sells. */
2818
+ slipCapBps?: number;
2819
+ }
2820
+ interface PlaceOrderResponse {
2821
+ orderId: string;
2822
+ externalId: string;
2823
+ venue: Venue;
2824
+ status: "pending";
2825
+ quoteId: string;
2826
+ /** `null` if the order row doesn't carry a quoted price. Not zero. */
2827
+ quotedPriceRaw: string | null;
2828
+ /** `null` under the same conditions as `quotedPriceRaw`. Not zero. */
2829
+ quotedCostRaw: string | null;
2830
+ /** `null` under the same conditions as `quotedPriceRaw`. Not zero. */
2831
+ quotedSharesRaw: string | null;
2832
+ }
2677
2833
  interface ValidateManagedParams {
2678
2834
  venueMarketOutcomeIds: string[];
2679
2835
  side: "buy" | "sell";
@@ -2733,7 +2889,7 @@ interface CreateBalanceRefillPolicyParams {
2733
2889
  targetTokenSymbol?: "USDC";
2734
2890
  minimumRaw: string;
2735
2891
  refillAmountRaw: string;
2736
- /** Optional daily refill limit. Defaults to $250 in 6-decimal USD units. */
2892
+ /** Optional daily refill limit. Defaults to $1,002 in 6-decimal USD units. */
2737
2893
  dailyCapRaw?: string;
2738
2894
  /** Optional per-refill fee limit. Defaults to $2 in 6-decimal USD units. */
2739
2895
  maxFeeRaw?: string;
@@ -2970,6 +3126,7 @@ interface ExecutionStatusOrder {
2970
3126
  executionPriceRaw?: string;
2971
3127
  partialFillReason?: string;
2972
3128
  errorReason?: string;
3129
+ venueOrderId?: string;
2973
3130
  txHash?: string;
2974
3131
  updatedAt: string;
2975
3132
  }
@@ -3337,6 +3494,8 @@ interface VenueSoloQuote {
3337
3494
  * SUPPORTED_FILL_VENUES). FE filters on truthiness.
3338
3495
  */
3339
3496
  quoteId: string | null;
3497
+ /** Why this venue cannot execute when quoteId is null (or execution is geo-gated). */
3498
+ unavailableReason?: string;
3340
3499
  venue: string;
3341
3500
  avgPrice: number | null;
3342
3501
  filledQty: number;
@@ -4030,6 +4189,7 @@ declare class AggClient {
4030
4189
  status?: MarketStatus[];
4031
4190
  sortBy?: string;
4032
4191
  sortDir?: string;
4192
+ aggKey?: string | string[];
4033
4193
  recurrence?: RecurrenceFilter | RecurrenceFilter[];
4034
4194
  limit?: number;
4035
4195
  cursor?: string;
@@ -4037,6 +4197,7 @@ declare class AggClient {
4037
4197
  maxYesPrice?: number;
4038
4198
  /** ISO-8601 timestamp. Hides events with endDate <= this value. NULL-endDate events are kept. */
4039
4199
  endDateFrom?: string;
4200
+ signal?: AbortSignal;
4040
4201
  /**
4041
4202
  * When true, fold same-venue companion events into one tile per game
4042
4203
  * (`groupParentId IS NULL`). Sent as `grouped=true`; omitted when false/absent
@@ -4049,6 +4210,10 @@ declare class AggClient {
4049
4210
  getVenueEventById(id: string, options?: {
4050
4211
  signal?: AbortSignal;
4051
4212
  }): Promise<VenueEvent>;
4213
+ /** Get normalized live score state for sports events. Requires appId or admin auth. */
4214
+ getSportsLive(eventIds: string[], options?: {
4215
+ signal?: AbortSignal;
4216
+ }): Promise<SportsLiveResponse>;
4052
4217
  /** List deterministic recurring crypto window markets across venues. Requires appId or admin auth. */
4053
4218
  listRecurringCryptoMarkets(options?: ListRecurringCryptoMarketsOptions & {
4054
4219
  signal?: AbortSignal;
@@ -4213,6 +4378,13 @@ declare class AggClient {
4213
4378
  executeManaged(params: ExecuteManagedParams): Promise<ExecuteManagedResponse>;
4214
4379
  /** Place a managed limit order. Returns the venue-backed order state. */
4215
4380
  placeLimitOrder(params: PlaceLimitOrderParams): Promise<PlaceLimitOrderResponse>;
4381
+ /**
4382
+ * Place a market order directly on a named venue — no prior quote needed.
4383
+ * Always produces exactly one order. `externalId` is required and unique
4384
+ * within your app — two different users of the same app cannot share one —
4385
+ * so retrying a timed-out call with the same value is safe.
4386
+ */
4387
+ placeOrder(params: PlaceOrderParams): Promise<PlaceOrderResponse>;
4216
4388
  /** Redeem resolved winning positions by venue market outcome ids. */
4217
4389
  redeem(body: RedeemRequest): Promise<RedeemResponse>;
4218
4390
  /** List the authenticated user's managed balance refill policies. */
@@ -4380,4 +4552,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
4380
4552
 
4381
4553
  declare function createAggClient(options: AggClientOptions): AggClient;
4382
4554
 
4383
- export { ACTIVE_VENUES, type Account, AccountProvider, AccountType, AggApiError, type AggApiErrorInit, type AggApiFieldError, type AggAuthDeliveryMode, type AggAuthProviderType, type AggAuthStartBody, type AggAuthStartResult, type AggAuthVerifyBody, AggClient, type AggClientAuthOptions, type AggClientSessionInput, type AggLinkAccountBody, type AggLinkAccountConfirmResult, type AggLinkAccountResult, type AggSessionUser, AggWebSocket, type AggWebSocketCallbacks, type AggWebSocketOptions, type AggregatedOrderbookLevel, type AggregatedOrderbookResponse, type App, type AppClientConfigResponse, type AttributedOrderbook, type AttributedOrderbookLevel, type AuthCodeResponse, type AuthStatus, type AuthTokenResponse, type AuthUser, type BalanceRefillAttempt, type BalanceRefillAttemptStatus, type BalanceRefillPolicy, type BalanceRefillPolicyStatus, type BatchMidpointsResponse, type BatchOrderbooksResponse, type BookQuality, type BuildVenueUrlOpts, CONFIRMED_MATCH_STATUSES, type CancelManagedExecutionResponse, type Candle, CandleBuilder, type CandleInterval, type Category, Chain, type ChartBarsResponse, type ChartCandle, type ChartResolution, type ChartVenueCandles, type ComputeSplitsRequest, type ComputeSplitsResponse, type ComputeSplitsSelection, type CorrelatedMarketCascadeItem, type CorrelatedMarketCascadeResponse, type CorrelatedMarketQueryResult, type CorrelatedMarketSide, type CorrelatedMarketSignal, type CorrelatedMarketSignalBatch, type CorrelatedMarketSignalDirection, type CorrelatedMarketsStatus, type CreateApp, type CreateBalanceRefillPolicyParams, type CreatePaperTradingAccountParams, type CryptoReferencePriceError, type CryptoReferencePriceExternalMarketInput, type CryptoReferencePriceMarketInput, type CryptoReferencePriceResult, type CryptoReferencePriceSource, type CryptoReferencePriceTarget, type CryptoReferencePricesResponse, type DepositAddressesPendingResponse, type DepositAddressesReadyResponse, type DepositAddressesResponse, type DepositAddressesSupportedChain, type DepositAddressesToken, type DepositStep, type DiagnosticCallback, type DiagnosticEvent, type ExecuteManagedParams, type ExecuteManagedRequest, type ExecuteManagedResponse, type ExecuteTradeRequest, type ExecuteTradeResponse, type ExecutionDagProgress, type ExecutionDisplayGroupStatus, type ExecutionDisplayStepKind, type ExecutionMode, type ExecutionOrderItem, type ExecutionOrdersQuery, type ExecutionOverallState, type ExecutionPositionGroup, type ExecutionPositionsQuery, type ExecutionStatusOrder, type ExecutionStatusQuery, type ExecutionStatusResponse, type ExecutionStatusStep, type GetBalanceQuery, type GetBalanceResponse, type GetCryptoReferencePricesOptions, type GetHoldingsQuery, type GetHoldingsResponse, type GetOrdersParams, type GetOrdersQuery, type GetPositionsParams, type GetPositionsQuery, type HelloResponse, IMAGE_SIZES, INACTIVE_VENUES, ImageSize, type LimitOrderTimeInForce, type ListRecurringCryptoMarketsOptions, type ManagedBalancesParams, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedMidpointOutcome, type MatchedOrderbookMarket, type MatchedVenueMarketOutcomeRef, type MidpointItem, type MidpointRow, type NewsFeedArticleFeedItem, type NewsFeedArticleFeedResponse, type NewsFeedArticleWithSummary, type NewsFeedLinkedMarket, type NewsFeedListResponse, type NewsFeedMarketFeedArticle, type NewsFeedMarketFeedItem, type NewsFeedMarketFeedResponse, type NewsFeedMarketNewsParams, type NewsFeedMarketNewsResponse, type NewsFeedMarketNewsResult, type NewsFeedPageOptions, type NewsFeedStatusResponse, type NonceResponse, type OrderListItem, type OrderListQuery, OrderStatus, OrderType, type Orderbook, type OrderbookBatchItemError, type OrderbookBatchItemErrorCode, type OrderbookBatchItemStatus, type OrderbookHistoryPoint, type OrderbookHistoryResponse, type OrderbookLevel, type OrderbookQuoteFill, type OrderbookQuoteParams, type OrderbookQuoteResponse, type OrderbookServiceUnavailableError, type OrderbookState, type OrderbooksOnlyError, type OutcomeMidpoint, type OutcomeMidpointRow, type OutcomeOrderbookResponse, type PaginatedResponse, type PaperTradingAccount, type PaperTradingAccountsPage, type PaperTradingAppOptions, type PaperTradingBalanceAdjustment, type PaperTradingBalanceResponse, type PaperTradingLiquidityStatus, type PaperTradingListParams, type PaperTradingMarkSource, type PaperTradingOrder, type PaperTradingOrdersPage, type PaperTradingPortfolio, type PaperTradingPosition, type PaperTradingPositionsPage, type PersistedAuthSnapshot, type PlaceLimitOrderParams, type PlaceLimitOrderResponse, type PlacePaperTradingOrderParams, type PositionGroup, type PositionRedeemStatus, type PricePoint, type PriceSource, type PricesHistoryResponse, 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, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, type ServerWallet, type SetPaperTradingBalanceParams, type SettlementDiff, type SettlementDifference, type SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SimpleOrderbookLevel, type SmartRouteAllocation, type SmartRouteBridgeStep, type SmartRouteFeeBreakdown, type SmartRouteFill, type SmartRouteParams, type SmartRouteResponse, type SmartRouteSettlementLeg, type SmartRouteSettlementPlan, type SmartRouteSetupCostLine, type SmartRouteSide, type SmartRouteStatus, type SmartRouteVenueFill, type SplitsByAmountResult, type SyncBalancesResponse, TimeInForce, type TradeExecutorOrder, type TradeExecutorOrderListResponse, TradeSide$1 as TradeSide, type TradeSplit, type TradeStep, TurnstileChallengeError, type UnifiedBalanceResponse, type UpdateBalanceRefillPolicyParams, type UpdateUserBody, type UpsertVenueKey, type UserActivityBridge, type UserActivityDeposit, type UserActivityItem, type UserActivityQuery, type UserActivityRedeem, type UserActivityRedeemLeg, type UserActivityTrade, type UserActivityType, type UserActivityUserOp, type UserActivityWithdrawal, type UserHolding, type UserProfile, VENUES, type ValidateBalanceOnClientStep, type ValidateManagedParams, type ValidateManagedRequest, type ValidateManagedResponse, type ValidateTradeRequest, type ValidateTradeResponse, Venue, type VenueEvent, type VenueEventListItem, type VenueEventWithMarkets, type VenueGeoPolicyEntry, type VenueGeoPolicyResponse, type VenueKeyStatus, type VenueKeySummary, type VenueMarket, type VenueMarketClusterNode, type VenueMarketListItem, type VenueMarketOutcome, type VenueMarketRef, type VenueOrderbookEntry, type VenueOrderbookLevel, type VenuePositionBalance, type VenuePriceInfo, type VenueSoloQuote, type VerifyBody, type VerifyResponse, type WalletChainBalance, type WalletTokenBalance, type WithdrawManagedParams, type WithdrawManagedRequest, type WithdrawManagedResponse, type WithdrawManagedSourceItem, type WithdrawPreviewParams, type WithdrawPreviewResponse, type WithdrawTokenSymbol, type WithdrawalExpected, type WithdrawalLeg, type WithdrawalLegStatus, type WithdrawalLegType, type WithdrawalLifecycleStatus, type WithdrawalQuoteParams, type WithdrawalQuoteResponse, type WithdrawalSource, type WithdrawalSourceItem, type WithdrawalSourceStatus, type WithdrawalSourceTokenSymbol, type WsArbFeedBatch, type WsArbFeedEntry, type WsArbMarketUpdate, type WsAttributedLevel, type WsAuthenticated, type WsBalanceUpdate, type WsCandleInterval, type WsClientMessage, type WsConnected, type WsError, type WsHeartbeat, type WsMarkSource, type WsMarketResolved, type WsOrderEvent, type WsOrderEventType, type WsOrderSubmitted, type WsOrderbookDelta, type WsOrderbookSnapshot, type WsRedeemEvent, type WsServerMessage, type WsSubscribed, type WsTrade, type WsUnsubscribed, type WsVenueBook, type WsVenueInfo, type WsVenueLevel, type WsWithdrawalLegStatus, type WsWithdrawalLifecycleEvent, type WsWithdrawalLifecycleLeg, type WsWithdrawalLifecycleStatus, aggregateMidpoint, applyOrderbookDelta, buildVenueUrl, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getEffectiveDisabledVenues, getWalletAddressFromUserProfile, hasShape, isAggApiError, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, isVenueActive, isVenueDataVisible, isVenueInactive, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
4555
+ export { ACTIVE_VENUES, type Account, AccountProvider, AccountType, AggApiError, type AggApiErrorInit, type AggApiFieldError, type AggAuthDeliveryMode, type AggAuthProviderType, type AggAuthStartBody, type AggAuthStartResult, type AggAuthVerifyBody, AggClient, type AggClientAuthOptions, type AggClientSessionInput, type AggLinkAccountBody, type AggLinkAccountConfirmResult, type AggLinkAccountResult, type AggSessionUser, AggWebSocket, type AggWebSocketCallbacks, type AggWebSocketOptions, type AggregatedOrderbookLevel, type AggregatedOrderbookResponse, type App, type AppClientConfigResponse, type AttributedOrderbook, type AttributedOrderbookLevel, type AuthCodeResponse, type AuthStatus, type AuthTokenResponse, type AuthUser, type BalanceRefillAttempt, type BalanceRefillAttemptStatus, type BalanceRefillPolicy, type BalanceRefillPolicyStatus, type BatchMidpointsResponse, type BatchOrderbooksResponse, type BookQuality, type BuildVenueUrlOpts, CONFIRMED_MATCH_STATUSES, type CancelManagedExecutionResponse, type Candle, CandleBuilder, type CandleInterval, type Category, Chain, type ChartBarsResponse, type ChartCandle, type ChartResolution, type ChartVenueCandles, type ComputeSplitsRequest, type ComputeSplitsResponse, type ComputeSplitsSelection, type CorrelatedMarketCascadeItem, type CorrelatedMarketCascadeResponse, type CorrelatedMarketQueryResult, type CorrelatedMarketSide, type CorrelatedMarketSignal, type CorrelatedMarketSignalBatch, type CorrelatedMarketSignalDirection, type CorrelatedMarketsStatus, type CreateApp, type CreateBalanceRefillPolicyParams, type CreatePaperTradingAccountParams, type CryptoReferencePriceError, type CryptoReferencePriceExternalMarketInput, type CryptoReferencePriceMarketInput, type CryptoReferencePriceResult, type CryptoReferencePriceSource, type CryptoReferencePriceTarget, type CryptoReferencePricesResponse, 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, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, type ServerWallet, type SetPaperTradingBalanceParams, type SettlementDiff, type SettlementDifference, type SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SimpleOrderbookLevel, type SmartRouteAllocation, type SmartRouteBridgeStep, type SmartRouteFeeBreakdown, type SmartRouteFill, type SmartRouteParams, type SmartRouteResponse, type SmartRouteSettlementLeg, type SmartRouteSettlementPlan, type SmartRouteSetupCostLine, type SmartRouteSide, type SmartRouteStatus, type SmartRouteVenueFill, type SplitsByAmountResult, type SportsGameStatus, type SportsLiveParticipant, type SportsLiveResponse, type SportsLiveState, type SyncBalancesResponse, TimeInForce, type TradeExecutorOrder, type TradeExecutorOrderListResponse, TradeSide$1 as TradeSide, type TradeSplit, type TradeStep, TurnstileChallengeError, type UnifiedBalanceResponse, type UpdateBalanceRefillPolicyParams, type UpdateUserBody, type UpsertVenueKey, type UserActivityBridge, type UserActivityDeposit, type UserActivityItem, type UserActivityQuery, type UserActivityRedeem, type UserActivityRedeemLeg, type UserActivityTrade, type UserActivityType, type UserActivityUserOp, type UserActivityWithdrawal, type UserHolding, type UserProfile, VENUES, 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 };
package/dist/index.js CHANGED
@@ -78,9 +78,12 @@ __export(index_exports, {
78
78
  CONFIRMED_MATCH_STATUSES: () => CONFIRMED_MATCH_STATUSES,
79
79
  CandleBuilder: () => CandleBuilder,
80
80
  Chain: () => Chain,
81
+ DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW: () => DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW,
82
+ DEFAULT_BALANCE_REFILL_MAX_FEE_RAW: () => DEFAULT_BALANCE_REFILL_MAX_FEE_RAW,
81
83
  IMAGE_SIZES: () => IMAGE_SIZES,
82
84
  INACTIVE_VENUES: () => INACTIVE_VENUES,
83
85
  ImageSize: () => ImageSize,
86
+ LIMIT_PRICE_RAW_SCALE: () => LIMIT_PRICE_RAW_SCALE,
84
87
  MarketStatus: () => MarketStatus,
85
88
  MatchStatus: () => MatchStatus,
86
89
  MatchType: () => MatchType,
@@ -91,7 +94,9 @@ __export(index_exports, {
91
94
  TradeSide: () => TradeSide,
92
95
  TurnstileChallengeError: () => TurnstileChallengeError,
93
96
  VENUES: () => VENUES,
97
+ VENUE_CHAIN_IDS: () => VENUE_CHAIN_IDS,
94
98
  Venue: () => Venue,
99
+ adjustLimitPriceRawToTick: () => adjustLimitPriceRawToTick,
95
100
  aggregateMidpoint: () => aggregateMidpoint,
96
101
  applyOrderbookDelta: () => applyOrderbookDelta,
97
102
  buildVenueUrl: () => buildVenueUrl,
@@ -102,10 +107,12 @@ __export(index_exports, {
102
107
  formatMarketQuestion: () => formatMarketQuestion,
103
108
  formatOutcomeLabel: () => formatOutcomeLabel,
104
109
  formatOutcomeTitle: () => formatOutcomeTitle,
110
+ getBalanceRefillMaximumRaw: () => getBalanceRefillMaximumRaw,
105
111
  getEffectiveDisabledVenues: () => getEffectiveDisabledVenues,
106
112
  getWalletAddressFromUserProfile: () => getWalletAddressFromUserProfile,
107
113
  hasShape: () => hasShape,
108
114
  isAggApiError: () => isAggApiError,
115
+ isBalanceRefillWithinDailyCap: () => isBalanceRefillWithinDailyCap,
109
116
  isEmail: () => isEmail,
110
117
  isEnum: () => isEnum,
111
118
  isFiniteNonNeg: () => isFiniteNonNeg,
@@ -136,6 +143,7 @@ var Venue = /* @__PURE__ */ ((Venue3) => {
136
143
  Venue3["probable"] = "probable";
137
144
  Venue3["myriad"] = "myriad";
138
145
  Venue3["hyperliquid"] = "hyperliquid";
146
+ Venue3["novig"] = "novig";
139
147
  return Venue3;
140
148
  })(Venue || {});
141
149
  var VENUES = [
@@ -146,9 +154,19 @@ var VENUES = [
146
154
  "predict" /* predict */,
147
155
  "probable" /* probable */,
148
156
  "myriad" /* myriad */,
149
- "hyperliquid" /* hyperliquid */
157
+ "hyperliquid" /* hyperliquid */,
158
+ "novig" /* novig */
150
159
  ];
160
+ var VENUE_CHAIN_IDS = {
161
+ ["kalshi" /* kalshi */]: 792703809,
162
+ ["polymarket" /* polymarket */]: 137,
163
+ ["limitless" /* limitless */]: 8453,
164
+ ["predict" /* predict */]: 56,
165
+ ["myriad" /* myriad */]: 56,
166
+ ["hyperliquid" /* hyperliquid */]: 1337
167
+ };
151
168
  var ACTIVE_VENUES = [
169
+ "kalshi" /* kalshi */,
152
170
  "polymarket" /* polymarket */,
153
171
  "limitless" /* limitless */,
154
172
  "opinion" /* opinion */,
@@ -157,7 +175,8 @@ var ACTIVE_VENUES = [
157
175
  "myriad" /* myriad */,
158
176
  "hyperliquid" /* hyperliquid */
159
177
  ];
160
- var INACTIVE_VENUES = ["kalshi" /* kalshi */];
178
+ var INACTIVE_VENUES = ["novig" /* novig */];
179
+ var DEFAULT_DISABLED_VENUES = ["novig" /* novig */];
161
180
  var ACTIVE_VENUE_SET = new Set(ACTIVE_VENUES);
162
181
  var INACTIVE_VENUE_SET = new Set(INACTIVE_VENUES);
163
182
  function normalizeVenue(venue) {
@@ -178,11 +197,13 @@ function isVenueDataVisible(venue, dataVisibleOverride = []) {
178
197
  const n = normalizeVenue(venue);
179
198
  return dataVisibleOverride.some((v) => normalizeVenue(v) === n);
180
199
  }
181
- function getEffectiveDisabledVenues(disabledVenues = [], dataVisibleVenues = []) {
182
- if (disabledVenues.length === 0 && dataVisibleVenues.length === 0) return [...INACTIVE_VENUES];
200
+ function getEffectiveDisabledVenues(disabledVenues, dataVisibleVenues = []) {
201
+ if (disabledVenues === void 0) {
202
+ const disabled2 = new Set(DEFAULT_DISABLED_VENUES);
203
+ for (const venue of dataVisibleVenues) disabled2.delete(normalizeVenue(venue));
204
+ return VENUES.filter((venue) => disabled2.has(venue));
205
+ }
183
206
  const disabled = new Set(disabledVenues.map(normalizeVenue));
184
- for (const venue of INACTIVE_VENUES) disabled.add(venue);
185
- for (const venue of dataVisibleVenues) disabled.delete(normalizeVenue(venue));
186
207
  return VENUES.filter((venue) => disabled.has(venue));
187
208
  }
188
209
 
@@ -705,11 +726,75 @@ function buildVenueUrl(venue, opts) {
705
726
  if (opts.eventSlug) return `https://probable.markets/event/${opts.eventSlug}`;
706
727
  return null;
707
728
  }
729
+ case "novig": {
730
+ if (opts.outcomeExternalId && opts.partnerId) {
731
+ return opts.platform === "native" ? `novigapp://events/${opts.outcomeExternalId}/${opts.partnerId}` : `https://novig.com/events/${opts.outcomeExternalId}/${opts.partnerId}`;
732
+ }
733
+ return null;
734
+ }
708
735
  default:
709
736
  return null;
710
737
  }
711
738
  }
712
739
 
740
+ // ../common/src/utils/limit-price-ticks.ts
741
+ var LIMIT_PRICE_RAW_SCALE = BigInt(1e6);
742
+ var resolveTickSizeRaw = (tickSize) => {
743
+ const scaledTick = tickSize * Number(LIMIT_PRICE_RAW_SCALE);
744
+ const roundedTick = Math.round(scaledTick);
745
+ if (!Number.isFinite(scaledTick) || roundedTick <= 0 || Math.abs(scaledTick - roundedTick) > 1e-6) {
746
+ throw new RangeError(`Unsupported limit-order tick size: ${tickSize}`);
747
+ }
748
+ return BigInt(roundedTick);
749
+ };
750
+ var adjustLimitPriceRawToTick = ({
751
+ limitPriceRaw,
752
+ side,
753
+ tickSize
754
+ }) => {
755
+ const originalPrice = BigInt(limitPriceRaw);
756
+ const originalPriceRaw = originalPrice.toString();
757
+ if (tickSize == null) {
758
+ return {
759
+ adjusted: false,
760
+ adjustedPriceRaw: originalPriceRaw,
761
+ originalPriceRaw,
762
+ tickSizeRaw: null
763
+ };
764
+ }
765
+ const tickSizeRaw = resolveTickSizeRaw(tickSize);
766
+ const remainder = originalPrice % tickSizeRaw;
767
+ if (remainder === BigInt(0)) {
768
+ return {
769
+ adjusted: false,
770
+ adjustedPriceRaw: originalPriceRaw,
771
+ originalPriceRaw,
772
+ tickSizeRaw: tickSizeRaw.toString()
773
+ };
774
+ }
775
+ const adjustedPrice = side === "buy" ? originalPrice - remainder : originalPrice + (tickSizeRaw - remainder);
776
+ return {
777
+ adjusted: true,
778
+ adjustedPriceRaw: adjustedPrice.toString(),
779
+ originalPriceRaw,
780
+ tickSizeRaw: tickSizeRaw.toString()
781
+ };
782
+ };
783
+
784
+ // ../common/src/utils/balance-refill.ts
785
+ var DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW = "1002000000";
786
+ var DEFAULT_BALANCE_REFILL_MAX_FEE_RAW = "2000000";
787
+ var getBalanceRefillMaximumRaw = (dailyCapRaw, maxFeeRaw) => {
788
+ const dailyCap = BigInt(dailyCapRaw);
789
+ const maximumFee = BigInt(maxFeeRaw);
790
+ if (dailyCap <= maximumFee) return "0";
791
+ return (dailyCap - maximumFee).toString();
792
+ };
793
+ var isBalanceRefillWithinDailyCap = (minimumRaw, refillAmountRaw, dailyCapRaw, maxFeeRaw) => {
794
+ const maximum = BigInt(getBalanceRefillMaximumRaw(dailyCapRaw, maxFeeRaw));
795
+ return BigInt(minimumRaw) <= maximum && BigInt(refillAmountRaw) <= maximum;
796
+ };
797
+
713
798
  // src/errors.ts
714
799
  var TurnstileChallengeError = class extends Error {
715
800
  constructor(siteKey) {
@@ -1662,6 +1747,7 @@ var AggWebSocket = class {
1662
1747
  var COOKIE_REFRESH_DELIVERY = "cookie-refresh";
1663
1748
  var DEFAULT_MIDPOINT_IDS_PER_REQUEST = 75;
1664
1749
  var MAX_MIDPOINT_IDS_PER_REQUEST = 75;
1750
+ var MAX_SPORTS_EVENT_IDS_PER_REQUEST = 25;
1665
1751
  var isUserProfile = (user) => {
1666
1752
  return "accounts" in user && "wallets" in user && "avatarUrl" in user;
1667
1753
  };
@@ -2375,7 +2461,9 @@ Issued At: ${issuedAt}`;
2375
2461
  const query = {};
2376
2462
  if (params.orderId) query.orderId = params.orderId;
2377
2463
  if (params.quoteId) query.quoteId = params.quoteId;
2464
+ if (params.externalId) query.externalId = params.externalId;
2378
2465
  if (params.status) query.status = params.status;
2466
+ if (params.orderType) query.orderType = params.orderType;
2379
2467
  if (params.mode) query.mode = params.mode;
2380
2468
  if (params.cursor) query.cursor = params.cursor;
2381
2469
  if (params.limit != null) query.limit = String(params.limit);
@@ -2576,6 +2664,7 @@ Issued At: ${issuedAt}`;
2576
2664
  if ((options == null ? void 0 : options.status) && options.status.length > 0) query.status = options.status;
2577
2665
  if (options == null ? void 0 : options.sortBy) query.sortBy = options.sortBy;
2578
2666
  if (options == null ? void 0 : options.sortDir) query.sortDir = options.sortDir;
2667
+ if (options == null ? void 0 : options.aggKey) query.aggKey = options.aggKey;
2579
2668
  if (options == null ? void 0 : options.recurrence) query.recurrence = options.recurrence;
2580
2669
  if ((options == null ? void 0 : options.limit) != null) query.limit = String(options.limit);
2581
2670
  if (options == null ? void 0 : options.cursor) query.cursor = options.cursor;
@@ -2584,7 +2673,8 @@ Issued At: ${issuedAt}`;
2584
2673
  if (options == null ? void 0 : options.endDateFrom) query.endDateFrom = options.endDateFrom;
2585
2674
  if (options == null ? void 0 : options.grouped) query.grouped = "true";
2586
2675
  return this.request("/venue-events", {
2587
- query: Object.keys(query).length > 0 ? query : void 0
2676
+ query: Object.keys(query).length > 0 ? query : void 0,
2677
+ signal: options == null ? void 0 : options.signal
2588
2678
  });
2589
2679
  });
2590
2680
  }
@@ -2600,6 +2690,27 @@ Issued At: ${issuedAt}`;
2600
2690
  });
2601
2691
  });
2602
2692
  }
2693
+ /** Get normalized live score state for sports events. Requires appId or admin auth. */
2694
+ getSportsLive(eventIds, options) {
2695
+ return __async(this, null, function* () {
2696
+ const normalizedEventIds = normalizeRequestedVenueMarketIds(eventIds);
2697
+ if (normalizedEventIds.length === 0) {
2698
+ return { data: [], missingEventIds: [] };
2699
+ }
2700
+ const responses = yield Promise.all(
2701
+ chunkArray(normalizedEventIds, MAX_SPORTS_EVENT_IDS_PER_REQUEST).map(
2702
+ (eventIdChunk) => this.request("/sports/live", {
2703
+ query: { eventIds: eventIdChunk },
2704
+ signal: options == null ? void 0 : options.signal
2705
+ })
2706
+ )
2707
+ );
2708
+ return {
2709
+ data: responses.flatMap((response) => response.data),
2710
+ missingEventIds: [...new Set(responses.flatMap((response) => response.missingEventIds))]
2711
+ };
2712
+ });
2713
+ }
2603
2714
  /** List deterministic recurring crypto window markets across venues. Requires appId or admin auth. */
2604
2715
  listRecurringCryptoMarkets(options) {
2605
2716
  return __async(this, null, function* () {
@@ -3040,6 +3151,20 @@ Issued At: ${issuedAt}`;
3040
3151
  });
3041
3152
  });
3042
3153
  }
3154
+ /**
3155
+ * Place a market order directly on a named venue — no prior quote needed.
3156
+ * Always produces exactly one order. `externalId` is required and unique
3157
+ * within your app — two different users of the same app cannot share one —
3158
+ * so retrying a timed-out call with the same value is safe.
3159
+ */
3160
+ placeOrder(params) {
3161
+ return __async(this, null, function* () {
3162
+ return this.request("/execution/orders", {
3163
+ method: "POST",
3164
+ body: JSON.stringify(params)
3165
+ });
3166
+ });
3167
+ }
3043
3168
  /** Redeem resolved winning positions by venue market outcome ids. */
3044
3169
  redeem(body) {
3045
3170
  return __async(this, null, function* () {
@@ -3416,9 +3541,12 @@ function createAggClient(options) {
3416
3541
  CONFIRMED_MATCH_STATUSES,
3417
3542
  CandleBuilder,
3418
3543
  Chain,
3544
+ DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW,
3545
+ DEFAULT_BALANCE_REFILL_MAX_FEE_RAW,
3419
3546
  IMAGE_SIZES,
3420
3547
  INACTIVE_VENUES,
3421
3548
  ImageSize,
3549
+ LIMIT_PRICE_RAW_SCALE,
3422
3550
  MarketStatus,
3423
3551
  MatchStatus,
3424
3552
  MatchType,
@@ -3429,7 +3557,9 @@ function createAggClient(options) {
3429
3557
  TradeSide,
3430
3558
  TurnstileChallengeError,
3431
3559
  VENUES,
3560
+ VENUE_CHAIN_IDS,
3432
3561
  Venue,
3562
+ adjustLimitPriceRawToTick,
3433
3563
  aggregateMidpoint,
3434
3564
  applyOrderbookDelta,
3435
3565
  buildVenueUrl,
@@ -3440,10 +3570,12 @@ function createAggClient(options) {
3440
3570
  formatMarketQuestion,
3441
3571
  formatOutcomeLabel,
3442
3572
  formatOutcomeTitle,
3573
+ getBalanceRefillMaximumRaw,
3443
3574
  getEffectiveDisabledVenues,
3444
3575
  getWalletAddressFromUserProfile,
3445
3576
  hasShape,
3446
3577
  isAggApiError,
3578
+ isBalanceRefillWithinDailyCap,
3447
3579
  isEmail,
3448
3580
  isEnum,
3449
3581
  isFiniteNonNeg,