@metamask-previews/perps-controller 26.2.0-preview-2cd622db9 → 26.2.0-preview-53b9b7d11
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/CHANGELOG.md +12 -1
- package/dist/PerpsController-method-action-types.d.ts +11 -1
- package/dist/PerpsController-method-action-types.d.ts.map +1 -1
- package/dist/PerpsController-method-action-types.js.map +1 -1
- package/dist/PerpsController.d.ts +8 -1
- package/dist/PerpsController.d.ts.map +1 -1
- package/dist/PerpsController.js +45 -13
- package/dist/PerpsController.js.map +1 -1
- package/dist/aggregation/SubscriptionMultiplexer.d.ts.map +1 -1
- package/dist/aggregation/SubscriptionMultiplexer.js +10 -2
- package/dist/aggregation/SubscriptionMultiplexer.js.map +1 -1
- package/dist/constants/eventNames.d.ts +2 -0
- package/dist/constants/eventNames.d.ts.map +1 -1
- package/dist/constants/eventNames.js +3 -0
- package/dist/constants/eventNames.js.map +1 -1
- package/dist/constants/lighterConfig.d.ts +11 -0
- package/dist/constants/lighterConfig.d.ts.map +1 -1
- package/dist/constants/lighterConfig.js +11 -0
- package/dist/constants/lighterConfig.js.map +1 -1
- package/dist/constants/perpsConfig.d.ts +6 -0
- package/dist/constants/perpsConfig.d.ts.map +1 -1
- package/dist/constants/perpsConfig.js +6 -0
- package/dist/constants/perpsConfig.js.map +1 -1
- package/dist/errors.d.ts +7 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +10 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/perpsErrorCodes.d.ts +1 -0
- package/dist/perpsErrorCodes.d.ts.map +1 -1
- package/dist/perpsErrorCodes.js +1 -0
- package/dist/perpsErrorCodes.js.map +1 -1
- package/dist/providers/AggregatedPerpsProvider.d.ts +6 -1
- package/dist/providers/AggregatedPerpsProvider.d.ts.map +1 -1
- package/dist/providers/AggregatedPerpsProvider.js +14 -0
- package/dist/providers/AggregatedPerpsProvider.js.map +1 -1
- package/dist/providers/HyperLiquidProvider.d.ts.map +1 -1
- package/dist/providers/HyperLiquidProvider.js +1 -3
- package/dist/providers/HyperLiquidProvider.js.map +1 -1
- package/dist/providers/LighterProvider.d.ts +6 -1
- package/dist/providers/LighterProvider.d.ts.map +1 -1
- package/dist/providers/LighterProvider.js +458 -149
- package/dist/providers/LighterProvider.js.map +1 -1
- package/dist/services/HyperLiquidClientService.d.ts.map +1 -1
- package/dist/services/HyperLiquidClientService.js +13 -1
- package/dist/services/HyperLiquidClientService.js.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.d.ts.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.js +1 -0
- package/dist/services/HyperLiquidSubscriptionService.js.map +1 -1
- package/dist/services/StreamChannelManager.d.ts +12 -2
- package/dist/services/StreamChannelManager.d.ts.map +1 -1
- package/dist/services/StreamChannelManager.js +18 -0
- package/dist/services/StreamChannelManager.js.map +1 -1
- package/dist/types/index.d.ts +21 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/perpsClientCopy.d.ts.map +1 -1
- package/dist/utils/perpsClientCopy.js +4 -0
- package/dist/utils/perpsClientCopy.js.map +1 -1
- package/docs/architecture.md +5 -4
- package/docs/venues/lighter/api-keys.md +8 -0
- package/package.json +3 -3
|
@@ -223,6 +223,17 @@ export const LIGHTER_RECONNECT_BASE_DELAY_MS = 1_000;
|
|
|
223
223
|
export const LIGHTER_RECONNECT_MAX_DELAY_MS = 30_000;
|
|
224
224
|
/** How long the socket may stay down with listeners before health degrades. */
|
|
225
225
|
export const LIGHTER_SOCKET_DOWN_GRACE_MS = 10_000;
|
|
226
|
+
/** Bounded discovery while Lighter account streams await a first deposit. */
|
|
227
|
+
export const LIGHTER_ACCOUNT_DISCOVERY_CONFIG = {
|
|
228
|
+
InitialIntervalMs: 3_000,
|
|
229
|
+
MaxIntervalMs: 15_000,
|
|
230
|
+
DeadlineMs: 180_000,
|
|
231
|
+
};
|
|
232
|
+
/** Bounded re-mint when a reconnect fails to re-subscribe the orders channel. */
|
|
233
|
+
export const LIGHTER_ORDERS_RESUBSCRIBE_RETRY = {
|
|
234
|
+
DelayMs: 5_000,
|
|
235
|
+
MaxAttempts: 3,
|
|
236
|
+
};
|
|
226
237
|
/**
|
|
227
238
|
* Maximum leverage placeholder until per-market margin fractions are wired.
|
|
228
239
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lighterConfig.js","sourceRoot":"","sources":["../../src/constants/lighterConfig.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAC5C,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAuB;IACvD,OAAO,OAAO,KAAK,SAAS;QAC1B,CAAC,CAAC,wBAAwB;QAC1B,CAAC,CAAC,wBAAwB,CAAC;AAC/B,CAAC;AAED,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqB;IACjD,OAAO,EAAE;QACP,IAAI,EAAE,qCAAqC;QAC3C,EAAE,EAAE,0CAA0C;KAC/C;IACD,OAAO,EAAE;QACP,IAAI,EAAE,iCAAiC;QACvC,EAAE,EAAE,sCAAsC;KAC3C;CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAuB;IAC5D,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;AACzC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAuB;IAC1D,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC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C;AAEhE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,uCAAuC,GAAG,GAAG,CAAC;AAE3D,8DAA8D;AAC9D,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC;AACxD,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC;AACxD,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,kCAAkC,GAAG,GAAG,CAAC;AACtD,MAAM,CAAC,MAAM,6BAA6B,GAAG,KAAK,CAAC;AACnD,MAAM,CAAC,MAAM,6BAA6B,GAAG,OAAO,CAAC;AACrD,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAC/C,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAC;AACrD,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,CAAC;AACpD,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAEnD,gEAAgE;AAChE,MAAM,CAAC,MAAM,kCAAkC,GAAG,KAAK,CAAC","sourcesContent":["/**\n * Lighter Protocol Configuration Constants\n *\n * Endpoints, chain ids, transaction type codes and signer defaults for the\n * zkLighter integration. Values verified against the public API\n * (https://apidocs.lighter.xyz) and lighter-python `endpoint_profiles.py`.\n */\n\nimport type {\n LighterEndpoints,\n LighterNetwork,\n LighterOrderBookMeta,\n} from '../types/lighter-types.js';\n\n// ============================================================================\n// Network Constants\n// ============================================================================\n\n/**\n * zkLighter L2 chain ids (protocol-level, not EVM chain ids).\n */\nexport const LIGHTER_MAINNET_CHAIN_ID = 304;\nexport const LIGHTER_TESTNET_CHAIN_ID = 300;\n\n/**\n * Get the zkLighter chain id for a network.\n *\n * @param network - The Lighter network environment (mainnet or testnet).\n * @returns The zkLighter chain id for the specified network.\n */\nexport function getLighterChainId(network: LighterNetwork): number {\n return network === 'testnet'\n ? LIGHTER_TESTNET_CHAIN_ID\n : LIGHTER_MAINNET_CHAIN_ID;\n}\n\n// ============================================================================\n// API Endpoints\n// ============================================================================\n\n/**\n * Lighter REST and WebSocket endpoints\n */\nexport const LIGHTER_ENDPOINTS: LighterEndpoints = {\n mainnet: {\n http: 'https://mainnet.zklighter.elliot.ai',\n ws: 'wss://mainnet.zklighter.elliot.ai/stream',\n },\n testnet: {\n http: 'https://api.testnet.lighter.xyz',\n ws: 'wss://api.testnet.lighter.xyz/stream',\n },\n};\n\n/**\n * Get HTTP endpoint for a network.\n *\n * @param network - The Lighter network environment (mainnet or testnet).\n * @returns The HTTP API base URL for the specified network.\n */\nexport function getLighterHttpEndpoint(network: LighterNetwork): string {\n return LIGHTER_ENDPOINTS[network].http;\n}\n\n/**\n * Get the WebSocket stream endpoint for a network.\n *\n * @param network - The Lighter network environment (mainnet or testnet).\n * @returns The WebSocket stream URL for the specified network.\n */\nexport function getLighterWsEndpoint(network: LighterNetwork): string {\n return LIGHTER_ENDPOINTS[network].ws;\n}\n\n/** L2 transaction type: Transfer (funds move to another Lighter account). */\nexport const LIGHTER_TX_TYPE_TRANSFER = 12;\n\n/** L2 transaction type: Withdraw (funds exit to L1). */\nexport const LIGHTER_TX_TYPE_WITHDRAW = 13;\n\n/** L2 transaction type: ModifyOrder (reprice/resize a resting order). */\nexport const LIGHTER_TX_TYPE_MODIFY_ORDER = 17;\n\n/** USDC collateral asset index on zkLighter (asset indexing starts at 1). */\nexport const LIGHTER_USDC_ASSET_INDEX = 1;\n\n/**\n * Candle resolutions Lighter serves natively (subset of CandlePeriod values).\n */\nexport const LIGHTER_SUPPORTED_RESOLUTIONS: ReadonlySet<string> = new Set([\n '1m',\n '5m',\n '15m',\n '30m',\n '1h',\n '4h',\n '12h',\n '1d',\n]);\n\n/**\n * Millisecond span per supported resolution (range computation for candles).\n */\nexport const LIGHTER_RESOLUTION_MS: Record<string, number> = {\n '1m': 60_000,\n '5m': 300_000,\n '15m': 900_000,\n '30m': 1_800_000,\n '1h': 3_600_000,\n '4h': 14_400_000,\n '12h': 43_200_000,\n '1d': 86_400_000,\n};\n\n// ============================================================================\n// L2 Transaction Types (types/txtypes/constants.go)\n// ============================================================================\n\nexport const LIGHTER_TX_TYPE_CHANGE_PUB_KEY = 8;\nexport const LIGHTER_TX_TYPE_CREATE_ORDER = 14;\nexport const LIGHTER_TX_TYPE_CANCEL_ORDER = 15;\nexport const LIGHTER_TX_TYPE_CANCEL_ALL_ORDERS = 16;\n\n/** Documented Lighter transaction status values. */\nexport const LIGHTER_TRANSACTION_STATUS = {\n Failed: 0,\n Pending: 1,\n Executed: 2,\n PendingFinal: 3,\n} as const;\n\nexport type LighterTransactionOutcome =\n | 'failed'\n | 'pending'\n | 'executed'\n | 'pending-final';\n\n/**\n * Decode the venue transaction status without treating undocumented values\n * as terminal.\n *\n * @param status - Raw status from the transaction endpoint.\n * @returns The documented outcome, or null for an unknown value.\n */\nexport function getLighterTransactionOutcome(\n status: unknown,\n): LighterTransactionOutcome | null {\n switch (status) {\n case LIGHTER_TRANSACTION_STATUS.Failed:\n return 'failed';\n case LIGHTER_TRANSACTION_STATUS.Pending:\n return 'pending';\n case LIGHTER_TRANSACTION_STATUS.Executed:\n return 'executed';\n case LIGHTER_TRANSACTION_STATUS.PendingFinal:\n return 'pending-final';\n default:\n return null;\n }\n}\n\n// ============================================================================\n// Order enums (wire values expected by `_signCreateOrder`)\n// ============================================================================\n\n/** The pinned signer represents execution and trigger prices as uint32. */\nexport const LIGHTER_MAX_WIRE_PRICE = 4_294_967_295;\n\nexport const LIGHTER_ORDER_TYPE_LIMIT = 0;\nexport const LIGHTER_ORDER_TYPE_MARKET = 1;\nexport const LIGHTER_ORDER_TYPE_STOP_LOSS = 2;\nexport const LIGHTER_ORDER_TYPE_STOP_LOSS_LIMIT = 3;\nexport const LIGHTER_ORDER_TYPE_TAKE_PROFIT = 4;\nexport const LIGHTER_ORDER_TYPE_TAKE_PROFIT_LIMIT = 5;\n\n/** Native parent plus one attached child (OTO). */\nexport const LIGHTER_GROUPING_ONE_TRIGGERS_THE_OTHER = 1;\n/** Native parent plus mutually cancelling attached children (OTOCO). */\nexport const LIGHTER_GROUPING_ONE_TRIGGERS_OCO = 3;\n\n/** Grouped-orders grouping type: one-cancels-the-other (OCO). */\nexport const LIGHTER_GROUPING_ONE_CANCELS_THE_OTHER = 2;\n\n/** L2 transaction type: CreateGroupedOrders (e.g. OCO TP/SL pairs). */\nexport const LIGHTER_TX_TYPE_CREATE_GROUPED_ORDERS = 28;\n\n/** L2 transaction type: UpdateMargin (isolated margin add/remove). */\nexport const LIGHTER_TX_TYPE_UPDATE_MARGIN = 29;\n\n/** L2 transaction type: UpdateLeverage (per-market IMF + margin mode). */\nexport const LIGHTER_TX_TYPE_UPDATE_LEVERAGE = 20;\n\nexport const LIGHTER_TIME_IN_FORCE_IMMEDIATE_OR_CANCEL = 0;\nexport const LIGHTER_TIME_IN_FORCE_GOOD_TILL_TIME = 1;\nexport const LIGHTER_TIME_IN_FORCE_POST_ONLY = 2;\n\n/** Default pending expiry for GTT and trigger orders (per lighter SDKs). */\nexport const LIGHTER_ORDER_EXPIRY_NONE = -1;\n/** Sentinel for \"no trigger price\". */\nexport const LIGHTER_NO_TRIGGER_PRICE = 0;\n\n// ============================================================================\n// Signer / key derivation\n// ============================================================================\n\n/**\n * Default API key slot used by the MetaMask integration.\n * Slots 0-2 are commonly used by Lighter's own frontends; a dedicated\n * slot avoids clobbering keys registered by other clients.\n */\nexport const LIGHTER_DEFAULT_API_KEY_INDEX = 7;\n/** Inclusive venue range available for trading API keys. */\nexport const LIGHTER_MIN_TRADING_API_KEY_INDEX = 2;\nexport const LIGHTER_MAX_TRADING_API_KEY_INDEX = 254;\n/** Bounded number of trading slots scanned for account-local recovery state. */\nexport const LIGHTER_TRADING_API_KEY_COUNT =\n LIGHTER_MAX_TRADING_API_KEY_INDEX - LIGHTER_MIN_TRADING_API_KEY_INDEX + 1;\n/** Bound registration visibility reads before returning a retryable failure. */\nexport const LIGHTER_KEY_REGISTRATION_VISIBILITY_TIMEOUT_MS = 10_000;\nexport const LIGHTER_KEY_REGISTRATION_VISIBILITY_POLL_MS = 250;\nexport const LIGHTER_KEY_REGISTRATION_VISIBILITY_MAX_ATTEMPTS =\n LIGHTER_KEY_REGISTRATION_VISIBILITY_TIMEOUT_MS /\n LIGHTER_KEY_REGISTRATION_VISIBILITY_POLL_MS;\n/** Maximum newest-first complete fill history retained for late subscribers. */\nexport const LIGHTER_FILL_REPLAY_LIMIT = 100;\n\n// ============================================================================\n// REST API Configuration\n// ============================================================================\n\n/**\n * HTTP request timeout in milliseconds\n */\nexport const LIGHTER_HTTP_TIMEOUT_MS = 10000;\n\n/**\n * Most trades `GET /api/v1/recentTrades` returns; a larger `limit` is rejected.\n */\nexport const LIGHTER_RECENT_TRADES_MAX_LIMIT = 100;\n\n/**\n * Interval for polling REST prices (no WS subscription in the POC)\n */\nexport const LIGHTER_PRICE_POLLING_INTERVAL_MS = 5000;\n\n/**\n * Standard-account REST budget: Lighter allows 60 requests per minute per IP\n * and per L1 address, and answers 429 or 405 above it.\n */\nexport const LIGHTER_REST_REQUESTS_PER_MINUTE = 60;\n\n/** Sliding window the REST budget is counted over. */\nexport const LIGHTER_REST_BUDGET_WINDOW_MS = 60_000;\n\n/** First cooldown after a 429/405 without Retry-After; doubles per strike. */\nexport const LIGHTER_RATE_LIMIT_BASE_COOLDOWN_MS = 1_000;\n\n/** Longest cooldown after repeated 429/405 responses. */\nexport const LIGHTER_RATE_LIMIT_MAX_COOLDOWN_MS = 60_000;\n\n/** Consecutive 5xx responses after which Lighter health reports degraded. */\nexport const LIGHTER_SERVER_ERROR_DEGRADED_THRESHOLD = 3;\n\n// ============================================================================\n// WebSocket stream lifecycle\n// ============================================================================\n\n/**\n * Wait after a channel's last listener leaves before unsubscribing it, so\n * quick back-and-forth between markets does not churn frames (Lighter counts\n * them against 200 messages per minute per IP).\n */\nexport const LIGHTER_CHANNEL_RELEASE_DELAY_MS = 5_000;\n\n/** Default time the shared socket stays open after its last listener leaves. */\nexport const LIGHTER_SOCKET_IDLE_CLOSE_MS = 30_000;\n\n/** First reconnect delay after the socket drops; doubles per attempt. */\nexport const LIGHTER_RECONNECT_BASE_DELAY_MS = 1_000;\n\n/** Longest reconnect delay. */\nexport const LIGHTER_RECONNECT_MAX_DELAY_MS = 30_000;\n\n/** How long the socket may stay down with listeners before health degrades. */\nexport const LIGHTER_SOCKET_DOWN_GRACE_MS = 10_000;\n\n/**\n * Maximum leverage placeholder until per-market margin fractions are wired.\n */\nexport const LIGHTER_MAX_LEVERAGE = 50;\n\n/**\n * TTL for the authoritative per-market margin-metadata cache used by\n * explicit leverage validation. Without expiry, metadata fetched once\n * (e.g. an older, higher max) would keep validating later-overlimit\n * leverage for the whole session; the venue cap remains the final\n * enforcement either way.\n */\nexport const LIGHTER_MARGIN_METADATA_TTL_MS = 60_000;\n\n/**\n * Prefix marking venue-data integrity failures (malformed numeric fields\n * in venue payloads). These must fail closed and surface — never degrade\n * into silently-coerced values or empty reads.\n */\nexport const LIGHTER_DATA_INTEGRITY_PREFIX = 'Invalid Lighter venue data:';\n\n/** Full-string decimal/scientific literal (optional sign and exponent). */\nconst LIGHTER_STRICT_DECIMAL_PATTERN =\n /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?$/u;\n\n/**\n * Parse a numeric string STRICTLY: the entire trimmed string must be a\n * decimal/scientific literal. parseFloat prefix-parses, so '0.1oops'\n * would silently become 0.1.\n *\n * Accepts unknown because venue REST payloads are type-cast without\n * runtime validation: a missing/null/numeric field must yield null (for\n * the caller's explicit error path), never a TypeError that generic\n * catches misclassify as an ordinary read failure.\n *\n * Note: '1e999' matches the literal pattern and parses to Infinity —\n * callers own the finiteness check.\n *\n * @param value - Raw value from params or a venue payload.\n * @returns The parsed number, or null when the value is not a string\n * containing a pure numeric literal.\n */\nexport function parseLighterStrictDecimal(value: unknown): number | null {\n if (typeof value !== 'string') {\n return null;\n }\n const trimmed = value.trim();\n return LIGHTER_STRICT_DECIMAL_PATTERN.test(trimmed)\n ? parseFloat(trimmed)\n : null;\n}\n\n// ============================================================================\n// Size / price integerization\n// ============================================================================\n\n/**\n * Convert a human-readable amount to the integer representation expected by\n * the Lighter signer for a given number of supported decimals.\n *\n * @param value - Human-readable amount (e.g. 0.05 SOL, 187.25 USDC).\n * @param decimals - `supportedSizeDecimals` / `supportedPriceDecimals`\n * from the market metadata.\n * @returns Integer wire value (e.g. 0.05 @ 5 decimals -> 5000).\n */\nexport function toLighterInteger(value: number, decimals: number): number {\n const scaled = Math.round(value * 10 ** decimals);\n // Fail closed on wire-format overflow: a huge-but-finite value scales to\n // an unsafe integer (or Infinity) and would stringify as '1e+305' inside\n // signer params.\n if (!Number.isSafeInteger(scaled)) {\n throw new Error(\n `Value ${value} is outside Lighter's integer range at ${decimals} decimals`,\n );\n }\n // NOTE: this is a generic converter — zero and negative results are\n // valid here. Positive-intent policy for signer-bound values lives in\n // the provider's internal wire wrapper.\n return scaled;\n}\n\n/**\n * Convert an integer wire value back to a human-readable amount.\n *\n * @param value - Integer wire value.\n * @param decimals - Supported decimals from the market metadata.\n * @returns Human-readable amount.\n */\nexport function fromLighterInteger(value: number, decimals: number): number {\n return value / 10 ** decimals;\n}\n\n/**\n * Check the size precision accepted by the maker sizing calculation.\n *\n * @param decimals - Venue size decimals.\n * @returns Whether the value can be used as a size precision.\n */\nexport function isLighterOrderSizeDecimals(decimals: number): boolean {\n // Number.toFixed accepts up to 100 fractional digits.\n return Number.isSafeInteger(decimals) && decimals >= 0 && decimals <= 100;\n}\n\n/**\n * Read both maker minimums as a pair. Sizing requires both values.\n *\n * @param market - Market metadata from `orderBooks`.\n * @returns The parsed minimums, or null when either is invalid.\n */\nexport function getLighterMakerMinimums(\n market: Pick<LighterOrderBookMeta, 'minBaseAmount' | 'minQuoteAmount'>,\n): { minBase: number; minQuote: number } | null {\n const minBase = parseLighterStrictDecimal(market.minBaseAmount);\n const minQuote = parseLighterStrictDecimal(market.minQuoteAmount);\n if (\n minBase === null ||\n !Number.isFinite(minBase) ||\n minBase <= 0 ||\n minQuote === null ||\n !Number.isFinite(minQuote) ||\n minQuote <= 0\n ) {\n return null;\n }\n return { minBase, minQuote };\n}\n\n/**\n * Compute the minimum order base size for a market that satisfies both\n * `minBaseAmount` and `minQuoteAmount` at a given price.\n *\n * @param market - Market metadata from `orderBooks`.\n * @param price - Order price (human units).\n * @returns Base size in human units, rounded up to the market's size step.\n */\nexport function computeLighterMinOrderSize(\n market: Pick<\n LighterOrderBookMeta,\n 'minBaseAmount' | 'minQuoteAmount' | 'supportedSizeDecimals'\n >,\n price: number,\n): number {\n const minimums = getLighterMakerMinimums(market);\n if (\n minimums === null ||\n !Number.isFinite(price) ||\n price <= 0 ||\n !isLighterOrderSizeDecimals(market.supportedSizeDecimals)\n ) {\n throw new Error(\n `${LIGHTER_DATA_INTEGRITY_PREFIX} invalid market minimum-size metadata`,\n );\n }\n const { minBase, minQuote } = minimums;\n const step = 10 ** -market.supportedSizeDecimals;\n const byQuote = minQuote / price;\n const raw = Math.max(minBase, byQuote);\n // Small epsilon guards against float artifacts (0.1 / 1e-5 = 10000.0000002)\n // pushing the ceil one step too high.\n const units = Math.ceil(raw / step - 1e-9);\n return Number((units * step).toFixed(market.supportedSizeDecimals));\n}\n\n/**\n * L1 bridge facts per network, as reported live by\n * `GET /api/v1/layer1BasicInfo` (contract addresses) and the venue docs\n * (minimums). Mainnet settles against Ethereum L1; testnet runs on a\n * venue-hosted devnet L1 (chain id 123456), so its route is informational.\n */\nexport const LIGHTER_BRIDGE_CONFIG = {\n mainnet: {\n /** CAIP-2 chain the bridge contract lives on (Ethereum mainnet). */\n chainId: 'eip155:1',\n /** ZkLighter L1 contract (deposits via `deposit`, selector 0x8a857083). */\n bridgeContract: '0x3B4D794a66304F130a4Db8F2551B0070dfCf5ca7',\n /** Canonical Ethereum USDC. */\n usdcContract: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',\n /** Venue-documented USDC minimums. */\n minDepositUsdc: '1',\n minWithdrawUsdc: '1',\n },\n testnet: {\n chainId: 'eip155:123456',\n bridgeContract: '0xe034801BC49cCDC79FB683022dA0591C86077261',\n usdcContract: '0x57382a12EC72eBb1e717b7BB76c78CdDAfE3A396',\n minDepositUsdc: '1',\n minWithdrawUsdc: '1',\n },\n} as const;\n\n/** UpdateLeverage margin-mode codes (types/txtypes constants). */\nexport const LIGHTER_MARGIN_MODE_CROSS = 0;\nexport const LIGHTER_MARGIN_MODE_ISOLATED = 1;\n\n/**\n * Marker prefix for capability-gate errors (unsupported account tier /\n * unverified fee semantics). Callers use it to surface these explicitly\n * instead of degrading them into empty state.\n */\nexport const LIGHTER_UNSUPPORTED_CAPABILITY_PREFIX =\n 'Unsupported Lighter capability:';\n\n/** Maximum verified venue accounts remembered per wallet/network for recovery inventory. */\nexport const LIGHTER_RECOVERY_ACCOUNT_INDEX_LIMIT = 64;\n\n/** Clock slack for signed transaction expiry and venue trade provenance. */\nexport const LIGHTER_TX_EXPIRY_SLACK_MS = 30_000;\n\n/** Fixed native wire bounds and bounded probe inventory limits. */\nexport const LIGHTER_MAX_MARKET_ID = 65535;\nexport const LIGHTER_MAX_BASE_AMOUNT = '281474976710655';\n/** Inclusive uint48 client-order identity bound. */\nexport const LIGHTER_MAX_CLIENT_ORDER_INDEX = '281474976710655';\n/**\n * Bits 47..32 of the client order index of MetaMask stop loss and take profit\n * orders. notify-perps decodes the same value from fills, so it must not change.\n */\nexport const LIGHTER_METAMASK_TAG_PREFIX = 0xa5c3;\nexport const LIGHTER_MAX_ORDER_PRICE = '4294967295';\nexport const LIGHTER_MAX_ORDER_ID = '1152921504606846975';\nexport const LIGHTER_MAX_DECIMALS = 255;\nexport const LIGHTER_MINUTE_MS = 60_000;\nexport const LIGHTER_NATIVE_PROBE_RECORD_LIMIT = 64;\nexport const LIGHTER_NATIVE_PROBE_CANCEL_LIMIT = 16;\nexport const LIGHTER_NATIVE_PROBE_PAGE_LIMIT = 100;\nexport const LIGHTER_NATIVE_PROBE_PAGE_SIZE = 100;\nexport const LIGHTER_CLIENT_ORDER_LOOKUP_LIMIT = 20;\n\n/** Shared bounded testnet native-probe notional ceiling, in USD. */\nexport const LIGHTER_NATIVE_PROBE_MAX_NOTIONAL = 20;\n\n/** Settlement budget shared by every cancellation in one Scale group. */\nexport const LIGHTER_SCALE_SETTLEMENT_WINDOW_MS = 10_000;\n\n/** Read-only Scale visibility cadence, also used after each placement. */\nexport const LIGHTER_SCALE_SETTLEMENT_POLL_MS = 250;\n\n/** Read-only settlement budget after an exact Chase cancellation dispatch. */\nexport const LIGHTER_CHASE_CANCEL_SETTLEMENT_WINDOW_MS = 10_000;\n\n/** Delay between exact Chase child reads, without another sign or send. */\nexport const LIGHTER_CHASE_CANCEL_SETTLEMENT_POLL_MS = 250;\n\n/** Bounded Chase policy, distinct from native wire limits. */\nexport const LIGHTER_CHASE_DEFAULT_INTERVAL_MS = 15_000;\nexport const LIGHTER_CHASE_DEFAULT_DURATION_MS = 60_000;\nexport const LIGHTER_CHASE_DEFAULT_REPRICINGS = 1;\nexport const LIGHTER_CHASE_DEFAULT_DISTANCE_BPS = 100;\nexport const LIGHTER_CHASE_MIN_INTERVAL_MS = 1_000;\nexport const LIGHTER_CHASE_MAX_DURATION_MS = 300_000;\nexport const LIGHTER_CHASE_MAX_REPRICINGS = 20;\nexport const LIGHTER_CHASE_MAX_DISTANCE_BPS = 10_000;\nexport const LIGHTER_CHASE_QUOTE_MAX_AGE_MS = 5_000;\nexport const LIGHTER_CHASE_HANDLE_MAX_LENGTH = 128;\n\n/** Maximum duration of a post-only crossing-check book read. */\nexport const LIGHTER_POST_ONLY_QUOTE_MAX_AGE_MS = 5_000;\n"]}
|
|
1
|
+
{"version":3,"file":"lighterConfig.js","sourceRoot":"","sources":["../../src/constants/lighterConfig.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,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,GAAG,CAAC;AACtD,MAAM,CAAC,MAAM,6BAA6B,GAAG,KAAK,CAAC;AACnD,MAAM,CAAC,MAAM,6BAA6B,GAAG,OAAO,CAAC;AACrD,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAC/C,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAC;AACrD,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,CAAC;AACpD,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAEnD,gEAAgE;AAChE,MAAM,CAAC,MAAM,kCAAkC,GAAG,KAAK,CAAC","sourcesContent":["/**\n * Lighter Protocol Configuration Constants\n *\n * Endpoints, chain ids, transaction type codes and signer defaults for the\n * zkLighter integration. Values verified against the public API\n * (https://apidocs.lighter.xyz) and lighter-python `endpoint_profiles.py`.\n */\n\nimport type {\n LighterEndpoints,\n LighterNetwork,\n LighterOrderBookMeta,\n} from '../types/lighter-types.js';\n\n// ============================================================================\n// Network Constants\n// ============================================================================\n\n/**\n * zkLighter L2 chain ids (protocol-level, not EVM chain ids).\n */\nexport const LIGHTER_MAINNET_CHAIN_ID = 304;\nexport const LIGHTER_TESTNET_CHAIN_ID = 300;\n\n/**\n * Get the zkLighter chain id for a network.\n *\n * @param network - The Lighter network environment (mainnet or testnet).\n * @returns The zkLighter chain id for the specified network.\n */\nexport function getLighterChainId(network: LighterNetwork): number {\n return network === 'testnet'\n ? LIGHTER_TESTNET_CHAIN_ID\n : LIGHTER_MAINNET_CHAIN_ID;\n}\n\n// ============================================================================\n// API Endpoints\n// ============================================================================\n\n/**\n * Lighter REST and WebSocket endpoints\n */\nexport const LIGHTER_ENDPOINTS: LighterEndpoints = {\n mainnet: {\n http: 'https://mainnet.zklighter.elliot.ai',\n ws: 'wss://mainnet.zklighter.elliot.ai/stream',\n },\n testnet: {\n http: 'https://api.testnet.lighter.xyz',\n ws: 'wss://api.testnet.lighter.xyz/stream',\n },\n};\n\n/**\n * Get HTTP endpoint for a network.\n *\n * @param network - The Lighter network environment (mainnet or testnet).\n * @returns The HTTP API base URL for the specified network.\n */\nexport function getLighterHttpEndpoint(network: LighterNetwork): string {\n return LIGHTER_ENDPOINTS[network].http;\n}\n\n/**\n * Get the WebSocket stream endpoint for a network.\n *\n * @param network - The Lighter network environment (mainnet or testnet).\n * @returns The WebSocket stream URL for the specified network.\n */\nexport function getLighterWsEndpoint(network: LighterNetwork): string {\n return LIGHTER_ENDPOINTS[network].ws;\n}\n\n/** L2 transaction type: Transfer (funds move to another Lighter account). */\nexport const LIGHTER_TX_TYPE_TRANSFER = 12;\n\n/** L2 transaction type: Withdraw (funds exit to L1). */\nexport const LIGHTER_TX_TYPE_WITHDRAW = 13;\n\n/** L2 transaction type: ModifyOrder (reprice/resize a resting order). */\nexport const LIGHTER_TX_TYPE_MODIFY_ORDER = 17;\n\n/** USDC collateral asset index on zkLighter (asset indexing starts at 1). */\nexport const LIGHTER_USDC_ASSET_INDEX = 1;\n\n/**\n * Candle resolutions Lighter serves natively (subset of CandlePeriod values).\n */\nexport const LIGHTER_SUPPORTED_RESOLUTIONS: ReadonlySet<string> = new Set([\n '1m',\n '5m',\n '15m',\n '30m',\n '1h',\n '4h',\n '12h',\n '1d',\n]);\n\n/**\n * Millisecond span per supported resolution (range computation for candles).\n */\nexport const LIGHTER_RESOLUTION_MS: Record<string, number> = {\n '1m': 60_000,\n '5m': 300_000,\n '15m': 900_000,\n '30m': 1_800_000,\n '1h': 3_600_000,\n '4h': 14_400_000,\n '12h': 43_200_000,\n '1d': 86_400_000,\n};\n\n// ============================================================================\n// L2 Transaction Types (types/txtypes/constants.go)\n// ============================================================================\n\nexport const LIGHTER_TX_TYPE_CHANGE_PUB_KEY = 8;\nexport const LIGHTER_TX_TYPE_CREATE_ORDER = 14;\nexport const LIGHTER_TX_TYPE_CANCEL_ORDER = 15;\nexport const LIGHTER_TX_TYPE_CANCEL_ALL_ORDERS = 16;\n\n/** Documented Lighter transaction status values. */\nexport const LIGHTER_TRANSACTION_STATUS = {\n Failed: 0,\n Pending: 1,\n Executed: 2,\n PendingFinal: 3,\n} as const;\n\nexport type LighterTransactionOutcome =\n | 'failed'\n | 'pending'\n | 'executed'\n | 'pending-final';\n\n/**\n * Decode the venue transaction status without treating undocumented values\n * as terminal.\n *\n * @param status - Raw status from the transaction endpoint.\n * @returns The documented outcome, or null for an unknown value.\n */\nexport function getLighterTransactionOutcome(\n status: unknown,\n): LighterTransactionOutcome | null {\n switch (status) {\n case LIGHTER_TRANSACTION_STATUS.Failed:\n return 'failed';\n case LIGHTER_TRANSACTION_STATUS.Pending:\n return 'pending';\n case LIGHTER_TRANSACTION_STATUS.Executed:\n return 'executed';\n case LIGHTER_TRANSACTION_STATUS.PendingFinal:\n return 'pending-final';\n default:\n return null;\n }\n}\n\n// ============================================================================\n// Order enums (wire values expected by `_signCreateOrder`)\n// ============================================================================\n\n/** The pinned signer represents execution and trigger prices as uint32. */\nexport const LIGHTER_MAX_WIRE_PRICE = 4_294_967_295;\n\nexport const LIGHTER_ORDER_TYPE_LIMIT = 0;\nexport const LIGHTER_ORDER_TYPE_MARKET = 1;\nexport const LIGHTER_ORDER_TYPE_STOP_LOSS = 2;\nexport const LIGHTER_ORDER_TYPE_STOP_LOSS_LIMIT = 3;\nexport const LIGHTER_ORDER_TYPE_TAKE_PROFIT = 4;\nexport const LIGHTER_ORDER_TYPE_TAKE_PROFIT_LIMIT = 5;\n\n/** Native parent plus one attached child (OTO). */\nexport const LIGHTER_GROUPING_ONE_TRIGGERS_THE_OTHER = 1;\n/** Native parent plus mutually cancelling attached children (OTOCO). */\nexport const LIGHTER_GROUPING_ONE_TRIGGERS_OCO = 3;\n\n/** Grouped-orders grouping type: one-cancels-the-other (OCO). */\nexport const LIGHTER_GROUPING_ONE_CANCELS_THE_OTHER = 2;\n\n/** L2 transaction type: CreateGroupedOrders (e.g. OCO TP/SL pairs). */\nexport const LIGHTER_TX_TYPE_CREATE_GROUPED_ORDERS = 28;\n\n/** L2 transaction type: UpdateMargin (isolated margin add/remove). */\nexport const LIGHTER_TX_TYPE_UPDATE_MARGIN = 29;\n\n/** L2 transaction type: UpdateLeverage (per-market IMF + margin mode). */\nexport const LIGHTER_TX_TYPE_UPDATE_LEVERAGE = 20;\n\nexport const LIGHTER_TIME_IN_FORCE_IMMEDIATE_OR_CANCEL = 0;\nexport const LIGHTER_TIME_IN_FORCE_GOOD_TILL_TIME = 1;\nexport const LIGHTER_TIME_IN_FORCE_POST_ONLY = 2;\n\n/** Default pending expiry for GTT and trigger orders (per lighter SDKs). */\nexport const LIGHTER_ORDER_EXPIRY_NONE = -1;\n/** Sentinel for \"no trigger price\". */\nexport const LIGHTER_NO_TRIGGER_PRICE = 0;\n\n// ============================================================================\n// Signer / key derivation\n// ============================================================================\n\n/**\n * Default API key slot used by the MetaMask integration.\n * Slots 0-2 are commonly used by Lighter's own frontends; a dedicated\n * slot avoids clobbering keys registered by other clients.\n */\nexport const LIGHTER_DEFAULT_API_KEY_INDEX = 7;\n/** Inclusive venue range available for trading API keys. */\nexport const LIGHTER_MIN_TRADING_API_KEY_INDEX = 2;\nexport const LIGHTER_MAX_TRADING_API_KEY_INDEX = 254;\n/** Bounded number of trading slots scanned for account-local recovery state. */\nexport const LIGHTER_TRADING_API_KEY_COUNT =\n LIGHTER_MAX_TRADING_API_KEY_INDEX - LIGHTER_MIN_TRADING_API_KEY_INDEX + 1;\n/** Bound registration visibility reads before returning a retryable failure. */\nexport const LIGHTER_KEY_REGISTRATION_VISIBILITY_TIMEOUT_MS = 10_000;\nexport const LIGHTER_KEY_REGISTRATION_VISIBILITY_POLL_MS = 250;\nexport const LIGHTER_KEY_REGISTRATION_VISIBILITY_MAX_ATTEMPTS =\n LIGHTER_KEY_REGISTRATION_VISIBILITY_TIMEOUT_MS /\n LIGHTER_KEY_REGISTRATION_VISIBILITY_POLL_MS;\n/** Maximum newest-first complete fill history retained for late subscribers. */\nexport const LIGHTER_FILL_REPLAY_LIMIT = 100;\n\n// ============================================================================\n// REST API Configuration\n// ============================================================================\n\n/**\n * HTTP request timeout in milliseconds\n */\nexport const LIGHTER_HTTP_TIMEOUT_MS = 10000;\n\n/**\n * Most trades `GET /api/v1/recentTrades` returns; a larger `limit` is rejected.\n */\nexport const LIGHTER_RECENT_TRADES_MAX_LIMIT = 100;\n\n/**\n * Interval for polling REST prices (no WS subscription in the POC)\n */\nexport const LIGHTER_PRICE_POLLING_INTERVAL_MS = 5000;\n\n/**\n * Standard-account REST budget: Lighter allows 60 requests per minute per IP\n * and per L1 address, and answers 429 or 405 above it.\n */\nexport const LIGHTER_REST_REQUESTS_PER_MINUTE = 60;\n\n/** Sliding window the REST budget is counted over. */\nexport const LIGHTER_REST_BUDGET_WINDOW_MS = 60_000;\n\n/** First cooldown after a 429/405 without Retry-After; doubles per strike. */\nexport const LIGHTER_RATE_LIMIT_BASE_COOLDOWN_MS = 1_000;\n\n/** Longest cooldown after repeated 429/405 responses. */\nexport const LIGHTER_RATE_LIMIT_MAX_COOLDOWN_MS = 60_000;\n\n/** Consecutive 5xx responses after which Lighter health reports degraded. */\nexport const LIGHTER_SERVER_ERROR_DEGRADED_THRESHOLD = 3;\n\n// ============================================================================\n// WebSocket stream lifecycle\n// ============================================================================\n\n/**\n * Wait after a channel's last listener leaves before unsubscribing it, so\n * quick back-and-forth between markets does not churn frames (Lighter counts\n * them against 200 messages per minute per IP).\n */\nexport const LIGHTER_CHANNEL_RELEASE_DELAY_MS = 5_000;\n\n/** Default time the shared socket stays open after its last listener leaves. */\nexport const LIGHTER_SOCKET_IDLE_CLOSE_MS = 30_000;\n\n/** First reconnect delay after the socket drops; doubles per attempt. */\nexport const LIGHTER_RECONNECT_BASE_DELAY_MS = 1_000;\n\n/** Longest reconnect delay. */\nexport const LIGHTER_RECONNECT_MAX_DELAY_MS = 30_000;\n\n/** How long the socket may stay down with listeners before health degrades. */\nexport const LIGHTER_SOCKET_DOWN_GRACE_MS = 10_000;\n\n/** Bounded discovery while Lighter account streams await a first deposit. */\nexport const LIGHTER_ACCOUNT_DISCOVERY_CONFIG = {\n InitialIntervalMs: 3_000,\n MaxIntervalMs: 15_000,\n DeadlineMs: 180_000,\n} as const;\n\n/** Bounded re-mint when a reconnect fails to re-subscribe the orders channel. */\nexport const LIGHTER_ORDERS_RESUBSCRIBE_RETRY = {\n DelayMs: 5_000,\n MaxAttempts: 3,\n} as const;\n\n/**\n * Maximum leverage placeholder until per-market margin fractions are wired.\n */\nexport const LIGHTER_MAX_LEVERAGE = 50;\n\n/**\n * TTL for the authoritative per-market margin-metadata cache used by\n * explicit leverage validation. Without expiry, metadata fetched once\n * (e.g. an older, higher max) would keep validating later-overlimit\n * leverage for the whole session; the venue cap remains the final\n * enforcement either way.\n */\nexport const LIGHTER_MARGIN_METADATA_TTL_MS = 60_000;\n\n/**\n * Prefix marking venue-data integrity failures (malformed numeric fields\n * in venue payloads). These must fail closed and surface — never degrade\n * into silently-coerced values or empty reads.\n */\nexport const LIGHTER_DATA_INTEGRITY_PREFIX = 'Invalid Lighter venue data:';\n\n/** Full-string decimal/scientific literal (optional sign and exponent). */\nconst LIGHTER_STRICT_DECIMAL_PATTERN =\n /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?$/u;\n\n/**\n * Parse a numeric string STRICTLY: the entire trimmed string must be a\n * decimal/scientific literal. parseFloat prefix-parses, so '0.1oops'\n * would silently become 0.1.\n *\n * Accepts unknown because venue REST payloads are type-cast without\n * runtime validation: a missing/null/numeric field must yield null (for\n * the caller's explicit error path), never a TypeError that generic\n * catches misclassify as an ordinary read failure.\n *\n * Note: '1e999' matches the literal pattern and parses to Infinity —\n * callers own the finiteness check.\n *\n * @param value - Raw value from params or a venue payload.\n * @returns The parsed number, or null when the value is not a string\n * containing a pure numeric literal.\n */\nexport function parseLighterStrictDecimal(value: unknown): number | null {\n if (typeof value !== 'string') {\n return null;\n }\n const trimmed = value.trim();\n return LIGHTER_STRICT_DECIMAL_PATTERN.test(trimmed)\n ? parseFloat(trimmed)\n : null;\n}\n\n// ============================================================================\n// Size / price integerization\n// ============================================================================\n\n/**\n * Convert a human-readable amount to the integer representation expected by\n * the Lighter signer for a given number of supported decimals.\n *\n * @param value - Human-readable amount (e.g. 0.05 SOL, 187.25 USDC).\n * @param decimals - `supportedSizeDecimals` / `supportedPriceDecimals`\n * from the market metadata.\n * @returns Integer wire value (e.g. 0.05 @ 5 decimals -> 5000).\n */\nexport function toLighterInteger(value: number, decimals: number): number {\n const scaled = Math.round(value * 10 ** decimals);\n // Fail closed on wire-format overflow: a huge-but-finite value scales to\n // an unsafe integer (or Infinity) and would stringify as '1e+305' inside\n // signer params.\n if (!Number.isSafeInteger(scaled)) {\n throw new Error(\n `Value ${value} is outside Lighter's integer range at ${decimals} decimals`,\n );\n }\n // NOTE: this is a generic converter — zero and negative results are\n // valid here. Positive-intent policy for signer-bound values lives in\n // the provider's internal wire wrapper.\n return scaled;\n}\n\n/**\n * Convert an integer wire value back to a human-readable amount.\n *\n * @param value - Integer wire value.\n * @param decimals - Supported decimals from the market metadata.\n * @returns Human-readable amount.\n */\nexport function fromLighterInteger(value: number, decimals: number): number {\n return value / 10 ** decimals;\n}\n\n/**\n * Check the size precision accepted by the maker sizing calculation.\n *\n * @param decimals - Venue size decimals.\n * @returns Whether the value can be used as a size precision.\n */\nexport function isLighterOrderSizeDecimals(decimals: number): boolean {\n // Number.toFixed accepts up to 100 fractional digits.\n return Number.isSafeInteger(decimals) && decimals >= 0 && decimals <= 100;\n}\n\n/**\n * Read both maker minimums as a pair. Sizing requires both values.\n *\n * @param market - Market metadata from `orderBooks`.\n * @returns The parsed minimums, or null when either is invalid.\n */\nexport function getLighterMakerMinimums(\n market: Pick<LighterOrderBookMeta, 'minBaseAmount' | 'minQuoteAmount'>,\n): { minBase: number; minQuote: number } | null {\n const minBase = parseLighterStrictDecimal(market.minBaseAmount);\n const minQuote = parseLighterStrictDecimal(market.minQuoteAmount);\n if (\n minBase === null ||\n !Number.isFinite(minBase) ||\n minBase <= 0 ||\n minQuote === null ||\n !Number.isFinite(minQuote) ||\n minQuote <= 0\n ) {\n return null;\n }\n return { minBase, minQuote };\n}\n\n/**\n * Compute the minimum order base size for a market that satisfies both\n * `minBaseAmount` and `minQuoteAmount` at a given price.\n *\n * @param market - Market metadata from `orderBooks`.\n * @param price - Order price (human units).\n * @returns Base size in human units, rounded up to the market's size step.\n */\nexport function computeLighterMinOrderSize(\n market: Pick<\n LighterOrderBookMeta,\n 'minBaseAmount' | 'minQuoteAmount' | 'supportedSizeDecimals'\n >,\n price: number,\n): number {\n const minimums = getLighterMakerMinimums(market);\n if (\n minimums === null ||\n !Number.isFinite(price) ||\n price <= 0 ||\n !isLighterOrderSizeDecimals(market.supportedSizeDecimals)\n ) {\n throw new Error(\n `${LIGHTER_DATA_INTEGRITY_PREFIX} invalid market minimum-size metadata`,\n );\n }\n const { minBase, minQuote } = minimums;\n const step = 10 ** -market.supportedSizeDecimals;\n const byQuote = minQuote / price;\n const raw = Math.max(minBase, byQuote);\n // Small epsilon guards against float artifacts (0.1 / 1e-5 = 10000.0000002)\n // pushing the ceil one step too high.\n const units = Math.ceil(raw / step - 1e-9);\n return Number((units * step).toFixed(market.supportedSizeDecimals));\n}\n\n/**\n * L1 bridge facts per network, as reported live by\n * `GET /api/v1/layer1BasicInfo` (contract addresses) and the venue docs\n * (minimums). Mainnet settles against Ethereum L1; testnet runs on a\n * venue-hosted devnet L1 (chain id 123456), so its route is informational.\n */\nexport const LIGHTER_BRIDGE_CONFIG = {\n mainnet: {\n /** CAIP-2 chain the bridge contract lives on (Ethereum mainnet). */\n chainId: 'eip155:1',\n /** ZkLighter L1 contract (deposits via `deposit`, selector 0x8a857083). */\n bridgeContract: '0x3B4D794a66304F130a4Db8F2551B0070dfCf5ca7',\n /** Canonical Ethereum USDC. */\n usdcContract: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',\n /** Venue-documented USDC minimums. */\n minDepositUsdc: '1',\n minWithdrawUsdc: '1',\n },\n testnet: {\n chainId: 'eip155:123456',\n bridgeContract: '0xe034801BC49cCDC79FB683022dA0591C86077261',\n usdcContract: '0x57382a12EC72eBb1e717b7BB76c78CdDAfE3A396',\n minDepositUsdc: '1',\n minWithdrawUsdc: '1',\n },\n} as const;\n\n/** UpdateLeverage margin-mode codes (types/txtypes constants). */\nexport const LIGHTER_MARGIN_MODE_CROSS = 0;\nexport const LIGHTER_MARGIN_MODE_ISOLATED = 1;\n\n/**\n * Marker prefix for capability-gate errors (unsupported account tier /\n * unverified fee semantics). Callers use it to surface these explicitly\n * instead of degrading them into empty state.\n */\nexport const LIGHTER_UNSUPPORTED_CAPABILITY_PREFIX =\n 'Unsupported Lighter capability:';\n\n/** Maximum verified venue accounts remembered per wallet/network for recovery inventory. */\nexport const LIGHTER_RECOVERY_ACCOUNT_INDEX_LIMIT = 64;\n\n/** Clock slack for signed transaction expiry and venue trade provenance. */\nexport const LIGHTER_TX_EXPIRY_SLACK_MS = 30_000;\n\n/** Fixed native wire bounds and bounded probe inventory limits. */\nexport const LIGHTER_MAX_MARKET_ID = 65535;\nexport const LIGHTER_MAX_BASE_AMOUNT = '281474976710655';\n/** Inclusive uint48 client-order identity bound. */\nexport const LIGHTER_MAX_CLIENT_ORDER_INDEX = '281474976710655';\n/**\n * Bits 47..32 of the client order index of MetaMask stop loss and take profit\n * orders. notify-perps decodes the same value from fills, so it must not change.\n */\nexport const LIGHTER_METAMASK_TAG_PREFIX = 0xa5c3;\nexport const LIGHTER_MAX_ORDER_PRICE = '4294967295';\nexport const LIGHTER_MAX_ORDER_ID = '1152921504606846975';\nexport const LIGHTER_MAX_DECIMALS = 255;\nexport const LIGHTER_MINUTE_MS = 60_000;\nexport const LIGHTER_NATIVE_PROBE_RECORD_LIMIT = 64;\nexport const LIGHTER_NATIVE_PROBE_CANCEL_LIMIT = 16;\nexport const LIGHTER_NATIVE_PROBE_PAGE_LIMIT = 100;\nexport const LIGHTER_NATIVE_PROBE_PAGE_SIZE = 100;\nexport const LIGHTER_CLIENT_ORDER_LOOKUP_LIMIT = 20;\n\n/** Shared bounded testnet native-probe notional ceiling, in USD. */\nexport const LIGHTER_NATIVE_PROBE_MAX_NOTIONAL = 20;\n\n/** Settlement budget shared by every cancellation in one Scale group. */\nexport const LIGHTER_SCALE_SETTLEMENT_WINDOW_MS = 10_000;\n\n/** Read-only Scale visibility cadence, also used after each placement. */\nexport const LIGHTER_SCALE_SETTLEMENT_POLL_MS = 250;\n\n/** Read-only settlement budget after an exact Chase cancellation dispatch. */\nexport const LIGHTER_CHASE_CANCEL_SETTLEMENT_WINDOW_MS = 10_000;\n\n/** Delay between exact Chase child reads, without another sign or send. */\nexport const LIGHTER_CHASE_CANCEL_SETTLEMENT_POLL_MS = 250;\n\n/** Bounded Chase policy, distinct from native wire limits. */\nexport const LIGHTER_CHASE_DEFAULT_INTERVAL_MS = 15_000;\nexport const LIGHTER_CHASE_DEFAULT_DURATION_MS = 60_000;\nexport const LIGHTER_CHASE_DEFAULT_REPRICINGS = 1;\nexport const LIGHTER_CHASE_DEFAULT_DISTANCE_BPS = 100;\nexport const LIGHTER_CHASE_MIN_INTERVAL_MS = 1_000;\nexport const LIGHTER_CHASE_MAX_DURATION_MS = 300_000;\nexport const LIGHTER_CHASE_MAX_REPRICINGS = 20;\nexport const LIGHTER_CHASE_MAX_DISTANCE_BPS = 10_000;\nexport const LIGHTER_CHASE_QUOTE_MAX_AGE_MS = 5_000;\nexport const LIGHTER_CHASE_HANDLE_MAX_LENGTH = 128;\n\n/** Maximum duration of a post-only crossing-check book read. */\nexport const LIGHTER_POST_ONLY_QUOTE_MAX_AGE_MS = 5_000;\n"]}
|
|
@@ -130,6 +130,12 @@ export declare const STREAM_RETRY_CONFIG: {
|
|
|
130
130
|
* change. An illiquid market's book empties for shorter than that.
|
|
131
131
|
*/
|
|
132
132
|
export declare const MARKET_STATE_CONFIRM_MS = 60000;
|
|
133
|
+
/** Wait after a market change before reading the markets again. */
|
|
134
|
+
export declare const MARKET_CHANGE_SETTLE_MS = 1000;
|
|
135
|
+
/** Wait after a fill before reading the fee rates again. */
|
|
136
|
+
export declare const FEE_CHANGE_SETTLE_MS = 1000;
|
|
137
|
+
/** Largest delay supported by setTimeout. */
|
|
138
|
+
export declare const MAX_TIMEOUT_MS = 2147483647;
|
|
133
139
|
/** Read timing of a live TWAP list. */
|
|
134
140
|
export declare const TWAP_ORDER_CONFIG: {
|
|
135
141
|
/** Delay before re-reading when the stream lists a schedule no read has. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perpsConfig.d.ts","sourceRoot":"","sources":["../../src/constants/perpsConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,+CAA+C,CAAC;AACzE,eAAO,MAAM,YAAY,QAAQ,CAAC;AAElC,eAAO,MAAM,eAAe;aAC1B,cAAc,EAAE,cAAc;aAC9B,WAAW,EAAE,OAAO;IACpB,sGAAsG;aACtG,4BAA4B,EAAE,eAAe;IAC7C,uFAAuF;aACvF,uBAAuB,EAAE,KAAK;aAC9B,gBAAgB,EAAE,IAAI;aACtB,qBAAqB,EAAE,IAAI;aAC3B,yBAAyB,EAAE,KAAM;aACjC,mBAAmB,EAAE,KAAM;aAC3B,0BAA0B,EAAE,KAAM;aAGlC,uBAAuB,EAAE,KAAM;aAC/B,0BAA0B,EAAE,KAAM;aAClC,sBAAsB,EAAE,IAAK;aAC7B,mBAAmB,EAAE,GAAG;aACxB,0BAA0B,EAAE,GAAG;aAC/B,0BAA0B,EAAE,GAAG;aAC/B,0BAA0B,EAAE,GAAG;aAC/B,sBAAsB,EAAE,GAAG;aAC3B,wBAAwB,EAAE,IAAK;aAC/B,wBAAwB,EAAE,CAAC;aAC3B,yBAAyB,EAAE,IAAK;aAGhC,uBAAuB,EAAE,KAAK;aAC9B,kBAAkB,EAAE,GAAG;aAGvB,mBAAmB,EAAE,KAAM;aAG3B,+BAA+B,EAAE,KAAM;aAEvC,wBAAwB,EAAE,CAAC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aAEtB,QAAQ,EAAE,CAAC;aAEX,iBAAiB,EAAE,CAAC;aAEpB,aAAa,EAAE,CAAC;aAEhB,sBAAsB,EAAE,CAAC;aAEzB,gBAAgB,EAAE,CAAC;aAEnB,4BAA4B,EAAE,CAAC;aAG/B,0BAA0B,EAAE,CAAC;aAE7B,iCAAiC,EAAE,CAAC;aAEpC,gBAAgB,EAAE,CAAC;CACX,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,eAAe;IAC1B,uEAAuE;aACvE,eAAe,EAAE,aAAa;IAC9B;;;;;;OAMG;aACH,oBAAoB;CACZ,CAAC;AAQX,eAAO,MAAM,wBAAwB,6BAA6B,CAAC;AACnE,eAAO,MAAM,0BAA0B,kCAAkC,CAAC;AAC1E,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,QAAS,CAAC;AAE3D;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GAAG,MAAM,CAET;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,OAAO,GACjB,MAAM,CAMR"}
|
|
@@ -149,6 +149,12 @@ export const STREAM_RETRY_CONFIG = {
|
|
|
149
149
|
* change. An illiquid market's book empties for shorter than that.
|
|
150
150
|
*/
|
|
151
151
|
export const MARKET_STATE_CONFIRM_MS = 60000;
|
|
152
|
+
/** Wait after a market change before reading the markets again. */
|
|
153
|
+
export const MARKET_CHANGE_SETTLE_MS = 1000;
|
|
154
|
+
/** Wait after a fill before reading the fee rates again. */
|
|
155
|
+
export const FEE_CHANGE_SETTLE_MS = 1000;
|
|
156
|
+
/** Largest delay supported by setTimeout. */
|
|
157
|
+
export const MAX_TIMEOUT_MS = 2_147_483_647;
|
|
152
158
|
/** Read timing of a live TWAP list. */
|
|
153
159
|
export const TWAP_ORDER_CONFIG = {
|
|
154
160
|
/** Delay before re-reading when the stream lists a schedule no read has. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perpsConfig.js","sourceRoot":"","sources":["../../src/constants/perpsConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,4CAA4C,CAAC;AACzE,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC;AAElC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,cAAc,EAAE,cAAc;IAC9B,WAAW,EAAE,OAAO,EAAE,kFAAkF;IACxG,sGAAsG;IACtG,4BAA4B,EAAE,eAAe;IAC7C,uFAAuF;IACvF,uBAAuB,EAAE,KAAK;IAC9B,gBAAgB,EAAE,IAAI,EAAE,YAAY;IACpC,qBAAqB,EAAE,IAAI,EAAE,WAAW;IACxC,yBAAyB,EAAE,MAAM,EAAE,6FAA6F;IAChI,mBAAmB,EAAE,MAAM,EAAE,gEAAgE;IAC7F,0BAA0B,EAAE,MAAM,EAAE,4DAA4D;IAEhG,8BAA8B;IAC9B,uBAAuB,EAAE,MAAM,EAAE,+GAA+G;IAChJ,0BAA0B,EAAE,MAAM,EAAE,2EAA2E;IAC/G,sBAAsB,EAAE,KAAK,EAAE,oDAAoD;IACnF,mBAAmB,EAAE,GAAG,EAAE,kEAAkE;IAC5F,0BAA0B,EAAE,GAAG,EAAE,2GAA2G;IAC5I,0BAA0B,EAAE,GAAG,EAAE,uDAAuD;IACxF,0BAA0B,EAAE,GAAG,EAAE,+EAA+E;IAChH,sBAAsB,EAAE,GAAG,EAAE,0DAA0D;IACvF,wBAAwB,EAAE,KAAK,EAAE,gDAAgD;IACjF,wBAAwB,EAAE,CAAC,EAAE,kEAAkE;IAC/F,yBAAyB,EAAE,KAAK,EAAE,iFAAiF;IAEnH,sCAAsC;IACtC,uBAAuB,EAAE,KAAK,EAAE,oFAAoF;IACpH,kB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CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;AACrE,CAAC","sourcesContent":["/**\n * Perps feature constants - Controller layer (portable)\n *\n * This file contains only controller-portable configuration:\n * - Constants used by controller logic, providers, and services\n * - Calculation thresholds, API configs, and protocol constants\n *\n * UI-only constants (layout, display, navigation) live in:\n * app/components/UI/Perps/constants/perpsConfig.ts\n */\nexport const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';\nexport const ZERO_BALANCE = '0x0';\n\nexport const PERPS_CONSTANTS = {\n FeatureFlagKey: 'perpsEnabled',\n FeatureName: 'perps', // Constant for Sentry error filtering - enables \"feature:perps\" dashboard queries\n /** Token description used to identify the synthetic \"Perps balance\" option in pay-with token lists */\n PerpsBalanceTokenDescription: 'perps-balance',\n /** Symbol displayed for the synthetic \"Perps balance\" token in pay-with token lists */\n PerpsBalanceTokenSymbol: 'USD',\n WebsocketTimeout: 5000, // 5 seconds\n WebsocketCleanupDelay: 1000, // 1 second\n BackgroundDisconnectDelay: 20_000, // 20 seconds delay before disconnecting when app is backgrounded or when user exits perps UX\n ConnectionTimeoutMs: 10_000, // 10 seconds timeout for connection and position loading states\n DefaultMonitoringTimeoutMs: 10_000, // 10 seconds default timeout for data monitoring operations\n\n // Connection timing constants\n ConnectionGracePeriodMs: 20_000, // 20 seconds grace period before actual disconnection (same as BackgroundDisconnectDelay for semantic clarity)\n ConnectionAttemptTimeoutMs: 30_000, // 30 seconds timeout for connection attempts to prevent indefinite hanging\n WebsocketPingTimeoutMs: 5_000, // 5 seconds timeout for WebSocket health check ping\n ConnectRetryDelayMs: 200, // Delay before retrying connect() when connection isn't ready yet\n ForegroundPingRetryDelayMs: 500, // Delay before retrying ping in resumeFromForeground — JS thread may be sluggish right after foregrounding\n ReconnectionCleanupDelayMs: 500, // Platform-agnostic delay to ensure WebSocket is ready\n ReconnectionDelayAndroidMs: 300, // Android-specific reconnection delay for better reliability on slower devices\n ReconnectionDelayIosMs: 100, // iOS-specific reconnection delay for optimal performance\n ReconnectionRetryDelayMs: 5_000, // 5 seconds delay between reconnection attempts\n NetworkRestoreMaxRetries: 8, // Max retry attempts when reconnecting after WiFi/network restore\n NetworkRestoreRetryBaseMs: 1_500, // Base delay (ms) between network restore retries (multiplied by attempt number)\n\n // Connection manager timing constants\n BalanceUpdateThrottleMs: 15000, // Update at most every 15 seconds to reduce state updates in PerpsConnectionManager\n InitialDataDelayMs: 100, // Delay to allow initial data to load after connection establishment\n\n // Order submission timing\n PlaceOrderTimeoutMs: 60_000, // Hard timeout for provider round-trip in TradingService.placeOrder\n\n // Deposit toast timing\n DepositTakingLongerToastDelayMs: 30_000, // Delay before showing \"Deposit taking longer than usual\" toast\n\n DefaultAssetPreviewLimit: 5,\n DefaultMaxLeverage: 3 as number, // Default fallback max leverage when market data is unavailable - conservative default\n FallbackPriceDisplay: '$---', // Display when price data is unavailable\n FallbackPercentageDisplay: '--%', // Display when change data is unavailable\n FallbackDataDisplay: '--', // Display when non-price data is unavailable\n ZeroAmountDisplay: '$0', // Display for zero dollar amounts (e.g., no volume)\n ZeroAmountDetailedDisplay: '$0.00', // Display for zero dollar amounts with decimals\n\n RecentActivityLimit: 3,\n\n // Historical data fetching constants\n FillsLookbackMs: 90 * 24 * 60 * 60 * 1000, // 3 months in milliseconds - limits REST API fills fetch\n\n // Recently viewed markets\n RecentlyViewedMarketsTtlMs: 24 * 60 * 60 * 1000, // 24 hours TTL for recently viewed market entries\n RecentlyViewedMarketsLimit: 10, // Maximum number of recently viewed markets to track\n\n // Temporary order form draft\n PendingTradeConfigurationTtlMs: 30_000, // Restore a draft only during a brief navigation away from the form\n} as const;\n\n/**\n * Withdrawal-specific constants (protocol-agnostic)\n * Note: Protocol-specific values like estimated time should be defined in each protocol's config\n */\nexport const WITHDRAWAL_CONSTANTS = {\n DefaultMinAmount: '1.01', // Default minimum withdrawal amount in USDC\n DefaultFeeAmount: 1, // Default withdrawal fee in USDC\n DefaultFeeToken: 'USDC', // Default fee token\n} as const;\n\n/**\n * Validation thresholds for UI warnings and checks\n * These values control when warnings are shown to users\n */\nexport const VALIDATION_THRESHOLDS = {\n // Leverage threshold for warning users about high leverage\n HighLeverageWarning: 20, // Show warning when leverage > 20x\n\n // Limit price difference threshold (as decimal, 0.1 = 10%)\n LimitPriceDifferenceWarning: 0.1, // Warn if limit price differs by >10% from current price\n\n // Price deviation threshold (as decimal, 0.1 = 10%)\n PriceDeviation: 0.1, // Warn if perps price deviates by >10% from spot price\n} as const;\n\n/**\n * Order slippage configuration\n * Controls default slippage tolerance for different order types\n * Conservative defaults based on HyperLiquid platform interface\n * See: docs/perps/hyperliquid/ORDER-MATCHING-ERRORS.md\n */\nexport const ORDER_SLIPPAGE_CONFIG = {\n // Market order slippage (basis points)\n // 300 basis points = 3% = 0.03 decimal\n // Conservative default for measured rollout, prevents most IOC failures\n DefaultMarketSlippageBps: 300,\n\n // TP/SL order slippage (basis points)\n // 1000 basis points = 10% = 0.10 decimal\n // Aligns with HyperLiquid platform default for triggered orders\n DefaultTpslSlippageBps: 1000,\n\n // Limit order slippage (basis points)\n // 100 basis points = 1% = 0.01 decimal\n // Kept conservative as limit orders rest on book (not IOC/immediate execution)\n DefaultLimitSlippageBps: 100,\n} as const;\n\n/**\n * Defaults and bounds for the emulated `chase` placement.\n *\n * No supported venue exposes a chase as an API action — HyperLiquid documents it\n * as running client-side — so the strategy is run here: a post-only order rests\n * one tick inside the spread and is cancelled and re-placed as the touch moves.\n * The poll floor limits request frequency; callers may also set explicit\n * duration or repricing caps. Protocol-agnostic — a provider that gains a\n * native chase ignores these entirely.\n */\nexport const CHASE_ORDER_CONFIG = {\n /** Maximum submissions used to survive a touch moving before an ALO rests. */\n InitialPlacementAttempts: 3,\n /** How often the touch is re-read when the caller does not say. */\n DefaultIntervalMs: 15000,\n /** Floor on the poll interval, whatever the caller asks for. */\n MinIntervalMs: 1000,\n /**\n * How many chases may run at once.\n *\n * HyperLiquid documents a cap of five simultaneously active chase orders. It\n * is a venue rule rather than controller policy, but it is spelled here\n * alongside the rest of the chase configuration because an emulated chase is\n * the only thing that can enforce it.\n */\n MaxActiveSessions: 5,\n /** Most ended chases a live chase list keeps in history, newest first. */\n HistoryLimit: 50,\n /**\n * Reads a live chase list keeps a running chase that a read omits. An\n * aggregated read drops a provider whose read failed, so one omission is not\n * proof the chase is gone.\n */\n OmissionGraceReads: 1,\n} as const;\n\n/** How a shared stream channel reopens a source that failed. */\nexport const STREAM_RETRY_CONFIG = {\n /** Delay before the first reopen; it doubles with each attempt. */\n BaseDelayMs: 1000,\n /** Longest delay between two attempts. */\n MaxDelayMs: 30000,\n /** Reopens before the channel waits for a reconnect or a new reader. */\n MaxAttempts: 5,\n /** How long a source must run, with data, to earn a fresh budget. */\n StableMs: 60000,\n} as const;\n\n/**\n * How long a market must look retired, or quoted again, before it counts as a\n * change. An illiquid market's book empties for shorter than that.\n */\nexport const MARKET_STATE_CONFIRM_MS = 60000;\n\n/** Read timing of a live TWAP list. */\nexport const TWAP_ORDER_CONFIG = {\n /** Delay before re-reading when the stream lists a schedule no read has. */\n StreamCatchUpIntervalMs: 1000,\n} as const;\n\n/** Thresholds for the price warnings shown on a resting order draft. */\nexport const ORDER_PRICE_WARNING_CONFIG = {\n /** Distance from the touch, as a fraction, past which a price is far from market. */\n FarFromMarketRatio: 0.05,\n} as const;\n\n/** Public lifecycle states reported for an emulated Chase order. */\nexport const CHASE_ORDER_STATUS = {\n Active: 'active',\n TerminationPending: 'termination_pending',\n Backgrounded: 'backgrounded',\n MaxDistanceReached: 'max_distance_reached',\n DurationReached: 'duration_reached',\n RepricingLimitReached: 'repricing_limit_reached',\n Filled: 'filled',\n Canceled: 'canceled',\n Failed: 'failed',\n} as const;\n\n/**\n * Bounds and step for the user-configurable max slippage preference (basis points).\n * Shared by the controller (`setMaxSlippage`) and UI (`slippageConfig.ts`).\n */\nexport const MAX_SLIPPAGE_BOUNDS = {\n MinBps: 10,\n MaxBps: 1000,\n StepBps: 10,\n} as const;\n\n/**\n * Max order amount buffer to reduce \"Insufficient margin\" rejections from the exchange.\n * When the user selects 100% (slider or Max), we cap the order at (1 - this) of the\n * theoretical max so that fees, rounding, and exchange-side margin checks are covered.\n * Value as decimal (e.g. 0.005 = 0.5%).\n */\nexport const MAX_ORDER_MARGIN_BUFFER = 0.005; // 0.5%\n\n/**\n * Performance optimization constants\n * These values control debouncing and throttling for better performance\n */\nexport const PERFORMANCE_CONFIG = {\n // Price updates debounce delay (milliseconds)\n // Batches rapid WebSocket price updates to reduce re-renders\n PriceUpdateDebounceMs: 1000,\n\n // Order validation debounce delay (milliseconds)\n // Prevents excessive validation calls during rapid form input changes\n ValidationDebounceMs: 300,\n\n // Freshness window for provider market metadata used by strategy capability reads\n OrderCapabilitiesMetaFreshnessMs: 30_000,\n\n // Liquidation price debounce delay (milliseconds)\n // Prevents excessive liquidation price calls during rapid form input changes\n LiquidationPriceDebounceMs: 500,\n\n // Candle subscription debounce delay (milliseconds)\n // Prevents WS subscription churn during rapid market switching (#28141)\n CandleConnectDebounceMs: 500,\n\n // Order-form slippage estimate throttle (milliseconds)\n // Updates the estimated-slippage value derived from the live L2 order book\n // no more than once per window. Aggressive enough to keep the row reactive\n // while the user edits the amount, conservative enough to avoid re-render\n // pressure on every book tick.\n SlippageEstimateThrottleMs: 250,\n\n // Order-book levels sampled when estimating slippage\n // Number of price levels (per side) walked by `calculateEstimatedSlippageBps`\n // to fill the requested USD notional. Matches the L2 sample size used by the\n // order-book panel and is enough depth for the typical order sizes we\n // surface in the order form.\n SlippageEstimateBookLevels: 10,\n\n // Candle WS teardown delay (milliseconds)\n // When the last subscriber for a cacheKey unsubscribes, wait this long before\n // tearing down the WS. A subsequent subscribe inside the window cancels the\n // teardown so rapid back-and-forth switches do not churn the connection.\n CandleTeardownDelayMs: 150,\n\n // Perps REST coalesce TTL (milliseconds)\n //\n // Window in which identical GET-style REST calls (getOrderFills, getOrders,\n // getFunding, historicalOrders) share a single in-flight promise / cached\n // result. `forceRefresh` still bypasses the cache end-to-end (hooks →\n // controller → MarketDataService → provider → HyperLiquidClientService), so\n // pull-to-refresh always hits the network.\n //\n // Why 60 s: HyperLiquid's documented rate limit is 1200 weight / IP /\n // rolling 60 s window. Sizing TTL = window length caps each endpoint-per-\n // account at ≤1 REST hit per window under any UI activity pattern — rapid\n // market switching, re-mounts (usePerpsMarketFills, usePerpsTransactionHistory),\n // and multi-tab scans all share a single request. Live fills/orders/prices\n // still flow via WS subscriptions, so REST is seed/backfill only — cache\n // staleness inside the 60 s window is never user-visible.\n PerpsRestCoalesceTtlMs: 60_000,\n\n // Candle snapshot REST coalesce TTL (milliseconds).\n // Longer than PerpsRestCoalesceTtlMs because WS stream keeps live candles\n // fresh — the REST snapshot only seeds the chart on initial subscribe. A\n // 30 s window lets rapid market switching (pass 1 → pass 2 of a stress\n // loop) share the same snapshot per (symbol, interval), cutting\n // candleSnapshot REST weight roughly in half.\n PerpsCandleCoalesceTtlMs: 30_000,\n\n // Navigation params delay (milliseconds)\n // Required for React Navigation to complete state transitions before setting params\n // This ensures navigation context is available when programmatically selecting tabs\n NavigationParamsDelayMs: 200,\n\n // Tab control reset delay (milliseconds)\n // Delay to reset programmatic tab control after tab switching to prevent render loops\n TabControlResetDelayMs: 500,\n\n // Market data cache duration (milliseconds)\n // How long to cache market list data before fetching fresh data\n MarketDataCacheDurationMs: 5 * 60 * 1000, // 5 minutes\n\n // Asset metadata cache duration (milliseconds)\n // How long to cache asset icon validation results\n AssetMetadataCacheDurationMs: 60 * 60 * 1000, // 1 hour\n\n // Max leverage cache duration (milliseconds)\n // How long to cache max leverage values per asset (leverage rarely changes)\n MaxLeverageCacheDurationMs: 60 * 60 * 1000, // 1 hour\n\n // Rewards cache durations (milliseconds)\n // How long to cache fee discount data from rewards API\n FeeDiscountCacheDurationMs: 5 * 60 * 1000, // 5 minutes\n // How long to cache points calculation parameters from rewards API\n PointsCalculationCacheDurationMs: 5 * 60 * 1000, // 5 minutes\n\n /**\n * Performance logging markers for filtering logs during development and debugging\n * These markers help isolate performance-related logs from general application logs\n * Usage: Use in DevLogger calls to easily filter specific performance areas\n * Impact: Development only (uses DevLogger) - zero production performance cost\n *\n * Examples:\n * - Filter Sentry performance logs: `adb logcat | grep PERPSMARK_SENTRY`\n * - Filter MetaMetrics events: `adb logcat | grep PERPSMARK_METRICS`\n * - Filter WebSocket performance: `adb logcat | grep PERPSMARK_WS`\n * - Filter all Perps performance: `adb logcat | grep PERPSMARK_`\n */\n LoggingMarkers: {\n // Sentry performance measurement logs (screen loads, bottom sheets, API timing)\n SentryPerformance: 'PERPSMARK_SENTRY',\n\n // MetaMetrics event tracking logs (user interactions, business analytics)\n MetametricsEvents: 'PERPSMARK_METRICS',\n\n // WebSocket performance logs (connection timing, data flow, reconnections)\n WebsocketPerformance: 'PERPSMARK_SENTRY_WS',\n } as const,\n} as const;\n\nexport const TP_SL_CONFIG = {\n UsePositionBoundTpsl: true,\n} as const;\n\n/**\n * Quick-pick RoE percentages for take profit (positive) and stop loss\n * (negative) in TP/SL forms, as Mobile and Extension show them.\n */\nexport const TP_SL_ROE_PRESETS = {\n TakeProfit: [10, 25, 50, 100],\n StopLoss: [-5, -10, -25, -50],\n} as const;\n\n/**\n * Bounds applied to a HyperLiquid TWAP placement.\n *\n * The pinned HyperLiquid SDK (0.33.1) validates the TWAP duration as a safe\n * integer in `[5, 1440]` before signing, although the venue currently documents\n * a maximum of seven days (`10080` minutes). The controller exposes the SDK's\n * narrower cap until that dependency supports the venue limit, avoiding an\n * opaque SDK error. `MinNotionalUsd` is the venue's documented minimum *total*\n * order size for a TWAP, which it enforces instead of the per-order minimum —\n * its suborders are its own business.\n *\n * Carries the venue prefix, like `HYPERLIQUID_ORDER_LIMITS`, because these are\n * venue/SDK constraints rather than controller policy.\n *\n * From: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/order-types\n */\nexport const HYPERLIQUID_TWAP_LIMITS = {\n MinDurationMinutes: 5,\n MaxDurationMinutes: 1440,\n MinNotionalUsd: 100,\n /** The venue sends one TWAP suborder every 30 seconds. */\n SliceIntervalSeconds: 30,\n} as const;\n\n/**\n * HyperLiquid order limits based on leverage\n * From: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/contract-specifications\n */\nexport const HYPERLIQUID_ORDER_LIMITS = {\n // Market orders\n MarketOrderLimits: {\n // $15,000,000 for max leverage >= 25\n HighLeverage: 15_000_000,\n // $5,000,000 for max leverage in [20, 25)\n MediumHighLeverage: 5_000_000,\n // $2,000,000 for max leverage in [10, 20)\n MediumLeverage: 2_000_000,\n // $500,000 for max leverage < 10\n LowLeverage: 500_000,\n },\n // Limit orders are 10x market order limits\n LimitOrderMultiplier: 10,\n} as const;\n\n/**\n * Cross-margin ratio levels (`PerpsAccountSummary.accountRatio`, maintenance\n * margin over cross collateral; liquidation at 1) where clients warn: a\n * warning from `Warning` up, danger above `Danger`.\n */\nexport const CROSS_MARGIN_RATIO_THRESHOLDS = {\n Warning: 0.5,\n Danger: 0.75,\n} as const;\n\n/**\n * Order-book price grouping ladder shared by Mobile, Extension and Terminal.\n * The `decade` ladder is `10^(floor(log10(mid)) - DecadeOffset)` times each\n * of `Multipliers`; the `tick` ladder is the market tick times each of\n * `TickMultipliers`.\n */\nexport const ORDER_BOOK_GROUPING_CONFIG = {\n DecadeOffset: 4,\n Multipliers: [1, 2, 5, 10, 100, 1000],\n /** Multipliers of the market tick for the `tick` ladder. */\n TickMultipliers: [1, 2, 5, 10, 20, 50],\n /** Index of the default option; the middle option when the ladder is shorter. */\n DefaultOptionIndex: 3,\n /** Options when the mid price is unknown. */\n FallbackOptions: [0.01, 0.1, 1],\n /** Significant-figure range a venue aggregates a book stream at. */\n MinSignificantFigures: 2,\n MaxSignificantFigures: 5,\n} as const;\n\n/**\n * Close position configuration\n * Controls behavior and constants specific to position closing\n */\nexport const CLOSE_POSITION_CONFIG = {\n // Decimal places for USD amount input display\n UsdDecimalPlaces: 2,\n\n // Default close percentage when opening the close position view\n DefaultClosePercentage: 100,\n\n // Precision for position size calculations to prevent rounding errors\n AmountCalculationPrecision: 6,\n\n // Throttle delay for real-time price updates during position closing\n PriceThrottleMs: 3000,\n\n // Fallback decimal places for tokens without metadata\n FallbackTokenDecimals: 18,\n} as const;\n\n/**\n * Margin adjustment configuration\n * Controls behavior for adding/removing margin from positions\n */\nexport const MARGIN_ADJUSTMENT_CONFIG = {\n // Risk thresholds for margin removal warnings\n // Threshold values represent ratio of (price distance to liquidation) / (liquidation price)\n // Values < 1.0 mean price is dangerously close to liquidation\n LiquidationRiskThreshold: 1.2, // 20% buffer before liquidation - triggers danger state\n LiquidationWarningThreshold: 1.5, // 50% buffer before liquidation - triggers warning state\n\n // Minimum margin adjustment amount (USD)\n // Prevents dust adjustments and ensures meaningful position changes\n MinAdjustmentAmount: 1,\n\n // Precision for margin calculations\n // Ensures accurate decimal handling in margin/leverage calculations\n CalculationPrecision: 6,\n\n // Safety buffer for margin removal to account for HyperLiquid's transfer margin requirement\n // HyperLiquid enforces: transfer_margin_required = max(initial_margin_required, 0.1 * total_position_value)\n // See: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/margin-and-pnl\n MarginRemovalSafetyBuffer: 0.1,\n\n // Share of notional kept back from a margin removal for the mark price\n // moving before the venue processes it; the exact boundary is rejected on\n // any adverse tick\n MarginRemovalPriceMoveBuffer: 0.01,\n\n // Fallback max leverage when market data is unavailable\n // Conservative value to prevent over-removal of margin\n // Most HyperLiquid assets support at least 50x leverage\n FallbackMaxLeverage: 50,\n} as const;\n\n/**\n * Data Lake API configuration\n * Endpoints for reporting perps trading activity for notifications\n */\nexport const DATA_LAKE_API_CONFIG = {\n // Order reporting endpoint - only used for mainnet perps trading\n OrdersEndpoint: 'https://perps.api.cx.metamask.io/api/v1/orders',\n} as const;\n\n/**\n * notify-perps settings for Lighter notification enrollment and the shared\n * fire-and-forget retry policy of the notify-perps reporters\n */\nexport const NOTIFY_PERPS_API_CONFIG = {\n // Path appended to `notifyPerpsApi.baseUrl`\n LighterNotificationAccountsPath: '/api/v1/lighter/accounts',\n // Retries after the first attempt, with exponential backoff from RetryDelayMs\n MaxRetries: 3,\n RetryDelayMs: 1000,\n} as const;\n\n/**\n * Subscription benefits cache (stale-while-revalidate).\n *\n * The unified fee resolver never awaits the benefits read, so these bounds are\n * what decide whether the cached snapshot may grant the perps fee waiver:\n * - within `FreshMs` the snapshot is served as-is,\n * - past `FreshMs` it is still served while a background refresh runs,\n * - past `MaxStaleMs` it is no longer trusted to grant the waiver, and the\n * resolver falls back to the next-lowest fee source.\n */\nexport const SUBSCRIPTION_BENEFITS_CACHE = {\n FreshMs: 60_000, // 1 minute – no refresh triggered\n MaxStaleMs: 10 * 60 * 1000, // 10 minutes – ceiling for granting the waiver\n} as const;\n\n/**\n * Client order ID marking for the ADR 0064 subscription fee waiver.\n *\n * A HyperLiquid cloid is 16 bytes. When the subscription source wins the fee\n * comparison, the order's cloid is stamped so the fill can be attributed to the\n * subscription program off the existing HL fill fan-out, with no dedicated\n * builder address and no per-user approval:\n *\n * ```\n * 0x <program marker: 4 bytes> <flags: 1 byte> <entropy: 11 bytes>\n * ```\n *\n * The flag byte follows the leading marker rather than replacing it, so the\n * marking composes with the cloid the Scale ladder already builds: a Scale rung\n * keeps its own `4d4d5343` marker and its rung index, and only the flag byte is\n * claimed, leaving group recovery and cancel-by-cloid intact.\n *\n * `ProgramId` is isolated in this one constant so every marking and decoding\n * path reads the marker from a single place; see its own documentation below\n * for the registered value and how it is encoded.\n */\nexport const SUBSCRIPTION_CLOID_CONFIG = {\n /**\n * Reserved program marker, 4 bytes as lowercase hex without the `0x`.\n *\n * The registry assigns perps subscriptions program_id `0x0100`, from the\n * `0x0000`–`0x00FF`-adjacent range reserved for core protocol features. It is\n * a 2-byte id, zero-extended big-endian into this 4-byte marker field so the\n * rest of the layout — flag byte at a fixed offset, 11 bytes of entropy — is\n * unchanged. No previously released client emitted a cloid starting with\n * these bytes, and it cannot collide with the Scale marker (`4d4d5343`),\n * which is what makes the decoder safe against historical fills.\n */\n ProgramId: '00000100',\n\n /** Hex characters in the leading program marker (4 bytes). */\n ProgramIdHexLength: 8,\n\n /** Hex characters of trailing entropy in a marked cloid (11 bytes). */\n EntropyHexLength: 22,\n} as const;\n\n/**\n * Flag bits carried in the flag byte of a subscription-marked cloid.\n */\nexport const SUBSCRIPTION_CLOID_FLAGS = {\n /** Bit 0 — a subscription fee reduction was applied to this order. */\n FeeReductionApplied: 0x01,\n} as const;\n\n/**\n * Remote feature flag that gates the subscription fee-waiver source.\n *\n * ADR 0064 Milestone 8 requires the subscription source to be killable on its\n * own, without touching VIP, season, or the default builder fee. Absent or\n * malformed, the flag reads as enabled so an unreachable flag service cannot\n * silently drop a benefit the user pays for.\n */\nexport const SUBSCRIPTION_FEE_WAIVER_FLAG = 'perpsSubscriptionFeeWaiverEnabled';\n\n/**\n * Terminal API configuration.\n * The full endpoint URL is injected at runtime via\n * `PerpsPlatformDependencies.terminalApi.marketDataUrl` from each client build\n * (dev/uat/prd); only cache settings live here.\n */\nexport const TERMINAL_API_CONFIG = {\n CacheTtlMs: 5 * 60 * 1000, // 5 minutes\n FetchTimeoutMs: 10_000, // 10 seconds – degrade to provider on slow Terminal\n} as const;\n\n/**\n * Decimal precision configuration\n * Controls maximum decimal places for price and input validation\n */\nexport const DECIMAL_PRECISION_CONFIG = {\n // Maximum decimal places for price input (matches Hyperliquid limit)\n // Used in TP/SL forms, limit price inputs, and price validation\n MaxPriceDecimals: 6,\n // Maximum significant figures allowed by HyperLiquid API\n // Orders with more than 5 significant figures will be rejected\n MaxSignificantFigures: 5,\n // Defensive fallback for size decimals when market data fails to load\n // Real szDecimals should always come from market data API (varies by asset)\n // Using 6 as safe maximum to prevent crashes (covers most assets)\n // NOTE: This is NOT semantically correct - just a defensive measure\n FallbackSizeDecimals: 6,\n} as const;\n\n/**\n * Decimal places kept by the shared TP/SL calculations.\n *\n * A calculated trigger price keeps the decimals of the first band whose\n * `BelowPrice` it is under, else `TriggerPriceDefaultDecimals`, without\n * trailing zeros: low-priced assets need more decimals. The provider rounds\n * the price to the asset's submission precision when the order is sent.\n */\nexport const TP_SL_PRECISION_CONFIG = {\n TriggerPriceBands: [\n { BelowPrice: 0.01, Decimals: 8 },\n { BelowPrice: 1, Decimals: DECIMAL_PRECISION_CONFIG.MaxPriceDecimals },\n { BelowPrice: 100, Decimals: 4 },\n ],\n TriggerPriceDefaultDecimals: 2,\n // Decimal places of a calculated or displayed RoE or price-move percentage\n PercentageDecimals: 2,\n} as const;\n\n/**\n * Market sorting configuration\n * Controls sorting behavior and presets for the trending markets view\n */\nexport const MARKET_SORTING_CONFIG = {\n // Default sort settings\n DefaultSortOptionId: 'volume' as const,\n DefaultDirection: 'desc' as const,\n\n // Available sort fields (only includes fields supported by PerpsMarketData)\n SortFields: {\n Volume: 'volume',\n PriceChange: 'priceChange',\n OpenInterest: 'openInterest',\n FundingRate: 'fundingRate',\n /** `sortMarkets` only: the current price. */\n Price: 'price',\n /** `sortMarkets` only: the market name. */\n Name: 'name',\n } as const,\n\n // Sort button presets for filter chips (simplified buttons without direction)\n SortButtonPresets: [\n { field: 'volume', labelKey: 'perps.sort.volume' },\n { field: 'priceChange', labelKey: 'perps.sort.price_change' },\n { field: 'fundingRate', labelKey: 'perps.sort.funding_rate' },\n ] as const,\n\n // Sort options for the bottom sheet\n // All options support direction toggle (high-to-low / low-to-high)\n SortOptions: [\n {\n id: 'volume',\n labelKey: 'perps.sort.volume',\n field: 'volume',\n direction: 'desc',\n },\n {\n id: 'priceChange',\n labelKey: 'perps.sort.price_change',\n field: 'priceChange',\n direction: 'desc',\n },\n {\n id: 'openInterest',\n labelKey: 'perps.sort.open_interest',\n field: 'openInterest',\n direction: 'desc',\n },\n {\n id: 'fundingRate',\n labelKey: 'perps.sort.funding_rate',\n field: 'fundingRate',\n direction: 'desc',\n },\n ] as const,\n} as const;\n\n/**\n * Type for valid sort option IDs\n * Derived from SORT_OPTIONS to ensure type safety\n * Valid values: 'volume' | 'priceChange' | 'openInterest' | 'fundingRate'\n */\nexport type SortOptionId =\n (typeof MARKET_SORTING_CONFIG.SortOptions)[number]['id'];\n\n/**\n * Perps interface mode.\n *\n * `Lite` is the simplified default experience; `Pro` exposes the advanced\n * trading layout (chart, order book, inline order form).\n */\nexport enum PerpsMode {\n Lite = 'lite',\n Pro = 'pro',\n}\n\n/**\n * Side filter for the Pro Positions list (long/short/all).\n *\n * Independent of `ordersSideFilter`. Shared across markets via\n * `proLayoutPreferences.positionsSideFilter`.\n */\nexport type ProPositionsSideFilter = 'all' | 'long' | 'short';\n\n/**\n * Sort fields available on the Pro Positions list.\n */\nexport type ProPositionsSortField =\n | 'positionValue'\n | 'unrealizedPnl'\n | 'fundingRate';\n\n/**\n * Sort direction for the Pro Positions list.\n */\nexport type ProPositionsSortDirection = 'asc' | 'desc';\n\n/**\n * Side filter for the Pro Orders list (long/short/all).\n *\n * Independent of `positionsSideFilter`. Shared across markets via\n * `proLayoutPreferences.ordersSideFilter`.\n */\nexport type ProOrdersSideFilter = 'all' | 'long' | 'short';\n\n/**\n * Sort fields available on the Pro Orders list.\n */\nexport type ProOrdersSortField = 'orderValue' | 'size' | 'price' | 'time';\n\n/**\n * Sort direction for the Pro Orders list.\n */\nexport type ProOrdersSortDirection = 'asc' | 'desc';\n\n/**\n * Currency used by the Pro order-book size/total column.\n */\nexport type OrderBookListCurrency = 'base' | 'usd';\n\n/**\n * Value shown by the Pro order-book size/total column.\n */\nexport type OrderBookListMetric = 'size' | 'total';\n\n/**\n * Market-agnostic Pro order-book display preferences.\n */\nexport type OrderBookPreferences = {\n currency: OrderBookListCurrency;\n metric: OrderBookListMetric;\n};\n\n/**\n * Default Pro order-book display preferences.\n */\nexport const DEFAULT_ORDER_BOOK_PREFERENCES: OrderBookPreferences = {\n currency: 'usd',\n metric: 'total',\n};\n\n/**\n * Pro-mode layout preferences (network-independent).\n *\n * Flat object that persists across markets (unlike the per-market\n * `tradeConfigurations`). `chartExpanded` and the `*Position` fields are\n * reserved for future container-position UI. Positions and Orders each have\n * their own side filter and sort so they survive market navigation and app\n * restarts independently.\n */\nexport type ProLayoutPreferences = {\n orderBookExpanded: boolean;\n chartExpanded: boolean;\n orderBookPosition: 'left' | 'right';\n orderFormPosition: 'left' | 'right';\n positionsSideFilter: ProPositionsSideFilter;\n positionsSortField: ProPositionsSortField;\n positionsSortDirection: ProPositionsSortDirection;\n ordersSideFilter: ProOrdersSideFilter;\n ordersSortField: ProOrdersSortField;\n ordersSortDirection: ProOrdersSortDirection;\n};\n\n/**\n * Default pro-mode layout preferences.\n *\n * Shared by `getDefaultPerpsControllerState()`, the controller getter, and the\n * selector so callers always receive a fully-populated object even when the\n * persisted state predates this field.\n */\nexport const DEFAULT_PRO_LAYOUT_PREFERENCES: ProLayoutPreferences = {\n orderBookExpanded: false,\n chartExpanded: true,\n orderBookPosition: 'left',\n orderFormPosition: 'right',\n positionsSideFilter: 'all',\n positionsSortField: 'positionValue',\n positionsSortDirection: 'desc',\n ordersSideFilter: 'all',\n ordersSortField: 'time',\n ordersSortDirection: 'desc',\n};\n\n/**\n * Default Perps interface mode.\n */\nexport const DEFAULT_PERPS_MODE: PerpsMode = PerpsMode.Lite;\n\n/**\n * Default market-agnostic order type.\n */\nexport const DEFAULT_SELECTED_ORDER_TYPE = 'market' as const;\n\n/**\n * Funding rate display configuration\n * Controls how funding rates are formatted and displayed\n */\nexport const FUNDING_RATE_CONFIG = {\n // Number of decimal places to display for funding rates\n Decimals: 4,\n // Default display value when funding rate is zero or unavailable\n ZeroDisplay: '0.0000%',\n // Multiplier to convert decimal funding rate to percentage\n PercentageMultiplier: 100,\n} as const;\n\n/**\n * Decimal places shown for each displayed perps value, shared by Mobile,\n * Extension and Terminal. Pass one as the `decimals` option of the display\n * formatters (`formatPercentage`, `formatCrossMarginRatio`, `formatPnl`,\n * `formatPerpsFiat`, `formatFundingRate`, `formatFeeBps`,\n * `formatLiquidationDistance`, `formatPerpsCompact`,\n * `formatPerpsUsdInput`). Prices follow `PRICE_RANGES_UNIVERSAL` instead.\n */\nexport const PERPS_DISPLAY_PRECISION = {\n // Generic percentage, such as the 24h change: \"+5.25%\"\n Percentage: 2,\n // Cross margin account ratio and usage, from a 0..1 ratio: \"17.4%\", \"63%\"\n CrossMarginRatioPercent: 1,\n // Return on equity: \"+10.3%\"\n RoePercent: 1,\n // Profit and loss in USD: \"+$12.34\"\n Pnl: 2,\n // Fee amount in USD: \"$1.50\"\n Fee: 2,\n // Fee rate as a percentage: \"0.045%\"\n FeeRatePercent: 3,\n // Funding rate as a percentage: \"0.0125%\"\n FundingRatePercent: FUNDING_RATE_CONFIG.Decimals,\n // Estimated slippage of an order as a percentage: \"0.0021%\"\n SlippageEstimatePercent: 4,\n // Most decimals a displayed price may have (Hyperliquid limit)\n MaxPriceDecimals: DECIMAL_PRECISION_CONFIG.MaxPriceDecimals,\n // Most decimals of a fee in basis points: \"4.5 bps\", \"1.44 bps\"\n FeeBps: 2,\n // Distance from the liquidation price as a percentage: \"30.00%\"\n LiquidationDistancePercent: 2,\n // Most decimals of a leverage multiplier, trailing zeros dropped: \"0.2x\", \"1.21x\"\n Leverage: 2,\n // Most decimals of TWAP progress as a percentage: \"25%\", \"33.33%\"\n TwapProgressPercent: 2,\n // Most decimals of a typed USD amount: \"12.34\"\n UsdInput: 2,\n // Most digits of a typed USD amount, integer and fraction together\n UsdInputMaxDigits: 9,\n // Volume and open interest from $1M up, and below $1K: \"$1.23M\", \"$999.50\"\n VolumeCompact: 2,\n // Volume and open interest in thousands: \"$123K\"\n VolumeCompactThousands: 0,\n // Order book size and total from 1K up: \"$2.1K\", \"604.9K\"\n OrderBookCompact: 1,\n // Most decimals of an abbreviated order book price: \"$61.47K\"\n OrderBookAbbreviatedPriceMax: 3,\n // Distance of an order book depth level from the mid price as a\n // percentage: \"+0.0125%\"\n OrderBookDepthRangePercent: 4,\n // Most decimals of the depth chart zoom range as a percentage: \"0.00125\"\n OrderBookDepthZoomRangePercentMax: 5,\n // Most decimals of a TWAP sub-order's base-asset size: \"0.00012\"\n TwapSuborderSize: 5,\n} as const;\n\n/**\n * Provider configuration for multi-provider support\n */\nexport const PROVIDER_CONFIG = {\n /** Default perpetual DEX provider when no explicit selection exists */\n DefaultProvider: 'hyperliquid' as const,\n /**\n * Force Lighter to testnet only. Off: Lighter follows the global network\n * toggle — mainnet reads AND writes are enabled (the initial rollout\n * write gate was removed once the write path was validated end-to-end\n * on testnet). Flip on to pin Lighter to testnet regardless of the\n * global network toggle.\n */\n LIGHTER_TESTNET_ONLY: false,\n} as const;\n\n// Disk-backed cold-start cache keys and throttle interval.\n// The user-data key ends in _V2 because the AccountState balance contract\n// changed (TAT-3047) and has no in-payload version field. Bumping the key\n// forces a one-time empty cache on upgrade — consumers fall through to\n// skeleton/fallback until the first WS tick, avoiding stale legacy-shape\n// reads that would surface as $0 balances.\nexport const PERPS_DISK_CACHE_MARKETS = 'PERPS_DISK_CACHE_MARKETS';\nexport const PERPS_DISK_CACHE_USER_DATA = 'PERPS_DISK_CACHE_USER_DATA_V2';\nexport const PERPS_DISK_CACHE_THROTTLE_MS = 30_000;\n\n/**\n * Minimum interval between WebSocket-triggered HL `userAbstraction`\n * refreshes. Balances picking up HL-web mode flips (Unified ↔ Standard)\n * promptly against burning REST quota on every spot tick. Covers the\n * observed user pattern of flipping mode once per session at most.\n */\nexport const ABSTRACTION_MODE_REFRESH_THROTTLE_MS = 60_000;\n\n/**\n * Build the standard provider:network cache key from controller state.\n *\n * @param state - Controller state containing provider and network info.\n * @param state.activeProvider - Active perps provider name.\n * @param state.isTestnet - Whether testnet mode is active.\n * @returns Cache key in the format \"provider:mainnet\" or \"provider:testnet\".\n */\nexport function getProviderNetworkKey(state: {\n activeProvider?: string;\n isTestnet?: boolean;\n}): string {\n return `${state.activeProvider ?? PROVIDER_CONFIG.DefaultProvider}:${state.isTestnet ? 'testnet' : 'mainnet'}`;\n}\n\n/**\n * Build a provider:network cache key for a specific provider id.\n * Accounts for LIGHTER_TESTNET_ONLY: when set, Lighter stays on testnet\n * regardless of the global network flag.\n *\n * @param providerId - The provider identifier (e.g. \"hyperliquid\", \"lighter\").\n * @param isTestnet - Global testnet flag from controller state.\n * @returns Cache key in the format \"provider:mainnet\" or \"provider:testnet\".\n */\nexport function buildProviderCacheKey(\n providerId: string,\n isTestnet: boolean,\n): string {\n let effectiveTestnet = isTestnet;\n if (providerId === 'lighter') {\n effectiveTestnet = PROVIDER_CONFIG.LIGHTER_TESTNET_ONLY || isTestnet;\n }\n return `${providerId}:${effectiveTestnet ? 'testnet' : 'mainnet'}`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"perpsConfig.js","sourceRoot":"","sources":["../../src/constants/perpsConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,4CAA4C,CAAC;AACzE,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC;AAElC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,cAAc,EAAE,cAAc;IAC9B,WAAW,EAAE,OAAO,EAAE,kFAAkF;IACxG,sGAAsG;IACtG,4BAA4B,EAAE,eAAe;IAC7C,uFAAuF;IACvF,uBAAuB,EAAE,KAAK;IAC9B,gBAAgB,EAAE,IAAI,EAAE,YAAY;IACpC,qBAAqB,EAAE,IAAI,EAAE,WAAW;IACxC,yBAAyB,EAAE,MAAM,EAAE,6FAA6F;IAChI,mBAAmB,EAAE,MAAM,EAAE,gEAAgE;IAC7F,0BAA0B,EAAE,MAAM,EAAE,4DAA4D;IAEhG,8BAA8B;IAC9B,uBAAuB,EAAE,MAAM,EAAE,+GAA+G;IAChJ,0BAA0B,EAAE,MAAM,EAAE,2EAA2E;IAC/G,sBAAsB,EAAE,KAAK,EAAE,oDAAoD;IACnF,mBAAmB,EAAE,GAAG,EAAE,kEAAkE;IAC5F,0BAA0B,EAAE,GAAG,EAAE,2GAA2G;IAC5I,0BAA0B,EAAE,GAAG,EAAE,uDAAuD;IACxF,0BAA0B,EAAE,GAAG,EAAE,+EAA+E;IAChH,sBAAsB,EAAE,GAAG,EAAE,0DAA0D;I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AAe,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;AACjH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAAkB,EAClB,SAAkB;IAElB,IAAI,gBAAgB,GAAG,SAAS,CAAC;IACjC,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,gBAAgB,GAAG,eAAe,CAAC,oBAAoB,IAAI,SAAS,CAAC;IACvE,CAAC;IACD,OAAO,GAAG,UAAU,IAAI,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;AACrE,CAAC","sourcesContent":["/**\n * Perps feature constants - Controller layer (portable)\n *\n * This file contains only controller-portable configuration:\n * - Constants used by controller logic, providers, and services\n * - Calculation thresholds, API configs, and protocol constants\n *\n * UI-only constants (layout, display, navigation) live in:\n * app/components/UI/Perps/constants/perpsConfig.ts\n */\nexport const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';\nexport const ZERO_BALANCE = '0x0';\n\nexport const PERPS_CONSTANTS = {\n FeatureFlagKey: 'perpsEnabled',\n FeatureName: 'perps', // Constant for Sentry error filtering - enables \"feature:perps\" dashboard queries\n /** Token description used to identify the synthetic \"Perps balance\" option in pay-with token lists */\n PerpsBalanceTokenDescription: 'perps-balance',\n /** Symbol displayed for the synthetic \"Perps balance\" token in pay-with token lists */\n PerpsBalanceTokenSymbol: 'USD',\n WebsocketTimeout: 5000, // 5 seconds\n WebsocketCleanupDelay: 1000, // 1 second\n BackgroundDisconnectDelay: 20_000, // 20 seconds delay before disconnecting when app is backgrounded or when user exits perps UX\n ConnectionTimeoutMs: 10_000, // 10 seconds timeout for connection and position loading states\n DefaultMonitoringTimeoutMs: 10_000, // 10 seconds default timeout for data monitoring operations\n\n // Connection timing constants\n ConnectionGracePeriodMs: 20_000, // 20 seconds grace period before actual disconnection (same as BackgroundDisconnectDelay for semantic clarity)\n ConnectionAttemptTimeoutMs: 30_000, // 30 seconds timeout for connection attempts to prevent indefinite hanging\n WebsocketPingTimeoutMs: 5_000, // 5 seconds timeout for WebSocket health check ping\n ConnectRetryDelayMs: 200, // Delay before retrying connect() when connection isn't ready yet\n ForegroundPingRetryDelayMs: 500, // Delay before retrying ping in resumeFromForeground — JS thread may be sluggish right after foregrounding\n ReconnectionCleanupDelayMs: 500, // Platform-agnostic delay to ensure WebSocket is ready\n ReconnectionDelayAndroidMs: 300, // Android-specific reconnection delay for better reliability on slower devices\n ReconnectionDelayIosMs: 100, // iOS-specific reconnection delay for optimal performance\n ReconnectionRetryDelayMs: 5_000, // 5 seconds delay between reconnection attempts\n NetworkRestoreMaxRetries: 8, // Max retry attempts when reconnecting after WiFi/network restore\n NetworkRestoreRetryBaseMs: 1_500, // Base delay (ms) between network restore retries (multiplied by attempt number)\n\n // Connection manager timing constants\n BalanceUpdateThrottleMs: 15000, // Update at most every 15 seconds to reduce state updates in PerpsConnectionManager\n InitialDataDelayMs: 100, // Delay to allow initial data to load after connection establishment\n\n // Order submission timing\n PlaceOrderTimeoutMs: 60_000, // Hard timeout for provider round-trip in TradingService.placeOrder\n\n // Deposit toast timing\n DepositTakingLongerToastDelayMs: 30_000, // Delay before showing \"Deposit taking longer than usual\" toast\n\n DefaultAssetPreviewLimit: 5,\n DefaultMaxLeverage: 3 as number, // Default fallback max leverage when market data is unavailable - conservative default\n FallbackPriceDisplay: '$---', // Display when price data is unavailable\n FallbackPercentageDisplay: '--%', // Display when change data is unavailable\n FallbackDataDisplay: '--', // Display when non-price data is unavailable\n ZeroAmountDisplay: '$0', // Display for zero dollar amounts (e.g., no volume)\n ZeroAmountDetailedDisplay: '$0.00', // Display for zero dollar amounts with decimals\n\n RecentActivityLimit: 3,\n\n // Historical data fetching constants\n FillsLookbackMs: 90 * 24 * 60 * 60 * 1000, // 3 months in milliseconds - limits REST API fills fetch\n\n // Recently viewed markets\n RecentlyViewedMarketsTtlMs: 24 * 60 * 60 * 1000, // 24 hours TTL for recently viewed market entries\n RecentlyViewedMarketsLimit: 10, // Maximum number of recently viewed markets to track\n\n // Temporary order form draft\n PendingTradeConfigurationTtlMs: 30_000, // Restore a draft only during a brief navigation away from the form\n} as const;\n\n/**\n * Withdrawal-specific constants (protocol-agnostic)\n * Note: Protocol-specific values like estimated time should be defined in each protocol's config\n */\nexport const WITHDRAWAL_CONSTANTS = {\n DefaultMinAmount: '1.01', // Default minimum withdrawal amount in USDC\n DefaultFeeAmount: 1, // Default withdrawal fee in USDC\n DefaultFeeToken: 'USDC', // Default fee token\n} as const;\n\n/**\n * Validation thresholds for UI warnings and checks\n * These values control when warnings are shown to users\n */\nexport const VALIDATION_THRESHOLDS = {\n // Leverage threshold for warning users about high leverage\n HighLeverageWarning: 20, // Show warning when leverage > 20x\n\n // Limit price difference threshold (as decimal, 0.1 = 10%)\n LimitPriceDifferenceWarning: 0.1, // Warn if limit price differs by >10% from current price\n\n // Price deviation threshold (as decimal, 0.1 = 10%)\n PriceDeviation: 0.1, // Warn if perps price deviates by >10% from spot price\n} as const;\n\n/**\n * Order slippage configuration\n * Controls default slippage tolerance for different order types\n * Conservative defaults based on HyperLiquid platform interface\n * See: docs/perps/hyperliquid/ORDER-MATCHING-ERRORS.md\n */\nexport const ORDER_SLIPPAGE_CONFIG = {\n // Market order slippage (basis points)\n // 300 basis points = 3% = 0.03 decimal\n // Conservative default for measured rollout, prevents most IOC failures\n DefaultMarketSlippageBps: 300,\n\n // TP/SL order slippage (basis points)\n // 1000 basis points = 10% = 0.10 decimal\n // Aligns with HyperLiquid platform default for triggered orders\n DefaultTpslSlippageBps: 1000,\n\n // Limit order slippage (basis points)\n // 100 basis points = 1% = 0.01 decimal\n // Kept conservative as limit orders rest on book (not IOC/immediate execution)\n DefaultLimitSlippageBps: 100,\n} as const;\n\n/**\n * Defaults and bounds for the emulated `chase` placement.\n *\n * No supported venue exposes a chase as an API action — HyperLiquid documents it\n * as running client-side — so the strategy is run here: a post-only order rests\n * one tick inside the spread and is cancelled and re-placed as the touch moves.\n * The poll floor limits request frequency; callers may also set explicit\n * duration or repricing caps. Protocol-agnostic — a provider that gains a\n * native chase ignores these entirely.\n */\nexport const CHASE_ORDER_CONFIG = {\n /** Maximum submissions used to survive a touch moving before an ALO rests. */\n InitialPlacementAttempts: 3,\n /** How often the touch is re-read when the caller does not say. */\n DefaultIntervalMs: 15000,\n /** Floor on the poll interval, whatever the caller asks for. */\n MinIntervalMs: 1000,\n /**\n * How many chases may run at once.\n *\n * HyperLiquid documents a cap of five simultaneously active chase orders. It\n * is a venue rule rather than controller policy, but it is spelled here\n * alongside the rest of the chase configuration because an emulated chase is\n * the only thing that can enforce it.\n */\n MaxActiveSessions: 5,\n /** Most ended chases a live chase list keeps in history, newest first. */\n HistoryLimit: 50,\n /**\n * Reads a live chase list keeps a running chase that a read omits. An\n * aggregated read drops a provider whose read failed, so one omission is not\n * proof the chase is gone.\n */\n OmissionGraceReads: 1,\n} as const;\n\n/** How a shared stream channel reopens a source that failed. */\nexport const STREAM_RETRY_CONFIG = {\n /** Delay before the first reopen; it doubles with each attempt. */\n BaseDelayMs: 1000,\n /** Longest delay between two attempts. */\n MaxDelayMs: 30000,\n /** Reopens before the channel waits for a reconnect or a new reader. */\n MaxAttempts: 5,\n /** How long a source must run, with data, to earn a fresh budget. */\n StableMs: 60000,\n} as const;\n\n/**\n * How long a market must look retired, or quoted again, before it counts as a\n * change. An illiquid market's book empties for shorter than that.\n */\nexport const MARKET_STATE_CONFIRM_MS = 60000;\n\n/** Wait after a market change before reading the markets again. */\nexport const MARKET_CHANGE_SETTLE_MS = 1000;\n\n/** Wait after a fill before reading the fee rates again. */\nexport const FEE_CHANGE_SETTLE_MS = 1000;\n\n/** Largest delay supported by setTimeout. */\nexport const MAX_TIMEOUT_MS = 2_147_483_647;\n\n/** Read timing of a live TWAP list. */\nexport const TWAP_ORDER_CONFIG = {\n /** Delay before re-reading when the stream lists a schedule no read has. */\n StreamCatchUpIntervalMs: 1000,\n} as const;\n\n/** Thresholds for the price warnings shown on a resting order draft. */\nexport const ORDER_PRICE_WARNING_CONFIG = {\n /** Distance from the touch, as a fraction, past which a price is far from market. */\n FarFromMarketRatio: 0.05,\n} as const;\n\n/** Public lifecycle states reported for an emulated Chase order. */\nexport const CHASE_ORDER_STATUS = {\n Active: 'active',\n TerminationPending: 'termination_pending',\n Backgrounded: 'backgrounded',\n MaxDistanceReached: 'max_distance_reached',\n DurationReached: 'duration_reached',\n RepricingLimitReached: 'repricing_limit_reached',\n Filled: 'filled',\n Canceled: 'canceled',\n Failed: 'failed',\n} as const;\n\n/**\n * Bounds and step for the user-configurable max slippage preference (basis points).\n * Shared by the controller (`setMaxSlippage`) and UI (`slippageConfig.ts`).\n */\nexport const MAX_SLIPPAGE_BOUNDS = {\n MinBps: 10,\n MaxBps: 1000,\n StepBps: 10,\n} as const;\n\n/**\n * Max order amount buffer to reduce \"Insufficient margin\" rejections from the exchange.\n * When the user selects 100% (slider or Max), we cap the order at (1 - this) of the\n * theoretical max so that fees, rounding, and exchange-side margin checks are covered.\n * Value as decimal (e.g. 0.005 = 0.5%).\n */\nexport const MAX_ORDER_MARGIN_BUFFER = 0.005; // 0.5%\n\n/**\n * Performance optimization constants\n * These values control debouncing and throttling for better performance\n */\nexport const PERFORMANCE_CONFIG = {\n // Price updates debounce delay (milliseconds)\n // Batches rapid WebSocket price updates to reduce re-renders\n PriceUpdateDebounceMs: 1000,\n\n // Order validation debounce delay (milliseconds)\n // Prevents excessive validation calls during rapid form input changes\n ValidationDebounceMs: 300,\n\n // Freshness window for provider market metadata used by strategy capability reads\n OrderCapabilitiesMetaFreshnessMs: 30_000,\n\n // Liquidation price debounce delay (milliseconds)\n // Prevents excessive liquidation price calls during rapid form input changes\n LiquidationPriceDebounceMs: 500,\n\n // Candle subscription debounce delay (milliseconds)\n // Prevents WS subscription churn during rapid market switching (#28141)\n CandleConnectDebounceMs: 500,\n\n // Order-form slippage estimate throttle (milliseconds)\n // Updates the estimated-slippage value derived from the live L2 order book\n // no more than once per window. Aggressive enough to keep the row reactive\n // while the user edits the amount, conservative enough to avoid re-render\n // pressure on every book tick.\n SlippageEstimateThrottleMs: 250,\n\n // Order-book levels sampled when estimating slippage\n // Number of price levels (per side) walked by `calculateEstimatedSlippageBps`\n // to fill the requested USD notional. Matches the L2 sample size used by the\n // order-book panel and is enough depth for the typical order sizes we\n // surface in the order form.\n SlippageEstimateBookLevels: 10,\n\n // Candle WS teardown delay (milliseconds)\n // When the last subscriber for a cacheKey unsubscribes, wait this long before\n // tearing down the WS. A subsequent subscribe inside the window cancels the\n // teardown so rapid back-and-forth switches do not churn the connection.\n CandleTeardownDelayMs: 150,\n\n // Perps REST coalesce TTL (milliseconds)\n //\n // Window in which identical GET-style REST calls (getOrderFills, getOrders,\n // getFunding, historicalOrders) share a single in-flight promise / cached\n // result. `forceRefresh` still bypasses the cache end-to-end (hooks →\n // controller → MarketDataService → provider → HyperLiquidClientService), so\n // pull-to-refresh always hits the network.\n //\n // Why 60 s: HyperLiquid's documented rate limit is 1200 weight / IP /\n // rolling 60 s window. Sizing TTL = window length caps each endpoint-per-\n // account at ≤1 REST hit per window under any UI activity pattern — rapid\n // market switching, re-mounts (usePerpsMarketFills, usePerpsTransactionHistory),\n // and multi-tab scans all share a single request. Live fills/orders/prices\n // still flow via WS subscriptions, so REST is seed/backfill only — cache\n // staleness inside the 60 s window is never user-visible.\n PerpsRestCoalesceTtlMs: 60_000,\n\n // Candle snapshot REST coalesce TTL (milliseconds).\n // Longer than PerpsRestCoalesceTtlMs because WS stream keeps live candles\n // fresh — the REST snapshot only seeds the chart on initial subscribe. A\n // 30 s window lets rapid market switching (pass 1 → pass 2 of a stress\n // loop) share the same snapshot per (symbol, interval), cutting\n // candleSnapshot REST weight roughly in half.\n PerpsCandleCoalesceTtlMs: 30_000,\n\n // Navigation params delay (milliseconds)\n // Required for React Navigation to complete state transitions before setting params\n // This ensures navigation context is available when programmatically selecting tabs\n NavigationParamsDelayMs: 200,\n\n // Tab control reset delay (milliseconds)\n // Delay to reset programmatic tab control after tab switching to prevent render loops\n TabControlResetDelayMs: 500,\n\n // Market data cache duration (milliseconds)\n // How long to cache market list data before fetching fresh data\n MarketDataCacheDurationMs: 5 * 60 * 1000, // 5 minutes\n\n // Asset metadata cache duration (milliseconds)\n // How long to cache asset icon validation results\n AssetMetadataCacheDurationMs: 60 * 60 * 1000, // 1 hour\n\n // Max leverage cache duration (milliseconds)\n // How long to cache max leverage values per asset (leverage rarely changes)\n MaxLeverageCacheDurationMs: 60 * 60 * 1000, // 1 hour\n\n // Rewards cache durations (milliseconds)\n // How long to cache fee discount data from rewards API\n FeeDiscountCacheDurationMs: 5 * 60 * 1000, // 5 minutes\n // How long to cache points calculation parameters from rewards API\n PointsCalculationCacheDurationMs: 5 * 60 * 1000, // 5 minutes\n\n /**\n * Performance logging markers for filtering logs during development and debugging\n * These markers help isolate performance-related logs from general application logs\n * Usage: Use in DevLogger calls to easily filter specific performance areas\n * Impact: Development only (uses DevLogger) - zero production performance cost\n *\n * Examples:\n * - Filter Sentry performance logs: `adb logcat | grep PERPSMARK_SENTRY`\n * - Filter MetaMetrics events: `adb logcat | grep PERPSMARK_METRICS`\n * - Filter WebSocket performance: `adb logcat | grep PERPSMARK_WS`\n * - Filter all Perps performance: `adb logcat | grep PERPSMARK_`\n */\n LoggingMarkers: {\n // Sentry performance measurement logs (screen loads, bottom sheets, API timing)\n SentryPerformance: 'PERPSMARK_SENTRY',\n\n // MetaMetrics event tracking logs (user interactions, business analytics)\n MetametricsEvents: 'PERPSMARK_METRICS',\n\n // WebSocket performance logs (connection timing, data flow, reconnections)\n WebsocketPerformance: 'PERPSMARK_SENTRY_WS',\n } as const,\n} as const;\n\nexport const TP_SL_CONFIG = {\n UsePositionBoundTpsl: true,\n} as const;\n\n/**\n * Quick-pick RoE percentages for take profit (positive) and stop loss\n * (negative) in TP/SL forms, as Mobile and Extension show them.\n */\nexport const TP_SL_ROE_PRESETS = {\n TakeProfit: [10, 25, 50, 100],\n StopLoss: [-5, -10, -25, -50],\n} as const;\n\n/**\n * Bounds applied to a HyperLiquid TWAP placement.\n *\n * The pinned HyperLiquid SDK (0.33.1) validates the TWAP duration as a safe\n * integer in `[5, 1440]` before signing, although the venue currently documents\n * a maximum of seven days (`10080` minutes). The controller exposes the SDK's\n * narrower cap until that dependency supports the venue limit, avoiding an\n * opaque SDK error. `MinNotionalUsd` is the venue's documented minimum *total*\n * order size for a TWAP, which it enforces instead of the per-order minimum —\n * its suborders are its own business.\n *\n * Carries the venue prefix, like `HYPERLIQUID_ORDER_LIMITS`, because these are\n * venue/SDK constraints rather than controller policy.\n *\n * From: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/order-types\n */\nexport const HYPERLIQUID_TWAP_LIMITS = {\n MinDurationMinutes: 5,\n MaxDurationMinutes: 1440,\n MinNotionalUsd: 100,\n /** The venue sends one TWAP suborder every 30 seconds. */\n SliceIntervalSeconds: 30,\n} as const;\n\n/**\n * HyperLiquid order limits based on leverage\n * From: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/contract-specifications\n */\nexport const HYPERLIQUID_ORDER_LIMITS = {\n // Market orders\n MarketOrderLimits: {\n // $15,000,000 for max leverage >= 25\n HighLeverage: 15_000_000,\n // $5,000,000 for max leverage in [20, 25)\n MediumHighLeverage: 5_000_000,\n // $2,000,000 for max leverage in [10, 20)\n MediumLeverage: 2_000_000,\n // $500,000 for max leverage < 10\n LowLeverage: 500_000,\n },\n // Limit orders are 10x market order limits\n LimitOrderMultiplier: 10,\n} as const;\n\n/**\n * Cross-margin ratio levels (`PerpsAccountSummary.accountRatio`, maintenance\n * margin over cross collateral; liquidation at 1) where clients warn: a\n * warning from `Warning` up, danger above `Danger`.\n */\nexport const CROSS_MARGIN_RATIO_THRESHOLDS = {\n Warning: 0.5,\n Danger: 0.75,\n} as const;\n\n/**\n * Order-book price grouping ladder shared by Mobile, Extension and Terminal.\n * The `decade` ladder is `10^(floor(log10(mid)) - DecadeOffset)` times each\n * of `Multipliers`; the `tick` ladder is the market tick times each of\n * `TickMultipliers`.\n */\nexport const ORDER_BOOK_GROUPING_CONFIG = {\n DecadeOffset: 4,\n Multipliers: [1, 2, 5, 10, 100, 1000],\n /** Multipliers of the market tick for the `tick` ladder. */\n TickMultipliers: [1, 2, 5, 10, 20, 50],\n /** Index of the default option; the middle option when the ladder is shorter. */\n DefaultOptionIndex: 3,\n /** Options when the mid price is unknown. */\n FallbackOptions: [0.01, 0.1, 1],\n /** Significant-figure range a venue aggregates a book stream at. */\n MinSignificantFigures: 2,\n MaxSignificantFigures: 5,\n} as const;\n\n/**\n * Close position configuration\n * Controls behavior and constants specific to position closing\n */\nexport const CLOSE_POSITION_CONFIG = {\n // Decimal places for USD amount input display\n UsdDecimalPlaces: 2,\n\n // Default close percentage when opening the close position view\n DefaultClosePercentage: 100,\n\n // Precision for position size calculations to prevent rounding errors\n AmountCalculationPrecision: 6,\n\n // Throttle delay for real-time price updates during position closing\n PriceThrottleMs: 3000,\n\n // Fallback decimal places for tokens without metadata\n FallbackTokenDecimals: 18,\n} as const;\n\n/**\n * Margin adjustment configuration\n * Controls behavior for adding/removing margin from positions\n */\nexport const MARGIN_ADJUSTMENT_CONFIG = {\n // Risk thresholds for margin removal warnings\n // Threshold values represent ratio of (price distance to liquidation) / (liquidation price)\n // Values < 1.0 mean price is dangerously close to liquidation\n LiquidationRiskThreshold: 1.2, // 20% buffer before liquidation - triggers danger state\n LiquidationWarningThreshold: 1.5, // 50% buffer before liquidation - triggers warning state\n\n // Minimum margin adjustment amount (USD)\n // Prevents dust adjustments and ensures meaningful position changes\n MinAdjustmentAmount: 1,\n\n // Precision for margin calculations\n // Ensures accurate decimal handling in margin/leverage calculations\n CalculationPrecision: 6,\n\n // Safety buffer for margin removal to account for HyperLiquid's transfer margin requirement\n // HyperLiquid enforces: transfer_margin_required = max(initial_margin_required, 0.1 * total_position_value)\n // See: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/margin-and-pnl\n MarginRemovalSafetyBuffer: 0.1,\n\n // Share of notional kept back from a margin removal for the mark price\n // moving before the venue processes it; the exact boundary is rejected on\n // any adverse tick\n MarginRemovalPriceMoveBuffer: 0.01,\n\n // Fallback max leverage when market data is unavailable\n // Conservative value to prevent over-removal of margin\n // Most HyperLiquid assets support at least 50x leverage\n FallbackMaxLeverage: 50,\n} as const;\n\n/**\n * Data Lake API configuration\n * Endpoints for reporting perps trading activity for notifications\n */\nexport const DATA_LAKE_API_CONFIG = {\n // Order reporting endpoint - only used for mainnet perps trading\n OrdersEndpoint: 'https://perps.api.cx.metamask.io/api/v1/orders',\n} as const;\n\n/**\n * notify-perps settings for Lighter notification enrollment and the shared\n * fire-and-forget retry policy of the notify-perps reporters\n */\nexport const NOTIFY_PERPS_API_CONFIG = {\n // Path appended to `notifyPerpsApi.baseUrl`\n LighterNotificationAccountsPath: '/api/v1/lighter/accounts',\n // Retries after the first attempt, with exponential backoff from RetryDelayMs\n MaxRetries: 3,\n RetryDelayMs: 1000,\n} as const;\n\n/**\n * Subscription benefits cache (stale-while-revalidate).\n *\n * The unified fee resolver never awaits the benefits read, so these bounds are\n * what decide whether the cached snapshot may grant the perps fee waiver:\n * - within `FreshMs` the snapshot is served as-is,\n * - past `FreshMs` it is still served while a background refresh runs,\n * - past `MaxStaleMs` it is no longer trusted to grant the waiver, and the\n * resolver falls back to the next-lowest fee source.\n */\nexport const SUBSCRIPTION_BENEFITS_CACHE = {\n FreshMs: 60_000, // 1 minute – no refresh triggered\n MaxStaleMs: 10 * 60 * 1000, // 10 minutes – ceiling for granting the waiver\n} as const;\n\n/**\n * Client order ID marking for the ADR 0064 subscription fee waiver.\n *\n * A HyperLiquid cloid is 16 bytes. When the subscription source wins the fee\n * comparison, the order's cloid is stamped so the fill can be attributed to the\n * subscription program off the existing HL fill fan-out, with no dedicated\n * builder address and no per-user approval:\n *\n * ```\n * 0x <program marker: 4 bytes> <flags: 1 byte> <entropy: 11 bytes>\n * ```\n *\n * The flag byte follows the leading marker rather than replacing it, so the\n * marking composes with the cloid the Scale ladder already builds: a Scale rung\n * keeps its own `4d4d5343` marker and its rung index, and only the flag byte is\n * claimed, leaving group recovery and cancel-by-cloid intact.\n *\n * `ProgramId` is isolated in this one constant so every marking and decoding\n * path reads the marker from a single place; see its own documentation below\n * for the registered value and how it is encoded.\n */\nexport const SUBSCRIPTION_CLOID_CONFIG = {\n /**\n * Reserved program marker, 4 bytes as lowercase hex without the `0x`.\n *\n * The registry assigns perps subscriptions program_id `0x0100`, from the\n * `0x0000`–`0x00FF`-adjacent range reserved for core protocol features. It is\n * a 2-byte id, zero-extended big-endian into this 4-byte marker field so the\n * rest of the layout — flag byte at a fixed offset, 11 bytes of entropy — is\n * unchanged. No previously released client emitted a cloid starting with\n * these bytes, and it cannot collide with the Scale marker (`4d4d5343`),\n * which is what makes the decoder safe against historical fills.\n */\n ProgramId: '00000100',\n\n /** Hex characters in the leading program marker (4 bytes). */\n ProgramIdHexLength: 8,\n\n /** Hex characters of trailing entropy in a marked cloid (11 bytes). */\n EntropyHexLength: 22,\n} as const;\n\n/**\n * Flag bits carried in the flag byte of a subscription-marked cloid.\n */\nexport const SUBSCRIPTION_CLOID_FLAGS = {\n /** Bit 0 — a subscription fee reduction was applied to this order. */\n FeeReductionApplied: 0x01,\n} as const;\n\n/**\n * Remote feature flag that gates the subscription fee-waiver source.\n *\n * ADR 0064 Milestone 8 requires the subscription source to be killable on its\n * own, without touching VIP, season, or the default builder fee. Absent or\n * malformed, the flag reads as enabled so an unreachable flag service cannot\n * silently drop a benefit the user pays for.\n */\nexport const SUBSCRIPTION_FEE_WAIVER_FLAG = 'perpsSubscriptionFeeWaiverEnabled';\n\n/**\n * Terminal API configuration.\n * The full endpoint URL is injected at runtime via\n * `PerpsPlatformDependencies.terminalApi.marketDataUrl` from each client build\n * (dev/uat/prd); only cache settings live here.\n */\nexport const TERMINAL_API_CONFIG = {\n CacheTtlMs: 5 * 60 * 1000, // 5 minutes\n FetchTimeoutMs: 10_000, // 10 seconds – degrade to provider on slow Terminal\n} as const;\n\n/**\n * Decimal precision configuration\n * Controls maximum decimal places for price and input validation\n */\nexport const DECIMAL_PRECISION_CONFIG = {\n // Maximum decimal places for price input (matches Hyperliquid limit)\n // Used in TP/SL forms, limit price inputs, and price validation\n MaxPriceDecimals: 6,\n // Maximum significant figures allowed by HyperLiquid API\n // Orders with more than 5 significant figures will be rejected\n MaxSignificantFigures: 5,\n // Defensive fallback for size decimals when market data fails to load\n // Real szDecimals should always come from market data API (varies by asset)\n // Using 6 as safe maximum to prevent crashes (covers most assets)\n // NOTE: This is NOT semantically correct - just a defensive measure\n FallbackSizeDecimals: 6,\n} as const;\n\n/**\n * Decimal places kept by the shared TP/SL calculations.\n *\n * A calculated trigger price keeps the decimals of the first band whose\n * `BelowPrice` it is under, else `TriggerPriceDefaultDecimals`, without\n * trailing zeros: low-priced assets need more decimals. The provider rounds\n * the price to the asset's submission precision when the order is sent.\n */\nexport const TP_SL_PRECISION_CONFIG = {\n TriggerPriceBands: [\n { BelowPrice: 0.01, Decimals: 8 },\n { BelowPrice: 1, Decimals: DECIMAL_PRECISION_CONFIG.MaxPriceDecimals },\n { BelowPrice: 100, Decimals: 4 },\n ],\n TriggerPriceDefaultDecimals: 2,\n // Decimal places of a calculated or displayed RoE or price-move percentage\n PercentageDecimals: 2,\n} as const;\n\n/**\n * Market sorting configuration\n * Controls sorting behavior and presets for the trending markets view\n */\nexport const MARKET_SORTING_CONFIG = {\n // Default sort settings\n DefaultSortOptionId: 'volume' as const,\n DefaultDirection: 'desc' as const,\n\n // Available sort fields (only includes fields supported by PerpsMarketData)\n SortFields: {\n Volume: 'volume',\n PriceChange: 'priceChange',\n OpenInterest: 'openInterest',\n FundingRate: 'fundingRate',\n /** `sortMarkets` only: the current price. */\n Price: 'price',\n /** `sortMarkets` only: the market name. */\n Name: 'name',\n } as const,\n\n // Sort button presets for filter chips (simplified buttons without direction)\n SortButtonPresets: [\n { field: 'volume', labelKey: 'perps.sort.volume' },\n { field: 'priceChange', labelKey: 'perps.sort.price_change' },\n { field: 'fundingRate', labelKey: 'perps.sort.funding_rate' },\n ] as const,\n\n // Sort options for the bottom sheet\n // All options support direction toggle (high-to-low / low-to-high)\n SortOptions: [\n {\n id: 'volume',\n labelKey: 'perps.sort.volume',\n field: 'volume',\n direction: 'desc',\n },\n {\n id: 'priceChange',\n labelKey: 'perps.sort.price_change',\n field: 'priceChange',\n direction: 'desc',\n },\n {\n id: 'openInterest',\n labelKey: 'perps.sort.open_interest',\n field: 'openInterest',\n direction: 'desc',\n },\n {\n id: 'fundingRate',\n labelKey: 'perps.sort.funding_rate',\n field: 'fundingRate',\n direction: 'desc',\n },\n ] as const,\n} as const;\n\n/**\n * Type for valid sort option IDs\n * Derived from SORT_OPTIONS to ensure type safety\n * Valid values: 'volume' | 'priceChange' | 'openInterest' | 'fundingRate'\n */\nexport type SortOptionId =\n (typeof MARKET_SORTING_CONFIG.SortOptions)[number]['id'];\n\n/**\n * Perps interface mode.\n *\n * `Lite` is the simplified default experience; `Pro` exposes the advanced\n * trading layout (chart, order book, inline order form).\n */\nexport enum PerpsMode {\n Lite = 'lite',\n Pro = 'pro',\n}\n\n/**\n * Side filter for the Pro Positions list (long/short/all).\n *\n * Independent of `ordersSideFilter`. Shared across markets via\n * `proLayoutPreferences.positionsSideFilter`.\n */\nexport type ProPositionsSideFilter = 'all' | 'long' | 'short';\n\n/**\n * Sort fields available on the Pro Positions list.\n */\nexport type ProPositionsSortField =\n | 'positionValue'\n | 'unrealizedPnl'\n | 'fundingRate';\n\n/**\n * Sort direction for the Pro Positions list.\n */\nexport type ProPositionsSortDirection = 'asc' | 'desc';\n\n/**\n * Side filter for the Pro Orders list (long/short/all).\n *\n * Independent of `positionsSideFilter`. Shared across markets via\n * `proLayoutPreferences.ordersSideFilter`.\n */\nexport type ProOrdersSideFilter = 'all' | 'long' | 'short';\n\n/**\n * Sort fields available on the Pro Orders list.\n */\nexport type ProOrdersSortField = 'orderValue' | 'size' | 'price' | 'time';\n\n/**\n * Sort direction for the Pro Orders list.\n */\nexport type ProOrdersSortDirection = 'asc' | 'desc';\n\n/**\n * Currency used by the Pro order-book size/total column.\n */\nexport type OrderBookListCurrency = 'base' | 'usd';\n\n/**\n * Value shown by the Pro order-book size/total column.\n */\nexport type OrderBookListMetric = 'size' | 'total';\n\n/**\n * Market-agnostic Pro order-book display preferences.\n */\nexport type OrderBookPreferences = {\n currency: OrderBookListCurrency;\n metric: OrderBookListMetric;\n};\n\n/**\n * Default Pro order-book display preferences.\n */\nexport const DEFAULT_ORDER_BOOK_PREFERENCES: OrderBookPreferences = {\n currency: 'usd',\n metric: 'total',\n};\n\n/**\n * Pro-mode layout preferences (network-independent).\n *\n * Flat object that persists across markets (unlike the per-market\n * `tradeConfigurations`). `chartExpanded` and the `*Position` fields are\n * reserved for future container-position UI. Positions and Orders each have\n * their own side filter and sort so they survive market navigation and app\n * restarts independently.\n */\nexport type ProLayoutPreferences = {\n orderBookExpanded: boolean;\n chartExpanded: boolean;\n orderBookPosition: 'left' | 'right';\n orderFormPosition: 'left' | 'right';\n positionsSideFilter: ProPositionsSideFilter;\n positionsSortField: ProPositionsSortField;\n positionsSortDirection: ProPositionsSortDirection;\n ordersSideFilter: ProOrdersSideFilter;\n ordersSortField: ProOrdersSortField;\n ordersSortDirection: ProOrdersSortDirection;\n};\n\n/**\n * Default pro-mode layout preferences.\n *\n * Shared by `getDefaultPerpsControllerState()`, the controller getter, and the\n * selector so callers always receive a fully-populated object even when the\n * persisted state predates this field.\n */\nexport const DEFAULT_PRO_LAYOUT_PREFERENCES: ProLayoutPreferences = {\n orderBookExpanded: false,\n chartExpanded: true,\n orderBookPosition: 'left',\n orderFormPosition: 'right',\n positionsSideFilter: 'all',\n positionsSortField: 'positionValue',\n positionsSortDirection: 'desc',\n ordersSideFilter: 'all',\n ordersSortField: 'time',\n ordersSortDirection: 'desc',\n};\n\n/**\n * Default Perps interface mode.\n */\nexport const DEFAULT_PERPS_MODE: PerpsMode = PerpsMode.Lite;\n\n/**\n * Default market-agnostic order type.\n */\nexport const DEFAULT_SELECTED_ORDER_TYPE = 'market' as const;\n\n/**\n * Funding rate display configuration\n * Controls how funding rates are formatted and displayed\n */\nexport const FUNDING_RATE_CONFIG = {\n // Number of decimal places to display for funding rates\n Decimals: 4,\n // Default display value when funding rate is zero or unavailable\n ZeroDisplay: '0.0000%',\n // Multiplier to convert decimal funding rate to percentage\n PercentageMultiplier: 100,\n} as const;\n\n/**\n * Decimal places shown for each displayed perps value, shared by Mobile,\n * Extension and Terminal. Pass one as the `decimals` option of the display\n * formatters (`formatPercentage`, `formatCrossMarginRatio`, `formatPnl`,\n * `formatPerpsFiat`, `formatFundingRate`, `formatFeeBps`,\n * `formatLiquidationDistance`, `formatPerpsCompact`,\n * `formatPerpsUsdInput`). Prices follow `PRICE_RANGES_UNIVERSAL` instead.\n */\nexport const PERPS_DISPLAY_PRECISION = {\n // Generic percentage, such as the 24h change: \"+5.25%\"\n Percentage: 2,\n // Cross margin account ratio and usage, from a 0..1 ratio: \"17.4%\", \"63%\"\n CrossMarginRatioPercent: 1,\n // Return on equity: \"+10.3%\"\n RoePercent: 1,\n // Profit and loss in USD: \"+$12.34\"\n Pnl: 2,\n // Fee amount in USD: \"$1.50\"\n Fee: 2,\n // Fee rate as a percentage: \"0.045%\"\n FeeRatePercent: 3,\n // Funding rate as a percentage: \"0.0125%\"\n FundingRatePercent: FUNDING_RATE_CONFIG.Decimals,\n // Estimated slippage of an order as a percentage: \"0.0021%\"\n SlippageEstimatePercent: 4,\n // Most decimals a displayed price may have (Hyperliquid limit)\n MaxPriceDecimals: DECIMAL_PRECISION_CONFIG.MaxPriceDecimals,\n // Most decimals of a fee in basis points: \"4.5 bps\", \"1.44 bps\"\n FeeBps: 2,\n // Distance from the liquidation price as a percentage: \"30.00%\"\n LiquidationDistancePercent: 2,\n // Most decimals of a leverage multiplier, trailing zeros dropped: \"0.2x\", \"1.21x\"\n Leverage: 2,\n // Most decimals of TWAP progress as a percentage: \"25%\", \"33.33%\"\n TwapProgressPercent: 2,\n // Most decimals of a typed USD amount: \"12.34\"\n UsdInput: 2,\n // Most digits of a typed USD amount, integer and fraction together\n UsdInputMaxDigits: 9,\n // Volume and open interest from $1M up, and below $1K: \"$1.23M\", \"$999.50\"\n VolumeCompact: 2,\n // Volume and open interest in thousands: \"$123K\"\n VolumeCompactThousands: 0,\n // Order book size and total from 1K up: \"$2.1K\", \"604.9K\"\n OrderBookCompact: 1,\n // Most decimals of an abbreviated order book price: \"$61.47K\"\n OrderBookAbbreviatedPriceMax: 3,\n // Distance of an order book depth level from the mid price as a\n // percentage: \"+0.0125%\"\n OrderBookDepthRangePercent: 4,\n // Most decimals of the depth chart zoom range as a percentage: \"0.00125\"\n OrderBookDepthZoomRangePercentMax: 5,\n // Most decimals of a TWAP sub-order's base-asset size: \"0.00012\"\n TwapSuborderSize: 5,\n} as const;\n\n/**\n * Provider configuration for multi-provider support\n */\nexport const PROVIDER_CONFIG = {\n /** Default perpetual DEX provider when no explicit selection exists */\n DefaultProvider: 'hyperliquid' as const,\n /**\n * Force Lighter to testnet only. Off: Lighter follows the global network\n * toggle — mainnet reads AND writes are enabled (the initial rollout\n * write gate was removed once the write path was validated end-to-end\n * on testnet). Flip on to pin Lighter to testnet regardless of the\n * global network toggle.\n */\n LIGHTER_TESTNET_ONLY: false,\n} as const;\n\n// Disk-backed cold-start cache keys and throttle interval.\n// The user-data key ends in _V2 because the AccountState balance contract\n// changed (TAT-3047) and has no in-payload version field. Bumping the key\n// forces a one-time empty cache on upgrade — consumers fall through to\n// skeleton/fallback until the first WS tick, avoiding stale legacy-shape\n// reads that would surface as $0 balances.\nexport const PERPS_DISK_CACHE_MARKETS = 'PERPS_DISK_CACHE_MARKETS';\nexport const PERPS_DISK_CACHE_USER_DATA = 'PERPS_DISK_CACHE_USER_DATA_V2';\nexport const PERPS_DISK_CACHE_THROTTLE_MS = 30_000;\n\n/**\n * Minimum interval between WebSocket-triggered HL `userAbstraction`\n * refreshes. Balances picking up HL-web mode flips (Unified ↔ Standard)\n * promptly against burning REST quota on every spot tick. Covers the\n * observed user pattern of flipping mode once per session at most.\n */\nexport const ABSTRACTION_MODE_REFRESH_THROTTLE_MS = 60_000;\n\n/**\n * Build the standard provider:network cache key from controller state.\n *\n * @param state - Controller state containing provider and network info.\n * @param state.activeProvider - Active perps provider name.\n * @param state.isTestnet - Whether testnet mode is active.\n * @returns Cache key in the format \"provider:mainnet\" or \"provider:testnet\".\n */\nexport function getProviderNetworkKey(state: {\n activeProvider?: string;\n isTestnet?: boolean;\n}): string {\n return `${state.activeProvider ?? PROVIDER_CONFIG.DefaultProvider}:${state.isTestnet ? 'testnet' : 'mainnet'}`;\n}\n\n/**\n * Build a provider:network cache key for a specific provider id.\n * Accounts for LIGHTER_TESTNET_ONLY: when set, Lighter stays on testnet\n * regardless of the global network flag.\n *\n * @param providerId - The provider identifier (e.g. \"hyperliquid\", \"lighter\").\n * @param isTestnet - Global testnet flag from controller state.\n * @returns Cache key in the format \"provider:mainnet\" or \"provider:testnet\".\n */\nexport function buildProviderCacheKey(\n providerId: string,\n isTestnet: boolean,\n): string {\n let effectiveTestnet = isTestnet;\n if (providerId === 'lighter') {\n effectiveTestnet = PROVIDER_CONFIG.LIGHTER_TESTNET_ONLY || isTestnet;\n }\n return `${providerId}:${effectiveTestnet ? 'testnet' : 'mainnet'}`;\n}\n"]}
|
package/dist/errors.d.ts
CHANGED
|
@@ -39,6 +39,13 @@ export declare class PerpsControllerError extends Error {
|
|
|
39
39
|
readonly errorDetails?: PerpsErrorDetails;
|
|
40
40
|
constructor(errorCode: PerpsErrorCode, message: string, errorDetails?: PerpsErrorDetails, options?: ErrorOptions);
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Check whether the orders source is waiting to resume with a trading key.
|
|
44
|
+
*
|
|
45
|
+
* @param error - The subscription error.
|
|
46
|
+
* @returns Whether the venue will resume the existing subscription.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isOrdersStreamPaused(error: Error): boolean;
|
|
42
49
|
/**
|
|
43
50
|
* Creates a normalized local price movement error.
|
|
44
51
|
*
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,OAAO,iBAAiB,CAAC,WAAW,CAAC;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,OAAO,CAAC,cAAc,EAAE,OAAO,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACpE,QAAQ,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB,sBAAsB,GACtB,uBAAuB,CAAC;AAE5B,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAClC,CAAC;AAEF;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IAEnC,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC;IAE1C,YACE,SAAS,EAAE,cAAc,EACzB,OAAO,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,iBAAiB,EAChC,OAAO,CAAC,EAAE,Y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,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAEtE,YAAY,OAAO,EAAE;QACnB,MAAM,EAAE,KAAK,EAAE,CAAC;QAChB,QAAQ,EAAE;YAAE,UAAU,EAAE,iBAAiB,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC9D,EASA;CACF"}
|
package/dist/errors.js
CHANGED
|
@@ -13,6 +13,16 @@ export class PerpsControllerError extends Error {
|
|
|
13
13
|
this.errorDetails = errorDetails;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Check whether the orders source is waiting to resume with a trading key.
|
|
18
|
+
*
|
|
19
|
+
* @param error - The subscription error.
|
|
20
|
+
* @returns Whether the venue will resume the existing subscription.
|
|
21
|
+
*/
|
|
22
|
+
export function isOrdersStreamPaused(error) {
|
|
23
|
+
return (error instanceof PerpsControllerError &&
|
|
24
|
+
error.errorCode === PERPS_ERROR_CODES.ORDERS_STREAM_PAUSED);
|
|
25
|
+
}
|
|
16
26
|
/**
|
|
17
27
|
* Creates a normalized local price movement error.
|
|
18
28
|
*
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAuCzD;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,SAAS,CAAiB;IAE1B,YAAY,CAAqB;IAE1C,YACE,SAAyB,EACzB,OAAe,EACf,YAAgC,EAChC,OAAsB;QAEtB,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAOrC;IACC,MAAM,EACJ,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,cAAc,GACf,GAAG,MAAM,CAAC;IAEX,OAAO,IAAI,oBAAoB,CAC7B,iBAAiB,CAAC,WAAW,EAC7B,yBAAyB,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,cAAc,SAAS;QACpF,aAAa,sBAAsB,cAAc,qBAAqB,EAAE,EAC1E;QACE,IAAI,EAAE,iBAAiB,CAAC,WAAW;QACnC,aAAa;QACb,cAAc;QACd,aAAa;QACb,YAAY;KACb,CACF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oCAAoC;IAClD,OAAO,IAAI,oBAAoB,CAC7B,iBAAiB,CAAC,4BAA4B,EAC9C,iBAAiB,CAAC,4BAA4B,CAC/C,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACnC,MAAM,CAAU;IAEhB,QAAQ,CAAqD;IAEtE,YAAY,OAGX;QACC,KAAK,CACH,OAAO,CAAC,QAAQ;aACb,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,UAAU,KAAK,KAAK,EAAE,CAAC;aACzD,IAAI,CAAC,IAAI,CAAC,CACd,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACnC,CAAC;CACF","sourcesContent":["import { PERPS_ERROR_CODES } from './perpsErrorCodes.js';\nimport type { PerpsErrorCode } from './perpsErrorCodes.js';\nimport type { Order, PerpsProviderType } from './types/index.js';\n\n/**\n * Details for a local price movement rejection.\n *\n * The numeric values are kept unformatted so clients can localize and format\n * them for their own surfaces while the legacy error string remains available.\n */\nexport type PriceMovedErrorDetails = {\n code: typeof PERPS_ERROR_CODES.PRICE_MOVED;\n priceDeltaBps: number;\n maxSlippageBps: number;\n expectedPrice: number;\n currentPrice: number;\n};\n\n/**\n * Provider context for a normalized Hyperliquid failure.\n *\n * Raw venue messages are deliberately excluded because result details cross\n * the client boundary. The original failure is retained as the error cause for\n * telemetry instead.\n */\nexport type HyperLiquidErrorDetails = {\n code: Exclude<PerpsErrorCode, typeof PERPS_ERROR_CODES.PRICE_MOVED>;\n provider: 'hyperliquid';\n};\n\nexport type PerpsErrorDetails =\n | PriceMovedErrorDetails\n | HyperLiquidErrorDetails;\n\nexport type PerpsErrorResultFields = {\n errorCode?: PerpsErrorCode;\n errorDetails?: PerpsErrorDetails;\n};\n\n/**\n * Error that preserves a stable client-facing code and optional structured\n * details across provider and controller error boundaries.\n */\nexport class PerpsControllerError extends Error {\n readonly errorCode: PerpsErrorCode;\n\n readonly errorDetails?: PerpsErrorDetails;\n\n constructor(\n errorCode: PerpsErrorCode,\n message: string,\n errorDetails?: PerpsErrorDetails,\n options?: ErrorOptions,\n ) {\n super(message, options);\n this.name = 'PerpsControllerError';\n this.errorCode = errorCode;\n this.errorDetails = errorDetails;\n }\n}\n\n/**\n * Creates a normalized local price movement error.\n *\n * @param params - Price movement context.\n * @param params.expectedPrice - Price used when the order was sized.\n * @param params.currentPrice - Current price used for submission.\n * @param params.formattedExpectedPrice - Provider-formatted expected price.\n * @param params.formattedCurrentPrice - Provider-formatted current price.\n * @param params.priceDeltaBps - Absolute price movement in basis points.\n * @param params.maxSlippageBps - Maximum allowed movement in basis points.\n * @returns A structured price movement error.\n */\nexport function createPriceMovedError(params: {\n expectedPrice: number;\n currentPrice: number;\n formattedExpectedPrice: string;\n formattedCurrentPrice: string;\n priceDeltaBps: number;\n maxSlippageBps: number;\n}): PerpsControllerError {\n const {\n expectedPrice,\n currentPrice,\n formattedExpectedPrice,\n formattedCurrentPrice,\n priceDeltaBps,\n maxSlippageBps,\n } = params;\n\n return new PerpsControllerError(\n PERPS_ERROR_CODES.PRICE_MOVED,\n `Price moved too much: ${priceDeltaBps.toFixed(0)} bps (max: ${maxSlippageBps} bps). ` +\n `Expected: ${formattedExpectedPrice}, Current: ${formattedCurrentPrice}`,\n {\n code: PERPS_ERROR_CODES.PRICE_MOVED,\n priceDeltaBps,\n maxSlippageBps,\n expectedPrice,\n currentPrice,\n },\n );\n}\n\n/**\n * Creates the error a provider raises when it cannot replace one position\n * TP/SL leg on its own.\n *\n * @returns A typed `TPSL_LEG_REPLACE_UNSUPPORTED` error.\n */\nexport function createTpslLegReplaceUnsupportedError(): PerpsControllerError {\n return new PerpsControllerError(\n PERPS_ERROR_CODES.TPSL_LEG_REPLACE_UNSUPPORTED,\n PERPS_ERROR_CODES.TPSL_LEG_REPLACE_UNSUPPORTED,\n );\n}\n\n/** A strict open-order read was incomplete; discovered orders remain usable. */\nexport class OrderDiscoveryError extends Error {\n readonly orders: Order[];\n\n readonly failures: { providerId: PerpsProviderType; error: string }[];\n\n constructor(options: {\n orders: Order[];\n failures: { providerId: PerpsProviderType; error: string }[];\n }) {\n super(\n options.failures\n .map(({ providerId, error }) => `${providerId}: ${error}`)\n .join('; '),\n );\n this.name = 'OrderDiscoveryError';\n this.orders = options.orders;\n this.failures = options.failures;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAuCzD;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,SAAS,CAAiB;IAE1B,YAAY,CAAqB;IAE1C,YACE,SAAyB,EACzB,OAAe,EACf,YAAgC,EAChC,OAAsB;QAEtB,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC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B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACnC,CAAC;CACF","sourcesContent":["import { PERPS_ERROR_CODES } from './perpsErrorCodes.js';\nimport type { PerpsErrorCode } from './perpsErrorCodes.js';\nimport type { Order, PerpsProviderType } from './types/index.js';\n\n/**\n * Details for a local price movement rejection.\n *\n * The numeric values are kept unformatted so clients can localize and format\n * them for their own surfaces while the legacy error string remains available.\n */\nexport type PriceMovedErrorDetails = {\n code: typeof PERPS_ERROR_CODES.PRICE_MOVED;\n priceDeltaBps: number;\n maxSlippageBps: number;\n expectedPrice: number;\n currentPrice: number;\n};\n\n/**\n * Provider context for a normalized Hyperliquid failure.\n *\n * Raw venue messages are deliberately excluded because result details cross\n * the client boundary. The original failure is retained as the error cause for\n * telemetry instead.\n */\nexport type HyperLiquidErrorDetails = {\n code: Exclude<PerpsErrorCode, typeof PERPS_ERROR_CODES.PRICE_MOVED>;\n provider: 'hyperliquid';\n};\n\nexport type PerpsErrorDetails =\n | PriceMovedErrorDetails\n | HyperLiquidErrorDetails;\n\nexport type PerpsErrorResultFields = {\n errorCode?: PerpsErrorCode;\n errorDetails?: PerpsErrorDetails;\n};\n\n/**\n * Error that preserves a stable client-facing code and optional structured\n * details across provider and controller error boundaries.\n */\nexport class PerpsControllerError extends Error {\n readonly errorCode: PerpsErrorCode;\n\n readonly errorDetails?: PerpsErrorDetails;\n\n constructor(\n errorCode: PerpsErrorCode,\n message: string,\n errorDetails?: PerpsErrorDetails,\n options?: ErrorOptions,\n ) {\n super(message, options);\n this.name = 'PerpsControllerError';\n this.errorCode = errorCode;\n this.errorDetails = errorDetails;\n }\n}\n\n/**\n * Check whether the orders source is waiting to resume with a trading key.\n *\n * @param error - The subscription error.\n * @returns Whether the venue will resume the existing subscription.\n */\nexport function isOrdersStreamPaused(error: Error): boolean {\n return (\n error instanceof PerpsControllerError &&\n error.errorCode === PERPS_ERROR_CODES.ORDERS_STREAM_PAUSED\n );\n}\n\n/**\n * Creates a normalized local price movement error.\n *\n * @param params - Price movement context.\n * @param params.expectedPrice - Price used when the order was sized.\n * @param params.currentPrice - Current price used for submission.\n * @param params.formattedExpectedPrice - Provider-formatted expected price.\n * @param params.formattedCurrentPrice - Provider-formatted current price.\n * @param params.priceDeltaBps - Absolute price movement in basis points.\n * @param params.maxSlippageBps - Maximum allowed movement in basis points.\n * @returns A structured price movement error.\n */\nexport function createPriceMovedError(params: {\n expectedPrice: number;\n currentPrice: number;\n formattedExpectedPrice: string;\n formattedCurrentPrice: string;\n priceDeltaBps: number;\n maxSlippageBps: number;\n}): PerpsControllerError {\n const {\n expectedPrice,\n currentPrice,\n formattedExpectedPrice,\n formattedCurrentPrice,\n priceDeltaBps,\n maxSlippageBps,\n } = params;\n\n return new PerpsControllerError(\n PERPS_ERROR_CODES.PRICE_MOVED,\n `Price moved too much: ${priceDeltaBps.toFixed(0)} bps (max: ${maxSlippageBps} bps). ` +\n `Expected: ${formattedExpectedPrice}, Current: ${formattedCurrentPrice}`,\n {\n code: PERPS_ERROR_CODES.PRICE_MOVED,\n priceDeltaBps,\n maxSlippageBps,\n expectedPrice,\n currentPrice,\n },\n );\n}\n\n/**\n * Creates the error a provider raises when it cannot replace one position\n * TP/SL leg on its own.\n *\n * @returns A typed `TPSL_LEG_REPLACE_UNSUPPORTED` error.\n */\nexport function createTpslLegReplaceUnsupportedError(): PerpsControllerError {\n return new PerpsControllerError(\n PERPS_ERROR_CODES.TPSL_LEG_REPLACE_UNSUPPORTED,\n PERPS_ERROR_CODES.TPSL_LEG_REPLACE_UNSUPPORTED,\n );\n}\n\n/** A strict open-order read was incomplete; discovered orders remain usable. */\nexport class OrderDiscoveryError extends Error {\n readonly orders: Order[];\n\n readonly failures: { providerId: PerpsProviderType; error: string }[];\n\n constructor(options: {\n orders: Order[];\n failures: { providerId: PerpsProviderType; error: string }[];\n }) {\n super(\n options.failures\n .map(({ providerId, error }) => `${providerId}: ${error}`)\n .join('; '),\n );\n this.name = 'OrderDiscoveryError';\n this.orders = options.orders;\n this.failures = options.failures;\n }\n}\n"]}
|