@agg-build/sdk 4.7.0 → 4.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -8,10 +8,11 @@ declare enum Venue {
8
8
  probable = "probable",
9
9
  myriad = "myriad",
10
10
  hyperliquid = "hyperliquid",
11
- novig = "novig"
11
+ novig = "novig",
12
+ prophetx = "prophetx"
12
13
  }
13
14
  /** Single source of truth for venue identifiers. */
14
- declare const VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.probable, Venue.myriad, Venue.hyperliquid, Venue.novig];
15
+ declare const VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.probable, Venue.myriad, Venue.hyperliquid, Venue.novig, Venue.prophetx];
15
16
  /** Canonical destination chain for venues with on-chain funding or settlement. */
16
17
  declare const VENUE_CHAIN_IDS: Partial<Record<Venue, number>>;
17
18
  /**
@@ -22,32 +23,37 @@ declare const VENUE_CHAIN_IDS: Partial<Record<Venue, number>>;
22
23
  * Re-activating a venue is therefore an intentional code change here rather
23
24
  * than a runtime configuration toggle.
24
25
  */
25
- declare const ACTIVE_VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.probable, Venue.myriad, Venue.hyperliquid];
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
27
  /**
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.
28
+ * Venues excluded from new user-facing activity. Kalshi and Novig have both
29
+ * left this set — each is fully active (data + execution) — leaving ProphetX
30
+ * as the only member.
30
31
  *
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
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
35
39
  * (see `dataVisibleVenues` in `@app/runtime-config`).
36
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
+ *
37
48
  * Membership here does NOT stop ingestion: the Rust engine gates discovery on
38
49
  * credentials, so Novig data keeps flowing into `VenueEvent`/`VenueMarket` and
39
50
  * keeps being matched. This set governs the API read layer and execution only.
40
51
  *
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.
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.
49
55
  */
50
- declare const INACTIVE_VENUES: readonly [Venue.novig];
56
+ declare const INACTIVE_VENUES: readonly [Venue.prophetx];
51
57
  /** Whether a venue may participate in new user-facing activity. */
52
58
  declare function isVenueActive(venue: string): boolean;
53
59
  /** Whether a venue is intentionally retained only for wind-down/history flows. */
@@ -2885,16 +2891,23 @@ interface ExecuteManagedParams {
2885
2891
  signingAddress?: string;
2886
2892
  /**
2887
2893
  * Self-custody only: which approve shape a cross-chain fill uses when the
2888
- * bridge needs an ERC20 approve. Omit (the default) for "sponsored" — we pay
2889
- * the gas, but the wallet must sign a one-time EIP-7702 authorization over a
2890
- * RAW DIGEST, which many wallets cannot produce. Send "user_broadcast" when
2891
- * yours cannot: the user sends the approve and pays their own gas. Only your
2892
- * client can know which applies — it is a property of the wallet software,
2893
- * not of the address or the chain.
2894
+ * bridge needs an ERC20 approve. Omit (the default) for "sponsored" — the
2895
+ * approve costs the wallet no gas, but the wallet must sign a one-time
2896
+ * EIP-7702 authorization over a RAW DIGEST, which many wallets cannot
2897
+ * produce. Send "user_broadcast" when yours cannot: the user sends the
2898
+ * approve from their own wallet and pays its gas. Only your client can know
2899
+ * which applies — it is a property of the wallet software, not of the
2900
+ * address or the chain.
2894
2901
  *
2895
2902
  * Worth surfacing in your UI: "user_broadcast" never establishes the
2896
- * delegation, so it charges gas on EVERY bridge. "sponsored" costs one
2897
- * signature once per chain, then is free.
2903
+ * delegation, so an approve is needed on EVERY bridge. "sponsored" costs one
2904
+ * signature once per chain.
2905
+ *
2906
+ * Neither mode makes bridging free — the approve is only one of the costs.
2907
+ * Relay's fee comes out of the amount delivered on every bridge, and one-time
2908
+ * costs apply per route. Quote with `deepEstimate` and read
2909
+ * `feeBreakdown.bridgeFees` and `feeBreakdown.setupCosts` rather than
2910
+ * inferring cost from the approve mode.
2898
2911
  */
2899
2912
  approveMode?: "sponsored" | "user_broadcast";
2900
2913
  }
@@ -3665,6 +3678,16 @@ interface VenueSoloQuote {
3665
3678
  setupCosts?: SmartRouteSetupCostLine[];
3666
3679
  /** Sum of this solo's `setupCosts` entries where `alreadyPaid=false`. */
3667
3680
  setupCostsTotal?: number;
3681
+ /**
3682
+ * Cost breakdown for executing THIS venue alone. Present when
3683
+ * `status === "ok"`; absent otherwise.
3684
+ *
3685
+ * Read this — not the top-level `feeBreakdown` — when rendering fees for a
3686
+ * single venue. A solo's bridge lanes and venue fee are its own, so a venue
3687
+ * needing no bridge reports `bridgeFees: 0` here even when the multi-route
3688
+ * plan bridged.
3689
+ */
3690
+ feeBreakdown?: SmartRouteFeeBreakdown;
3668
3691
  }
3669
3692
  /** @deprecated Smart-route side overrides are kept only for source compatibility. */
3670
3693
  type SmartRouteSide = "yes" | "no";
@@ -3710,8 +3733,11 @@ interface SmartRouteParams {
3710
3733
  interface SmartRouteSetupCostLine {
3711
3734
  /** "chainApproval" = ERC-20 + venue-contract approvals on the venue's
3712
3735
  * chain (Polymarket / Polygon, Limitless / Base, predict.fun / BNB).
3713
- * "venueMarketAta" = Kalshi-on-Solana per-market token-account rent. */
3714
- kind: "chainApproval" | "venueMarketAta";
3736
+ * "venueMarketAta" = Kalshi-on-Solana per-market token-account rent.
3737
+ * "hyperliquidActivation" = Hyperliquid's one-time 1 USDC fee to activate
3738
+ * the user's address on its first deposit; `alreadyPaid` once the address
3739
+ * exists on Hyperliquid. Deducted from the bridged amount, not a step. */
3740
+ kind: "chainApproval" | "venueMarketAta" | "hyperliquidActivation";
3715
3741
  venue: string;
3716
3742
  /** Set when `kind === "chainApproval"`. */
3717
3743
  chainId?: number;
@@ -3724,13 +3750,6 @@ interface SmartRouteSetupCostLine {
3724
3750
  * strike-through "first-time fee" chip rather than charging again. */
3725
3751
  alreadyPaid: boolean;
3726
3752
  }
3727
- interface SmartRouteFeeBreakdown {
3728
- rawExecCost: number;
3729
- venueFees: number;
3730
- bridgeFees: number;
3731
- executionGas: number;
3732
- totalCost: number;
3733
- }
3734
3753
  /** Cost breakdown for a route quote. */
3735
3754
  interface SmartRouteFeeBreakdown {
3736
3755
  rawExecCost: number;
@@ -4215,7 +4234,16 @@ declare class AggClient {
4215
4234
  private notifyListeners;
4216
4235
  /** Get the currently authenticated user, if any. */
4217
4236
  get user(): UserProfile | undefined;
4218
- /** Build an EIP-4361 SIWE message string (pure formatting, no crypto). */
4237
+ /**
4238
+ * Build an EIP-4361 SIWE message string.
4239
+ *
4240
+ * `params.address` is accepted in any casing. EIP-4361 requires the address
4241
+ * line to be EIP-55 checksummed, and wallets commonly return a lowercase one
4242
+ * — `eth_requestAccounts` does — so the checksum is applied here, the way
4243
+ * viem, ethers and `siwe` do inside their own message builders. An address
4244
+ * that is not 20 bytes of hex throws: no message we could build from it
4245
+ * would verify.
4246
+ */
4219
4247
  buildSiweMessage(params: SiweMessageParams): string;
4220
4248
  /** Build a SIWS message string for Solana wallet sign-in (pure formatting, no crypto). */
4221
4249
  buildSiwsMessage(params: SiwsMessageParams): string;
@@ -4733,6 +4761,17 @@ declare class CandleBuilder {
4733
4761
  private markDirty;
4734
4762
  }
4735
4763
 
4764
+ /**
4765
+ * EIP-55 checksum an EVM address.
4766
+ *
4767
+ * Accepts any casing — lowercase, uppercase, or an already-checksummed
4768
+ * address — and returns the canonical mixed-case form. A mixed-case input
4769
+ * with a WRONG checksum is corrected, not rejected: this is a message
4770
+ * builder, and the wallet's signature is what authenticates the address
4771
+ * downstream. Throws only when the input is not a 20-byte hex address at all.
4772
+ */
4773
+ declare function toChecksumAddress(address: string): string;
4774
+
4736
4775
  /**
4737
4776
  * Merge forming candles from matched venues into one aggregate.
4738
4777
  * Open/Close: volume-weighted average (simple average if all v=0).
@@ -4749,4 +4788,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
4749
4788
 
4750
4789
  declare function createAggClient(options: AggClientOptions): AggClient;
4751
4790
 
4752
- 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 };
4791
+ 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 };
package/dist/index.d.ts CHANGED
@@ -8,10 +8,11 @@ declare enum Venue {
8
8
  probable = "probable",
9
9
  myriad = "myriad",
10
10
  hyperliquid = "hyperliquid",
11
- novig = "novig"
11
+ novig = "novig",
12
+ prophetx = "prophetx"
12
13
  }
13
14
  /** Single source of truth for venue identifiers. */
14
- declare const VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.probable, Venue.myriad, Venue.hyperliquid, Venue.novig];
15
+ declare const VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.probable, Venue.myriad, Venue.hyperliquid, Venue.novig, Venue.prophetx];
15
16
  /** Canonical destination chain for venues with on-chain funding or settlement. */
16
17
  declare const VENUE_CHAIN_IDS: Partial<Record<Venue, number>>;
17
18
  /**
@@ -22,32 +23,37 @@ declare const VENUE_CHAIN_IDS: Partial<Record<Venue, number>>;
22
23
  * Re-activating a venue is therefore an intentional code change here rather
23
24
  * than a runtime configuration toggle.
24
25
  */
25
- declare const ACTIVE_VENUES: readonly [Venue.kalshi, Venue.polymarket, Venue.limitless, Venue.opinion, Venue.predict, Venue.probable, Venue.myriad, Venue.hyperliquid];
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
27
  /**
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.
28
+ * Venues excluded from new user-facing activity. Kalshi and Novig have both
29
+ * left this set — each is fully active (data + execution) — leaving ProphetX
30
+ * as the only member.
30
31
  *
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
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
35
39
  * (see `dataVisibleVenues` in `@app/runtime-config`).
36
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
+ *
37
48
  * Membership here does NOT stop ingestion: the Rust engine gates discovery on
38
49
  * credentials, so Novig data keeps flowing into `VenueEvent`/`VenueMarket` and
39
50
  * keeps being matched. This set governs the API read layer and execution only.
40
51
  *
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.
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.
49
55
  */
50
- declare const INACTIVE_VENUES: readonly [Venue.novig];
56
+ declare const INACTIVE_VENUES: readonly [Venue.prophetx];
51
57
  /** Whether a venue may participate in new user-facing activity. */
52
58
  declare function isVenueActive(venue: string): boolean;
53
59
  /** Whether a venue is intentionally retained only for wind-down/history flows. */
@@ -2885,16 +2891,23 @@ interface ExecuteManagedParams {
2885
2891
  signingAddress?: string;
2886
2892
  /**
2887
2893
  * Self-custody only: which approve shape a cross-chain fill uses when the
2888
- * bridge needs an ERC20 approve. Omit (the default) for "sponsored" — we pay
2889
- * the gas, but the wallet must sign a one-time EIP-7702 authorization over a
2890
- * RAW DIGEST, which many wallets cannot produce. Send "user_broadcast" when
2891
- * yours cannot: the user sends the approve and pays their own gas. Only your
2892
- * client can know which applies — it is a property of the wallet software,
2893
- * not of the address or the chain.
2894
+ * bridge needs an ERC20 approve. Omit (the default) for "sponsored" — the
2895
+ * approve costs the wallet no gas, but the wallet must sign a one-time
2896
+ * EIP-7702 authorization over a RAW DIGEST, which many wallets cannot
2897
+ * produce. Send "user_broadcast" when yours cannot: the user sends the
2898
+ * approve from their own wallet and pays its gas. Only your client can know
2899
+ * which applies — it is a property of the wallet software, not of the
2900
+ * address or the chain.
2894
2901
  *
2895
2902
  * Worth surfacing in your UI: "user_broadcast" never establishes the
2896
- * delegation, so it charges gas on EVERY bridge. "sponsored" costs one
2897
- * signature once per chain, then is free.
2903
+ * delegation, so an approve is needed on EVERY bridge. "sponsored" costs one
2904
+ * signature once per chain.
2905
+ *
2906
+ * Neither mode makes bridging free — the approve is only one of the costs.
2907
+ * Relay's fee comes out of the amount delivered on every bridge, and one-time
2908
+ * costs apply per route. Quote with `deepEstimate` and read
2909
+ * `feeBreakdown.bridgeFees` and `feeBreakdown.setupCosts` rather than
2910
+ * inferring cost from the approve mode.
2898
2911
  */
2899
2912
  approveMode?: "sponsored" | "user_broadcast";
2900
2913
  }
@@ -3665,6 +3678,16 @@ interface VenueSoloQuote {
3665
3678
  setupCosts?: SmartRouteSetupCostLine[];
3666
3679
  /** Sum of this solo's `setupCosts` entries where `alreadyPaid=false`. */
3667
3680
  setupCostsTotal?: number;
3681
+ /**
3682
+ * Cost breakdown for executing THIS venue alone. Present when
3683
+ * `status === "ok"`; absent otherwise.
3684
+ *
3685
+ * Read this — not the top-level `feeBreakdown` — when rendering fees for a
3686
+ * single venue. A solo's bridge lanes and venue fee are its own, so a venue
3687
+ * needing no bridge reports `bridgeFees: 0` here even when the multi-route
3688
+ * plan bridged.
3689
+ */
3690
+ feeBreakdown?: SmartRouteFeeBreakdown;
3668
3691
  }
3669
3692
  /** @deprecated Smart-route side overrides are kept only for source compatibility. */
3670
3693
  type SmartRouteSide = "yes" | "no";
@@ -3710,8 +3733,11 @@ interface SmartRouteParams {
3710
3733
  interface SmartRouteSetupCostLine {
3711
3734
  /** "chainApproval" = ERC-20 + venue-contract approvals on the venue's
3712
3735
  * chain (Polymarket / Polygon, Limitless / Base, predict.fun / BNB).
3713
- * "venueMarketAta" = Kalshi-on-Solana per-market token-account rent. */
3714
- kind: "chainApproval" | "venueMarketAta";
3736
+ * "venueMarketAta" = Kalshi-on-Solana per-market token-account rent.
3737
+ * "hyperliquidActivation" = Hyperliquid's one-time 1 USDC fee to activate
3738
+ * the user's address on its first deposit; `alreadyPaid` once the address
3739
+ * exists on Hyperliquid. Deducted from the bridged amount, not a step. */
3740
+ kind: "chainApproval" | "venueMarketAta" | "hyperliquidActivation";
3715
3741
  venue: string;
3716
3742
  /** Set when `kind === "chainApproval"`. */
3717
3743
  chainId?: number;
@@ -3724,13 +3750,6 @@ interface SmartRouteSetupCostLine {
3724
3750
  * strike-through "first-time fee" chip rather than charging again. */
3725
3751
  alreadyPaid: boolean;
3726
3752
  }
3727
- interface SmartRouteFeeBreakdown {
3728
- rawExecCost: number;
3729
- venueFees: number;
3730
- bridgeFees: number;
3731
- executionGas: number;
3732
- totalCost: number;
3733
- }
3734
3753
  /** Cost breakdown for a route quote. */
3735
3754
  interface SmartRouteFeeBreakdown {
3736
3755
  rawExecCost: number;
@@ -4215,7 +4234,16 @@ declare class AggClient {
4215
4234
  private notifyListeners;
4216
4235
  /** Get the currently authenticated user, if any. */
4217
4236
  get user(): UserProfile | undefined;
4218
- /** Build an EIP-4361 SIWE message string (pure formatting, no crypto). */
4237
+ /**
4238
+ * Build an EIP-4361 SIWE message string.
4239
+ *
4240
+ * `params.address` is accepted in any casing. EIP-4361 requires the address
4241
+ * line to be EIP-55 checksummed, and wallets commonly return a lowercase one
4242
+ * — `eth_requestAccounts` does — so the checksum is applied here, the way
4243
+ * viem, ethers and `siwe` do inside their own message builders. An address
4244
+ * that is not 20 bytes of hex throws: no message we could build from it
4245
+ * would verify.
4246
+ */
4219
4247
  buildSiweMessage(params: SiweMessageParams): string;
4220
4248
  /** Build a SIWS message string for Solana wallet sign-in (pure formatting, no crypto). */
4221
4249
  buildSiwsMessage(params: SiwsMessageParams): string;
@@ -4733,6 +4761,17 @@ declare class CandleBuilder {
4733
4761
  private markDirty;
4734
4762
  }
4735
4763
 
4764
+ /**
4765
+ * EIP-55 checksum an EVM address.
4766
+ *
4767
+ * Accepts any casing — lowercase, uppercase, or an already-checksummed
4768
+ * address — and returns the canonical mixed-case form. A mixed-case input
4769
+ * with a WRONG checksum is corrected, not rejected: this is a message
4770
+ * builder, and the wallet's signature is what authenticates the address
4771
+ * downstream. Throws only when the input is not a 20-byte hex address at all.
4772
+ */
4773
+ declare function toChecksumAddress(address: string): string;
4774
+
4736
4775
  /**
4737
4776
  * Merge forming candles from matched venues into one aggregate.
4738
4777
  * Open/Close: volume-weighted average (simple average if all v=0).
@@ -4749,4 +4788,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
4749
4788
 
4750
4789
  declare function createAggClient(options: AggClientOptions): AggClient;
4751
4790
 
4752
- 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 };
4791
+ 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 };
package/dist/index.js CHANGED
@@ -132,7 +132,8 @@ __export(index_exports, {
132
132
  parseEmailStrict: () => parseEmailStrict,
133
133
  safeParse: () => safeParse,
134
134
  snapshotToOrderbook: () => snapshotToOrderbook,
135
- sortVenues: () => sortVenues
135
+ sortVenues: () => sortVenues,
136
+ toChecksumAddress: () => toChecksumAddress
136
137
  });
137
138
  module.exports = __toCommonJS(index_exports);
138
139
 
@@ -147,6 +148,7 @@ var Venue = /* @__PURE__ */ ((Venue3) => {
147
148
  Venue3["myriad"] = "myriad";
148
149
  Venue3["hyperliquid"] = "hyperliquid";
149
150
  Venue3["novig"] = "novig";
151
+ Venue3["prophetx"] = "prophetx";
150
152
  return Venue3;
151
153
  })(Venue || {});
152
154
  var VENUES = [
@@ -158,7 +160,8 @@ var VENUES = [
158
160
  "probable" /* probable */,
159
161
  "myriad" /* myriad */,
160
162
  "hyperliquid" /* hyperliquid */,
161
- "novig" /* novig */
163
+ "novig" /* novig */,
164
+ "prophetx" /* prophetx */
162
165
  ];
163
166
  var VENUE_CHAIN_IDS = {
164
167
  ["kalshi" /* kalshi */]: 792703809,
@@ -166,7 +169,8 @@ var VENUE_CHAIN_IDS = {
166
169
  ["limitless" /* limitless */]: 8453,
167
170
  ["predict" /* predict */]: 56,
168
171
  ["myriad" /* myriad */]: 56,
169
- ["hyperliquid" /* hyperliquid */]: 1337
172
+ ["hyperliquid" /* hyperliquid */]: 1337,
173
+ ["novig" /* novig */]: 792703809
170
174
  };
171
175
  var ACTIVE_VENUES = [
172
176
  "kalshi" /* kalshi */,
@@ -176,10 +180,11 @@ var ACTIVE_VENUES = [
176
180
  "predict" /* predict */,
177
181
  "probable" /* probable */,
178
182
  "myriad" /* myriad */,
179
- "hyperliquid" /* hyperliquid */
183
+ "hyperliquid" /* hyperliquid */,
184
+ "novig" /* novig */
180
185
  ];
181
- var INACTIVE_VENUES = ["novig" /* novig */];
182
- var DEFAULT_DISABLED_VENUES = ["novig" /* novig */];
186
+ var INACTIVE_VENUES = ["prophetx" /* prophetx */];
187
+ var DEFAULT_DISABLED_VENUES = ["novig" /* novig */, "prophetx" /* prophetx */];
183
188
  var ACTIVE_VENUE_SET = new Set(ACTIVE_VENUES);
184
189
  var INACTIVE_VENUE_SET = new Set(INACTIVE_VENUES);
185
190
  function normalizeVenue(venue) {
@@ -821,6 +826,136 @@ function isAggApiError(value) {
821
826
  return value instanceof AggApiError;
822
827
  }
823
828
 
829
+ // src/eip55.ts
830
+ var IOTA_LO = [
831
+ 1,
832
+ 32898,
833
+ 32906,
834
+ 2147516416,
835
+ 32907,
836
+ 2147483649,
837
+ 2147516545,
838
+ 32777,
839
+ 138,
840
+ 136,
841
+ 2147516425,
842
+ 2147483658,
843
+ 2147516555,
844
+ 139,
845
+ 32905,
846
+ 32771,
847
+ 32770,
848
+ 128,
849
+ 32778,
850
+ 2147483658,
851
+ 2147516545,
852
+ 32896,
853
+ 2147483649,
854
+ 2147516424
855
+ ];
856
+ var IOTA_HI = [
857
+ 0,
858
+ 0,
859
+ 2147483648,
860
+ 2147483648,
861
+ 0,
862
+ 0,
863
+ 2147483648,
864
+ 2147483648,
865
+ 0,
866
+ 0,
867
+ 0,
868
+ 0,
869
+ 0,
870
+ 2147483648,
871
+ 2147483648,
872
+ 2147483648,
873
+ 2147483648,
874
+ 2147483648,
875
+ 0,
876
+ 2147483648,
877
+ 2147483648,
878
+ 2147483648,
879
+ 0,
880
+ 2147483648
881
+ ];
882
+ var PI = [];
883
+ var ROTL = [];
884
+ for (let round = 0, x = 1, y = 0; round < 24; round++) {
885
+ [x, y] = [y, (2 * x + 3 * y) % 5];
886
+ PI.push(2 * (5 * y + x));
887
+ ROTL.push((round + 1) * (round + 2) / 2 % 64);
888
+ }
889
+ var rotlLo = (lo, hi, s) => s > 32 ? hi << s - 32 | lo >>> 64 - s : lo << s | hi >>> 32 - s;
890
+ var rotlHi = (lo, hi, s) => s > 32 ? lo << s - 32 | hi >>> 64 - s : hi << s | lo >>> 32 - s;
891
+ function keccakP(s) {
892
+ const B = new Uint32Array(10);
893
+ for (let round = 0; round < 24; round++) {
894
+ for (let x = 0; x < 10; x++) B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
895
+ for (let x = 0; x < 10; x += 2) {
896
+ const idx1 = (x + 8) % 10;
897
+ const idx0 = (x + 2) % 10;
898
+ const B0 = B[idx0];
899
+ const B1 = B[idx0 + 1];
900
+ const Tlo = rotlLo(B0, B1, 1) ^ B[idx1];
901
+ const Thi = rotlHi(B0, B1, 1) ^ B[idx1 + 1];
902
+ for (let y = 0; y < 50; y += 10) {
903
+ s[x + y] ^= Tlo;
904
+ s[x + y + 1] ^= Thi;
905
+ }
906
+ }
907
+ let curLo = s[2];
908
+ let curHi = s[3];
909
+ for (let t = 0; t < 24; t++) {
910
+ const shift = ROTL[t];
911
+ const Tlo = rotlLo(curLo, curHi, shift);
912
+ const Thi = rotlHi(curLo, curHi, shift);
913
+ const pi = PI[t];
914
+ curLo = s[pi];
915
+ curHi = s[pi + 1];
916
+ s[pi] = Tlo;
917
+ s[pi + 1] = Thi;
918
+ }
919
+ for (let y = 0; y < 50; y += 10) {
920
+ for (let x = 0; x < 10; x++) B[x] = s[y + x];
921
+ for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
922
+ }
923
+ s[0] ^= IOTA_LO[round];
924
+ s[1] ^= IOTA_HI[round];
925
+ }
926
+ }
927
+ var RATE = 136;
928
+ function keccak256(data) {
929
+ const s = new Uint32Array(50);
930
+ let pos = 0;
931
+ for (let i = 0; i < data.length; i++) {
932
+ s[pos >> 2] ^= data[i] << (pos & 3) * 8;
933
+ if (++pos === RATE) {
934
+ keccakP(s);
935
+ pos = 0;
936
+ }
937
+ }
938
+ s[pos >> 2] ^= 1 << (pos & 3) * 8;
939
+ s[RATE - 1 >> 2] ^= 128 << (RATE - 1 & 3) * 8;
940
+ keccakP(s);
941
+ const out = new Uint8Array(32);
942
+ for (let i = 0; i < 32; i++) out[i] = s[i >> 2] >>> (i & 3) * 8 & 255;
943
+ return out;
944
+ }
945
+ function toChecksumAddress(address) {
946
+ if (!/^0x[0-9a-fA-F]{40}$/.test(address)) {
947
+ throw new Error(`"${address}" is not a 20-byte hex address`);
948
+ }
949
+ const lower = address.slice(2).toLowerCase();
950
+ const hash = keccak256(Uint8Array.from(lower, (c) => c.charCodeAt(0)));
951
+ let out = "0x";
952
+ for (let i = 0; i < 40; i++) {
953
+ const nibble = i % 2 === 0 ? hash[i >> 1] >> 4 : hash[i >> 1] & 15;
954
+ out += nibble >= 8 ? lower[i].toUpperCase() : lower[i];
955
+ }
956
+ return out;
957
+ }
958
+
824
959
  // src/types.ts
825
960
  var SELF_CUSTODY_FILL_TIMEOUT_MS = 5 * 6e4;
826
961
  var SELF_CUSTODY_POLL_INTERVAL_MS = 2e3;
@@ -2184,18 +2319,26 @@ var AggClient = class {
2184
2319
  return this.currentUser;
2185
2320
  }
2186
2321
  // --- SIWE auth ---
2187
- /** Build an EIP-4361 SIWE message string (pure formatting, no crypto). */
2322
+ /**
2323
+ * Build an EIP-4361 SIWE message string.
2324
+ *
2325
+ * `params.address` is accepted in any casing. EIP-4361 requires the address
2326
+ * line to be EIP-55 checksummed, and wallets commonly return a lowercase one
2327
+ * — `eth_requestAccounts` does — so the checksum is applied here, the way
2328
+ * viem, ethers and `siwe` do inside their own message builders. An address
2329
+ * that is not 20 bytes of hex throws: no message we could build from it
2330
+ * would verify.
2331
+ */
2188
2332
  buildSiweMessage(params) {
2189
2333
  var _a, _b;
2190
2334
  const chainId = (_a = params.chainId) != null ? _a : 1;
2191
2335
  const issuedAt = (_b = params.issuedAt) != null ? _b : (/* @__PURE__ */ new Date()).toISOString();
2336
+ const address = toChecksumAddress(params.address);
2192
2337
  let message = `${params.domain} wants you to sign in with your Ethereum account:
2193
- ${params.address}`;
2194
- if (params.statement) {
2195
- message += `
2338
+ ${address}`;
2339
+ message += params.statement ? `
2196
2340
 
2197
- ${params.statement}`;
2198
- }
2341
+ ${params.statement}` : "\n";
2199
2342
  message += `
2200
2343
 
2201
2344
  URI: ${params.uri}
@@ -3699,5 +3842,6 @@ function createAggClient(options) {
3699
3842
  parseEmailStrict,
3700
3843
  safeParse,
3701
3844
  snapshotToOrderbook,
3702
- sortVenues
3845
+ sortVenues,
3846
+ toChecksumAddress
3703
3847
  });
package/dist/index.mjs CHANGED
@@ -16,6 +16,7 @@ var Venue = /* @__PURE__ */ ((Venue3) => {
16
16
  Venue3["myriad"] = "myriad";
17
17
  Venue3["hyperliquid"] = "hyperliquid";
18
18
  Venue3["novig"] = "novig";
19
+ Venue3["prophetx"] = "prophetx";
19
20
  return Venue3;
20
21
  })(Venue || {});
21
22
  var VENUES = [
@@ -27,7 +28,8 @@ var VENUES = [
27
28
  "probable" /* probable */,
28
29
  "myriad" /* myriad */,
29
30
  "hyperliquid" /* hyperliquid */,
30
- "novig" /* novig */
31
+ "novig" /* novig */,
32
+ "prophetx" /* prophetx */
31
33
  ];
32
34
  var VENUE_CHAIN_IDS = {
33
35
  ["kalshi" /* kalshi */]: 792703809,
@@ -35,7 +37,8 @@ var VENUE_CHAIN_IDS = {
35
37
  ["limitless" /* limitless */]: 8453,
36
38
  ["predict" /* predict */]: 56,
37
39
  ["myriad" /* myriad */]: 56,
38
- ["hyperliquid" /* hyperliquid */]: 1337
40
+ ["hyperliquid" /* hyperliquid */]: 1337,
41
+ ["novig" /* novig */]: 792703809
39
42
  };
40
43
  var ACTIVE_VENUES = [
41
44
  "kalshi" /* kalshi */,
@@ -45,10 +48,11 @@ var ACTIVE_VENUES = [
45
48
  "predict" /* predict */,
46
49
  "probable" /* probable */,
47
50
  "myriad" /* myriad */,
48
- "hyperliquid" /* hyperliquid */
51
+ "hyperliquid" /* hyperliquid */,
52
+ "novig" /* novig */
49
53
  ];
50
- var INACTIVE_VENUES = ["novig" /* novig */];
51
- var DEFAULT_DISABLED_VENUES = ["novig" /* novig */];
54
+ var INACTIVE_VENUES = ["prophetx" /* prophetx */];
55
+ var DEFAULT_DISABLED_VENUES = ["novig" /* novig */, "prophetx" /* prophetx */];
52
56
  var ACTIVE_VENUE_SET = new Set(ACTIVE_VENUES);
53
57
  var INACTIVE_VENUE_SET = new Set(INACTIVE_VENUES);
54
58
  function normalizeVenue(venue) {
@@ -690,6 +694,136 @@ function isAggApiError(value) {
690
694
  return value instanceof AggApiError;
691
695
  }
692
696
 
697
+ // src/eip55.ts
698
+ var IOTA_LO = [
699
+ 1,
700
+ 32898,
701
+ 32906,
702
+ 2147516416,
703
+ 32907,
704
+ 2147483649,
705
+ 2147516545,
706
+ 32777,
707
+ 138,
708
+ 136,
709
+ 2147516425,
710
+ 2147483658,
711
+ 2147516555,
712
+ 139,
713
+ 32905,
714
+ 32771,
715
+ 32770,
716
+ 128,
717
+ 32778,
718
+ 2147483658,
719
+ 2147516545,
720
+ 32896,
721
+ 2147483649,
722
+ 2147516424
723
+ ];
724
+ var IOTA_HI = [
725
+ 0,
726
+ 0,
727
+ 2147483648,
728
+ 2147483648,
729
+ 0,
730
+ 0,
731
+ 2147483648,
732
+ 2147483648,
733
+ 0,
734
+ 0,
735
+ 0,
736
+ 0,
737
+ 0,
738
+ 2147483648,
739
+ 2147483648,
740
+ 2147483648,
741
+ 2147483648,
742
+ 2147483648,
743
+ 0,
744
+ 2147483648,
745
+ 2147483648,
746
+ 2147483648,
747
+ 0,
748
+ 2147483648
749
+ ];
750
+ var PI = [];
751
+ var ROTL = [];
752
+ for (let round = 0, x = 1, y = 0; round < 24; round++) {
753
+ [x, y] = [y, (2 * x + 3 * y) % 5];
754
+ PI.push(2 * (5 * y + x));
755
+ ROTL.push((round + 1) * (round + 2) / 2 % 64);
756
+ }
757
+ var rotlLo = (lo, hi, s) => s > 32 ? hi << s - 32 | lo >>> 64 - s : lo << s | hi >>> 32 - s;
758
+ var rotlHi = (lo, hi, s) => s > 32 ? lo << s - 32 | hi >>> 64 - s : hi << s | lo >>> 32 - s;
759
+ function keccakP(s) {
760
+ const B = new Uint32Array(10);
761
+ for (let round = 0; round < 24; round++) {
762
+ for (let x = 0; x < 10; x++) B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
763
+ for (let x = 0; x < 10; x += 2) {
764
+ const idx1 = (x + 8) % 10;
765
+ const idx0 = (x + 2) % 10;
766
+ const B0 = B[idx0];
767
+ const B1 = B[idx0 + 1];
768
+ const Tlo = rotlLo(B0, B1, 1) ^ B[idx1];
769
+ const Thi = rotlHi(B0, B1, 1) ^ B[idx1 + 1];
770
+ for (let y = 0; y < 50; y += 10) {
771
+ s[x + y] ^= Tlo;
772
+ s[x + y + 1] ^= Thi;
773
+ }
774
+ }
775
+ let curLo = s[2];
776
+ let curHi = s[3];
777
+ for (let t = 0; t < 24; t++) {
778
+ const shift = ROTL[t];
779
+ const Tlo = rotlLo(curLo, curHi, shift);
780
+ const Thi = rotlHi(curLo, curHi, shift);
781
+ const pi = PI[t];
782
+ curLo = s[pi];
783
+ curHi = s[pi + 1];
784
+ s[pi] = Tlo;
785
+ s[pi + 1] = Thi;
786
+ }
787
+ for (let y = 0; y < 50; y += 10) {
788
+ for (let x = 0; x < 10; x++) B[x] = s[y + x];
789
+ for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
790
+ }
791
+ s[0] ^= IOTA_LO[round];
792
+ s[1] ^= IOTA_HI[round];
793
+ }
794
+ }
795
+ var RATE = 136;
796
+ function keccak256(data) {
797
+ const s = new Uint32Array(50);
798
+ let pos = 0;
799
+ for (let i = 0; i < data.length; i++) {
800
+ s[pos >> 2] ^= data[i] << (pos & 3) * 8;
801
+ if (++pos === RATE) {
802
+ keccakP(s);
803
+ pos = 0;
804
+ }
805
+ }
806
+ s[pos >> 2] ^= 1 << (pos & 3) * 8;
807
+ s[RATE - 1 >> 2] ^= 128 << (RATE - 1 & 3) * 8;
808
+ keccakP(s);
809
+ const out = new Uint8Array(32);
810
+ for (let i = 0; i < 32; i++) out[i] = s[i >> 2] >>> (i & 3) * 8 & 255;
811
+ return out;
812
+ }
813
+ function toChecksumAddress(address) {
814
+ if (!/^0x[0-9a-fA-F]{40}$/.test(address)) {
815
+ throw new Error(`"${address}" is not a 20-byte hex address`);
816
+ }
817
+ const lower = address.slice(2).toLowerCase();
818
+ const hash = keccak256(Uint8Array.from(lower, (c) => c.charCodeAt(0)));
819
+ let out = "0x";
820
+ for (let i = 0; i < 40; i++) {
821
+ const nibble = i % 2 === 0 ? hash[i >> 1] >> 4 : hash[i >> 1] & 15;
822
+ out += nibble >= 8 ? lower[i].toUpperCase() : lower[i];
823
+ }
824
+ return out;
825
+ }
826
+
693
827
  // src/types.ts
694
828
  var SELF_CUSTODY_FILL_TIMEOUT_MS = 5 * 6e4;
695
829
  var SELF_CUSTODY_POLL_INTERVAL_MS = 2e3;
@@ -2053,18 +2187,26 @@ var AggClient = class {
2053
2187
  return this.currentUser;
2054
2188
  }
2055
2189
  // --- SIWE auth ---
2056
- /** Build an EIP-4361 SIWE message string (pure formatting, no crypto). */
2190
+ /**
2191
+ * Build an EIP-4361 SIWE message string.
2192
+ *
2193
+ * `params.address` is accepted in any casing. EIP-4361 requires the address
2194
+ * line to be EIP-55 checksummed, and wallets commonly return a lowercase one
2195
+ * — `eth_requestAccounts` does — so the checksum is applied here, the way
2196
+ * viem, ethers and `siwe` do inside their own message builders. An address
2197
+ * that is not 20 bytes of hex throws: no message we could build from it
2198
+ * would verify.
2199
+ */
2057
2200
  buildSiweMessage(params) {
2058
2201
  var _a, _b;
2059
2202
  const chainId = (_a = params.chainId) != null ? _a : 1;
2060
2203
  const issuedAt = (_b = params.issuedAt) != null ? _b : (/* @__PURE__ */ new Date()).toISOString();
2204
+ const address = toChecksumAddress(params.address);
2061
2205
  let message = `${params.domain} wants you to sign in with your Ethereum account:
2062
- ${params.address}`;
2063
- if (params.statement) {
2064
- message += `
2206
+ ${address}`;
2207
+ message += params.statement ? `
2065
2208
 
2066
- ${params.statement}`;
2067
- }
2209
+ ${params.statement}` : "\n";
2068
2210
  message += `
2069
2211
 
2070
2212
  URI: ${params.uri}
@@ -3567,5 +3709,6 @@ export {
3567
3709
  parseEmailStrict,
3568
3710
  safeParse,
3569
3711
  snapshotToOrderbook,
3570
- sortVenues
3712
+ sortVenues,
3713
+ toChecksumAddress
3571
3714
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/sdk",
3
- "version": "4.7.0",
3
+ "version": "4.7.4",
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",