@metamask-previews/perps-controller 17.0.0-preview-95104ffdb → 17.1.0-preview-e81860e6b

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 CHANGED
@@ -9,7 +9,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Changed
11
11
 
12
+ - Bump `@metamask/utils` from `^11.12.0` to `^12.0.0` ([#10192](https://github.com/MetaMask/core/pull/10192))
13
+
14
+ ## [17.1.0]
15
+
16
+ ### Added
17
+
18
+ - Add `MarketCategory.Memecoin` (`'memecoin'`) as a new UI-only filter category and expose it via `MARKET_CATEGORIES` and `MarketTypeFilter`. ([#10168](https://github.com/MetaMask/core/pull/10168))
19
+ - Derived in `matchesCategory` from a non-HIP-3 crypto market carrying the `'memecoin'` tag.
20
+ - Overlaps with the `'crypto'` filter by design — memecoin markets appear under both pills.
21
+
22
+ ### Changed
23
+
12
24
  - Bump `uuid` from `^8.3.2` to `^9.0.1` ([#10117](https://github.com/MetaMask/core/pull/10117))
25
+ - Bump `@metamask/utils` from `^11.12.0` to `^12.0.0` ([#10192](https://github.com/MetaMask/core/pull/10192))
13
26
 
14
27
  ## [17.0.0]
15
28
 
@@ -911,7 +924,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
911
924
 
912
925
  - Bump `@metamask/controller-utils` from `^11.18.0` to `^11.19.0` ([#7995](https://github.com/MetaMask/core/pull/7995))
913
926
 
914
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@17.0.0...HEAD
927
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@17.1.0...HEAD
928
+ [17.1.0]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@17.0.0...@metamask/perps-controller@17.1.0
915
929
  [17.0.0]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@16.2.0...@metamask/perps-controller@17.0.0
916
930
  [16.2.0]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@16.1.0...@metamask/perps-controller@16.2.0
917
931
  [16.1.0]: https://github.com/MetaMask/core/compare/@metamask/perps-controller@16.0.0...@metamask/perps-controller@16.1.0
@@ -66,7 +66,8 @@ export declare enum MarketCategory {
66
66
  Index = "index",
67
67
  Etf = "etf",
68
68
  Commodity = "commodity",
69
- Forex = "forex"
69
+ Forex = "forex",
70
+ Memecoin = "memecoin"
70
71
  }
71
72
  export type MarketType = `${MarketCategory}`;
72
73
  /**
@@ -86,14 +87,19 @@ export type TerminalAssetMetadata = {
86
87
  */
87
88
  listedAt?: number;
88
89
  };
89
- export type MarketTypeFilter = 'all' | 'crypto' | 'stock' | 'pre-ipo' | 'index' | 'etf' | 'commodity' | 'forex' | 'new';
90
+ export type MarketTypeFilter = 'all' | 'crypto' | 'memecoin' | 'stock' | 'pre-ipo' | 'index' | 'etf' | 'commodity' | 'forex' | 'new';
90
91
  /**
91
- * Ordered list of the 7 data-model market categories for UI pills.
92
+ * Ordered list of data-model market categories for UI pills.
92
93
  * Does not include the 'all' or 'new' sentinel values — those are applied
93
94
  * via dedicated UI controls, not the category pills.
95
+ *
96
+ * Note: 'memecoin' is a derived category (marketType === 'crypto' &&
97
+ * tags.includes('memecoin')). It overlaps with 'crypto' by design —
98
+ * memecoins appear under both pills.
99
+ *
94
100
  * Kept in sync with {@link MarketTypeFilter} via `satisfies`.
95
101
  */
96
- export declare const MARKET_CATEGORIES: ["crypto", "stock", "pre-ipo", "index", "etf", "commodity", "forex"];
102
+ export declare const MARKET_CATEGORIES: ["crypto", "memecoin", "stock", "pre-ipo", "index", "etf", "commodity", "forex"];
97
103
  export type InputMethod = 'default' | 'slider' | 'keypad' | 'percentage' | 'max';
98
104
  export type TradeAction = 'create_position' | 'increase_exposure' | 'flip_long_to_short' | 'flip_short_to_long';
99
105
  export type TrackingData = {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"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,GAAG,MAAM,CAAC;IAC1C,sEAAsE;IACtE,oBAAoB,EAAE,OAAO,EAAE,CAAC;CACjC,CAAC;AAMF;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAMF;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,uBAAuB,CASlC;AAOD,mBAAmB,kBAAkB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AAEtC,YAAY,EACV,aAAa,EACb,WAAW,EACX,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,0BAA0B,EAC1B,8BAA8B,EAC9B,YAAY,EACZ,0BAA0B,EAC1B,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC"}
@@ -21,15 +21,22 @@ export var MarketCategory;
21
21
  MarketCategory["Etf"] = "etf";
22
22
  MarketCategory["Commodity"] = "commodity";
23
23
  MarketCategory["Forex"] = "forex";
24
+ MarketCategory["Memecoin"] = "memecoin";
24
25
  })(MarketCategory || (MarketCategory = {}));
25
26
  /**
26
- * Ordered list of the 7 data-model market categories for UI pills.
27
+ * Ordered list of data-model market categories for UI pills.
27
28
  * Does not include the 'all' or 'new' sentinel values — those are applied
28
29
  * via dedicated UI controls, not the category pills.
30
+ *
31
+ * Note: 'memecoin' is a derived category (marketType === 'crypto' &&
32
+ * tags.includes('memecoin')). It overlaps with 'crypto' by design —
33
+ * memecoins appear under both pills.
34
+ *
29
35
  * Kept in sync with {@link MarketTypeFilter} via `satisfies`.
30
36
  */
31
37
  export const MARKET_CATEGORIES = [
32
38
  'crypto',
39
+ 'memecoin',
33
40
  'stock',
34
41
  'pre-ipo',
35
42
  'index',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAoB9C;;;;GAIG;AACH,MAAM,CAAN,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC,yDAA6B,CAAA;IAC7B,qDAAyB,CAAA;IACzB,mDAAuB,CAAA;IACvB,2DAA+B,CAAA;AACjC,CAAC,EALW,wBAAwB,KAAxB,wBAAwB,QAKnC;AAuDD,gEAAgE;AAChE,MAAM,CAAN,IAAY,cAQX;AARD,WAAY,cAAc;IACxB,2CAAyB,CAAA;IACzB,iCAAe,CAAA;IACf,oCAAkB,CAAA;IAClB,iCAAe,CAAA;IACf,6BAAW,CAAA;IACX,yCAAuB,CAAA;IACvB,iCAAe,CAAA;AACjB,CAAC,EARW,cAAc,KAAd,cAAc,QAQzB;AAkCD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,QAAQ;IACR,OAAO;IACP,SAAS;IACT,OAAO;IACP,KAAK;IACL,WAAW;IACX,OAAO;CAC8B,CAAC;AAigExC;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,mBAiBX;AAjBD,WAAY,mBAAmB;IAC7B,4EAAqD,CAAA;IACrD,kEAA2C,CAAA;IAC3C,mFAA4D,CAAA;IAC5D,+EAAwD,CAAA;IACxD,0DAAmC,CAAA;IACnC,4DAAqC,CAAA;IACr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oB,GAAG;IAClC,SAAS,EAAE,iBAAiB;IAC5B,eAAe,EAAE,wBAAwB;IACzC,kBAAkB,EAAE,2BAA2B;IAC/C,UAAU,EAAE,mBAAmB;CACvB,CAAC;AA2aX;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC;QAC7B,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC;QACpC,OAAQ,KAA8B,CAAC,OAAO,KAAK,SAAS;QAC5D,OAAQ,KAAqC,CAAC,cAAc,KAAK,QAAQ,CAC1E,CAAC;AACJ,CAAC;AAQD,cAAc,uBAAuB,CAAC","sourcesContent":["import { hasProperty } from '@metamask/utils';\nimport type {\n CaipAccountId,\n CaipChainId,\n CaipAssetId,\n Hex,\n} from '@metamask/utils';\n\nimport type { CandlePeriod, TimeDuration } from '../constants/chartConfig.js';\nimport type { CHASE_ORDER_STATUS } from '../constants/perpsConfig.js';\nimport type { LighterSignerBridge } from './lighter-types.js';\nimport type {\n CandleData,\n OrderType,\n StrategyOrderType,\n TpslLinkage,\n TriggerDirection,\n TriggerOrderType,\n} from './perps-types.js';\n\n/**\n * Connection states for WebSocket management.\n * Defined inline to avoid importing from Mobile-only services.\n * Must stay in sync with HyperLiquidClientService.WebSocketConnectionState.\n */\nexport enum WebSocketConnectionState {\n Disconnected = 'disconnected',\n Connecting = 'connecting',\n Connected = 'connected',\n Disconnecting = 'disconnecting',\n}\n\n/** Provider-agnostic raw ledger update. Fields match the common shape across providers. */\nexport type RawLedgerUpdate = {\n hash: string;\n time: number;\n delta: {\n type: string;\n usdc?: string;\n coin?: string;\n };\n};\n\n// User history item for deposits and withdrawals\nexport type UserHistoryItem = {\n id: string;\n timestamp: number;\n type: 'deposit' | 'withdrawal';\n amount: string;\n asset: string;\n txHash: string;\n status: 'completed' | 'failed' | 'pending';\n details: {\n source: string;\n bridgeContract?: string;\n recipient?: string;\n blockNumber?: string;\n chainId?: string;\n synthetic?: boolean;\n };\n};\n\n// Parameters for getting user history\nexport type GetUserHistoryParams = {\n startTime?: number;\n endTime?: number;\n accountId?: CaipAccountId;\n};\n\n// Trade configuration saved per market per network\nexport type TradeConfiguration = {\n leverage?: number; // Last used leverage for this market\n // Pending trade configuration (temporary, expires after 30 seconds)\n pendingConfig?: {\n amount?: string; // Order size in USD\n leverage?: number; // Leverage\n takeProfitPrice?: string; // Take profit price\n stopLossPrice?: string; // Stop loss price\n limitPrice?: string; // Limit price (for limit orders)\n orderType?: OrderType; // Market vs limit\n reduceOnly?: boolean; // Whether the order may only reduce a position\n timestamp: number; // When the config was saved (for expiration check)\n };\n};\n\n// Market asset type classification (reusable across components)\nexport enum MarketCategory {\n CryptoCurrency = 'crypto',\n Stock = 'stock',\n PreIpo = 'pre-ipo',\n Index = 'index',\n Etf = 'etf',\n Commodity = 'commodity',\n Forex = 'forex',\n}\n\nexport type MarketType = `${MarketCategory}`;\n\n/**\n * Metadata extracted from Terminal API for a single asset.\n * Used downstream to enrich PerpsMarketData with name, keywords, tags, etc.\n */\nexport type TerminalAssetMetadata = {\n name?: string;\n description?: string;\n keywords?: string[];\n tags?: string[];\n categories?: string[];\n marketType?: MarketType;\n /**\n * Epoch ms when this market was listed on the Terminal backend.\n * Normalized from the raw API value (number or ISO string).\n */\n listedAt?: number;\n};\n\n// Market type filter for UI category badges\nexport type MarketTypeFilter =\n | 'all'\n | 'crypto'\n | 'stock'\n | 'pre-ipo'\n | 'index'\n | 'etf'\n | 'commodity'\n | 'forex'\n | 'new';\n\n/**\n * Ordered list of the 7 data-model market categories for UI pills.\n * Does not include the 'all' or 'new' sentinel values — those are applied\n * via dedicated UI controls, not the category pills.\n * Kept in sync with {@link MarketTypeFilter} via `satisfies`.\n */\nexport const MARKET_CATEGORIES = [\n 'crypto',\n 'stock',\n 'pre-ipo',\n 'index',\n 'etf',\n 'commodity',\n 'forex',\n] as const satisfies MarketTypeFilter[];\n\n// Input method for amount entry tracking\nexport type InputMethod =\n | 'default'\n | 'slider'\n | 'keypad'\n | 'percentage'\n | 'max';\n\n// Trade action type - differentiates first trade on a market, adding to an\n// existing position, and flipping a position's direction\nexport type TradeAction =\n | 'create_position'\n | 'increase_exposure'\n | 'flip_long_to_short'\n | 'flip_short_to_long';\n\n// Unified tracking data interface for analytics events (never persisted in state)\n// Note: Numeric values are already parsed by hooks (usePerpsOrderFees, etc.) from API responses\nexport type TrackingData = {\n // Common to all operations\n totalFee: number; // Total fee for the operation (parsed by hooks)\n marketPrice: number; // Market price at operation time (parsed by hooks)\n metamaskFee?: number; // MetaMask fee amount (parsed by hooks)\n metamaskFeeRate?: number; // MetaMask fee rate (parsed by hooks)\n feeDiscountPercentage?: number; // Fee discount percentage (parsed by hooks)\n estimatedPoints?: number; // Estimated reward points (parsed by hooks)\n\n // Order-specific (used for trade operations)\n marginUsed?: number; // Margin required for this order (calculated by hooks)\n inputMethod?: InputMethod; // How user set the amount\n tradeAction?: TradeAction; // 'create_position' for first trade, 'increase_exposure' for adding to existing\n\n // Close-specific (used for position close operations)\n receivedAmount?: number; // Amount user receives after close (calculated by hooks)\n realizedPnl?: number; // Realized P&L from close (calculated by hooks)\n\n // Entry source for analytics (e.g., 'trending' for Trending page discovery)\n source?: string;\n // Chart library active when the trade was initiated (e.g., lightweight, advanced)\n chartLibrary?: string;\n\n // Entry point / discovery attribution. Propagated onto trade/close/\n // cancel/risk events as entry_point, discovery_source, perp_discovery_source.\n entryPoint?: string;\n discoverySource?: string;\n perpDiscoverySource?: string;\n\n // HyperLiquid protocol fee rate. Emitted as hl_fee_rate on trade +\n // close events when present; omitted entirely when unavailable.\n hlFeeRate?: number;\n\n // Pay with any token: true when user paid with a custom token (not Perps balance)\n tradeWithToken?: boolean;\n mmPayTokenSelected?: string; // Token symbol when tradeWithToken is true\n mmPayNetworkSelected?: string; // chainId when tradeWithToken is true\n\n // VIP tier and discount for rewards tracking\n vipTier?: number; // User's VIP tier level\n vipDiscount?: number; // VIP discount percentage applied\n\n // A/B test context to attribute trade events to specific experiments\n abTests?: Record<string, string>;\n};\n\n// TP/SL-specific tracking data for analytics events\nexport type TPSLTrackingData = {\n direction: 'long' | 'short'; // Position direction\n /**\n * @deprecated Source of the TP/SL update (e.g., 'tp_sl_view', 'position_card').\n * Prefer `entryPoint` / `discoverySource` / `perpDiscoverySource` for risk-event\n * attribution; `source` is retained for backward compatibility.\n */\n source: string;\n positionSize: number; // Unsigned position size for metrics\n takeProfitPercentage?: number; // Take profit percentage from entry\n stopLossPercentage?: number; // Stop loss percentage from entry\n isEditingExistingPosition?: boolean; // true = editing existing position, false = creating for new order\n entryPrice?: number; // Entry price for percentage calculations\n\n // Entry point / discovery attribution, propagated onto risk events.\n entryPoint?: string;\n discoverySource?: string;\n perpDiscoverySource?: string;\n};\n\n/** Collateral mode requested for a new order. */\nexport type MarginMode = 'isolated' | 'cross';\n\n// MetaMask Perps API order parameters for PerpsController\nexport type OrderParams = {\n symbol: string; // Asset identifier (e.g., 'ETH', 'BTC', 'xyz:TSLA')\n isBuy: boolean; // true = BUY order, false = SELL order\n size: string; // Order size as string (derived for validation, provider recalculates from usdAmount)\n orderType: OrderType; // Order type\n price?: string; // Limit price (required for limit orders)\n reduceOnly?: boolean; // Reduce-only flag\n isFullClose?: boolean; // Indicates closing 100% of position (skips $10 minimum validation)\n timeInForce?: 'GTC' | 'IOC' | 'ALO'; // Time in force for plain limit orders\n\n // USD as source of truth (hybrid approach)\n usdAmount?: string; // USD amount (primary source of truth, provider calculates size from this)\n priceAtCalculation?: number; // Price snapshot when size was calculated (for slippage validation)\n maxSlippageBps?: number; // Slippage tolerance in basis points (e.g., 100 = 1%, default if not provided)\n /**\n * @deprecated Use `maxSlippageBps` instead. Retained for one release so that\n * existing publisher consumers (extension, core) that still pass slippage as\n * a decimal (e.g. 0.03 for 3%) continue to work; the provider normalizes the\n * value to basis points when `maxSlippageBps` is absent.\n */\n slippage?: number;\n\n // Trigger placement (stop_market, stop_limit, take_profit_market, take_profit_limit).\n // Required for those order types and rejected for market/limit orders.\n triggerPrice?: string; // Price at which the resting order activates\n\n // Strategy placement (twap, scale, chase). Each group below is required for\n // its own order type and rejected on every other one, so a stray field can\n // never be silently dropped. Strategy orders carry no `price`, `triggerPrice`,\n // `timeInForce` or attached TP/SL — the strategy owns its own execution.\n twapDuration?: number; // TWAP window in whole minutes; each provider enforces its own venue's bounds\n twapRandomize?: boolean; // Randomize each TWAP suborder's size by up to ±20% (default false)\n scaleMinPrice?: string; // Lowest limit price in the scale ladder\n scaleMaxPrice?: string; // Highest limit price in the scale ladder; must exceed scaleMinPrice\n scaleNumOrders?: number; // How many limit orders to spread across the ladder (2..20)\n /**\n * How the ladder's size is weighted across its rungs. Rung weights ramp\n * linearly from 1 at `scaleMinPrice` to this value at `scaleMaxPrice`, in that\n * direction for both sides — a short does not flip it. Above 1 puts more size\n * at `scaleMaxPrice`, below 1 at `scaleMinPrice`. Omitted or exactly 1 spreads\n * the size evenly. Any finite value above 0 is accepted as given; see\n * `splitScaleSizes` for how the sizes are allocated.\n */\n scaleSkew?: number;\n chaseIntervalMs?: number; // How often the chase re-reads the touch (default 15000, min 1000)\n chaseMaxDurationMs?: number; // Optional hard stop for the chase window (unbounded by default)\n chaseMaxRepricings?: number; // Optional cap on cancel/replace cycles (unbounded by default)\n chaseMaxDistanceBps?: number; // Optional directional distance from arrival price where chasing stops\n\n // Advanced order features\n takeProfitPrice?: string; // Take profit price\n stopLossPrice?: string; // Stop loss price\n // Partial TP/SL: size of the attached TP/SL order. Omit for a TP/SL covering\n // the full order size. Must be positive and no greater than `size`.\n takeProfitSize?: string; // Quantity covered by the attached take profit\n stopLossSize?: string; // Quantity covered by the attached stop loss\n clientOrderId?: string; // Optional client-provided order ID\n /**\n * How an attached TP/SL is linked: to this order (`order`), to the resulting\n * position (`position`), or absent (`none`). Defaults to `none` without TP/SL\n * and `order` with TP/SL. Takes precedence over the deprecated `grouping`.\n */\n tpslLinkage?: TpslLinkage;\n /**\n * @deprecated Use `tpslLinkage`. This field carries HyperLiquid's own grouping\n * vocabulary; it is honoured for existing callers but a provider-agnostic\n * placement should not depend on protocol wording.\n */\n grouping?: 'na' | 'normalTpsl' | 'positionTpsl'; // Override grouping (defaults: 'na' without TP/SL, 'normalTpsl' with TP/SL)\n currentPrice?: number; // Current market price (avoids extra API call if provided)\n leverage?: number; // Leverage to apply for the order (e.g., 10 for 10x leverage)\n /**\n * Explicit collateral mode. Requires leverage. HyperLiquid validates market\n * support and refuses mode changes with an open position or resting order.\n * Omit to retain the existing isolated-leverage behavior.\n */\n marginMode?: MarginMode;\n existingPositionLeverage?: number; // Existing position leverage for validation (protocol constraint)\n\n // Optional tracking data for MetaMetrics events\n trackingData?: TrackingData;\n\n // Multi-provider routing (optional: defaults to active/default provider).\n providerId?: PerpsProviderType;\n};\n\nexport type ScaleOrderChild =\n | {\n state: 'resting' | 'filled';\n orderId: string;\n }\n | {\n state: 'waitingForFill' | 'waitingForTrigger';\n orderId?: never;\n };\n\nexport type OrderResult = {\n success?: boolean;\n /**\n * What names the placement afterwards.\n *\n * For an ordinary placement this is the exchange's order ID. For a *strategy*\n * placement it is a handle instead — a venue TWAP id, or a client-generated\n * scale-group or chase-session id — which is what `CancelOrderParams` takes\n * together with the matching `orderType` and `providerId`. Scale and chase\n * handles are held in the provider session that created them. Scale handles\n * are also encoded in each rung's venue client-order ID, so an open-order\n * read can recover the group after reconnect. Chase handles cannot be\n * recovered because every replacement receives a new exchange order ID.\n * The individual exchange IDs a strategy expanded into are in\n * `childOrderIds`.\n */\n orderId?: string;\n error?: string;\n filledSize?: string; // Amount filled\n // Full normalized size submitted to the exchange (post precision rounding,\n // USD recalculation, and any $10-minimum retry). Present only when the\n // provider reached submission.\n submittedSize?: string;\n // Normalized size of the submitted rungs that the exchange accepted. This\n // differs from `submittedSize` when a non-atomic Scale batch is partly\n // rejected.\n acceptedSize?: string;\n // Size-weighted average execution price. Present only when the result\n // includes fills.\n averagePrice?: string;\n // Size-weighted limit price of accepted Scale rungs. This is a submission\n // price, not an execution price.\n weightedAverageLimitPrice?: string;\n // Every accepted child of a Scale batch and its immediate placement state.\n // Waiting children do not carry an exchange order ID; cancel the Scale handle\n // to cancel both resting and waiting children.\n acceptedChildren?: ScaleOrderChild[];\n // Exchange IDs tied to a multi-order or recovery result. On a successful\n // strategy placement, `orderId` carries the strategy handle and these IDs\n // identify its individual children.\n //\n // For a `scale` ladder these identify only resting, cancellable rungs. Every\n // accepted rung and its state is reported in `acceptedChildren`. Scale rungs\n // are never replaced, so a resting ID stays valid after the handle is gone.\n // For a `chase` this is only the order resting at placement time — the\n // strategy cancels and re-places as the touch moves, and each replacement has\n // a new ID that is held in the session rather than reported here, so the value\n // goes stale on the first re-price. Cancel a live chase by its handle.\n //\n // When TP/SL protection cannot be fully restored, these identify the old\n // orders that survived, may still be live when reconciliation failed, or were\n // recreated; an empty array means none are known or potentially live.\n childOrderIds?: string[];\n providerId?: PerpsProviderType; // Multi-provider: which provider executed this order (injected by aggregator)\n /**\n * Structured record of venue state that was ALREADY committed before the\n * placement failed — e.g. a leverage change that landed before the order\n * was rejected. Present only on failure results where such state exists;\n * callers must not treat the failure as \"nothing happened\".\n */\n partialState?: {\n /** Leverage (in x) the venue already applied for this symbol. */\n leverageUpdated?: number;\n };\n};\n\n/**\n * A TP/SL protection change that could not be safely completed\n * automatically and requires an explicit new protection intent from the\n * user. Surfaced by providers with durable settlement state (Lighter).\n */\nexport type PerpsPendingManualRecovery = {\n symbol: string;\n /** Durable identity (address:accountIndex:apiKey:symbol). */\n settlementKey: string;\n recordedAt: number;\n /** Human-readable cause of the parked state. */\n reason: string;\n /** Whether the interrupted operation replaced or removed protection. */\n priorIntent: 'replace' | 'remove';\n /** Venue order ids still on the books when the state was parked. */\n survivingOrderIds: string[];\n /** What the user should do to resolve the state. */\n actionNeeded: string;\n};\n\n/**\n * A previously ambiguous dispatch whose outcome was later resolved.\n * Writes stay blocked until each outcome is explicitly acknowledged via\n * `acknowledgeRecoveredDispatch` (after the caller refreshes venue\n * state) — except `failed`, which is retry-safe and non-blocking.\n */\nexport type PerpsRecoveredDispatch = {\n /** Stable id for selective acknowledgment. */\n recoveryId: string;\n /** Venue transaction type of the dispatch. */\n kind: number;\n /** Human-readable operation intent. */\n intent: string;\n txHash: string | null;\n outcome: 'succeeded' | 'failed' | 'unknown';\n /** How the outcome was determined (e.g. `tx-status:2`, `rest-advance`). */\n evidence: string;\n};\n\nexport type ChaseOrderStatus =\n (typeof CHASE_ORDER_STATUS)[keyof typeof CHASE_ORDER_STATUS];\n\nexport type TwapOrderStatus =\n | 'active'\n | 'completed'\n | 'completed_underfilled'\n | 'canceled'\n | 'failed';\n\nexport type TwapOrderFill = {\n fillId: string;\n orderId: string;\n side: 'buy' | 'sell';\n price: string;\n size: string;\n fee: string;\n feeToken: string;\n builderFee?: string;\n timestamp: number;\n transactionHash: string;\n};\n\n/** Current and terminal state of one venue-native TWAP schedule. */\nexport type TwapOrder = {\n orderId: string;\n symbol: string;\n side: 'buy' | 'sell';\n size: string;\n executedSize: string;\n remainingSize: string;\n executedNotional: string;\n averagePrice?: string;\n fillProgressBps: number;\n timeProgressBps: number;\n elapsedTimeMilliseconds: number;\n durationMinutes: number;\n randomize: boolean;\n reduceOnly: boolean;\n status: TwapOrderStatus;\n startedAt: number;\n lastUpdated: number;\n error?: string;\n fills: TwapOrderFill[];\n providerId?: PerpsProviderType;\n};\n\n/**\n * Client-visible state of one emulated Chase placement.\n *\n * The handle remains stable while the exchange child ID and resting price can\n * change on every reprice. Terminal sessions are retained until provider\n * teardown so clients can observe why chasing stopped and then reconcile the\n * surviving child through the ordinary orders stream.\n */\nexport type ChaseOrder = {\n handle: string;\n symbol: string;\n side: 'buy' | 'sell';\n originalSize: string;\n remainingSize: string;\n arrivalPrice: string;\n restingPrice: string;\n restingOrderId: string | null;\n /** Adverse distance of the resting child from arrival, rounded to whole bps. */\n distanceChasedBps: number;\n /**\n * Optional adverse-touch stop, strictly between 0 and 10,000 bps.\n * The resting child may sit just inside this boundary after price-grid rounding.\n */\n maxDistanceBps?: number;\n repricings: number;\n startedAt: number;\n status: ChaseOrderStatus;\n providerId?: PerpsProviderType;\n};\n\n/** Lifecycle signal emitted when a Chase reaches its configured distance. */\nexport type ChaseOrderMaxDistanceReached = {\n handle: string;\n symbol: string;\n side: 'buy' | 'sell';\n restingOrderId: string | null;\n restingPrice: string;\n maxDistanceBps: number;\n timestamp: number;\n providerId: PerpsProviderType;\n};\n\nexport type Position = {\n symbol: string; // Asset identifier (e.g., 'ETH', 'BTC', 'xyz:TSLA')\n size: string; // Signed position size (+ = LONG, - = SHORT)\n entryPrice: string; // Average entry price\n positionValue: string; // Total position value in USD\n unrealizedPnl: string; // Unrealized profit/loss\n marginUsed: string; // Margin currently used for this position\n leverage: {\n type: 'isolated' | 'cross'; // Margin type\n value: number; // Leverage multiplier\n rawUsd?: string; // USD amount (for isolated margin)\n };\n liquidationPrice: string | null; // Liquidation price (null if no risk)\n maxLeverage: number; // Maximum allowed leverage for this asset\n returnOnEquity: string; // ROE percentage\n cumulativeFunding: {\n // Funding payments history\n allTime: string; // Total funding since account opening\n sinceOpen: string; // Funding since position opened\n sinceChange: string; // Funding since last size change\n };\n /**\n * Take profit price (if set).\n *\n * Summary field, resolved for the common case a client renders: when\n * `takeProfitOrders` holds exactly one order this is that order's trigger\n * price, whether or not it covers the whole position. With two or more orders\n * no single price describes them, so this falls back to the position-bound\n * trigger — clients render `takeProfitCount` there instead.\n *\n * It may also reflect a TP/SL child of a *pending* order on this market, which\n * `takeProfitOrders` and `takeProfitCount` deliberately exclude because such a\n * child protects that order rather than the position. A position can therefore\n * report a price here with an empty array and a count of `0`. Prefer\n * `takeProfitOrders` for anything that must be exact.\n */\n takeProfitPrice?: string;\n /**\n * Stop loss price (if set). Same caveat as `takeProfitPrice`.\n */\n stopLossPrice?: string;\n takeProfitCount: number; // Take profit count, how many tps can affect the position\n stopLossCount: number; // Stop loss count, how many sls can affect the position\n // Full view of the trigger orders attached to this position, including\n // quantity-scoped (partial) ones. The scalar `takeProfitPrice`/`stopLossPrice`\n // fields above only carry one price each and cannot represent partial TP/SL.\n takeProfitOrders?: PositionTriggerOrder[];\n stopLossOrders?: PositionTriggerOrder[];\n providerId?: PerpsProviderType; // Multi-provider: which provider holds this position (injected by aggregator)\n};\n\n/**\n * A trigger order attached to a position, as surfaced in position state.\n * Provider-agnostic: protocols map their own trigger representation onto this.\n */\nexport type PositionTriggerOrder = {\n orderId: string; // Exchange order ID (cancelable)\n direction: TriggerDirection; // Whether the trigger takes profit or stops loss. Always known: recovered from the trigger price against the entry when the exchange does not name the placement type\n orderType?: TriggerOrderType; // Normalized placement type. Absent when the exchange reported an unnamed trigger, whose execution mode cannot be recovered\n triggerPrice: string; // Price at which the order activates\n size: string; // Quantity this trigger closes (resolved to position size when the protocol encodes \"whole position\")\n isPartial: boolean; // true when `size` is smaller than the position size\n reduceOnly: boolean; // Whether the trigger can only reduce the position\n};\n\n// Using 'type' instead of 'interface' for BaseController Json compatibility\nexport type AccountState = {\n /**\n * Total USD equity on this venue — collateral + unrealized PnL. Live MTM.\n * HL: crossMarginSummary.accountValue + spot(USDC) − spot.hold\n */\n totalBalance: string;\n /**\n * Max USD that can immediately collateralize a new position on this venue,\n * with no internal transfer required.\n * HL Unified: withdrawable + freeSpotUSDC\n * HL Standard: withdrawable\n */\n spendableBalance: string;\n /**\n * Max USD that can leave this venue to the user's external wallet.\n * UI reads this value without branching on provider; the provider\n * contract guarantees HL's own abstraction (Unified) or the direct\n * perps-clearinghouse (Standard) is what actually settles the\n * withdraw — no client-side spot→perps sweep is performed.\n * HL Unified: withdrawable + freeSpotUSDC (USDC only; `freeSpotUSDC = spot.total - spot.hold`, and HL withdraw3 draws from the unified ledger server-side)\n * HL Standard: withdrawable (perps-clearinghouse only; spot is a separate ledger)\n */\n withdrawableBalance: string;\n marginUsed: string;\n unrealizedPnl: string;\n returnOnEquity: string;\n /**\n * Per-sub-account balance breakdown (protocol-specific, optional)\n * Maps sub-account identifier to its balance details.\n *\n * Protocol examples:\n * - HyperLiquid HIP-3: '' or 'main' (main DEX), 'xyz' (HIP-3 builder DEX)\n * - dYdX: Sub-account numbers (e.g., '0', '1', '2')\n * - Other protocols: Vault IDs, pool IDs, margin account IDs, etc.\n *\n * Key: Sub-account identifier (protocol-specific string)\n * Value: Balance details for that sub-account\n */\n subAccountBreakdown?: Record<\n string,\n {\n spendableBalance: string;\n withdrawableBalance: string;\n totalBalance: string;\n }\n >;\n providerId?: PerpsProviderType; // Multi-provider: which provider this account state is from (injected by aggregator)\n};\n\nexport type ClosePositionParams = {\n symbol: string; // Asset identifier to close (e.g., 'ETH', 'BTC', 'xyz:TSLA')\n size?: string; // Size to close (omit for full close)\n /**\n * Close order type (default: market). Only `market` and `limit` are meaningful\n * here: `ClosePositionParams` carries no trigger price, so a trigger-based\n * close is not expressible and would be rejected during placement.\n *\n * Strategy placements are excluded at the type level rather than left to a\n * runtime rejection, because this type cannot carry any of the fields they\n * require and `closePosition` has no path that executes them. Derived with\n * `Exclude` on purpose: it shrinks as `StrategyOrderType` grows, so a strategy\n * added later is refused here automatically.\n */\n orderType?: Exclude<OrderType, StrategyOrderType>;\n price?: string; // Limit price (required for limit close)\n currentPrice?: number; // Current market price for validation\n\n // USD as source of truth (hybrid approach - same as OrderParams)\n usdAmount?: string; // USD amount (primary source of truth, provider calculates size from this)\n priceAtCalculation?: number; // Price snapshot when size was calculated (for slippage validation)\n maxSlippageBps?: number; // Slippage tolerance in basis points (e.g., 100 = 1%, default if not provided)\n\n // Optional tracking data for MetaMetrics events\n trackingData?: TrackingData;\n\n // Multi-provider routing (optional: defaults to active/default provider)\n providerId?: PerpsProviderType; // Optional: override active provider for routing\n\n /**\n * Optional caller snapshot for diagnostics.\n *\n * The provider always resolves the position from the current DEX WebSocket\n * slice or an HTTP read. It never uses this snapshot for order size or side.\n * If neither authoritative source answers, the close fails with\n * `PROVIDER_NOT_AVAILABLE`.\n */\n position?: Position;\n};\n\nexport type ClosePositionsParams = {\n symbols?: string[]; // Optional: specific symbols to close (omit or empty array to close all)\n closeAll?: boolean; // Explicitly close all positions\n};\n\nexport type ClosePositionsResult = {\n success: boolean; // Overall success (true if at least one position closed)\n successCount: number; // Number of positions closed successfully\n failureCount: number; // Number of positions that failed to close\n /**\n * Batch-level operation error.\n *\n * Set when the close fails as a whole: snapshot/preparation errors with no\n * per-position outcomes, or a thrown batch submission that also fills\n * `results` with per-position failures.\n */\n error?: string;\n results: {\n symbol: string;\n success: boolean;\n error?: string;\n }[];\n};\n\nexport type UpdateMarginParams = {\n symbol: string; // Asset identifier (e.g., 'BTC', 'ETH', 'xyz:TSLA')\n amount: string; // Amount to adjust as string (positive = add, negative = remove)\n providerId?: PerpsProviderType; // Multi-provider: optional provider override for routing\n};\n\nexport type MarginResult = {\n success: boolean;\n error?: string;\n};\n\nexport type FlipPositionParams = {\n symbol: string; // Asset identifier to flip (e.g., 'BTC', 'ETH', 'xyz:TSLA')\n position: Position; // Current position to flip\n\n // Optional tracking data for MetaMetrics events\n trackingData?: TrackingData;\n};\n\nexport type InitializeResult = {\n success: boolean;\n error?: string;\n chainId?: string;\n};\n\nexport type ReadyToTradeResult = {\n ready: boolean;\n error?: string;\n walletConnected?: boolean;\n networkSupported?: boolean;\n authenticatedAddress?: string;\n};\n\nexport type DisconnectResult = {\n success: boolean;\n error?: string;\n};\n\nexport type MarketInfo = {\n name: string; // HyperLiquid: universe name (asset symbol)\n szDecimals: number; // HyperLiquid: size decimals\n maxLeverage: number; // HyperLiquid: max leverage\n marginTableId: number; // HyperLiquid: margin requirements table ID\n marginMode?: 'strictIsolated' | 'noCross'; // HyperLiquid market capability\n onlyIsolated?: true; // HyperLiquid: isolated margin only (optional, only when true)\n isDelisted?: true; // HyperLiquid: delisted status (optional, only when true)\n minimumOrderSize?: number; // Minimum order size in USD (protocol-specific)\n providerId?: PerpsProviderType; // Multi-provider: which provider this market comes from (injected by aggregator)\n};\n\n/**\n * Market data with prices for UI display\n * Protocol-agnostic interface for market information with formatted values\n */\nexport type PerpsMarketData = {\n /**\n * Token symbol (e.g., 'BTC', 'ETH')\n */\n symbol: string;\n /**\n * Full token name (e.g., 'Bitcoin', 'Ethereum')\n */\n name: string;\n /**\n * Human-readable asset description from Terminal API metadata, when available\n * (e.g., 'The leading smart contract platform. Home to DeFi, NFTs...').\n * Only populated when using the Terminal API backend and the asset has one.\n */\n description?: string;\n /**\n * Maximum leverage available as formatted string (e.g., '40x', '25x')\n */\n maxLeverage: string;\n /**\n * Current price as formatted string (e.g., '$50,000.00')\n */\n price: string;\n /**\n * 24h price change as formatted string (e.g., '+$1,250.00', '-$850.50')\n */\n change24h: string;\n /**\n * 24h price change percentage as formatted string (e.g., '+2.5%', '-1.8%')\n */\n change24hPercent: string;\n /**\n * Trading volume as formatted string (e.g., '$1.2B', '$850M')\n */\n volume: string;\n /**\n * Open interest as formatted string (e.g., '$24.5M', '$1.2B')\n */\n openInterest?: string;\n /**\n * Next funding time in milliseconds since epoch (optional, market-specific)\n */\n nextFundingTime?: number;\n /**\n * Funding interval in hours (optional, market-specific)\n */\n fundingIntervalHours?: number;\n /**\n * Current funding rate as decimal (optional, from predictedFundings API)\n */\n fundingRate?: number;\n /**\n * Market source DEX identifier (HIP-3 support)\n * - null or undefined: Main validator DEX\n * - \"xyz\", \"abc\", etc: HIP-3 builder-deployed DEX\n */\n marketSource?: string | null;\n /**\n * Market asset type classification (optional)\n * - crypto: Cryptocurrency (default for most markets)\n * - stock: Individual stocks (HIP-3)\n * - pre-ipo: Pre-IPO assets (HIP-3)\n * - index: Market indices (HIP-3)\n * - etf: Exchange-traded funds (HIP-3)\n * - commodity: Commodity markets (HIP-3)\n * - forex: Foreign exchange pairs (HIP-3)\n */\n marketType?: MarketType;\n /**\n * Whether this is a HIP-3 market (has DEX prefix like xyz:, flx:)\n * Used to distinguish between crypto (isHip3=false) and non-crypto markets\n */\n isHip3?: boolean;\n /**\n * Whether this is a new/uncategorized market (HIP-3 markets not yet in explicit mapping)\n * Used for the \"New\" filter tab\n */\n isNewMarket?: boolean;\n /**\n * Multi-provider: which provider this market data comes from (injected by aggregator)\n */\n providerId?: PerpsProviderType;\n /**\n * Indicates this market snapshot came from the last known good cache after live fetch failure.\n */\n isStale?: boolean;\n /** Identifies an atomic Terminal summary whose price/change use mark semantics. */\n dataSource?: 'terminal-global-snapshot-mark';\n /** Source-bounded expiry for an atomic Terminal summary. */\n sourceExpiresAt?: number;\n /**\n * Searchable keywords from Terminal API metadata (e.g., ['defi', 'layer-1'])\n */\n keywords?: string[];\n /**\n * Taxonomy tags from Terminal API metadata (e.g., ['top-100', 'gaming'])\n */\n tags?: string[];\n /**\n * Market categories from Terminal API metadata (e.g., ['crypto', 'meme'])\n */\n categories?: string[];\n /** Timestamped hourly price points supplied by the atomic Terminal snapshot. */\n trend?: [timestampMs: number, price: string][];\n /**\n * Epoch ms when this market was listed on the Terminal backend.\n * Sourced from the Terminal API `listedAt` field.\n * Clients can use this to surface recently added markets (e.g. markets listed within the last 30 days).\n */\n listedAt?: number;\n};\n\nexport type ToggleTestnetResult = {\n success: boolean;\n isTestnet: boolean;\n error?: string;\n};\n\nexport type AssetRoute = {\n assetId: CaipAssetId; // CAIP asset ID (e.g., \"eip155:42161/erc20:0xaf88.../default\")\n chainId: CaipChainId; // CAIP-2 chain ID where the bridge contract is located\n contractAddress: Hex; // Bridge contract address for deposits/withdrawals\n constraints?: {\n minAmount?: string; // Minimum deposit/withdrawal amount\n maxAmount?: string; // Maximum deposit/withdrawal amount\n estimatedTime?: string; // Estimated processing time (formatted string - deprecated, use estimatedMinutes)\n estimatedMinutes?: number; // Estimated processing time in minutes (raw value for UI formatting)\n fees?: {\n fixed?: number; // Fixed fee amount (e.g., 1 for 1 token)\n percentage?: number; // Percentage fee (e.g., 0.05 for 0.05%)\n token?: string; // Fee token symbol (e.g., 'USDC', 'ETH')\n };\n };\n};\n\nexport type SwitchProviderResult = {\n success: boolean;\n providerId: PerpsActiveProviderMode;\n error?: string;\n};\n\nexport type CancelOrderParams = {\n orderId: string; // Order ID to cancel, or the strategy handle when orderType is a strategy type\n symbol: string; // Asset identifier (e.g., 'BTC', 'ETH', 'xyz:TSLA')\n /**\n * Placement type of what is being cancelled. Only the strategy types\n * (`twap`, `scale`, `chase`) change anything: each is cancelled through its\n * own path — the venue's TWAP cancel endpoint, a batch cancel of the ladder's\n * children, or stopping the chase session and cancelling its live order.\n * Omit it (or pass an ordinary order type) to cancel a single resting order,\n * which is what every existing caller does.\n */\n orderType?: OrderType;\n // Optional provider override. Omission uses active/default routing.\n providerId?: PerpsProviderType;\n // Optional tracking data for MetaMetrics events (e.g. discovery attribution)\n trackingData?: TrackingData;\n};\n\nexport type CancelOrderResult = {\n success: boolean;\n /**\n * What was cancelled, named the same way it was placed: an exchange order ID\n * for an ordinary cancel, and the strategy handle — TWAP id, scale group, or\n * chase session — when `CancelOrderParams.orderType` named one. Scale and\n * chase handles can only be cancelled during the provider session that\n * created them; TWAP IDs are venue-owned.\n */\n orderId?: string;\n error?: string;\n providerId?: PerpsProviderType; // Multi-provider: source provider identifier\n};\n\nexport type BatchCancelOrdersParams = {\n orderId: string;\n symbol: string;\n}[];\n\nexport type CancelOrdersParams = {\n symbols?: string[]; // Optional: specific symbols (omit to cancel all orders)\n orderIds?: string[]; // Optional: specific order IDs (omit to cancel all orders for specified coins)\n cancelAll?: boolean; // Explicitly cancel all orders\n};\n\nexport type CancelOrdersResult = {\n success: boolean; // Overall success (true if at least one order cancelled)\n successCount: number; // Number of orders cancelled successfully\n failureCount: number; // Number of orders that failed to cancel\n results: {\n orderId: string;\n symbol: string;\n success: boolean;\n error?: string;\n }[];\n};\n\nexport type EditOrderParams = {\n orderId: string | number; // Order ID or client order ID to modify\n newOrder: OrderParams; // New order parameters\n};\n\nexport type DepositParams = {\n amount: string; // Amount to deposit\n assetId: CaipAssetId; // Asset to deposit (required for validation)\n fromChainId?: CaipChainId; // Source chain (defaults to current network)\n toChainId?: CaipChainId; // Destination chain (defaults to HyperLiquid Arbitrum)\n recipient?: Hex; // Recipient address (defaults to selected account)\n};\n\n/** Params for depositWithConfirmation: prepares transaction for confirmation screen */\nexport type DepositWithConfirmationParams = {\n /** Optional deposit amount (display/tracking; actual amount comes from prepared transaction) */\n amount?: string;\n /** If true, uses addTransaction instead of submit to avoid navigation (e.g. deposit + place order flow) */\n placeOrder?: boolean;\n};\n\nexport type DepositResult = {\n success: boolean;\n txHash?: string;\n error?: string;\n};\n\n// Enhanced deposit flow state types for multi-step deposits\nexport type DepositStatus =\n | 'idle' // No deposit in progress\n | 'preparing' // Analyzing route & preparing transactions\n | 'swapping' // Converting token (e.g., ETH → USDC)\n | 'bridging' // Cross-chain transfer\n | 'depositing' // Final deposit to HyperLiquid\n | 'success' // Deposit completed successfully\n | 'error'; // Deposit failed at any step\n\nexport type DepositFlowType =\n | 'direct' // Same chain, same token (USDC on Arbitrum)\n | 'swap' // Same chain, different token (ETH → USDC)\n | 'bridge' // Different chain, same token (USDC on Ethereum → Arbitrum)\n | 'swap_bridge'; // Different chain, different token (ETH on Ethereum → USDC on Arbitrum)\n\nexport type DepositStepInfo = {\n totalSteps: number; // Total number of steps in this flow\n currentStep: number; // Current step (0-based index)\n stepNames: string[]; // Human-readable step names\n stepTxHashes?: string[]; // Transaction hashes for each completed step\n};\n\nexport type WithdrawParams = {\n amount: string; // Amount to withdraw\n destination?: Hex; // Destination address (optional, defaults to current account)\n assetId?: CaipAssetId; // Asset to withdraw (defaults to USDC)\n providerId?: PerpsProviderType; // Multi-provider: optional provider override for routing\n};\n\nexport type WithdrawResult = {\n success: boolean;\n txHash?: string;\n error?: string;\n withdrawalId?: string; // Unique ID for tracking\n estimatedArrivalTime?: number; // Provider-specific arrival time\n};\n\nexport type TransferBetweenDexsParams = {\n sourceDex: string; // Source DEX name ('' = main DEX, 'xyz' = HIP-3 DEX)\n destinationDex: string; // Destination DEX name ('' = main DEX, 'xyz' = HIP-3 DEX)\n amount: string; // USDC amount to transfer\n};\n\nexport type TransferBetweenDexsResult = {\n success: boolean;\n txHash?: string;\n error?: string;\n};\n\nexport type GetHistoricalPortfolioParams = {\n accountId?: CaipAccountId; // Optional: defaults to selected account\n};\n\nexport type HistoricalPortfolioResult = {\n accountValue1dAgo: string;\n timestamp: number;\n};\n\nexport type LiveDataConfig = {\n priceThrottleMs?: number; // ms between price updates (default: 2000)\n positionThrottleMs?: number; // ms between position updates (default: 5000)\n maxUpdatesPerSecond?: number; // hard limit to prevent UI blocking\n};\n\nexport type PerpsControllerConfig = {\n /**\n * Fallback blocked regions to use when RemoteFeatureFlagController fails to fetch.\n * The fallback is set by default if defined and replaced with remote block list once available.\n */\n fallbackBlockedRegions?: string[];\n /**\n * Fallback HIP-3 equity perps master switch to use when RemoteFeatureFlagController fails to fetch.\n * Controls whether HIP-3 (builder-deployed) DEXs are enabled.\n * The fallback is set by default if defined and replaced with remote feature flag once available.\n */\n fallbackHip3Enabled?: boolean;\n /**\n * Fallback HIP-3 market allowlist to use when RemoteFeatureFlagController fails to fetch.\n * Empty array = enable all markets (discovery mode), non-empty = allowlist specific markets.\n * Supports wildcards: \"xyz:*\" (all xyz markets), \"xyz\" (shorthand for \"xyz:*\"), \"BTC\" (main DEX market).\n * Only applies when HIP-3 is enabled.\n * The fallback is set by default if defined and replaced with remote feature flag once available.\n */\n fallbackHip3AllowlistMarkets?: string[];\n /**\n * Fallback HIP-3 market blocklist to use when RemoteFeatureFlagController fails to fetch.\n * Empty array = no blocking, non-empty = block specific markets.\n * Supports wildcards: \"xyz:*\" (block all xyz markets), \"xyz\" (shorthand for \"xyz:*\"), \"BTC\" (block main DEX market).\n * Always applied regardless of HIP-3 enabled state.\n * The fallback is set by default if defined and replaced with remote feature flag once available.\n */\n fallbackHip3BlocklistMarkets?: string[];\n\n /**\n * Override for the maximum allowed deviation of a market's price from its oracle\n * (reference) price before it is reported as untradable (`PriceUpdate.isTradable`),\n * as a decimal fraction (e.g. `0.95` = 95%). Protocol-agnostic: each provider applies\n * its own default when omitted (HyperLiquid uses\n * `HYPERLIQUID_CONFIG.OraclePriceDeviationLimit`, `0.95`). Lets a client tune the\n * threshold without a package release.\n */\n fallbackPriceDeviationLimit?: number;\n\n /**\n * Per-provider credentials and configuration.\n * Nested by provider name so each provider's settings are self-contained\n * and new protocols can be added without polluting the top-level config.\n * Passed from the init file where `process.env.X` is babel-transformed at build time.\n */\n providerCredentials?: PerpsProviderCredentials;\n};\n\nexport type HyperLiquidCredentials = {\n /** Builder fee wallet address for testnet. Empty/omitted = uses BUILDER_FEE_CONFIG default. */\n builderAddressTestnet?: string;\n /** Builder fee wallet address for mainnet. Empty/omitted = uses BUILDER_FEE_CONFIG default. */\n builderAddressMainnet?: string;\n /** Dedicated subscription waiver builder for testnet. */\n subscriptionBuilderAddressTestnet?: string;\n /** Dedicated subscription waiver builder for mainnet. */\n subscriptionBuilderAddressMainnet?: string;\n};\n\nexport type LighterCredentials = {\n /** Whether Lighter provider is enabled via local env var. */\n enabled?: boolean;\n /** Lighter account index override (testnet tooling). */\n accountIndexTestnet?: number;\n accountIndexMainnet?: number;\n /** API key slot to register/use (defaults to LIGHTER_DEFAULT_API_KEY_INDEX). */\n apiKeyIndex?: number;\n /**\n * Client-owned Lighter signer. The client creates and persists the venue\n * key behind this bridge; Core receives only signing results and public\n * registration data, matching the injected-wallet boundary used by\n * HyperLiquid.\n *\n * Mobile uses an off-screen WebView bridge; headless clients may use an\n * in-process WASM bridge.\n * Optional — without it the Lighter provider is read-only. Lives on the\n * Lighter credentials bag, not PerpsPlatformDependencies, so the shared\n * platform surface stays venue-agnostic.\n */\n signerBridge?: LighterSignerBridge;\n};\n\nexport type PerpsProviderCredentials = {\n hyperliquid?: HyperLiquidCredentials;\n lighter?: LighterCredentials;\n};\n\nexport type PriceUpdate = {\n symbol: string; // Asset identifier (e.g., 'BTC', 'ETH', 'xyz:TSLA')\n price: string; // Current mid price (average of best bid and ask)\n timestamp: number; // Update timestamp\n percentChange24h?: string; // 24h price change percentage\n // Order book data (only available when includeOrderBook is true)\n bestBid?: string; // Best bid price (highest price buyers are willing to pay)\n bestAsk?: string; // Best ask price (lowest price sellers are willing to accept)\n spread?: string; // Ask - Bid spread\n markPrice?: string; // Mark price from oracle (used for liquidations)\n // Market data (only available when includeMarketData is true)\n funding?: number; // Current funding rate\n openInterest?: number; // Open interest in USD\n volume24h?: number; // 24h trading volume in USD\n /**\n * Whether the market is currently tradable. Defaults to `true`.\n *\n * Some markets — most often HIP-3 builder-deployed ones — become temporarily\n * untradable when their market price drifts too far from the oracle price, in which\n * case the protocol rejects orders (HyperLiquid: \"Order price cannot be more than 95%\n * away from the reference price\"). Clients use this to proactively show a \"trading\n * unavailable\" warning instead of letting the order fail on submission.\n *\n * Computed per provider/protocol from that protocol's own rules. It is `false` only\n * when a provider determines the market is currently untradable; a provider that has no\n * such rule, or cannot assess tradability yet (e.g. before the oracle price is cached),\n * reports `true`. The value is always a concrete boolean — never `undefined`.\n */\n isTradable: boolean;\n providerId?: PerpsProviderType; // Multi-provider: price source (injected by aggregator)\n};\n\nexport type OrderFill = {\n orderId: string; // Order ID that was filled\n symbol: string; // Asset symbol\n side: string; // Normalized order side ('buy' or 'sell')\n size: string; // Fill size\n price: string; // Fill price\n pnl: string; // PNL\n direction: string; // Direction of the fill\n fee: string; // Fee paid\n feeToken: string; // Fee token symbol\n timestamp: number; // Fill timestamp\n startPosition?: string; // Start position\n success?: boolean; // Whether the order was filled successfully\n liquidation?: {\n liquidatedUser: string; // Address of the liquidated user. liquidatedUser isn't always the current user. It can also mean the fill filled another user's liquidation.\n markPx: string; // Mark price at liquidation\n method: string; // Liquidation method (e.g., 'market')\n };\n orderType?: 'take_profit' | 'stop_loss' | 'liquidation' | 'regular';\n detailedOrderType?: string; // Original order type from exchange\n providerId?: PerpsProviderType; // Multi-provider: which provider this fill occurred on (injected by aggregator)\n};\n\n// Parameter interfaces - all fully optional for better UX\nexport type CheckEligibilityParams = {\n blockedRegions: string[]; // List of blocked region codes (e.g., ['US', 'CN'])\n geoLocation: string; // User's geolocation from GeolocationController\n};\n\nexport type GetPositionsParams = {\n accountId?: CaipAccountId; // Optional: defaults to selected account\n includeHistory?: boolean; // Optional: include historical positions\n skipCache?: boolean; // Optional: bypass WebSocket cache and force API call (default: false)\n standalone?: boolean; // Optional: lightweight mode - skip full initialization, use standalone HTTP client (no wallet/WebSocket needed)\n userAddress?: string; // Optional: required when standalone is true - user address to query positions for\n};\n\nexport type GetAccountStateParams = {\n accountId?: CaipAccountId; // Optional: defaults to selected account\n source?: string; // Optional: source of the call for tracing (e.g., 'health_check', 'initial_connection')\n standalone?: boolean; // Optional: lightweight mode - skip full initialization, use standalone HTTP client (no wallet/WebSocket needed)\n userAddress?: string; // Optional: required when standalone is true - user address to query account state for\n};\n\nexport type GetUserDataSnapshotParams = {\n userAddress: string;\n identity: {\n provider: 'hyperliquid';\n network: 'mainnet' | 'testnet';\n hip3ConfigVersion: number;\n dexes: string[];\n };\n};\n\nexport type PerpsUserDataSnapshot = {\n positions: Position[];\n orders: Order[];\n accountState: AccountState;\n identity: GetUserDataSnapshotParams['identity'] & { address: string };\n};\n\nexport type GetOrderFillsParams = {\n accountId?: CaipAccountId; // Optional: defaults to selected account\n user?: Hex; // Optional: user address (defaults to selected account)\n startTime?: number; // Optional: start timestamp (Unix milliseconds)\n endTime?: number; // Optional: end timestamp (Unix milliseconds)\n limit?: number; // Optional: max number of results for pagination\n aggregateByTime?: boolean; // Optional: aggregate by time\n};\n\n/**\n * Parameters for getOrFetchFills - optimized cache-first fill retrieval.\n * Subset of GetOrderFillsParams for cache filtering.\n */\nexport type GetOrFetchFillsParams = {\n startTime?: number; // Optional: start timestamp (Unix milliseconds)\n symbol?: string; // Optional: filter by symbol\n};\n\nexport type GetOrdersParams = {\n accountId?: CaipAccountId; // Optional: defaults to selected account\n startTime?: number; // Optional: start timestamp (Unix milliseconds)\n endTime?: number; // Optional: end timestamp (Unix milliseconds)\n limit?: number; // Optional: max number of results for pagination\n offset?: number; // Optional: offset for pagination\n skipCache?: boolean; // Optional: bypass WebSocket cache and force API call (default: false)\n standalone?: boolean; // Optional: lightweight mode - skip full initialization, use standalone HTTP client (no wallet/WebSocket needed)\n userAddress?: string; // Optional: required when standalone is true - user address to query orders for\n};\n\n/**\n * Options for cache-aware provider read calls (getOrders, getOrderFills, etc.).\n * Provider-agnostic: providers without inner caches can ignore; providers that\n * cache at the service layer (e.g. HyperLiquid) must honor forceRefresh.\n */\nexport type PerpsReadOptions = {\n /** Bypass any provider-internal cache. Used for user-initiated refresh (pull-to-refresh). */\n forceRefresh?: boolean;\n};\n\nexport type GetFundingParams = {\n accountId?: CaipAccountId; // Optional: defaults to selected account\n startTime?: number; // Optional: start timestamp (Unix milliseconds)\n endTime?: number; // Optional: end timestamp (Unix milliseconds)\n limit?: number; // Optional: max number of results for pagination\n offset?: number; // Optional: offset for pagination\n};\n\nexport type GetSupportedPathsParams = {\n isTestnet?: boolean; // Optional: override current testnet state\n assetId?: CaipAssetId; // Optional: filter by specific asset\n symbol?: string; // Optional: filter by asset symbol (e.g., 'USDC')\n chainId?: CaipChainId; // Optional: filter by chain (CAIP-2 format)\n};\n\n/** Placeholder for future filter/pagination params (e.g., validated, chain). Empty today so the API signature is stable. */\nexport type GetAvailableDexsParams = Record<string, never>;\n\n/** Field to sort markets by. */\nexport type SortField =\n | 'volume'\n | 'priceChange'\n | 'fundingRate'\n | 'openInterest';\n\n/** Direction for market sorting. */\nexport type SortDirection = 'asc' | 'desc';\n\nexport type GetMarketsParams = {\n symbols?: string[]; // Optional symbol filter (e.g., ['BTC', 'xyz:XYZ100'])\n dex?: string; // HyperLiquid HIP-3: DEX name (empty string '' or undefined for main DEX). Other protocols: ignored.\n skipFilters?: boolean; // Skip market filtering (both allowlist and blocklist, default: false). When true, returns all markets without filtering.\n standalone?: boolean; // Lightweight mode: skip full initialization, only fetch market metadata (no wallet/WebSocket needed). Only main DEX markets returned. Use for discovery use cases like checking if a perps market exists.\n useTerminalApi?: boolean; // When true, enrich provider data from the legacy Terminal market endpoint.\n};\n\n/**\n * Parameters for {@link PerpsController.getMarketDataWithPrices}.\n * Extends the base market-fetch params with optional category filtering,\n * sorting, and pagination that are applied as post-processing.\n */\nexport type GetMarketDataWithPricesParams = {\n standalone?: boolean; // Lightweight mode: see GetMarketsParams.standalone\n categories?: MarketTypeFilter[]; // Filter to markets matching any of these categories; omit for all markets\n excludeSymbols?: string[]; // Symbols to exclude from results (e.g. the currently viewed market)\n sortBy?: SortField; // Sort results by this field\n direction?: SortDirection; // Sort direction (default: desc)\n limit?: number; // Maximum number of results to return\n useTerminalApi?: boolean; // When true, enrich provider data from the legacy Terminal market endpoint.\n};\n\nexport type SubscribePricesParams = {\n symbols: string[];\n callback: (prices: PriceUpdate[]) => void;\n throttleMs?: number; // Future: per-subscription throttling\n includeOrderBook?: boolean; // Optional: include bid/ask data from L2 book\n includeMarketData?: boolean; // Optional: include funding, open interest, volume data\n};\n\nexport type SubscribePositionsParams = {\n callback: (positions: Position[]) => void;\n accountId?: CaipAccountId; // Optional: defaults to selected account\n includeHistory?: boolean; // Future: include historical data\n};\n\nexport type SubscribeOrderFillsParams = {\n callback: (fills: OrderFill[], isSnapshot?: boolean) => void;\n accountId?: CaipAccountId; // Optional: defaults to selected account\n since?: number; // Future: only fills after timestamp\n};\n\nexport type SubscribeOrdersParams = {\n callback: (orders: Order[]) => void;\n accountId?: CaipAccountId; // Optional: defaults to selected account\n includeHistory?: boolean; // Optional: include filled/canceled orders\n};\n\nexport type SubscribeTwapOrdersParams = {\n /**\n * Receives current and terminal TWAP schedules, newest first — the same\n * shape `getTwapOrders()` returns, so a client can swap a poll for this\n * subscription without reshaping its state.\n *\n * Retention differs from the REST read on purpose: every active schedule is\n * always delivered, while terminal ones are bounded to the most recent 100\n * so a long-lived stream cannot accumulate an account's entire history.\n * Callers needing older terminal schedules should still read\n * `getTwapOrders()`.\n *\n * `isSnapshot` marks the venue's initial full set; later invocations carry\n * the merged result of a delta.\n */\n callback: (twapOrders: TwapOrder[], isSnapshot?: boolean) => void;\n accountId?: CaipAccountId; // Optional: defaults to selected account\n};\n\nexport type SubscribeAccountParams = {\n callback: (account: AccountState | null) => void;\n accountId?: CaipAccountId; // Optional: defaults to selected account\n};\n\nexport type SubscribeOICapsParams = {\n callback: (caps: string[]) => void;\n accountId?: CaipAccountId; // Optional: defaults to selected account\n};\n\nexport type SubscribeCandlesParams = {\n symbol: string;\n interval: CandlePeriod;\n duration?: TimeDuration;\n callback: (data: CandleData) => void;\n onError?: (error: Error) => void;\n};\n\n/**\n * Single price level in the order book\n */\nexport type OrderBookLevel = {\n /** Price at this level */\n price: string;\n /** Size at this level (in base asset) */\n size: string;\n /** Cumulative size up to and including this level */\n total: string;\n /** Notional value in USD */\n notional: string;\n /** Cumulative notional up to and including this level */\n totalNotional: string;\n};\n\n/**\n * Full order book data with multiple price levels\n */\nexport type OrderBookData = {\n /** Bid levels (buy orders) - highest price first */\n bids: OrderBookLevel[];\n /** Ask levels (sell orders) - lowest price first */\n asks: OrderBookLevel[];\n /** Spread between best bid and best ask */\n spread: string;\n /** Spread as a percentage of mid price */\n spreadPercentage: string;\n /** Mid price (average of best bid and best ask) */\n midPrice: string;\n /** Timestamp of last update */\n lastUpdated: number;\n /** Maximum total size across all levels (for scaling depth bars) */\n maxTotal: string;\n};\n\nexport type SubscribeOrderBookParams = {\n /** Symbol to subscribe to (e.g., 'BTC', 'ETH') */\n symbol: string;\n /** Number of levels to return per side (default: 10) */\n levels?: number;\n /** Price aggregation significant figures (2-5, default: 5). Higher = finer granularity */\n nSigFigs?: 2 | 3 | 4 | 5;\n /** Mantissa for aggregation when nSigFigs is 5 (2 or 5). Controls finest price increments */\n mantissa?: 2 | 5;\n /**\n * Enable fast order book updates (5 levels @ ~0.5 s cadence).\n * When omitted, Hyperliquid uses the default cadence (20 levels @ ~2 s).\n * Note: with `fast: true` the widget receives at most 5 levels per side\n * regardless of the `levels` setting.\n */\n fast?: boolean;\n /** Callback function receiving order book updates */\n callback: (orderBook: OrderBookData) => void;\n /** Callback for errors */\n onError?: (error: Error) => void;\n};\n\nexport type LiquidationPriceParams = {\n entryPrice: number;\n leverage: number;\n direction: 'long' | 'short';\n positionSize?: number; // Optional: for more accurate calculations\n marginType?: 'isolated' | 'cross'; // Optional: defaults to isolated\n asset?: string; // Optional: for asset-specific maintenance margins\n /** Provider that owns the position when calculations are aggregated. */\n providerId?: PerpsProviderType;\n};\n\n/**\n * Live position fields required to project a modify. Clients may pass a full\n * {@link Position}; extra fields are ignored.\n */\nexport type PositionModifyPreviewSource = Pick<\n Position,\n | 'symbol'\n | 'size'\n | 'marginUsed'\n | 'liquidationPrice'\n | 'entryPrice'\n | 'leverage'\n | 'positionValue'\n | 'maxLeverage'\n | 'providerId'\n>;\n\n/**\n * Proposed order plus the live position it would modify.\n *\n * Isolated-margin previews apply `leverage` to the *whole* resulting\n * position, matching `updateLeverage` before placement. Cross-margin\n * positions are not projected.\n */\nexport type PositionModifyPreviewParams = {\n position: PositionModifyPreviewSource;\n /** Proposed order direction. */\n direction: 'long' | 'short';\n /** Proposed order size in token units. */\n size: string;\n /**\n * Expected fill price for a marketable order, or the resting limit price.\n * Increases and flips require a positive price; a reduce does not.\n * Scale, TWAP, and chase orders should pass the expected fill size and price;\n * this preview models a single fill.\n */\n price: string;\n /**\n * Isolated leverage the provider will set on the asset before placing.\n * Applied to the entire resulting position, not only the added size.\n */\n leverage: number;\n reduceOnly?: boolean;\n /**\n * Estimated trading fees in USD. Deducted from isolated margin on\n * increases and flips. Omit or pass 0 when unknown.\n */\n feeAmountUsd?: number;\n /**\n * Explicit venue route. Aggregated providers use this, then\n * `position.providerId`, then the default provider.\n */\n providerId?: PerpsProviderType;\n};\n\n/**\n * Independently available numeric projection. Margin can be known when\n * liquidation cannot (missing maintenance-tier data, or no liquidation risk).\n */\nexport type PositionPreviewValue =\n | { available: true; value: number }\n | { available: false };\n\nexport type PositionModifyPreviewKind = 'increase' | 'decrease' | 'flip';\n\nexport type PositionModifyPreviewCurrent = {\n margin: PositionPreviewValue;\n liquidationPrice: PositionPreviewValue;\n};\n\nexport type PositionModifyPreviewOpen = {\n status: 'open';\n kind: PositionModifyPreviewKind;\n current: PositionModifyPreviewCurrent;\n resulting: {\n direction: 'long' | 'short';\n /** Resulting token size; always > 0 for `open`. */\n size: number;\n entryPrice: number;\n /**\n * Isolated leverage from mark notional / remaining margin, matching\n * HyperLiquid's displayed leverage rather than entry notional / margin.\n */\n leverage: number;\n margin: PositionPreviewValue;\n liquidationPrice: PositionPreviewValue;\n };\n};\n\nexport type PositionModifyPreviewFullClose = {\n status: 'full_close';\n current: PositionModifyPreviewCurrent;\n /** Direction of the position being closed. */\n resultingDirection: 'long' | 'short';\n};\n\nexport type PositionModifyPreviewUnsupported = {\n status: 'unsupported';\n reason: 'cross_margin' | 'provider';\n};\n\nexport type PositionModifyPreviewNone = {\n status: 'none';\n};\n\n/**\n * Read-only post-trade position projection.\n *\n * Discriminated on `status` so a non-modifying result cannot carry a\n * flip/full-close kind, and a full close cannot report a remaining size.\n */\nexport type PositionModifyPreviewResult =\n | PositionModifyPreviewNone\n | PositionModifyPreviewUnsupported\n | PositionModifyPreviewFullClose\n | PositionModifyPreviewOpen;\n\nexport type MaintenanceMarginParams = {\n asset: string;\n positionSize?: number; // Optional: for tiered margin systems\n /** Provider that owns the position when calculations are aggregated. */\n providerId?: PerpsProviderType;\n};\n\n/**\n * Context used to resolve the provider that owns order capabilities.\n * `symbol` allows providers to narrow capabilities per market, while\n * `providerId` follows the same explicit-over-default routing as placement.\n */\nexport type GetOrderCapabilitiesParams = {\n /** Provider-specific market identifier, including any routing prefix. */\n symbol: string;\n providerId?: PerpsProviderType;\n};\n\n/** Inputs for a provider-normalized Scale price ladder preview. */\nexport type GetScalePriceLadderParams = {\n /** Market symbol, including its provider route when applicable. */\n symbol: string;\n /** Lowest raw price in the ladder. */\n minPrice: number;\n /** Highest raw price in the ladder. */\n maxPrice: number;\n /** Number of ladder rungs. */\n count: number;\n /** Optional explicit route; omitted uses the active/default provider. */\n providerId?: PerpsProviderType;\n};\n\n/** Provider-owned strategy capabilities for the selected market route. */\nexport type DirectProviderOrderCapabilitiesUnavailableReason =\n | 'provider_unavailable'\n | 'invalid_symbol'\n | 'market_not_found'\n | 'strategy_market_unsupported';\n\nexport type RoutedOrderCapabilitiesUnavailableReason =\n | 'provider_not_found'\n | 'provider_not_routable'\n | 'not_implemented';\n\nexport type OrderCapabilitiesUnavailableReason =\n | DirectProviderOrderCapabilitiesUnavailableReason\n | RoutedOrderCapabilitiesUnavailableReason;\n\ntype ReadyPerpsOrderCapabilities = Readonly<{\n status: 'ready';\n providerId: PerpsProviderType;\n supportedStrategies: readonly StrategyOrderType[];\n}>;\n\nexport type DirectProviderOrderCapabilities =\n | ReadyPerpsOrderCapabilities\n | Readonly<{\n status: 'unavailable';\n providerId?: PerpsProviderType;\n reason: DirectProviderOrderCapabilitiesUnavailableReason;\n }>;\n\nexport type PerpsOrderCapabilities =\n | ReadyPerpsOrderCapabilities\n | Readonly<{\n status: 'unavailable';\n providerId?: PerpsProviderType;\n reason: OrderCapabilitiesUnavailableReason;\n }>;\n\n/** Reasons a direct provider cannot produce a Scale price ladder. */\nexport type DirectProviderScalePriceLadderUnavailableReason = Exclude<\n DirectProviderOrderCapabilitiesUnavailableReason,\n 'strategy_market_unsupported'\n>;\n\n/** Reasons a provider-routed Scale price ladder cannot be produced. */\nexport type ScalePriceLadderUnavailableReason =\n | DirectProviderScalePriceLadderUnavailableReason\n | RoutedOrderCapabilitiesUnavailableReason;\n\n/** Result of provider-routed Scale price normalization. */\nexport type PerpsScalePriceLadder =\n | Readonly<{\n status: 'ready';\n providerId: PerpsProviderType;\n prices: readonly string[];\n }>\n | Readonly<{\n status: 'unavailable';\n providerId?: PerpsProviderType;\n reason: ScalePriceLadderUnavailableReason;\n }>;\n\nexport type FeeCalculationParams = {\n // Trigger placements are charged as their execution kind (a stop_limit pays\n // limit-order fees when it fills, a stop_market pays taker fees).\n orderType: OrderType;\n isMaker?: boolean;\n amount?: string;\n symbol: string; // Required: Asset identifier for HIP-3 fee calculation (e.g., 'BTC', 'xyz:TSLA')\n // Optional provider override. Omission uses active/default routing.\n providerId?: PerpsProviderType;\n};\n\nexport type FeeCalculationResult = {\n // Total fees (protocol + MetaMask)\n feeRate?: number; // Total fee rate as decimal (e.g., 0.00145 for 0.145%), undefined when unavailable\n feeAmount?: number; // Total fee amount in USD (when amount is provided)\n\n // Protocol-specific base fees\n protocolFeeRate?: number; // Protocol fee rate (e.g., 0.00045 for HyperLiquid taker), undefined when unavailable\n protocolFeeAmount?: number; // Protocol fee amount in USD\n\n // MetaMask builder/revenue fee\n metamaskFeeRate?: number; // MetaMask fee rate (e.g., 0.001 for 0.1%), undefined when unavailable\n metamaskFeeAmount?: number; // MetaMask fee amount in USD\n\n // Optional detailed breakdown for transparency\n breakdown?: {\n baseFeeRate: number;\n volumeTier?: string;\n volumeDiscount?: number;\n stakingDiscount?: number;\n };\n\n /**\n * Read-only subscription fee-waiver preview, sourced from the same cached\n * benefits snapshot the fee resolver uses. Present only when the controller\n * has a subscription source wired; the quoted rates above are not adjusted\n * from it, so surfacing this never mutates the cap or the cache.\n */\n subscription?: PerpsSubscriptionFeeWaiverStatus;\n};\n\n/**\n * Usage state of the perps fee waiver on a subscription benefits snapshot.\n */\nexport type PerpsSubscriptionUsage = 'available' | 'exhausted';\n\n/**\n * Subscription benefits as returned by `GET /v1/profiles/{profileId}/benefits`.\n *\n * The perps controller never performs this request itself — the client owns the\n * Profile JWT and injects the read through\n * {@link PerpsPlatformDependencies.subscription}. Only the fields the perps fee\n * waiver depends on are modelled here.\n */\nexport type PerpsSubscriptionBenefits = {\n /** Subscription status; only `active` can pass the eligibility gate. */\n status: string;\n\n /** Perps fee waiver entitlement and its remaining allowance. */\n perpsFeeWaiver?: {\n /** Whether the plan entitles this profile to the perps fee waiver. */\n entitled: boolean;\n\n /** Backend usage state; only `available` can pass the eligibility gate. */\n usage?: PerpsSubscriptionUsage;\n\n /**\n * Set by the backend once the notional cap is crossed. Honored on the next\n * cache refresh — there is no client-held reservation to release.\n */\n exhausted?: boolean;\n\n /** Notional (USD) still covered by the waiver, for fee previews. */\n remainingNotionalUsd?: number;\n };\n};\n\n/**\n * Why the subscription fee waiver did or did not apply, plus the remaining\n * allowance for fee previews. Derived purely from the cached benefits snapshot.\n */\nexport type PerpsSubscriptionFeeWaiverStatus = {\n /** True only when every condition of the eligibility gate passed. */\n eligible: boolean;\n\n /**\n * Gate outcome:\n * - `eligible` — every condition passed\n * - `no-source` — no subscription dependency is wired\n * - `not-hydrated` — nothing cached yet; a refresh was kicked off\n * - `stale` — the cached snapshot is past the hard-stale ceiling\n * - `no-subscription` — the read succeeded but reported no subscription at\n * all (signed out, or no profile)\n * - `inactive` — subscription status is not `active`\n * - `not-entitled` — the plan does not include the perps fee waiver\n * - `exhausted` — the backend reported the notional cap as spent\n */\n reason:\n | 'eligible'\n | 'no-source'\n | 'not-hydrated'\n | 'stale'\n | 'no-subscription'\n | 'inactive'\n | 'not-entitled'\n | 'exhausted';\n\n /** Notional (USD) still covered by the waiver, when the backend reports it. */\n remainingNotionalUsd?: number;\n};\n\n/**\n * Fee source that won the unified resolver.\n *\n * `rewards` covers both VIP and season discounts: `RewardsController` already\n * returns the better of the two as a single discount, so the perps controller\n * treats them as one source rather than re-deriving the split.\n */\nexport type PerpsFeeSource = 'default' | 'rewards' | 'subscription';\n\n/**\n * Outcome of the unified fee resolver.\n */\nexport type PerpsFeeResolution = {\n /** Winning MetaMask builder fee, in basis points (lowest across sources). */\n feeBips: number;\n\n /**\n * Winning fee expressed as a discount off the default builder fee, in basis\n * points — the unit providers consume. `undefined` when no source resolved\n * (e.g. rewards state has not hydrated and no subscription waiver applies),\n * so callers do not treat it as a definitive \"no discount\" answer.\n */\n discountBips: number | undefined;\n\n /** Source that produced the winning fee. */\n source: PerpsFeeSource;\n\n /** Subscription gate outcome, always populated for observability. */\n subscription: PerpsSubscriptionFeeWaiverStatus;\n};\n\nexport type UpdatePositionTPSLParams = {\n symbol: string; // Asset identifier (e.g., 'BTC', 'ETH', 'xyz:TSLA')\n takeProfitPrice?: string; // Optional: undefined to remove\n stopLossPrice?: string; // Optional: undefined to remove\n // Partial TP/SL: quantity covered by the TP/SL order. Omit to cover the whole\n // position. When either size is provided the TP/SL orders are placed as\n // standalone reduce-only triggers, since a position-bound TP/SL cannot carry a\n // quantity.\n takeProfitSize?: string;\n stopLossSize?: string;\n // Optional tracking data for MetaMetrics events\n trackingData?: TPSLTrackingData;\n providerId?: PerpsProviderType; // Multi-provider: optional provider override for routing\n /**\n * Optional caller snapshot for diagnostics.\n *\n * The provider always resolves the position from the current DEX WebSocket\n * slice or an HTTP read. It never uses this snapshot for trigger size or side.\n * If neither authoritative source answers, the update fails with\n * `PROVIDER_NOT_AVAILABLE`.\n */\n position?: Position;\n};\n\nexport type Order = {\n orderId: string; // Order ID\n symbol: string; // Asset symbol (e.g., 'ETH', 'BTC')\n side: 'buy' | 'sell'; // Normalized order side\n orderType: OrderType; // Order type (market/limit)\n size: string; // Order size\n originalSize: string; // Original order size\n price: string; // Order price (for limit orders)\n filledSize: string; // Amount filled\n remainingSize: string; // Amount remaining\n status: 'open' | 'filled' | 'canceled' | 'rejected' | 'triggered' | 'queued'; // Normalized status\n timestamp: number; // Order timestamp\n lastUpdated?: number; // Last status update timestamp (optional - not provided by all APIs)\n // TODO: Consider creating separate type for OpenOrders (UI Orders) potentially if optional properties muddy up the original Order type\n takeProfitPrice?: string; // Take profit price (if set)\n stopLossPrice?: string; // Stop loss price (if set)\n stopLossOrderId?: string; // Stop loss order ID\n takeProfitOrderId?: string; // Take profit order ID\n detailedOrderType?: string; // Full order type from exchange (e.g., 'Take Profit Limit', 'Stop Market')\n isTrigger?: boolean; // Whether this is a trigger order (TP/SL)\n // Normalized trigger placement type, set for trigger orders only. `orderType`\n // above stays coarse (how the order executes) so existing consumers keep\n // their meaning; this field carries the full placement type.\n triggerOrderType?: TriggerOrderType;\n reduceOnly?: boolean; // Whether this is a reduce-only order\n isPositionTpsl?: boolean; // Whether this TP/SL is associated with the full position\n parentOrderId?: string; // Parent order ID for display-only synthetic TP/SL rows\n isSynthetic?: boolean; // Whether this order is synthetic (display-only, cancelable only when linked to a real child order ID)\n triggerPrice?: string; // Trigger condition price for trigger orders (e.g., TP/SL trigger level)\n strategyGroupId?: string; // Recoverable strategy handle shared by related venue orders\n providerId?: PerpsProviderType; // Multi-provider: which provider this order is on (injected by aggregator)\n};\n\nexport type Funding = {\n symbol: string; // Asset symbol (e.g., 'ETH', 'BTC')\n amountUsd: string; // Funding amount in USD (positive = received, negative = paid)\n rate?: string; // Funding rate applied (undefined when not available from provider)\n timestamp: number; // Funding payment timestamp\n transactionHash?: string; // Optional transaction hash\n};\n\nexport type PerpsProvider = {\n readonly protocolId: string;\n\n /** Whether this provider routes individual requests by `providerId`. */\n readonly routesOrdersByProviderId?: boolean;\n\n /**\n * Return strategy capabilities for the provider/market route. Providers may\n * omit this hook; the controller then reports capabilities as unavailable.\n */\n getOrderCapabilities?(\n params: GetOrderCapabilitiesParams,\n ): Promise<PerpsOrderCapabilities>;\n\n /**\n * Normalize a Scale ladder using the selected provider's venue rules.\n *\n * @param params - Market, ladder bounds, count, and optional provider route.\n * @returns Provider-normalized prices or a typed unavailable result.\n * @throws When the provider cannot normalize the requested ladder.\n */\n getScalePriceLadder?(\n params: GetScalePriceLadderParams,\n ): Promise<PerpsScalePriceLadder>;\n\n // Unified asset and route information\n getDepositRoutes(params?: GetSupportedPathsParams): AssetRoute[]; // Assets and their deposit routes\n getWithdrawalRoutes(params?: GetSupportedPathsParams): AssetRoute[]; // Assets and their withdrawal routes\n\n // Trading operations → Redux (persisted, optimistic updates)\n placeOrder(params: OrderParams): Promise<OrderResult>;\n editOrder(params: EditOrderParams): Promise<OrderResult>;\n cancelOrder(params: CancelOrderParams): Promise<CancelOrderResult>;\n cancelOrders?(params: BatchCancelOrdersParams): Promise<CancelOrdersResult>; // Optional: batch cancel for protocols that support it\n getTwapOrders?(): Promise<TwapOrder[]>;\n /**\n * Stream TWAP lifecycle updates. Optional: providers without a native TWAP\n * push channel omit it, and clients fall back to polling `getTwapOrders`.\n */\n subscribeToTwapOrders?(params: SubscribeTwapOrdersParams): () => void;\n getChaseOrders?(): Promise<ChaseOrder[]>;\n suspendChaseOrders?(): Promise<ChaseOrder[]>;\n closePosition(params: ClosePositionParams): Promise<OrderResult>;\n closePositions?(params: ClosePositionsParams): Promise<ClosePositionsResult>; // Optional: batch close for protocols that support it\n updatePositionTPSL(params: UpdatePositionTPSLParams): Promise<OrderResult>;\n updateMargin(params: UpdateMarginParams): Promise<MarginResult>;\n // Durable-settlement surfacing (optional: providers with durable local\n // settlement state — Lighter). Read-only listings plus selective,\n // explicit acknowledgment; never destructive read-all.\n getPendingManualRecoveries?(): Promise<PerpsPendingManualRecovery[]>;\n getRecoveredDispatches?(): Promise<PerpsRecoveredDispatch[]>;\n acknowledgeRecoveredDispatch?(recoveryId: string): Promise<void>;\n getPositions(params?: GetPositionsParams): Promise<Position[]>;\n getAccountState(params?: GetAccountStateParams): Promise<AccountState>;\n getUserDataSnapshot?(\n params: GetUserDataSnapshotParams,\n ): Promise<PerpsUserDataSnapshot>;\n getMarkets(params?: GetMarketsParams): Promise<MarketInfo[]>;\n getMarketDataWithPrices(): Promise<PerpsMarketData[]>;\n withdraw(params: WithdrawParams): Promise<WithdrawResult>; // API operation - stays in provider\n // Note: deposit() is handled by PerpsController routing (blockchain operation)\n validateDeposit(\n params: DepositParams,\n ): Promise<{ isValid: boolean; error?: string }>; // Protocol-specific deposit validation\n validateOrder(\n params: OrderParams,\n ): Promise<{ isValid: boolean; error?: string }>; // Protocol-specific order validation\n validateClosePosition(\n params: ClosePositionParams,\n ): Promise<{ isValid: boolean; error?: string }>; // Protocol-specific position close validation\n validateWithdrawal(\n params: WithdrawParams,\n ): Promise<{ isValid: boolean; error?: string }>; // Protocol-specific withdrawal validation\n\n // Historical data operations\n /**\n * Historical trade fills - actual executed trades with exact prices and fees.\n * Purpose: Track what actually happened when orders were executed.\n * Example: Market long 1 ETH @ $50,000 → OrderFill with exact execution price and fees\n */\n getOrderFills(\n params?: GetOrderFillsParams,\n options?: PerpsReadOptions,\n ): Promise<OrderFill[]>;\n\n /**\n * Get fills using WebSocket cache first, falling back to REST API.\n * OPTIMIZATION: Uses cached fills when available (0 API weight), only calls REST on cache miss.\n * Purpose: Prevent 429 errors during rapid market switching by reusing cached fills.\n *\n * @param params - Optional filter parameters (startTime, symbol)\n */\n getOrFetchFills(params?: GetOrFetchFillsParams): Promise<OrderFill[]>;\n\n /**\n * Get historical portfolio data\n * Purpose: Retrieve account value from previous periods for PnL tracking\n * Example: Get account value from yesterday to calculate 24h percentage change\n *\n * @param params - Optional parameters for historical portfolio retrieval\n */\n getHistoricalPortfolio(\n params?: GetHistoricalPortfolioParams,\n ): Promise<HistoricalPortfolioResult>;\n\n /**\n * Historical order lifecycle - order placement, modifications, and status changes.\n * Purpose: Track the complete journey of orders from request to completion.\n * Example: Limit buy 1 ETH @ $48,000 → Order with status 'open' → 'filled' when executed\n */\n getOrders(\n params?: GetOrdersParams,\n options?: PerpsReadOptions,\n ): Promise<Order[]>;\n\n /**\n * Currently active open orders (real-time status).\n * Purpose: Show orders that are currently open/pending execution (not historical states).\n * Different from getOrders() which returns complete historical order lifecycle.\n * Example: Shows only orders that are actually open right now in the exchange.\n */\n getOpenOrders(params?: GetOrdersParams): Promise<Order[]>;\n\n /**\n * Historical funding payments - periodic costs/rewards for holding positions.\n * Purpose: Track ongoing expenses and income from position maintenance.\n * Example: Holding long ETH position → Funding payment of -$5.00 (you pay the funding)\n */\n getFunding(\n params?: GetFundingParams,\n options?: PerpsReadOptions,\n ): Promise<Funding[]>;\n\n /**\n * Get user non-funding ledger updates (deposits, transfers, withdrawals)\n */\n getUserNonFundingLedgerUpdates(params?: {\n accountId?: string;\n startTime?: number;\n endTime?: number;\n }): Promise<RawLedgerUpdate[]>;\n\n /**\n * Resolve the provider's currently active account identifier.\n * Used by the REST coalesce layer so cached payloads are account-scoped\n * even when callers omit params.accountId (the common hook path) — prevents\n * one account's data from being served after an account switch within\n * the coalesce TTL window.\n */\n getCurrentAccountId(): Promise<CaipAccountId>;\n\n /**\n * Get user history (deposits, withdrawals, transfers)\n */\n getUserHistory(params?: {\n accountId?: CaipAccountId;\n startTime?: number;\n endTime?: number;\n }): Promise<UserHistoryItem[]>;\n\n // Protocol-specific calculations\n calculateLiquidationPrice(params: LiquidationPriceParams): Promise<string>;\n calculateMaintenanceMargin(params: MaintenanceMarginParams): Promise<number>;\n getMaxLeverage(\n asset: string,\n providerId?: PerpsProviderType,\n ): Promise<number>;\n calculateFees(params: FeeCalculationParams): Promise<FeeCalculationResult>;\n /**\n * Read-only projection of the position that would remain after the proposed\n * order. Isolated-margin venues apply selected leverage to the whole\n * resulting position and use the maintenance tier at liquidation notional.\n * Cross-margin returns `{ status: 'unsupported', reason: 'cross_margin' }`.\n */\n previewPositionModify(\n params: PositionModifyPreviewParams,\n ): Promise<PositionModifyPreviewResult>;\n\n // Live data subscriptions → Direct UI (NO Redux, maximum speed)\n subscribeToPrices(params: SubscribePricesParams): () => void;\n subscribeToPositions(params: SubscribePositionsParams): () => void;\n subscribeToOrderFills(params: SubscribeOrderFillsParams): () => void;\n subscribeToOrders(params: SubscribeOrdersParams): () => void;\n subscribeToAccount(params: SubscribeAccountParams): () => void;\n subscribeToOICaps(params: SubscribeOICapsParams): () => void;\n subscribeToCandles(params: SubscribeCandlesParams): () => void;\n subscribeToOrderBook(params: SubscribeOrderBookParams): () => void;\n\n // Live data configuration\n setLiveDataConfig(config: Partial<LiveDataConfig>): void;\n\n // Connection management\n toggleTestnet(): Promise<ToggleTestnetResult>;\n initialize(): Promise<InitializeResult>;\n isReadyToTrade(): Promise<ReadyToTradeResult>;\n disconnect(): Promise<DisconnectResult>;\n ping(timeoutMs?: number): Promise<void>; // Lightweight WebSocket health check with configurable timeout\n getWebSocketConnectionState?(): WebSocketConnectionState; // Optional: get current WebSocket connection state\n subscribeToConnectionState?(\n listener: (\n state: WebSocketConnectionState,\n reconnectionAttempt: number,\n ) => void,\n ): () => void; // Optional: subscribe to WebSocket connection state changes\n reconnect?(): Promise<void>; // Optional: manually trigger WebSocket reconnection\n\n // Block explorer\n getBlockExplorerUrl(address?: string): string;\n\n // Fee discount context (optional - for MetaMask reward discounts)\n setUserFeeDiscount?(discountBips: number | undefined): void;\n // Full fee resolution context, including attribution source.\n setUserFeeResolution?(resolution: PerpsFeeResolution | undefined): void;\n /** Approve the dedicated subscription builder outside order submission. */\n approveSubscriptionBuilderFee?(): Promise<boolean>;\n\n // HIP-3 (Builder-deployed DEXs) operations - optional for backward compatibility\n /**\n * Get list of available HIP-3 builder-deployed DEXs\n *\n * @param params - Optional parameters (reserved for future filters/pagination)\n * @returns Array of DEX names (empty string '' represents main DEX)\n */\n getAvailableDexs?(params?: GetAvailableDexsParams): Promise<string[]>;\n\n /**\n * Fetch historical OHLCV candle data for a symbol.\n * Optional: only providers that support historical candles need to implement this.\n */\n fetchHistoricalCandles?(options: {\n symbol: string;\n interval: CandlePeriod;\n limit?: number;\n endTime?: number;\n }): Promise<CandleData>;\n};\n\n// ============================================================================\n// Multi-Provider Aggregation Types (Phase 1)\n// ============================================================================\n\n/**\n * Provider identifier type for multi-provider support.\n * Add new providers here as they are implemented.\n */\nexport type PerpsProviderType = 'hyperliquid' | 'lighter';\n\n/**\n * Active provider mode for PerpsController state.\n * - Direct providers: 'hyperliquid', 'lighter'\n * - 'aggregated': Multi-provider aggregation mode\n */\nexport type PerpsActiveProviderMode = PerpsProviderType | 'aggregated';\n\n/**\n * Aggregation mode for read operations.\n * - 'all': Aggregate data from all registered providers\n * - 'active': Only aggregate from providers with active connections\n * - 'specific': Aggregate from a specific subset of providers\n */\nexport type AggregationMode = 'all' | 'active' | 'specific';\n\n/**\n * Routing strategy for write operations.\n * Phase 1 only supports 'default_provider' - advanced strategies deferred to Phase 3.\n */\nexport type RoutingStrategy = 'default_provider';\n\n/**\n * Configuration for AggregatedPerpsProvider\n */\nexport type AggregatedProviderConfig = {\n /** Map of provider ID to provider instance */\n providers: Map<PerpsProviderType, PerpsProvider>;\n /** Default provider for write operations when providerId not specified */\n defaultProvider: PerpsProviderType;\n /** Aggregation mode for read operations (default: 'all') */\n aggregationMode?: AggregationMode;\n /** Platform dependencies for logging, metrics, etc. */\n infrastructure: PerpsPlatformDependencies;\n};\n\n/**\n * Provider-specific error with context for multi-provider error handling\n */\nexport type ProviderError = {\n /** Which provider the error originated from */\n providerId: PerpsProviderType;\n /** Human-readable error message */\n message: string;\n /** Original error object if available */\n originalError?: Error;\n /** Whether the operation can be retried */\n isRetryable?: boolean;\n};\n\n/**\n * Aggregated account state combining data from multiple providers\n */\nexport type AggregatedAccountState = {\n /** Combined totals across all providers */\n total: AccountState;\n /** Per-provider breakdown */\n byProvider: Map<PerpsProviderType, AccountState>;\n};\n\n// ============================================================================\n// Injectable Dependency Interfaces\n// These interfaces enable dependency injection for platform-specific services,\n// allowing PerpsController to be moved to core without mobile-specific imports.\n// ============================================================================\n\n/**\n * Injectable logger interface for error reporting.\n * Allows core package to be platform-agnostic (mobile: Sentry, extension: different impl)\n */\nexport type PerpsLogger = {\n error(\n error: Error,\n options?: {\n tags?: Record<string, string | number>;\n context?: { name: string; data: Record<string, unknown> };\n extras?: Record<string, unknown>;\n },\n ): void;\n};\n\n/**\n * Analytics events specific to Perps feature.\n * These are the actual event names sent to analytics backend.\n * Values must match the corresponding MetaMetricsEvents values in mobile for compatibility.\n *\n * When migrating to core monorepo, this enum travels with PerpsController.\n */\nexport enum PerpsAnalyticsEvent {\n WithdrawalTransaction = 'Perp Withdrawal Transaction',\n TradeTransaction = 'Perp Trade Transaction',\n PositionCloseTransaction = 'Perp Position Close Transaction',\n OrderCancelTransaction = 'Perp Order Cancel Transaction',\n ScreenViewed = 'Perp Screen Viewed',\n UiInteraction = 'Perp UI Interaction',\n RiskManagement = 'Perp Risk Management',\n PerpsError = 'Perp Error',\n AccountSetup = 'Perp Account Setup',\n // New funnel + search events.\n // Names must match MetaMetrics/Mixpanel exactly; no other event names may be added.\n TransactionConsidered = 'Perp Transaction Considered',\n TradeQuoteReceived = 'Perp Trade Quote Received',\n SearchQuery = 'Perp Search Query',\n SearchResultTapped = 'Perp Search Result Tapped',\n SearchAbandoned = 'Perp Search Abandoned',\n}\n\n/**\n * UTM / discovery attribution context for Perps analytics.\n *\n * Held transiently in-memory by PerpsController (never persisted in state) and\n * merged into analytics event properties so client-originated UTM attribution\n * can be propagated onto core-emitted transaction events.\n */\nexport type PerpsAttributionContext = {\n utmSource?: string;\n utmMedium?: string;\n utmCampaign?: string;\n utmContent?: string;\n utmTerm?: string;\n};\n\n/**\n * Perps-specific trace names. These must match TraceName enum values in mobile.\n * When in core monorepo, this defines the valid trace names for Perps operations.\n */\nexport type PerpsTraceName =\n | 'Perps Open Position'\n | 'Perps Close Position'\n | 'Perps Deposit'\n | 'Perps Withdraw'\n | 'Perps Place Order'\n | 'Perps Edit Order'\n | 'Perps Cancel Order'\n | 'Perps Update TP/SL'\n | 'Perps Update Margin'\n | 'Perps Flip Position'\n | 'Perps Market Data Update'\n | 'Perps Order View'\n | 'Perps Tab View'\n | 'Perps Market List View'\n | 'Perps Position Details View'\n | 'Perps Adjust Margin View'\n | 'Perps Order Details View'\n | 'Perps Order Book View'\n | 'Perps Flip Position Sheet'\n | 'Perps Transactions View'\n | 'Perps Order Fills Fetch'\n | 'Perps Orders Fetch'\n | 'Perps Funding Fetch'\n | 'Perps Get Positions'\n | 'Perps Get Account State'\n | 'Perps Get Historical Portfolio'\n | 'Perps Get Markets'\n | 'Perps Get Market Data With Prices'\n | 'Perps Fetch Historical Candles'\n | 'Perps WebSocket Connected'\n | 'Perps WebSocket Disconnected'\n | 'Perps WebSocket First Positions'\n | 'Perps WebSocket First Orders'\n | 'Perps WebSocket First Account'\n | 'Perps Data Lake Report'\n | 'Perps Rewards API Call'\n | 'Perps Close Position View'\n | 'Perps Withdraw View'\n | 'Perps Connection Establishment'\n | 'Perps Account Switch Reconnection'\n | 'Perps Market Data Preload'\n | 'Perps User Data Preload';\n\n/**\n * Perps trace name constants. Values match TraceName enum in mobile.\n * When in core, these ARE the source of truth - mobile will re-export from core.\n */\nexport const PerpsTraceNames = {\n // Trading operations\n PlaceOrder: 'Perps Place Order',\n EditOrder: 'Perps Edit Order',\n CancelOrder: 'Perps Cancel Order',\n ClosePosition: 'Perps Close Position',\n UpdateTpsl: 'Perps Update TP/SL',\n UpdateMargin: 'Perps Update Margin',\n FlipPosition: 'Perps Flip Position',\n\n // Account operations\n Withdraw: 'Perps Withdraw',\n Deposit: 'Perps Deposit',\n\n // Market data\n GetPositions: 'Perps Get Positions',\n GetAccountState: 'Perps Get Account State',\n GetMarkets: 'Perps Get Markets',\n GetMarketDataWithPrices: 'Perps Get Market Data With Prices',\n OrderFillsFetch: 'Perps Order Fills Fetch',\n OrdersFetch: 'Perps Orders Fetch',\n FundingFetch: 'Perps Funding Fetch',\n GetHistoricalPortfolio: 'Perps Get Historical Portfolio',\n FetchHistoricalCandles: 'Perps Fetch Historical Candles',\n\n // Data lake\n DataLakeReport: 'Perps Data Lake Report',\n\n // WebSocket\n WebsocketConnected: 'Perps WebSocket Connected',\n WebsocketDisconnected: 'Perps WebSocket Disconnected',\n WebsocketFirstPositions: 'Perps WebSocket First Positions',\n WebsocketFirstOrders: 'Perps WebSocket First Orders',\n WebsocketFirstAccount: 'Perps WebSocket First Account',\n\n // Other\n RewardsApiCall: 'Perps Rewards API Call',\n ConnectionEstablishment: 'Perps Connection Establishment',\n AccountSwitchReconnection: 'Perps Account Switch Reconnection',\n MarketDataPreload: 'Perps Market Data Preload',\n UserDataPreload: 'Perps User Data Preload',\n} as const satisfies Record<string, PerpsTraceName>;\n\n/**\n * Perps trace operation constants. Values match TraceOperation enum in mobile.\n * These categorize traces by type of operation for Sentry/observability filtering.\n */\nexport const PerpsTraceOperations = {\n Operation: 'perps.operation',\n OrderSubmission: 'perps.order_submission',\n PositionManagement: 'perps.position_management',\n MarketData: 'perps.market_data',\n} as const;\n\n/**\n * Values allowed in trace data/tags. Matches Sentry's TraceValue type.\n */\nexport type PerpsTraceValue = string | number | boolean;\n\n/**\n * Properties allowed in analytics events. More constrained than unknown.\n * Named PerpsAnalyticsProperties to avoid conflict with PERPS_EVENT_PROPERTY\n * constant object from eventNames.ts (which contains property key names).\n */\nexport type PerpsAnalyticsProperties = Record<\n string,\n string | number | boolean | Record<string, string> | null | undefined\n>;\n\n/**\n * Injectable metrics interface for analytics.\n * Allows core package to work with different analytics backends.\n */\nexport type PerpsMetrics = {\n isEnabled(): boolean;\n\n /**\n * Track a Perps-specific analytics event with properties.\n * This abstracts away the MetricsEventBuilder pattern used in mobile.\n *\n * @param event - The Perps analytics event type (enum with actual event name values)\n * @param properties - Type-safe key-value properties to attach to the event\n */\n trackPerpsEvent(\n event: PerpsAnalyticsEvent,\n properties: PerpsAnalyticsProperties,\n ): void;\n};\n\n/**\n * Injectable debug logger for development logging.\n * Only logs in development mode.\n * Accepts `unknown` to allow logging error objects from catch blocks.\n */\nexport type PerpsDebugLogger = {\n log(...args: unknown[]): void;\n};\n\n/**\n * Injectable stream manager interface for pause/resume during critical operations.\n *\n * WHY THIS IS NEEDED:\n * PerpsStreamManager is a React-based mobile-specific singleton that:\n * - Uses React Context for subscription management\n * - Uses react-native-performance for tracing\n * - Directly accesses Engine.context (mobile singleton pattern)\n * - Manages WebSocket connections with throttling/caching\n *\n * PerpsController only needs pause/resume during critical operations (withStreamPause method)\n * to prevent stale UI updates during batch operations. The minimal interface allows:\n * - Mobile: Wrap existing singleton (streamManager[channel].pause())\n * - Extension: Implement with whatever streaming solution they use\n */\n/**\n * Injectable stream manager interface for pause/resume during critical operations.\n *\n * WHY THIS IS NEEDED:\n * PerpsStreamManager is a React-based mobile-specific singleton that:\n * - Uses React Context for subscription management\n * - Uses react-native-performance for tracing\n * - Directly accesses Engine.context (mobile singleton pattern)\n * - Manages WebSocket connections with throttling/caching\n *\n * PerpsController only needs pause/resume during critical operations (withStreamPause method)\n * to prevent stale UI updates during batch operations. The minimal interface allows:\n * - Mobile: Wrap existing singleton (streamManager[channel].pause())\n * - Extension: Implement with whatever streaming solution they use\n */\nexport type PerpsStreamManager = {\n pauseChannel(channel: string): void;\n resumeChannel(channel: string): void;\n clearAllChannels(): void;\n};\n\n/**\n * Injectable performance monitor interface.\n * Wraps react-native-performance or browser Performance API.\n */\nexport type PerpsPerformance = {\n now(): number;\n /**\n * Optional platform hook invoked once after constructor disk hydration.\n * Receives `performance.now()` — not a Sentry write.\n */\n onControllerConstructed?: (monotonicMs: number) => void;\n};\n\ntype PerpsSetMeasurement = ((\n name: string,\n value: number,\n unit: string,\n) => void) &\n ((name: string, value: number, unit: string, id: string) => void);\n\n/**\n * Injectable tracer interface for Sentry/observability tracing.\n * Services use this to create spans and measure operation durations.\n *\n * Note: trace() returns void because services use name/id pairs to identify traces.\n * The actual span management is handled internally by the platform adapter.\n */\nexport type PerpsTracer = {\n trace(params: {\n name: PerpsTraceName;\n id: string;\n op: string;\n tags?: Record<string, PerpsTraceValue>;\n data?: Record<string, PerpsTraceValue>;\n }): void;\n\n endTrace(params: {\n name: PerpsTraceName;\n id: string;\n data?: Record<string, PerpsTraceValue>;\n }): void;\n\n setMeasurement: PerpsSetMeasurement;\n\n addBreadcrumb(breadcrumb: {\n category: string;\n message: string;\n level: 'fatal' | 'error' | 'warning' | 'log' | 'info' | 'debug';\n data?: Record<string, unknown>;\n }): void;\n};\n\n// ============================================================================\n// Minimal local types for cross-controller DI (no external controller imports)\n// ============================================================================\n\n/**\n * Minimal typed-message params passed to keyring for EIP-712 signing.\n * Structurally matches KeyringController's TypedMessageParams.\n */\nexport type PerpsTypedMessageParams = {\n from: string;\n data: unknown;\n};\n\n/**\n * Minimal transaction params passed to TransactionController.addTransaction.\n * Only the fields PerpsController actually sets.\n */\nexport type PerpsTransactionParams = {\n from: string;\n to?: string;\n value?: string;\n data?: string;\n gas?: string;\n};\n\n/**\n * Options passed to TransactionController.addTransaction.\n */\nexport type PerpsAddTransactionOptions = {\n networkClientId: string;\n origin?: string;\n type?: string;\n skipInitialGasEstimate?: boolean;\n};\n\n/**\n * Minimal account shape read from AccountTreeController.\n * Only the fields PerpsController and its services actually use.\n */\nexport type PerpsInternalAccount = {\n address: string;\n type: string;\n id: string;\n};\n\n/**\n * Minimal remote feature flag state shape.\n * Only the remoteFeatureFlags record is needed by PerpsController.\n */\nexport type PerpsRemoteFeatureFlagState = {\n remoteFeatureFlags: Record<string, unknown>;\n};\n\n/**\n * Injectable interface for the Terminal-market service.\n *\n * `MarketDataService` programs against this contract so the concrete\n * `TerminalMarketService` class (which lives in `services/`) never leaks\n * into the types barrel — callers can supply any implementation that\n * satisfies the shape (production, stub, mock, etc.).\n */\nexport type PerpsTerminalMarketService = {\n fetchMarkets(): Promise<{\n markets: MarketInfo[];\n metadata: Map<string, TerminalAssetMetadata>;\n }>;\n clearCache(): void;\n logError(error: unknown, method: string): void;\n fetchGlobalSnapshot?(\n request: PerpsGlobalSnapshotRequest,\n ): Promise<PerpsGlobalSnapshotResult>;\n};\n\n/** Exact identity a client expects from an atomic global Perps snapshot. */\nexport type PerpsGlobalSnapshotRequest = {\n provider: 'hyperliquid';\n network: 'mainnet' | 'testnet';\n enabledDexes: string[];\n};\n\n/** Validated snapshot data and its source-bounded expiry. */\nexport type PerpsGlobalSnapshotResult = {\n markets: PerpsMarketData[];\n expiresAt: number;\n};\n\n/**\n * Platform dependencies for PerpsController and services.\n *\n * Architecture:\n * - Observability: logger, debugLogger, metrics, performance, tracer\n * - Platform: streamManager (mobile/extension specific)\n * - Cache: cache invalidation for standalone queries\n * - Rewards: delegated rewards interaction (DI — no RewardsController in Core yet)\n *\n * Cross-controller communication uses the messenger pattern (messenger.call).\n * Only rewards remains as DI because RewardsController is not yet in Core.\n */\nexport type PerpsPlatformDependencies = {\n // === Observability (stateless utilities) ===\n logger: PerpsLogger;\n debugLogger: PerpsDebugLogger;\n metrics: PerpsMetrics;\n performance: PerpsPerformance;\n tracer: PerpsTracer;\n\n // === Platform Services (mobile/extension specific) ===\n streamManager: PerpsStreamManager;\n\n // === Feature Flags (platform-specific version gating) ===\n featureFlags: {\n /**\n * Validate a version-gated feature flag against current app version.\n * Returns true if flag is enabled AND app meets minimum version,\n * false if flag is disabled, or undefined if flag is misconfigured/overridden.\n *\n * Platform-specific because it uses react-native-device-info (mobile)\n * or browser APIs (extension) to get the app version.\n */\n validateVersionGated(flag: VersionGatedFeatureFlag): boolean | undefined;\n };\n\n // === Market Data Formatting (platform-specific number formatting) ===\n marketDataFormatters: MarketDataFormatters;\n\n // === Cache Invalidation (for standalone query caches) ===\n cacheInvalidator: PerpsCacheInvalidator;\n\n // === Disk Cache (cold-start persistence) ===\n diskCache: {\n getItem(key: string): Promise<string | null>;\n getItemSync?(key: string): string | null;\n setItem(key: string, value: string): Promise<void>;\n removeItem(key: string): Promise<void>;\n };\n\n // === Terminal API (market metadata source) ===\n terminalApi?: {\n /** Full endpoint URL for the legacy perpetuals market-data endpoint. */\n marketDataUrl?: string;\n\n /** Full endpoint URL for the schema-v2 atomic global Perps snapshot. */\n globalSnapshotUrl?: string;\n };\n\n /** @deprecated Use `terminalApi.marketDataUrl`. */\n terminalApiUrl?: string;\n\n /**\n * Optional Terminal-market service instance for fetching structured market\n * metadata from the MetaMask Terminal API.\n *\n * When provided, `MarketDataService` uses this service to attempt the\n * Terminal API path before falling back to the provider.\n * Clients that do not use the Terminal API can omit this field.\n */\n terminalMarketService?: PerpsTerminalMarketService;\n\n // === Rewards (DI — no RewardsController in Core yet) ===\n rewards: {\n /**\n * Get fee discount for an account from the RewardsController.\n * Returns discount in basis points (e.g., 6500 = 65% discount), or null\n * when subscription state hasn't hydrated yet — callers should skip\n * caching null results and retry on the next fee calculation.\n *\n * Pass the perps MetaMask builder base fee in bips so the rewards\n * controller can convert an absolute VIP fee into a discount fraction.\n */\n getPerpsDiscountForAccount(\n caipAccountId: `${string}:${string}:${string}`,\n baseFeeBips: number,\n ): Promise<number | null>;\n };\n\n // === Subscription (DI — benefits endpoint is owned by the Subscription team) ===\n /**\n * Optional subscription source for the unified fee resolver.\n *\n * The client owns the Profile JWT, so it performs\n * `GET /v1/profiles/{profileId}/benefits` and hands the perps controller the\n * parsed body. The controller caches the result stale-while-revalidate and\n * never awaits this call on the order-signing path.\n *\n * Omit it entirely on clients that do not ship the subscription waiver; the\n * resolver then falls back to the rewards and default sources.\n */\n subscription?: {\n /**\n * Read the current profile's subscription benefits.\n * Resolve `null` when there is no subscription to report (signed out, no\n * profile). Rejections are tolerated: the resolver keeps the previous\n * snapshot and never grants the waiver from a failed read.\n */\n getPerpsBenefits(): Promise<PerpsSubscriptionBenefits | null>;\n };\n};\n\n/**\n * Cache types that can be invalidated.\n * Used by standalone query caches (e.g., usePerpsPositionForAsset).\n */\nexport type PerpsCacheType = 'positions' | 'accountState' | 'markets';\n\n/**\n * Parameters for invalidating a specific cache type.\n */\nexport type InvalidateCacheParams = {\n /** The type of cache to invalidate */\n cacheType: PerpsCacheType;\n};\n\n/**\n * Cache invalidation interface for standalone query caches.\n * Allows services to signal when data has changed without depending on\n * mobile-specific implementations.\n */\nexport type PerpsCacheInvalidator = {\n /**\n * Invalidate a specific cache type.\n * Notifies all subscribers that cached data is stale.\n */\n invalidate(params: InvalidateCacheParams): void;\n\n /**\n * Invalidate all cache types.\n */\n invalidateAll(): void;\n};\n\n// ============================================================================\n// Market Data Formatting\n// ============================================================================\n\n/**\n * Injectable formatters for market data transformation.\n * Decouples marketDataTransform from mobile-specific intl/formatUtils imports.\n *\n * Range configs are opaque (unknown[]) because the concrete type\n * (FiatRangeConfig on mobile) is platform-specific. The formatter\n * implementation casts internally.\n */\nexport type MarketDataFormatters = {\n /** Format a number as a USD volume string (e.g., '$1.2B', '$850M') */\n formatVolume(value: number): string;\n /** Format a number as a USD fiat string with adaptive precision */\n formatPerpsFiat(value: number, options?: { ranges?: unknown[] }): string;\n /** Format a number as a percentage string (e.g., '2.50%', '-1.80%') */\n formatPercentage(percent: number): string;\n /** Universal price ranges for formatting (opaque to portable code) */\n priceRangesUniversal: unknown[];\n};\n\n// ============================================================================\n// Payment Token (portable replacement for mobile-only AssetType)\n// ============================================================================\n\n/**\n * Minimal payment token for deposit flow.\n * Only the fields actually used by PerpsController are included.\n * Replaces the mobile-only AssetType (which extends TokenI and uses ImageSourcePropType).\n */\nexport type PaymentToken = {\n description?: string;\n address: string;\n chainId?: string;\n symbol?: string;\n};\n\n/**\n * Selected pay-with token shape used in PerpsController state, pending trade config,\n * selectors, and UI hooks. Use this type everywhere this shape is needed.\n */\nexport type PerpsSelectedPaymentToken = {\n description?: string;\n address: string;\n chainId: string;\n symbol?: string;\n};\n\n// ============================================================================\n// Version-gated Feature Flag (portable)\n// ============================================================================\n\n/**\n * Structure for a version-gated feature flag from LaunchDarkly.\n * Portable: no platform-specific imports.\n */\nexport type VersionGatedFeatureFlag = {\n enabled: boolean;\n minimumVersion: string;\n};\n\n/**\n * Type guard for VersionGatedFeatureFlag.\n * Pure logic, no platform dependencies.\n *\n * @param value - The value to check.\n * @returns True if the value is a VersionGatedFeatureFlag.\n */\nexport function isVersionGatedFeatureFlag(\n value: unknown,\n): value is VersionGatedFeatureFlag {\n return (\n typeof value === 'object' &&\n value !== null &&\n hasProperty(value, 'enabled') &&\n hasProperty(value, 'minimumVersion') &&\n typeof (value as { enabled: unknown }).enabled === 'boolean' &&\n typeof (value as { minimumVersion: unknown }).minimumVersion === 'string'\n );\n}\n\n// ============================================================================\n// Sub-module type re-exports\n// These types live in separate files within types/ and need to be accessible\n// from the root barrel via `export * from './types.js'`.\n// ============================================================================\nexport type * from './perps-types.js';\nexport * from './transactionTypes.js';\n// hyperliquid-types: selective export to avoid OrderType clash with main types\nexport type {\n AssetPosition,\n SpotBalance,\n PerpsUniverse,\n PerpsAssetCtx,\n PredictedFunding,\n FrontendOrder,\n SDKOrderParams,\n ClearinghouseStateResponse,\n SpotClearinghouseStateResponse,\n MetaResponse,\n FrontendOpenOrdersResponse,\n AllMidsResponse,\n MetaAndAssetCtxsResponse,\n PredictedFundingsResponse,\n SpotMetaResponse,\n} from './hyperliquid-types.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAoB9C;;;;GAIG;AACH,MAAM,CAAN,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC,yDAA6B,CAAA;IAC7B,qDAAyB,CAAA;IACzB,mDAAuB,CAAA;IACvB,2DAA+B,CAAA;AACjC,CAAC,EALW,wBAAwB,KAAxB,wBAAwB,QAKnC;AAuDD,gEAAgE;AAChE,MAAM,CAAN,IAAY,cASX;AATD,WAAY,cAAc;IACxB,2CAAyB,CAAA;IACzB,iCAAe,CAAA;IACf,oCAAkB,CAAA;IAClB,iCAAe,CAAA;IACf,6BAAW,CAAA;IACX,yCAAuB,CAAA;IACvB,iCAAe,CAAA;IACf,uCAAqB,CAAA;AACvB,CAAC,EATW,cAAc,KAAd,cAAc,QASzB;AAmCD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,QAAQ;IACR,UAAU;IACV,OAAO;IACP,SAAS;IACT,OAAO;IACP,KAAK;IACL,WAAW;IACX,OAAO;CAC8B,CAAC;AAigExC;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,mBAiBX;AAjBD,WAAY,mBAAmB;IAC7B,4EAAqD,CAAA;IACrD,kEAA2C,CAAA;IAC3C,mFAA4D,CAAA;IAC5D,+EAAwD,CAAA;IACxD,0DAAmC,CAAA;IACnC,4DAAqC,CAAA;IACrC,8DAAuC,CAAA;IACvC,gDAAyB,CAAA;IACzB,0DAAmC,CAAA;IACnC,8BAA8B;IAC9B,oFAAoF;IACpF,4EAAqD,CAAA;IACrD,uEAAgD,CAAA;IAChD,wDAAiC,CAAA;IACjC,uEA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AM,UAAU,yBAAyB,CACvC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC;QAC7B,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC;QACpC,OAAQ,KAA8B,CAAC,OAAO,KAAK,SAAS;QAC5D,OAAQ,KAAqC,CAAC,cAAc,KAAK,QAAQ,CAC1E,CAAC;AACJ,CAAC;AAQD,cAAc,uBAAuB,CAAC","sourcesContent":["import { hasProperty } from '@metamask/utils';\nimport type {\n CaipAccountId,\n CaipChainId,\n CaipAssetId,\n Hex,\n} from '@metamask/utils';\n\nimport type { CandlePeriod, TimeDuration } from '../constants/chartConfig.js';\nimport type { CHASE_ORDER_STATUS } from '../constants/perpsConfig.js';\nimport type { LighterSignerBridge } from './lighter-types.js';\nimport type {\n CandleData,\n OrderType,\n StrategyOrderType,\n TpslLinkage,\n TriggerDirection,\n TriggerOrderType,\n} from './perps-types.js';\n\n/**\n * Connection states for WebSocket management.\n * Defined inline to avoid importing from Mobile-only services.\n * Must stay in sync with HyperLiquidClientService.WebSocketConnectionState.\n */\nexport enum WebSocketConnectionState {\n Disconnected = 'disconnected',\n Connecting = 'connecting',\n Connected = 'connected',\n Disconnecting = 'disconnecting',\n}\n\n/** Provider-agnostic raw ledger update. Fields match the common shape across providers. */\nexport type RawLedgerUpdate = {\n hash: string;\n time: number;\n delta: {\n type: string;\n usdc?: string;\n coin?: string;\n };\n};\n\n// User history item for deposits and withdrawals\nexport type UserHistoryItem = {\n id: string;\n timestamp: number;\n type: 'deposit' | 'withdrawal';\n amount: string;\n asset: string;\n txHash: string;\n status: 'completed' | 'failed' | 'pending';\n details: {\n source: string;\n bridgeContract?: string;\n recipient?: string;\n blockNumber?: string;\n chainId?: string;\n synthetic?: boolean;\n };\n};\n\n// Parameters for getting user history\nexport type GetUserHistoryParams = {\n startTime?: number;\n endTime?: number;\n accountId?: CaipAccountId;\n};\n\n// Trade configuration saved per market per network\nexport type TradeConfiguration = {\n leverage?: number; // Last used leverage for this market\n // Pending trade configuration (temporary, expires after 30 seconds)\n pendingConfig?: {\n amount?: string; // Order size in USD\n leverage?: number; // Leverage\n takeProfitPrice?: string; // Take profit price\n stopLossPrice?: string; // Stop loss price\n limitPrice?: string; // Limit price (for limit orders)\n orderType?: OrderType; // Market vs limit\n reduceOnly?: boolean; // Whether the order may only reduce a position\n timestamp: number; // When the config was saved (for expiration check)\n };\n};\n\n// Market asset type classification (reusable across components)\nexport enum MarketCategory {\n CryptoCurrency = 'crypto',\n Stock = 'stock',\n PreIpo = 'pre-ipo',\n Index = 'index',\n Etf = 'etf',\n Commodity = 'commodity',\n Forex = 'forex',\n Memecoin = 'memecoin',\n}\n\nexport type MarketType = `${MarketCategory}`;\n\n/**\n * Metadata extracted from Terminal API for a single asset.\n * Used downstream to enrich PerpsMarketData with name, keywords, tags, etc.\n */\nexport type TerminalAssetMetadata = {\n name?: string;\n description?: string;\n keywords?: string[];\n tags?: string[];\n categories?: string[];\n marketType?: MarketType;\n /**\n * Epoch ms when this market was listed on the Terminal backend.\n * Normalized from the raw API value (number or ISO string).\n */\n listedAt?: number;\n};\n\n// Market type filter for UI category badges\nexport type MarketTypeFilter =\n | 'all'\n | 'crypto'\n | 'memecoin'\n | 'stock'\n | 'pre-ipo'\n | 'index'\n | 'etf'\n | 'commodity'\n | 'forex'\n | 'new';\n\n/**\n * Ordered list of data-model market categories for UI pills.\n * Does not include the 'all' or 'new' sentinel values — those are applied\n * via dedicated UI controls, not the category pills.\n *\n * Note: 'memecoin' is a derived category (marketType === 'crypto' &&\n * tags.includes('memecoin')). It overlaps with 'crypto' by design —\n * memecoins appear under both pills.\n *\n * Kept in sync with {@link MarketTypeFilter} via `satisfies`.\n */\nexport const MARKET_CATEGORIES = [\n 'crypto',\n 'memecoin',\n 'stock',\n 'pre-ipo',\n 'index',\n 'etf',\n 'commodity',\n 'forex',\n] as const satisfies MarketTypeFilter[];\n\n// Input method for amount entry tracking\nexport type InputMethod =\n | 'default'\n | 'slider'\n | 'keypad'\n | 'percentage'\n | 'max';\n\n// Trade action type - differentiates first trade on a market, adding to an\n// existing position, and flipping a position's direction\nexport type TradeAction =\n | 'create_position'\n | 'increase_exposure'\n | 'flip_long_to_short'\n | 'flip_short_to_long';\n\n// Unified tracking data interface for analytics events (never persisted in state)\n// Note: Numeric values are already parsed by hooks (usePerpsOrderFees, etc.) from API responses\nexport type TrackingData = {\n // Common to all operations\n totalFee: number; // Total fee for the operation (parsed by hooks)\n marketPrice: number; // Market price at operation time (parsed by hooks)\n metamaskFee?: number; // MetaMask fee amount (parsed by hooks)\n metamaskFeeRate?: number; // MetaMask fee rate (parsed by hooks)\n feeDiscountPercentage?: number; // Fee discount percentage (parsed by hooks)\n estimatedPoints?: number; // Estimated reward points (parsed by hooks)\n\n // Order-specific (used for trade operations)\n marginUsed?: number; // Margin required for this order (calculated by hooks)\n inputMethod?: InputMethod; // How user set the amount\n tradeAction?: TradeAction; // 'create_position' for first trade, 'increase_exposure' for adding to existing\n\n // Close-specific (used for position close operations)\n receivedAmount?: number; // Amount user receives after close (calculated by hooks)\n realizedPnl?: number; // Realized P&L from close (calculated by hooks)\n\n // Entry source for analytics (e.g., 'trending' for Trending page discovery)\n source?: string;\n // Chart library active when the trade was initiated (e.g., lightweight, advanced)\n chartLibrary?: string;\n\n // Entry point / discovery attribution. Propagated onto trade/close/\n // cancel/risk events as entry_point, discovery_source, perp_discovery_source.\n entryPoint?: string;\n discoverySource?: string;\n perpDiscoverySource?: string;\n\n // HyperLiquid protocol fee rate. Emitted as hl_fee_rate on trade +\n // close events when present; omitted entirely when unavailable.\n hlFeeRate?: number;\n\n // Pay with any token: true when user paid with a custom token (not Perps balance)\n tradeWithToken?: boolean;\n mmPayTokenSelected?: string; // Token symbol when tradeWithToken is true\n mmPayNetworkSelected?: string; // chainId when tradeWithToken is true\n\n // VIP tier and discount for rewards tracking\n vipTier?: number; // User's VIP tier level\n vipDiscount?: number; // VIP discount percentage applied\n\n // A/B test context to attribute trade events to specific experiments\n abTests?: Record<string, string>;\n};\n\n// TP/SL-specific tracking data for analytics events\nexport type TPSLTrackingData = {\n direction: 'long' | 'short'; // Position direction\n /**\n * @deprecated Source of the TP/SL update (e.g., 'tp_sl_view', 'position_card').\n * Prefer `entryPoint` / `discoverySource` / `perpDiscoverySource` for risk-event\n * attribution; `source` is retained for backward compatibility.\n */\n source: string;\n positionSize: number; // Unsigned position size for metrics\n takeProfitPercentage?: number; // Take profit percentage from entry\n stopLossPercentage?: number; // Stop loss percentage from entry\n isEditingExistingPosition?: boolean; // true = editing existing position, false = creating for new order\n entryPrice?: number; // Entry price for percentage calculations\n\n // Entry point / discovery attribution, propagated onto risk events.\n entryPoint?: string;\n discoverySource?: string;\n perpDiscoverySource?: string;\n};\n\n/** Collateral mode requested for a new order. */\nexport type MarginMode = 'isolated' | 'cross';\n\n// MetaMask Perps API order parameters for PerpsController\nexport type OrderParams = {\n symbol: string; // Asset identifier (e.g., 'ETH', 'BTC', 'xyz:TSLA')\n isBuy: boolean; // true = BUY order, false = SELL order\n size: string; // Order size as string (derived for validation, provider recalculates from usdAmount)\n orderType: OrderType; // Order type\n price?: string; // Limit price (required for limit orders)\n reduceOnly?: boolean; // Reduce-only flag\n isFullClose?: boolean; // Indicates closing 100% of position (skips $10 minimum validation)\n timeInForce?: 'GTC' | 'IOC' | 'ALO'; // Time in force for plain limit orders\n\n // USD as source of truth (hybrid approach)\n usdAmount?: string; // USD amount (primary source of truth, provider calculates size from this)\n priceAtCalculation?: number; // Price snapshot when size was calculated (for slippage validation)\n maxSlippageBps?: number; // Slippage tolerance in basis points (e.g., 100 = 1%, default if not provided)\n /**\n * @deprecated Use `maxSlippageBps` instead. Retained for one release so that\n * existing publisher consumers (extension, core) that still pass slippage as\n * a decimal (e.g. 0.03 for 3%) continue to work; the provider normalizes the\n * value to basis points when `maxSlippageBps` is absent.\n */\n slippage?: number;\n\n // Trigger placement (stop_market, stop_limit, take_profit_market, take_profit_limit).\n // Required for those order types and rejected for market/limit orders.\n triggerPrice?: string; // Price at which the resting order activates\n\n // Strategy placement (twap, scale, chase). Each group below is required for\n // its own order type and rejected on every other one, so a stray field can\n // never be silently dropped. Strategy orders carry no `price`, `triggerPrice`,\n // `timeInForce` or attached TP/SL — the strategy owns its own execution.\n twapDuration?: number; // TWAP window in whole minutes; each provider enforces its own venue's bounds\n twapRandomize?: boolean; // Randomize each TWAP suborder's size by up to ±20% (default false)\n scaleMinPrice?: string; // Lowest limit price in the scale ladder\n scaleMaxPrice?: string; // Highest limit price in the scale ladder; must exceed scaleMinPrice\n scaleNumOrders?: number; // How many limit orders to spread across the ladder (2..20)\n /**\n * How the ladder's size is weighted across its rungs. Rung weights ramp\n * linearly from 1 at `scaleMinPrice` to this value at `scaleMaxPrice`, in that\n * direction for both sides — a short does not flip it. Above 1 puts more size\n * at `scaleMaxPrice`, below 1 at `scaleMinPrice`. Omitted or exactly 1 spreads\n * the size evenly. Any finite value above 0 is accepted as given; see\n * `splitScaleSizes` for how the sizes are allocated.\n */\n scaleSkew?: number;\n chaseIntervalMs?: number; // How often the chase re-reads the touch (default 15000, min 1000)\n chaseMaxDurationMs?: number; // Optional hard stop for the chase window (unbounded by default)\n chaseMaxRepricings?: number; // Optional cap on cancel/replace cycles (unbounded by default)\n chaseMaxDistanceBps?: number; // Optional directional distance from arrival price where chasing stops\n\n // Advanced order features\n takeProfitPrice?: string; // Take profit price\n stopLossPrice?: string; // Stop loss price\n // Partial TP/SL: size of the attached TP/SL order. Omit for a TP/SL covering\n // the full order size. Must be positive and no greater than `size`.\n takeProfitSize?: string; // Quantity covered by the attached take profit\n stopLossSize?: string; // Quantity covered by the attached stop loss\n clientOrderId?: string; // Optional client-provided order ID\n /**\n * How an attached TP/SL is linked: to this order (`order`), to the resulting\n * position (`position`), or absent (`none`). Defaults to `none` without TP/SL\n * and `order` with TP/SL. Takes precedence over the deprecated `grouping`.\n */\n tpslLinkage?: TpslLinkage;\n /**\n * @deprecated Use `tpslLinkage`. This field carries HyperLiquid's own grouping\n * vocabulary; it is honoured for existing callers but a provider-agnostic\n * placement should not depend on protocol wording.\n */\n grouping?: 'na' | 'normalTpsl' | 'positionTpsl'; // Override grouping (defaults: 'na' without TP/SL, 'normalTpsl' with TP/SL)\n currentPrice?: number; // Current market price (avoids extra API call if provided)\n leverage?: number; // Leverage to apply for the order (e.g., 10 for 10x leverage)\n /**\n * Explicit collateral mode. Requires leverage. HyperLiquid validates market\n * support and refuses mode changes with an open position or resting order.\n * Omit to retain the existing isolated-leverage behavior.\n */\n marginMode?: MarginMode;\n existingPositionLeverage?: number; // Existing position leverage for validation (protocol constraint)\n\n // Optional tracking data for MetaMetrics events\n trackingData?: TrackingData;\n\n // Multi-provider routing (optional: defaults to active/default provider).\n providerId?: PerpsProviderType;\n};\n\nexport type ScaleOrderChild =\n | {\n state: 'resting' | 'filled';\n orderId: string;\n }\n | {\n state: 'waitingForFill' | 'waitingForTrigger';\n orderId?: never;\n };\n\nexport type OrderResult = {\n success?: boolean;\n /**\n * What names the placement afterwards.\n *\n * For an ordinary placement this is the exchange's order ID. For a *strategy*\n * placement it is a handle instead — a venue TWAP id, or a client-generated\n * scale-group or chase-session id — which is what `CancelOrderParams` takes\n * together with the matching `orderType` and `providerId`. Scale and chase\n * handles are held in the provider session that created them. Scale handles\n * are also encoded in each rung's venue client-order ID, so an open-order\n * read can recover the group after reconnect. Chase handles cannot be\n * recovered because every replacement receives a new exchange order ID.\n * The individual exchange IDs a strategy expanded into are in\n * `childOrderIds`.\n */\n orderId?: string;\n error?: string;\n filledSize?: string; // Amount filled\n // Full normalized size submitted to the exchange (post precision rounding,\n // USD recalculation, and any $10-minimum retry). Present only when the\n // provider reached submission.\n submittedSize?: string;\n // Normalized size of the submitted rungs that the exchange accepted. This\n // differs from `submittedSize` when a non-atomic Scale batch is partly\n // rejected.\n acceptedSize?: string;\n // Size-weighted average execution price. Present only when the result\n // includes fills.\n averagePrice?: string;\n // Size-weighted limit price of accepted Scale rungs. This is a submission\n // price, not an execution price.\n weightedAverageLimitPrice?: string;\n // Every accepted child of a Scale batch and its immediate placement state.\n // Waiting children do not carry an exchange order ID; cancel the Scale handle\n // to cancel both resting and waiting children.\n acceptedChildren?: ScaleOrderChild[];\n // Exchange IDs tied to a multi-order or recovery result. On a successful\n // strategy placement, `orderId` carries the strategy handle and these IDs\n // identify its individual children.\n //\n // For a `scale` ladder these identify only resting, cancellable rungs. Every\n // accepted rung and its state is reported in `acceptedChildren`. Scale rungs\n // are never replaced, so a resting ID stays valid after the handle is gone.\n // For a `chase` this is only the order resting at placement time — the\n // strategy cancels and re-places as the touch moves, and each replacement has\n // a new ID that is held in the session rather than reported here, so the value\n // goes stale on the first re-price. Cancel a live chase by its handle.\n //\n // When TP/SL protection cannot be fully restored, these identify the old\n // orders that survived, may still be live when reconciliation failed, or were\n // recreated; an empty array means none are known or potentially live.\n childOrderIds?: string[];\n providerId?: PerpsProviderType; // Multi-provider: which provider executed this order (injected by aggregator)\n /**\n * Structured record of venue state that was ALREADY committed before the\n * placement failed — e.g. a leverage change that landed before the order\n * was rejected. Present only on failure results where such state exists;\n * callers must not treat the failure as \"nothing happened\".\n */\n partialState?: {\n /** Leverage (in x) the venue already applied for this symbol. */\n leverageUpdated?: number;\n };\n};\n\n/**\n * A TP/SL protection change that could not be safely completed\n * automatically and requires an explicit new protection intent from the\n * user. Surfaced by providers with durable settlement state (Lighter).\n */\nexport type PerpsPendingManualRecovery = {\n symbol: string;\n /** Durable identity (address:accountIndex:apiKey:symbol). */\n settlementKey: string;\n recordedAt: number;\n /** Human-readable cause of the parked state. */\n reason: string;\n /** Whether the interrupted operation replaced or removed protection. */\n priorIntent: 'replace' | 'remove';\n /** Venue order ids still on the books when the state was parked. */\n survivingOrderIds: string[];\n /** What the user should do to resolve the state. */\n actionNeeded: string;\n};\n\n/**\n * A previously ambiguous dispatch whose outcome was later resolved.\n * Writes stay blocked until each outcome is explicitly acknowledged via\n * `acknowledgeRecoveredDispatch` (after the caller refreshes venue\n * state) — except `failed`, which is retry-safe and non-blocking.\n */\nexport type PerpsRecoveredDispatch = {\n /** Stable id for selective acknowledgment. */\n recoveryId: string;\n /** Venue transaction type of the dispatch. */\n kind: number;\n /** Human-readable operation intent. */\n intent: string;\n txHash: string | null;\n outcome: 'succeeded' | 'failed' | 'unknown';\n /** How the outcome was determined (e.g. `tx-status:2`, `rest-advance`). */\n evidence: string;\n};\n\nexport type ChaseOrderStatus =\n (typeof CHASE_ORDER_STATUS)[keyof typeof CHASE_ORDER_STATUS];\n\nexport type TwapOrderStatus =\n | 'active'\n | 'completed'\n | 'completed_underfilled'\n | 'canceled'\n | 'failed';\n\nexport type TwapOrderFill = {\n fillId: string;\n orderId: string;\n side: 'buy' | 'sell';\n price: string;\n size: string;\n fee: string;\n feeToken: string;\n builderFee?: string;\n timestamp: number;\n transactionHash: string;\n};\n\n/** Current and terminal state of one venue-native TWAP schedule. */\nexport type TwapOrder = {\n orderId: string;\n symbol: string;\n side: 'buy' | 'sell';\n size: string;\n executedSize: string;\n remainingSize: string;\n executedNotional: string;\n averagePrice?: string;\n fillProgressBps: number;\n timeProgressBps: number;\n elapsedTimeMilliseconds: number;\n durationMinutes: number;\n randomize: boolean;\n reduceOnly: boolean;\n status: TwapOrderStatus;\n startedAt: number;\n lastUpdated: number;\n error?: string;\n fills: TwapOrderFill[];\n providerId?: PerpsProviderType;\n};\n\n/**\n * Client-visible state of one emulated Chase placement.\n *\n * The handle remains stable while the exchange child ID and resting price can\n * change on every reprice. Terminal sessions are retained until provider\n * teardown so clients can observe why chasing stopped and then reconcile the\n * surviving child through the ordinary orders stream.\n */\nexport type ChaseOrder = {\n handle: string;\n symbol: string;\n side: 'buy' | 'sell';\n originalSize: string;\n remainingSize: string;\n arrivalPrice: string;\n restingPrice: string;\n restingOrderId: string | null;\n /** Adverse distance of the resting child from arrival, rounded to whole bps. */\n distanceChasedBps: number;\n /**\n * Optional adverse-touch stop, strictly between 0 and 10,000 bps.\n * The resting child may sit just inside this boundary after price-grid rounding.\n */\n maxDistanceBps?: number;\n repricings: number;\n startedAt: number;\n status: ChaseOrderStatus;\n providerId?: PerpsProviderType;\n};\n\n/** Lifecycle signal emitted when a Chase reaches its configured distance. */\nexport type ChaseOrderMaxDistanceReached = {\n handle: string;\n symbol: string;\n side: 'buy' | 'sell';\n restingOrderId: string | null;\n restingPrice: string;\n maxDistanceBps: number;\n timestamp: number;\n providerId: PerpsProviderType;\n};\n\nexport type Position = {\n symbol: string; // Asset identifier (e.g., 'ETH', 'BTC', 'xyz:TSLA')\n size: string; // Signed position size (+ = LONG, - = SHORT)\n entryPrice: string; // Average entry price\n positionValue: string; // Total position value in USD\n unrealizedPnl: string; // Unrealized profit/loss\n marginUsed: string; // Margin currently used for this position\n leverage: {\n type: 'isolated' | 'cross'; // Margin type\n value: number; // Leverage multiplier\n rawUsd?: string; // USD amount (for isolated margin)\n };\n liquidationPrice: string | null; // Liquidation price (null if no risk)\n maxLeverage: number; // Maximum allowed leverage for this asset\n returnOnEquity: string; // ROE percentage\n cumulativeFunding: {\n // Funding payments history\n allTime: string; // Total funding since account opening\n sinceOpen: string; // Funding since position opened\n sinceChange: string; // Funding since last size change\n };\n /**\n * Take profit price (if set).\n *\n * Summary field, resolved for the common case a client renders: when\n * `takeProfitOrders` holds exactly one order this is that order's trigger\n * price, whether or not it covers the whole position. With two or more orders\n * no single price describes them, so this falls back to the position-bound\n * trigger — clients render `takeProfitCount` there instead.\n *\n * It may also reflect a TP/SL child of a *pending* order on this market, which\n * `takeProfitOrders` and `takeProfitCount` deliberately exclude because such a\n * child protects that order rather than the position. A position can therefore\n * report a price here with an empty array and a count of `0`. Prefer\n * `takeProfitOrders` for anything that must be exact.\n */\n takeProfitPrice?: string;\n /**\n * Stop loss price (if set). Same caveat as `takeProfitPrice`.\n */\n stopLossPrice?: string;\n takeProfitCount: number; // Take profit count, how many tps can affect the position\n stopLossCount: number; // Stop loss count, how many sls can affect the position\n // Full view of the trigger orders attached to this position, including\n // quantity-scoped (partial) ones. The scalar `takeProfitPrice`/`stopLossPrice`\n // fields above only carry one price each and cannot represent partial TP/SL.\n takeProfitOrders?: PositionTriggerOrder[];\n stopLossOrders?: PositionTriggerOrder[];\n providerId?: PerpsProviderType; // Multi-provider: which provider holds this position (injected by aggregator)\n};\n\n/**\n * A trigger order attached to a position, as surfaced in position state.\n * Provider-agnostic: protocols map their own trigger representation onto this.\n */\nexport type PositionTriggerOrder = {\n orderId: string; // Exchange order ID (cancelable)\n direction: TriggerDirection; // Whether the trigger takes profit or stops loss. Always known: recovered from the trigger price against the entry when the exchange does not name the placement type\n orderType?: TriggerOrderType; // Normalized placement type. Absent when the exchange reported an unnamed trigger, whose execution mode cannot be recovered\n triggerPrice: string; // Price at which the order activates\n size: string; // Quantity this trigger closes (resolved to position size when the protocol encodes \"whole position\")\n isPartial: boolean; // true when `size` is smaller than the position size\n reduceOnly: boolean; // Whether the trigger can only reduce the position\n};\n\n// Using 'type' instead of 'interface' for BaseController Json compatibility\nexport type AccountState = {\n /**\n * Total USD equity on this venue — collateral + unrealized PnL. Live MTM.\n * HL: crossMarginSummary.accountValue + spot(USDC) − spot.hold\n */\n totalBalance: string;\n /**\n * Max USD that can immediately collateralize a new position on this venue,\n * with no internal transfer required.\n * HL Unified: withdrawable + freeSpotUSDC\n * HL Standard: withdrawable\n */\n spendableBalance: string;\n /**\n * Max USD that can leave this venue to the user's external wallet.\n * UI reads this value without branching on provider; the provider\n * contract guarantees HL's own abstraction (Unified) or the direct\n * perps-clearinghouse (Standard) is what actually settles the\n * withdraw — no client-side spot→perps sweep is performed.\n * HL Unified: withdrawable + freeSpotUSDC (USDC only; `freeSpotUSDC = spot.total - spot.hold`, and HL withdraw3 draws from the unified ledger server-side)\n * HL Standard: withdrawable (perps-clearinghouse only; spot is a separate ledger)\n */\n withdrawableBalance: string;\n marginUsed: string;\n unrealizedPnl: string;\n returnOnEquity: string;\n /**\n * Per-sub-account balance breakdown (protocol-specific, optional)\n * Maps sub-account identifier to its balance details.\n *\n * Protocol examples:\n * - HyperLiquid HIP-3: '' or 'main' (main DEX), 'xyz' (HIP-3 builder DEX)\n * - dYdX: Sub-account numbers (e.g., '0', '1', '2')\n * - Other protocols: Vault IDs, pool IDs, margin account IDs, etc.\n *\n * Key: Sub-account identifier (protocol-specific string)\n * Value: Balance details for that sub-account\n */\n subAccountBreakdown?: Record<\n string,\n {\n spendableBalance: string;\n withdrawableBalance: string;\n totalBalance: string;\n }\n >;\n providerId?: PerpsProviderType; // Multi-provider: which provider this account state is from (injected by aggregator)\n};\n\nexport type ClosePositionParams = {\n symbol: string; // Asset identifier to close (e.g., 'ETH', 'BTC', 'xyz:TSLA')\n size?: string; // Size to close (omit for full close)\n /**\n * Close order type (default: market). Only `market` and `limit` are meaningful\n * here: `ClosePositionParams` carries no trigger price, so a trigger-based\n * close is not expressible and would be rejected during placement.\n *\n * Strategy placements are excluded at the type level rather than left to a\n * runtime rejection, because this type cannot carry any of the fields they\n * require and `closePosition` has no path that executes them. Derived with\n * `Exclude` on purpose: it shrinks as `StrategyOrderType` grows, so a strategy\n * added later is refused here automatically.\n */\n orderType?: Exclude<OrderType, StrategyOrderType>;\n price?: string; // Limit price (required for limit close)\n currentPrice?: number; // Current market price for validation\n\n // USD as source of truth (hybrid approach - same as OrderParams)\n usdAmount?: string; // USD amount (primary source of truth, provider calculates size from this)\n priceAtCalculation?: number; // Price snapshot when size was calculated (for slippage validation)\n maxSlippageBps?: number; // Slippage tolerance in basis points (e.g., 100 = 1%, default if not provided)\n\n // Optional tracking data for MetaMetrics events\n trackingData?: TrackingData;\n\n // Multi-provider routing (optional: defaults to active/default provider)\n providerId?: PerpsProviderType; // Optional: override active provider for routing\n\n /**\n * Optional caller snapshot for diagnostics.\n *\n * The provider always resolves the position from the current DEX WebSocket\n * slice or an HTTP read. It never uses this snapshot for order size or side.\n * If neither authoritative source answers, the close fails with\n * `PROVIDER_NOT_AVAILABLE`.\n */\n position?: Position;\n};\n\nexport type ClosePositionsParams = {\n symbols?: string[]; // Optional: specific symbols to close (omit or empty array to close all)\n closeAll?: boolean; // Explicitly close all positions\n};\n\nexport type ClosePositionsResult = {\n success: boolean; // Overall success (true if at least one position closed)\n successCount: number; // Number of positions closed successfully\n failureCount: number; // Number of positions that failed to close\n /**\n * Batch-level operation error.\n *\n * Set when the close fails as a whole: snapshot/preparation errors with no\n * per-position outcomes, or a thrown batch submission that also fills\n * `results` with per-position failures.\n */\n error?: string;\n results: {\n symbol: string;\n success: boolean;\n error?: string;\n }[];\n};\n\nexport type UpdateMarginParams = {\n symbol: string; // Asset identifier (e.g., 'BTC', 'ETH', 'xyz:TSLA')\n amount: string; // Amount to adjust as string (positive = add, negative = remove)\n providerId?: PerpsProviderType; // Multi-provider: optional provider override for routing\n};\n\nexport type MarginResult = {\n success: boolean;\n error?: string;\n};\n\nexport type FlipPositionParams = {\n symbol: string; // Asset identifier to flip (e.g., 'BTC', 'ETH', 'xyz:TSLA')\n position: Position; // Current position to flip\n\n // Optional tracking data for MetaMetrics events\n trackingData?: TrackingData;\n};\n\nexport type InitializeResult = {\n success: boolean;\n error?: string;\n chainId?: string;\n};\n\nexport type ReadyToTradeResult = {\n ready: boolean;\n error?: string;\n walletConnected?: boolean;\n networkSupported?: boolean;\n authenticatedAddress?: string;\n};\n\nexport type DisconnectResult = {\n success: boolean;\n error?: string;\n};\n\nexport type MarketInfo = {\n name: string; // HyperLiquid: universe name (asset symbol)\n szDecimals: number; // HyperLiquid: size decimals\n maxLeverage: number; // HyperLiquid: max leverage\n marginTableId: number; // HyperLiquid: margin requirements table ID\n marginMode?: 'strictIsolated' | 'noCross'; // HyperLiquid market capability\n onlyIsolated?: true; // HyperLiquid: isolated margin only (optional, only when true)\n isDelisted?: true; // HyperLiquid: delisted status (optional, only when true)\n minimumOrderSize?: number; // Minimum order size in USD (protocol-specific)\n providerId?: PerpsProviderType; // Multi-provider: which provider this market comes from (injected by aggregator)\n};\n\n/**\n * Market data with prices for UI display\n * Protocol-agnostic interface for market information with formatted values\n */\nexport type PerpsMarketData = {\n /**\n * Token symbol (e.g., 'BTC', 'ETH')\n */\n symbol: string;\n /**\n * Full token name (e.g., 'Bitcoin', 'Ethereum')\n */\n name: string;\n /**\n * Human-readable asset description from Terminal API metadata, when available\n * (e.g., 'The leading smart contract platform. Home to DeFi, NFTs...').\n * Only populated when using the Terminal API backend and the asset has one.\n */\n description?: string;\n /**\n * Maximum leverage available as formatted string (e.g., '40x', '25x')\n */\n maxLeverage: string;\n /**\n * Current price as formatted string (e.g., '$50,000.00')\n */\n price: string;\n /**\n * 24h price change as formatted string (e.g., '+$1,250.00', '-$850.50')\n */\n change24h: string;\n /**\n * 24h price change percentage as formatted string (e.g., '+2.5%', '-1.8%')\n */\n change24hPercent: string;\n /**\n * Trading volume as formatted string (e.g., '$1.2B', '$850M')\n */\n volume: string;\n /**\n * Open interest as formatted string (e.g., '$24.5M', '$1.2B')\n */\n openInterest?: string;\n /**\n * Next funding time in milliseconds since epoch (optional, market-specific)\n */\n nextFundingTime?: number;\n /**\n * Funding interval in hours (optional, market-specific)\n */\n fundingIntervalHours?: number;\n /**\n * Current funding rate as decimal (optional, from predictedFundings API)\n */\n fundingRate?: number;\n /**\n * Market source DEX identifier (HIP-3 support)\n * - null or undefined: Main validator DEX\n * - \"xyz\", \"abc\", etc: HIP-3 builder-deployed DEX\n */\n marketSource?: string | null;\n /**\n * Market asset type classification (optional)\n * - crypto: Cryptocurrency (default for most markets)\n * - stock: Individual stocks (HIP-3)\n * - pre-ipo: Pre-IPO assets (HIP-3)\n * - index: Market indices (HIP-3)\n * - etf: Exchange-traded funds (HIP-3)\n * - commodity: Commodity markets (HIP-3)\n * - forex: Foreign exchange pairs (HIP-3)\n */\n marketType?: MarketType;\n /**\n * Whether this is a HIP-3 market (has DEX prefix like xyz:, flx:)\n * Used to distinguish between crypto (isHip3=false) and non-crypto markets\n */\n isHip3?: boolean;\n /**\n * Whether this is a new/uncategorized market (HIP-3 markets not yet in explicit mapping)\n * Used for the \"New\" filter tab\n */\n isNewMarket?: boolean;\n /**\n * Multi-provider: which provider this market data comes from (injected by aggregator)\n */\n providerId?: PerpsProviderType;\n /**\n * Indicates this market snapshot came from the last known good cache after live fetch failure.\n */\n isStale?: boolean;\n /** Identifies an atomic Terminal summary whose price/change use mark semantics. */\n dataSource?: 'terminal-global-snapshot-mark';\n /** Source-bounded expiry for an atomic Terminal summary. */\n sourceExpiresAt?: number;\n /**\n * Searchable keywords from Terminal API metadata (e.g., ['defi', 'layer-1'])\n */\n keywords?: string[];\n /**\n * Taxonomy tags from Terminal API metadata (e.g., ['top-100', 'gaming'])\n */\n tags?: string[];\n /**\n * Market categories from Terminal API metadata (e.g., ['crypto', 'meme'])\n */\n categories?: string[];\n /** Timestamped hourly price points supplied by the atomic Terminal snapshot. */\n trend?: [timestampMs: number, price: string][];\n /**\n * Epoch ms when this market was listed on the Terminal backend.\n * Sourced from the Terminal API `listedAt` field.\n * Clients can use this to surface recently added markets (e.g. markets listed within the last 30 days).\n */\n listedAt?: number;\n};\n\nexport type ToggleTestnetResult = {\n success: boolean;\n isTestnet: boolean;\n error?: string;\n};\n\nexport type AssetRoute = {\n assetId: CaipAssetId; // CAIP asset ID (e.g., \"eip155:42161/erc20:0xaf88.../default\")\n chainId: CaipChainId; // CAIP-2 chain ID where the bridge contract is located\n contractAddress: Hex; // Bridge contract address for deposits/withdrawals\n constraints?: {\n minAmount?: string; // Minimum deposit/withdrawal amount\n maxAmount?: string; // Maximum deposit/withdrawal amount\n estimatedTime?: string; // Estimated processing time (formatted string - deprecated, use estimatedMinutes)\n estimatedMinutes?: number; // Estimated processing time in minutes (raw value for UI formatting)\n fees?: {\n fixed?: number; // Fixed fee amount (e.g., 1 for 1 token)\n percentage?: number; // Percentage fee (e.g., 0.05 for 0.05%)\n token?: string; // Fee token symbol (e.g., 'USDC', 'ETH')\n };\n };\n};\n\nexport type SwitchProviderResult = {\n success: boolean;\n providerId: PerpsActiveProviderMode;\n error?: string;\n};\n\nexport type CancelOrderParams = {\n orderId: string; // Order ID to cancel, or the strategy handle when orderType is a strategy type\n symbol: string; // Asset identifier (e.g., 'BTC', 'ETH', 'xyz:TSLA')\n /**\n * Placement type of what is being cancelled. Only the strategy types\n * (`twap`, `scale`, `chase`) change anything: each is cancelled through its\n * own path — the venue's TWAP cancel endpoint, a batch cancel of the ladder's\n * children, or stopping the chase session and cancelling its live order.\n * Omit it (or pass an ordinary order type) to cancel a single resting order,\n * which is what every existing caller does.\n */\n orderType?: OrderType;\n // Optional provider override. Omission uses active/default routing.\n providerId?: PerpsProviderType;\n // Optional tracking data for MetaMetrics events (e.g. discovery attribution)\n trackingData?: TrackingData;\n};\n\nexport type CancelOrderResult = {\n success: boolean;\n /**\n * What was cancelled, named the same way it was placed: an exchange order ID\n * for an ordinary cancel, and the strategy handle — TWAP id, scale group, or\n * chase session — when `CancelOrderParams.orderType` named one. Scale and\n * chase handles can only be cancelled during the provider session that\n * created them; TWAP IDs are venue-owned.\n */\n orderId?: string;\n error?: string;\n providerId?: PerpsProviderType; // Multi-provider: source provider identifier\n};\n\nexport type BatchCancelOrdersParams = {\n orderId: string;\n symbol: string;\n}[];\n\nexport type CancelOrdersParams = {\n symbols?: string[]; // Optional: specific symbols (omit to cancel all orders)\n orderIds?: string[]; // Optional: specific order IDs (omit to cancel all orders for specified coins)\n cancelAll?: boolean; // Explicitly cancel all orders\n};\n\nexport type CancelOrdersResult = {\n success: boolean; // Overall success (true if at least one order cancelled)\n successCount: number; // Number of orders cancelled successfully\n failureCount: number; // Number of orders that failed to cancel\n results: {\n orderId: string;\n symbol: string;\n success: boolean;\n error?: string;\n }[];\n};\n\nexport type EditOrderParams = {\n orderId: string | number; // Order ID or client order ID to modify\n newOrder: OrderParams; // New order parameters\n};\n\nexport type DepositParams = {\n amount: string; // Amount to deposit\n assetId: CaipAssetId; // Asset to deposit (required for validation)\n fromChainId?: CaipChainId; // Source chain (defaults to current network)\n toChainId?: CaipChainId; // Destination chain (defaults to HyperLiquid Arbitrum)\n recipient?: Hex; // Recipient address (defaults to selected account)\n};\n\n/** Params for depositWithConfirmation: prepares transaction for confirmation screen */\nexport type DepositWithConfirmationParams = {\n /** Optional deposit amount (display/tracking; actual amount comes from prepared transaction) */\n amount?: string;\n /** If true, uses addTransaction instead of submit to avoid navigation (e.g. deposit + place order flow) */\n placeOrder?: boolean;\n};\n\nexport type DepositResult = {\n success: boolean;\n txHash?: string;\n error?: string;\n};\n\n// Enhanced deposit flow state types for multi-step deposits\nexport type DepositStatus =\n | 'idle' // No deposit in progress\n | 'preparing' // Analyzing route & preparing transactions\n | 'swapping' // Converting token (e.g., ETH → USDC)\n | 'bridging' // Cross-chain transfer\n | 'depositing' // Final deposit to HyperLiquid\n | 'success' // Deposit completed successfully\n | 'error'; // Deposit failed at any step\n\nexport type DepositFlowType =\n | 'direct' // Same chain, same token (USDC on Arbitrum)\n | 'swap' // Same chain, different token (ETH → USDC)\n | 'bridge' // Different chain, same token (USDC on Ethereum → Arbitrum)\n | 'swap_bridge'; // Different chain, different token (ETH on Ethereum → USDC on Arbitrum)\n\nexport type DepositStepInfo = {\n totalSteps: number; // Total number of steps in this flow\n currentStep: number; // Current step (0-based index)\n stepNames: string[]; // Human-readable step names\n stepTxHashes?: string[]; // Transaction hashes for each completed step\n};\n\nexport type WithdrawParams = {\n amount: string; // Amount to withdraw\n destination?: Hex; // Destination address (optional, defaults to current account)\n assetId?: CaipAssetId; // Asset to withdraw (defaults to USDC)\n providerId?: PerpsProviderType; // Multi-provider: optional provider override for routing\n};\n\nexport type WithdrawResult = {\n success: boolean;\n txHash?: string;\n error?: string;\n withdrawalId?: string; // Unique ID for tracking\n estimatedArrivalTime?: number; // Provider-specific arrival time\n};\n\nexport type TransferBetweenDexsParams = {\n sourceDex: string; // Source DEX name ('' = main DEX, 'xyz' = HIP-3 DEX)\n destinationDex: string; // Destination DEX name ('' = main DEX, 'xyz' = HIP-3 DEX)\n amount: string; // USDC amount to transfer\n};\n\nexport type TransferBetweenDexsResult = {\n success: boolean;\n txHash?: string;\n error?: string;\n};\n\nexport type GetHistoricalPortfolioParams = {\n accountId?: CaipAccountId; // Optional: defaults to selected account\n};\n\nexport type HistoricalPortfolioResult = {\n accountValue1dAgo: string;\n timestamp: number;\n};\n\nexport type LiveDataConfig = {\n priceThrottleMs?: number; // ms between price updates (default: 2000)\n positionThrottleMs?: number; // ms between position updates (default: 5000)\n maxUpdatesPerSecond?: number; // hard limit to prevent UI blocking\n};\n\nexport type PerpsControllerConfig = {\n /**\n * Fallback blocked regions to use when RemoteFeatureFlagController fails to fetch.\n * The fallback is set by default if defined and replaced with remote block list once available.\n */\n fallbackBlockedRegions?: string[];\n /**\n * Fallback HIP-3 equity perps master switch to use when RemoteFeatureFlagController fails to fetch.\n * Controls whether HIP-3 (builder-deployed) DEXs are enabled.\n * The fallback is set by default if defined and replaced with remote feature flag once available.\n */\n fallbackHip3Enabled?: boolean;\n /**\n * Fallback HIP-3 market allowlist to use when RemoteFeatureFlagController fails to fetch.\n * Empty array = enable all markets (discovery mode), non-empty = allowlist specific markets.\n * Supports wildcards: \"xyz:*\" (all xyz markets), \"xyz\" (shorthand for \"xyz:*\"), \"BTC\" (main DEX market).\n * Only applies when HIP-3 is enabled.\n * The fallback is set by default if defined and replaced with remote feature flag once available.\n */\n fallbackHip3AllowlistMarkets?: string[];\n /**\n * Fallback HIP-3 market blocklist to use when RemoteFeatureFlagController fails to fetch.\n * Empty array = no blocking, non-empty = block specific markets.\n * Supports wildcards: \"xyz:*\" (block all xyz markets), \"xyz\" (shorthand for \"xyz:*\"), \"BTC\" (block main DEX market).\n * Always applied regardless of HIP-3 enabled state.\n * The fallback is set by default if defined and replaced with remote feature flag once available.\n */\n fallbackHip3BlocklistMarkets?: string[];\n\n /**\n * Override for the maximum allowed deviation of a market's price from its oracle\n * (reference) price before it is reported as untradable (`PriceUpdate.isTradable`),\n * as a decimal fraction (e.g. `0.95` = 95%). Protocol-agnostic: each provider applies\n * its own default when omitted (HyperLiquid uses\n * `HYPERLIQUID_CONFIG.OraclePriceDeviationLimit`, `0.95`). Lets a client tune the\n * threshold without a package release.\n */\n fallbackPriceDeviationLimit?: number;\n\n /**\n * Per-provider credentials and configuration.\n * Nested by provider name so each provider's settings are self-contained\n * and new protocols can be added without polluting the top-level config.\n * Passed from the init file where `process.env.X` is babel-transformed at build time.\n */\n providerCredentials?: PerpsProviderCredentials;\n};\n\nexport type HyperLiquidCredentials = {\n /** Builder fee wallet address for testnet. Empty/omitted = uses BUILDER_FEE_CONFIG default. */\n builderAddressTestnet?: string;\n /** Builder fee wallet address for mainnet. Empty/omitted = uses BUILDER_FEE_CONFIG default. */\n builderAddressMainnet?: string;\n /** Dedicated subscription waiver builder for testnet. */\n subscriptionBuilderAddressTestnet?: string;\n /** Dedicated subscription waiver builder for mainnet. */\n subscriptionBuilderAddressMainnet?: string;\n};\n\nexport type LighterCredentials = {\n /** Whether Lighter provider is enabled via local env var. */\n enabled?: boolean;\n /** Lighter account index override (testnet tooling). */\n accountIndexTestnet?: number;\n accountIndexMainnet?: number;\n /** API key slot to register/use (defaults to LIGHTER_DEFAULT_API_KEY_INDEX). */\n apiKeyIndex?: number;\n /**\n * Client-owned Lighter signer. The client creates and persists the venue\n * key behind this bridge; Core receives only signing results and public\n * registration data, matching the injected-wallet boundary used by\n * HyperLiquid.\n *\n * Mobile uses an off-screen WebView bridge; headless clients may use an\n * in-process WASM bridge.\n * Optional — without it the Lighter provider is read-only. Lives on the\n * Lighter credentials bag, not PerpsPlatformDependencies, so the shared\n * platform surface stays venue-agnostic.\n */\n signerBridge?: LighterSignerBridge;\n};\n\nexport type PerpsProviderCredentials = {\n hyperliquid?: HyperLiquidCredentials;\n lighter?: LighterCredentials;\n};\n\nexport type PriceUpdate = {\n symbol: string; // Asset identifier (e.g., 'BTC', 'ETH', 'xyz:TSLA')\n price: string; // Current mid price (average of best bid and ask)\n timestamp: number; // Update timestamp\n percentChange24h?: string; // 24h price change percentage\n // Order book data (only available when includeOrderBook is true)\n bestBid?: string; // Best bid price (highest price buyers are willing to pay)\n bestAsk?: string; // Best ask price (lowest price sellers are willing to accept)\n spread?: string; // Ask - Bid spread\n markPrice?: string; // Mark price from oracle (used for liquidations)\n // Market data (only available when includeMarketData is true)\n funding?: number; // Current funding rate\n openInterest?: number; // Open interest in USD\n volume24h?: number; // 24h trading volume in USD\n /**\n * Whether the market is currently tradable. Defaults to `true`.\n *\n * Some markets — most often HIP-3 builder-deployed ones — become temporarily\n * untradable when their market price drifts too far from the oracle price, in which\n * case the protocol rejects orders (HyperLiquid: \"Order price cannot be more than 95%\n * away from the reference price\"). Clients use this to proactively show a \"trading\n * unavailable\" warning instead of letting the order fail on submission.\n *\n * Computed per provider/protocol from that protocol's own rules. It is `false` only\n * when a provider determines the market is currently untradable; a provider that has no\n * such rule, or cannot assess tradability yet (e.g. before the oracle price is cached),\n * reports `true`. The value is always a concrete boolean — never `undefined`.\n */\n isTradable: boolean;\n providerId?: PerpsProviderType; // Multi-provider: price source (injected by aggregator)\n};\n\nexport type OrderFill = {\n orderId: string; // Order ID that was filled\n symbol: string; // Asset symbol\n side: string; // Normalized order side ('buy' or 'sell')\n size: string; // Fill size\n price: string; // Fill price\n pnl: string; // PNL\n direction: string; // Direction of the fill\n fee: string; // Fee paid\n feeToken: string; // Fee token symbol\n timestamp: number; // Fill timestamp\n startPosition?: string; // Start position\n success?: boolean; // Whether the order was filled successfully\n liquidation?: {\n liquidatedUser: string; // Address of the liquidated user. liquidatedUser isn't always the current user. It can also mean the fill filled another user's liquidation.\n markPx: string; // Mark price at liquidation\n method: string; // Liquidation method (e.g., 'market')\n };\n orderType?: 'take_profit' | 'stop_loss' | 'liquidation' | 'regular';\n detailedOrderType?: string; // Original order type from exchange\n providerId?: PerpsProviderType; // Multi-provider: which provider this fill occurred on (injected by aggregator)\n};\n\n// Parameter interfaces - all fully optional for better UX\nexport type CheckEligibilityParams = {\n blockedRegions: string[]; // List of blocked region codes (e.g., ['US', 'CN'])\n geoLocation: string; // User's geolocation from GeolocationController\n};\n\nexport type GetPositionsParams = {\n accountId?: CaipAccountId; // Optional: defaults to selected account\n includeHistory?: boolean; // Optional: include historical positions\n skipCache?: boolean; // Optional: bypass WebSocket cache and force API call (default: false)\n standalone?: boolean; // Optional: lightweight mode - skip full initialization, use standalone HTTP client (no wallet/WebSocket needed)\n userAddress?: string; // Optional: required when standalone is true - user address to query positions for\n};\n\nexport type GetAccountStateParams = {\n accountId?: CaipAccountId; // Optional: defaults to selected account\n source?: string; // Optional: source of the call for tracing (e.g., 'health_check', 'initial_connection')\n standalone?: boolean; // Optional: lightweight mode - skip full initialization, use standalone HTTP client (no wallet/WebSocket needed)\n userAddress?: string; // Optional: required when standalone is true - user address to query account state for\n};\n\nexport type GetUserDataSnapshotParams = {\n userAddress: string;\n identity: {\n provider: 'hyperliquid';\n network: 'mainnet' | 'testnet';\n hip3ConfigVersion: number;\n dexes: string[];\n };\n};\n\nexport type PerpsUserDataSnapshot = {\n positions: Position[];\n orders: Order[];\n accountState: AccountState;\n identity: GetUserDataSnapshotParams['identity'] & { address: string };\n};\n\nexport type GetOrderFillsParams = {\n accountId?: CaipAccountId; // Optional: defaults to selected account\n user?: Hex; // Optional: user address (defaults to selected account)\n startTime?: number; // Optional: start timestamp (Unix milliseconds)\n endTime?: number; // Optional: end timestamp (Unix milliseconds)\n limit?: number; // Optional: max number of results for pagination\n aggregateByTime?: boolean; // Optional: aggregate by time\n};\n\n/**\n * Parameters for getOrFetchFills - optimized cache-first fill retrieval.\n * Subset of GetOrderFillsParams for cache filtering.\n */\nexport type GetOrFetchFillsParams = {\n startTime?: number; // Optional: start timestamp (Unix milliseconds)\n symbol?: string; // Optional: filter by symbol\n};\n\nexport type GetOrdersParams = {\n accountId?: CaipAccountId; // Optional: defaults to selected account\n startTime?: number; // Optional: start timestamp (Unix milliseconds)\n endTime?: number; // Optional: end timestamp (Unix milliseconds)\n limit?: number; // Optional: max number of results for pagination\n offset?: number; // Optional: offset for pagination\n skipCache?: boolean; // Optional: bypass WebSocket cache and force API call (default: false)\n standalone?: boolean; // Optional: lightweight mode - skip full initialization, use standalone HTTP client (no wallet/WebSocket needed)\n userAddress?: string; // Optional: required when standalone is true - user address to query orders for\n};\n\n/**\n * Options for cache-aware provider read calls (getOrders, getOrderFills, etc.).\n * Provider-agnostic: providers without inner caches can ignore; providers that\n * cache at the service layer (e.g. HyperLiquid) must honor forceRefresh.\n */\nexport type PerpsReadOptions = {\n /** Bypass any provider-internal cache. Used for user-initiated refresh (pull-to-refresh). */\n forceRefresh?: boolean;\n};\n\nexport type GetFundingParams = {\n accountId?: CaipAccountId; // Optional: defaults to selected account\n startTime?: number; // Optional: start timestamp (Unix milliseconds)\n endTime?: number; // Optional: end timestamp (Unix milliseconds)\n limit?: number; // Optional: max number of results for pagination\n offset?: number; // Optional: offset for pagination\n};\n\nexport type GetSupportedPathsParams = {\n isTestnet?: boolean; // Optional: override current testnet state\n assetId?: CaipAssetId; // Optional: filter by specific asset\n symbol?: string; // Optional: filter by asset symbol (e.g., 'USDC')\n chainId?: CaipChainId; // Optional: filter by chain (CAIP-2 format)\n};\n\n/** Placeholder for future filter/pagination params (e.g., validated, chain). Empty today so the API signature is stable. */\nexport type GetAvailableDexsParams = Record<string, never>;\n\n/** Field to sort markets by. */\nexport type SortField =\n | 'volume'\n | 'priceChange'\n | 'fundingRate'\n | 'openInterest';\n\n/** Direction for market sorting. */\nexport type SortDirection = 'asc' | 'desc';\n\nexport type GetMarketsParams = {\n symbols?: string[]; // Optional symbol filter (e.g., ['BTC', 'xyz:XYZ100'])\n dex?: string; // HyperLiquid HIP-3: DEX name (empty string '' or undefined for main DEX). Other protocols: ignored.\n skipFilters?: boolean; // Skip market filtering (both allowlist and blocklist, default: false). When true, returns all markets without filtering.\n standalone?: boolean; // Lightweight mode: skip full initialization, only fetch market metadata (no wallet/WebSocket needed). Only main DEX markets returned. Use for discovery use cases like checking if a perps market exists.\n useTerminalApi?: boolean; // When true, enrich provider data from the legacy Terminal market endpoint.\n};\n\n/**\n * Parameters for {@link PerpsController.getMarketDataWithPrices}.\n * Extends the base market-fetch params with optional category filtering,\n * sorting, and pagination that are applied as post-processing.\n */\nexport type GetMarketDataWithPricesParams = {\n standalone?: boolean; // Lightweight mode: see GetMarketsParams.standalone\n categories?: MarketTypeFilter[]; // Filter to markets matching any of these categories; omit for all markets\n excludeSymbols?: string[]; // Symbols to exclude from results (e.g. the currently viewed market)\n sortBy?: SortField; // Sort results by this field\n direction?: SortDirection; // Sort direction (default: desc)\n limit?: number; // Maximum number of results to return\n useTerminalApi?: boolean; // When true, enrich provider data from the legacy Terminal market endpoint.\n};\n\nexport type SubscribePricesParams = {\n symbols: string[];\n callback: (prices: PriceUpdate[]) => void;\n throttleMs?: number; // Future: per-subscription throttling\n includeOrderBook?: boolean; // Optional: include bid/ask data from L2 book\n includeMarketData?: boolean; // Optional: include funding, open interest, volume data\n};\n\nexport type SubscribePositionsParams = {\n callback: (positions: Position[]) => void;\n accountId?: CaipAccountId; // Optional: defaults to selected account\n includeHistory?: boolean; // Future: include historical data\n};\n\nexport type SubscribeOrderFillsParams = {\n callback: (fills: OrderFill[], isSnapshot?: boolean) => void;\n accountId?: CaipAccountId; // Optional: defaults to selected account\n since?: number; // Future: only fills after timestamp\n};\n\nexport type SubscribeOrdersParams = {\n callback: (orders: Order[]) => void;\n accountId?: CaipAccountId; // Optional: defaults to selected account\n includeHistory?: boolean; // Optional: include filled/canceled orders\n};\n\nexport type SubscribeTwapOrdersParams = {\n /**\n * Receives current and terminal TWAP schedules, newest first — the same\n * shape `getTwapOrders()` returns, so a client can swap a poll for this\n * subscription without reshaping its state.\n *\n * Retention differs from the REST read on purpose: every active schedule is\n * always delivered, while terminal ones are bounded to the most recent 100\n * so a long-lived stream cannot accumulate an account's entire history.\n * Callers needing older terminal schedules should still read\n * `getTwapOrders()`.\n *\n * `isSnapshot` marks the venue's initial full set; later invocations carry\n * the merged result of a delta.\n */\n callback: (twapOrders: TwapOrder[], isSnapshot?: boolean) => void;\n accountId?: CaipAccountId; // Optional: defaults to selected account\n};\n\nexport type SubscribeAccountParams = {\n callback: (account: AccountState | null) => void;\n accountId?: CaipAccountId; // Optional: defaults to selected account\n};\n\nexport type SubscribeOICapsParams = {\n callback: (caps: string[]) => void;\n accountId?: CaipAccountId; // Optional: defaults to selected account\n};\n\nexport type SubscribeCandlesParams = {\n symbol: string;\n interval: CandlePeriod;\n duration?: TimeDuration;\n callback: (data: CandleData) => void;\n onError?: (error: Error) => void;\n};\n\n/**\n * Single price level in the order book\n */\nexport type OrderBookLevel = {\n /** Price at this level */\n price: string;\n /** Size at this level (in base asset) */\n size: string;\n /** Cumulative size up to and including this level */\n total: string;\n /** Notional value in USD */\n notional: string;\n /** Cumulative notional up to and including this level */\n totalNotional: string;\n};\n\n/**\n * Full order book data with multiple price levels\n */\nexport type OrderBookData = {\n /** Bid levels (buy orders) - highest price first */\n bids: OrderBookLevel[];\n /** Ask levels (sell orders) - lowest price first */\n asks: OrderBookLevel[];\n /** Spread between best bid and best ask */\n spread: string;\n /** Spread as a percentage of mid price */\n spreadPercentage: string;\n /** Mid price (average of best bid and best ask) */\n midPrice: string;\n /** Timestamp of last update */\n lastUpdated: number;\n /** Maximum total size across all levels (for scaling depth bars) */\n maxTotal: string;\n};\n\nexport type SubscribeOrderBookParams = {\n /** Symbol to subscribe to (e.g., 'BTC', 'ETH') */\n symbol: string;\n /** Number of levels to return per side (default: 10) */\n levels?: number;\n /** Price aggregation significant figures (2-5, default: 5). Higher = finer granularity */\n nSigFigs?: 2 | 3 | 4 | 5;\n /** Mantissa for aggregation when nSigFigs is 5 (2 or 5). Controls finest price increments */\n mantissa?: 2 | 5;\n /**\n * Enable fast order book updates (5 levels @ ~0.5 s cadence).\n * When omitted, Hyperliquid uses the default cadence (20 levels @ ~2 s).\n * Note: with `fast: true` the widget receives at most 5 levels per side\n * regardless of the `levels` setting.\n */\n fast?: boolean;\n /** Callback function receiving order book updates */\n callback: (orderBook: OrderBookData) => void;\n /** Callback for errors */\n onError?: (error: Error) => void;\n};\n\nexport type LiquidationPriceParams = {\n entryPrice: number;\n leverage: number;\n direction: 'long' | 'short';\n positionSize?: number; // Optional: for more accurate calculations\n marginType?: 'isolated' | 'cross'; // Optional: defaults to isolated\n asset?: string; // Optional: for asset-specific maintenance margins\n /** Provider that owns the position when calculations are aggregated. */\n providerId?: PerpsProviderType;\n};\n\n/**\n * Live position fields required to project a modify. Clients may pass a full\n * {@link Position}; extra fields are ignored.\n */\nexport type PositionModifyPreviewSource = Pick<\n Position,\n | 'symbol'\n | 'size'\n | 'marginUsed'\n | 'liquidationPrice'\n | 'entryPrice'\n | 'leverage'\n | 'positionValue'\n | 'maxLeverage'\n | 'providerId'\n>;\n\n/**\n * Proposed order plus the live position it would modify.\n *\n * Isolated-margin previews apply `leverage` to the *whole* resulting\n * position, matching `updateLeverage` before placement. Cross-margin\n * positions are not projected.\n */\nexport type PositionModifyPreviewParams = {\n position: PositionModifyPreviewSource;\n /** Proposed order direction. */\n direction: 'long' | 'short';\n /** Proposed order size in token units. */\n size: string;\n /**\n * Expected fill price for a marketable order, or the resting limit price.\n * Increases and flips require a positive price; a reduce does not.\n * Scale, TWAP, and chase orders should pass the expected fill size and price;\n * this preview models a single fill.\n */\n price: string;\n /**\n * Isolated leverage the provider will set on the asset before placing.\n * Applied to the entire resulting position, not only the added size.\n */\n leverage: number;\n reduceOnly?: boolean;\n /**\n * Estimated trading fees in USD. Deducted from isolated margin on\n * increases and flips. Omit or pass 0 when unknown.\n */\n feeAmountUsd?: number;\n /**\n * Explicit venue route. Aggregated providers use this, then\n * `position.providerId`, then the default provider.\n */\n providerId?: PerpsProviderType;\n};\n\n/**\n * Independently available numeric projection. Margin can be known when\n * liquidation cannot (missing maintenance-tier data, or no liquidation risk).\n */\nexport type PositionPreviewValue =\n | { available: true; value: number }\n | { available: false };\n\nexport type PositionModifyPreviewKind = 'increase' | 'decrease' | 'flip';\n\nexport type PositionModifyPreviewCurrent = {\n margin: PositionPreviewValue;\n liquidationPrice: PositionPreviewValue;\n};\n\nexport type PositionModifyPreviewOpen = {\n status: 'open';\n kind: PositionModifyPreviewKind;\n current: PositionModifyPreviewCurrent;\n resulting: {\n direction: 'long' | 'short';\n /** Resulting token size; always > 0 for `open`. */\n size: number;\n entryPrice: number;\n /**\n * Isolated leverage from mark notional / remaining margin, matching\n * HyperLiquid's displayed leverage rather than entry notional / margin.\n */\n leverage: number;\n margin: PositionPreviewValue;\n liquidationPrice: PositionPreviewValue;\n };\n};\n\nexport type PositionModifyPreviewFullClose = {\n status: 'full_close';\n current: PositionModifyPreviewCurrent;\n /** Direction of the position being closed. */\n resultingDirection: 'long' | 'short';\n};\n\nexport type PositionModifyPreviewUnsupported = {\n status: 'unsupported';\n reason: 'cross_margin' | 'provider';\n};\n\nexport type PositionModifyPreviewNone = {\n status: 'none';\n};\n\n/**\n * Read-only post-trade position projection.\n *\n * Discriminated on `status` so a non-modifying result cannot carry a\n * flip/full-close kind, and a full close cannot report a remaining size.\n */\nexport type PositionModifyPreviewResult =\n | PositionModifyPreviewNone\n | PositionModifyPreviewUnsupported\n | PositionModifyPreviewFullClose\n | PositionModifyPreviewOpen;\n\nexport type MaintenanceMarginParams = {\n asset: string;\n positionSize?: number; // Optional: for tiered margin systems\n /** Provider that owns the position when calculations are aggregated. */\n providerId?: PerpsProviderType;\n};\n\n/**\n * Context used to resolve the provider that owns order capabilities.\n * `symbol` allows providers to narrow capabilities per market, while\n * `providerId` follows the same explicit-over-default routing as placement.\n */\nexport type GetOrderCapabilitiesParams = {\n /** Provider-specific market identifier, including any routing prefix. */\n symbol: string;\n providerId?: PerpsProviderType;\n};\n\n/** Inputs for a provider-normalized Scale price ladder preview. */\nexport type GetScalePriceLadderParams = {\n /** Market symbol, including its provider route when applicable. */\n symbol: string;\n /** Lowest raw price in the ladder. */\n minPrice: number;\n /** Highest raw price in the ladder. */\n maxPrice: number;\n /** Number of ladder rungs. */\n count: number;\n /** Optional explicit route; omitted uses the active/default provider. */\n providerId?: PerpsProviderType;\n};\n\n/** Provider-owned strategy capabilities for the selected market route. */\nexport type DirectProviderOrderCapabilitiesUnavailableReason =\n | 'provider_unavailable'\n | 'invalid_symbol'\n | 'market_not_found'\n | 'strategy_market_unsupported';\n\nexport type RoutedOrderCapabilitiesUnavailableReason =\n | 'provider_not_found'\n | 'provider_not_routable'\n | 'not_implemented';\n\nexport type OrderCapabilitiesUnavailableReason =\n | DirectProviderOrderCapabilitiesUnavailableReason\n | RoutedOrderCapabilitiesUnavailableReason;\n\ntype ReadyPerpsOrderCapabilities = Readonly<{\n status: 'ready';\n providerId: PerpsProviderType;\n supportedStrategies: readonly StrategyOrderType[];\n}>;\n\nexport type DirectProviderOrderCapabilities =\n | ReadyPerpsOrderCapabilities\n | Readonly<{\n status: 'unavailable';\n providerId?: PerpsProviderType;\n reason: DirectProviderOrderCapabilitiesUnavailableReason;\n }>;\n\nexport type PerpsOrderCapabilities =\n | ReadyPerpsOrderCapabilities\n | Readonly<{\n status: 'unavailable';\n providerId?: PerpsProviderType;\n reason: OrderCapabilitiesUnavailableReason;\n }>;\n\n/** Reasons a direct provider cannot produce a Scale price ladder. */\nexport type DirectProviderScalePriceLadderUnavailableReason = Exclude<\n DirectProviderOrderCapabilitiesUnavailableReason,\n 'strategy_market_unsupported'\n>;\n\n/** Reasons a provider-routed Scale price ladder cannot be produced. */\nexport type ScalePriceLadderUnavailableReason =\n | DirectProviderScalePriceLadderUnavailableReason\n | RoutedOrderCapabilitiesUnavailableReason;\n\n/** Result of provider-routed Scale price normalization. */\nexport type PerpsScalePriceLadder =\n | Readonly<{\n status: 'ready';\n providerId: PerpsProviderType;\n prices: readonly string[];\n }>\n | Readonly<{\n status: 'unavailable';\n providerId?: PerpsProviderType;\n reason: ScalePriceLadderUnavailableReason;\n }>;\n\nexport type FeeCalculationParams = {\n // Trigger placements are charged as their execution kind (a stop_limit pays\n // limit-order fees when it fills, a stop_market pays taker fees).\n orderType: OrderType;\n isMaker?: boolean;\n amount?: string;\n symbol: string; // Required: Asset identifier for HIP-3 fee calculation (e.g., 'BTC', 'xyz:TSLA')\n // Optional provider override. Omission uses active/default routing.\n providerId?: PerpsProviderType;\n};\n\nexport type FeeCalculationResult = {\n // Total fees (protocol + MetaMask)\n feeRate?: number; // Total fee rate as decimal (e.g., 0.00145 for 0.145%), undefined when unavailable\n feeAmount?: number; // Total fee amount in USD (when amount is provided)\n\n // Protocol-specific base fees\n protocolFeeRate?: number; // Protocol fee rate (e.g., 0.00045 for HyperLiquid taker), undefined when unavailable\n protocolFeeAmount?: number; // Protocol fee amount in USD\n\n // MetaMask builder/revenue fee\n metamaskFeeRate?: number; // MetaMask fee rate (e.g., 0.001 for 0.1%), undefined when unavailable\n metamaskFeeAmount?: number; // MetaMask fee amount in USD\n\n // Optional detailed breakdown for transparency\n breakdown?: {\n baseFeeRate: number;\n volumeTier?: string;\n volumeDiscount?: number;\n stakingDiscount?: number;\n };\n\n /**\n * Read-only subscription fee-waiver preview, sourced from the same cached\n * benefits snapshot the fee resolver uses. Present only when the controller\n * has a subscription source wired; the quoted rates above are not adjusted\n * from it, so surfacing this never mutates the cap or the cache.\n */\n subscription?: PerpsSubscriptionFeeWaiverStatus;\n};\n\n/**\n * Usage state of the perps fee waiver on a subscription benefits snapshot.\n */\nexport type PerpsSubscriptionUsage = 'available' | 'exhausted';\n\n/**\n * Subscription benefits as returned by `GET /v1/profiles/{profileId}/benefits`.\n *\n * The perps controller never performs this request itself — the client owns the\n * Profile JWT and injects the read through\n * {@link PerpsPlatformDependencies.subscription}. Only the fields the perps fee\n * waiver depends on are modelled here.\n */\nexport type PerpsSubscriptionBenefits = {\n /** Subscription status; only `active` can pass the eligibility gate. */\n status: string;\n\n /** Perps fee waiver entitlement and its remaining allowance. */\n perpsFeeWaiver?: {\n /** Whether the plan entitles this profile to the perps fee waiver. */\n entitled: boolean;\n\n /** Backend usage state; only `available` can pass the eligibility gate. */\n usage?: PerpsSubscriptionUsage;\n\n /**\n * Set by the backend once the notional cap is crossed. Honored on the next\n * cache refresh — there is no client-held reservation to release.\n */\n exhausted?: boolean;\n\n /** Notional (USD) still covered by the waiver, for fee previews. */\n remainingNotionalUsd?: number;\n };\n};\n\n/**\n * Why the subscription fee waiver did or did not apply, plus the remaining\n * allowance for fee previews. Derived purely from the cached benefits snapshot.\n */\nexport type PerpsSubscriptionFeeWaiverStatus = {\n /** True only when every condition of the eligibility gate passed. */\n eligible: boolean;\n\n /**\n * Gate outcome:\n * - `eligible` — every condition passed\n * - `no-source` — no subscription dependency is wired\n * - `not-hydrated` — nothing cached yet; a refresh was kicked off\n * - `stale` — the cached snapshot is past the hard-stale ceiling\n * - `no-subscription` — the read succeeded but reported no subscription at\n * all (signed out, or no profile)\n * - `inactive` — subscription status is not `active`\n * - `not-entitled` — the plan does not include the perps fee waiver\n * - `exhausted` — the backend reported the notional cap as spent\n */\n reason:\n | 'eligible'\n | 'no-source'\n | 'not-hydrated'\n | 'stale'\n | 'no-subscription'\n | 'inactive'\n | 'not-entitled'\n | 'exhausted';\n\n /** Notional (USD) still covered by the waiver, when the backend reports it. */\n remainingNotionalUsd?: number;\n};\n\n/**\n * Fee source that won the unified resolver.\n *\n * `rewards` covers both VIP and season discounts: `RewardsController` already\n * returns the better of the two as a single discount, so the perps controller\n * treats them as one source rather than re-deriving the split.\n */\nexport type PerpsFeeSource = 'default' | 'rewards' | 'subscription';\n\n/**\n * Outcome of the unified fee resolver.\n */\nexport type PerpsFeeResolution = {\n /** Winning MetaMask builder fee, in basis points (lowest across sources). */\n feeBips: number;\n\n /**\n * Winning fee expressed as a discount off the default builder fee, in basis\n * points — the unit providers consume. `undefined` when no source resolved\n * (e.g. rewards state has not hydrated and no subscription waiver applies),\n * so callers do not treat it as a definitive \"no discount\" answer.\n */\n discountBips: number | undefined;\n\n /** Source that produced the winning fee. */\n source: PerpsFeeSource;\n\n /** Subscription gate outcome, always populated for observability. */\n subscription: PerpsSubscriptionFeeWaiverStatus;\n};\n\nexport type UpdatePositionTPSLParams = {\n symbol: string; // Asset identifier (e.g., 'BTC', 'ETH', 'xyz:TSLA')\n takeProfitPrice?: string; // Optional: undefined to remove\n stopLossPrice?: string; // Optional: undefined to remove\n // Partial TP/SL: quantity covered by the TP/SL order. Omit to cover the whole\n // position. When either size is provided the TP/SL orders are placed as\n // standalone reduce-only triggers, since a position-bound TP/SL cannot carry a\n // quantity.\n takeProfitSize?: string;\n stopLossSize?: string;\n // Optional tracking data for MetaMetrics events\n trackingData?: TPSLTrackingData;\n providerId?: PerpsProviderType; // Multi-provider: optional provider override for routing\n /**\n * Optional caller snapshot for diagnostics.\n *\n * The provider always resolves the position from the current DEX WebSocket\n * slice or an HTTP read. It never uses this snapshot for trigger size or side.\n * If neither authoritative source answers, the update fails with\n * `PROVIDER_NOT_AVAILABLE`.\n */\n position?: Position;\n};\n\nexport type Order = {\n orderId: string; // Order ID\n symbol: string; // Asset symbol (e.g., 'ETH', 'BTC')\n side: 'buy' | 'sell'; // Normalized order side\n orderType: OrderType; // Order type (market/limit)\n size: string; // Order size\n originalSize: string; // Original order size\n price: string; // Order price (for limit orders)\n filledSize: string; // Amount filled\n remainingSize: string; // Amount remaining\n status: 'open' | 'filled' | 'canceled' | 'rejected' | 'triggered' | 'queued'; // Normalized status\n timestamp: number; // Order timestamp\n lastUpdated?: number; // Last status update timestamp (optional - not provided by all APIs)\n // TODO: Consider creating separate type for OpenOrders (UI Orders) potentially if optional properties muddy up the original Order type\n takeProfitPrice?: string; // Take profit price (if set)\n stopLossPrice?: string; // Stop loss price (if set)\n stopLossOrderId?: string; // Stop loss order ID\n takeProfitOrderId?: string; // Take profit order ID\n detailedOrderType?: string; // Full order type from exchange (e.g., 'Take Profit Limit', 'Stop Market')\n isTrigger?: boolean; // Whether this is a trigger order (TP/SL)\n // Normalized trigger placement type, set for trigger orders only. `orderType`\n // above stays coarse (how the order executes) so existing consumers keep\n // their meaning; this field carries the full placement type.\n triggerOrderType?: TriggerOrderType;\n reduceOnly?: boolean; // Whether this is a reduce-only order\n isPositionTpsl?: boolean; // Whether this TP/SL is associated with the full position\n parentOrderId?: string; // Parent order ID for display-only synthetic TP/SL rows\n isSynthetic?: boolean; // Whether this order is synthetic (display-only, cancelable only when linked to a real child order ID)\n triggerPrice?: string; // Trigger condition price for trigger orders (e.g., TP/SL trigger level)\n strategyGroupId?: string; // Recoverable strategy handle shared by related venue orders\n providerId?: PerpsProviderType; // Multi-provider: which provider this order is on (injected by aggregator)\n};\n\nexport type Funding = {\n symbol: string; // Asset symbol (e.g., 'ETH', 'BTC')\n amountUsd: string; // Funding amount in USD (positive = received, negative = paid)\n rate?: string; // Funding rate applied (undefined when not available from provider)\n timestamp: number; // Funding payment timestamp\n transactionHash?: string; // Optional transaction hash\n};\n\nexport type PerpsProvider = {\n readonly protocolId: string;\n\n /** Whether this provider routes individual requests by `providerId`. */\n readonly routesOrdersByProviderId?: boolean;\n\n /**\n * Return strategy capabilities for the provider/market route. Providers may\n * omit this hook; the controller then reports capabilities as unavailable.\n */\n getOrderCapabilities?(\n params: GetOrderCapabilitiesParams,\n ): Promise<PerpsOrderCapabilities>;\n\n /**\n * Normalize a Scale ladder using the selected provider's venue rules.\n *\n * @param params - Market, ladder bounds, count, and optional provider route.\n * @returns Provider-normalized prices or a typed unavailable result.\n * @throws When the provider cannot normalize the requested ladder.\n */\n getScalePriceLadder?(\n params: GetScalePriceLadderParams,\n ): Promise<PerpsScalePriceLadder>;\n\n // Unified asset and route information\n getDepositRoutes(params?: GetSupportedPathsParams): AssetRoute[]; // Assets and their deposit routes\n getWithdrawalRoutes(params?: GetSupportedPathsParams): AssetRoute[]; // Assets and their withdrawal routes\n\n // Trading operations → Redux (persisted, optimistic updates)\n placeOrder(params: OrderParams): Promise<OrderResult>;\n editOrder(params: EditOrderParams): Promise<OrderResult>;\n cancelOrder(params: CancelOrderParams): Promise<CancelOrderResult>;\n cancelOrders?(params: BatchCancelOrdersParams): Promise<CancelOrdersResult>; // Optional: batch cancel for protocols that support it\n getTwapOrders?(): Promise<TwapOrder[]>;\n /**\n * Stream TWAP lifecycle updates. Optional: providers without a native TWAP\n * push channel omit it, and clients fall back to polling `getTwapOrders`.\n */\n subscribeToTwapOrders?(params: SubscribeTwapOrdersParams): () => void;\n getChaseOrders?(): Promise<ChaseOrder[]>;\n suspendChaseOrders?(): Promise<ChaseOrder[]>;\n closePosition(params: ClosePositionParams): Promise<OrderResult>;\n closePositions?(params: ClosePositionsParams): Promise<ClosePositionsResult>; // Optional: batch close for protocols that support it\n updatePositionTPSL(params: UpdatePositionTPSLParams): Promise<OrderResult>;\n updateMargin(params: UpdateMarginParams): Promise<MarginResult>;\n // Durable-settlement surfacing (optional: providers with durable local\n // settlement state — Lighter). Read-only listings plus selective,\n // explicit acknowledgment; never destructive read-all.\n getPendingManualRecoveries?(): Promise<PerpsPendingManualRecovery[]>;\n getRecoveredDispatches?(): Promise<PerpsRecoveredDispatch[]>;\n acknowledgeRecoveredDispatch?(recoveryId: string): Promise<void>;\n getPositions(params?: GetPositionsParams): Promise<Position[]>;\n getAccountState(params?: GetAccountStateParams): Promise<AccountState>;\n getUserDataSnapshot?(\n params: GetUserDataSnapshotParams,\n ): Promise<PerpsUserDataSnapshot>;\n getMarkets(params?: GetMarketsParams): Promise<MarketInfo[]>;\n getMarketDataWithPrices(): Promise<PerpsMarketData[]>;\n withdraw(params: WithdrawParams): Promise<WithdrawResult>; // API operation - stays in provider\n // Note: deposit() is handled by PerpsController routing (blockchain operation)\n validateDeposit(\n params: DepositParams,\n ): Promise<{ isValid: boolean; error?: string }>; // Protocol-specific deposit validation\n validateOrder(\n params: OrderParams,\n ): Promise<{ isValid: boolean; error?: string }>; // Protocol-specific order validation\n validateClosePosition(\n params: ClosePositionParams,\n ): Promise<{ isValid: boolean; error?: string }>; // Protocol-specific position close validation\n validateWithdrawal(\n params: WithdrawParams,\n ): Promise<{ isValid: boolean; error?: string }>; // Protocol-specific withdrawal validation\n\n // Historical data operations\n /**\n * Historical trade fills - actual executed trades with exact prices and fees.\n * Purpose: Track what actually happened when orders were executed.\n * Example: Market long 1 ETH @ $50,000 → OrderFill with exact execution price and fees\n */\n getOrderFills(\n params?: GetOrderFillsParams,\n options?: PerpsReadOptions,\n ): Promise<OrderFill[]>;\n\n /**\n * Get fills using WebSocket cache first, falling back to REST API.\n * OPTIMIZATION: Uses cached fills when available (0 API weight), only calls REST on cache miss.\n * Purpose: Prevent 429 errors during rapid market switching by reusing cached fills.\n *\n * @param params - Optional filter parameters (startTime, symbol)\n */\n getOrFetchFills(params?: GetOrFetchFillsParams): Promise<OrderFill[]>;\n\n /**\n * Get historical portfolio data\n * Purpose: Retrieve account value from previous periods for PnL tracking\n * Example: Get account value from yesterday to calculate 24h percentage change\n *\n * @param params - Optional parameters for historical portfolio retrieval\n */\n getHistoricalPortfolio(\n params?: GetHistoricalPortfolioParams,\n ): Promise<HistoricalPortfolioResult>;\n\n /**\n * Historical order lifecycle - order placement, modifications, and status changes.\n * Purpose: Track the complete journey of orders from request to completion.\n * Example: Limit buy 1 ETH @ $48,000 → Order with status 'open' → 'filled' when executed\n */\n getOrders(\n params?: GetOrdersParams,\n options?: PerpsReadOptions,\n ): Promise<Order[]>;\n\n /**\n * Currently active open orders (real-time status).\n * Purpose: Show orders that are currently open/pending execution (not historical states).\n * Different from getOrders() which returns complete historical order lifecycle.\n * Example: Shows only orders that are actually open right now in the exchange.\n */\n getOpenOrders(params?: GetOrdersParams): Promise<Order[]>;\n\n /**\n * Historical funding payments - periodic costs/rewards for holding positions.\n * Purpose: Track ongoing expenses and income from position maintenance.\n * Example: Holding long ETH position → Funding payment of -$5.00 (you pay the funding)\n */\n getFunding(\n params?: GetFundingParams,\n options?: PerpsReadOptions,\n ): Promise<Funding[]>;\n\n /**\n * Get user non-funding ledger updates (deposits, transfers, withdrawals)\n */\n getUserNonFundingLedgerUpdates(params?: {\n accountId?: string;\n startTime?: number;\n endTime?: number;\n }): Promise<RawLedgerUpdate[]>;\n\n /**\n * Resolve the provider's currently active account identifier.\n * Used by the REST coalesce layer so cached payloads are account-scoped\n * even when callers omit params.accountId (the common hook path) — prevents\n * one account's data from being served after an account switch within\n * the coalesce TTL window.\n */\n getCurrentAccountId(): Promise<CaipAccountId>;\n\n /**\n * Get user history (deposits, withdrawals, transfers)\n */\n getUserHistory(params?: {\n accountId?: CaipAccountId;\n startTime?: number;\n endTime?: number;\n }): Promise<UserHistoryItem[]>;\n\n // Protocol-specific calculations\n calculateLiquidationPrice(params: LiquidationPriceParams): Promise<string>;\n calculateMaintenanceMargin(params: MaintenanceMarginParams): Promise<number>;\n getMaxLeverage(\n asset: string,\n providerId?: PerpsProviderType,\n ): Promise<number>;\n calculateFees(params: FeeCalculationParams): Promise<FeeCalculationResult>;\n /**\n * Read-only projection of the position that would remain after the proposed\n * order. Isolated-margin venues apply selected leverage to the whole\n * resulting position and use the maintenance tier at liquidation notional.\n * Cross-margin returns `{ status: 'unsupported', reason: 'cross_margin' }`.\n */\n previewPositionModify(\n params: PositionModifyPreviewParams,\n ): Promise<PositionModifyPreviewResult>;\n\n // Live data subscriptions → Direct UI (NO Redux, maximum speed)\n subscribeToPrices(params: SubscribePricesParams): () => void;\n subscribeToPositions(params: SubscribePositionsParams): () => void;\n subscribeToOrderFills(params: SubscribeOrderFillsParams): () => void;\n subscribeToOrders(params: SubscribeOrdersParams): () => void;\n subscribeToAccount(params: SubscribeAccountParams): () => void;\n subscribeToOICaps(params: SubscribeOICapsParams): () => void;\n subscribeToCandles(params: SubscribeCandlesParams): () => void;\n subscribeToOrderBook(params: SubscribeOrderBookParams): () => void;\n\n // Live data configuration\n setLiveDataConfig(config: Partial<LiveDataConfig>): void;\n\n // Connection management\n toggleTestnet(): Promise<ToggleTestnetResult>;\n initialize(): Promise<InitializeResult>;\n isReadyToTrade(): Promise<ReadyToTradeResult>;\n disconnect(): Promise<DisconnectResult>;\n ping(timeoutMs?: number): Promise<void>; // Lightweight WebSocket health check with configurable timeout\n getWebSocketConnectionState?(): WebSocketConnectionState; // Optional: get current WebSocket connection state\n subscribeToConnectionState?(\n listener: (\n state: WebSocketConnectionState,\n reconnectionAttempt: number,\n ) => void,\n ): () => void; // Optional: subscribe to WebSocket connection state changes\n reconnect?(): Promise<void>; // Optional: manually trigger WebSocket reconnection\n\n // Block explorer\n getBlockExplorerUrl(address?: string): string;\n\n // Fee discount context (optional - for MetaMask reward discounts)\n setUserFeeDiscount?(discountBips: number | undefined): void;\n // Full fee resolution context, including attribution source.\n setUserFeeResolution?(resolution: PerpsFeeResolution | undefined): void;\n /** Approve the dedicated subscription builder outside order submission. */\n approveSubscriptionBuilderFee?(): Promise<boolean>;\n\n // HIP-3 (Builder-deployed DEXs) operations - optional for backward compatibility\n /**\n * Get list of available HIP-3 builder-deployed DEXs\n *\n * @param params - Optional parameters (reserved for future filters/pagination)\n * @returns Array of DEX names (empty string '' represents main DEX)\n */\n getAvailableDexs?(params?: GetAvailableDexsParams): Promise<string[]>;\n\n /**\n * Fetch historical OHLCV candle data for a symbol.\n * Optional: only providers that support historical candles need to implement this.\n */\n fetchHistoricalCandles?(options: {\n symbol: string;\n interval: CandlePeriod;\n limit?: number;\n endTime?: number;\n }): Promise<CandleData>;\n};\n\n// ============================================================================\n// Multi-Provider Aggregation Types (Phase 1)\n// ============================================================================\n\n/**\n * Provider identifier type for multi-provider support.\n * Add new providers here as they are implemented.\n */\nexport type PerpsProviderType = 'hyperliquid' | 'lighter';\n\n/**\n * Active provider mode for PerpsController state.\n * - Direct providers: 'hyperliquid', 'lighter'\n * - 'aggregated': Multi-provider aggregation mode\n */\nexport type PerpsActiveProviderMode = PerpsProviderType | 'aggregated';\n\n/**\n * Aggregation mode for read operations.\n * - 'all': Aggregate data from all registered providers\n * - 'active': Only aggregate from providers with active connections\n * - 'specific': Aggregate from a specific subset of providers\n */\nexport type AggregationMode = 'all' | 'active' | 'specific';\n\n/**\n * Routing strategy for write operations.\n * Phase 1 only supports 'default_provider' - advanced strategies deferred to Phase 3.\n */\nexport type RoutingStrategy = 'default_provider';\n\n/**\n * Configuration for AggregatedPerpsProvider\n */\nexport type AggregatedProviderConfig = {\n /** Map of provider ID to provider instance */\n providers: Map<PerpsProviderType, PerpsProvider>;\n /** Default provider for write operations when providerId not specified */\n defaultProvider: PerpsProviderType;\n /** Aggregation mode for read operations (default: 'all') */\n aggregationMode?: AggregationMode;\n /** Platform dependencies for logging, metrics, etc. */\n infrastructure: PerpsPlatformDependencies;\n};\n\n/**\n * Provider-specific error with context for multi-provider error handling\n */\nexport type ProviderError = {\n /** Which provider the error originated from */\n providerId: PerpsProviderType;\n /** Human-readable error message */\n message: string;\n /** Original error object if available */\n originalError?: Error;\n /** Whether the operation can be retried */\n isRetryable?: boolean;\n};\n\n/**\n * Aggregated account state combining data from multiple providers\n */\nexport type AggregatedAccountState = {\n /** Combined totals across all providers */\n total: AccountState;\n /** Per-provider breakdown */\n byProvider: Map<PerpsProviderType, AccountState>;\n};\n\n// ============================================================================\n// Injectable Dependency Interfaces\n// These interfaces enable dependency injection for platform-specific services,\n// allowing PerpsController to be moved to core without mobile-specific imports.\n// ============================================================================\n\n/**\n * Injectable logger interface for error reporting.\n * Allows core package to be platform-agnostic (mobile: Sentry, extension: different impl)\n */\nexport type PerpsLogger = {\n error(\n error: Error,\n options?: {\n tags?: Record<string, string | number>;\n context?: { name: string; data: Record<string, unknown> };\n extras?: Record<string, unknown>;\n },\n ): void;\n};\n\n/**\n * Analytics events specific to Perps feature.\n * These are the actual event names sent to analytics backend.\n * Values must match the corresponding MetaMetricsEvents values in mobile for compatibility.\n *\n * When migrating to core monorepo, this enum travels with PerpsController.\n */\nexport enum PerpsAnalyticsEvent {\n WithdrawalTransaction = 'Perp Withdrawal Transaction',\n TradeTransaction = 'Perp Trade Transaction',\n PositionCloseTransaction = 'Perp Position Close Transaction',\n OrderCancelTransaction = 'Perp Order Cancel Transaction',\n ScreenViewed = 'Perp Screen Viewed',\n UiInteraction = 'Perp UI Interaction',\n RiskManagement = 'Perp Risk Management',\n PerpsError = 'Perp Error',\n AccountSetup = 'Perp Account Setup',\n // New funnel + search events.\n // Names must match MetaMetrics/Mixpanel exactly; no other event names may be added.\n TransactionConsidered = 'Perp Transaction Considered',\n TradeQuoteReceived = 'Perp Trade Quote Received',\n SearchQuery = 'Perp Search Query',\n SearchResultTapped = 'Perp Search Result Tapped',\n SearchAbandoned = 'Perp Search Abandoned',\n}\n\n/**\n * UTM / discovery attribution context for Perps analytics.\n *\n * Held transiently in-memory by PerpsController (never persisted in state) and\n * merged into analytics event properties so client-originated UTM attribution\n * can be propagated onto core-emitted transaction events.\n */\nexport type PerpsAttributionContext = {\n utmSource?: string;\n utmMedium?: string;\n utmCampaign?: string;\n utmContent?: string;\n utmTerm?: string;\n};\n\n/**\n * Perps-specific trace names. These must match TraceName enum values in mobile.\n * When in core monorepo, this defines the valid trace names for Perps operations.\n */\nexport type PerpsTraceName =\n | 'Perps Open Position'\n | 'Perps Close Position'\n | 'Perps Deposit'\n | 'Perps Withdraw'\n | 'Perps Place Order'\n | 'Perps Edit Order'\n | 'Perps Cancel Order'\n | 'Perps Update TP/SL'\n | 'Perps Update Margin'\n | 'Perps Flip Position'\n | 'Perps Market Data Update'\n | 'Perps Order View'\n | 'Perps Tab View'\n | 'Perps Market List View'\n | 'Perps Position Details View'\n | 'Perps Adjust Margin View'\n | 'Perps Order Details View'\n | 'Perps Order Book View'\n | 'Perps Flip Position Sheet'\n | 'Perps Transactions View'\n | 'Perps Order Fills Fetch'\n | 'Perps Orders Fetch'\n | 'Perps Funding Fetch'\n | 'Perps Get Positions'\n | 'Perps Get Account State'\n | 'Perps Get Historical Portfolio'\n | 'Perps Get Markets'\n | 'Perps Get Market Data With Prices'\n | 'Perps Fetch Historical Candles'\n | 'Perps WebSocket Connected'\n | 'Perps WebSocket Disconnected'\n | 'Perps WebSocket First Positions'\n | 'Perps WebSocket First Orders'\n | 'Perps WebSocket First Account'\n | 'Perps Data Lake Report'\n | 'Perps Rewards API Call'\n | 'Perps Close Position View'\n | 'Perps Withdraw View'\n | 'Perps Connection Establishment'\n | 'Perps Account Switch Reconnection'\n | 'Perps Market Data Preload'\n | 'Perps User Data Preload';\n\n/**\n * Perps trace name constants. Values match TraceName enum in mobile.\n * When in core, these ARE the source of truth - mobile will re-export from core.\n */\nexport const PerpsTraceNames = {\n // Trading operations\n PlaceOrder: 'Perps Place Order',\n EditOrder: 'Perps Edit Order',\n CancelOrder: 'Perps Cancel Order',\n ClosePosition: 'Perps Close Position',\n UpdateTpsl: 'Perps Update TP/SL',\n UpdateMargin: 'Perps Update Margin',\n FlipPosition: 'Perps Flip Position',\n\n // Account operations\n Withdraw: 'Perps Withdraw',\n Deposit: 'Perps Deposit',\n\n // Market data\n GetPositions: 'Perps Get Positions',\n GetAccountState: 'Perps Get Account State',\n GetMarkets: 'Perps Get Markets',\n GetMarketDataWithPrices: 'Perps Get Market Data With Prices',\n OrderFillsFetch: 'Perps Order Fills Fetch',\n OrdersFetch: 'Perps Orders Fetch',\n FundingFetch: 'Perps Funding Fetch',\n GetHistoricalPortfolio: 'Perps Get Historical Portfolio',\n FetchHistoricalCandles: 'Perps Fetch Historical Candles',\n\n // Data lake\n DataLakeReport: 'Perps Data Lake Report',\n\n // WebSocket\n WebsocketConnected: 'Perps WebSocket Connected',\n WebsocketDisconnected: 'Perps WebSocket Disconnected',\n WebsocketFirstPositions: 'Perps WebSocket First Positions',\n WebsocketFirstOrders: 'Perps WebSocket First Orders',\n WebsocketFirstAccount: 'Perps WebSocket First Account',\n\n // Other\n RewardsApiCall: 'Perps Rewards API Call',\n ConnectionEstablishment: 'Perps Connection Establishment',\n AccountSwitchReconnection: 'Perps Account Switch Reconnection',\n MarketDataPreload: 'Perps Market Data Preload',\n UserDataPreload: 'Perps User Data Preload',\n} as const satisfies Record<string, PerpsTraceName>;\n\n/**\n * Perps trace operation constants. Values match TraceOperation enum in mobile.\n * These categorize traces by type of operation for Sentry/observability filtering.\n */\nexport const PerpsTraceOperations = {\n Operation: 'perps.operation',\n OrderSubmission: 'perps.order_submission',\n PositionManagement: 'perps.position_management',\n MarketData: 'perps.market_data',\n} as const;\n\n/**\n * Values allowed in trace data/tags. Matches Sentry's TraceValue type.\n */\nexport type PerpsTraceValue = string | number | boolean;\n\n/**\n * Properties allowed in analytics events. More constrained than unknown.\n * Named PerpsAnalyticsProperties to avoid conflict with PERPS_EVENT_PROPERTY\n * constant object from eventNames.ts (which contains property key names).\n */\nexport type PerpsAnalyticsProperties = Record<\n string,\n string | number | boolean | Record<string, string> | null | undefined\n>;\n\n/**\n * Injectable metrics interface for analytics.\n * Allows core package to work with different analytics backends.\n */\nexport type PerpsMetrics = {\n isEnabled(): boolean;\n\n /**\n * Track a Perps-specific analytics event with properties.\n * This abstracts away the MetricsEventBuilder pattern used in mobile.\n *\n * @param event - The Perps analytics event type (enum with actual event name values)\n * @param properties - Type-safe key-value properties to attach to the event\n */\n trackPerpsEvent(\n event: PerpsAnalyticsEvent,\n properties: PerpsAnalyticsProperties,\n ): void;\n};\n\n/**\n * Injectable debug logger for development logging.\n * Only logs in development mode.\n * Accepts `unknown` to allow logging error objects from catch blocks.\n */\nexport type PerpsDebugLogger = {\n log(...args: unknown[]): void;\n};\n\n/**\n * Injectable stream manager interface for pause/resume during critical operations.\n *\n * WHY THIS IS NEEDED:\n * PerpsStreamManager is a React-based mobile-specific singleton that:\n * - Uses React Context for subscription management\n * - Uses react-native-performance for tracing\n * - Directly accesses Engine.context (mobile singleton pattern)\n * - Manages WebSocket connections with throttling/caching\n *\n * PerpsController only needs pause/resume during critical operations (withStreamPause method)\n * to prevent stale UI updates during batch operations. The minimal interface allows:\n * - Mobile: Wrap existing singleton (streamManager[channel].pause())\n * - Extension: Implement with whatever streaming solution they use\n */\n/**\n * Injectable stream manager interface for pause/resume during critical operations.\n *\n * WHY THIS IS NEEDED:\n * PerpsStreamManager is a React-based mobile-specific singleton that:\n * - Uses React Context for subscription management\n * - Uses react-native-performance for tracing\n * - Directly accesses Engine.context (mobile singleton pattern)\n * - Manages WebSocket connections with throttling/caching\n *\n * PerpsController only needs pause/resume during critical operations (withStreamPause method)\n * to prevent stale UI updates during batch operations. The minimal interface allows:\n * - Mobile: Wrap existing singleton (streamManager[channel].pause())\n * - Extension: Implement with whatever streaming solution they use\n */\nexport type PerpsStreamManager = {\n pauseChannel(channel: string): void;\n resumeChannel(channel: string): void;\n clearAllChannels(): void;\n};\n\n/**\n * Injectable performance monitor interface.\n * Wraps react-native-performance or browser Performance API.\n */\nexport type PerpsPerformance = {\n now(): number;\n /**\n * Optional platform hook invoked once after constructor disk hydration.\n * Receives `performance.now()` — not a Sentry write.\n */\n onControllerConstructed?: (monotonicMs: number) => void;\n};\n\ntype PerpsSetMeasurement = ((\n name: string,\n value: number,\n unit: string,\n) => void) &\n ((name: string, value: number, unit: string, id: string) => void);\n\n/**\n * Injectable tracer interface for Sentry/observability tracing.\n * Services use this to create spans and measure operation durations.\n *\n * Note: trace() returns void because services use name/id pairs to identify traces.\n * The actual span management is handled internally by the platform adapter.\n */\nexport type PerpsTracer = {\n trace(params: {\n name: PerpsTraceName;\n id: string;\n op: string;\n tags?: Record<string, PerpsTraceValue>;\n data?: Record<string, PerpsTraceValue>;\n }): void;\n\n endTrace(params: {\n name: PerpsTraceName;\n id: string;\n data?: Record<string, PerpsTraceValue>;\n }): void;\n\n setMeasurement: PerpsSetMeasurement;\n\n addBreadcrumb(breadcrumb: {\n category: string;\n message: string;\n level: 'fatal' | 'error' | 'warning' | 'log' | 'info' | 'debug';\n data?: Record<string, unknown>;\n }): void;\n};\n\n// ============================================================================\n// Minimal local types for cross-controller DI (no external controller imports)\n// ============================================================================\n\n/**\n * Minimal typed-message params passed to keyring for EIP-712 signing.\n * Structurally matches KeyringController's TypedMessageParams.\n */\nexport type PerpsTypedMessageParams = {\n from: string;\n data: unknown;\n};\n\n/**\n * Minimal transaction params passed to TransactionController.addTransaction.\n * Only the fields PerpsController actually sets.\n */\nexport type PerpsTransactionParams = {\n from: string;\n to?: string;\n value?: string;\n data?: string;\n gas?: string;\n};\n\n/**\n * Options passed to TransactionController.addTransaction.\n */\nexport type PerpsAddTransactionOptions = {\n networkClientId: string;\n origin?: string;\n type?: string;\n skipInitialGasEstimate?: boolean;\n};\n\n/**\n * Minimal account shape read from AccountTreeController.\n * Only the fields PerpsController and its services actually use.\n */\nexport type PerpsInternalAccount = {\n address: string;\n type: string;\n id: string;\n};\n\n/**\n * Minimal remote feature flag state shape.\n * Only the remoteFeatureFlags record is needed by PerpsController.\n */\nexport type PerpsRemoteFeatureFlagState = {\n remoteFeatureFlags: Record<string, unknown>;\n};\n\n/**\n * Injectable interface for the Terminal-market service.\n *\n * `MarketDataService` programs against this contract so the concrete\n * `TerminalMarketService` class (which lives in `services/`) never leaks\n * into the types barrel — callers can supply any implementation that\n * satisfies the shape (production, stub, mock, etc.).\n */\nexport type PerpsTerminalMarketService = {\n fetchMarkets(): Promise<{\n markets: MarketInfo[];\n metadata: Map<string, TerminalAssetMetadata>;\n }>;\n clearCache(): void;\n logError(error: unknown, method: string): void;\n fetchGlobalSnapshot?(\n request: PerpsGlobalSnapshotRequest,\n ): Promise<PerpsGlobalSnapshotResult>;\n};\n\n/** Exact identity a client expects from an atomic global Perps snapshot. */\nexport type PerpsGlobalSnapshotRequest = {\n provider: 'hyperliquid';\n network: 'mainnet' | 'testnet';\n enabledDexes: string[];\n};\n\n/** Validated snapshot data and its source-bounded expiry. */\nexport type PerpsGlobalSnapshotResult = {\n markets: PerpsMarketData[];\n expiresAt: number;\n};\n\n/**\n * Platform dependencies for PerpsController and services.\n *\n * Architecture:\n * - Observability: logger, debugLogger, metrics, performance, tracer\n * - Platform: streamManager (mobile/extension specific)\n * - Cache: cache invalidation for standalone queries\n * - Rewards: delegated rewards interaction (DI — no RewardsController in Core yet)\n *\n * Cross-controller communication uses the messenger pattern (messenger.call).\n * Only rewards remains as DI because RewardsController is not yet in Core.\n */\nexport type PerpsPlatformDependencies = {\n // === Observability (stateless utilities) ===\n logger: PerpsLogger;\n debugLogger: PerpsDebugLogger;\n metrics: PerpsMetrics;\n performance: PerpsPerformance;\n tracer: PerpsTracer;\n\n // === Platform Services (mobile/extension specific) ===\n streamManager: PerpsStreamManager;\n\n // === Feature Flags (platform-specific version gating) ===\n featureFlags: {\n /**\n * Validate a version-gated feature flag against current app version.\n * Returns true if flag is enabled AND app meets minimum version,\n * false if flag is disabled, or undefined if flag is misconfigured/overridden.\n *\n * Platform-specific because it uses react-native-device-info (mobile)\n * or browser APIs (extension) to get the app version.\n */\n validateVersionGated(flag: VersionGatedFeatureFlag): boolean | undefined;\n };\n\n // === Market Data Formatting (platform-specific number formatting) ===\n marketDataFormatters: MarketDataFormatters;\n\n // === Cache Invalidation (for standalone query caches) ===\n cacheInvalidator: PerpsCacheInvalidator;\n\n // === Disk Cache (cold-start persistence) ===\n diskCache: {\n getItem(key: string): Promise<string | null>;\n getItemSync?(key: string): string | null;\n setItem(key: string, value: string): Promise<void>;\n removeItem(key: string): Promise<void>;\n };\n\n // === Terminal API (market metadata source) ===\n terminalApi?: {\n /** Full endpoint URL for the legacy perpetuals market-data endpoint. */\n marketDataUrl?: string;\n\n /** Full endpoint URL for the schema-v2 atomic global Perps snapshot. */\n globalSnapshotUrl?: string;\n };\n\n /** @deprecated Use `terminalApi.marketDataUrl`. */\n terminalApiUrl?: string;\n\n /**\n * Optional Terminal-market service instance for fetching structured market\n * metadata from the MetaMask Terminal API.\n *\n * When provided, `MarketDataService` uses this service to attempt the\n * Terminal API path before falling back to the provider.\n * Clients that do not use the Terminal API can omit this field.\n */\n terminalMarketService?: PerpsTerminalMarketService;\n\n // === Rewards (DI — no RewardsController in Core yet) ===\n rewards: {\n /**\n * Get fee discount for an account from the RewardsController.\n * Returns discount in basis points (e.g., 6500 = 65% discount), or null\n * when subscription state hasn't hydrated yet — callers should skip\n * caching null results and retry on the next fee calculation.\n *\n * Pass the perps MetaMask builder base fee in bips so the rewards\n * controller can convert an absolute VIP fee into a discount fraction.\n */\n getPerpsDiscountForAccount(\n caipAccountId: `${string}:${string}:${string}`,\n baseFeeBips: number,\n ): Promise<number | null>;\n };\n\n // === Subscription (DI — benefits endpoint is owned by the Subscription team) ===\n /**\n * Optional subscription source for the unified fee resolver.\n *\n * The client owns the Profile JWT, so it performs\n * `GET /v1/profiles/{profileId}/benefits` and hands the perps controller the\n * parsed body. The controller caches the result stale-while-revalidate and\n * never awaits this call on the order-signing path.\n *\n * Omit it entirely on clients that do not ship the subscription waiver; the\n * resolver then falls back to the rewards and default sources.\n */\n subscription?: {\n /**\n * Read the current profile's subscription benefits.\n * Resolve `null` when there is no subscription to report (signed out, no\n * profile). Rejections are tolerated: the resolver keeps the previous\n * snapshot and never grants the waiver from a failed read.\n */\n getPerpsBenefits(): Promise<PerpsSubscriptionBenefits | null>;\n };\n};\n\n/**\n * Cache types that can be invalidated.\n * Used by standalone query caches (e.g., usePerpsPositionForAsset).\n */\nexport type PerpsCacheType = 'positions' | 'accountState' | 'markets';\n\n/**\n * Parameters for invalidating a specific cache type.\n */\nexport type InvalidateCacheParams = {\n /** The type of cache to invalidate */\n cacheType: PerpsCacheType;\n};\n\n/**\n * Cache invalidation interface for standalone query caches.\n * Allows services to signal when data has changed without depending on\n * mobile-specific implementations.\n */\nexport type PerpsCacheInvalidator = {\n /**\n * Invalidate a specific cache type.\n * Notifies all subscribers that cached data is stale.\n */\n invalidate(params: InvalidateCacheParams): void;\n\n /**\n * Invalidate all cache types.\n */\n invalidateAll(): void;\n};\n\n// ============================================================================\n// Market Data Formatting\n// ============================================================================\n\n/**\n * Injectable formatters for market data transformation.\n * Decouples marketDataTransform from mobile-specific intl/formatUtils imports.\n *\n * Range configs are opaque (unknown[]) because the concrete type\n * (FiatRangeConfig on mobile) is platform-specific. The formatter\n * implementation casts internally.\n */\nexport type MarketDataFormatters = {\n /** Format a number as a USD volume string (e.g., '$1.2B', '$850M') */\n formatVolume(value: number): string;\n /** Format a number as a USD fiat string with adaptive precision */\n formatPerpsFiat(value: number, options?: { ranges?: unknown[] }): string;\n /** Format a number as a percentage string (e.g., '2.50%', '-1.80%') */\n formatPercentage(percent: number): string;\n /** Universal price ranges for formatting (opaque to portable code) */\n priceRangesUniversal: unknown[];\n};\n\n// ============================================================================\n// Payment Token (portable replacement for mobile-only AssetType)\n// ============================================================================\n\n/**\n * Minimal payment token for deposit flow.\n * Only the fields actually used by PerpsController are included.\n * Replaces the mobile-only AssetType (which extends TokenI and uses ImageSourcePropType).\n */\nexport type PaymentToken = {\n description?: string;\n address: string;\n chainId?: string;\n symbol?: string;\n};\n\n/**\n * Selected pay-with token shape used in PerpsController state, pending trade config,\n * selectors, and UI hooks. Use this type everywhere this shape is needed.\n */\nexport type PerpsSelectedPaymentToken = {\n description?: string;\n address: string;\n chainId: string;\n symbol?: string;\n};\n\n// ============================================================================\n// Version-gated Feature Flag (portable)\n// ============================================================================\n\n/**\n * Structure for a version-gated feature flag from LaunchDarkly.\n * Portable: no platform-specific imports.\n */\nexport type VersionGatedFeatureFlag = {\n enabled: boolean;\n minimumVersion: string;\n};\n\n/**\n * Type guard for VersionGatedFeatureFlag.\n * Pure logic, no platform dependencies.\n *\n * @param value - The value to check.\n * @returns True if the value is a VersionGatedFeatureFlag.\n */\nexport function isVersionGatedFeatureFlag(\n value: unknown,\n): value is VersionGatedFeatureFlag {\n return (\n typeof value === 'object' &&\n value !== null &&\n hasProperty(value, 'enabled') &&\n hasProperty(value, 'minimumVersion') &&\n typeof (value as { enabled: unknown }).enabled === 'boolean' &&\n typeof (value as { minimumVersion: unknown }).minimumVersion === 'string'\n );\n}\n\n// ============================================================================\n// Sub-module type re-exports\n// These types live in separate files within types/ and need to be accessible\n// from the root barrel via `export * from './types.js'`.\n// ============================================================================\nexport type * from './perps-types.js';\nexport * from './transactionTypes.js';\n// hyperliquid-types: selective export to avoid OrderType clash with main types\nexport type {\n AssetPosition,\n SpotBalance,\n PerpsUniverse,\n PerpsAssetCtx,\n PredictedFunding,\n FrontendOrder,\n SDKOrderParams,\n ClearinghouseStateResponse,\n SpotClearinghouseStateResponse,\n MetaResponse,\n FrontendOpenOrdersResponse,\n AllMidsResponse,\n MetaAndAssetCtxsResponse,\n PredictedFundingsResponse,\n SpotMetaResponse,\n} from './hyperliquid-types.js';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"marketUtils.d.ts","sourceRoot":"","sources":["../../src/utils/marketUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,yBAAyB,CAAC;AAGvE,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,eAAe,EAAE,GACzB,eAAe,EAAE,CAanB;AASD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,WACf,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,cAAc,CAAC,KACvD,OAAiE,CAAC;AAErE;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAkBT;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,gBAAgB,CAQ7E;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,eAAe,EAAE,EAC1B,MAAM,CAAC,EAAE,6BAA6B,GACrC,eAAe,EAAE,CA6BnB;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,oBAAoB,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MACG,CAAC;AAE9C,eAAO,MAAM,qBAAqB,YAAa,MAAM,KAAG,OA4BvD,CAAC;AAEF,eAAO,MAAM,oBAAoB,YA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,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CA2B7B,CAAC;AAEF,eAAO,MAAM,oBAAoB,YACtB,eAAe,EAAE,eACb,MAAM,KAClB,eAAe,EAYjB,CAAC"}
@@ -48,6 +48,14 @@ export function matchesCategory(market, category) {
48
48
  case 'crypto':
49
49
  // Main-DEX markets, plus HIP-3 assets explicitly typed as CryptoCurrency.
50
50
  return !isHip3Market(market) || market.marketType === 'crypto';
51
+ case 'memecoin':
52
+ // Derived category: a crypto market that carries the 'memecoin' tag.
53
+ // Aligned with the 'crypto' case above so tagged main-DEX markets
54
+ // still match when their marketType is unset (the common
55
+ // provider-sourced shape prior to Terminal enrichment). Overlaps
56
+ // with 'crypto' by design — memecoins appear under both pills.
57
+ return ((!isHip3Market(market) || market.marketType === 'crypto') &&
58
+ (market.tags?.includes('memecoin') ?? false));
51
59
  default:
52
60
  // Every other filter is a 1:1 data-model category match.
53
61
  return market.marketType !== undefined && market.marketType === category;
@@ -1 +1 @@
1
- {"version":3,"file":"marketUtils.js","sourceRoot":"","sources":["../../src/utils/marketUtils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,UAAU,oBAAoB,CAClC,OAA0B;IAE1B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC9B,GAAG,MAAM;QACT,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1D,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,GAAG,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,UAAU,EAAE,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QAChE,GAAG,CA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AC,MAAM,CAC5C,CAAC,MAAmB,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,kBAAkB,CAC3D,CAAC;IAEF,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,cAAc,GAAG,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,MAAmB,EAAE,EAAE,CACvD,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CACxB,CAAC;IACF,MAAM,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,MAAmB,EAAE,EAAE,CACtD,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CACvB,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACxB,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;KACvB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,OAA0B,EAC1B,WAAmB,EACA,EAAE;IACrB,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC;QACzB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IAEpD,OAAO,OAAO,CAAC,MAAM,CACnB,CAAC,MAAM,EAAE,EAAE,CACT,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;QACjD,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAClD,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type {\n GetMarketDataWithPricesParams,\n MarketTypeFilter,\n PerpsMarketData,\n} from '../types/index.js';\nimport type { CandleData, CandleStick } from '../types/perps-types.js';\nimport { sortMarkets } from './sortMarkets.js';\n\nexport function clonePerpsMarketData(\n markets: PerpsMarketData[],\n): PerpsMarketData[] {\n return markets.map((market) => ({\n ...market,\n ...(market.keywords && { keywords: [...market.keywords] }),\n ...(market.tags && { tags: [...market.tags] }),\n ...(market.categories && { categories: [...market.categories] }),\n ...(market.trend && {\n trend: market.trend.map(([timestamp, price]): [number, string] => [\n timestamp,\n price,\n ]),\n }),\n }));\n}\n\n// ============================================================================\n// Market category classification (pure functions)\n// No service dependencies — pure data transformations that can be tested and\n// reused independently. `matchesCategory` and `getMarketTypeFilter` share the\n// same category model.\n// ============================================================================\n\n/**\n * Whether a market is a HIP-3 (non-main-DEX) market. A `marketSource` DEX id\n * marks a HIP-3 market even when the `isHip3` flag is unset (e.g. partial route\n * params), so both signals are checked. Used as the single HIP-3 signal so the\n * classifiers stay consistent.\n *\n * @param market - The market data to test.\n * @returns True if the market is HIP-3.\n */\nexport const isHip3Market = (\n market: Pick<PerpsMarketData, 'isHip3' | 'marketSource'>,\n): boolean => Boolean(market.isHip3) || Boolean(market.marketSource);\n\n/**\n * Returns true when a market matches the given UI filter category.\n *\n * @param market - The market data to test.\n * @param category - The filter category to test against.\n * @returns Whether the market matches the category.\n */\nexport function matchesCategory(\n market: PerpsMarketData,\n category: MarketTypeFilter,\n): boolean {\n switch (category) {\n case 'all':\n return true;\n case 'new':\n // Explicitly flagged, or an uncategorized HIP-3 market (kept in sync with\n // getMarketTypeFilter's 'new' bucket).\n return (\n market.isNewMarket === true ||\n (isHip3Market(market) && market.marketType === undefined)\n );\n case 'crypto':\n // Main-DEX markets, plus HIP-3 assets explicitly typed as CryptoCurrency.\n return !isHip3Market(market) || market.marketType === 'crypto';\n default:\n // Every other filter is a 1:1 data-model category match.\n return market.marketType !== undefined && market.marketType === category;\n }\n}\n\n/**\n * Resolve the user-facing category bucket for a market — one of `crypto`,\n * `stock`, `pre-ipo`, `index`, `etf`, `commodity`, `forex`, or `new`. Data-model\n * categories map 1:1. A market with no data-model category is `crypto` when it\n * is main-DEX, or `new` when it is an uncategorized HIP-3 market (`isHip3`, or a\n * `marketSource` DEX id when `isHip3` is unset, e.g. minimal route params).\n * Never returns the `all` sentinel.\n *\n * Centralised as the single source of truth so consumers (e.g. category\n * shortcuts, related markets) share one classification instead of re-deriving\n * it per client and drifting as new categories are added.\n *\n * @param market - The market data to classify.\n * @returns The market type filter bucket.\n */\nexport function getMarketTypeFilter(market: PerpsMarketData): MarketTypeFilter {\n const { marketType } = market;\n if (marketType) {\n return marketType;\n }\n // No data-model category: an uncategorized HIP-3 market is the 'new' bucket;\n // otherwise it's a main-DEX crypto market.\n return isHip3Market(market) ? 'new' : 'crypto';\n}\n\n/**\n * Applies optional category filtering, sorting, and limit to a list of markets.\n *\n * @param markets - Source market array.\n * @param params - Optional filter/sort/limit params.\n * @returns Filtered, sorted, and/or sliced market array.\n */\nexport function applyMarketFilters(\n markets: PerpsMarketData[],\n params?: GetMarketDataWithPricesParams,\n): PerpsMarketData[] {\n let result = markets;\n\n if (params?.categories?.length) {\n const { categories } = params;\n result = result.filter((market) =>\n // A market is included if it matches ANY of the requested categories.\n categories.some((category) => matchesCategory(market, category)),\n );\n }\n\n if (params?.excludeSymbols?.length) {\n const excluded = new Set(params.excludeSymbols);\n result = result.filter((market) => !excluded.has(market.symbol));\n }\n\n if (params?.sortBy) {\n result = sortMarkets({\n markets: result,\n sortBy: params.sortBy,\n direction: params.direction,\n });\n }\n\n if (params?.limit !== undefined) {\n result = result.slice(0, params.limit);\n }\n\n return result;\n}\n\n/**\n * Maximum length for market filter patterns (prevents DoS attacks)\n */\nexport const MAX_MARKET_PATTERN_LENGTH = 100;\n\nexport type MarketPatternMatcher = RegExp | string;\n\nexport type CompiledMarketPattern = {\n pattern: string;\n matcher: MarketPatternMatcher;\n};\n\nexport const escapeRegex = (str: string): string =>\n str.replace(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n\nexport const validateMarketPattern = (pattern: string): boolean => {\n if (!pattern || pattern.trim().length === 0) {\n throw new Error('Market pattern cannot be empty');\n }\n\n const normalizedPattern = pattern.trim();\n\n if (normalizedPattern.length > MAX_MARKET_PATTERN_LENGTH) {\n throw new Error(\n `Market pattern exceeds maximum length (${MAX_MARKET_PATTERN_LENGTH} chars): ${normalizedPattern}`,\n );\n }\n\n const dangerousChars = /[\\\\()[\\]{}^$+?.|]/u;\n if (dangerousChars.test(normalizedPattern)) {\n throw new Error(\n `Market pattern contains invalid regex characters: ${normalizedPattern}`,\n );\n }\n\n const validPattern = /^[a-zA-Z0-9:_\\-*]+$/u;\n if (!validPattern.test(normalizedPattern)) {\n throw new Error(\n `Market pattern contains invalid characters: ${normalizedPattern}`,\n );\n }\n\n return true;\n};\n\nexport const compileMarketPattern = (pattern: string): MarketPatternMatcher => {\n const normalizedPattern = pattern.trim();\n validateMarketPattern(normalizedPattern);\n\n if (normalizedPattern.endsWith(':*')) {\n const prefix = normalizedPattern.slice(0, -2);\n return new RegExp(`^${escapeRegex(prefix)}:`, 'u');\n }\n\n if (!normalizedPattern.includes(':')) {\n return new RegExp(`^${escapeRegex(normalizedPattern)}:`, 'u');\n }\n\n return normalizedPattern;\n};\n\nexport const matchesMarketPattern = (\n symbol: string,\n matcher: MarketPatternMatcher,\n): boolean => {\n if (typeof matcher === 'string') {\n return symbol === matcher;\n }\n\n return matcher.test(symbol);\n};\n\nexport const shouldIncludeMarket = (\n symbol: string,\n dex: string | null,\n hip3Enabled: boolean,\n compiledEnabledPatterns: CompiledMarketPattern[],\n compiledBlockedPatterns: CompiledMarketPattern[],\n): boolean => {\n if (dex === null) {\n return true;\n }\n\n if (!hip3Enabled) {\n return false;\n }\n\n if (compiledEnabledPatterns.length > 0) {\n const whitelisted = compiledEnabledPatterns.some(({ matcher }) =>\n matchesMarketPattern(symbol, matcher),\n );\n if (!whitelisted) {\n return false;\n }\n }\n\n if (compiledBlockedPatterns.length === 0) {\n return true;\n }\n\n const blacklisted = compiledBlockedPatterns.some(({ matcher }) =>\n matchesMarketPattern(symbol, matcher),\n );\n\n return !blacklisted;\n};\n\nexport const getPerpsDisplaySymbol = (symbol: string): string => {\n if (!symbol || typeof symbol !== 'string') {\n return symbol;\n }\n\n const colonIndex = symbol.indexOf(':');\n if (colonIndex > 0 && colonIndex < symbol.length - 1) {\n return symbol.substring(colonIndex + 1);\n }\n\n return symbol;\n};\n\nexport const getPerpsDexFromSymbol = (symbol: string): string | null => {\n if (!symbol || typeof symbol !== 'string') {\n return null;\n }\n\n const colonIndex = symbol.indexOf(':');\n if (colonIndex > 0 && colonIndex < symbol.length - 1) {\n return symbol.substring(0, colonIndex);\n }\n\n return null;\n};\n\ntype FundingCountdownParams = {\n nextFundingTime?: number;\n fundingIntervalHours?: number;\n};\n\nexport const calculateFundingCountdown = (\n params?: FundingCountdownParams,\n): string => {\n const now = new Date();\n const nowMs = now.getTime();\n\n if (params?.nextFundingTime && params.nextFundingTime > nowMs) {\n const msUntilFunding = params.nextFundingTime - nowMs;\n const hoursUntilFunding = msUntilFunding / (1000 * 60 * 60);\n\n if (hoursUntilFunding <= 1.1) {\n const totalSeconds = Math.floor(msUntilFunding / 1000);\n\n const hours = Math.floor(totalSeconds / 3600);\n const minutes = Math.floor((totalSeconds % 3600) / 60);\n const seconds = totalSeconds % 60;\n\n const formattedHours = String(hours).padStart(2, '0');\n const formattedMinutes = String(minutes).padStart(2, '0');\n const formattedSeconds = String(seconds).padStart(2, '0');\n\n return `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;\n }\n }\n\n const utcMinutes = now.getUTCMinutes();\n const utcSeconds = now.getUTCSeconds();\n\n const minutesUntilNextHour = 59 - utcMinutes;\n const secondsUntilNextHour = 60 - utcSeconds;\n\n const finalSeconds = secondsUntilNextHour === 60 ? 0 : secondsUntilNextHour;\n const finalMinutes =\n secondsUntilNextHour === 60\n ? minutesUntilNextHour + 1\n : minutesUntilNextHour;\n\n const finalHours = finalMinutes === 60 ? 1 : 0;\n const adjustedMinutes = finalMinutes === 60 ? 0 : finalMinutes;\n\n const formattedHours = String(finalHours).padStart(2, '0');\n const formattedMinutes = String(adjustedMinutes).padStart(2, '0');\n const formattedSeconds = String(finalSeconds).padStart(2, '0');\n\n return `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;\n};\n\nexport const calculate24hHighLow = (\n candleData: CandleData | null,\n): { high: number; low: number } => {\n if (!candleData?.candles || candleData.candles.length === 0) {\n return { high: 0, low: 0 };\n }\n\n const now = Date.now();\n const twentyFourHoursAgo = now - 24 * 60 * 60 * 1000;\n\n let last24hCandles = candleData.candles.filter(\n (candle: CandleStick) => candle.time >= twentyFourHoursAgo,\n );\n\n if (last24hCandles.length === 0) {\n last24hCandles = [...candleData.candles];\n }\n\n const highs = last24hCandles.map((candle: CandleStick) =>\n parseFloat(candle.high),\n );\n const lows = last24hCandles.map((candle: CandleStick) =>\n parseFloat(candle.low),\n );\n\n return {\n high: Math.max(...highs),\n low: Math.min(...lows),\n };\n};\n\nexport const filterMarketsByQuery = (\n markets: PerpsMarketData[],\n searchQuery: string,\n): PerpsMarketData[] => {\n if (!searchQuery?.trim()) {\n return markets;\n }\n\n const lowerQuery = searchQuery.toLowerCase().trim();\n\n return markets.filter(\n (market) =>\n market.symbol?.toLowerCase().includes(lowerQuery) ||\n market.name?.toLowerCase().includes(lowerQuery),\n );\n};\n"]}
1
+ {"version":3,"file":"marketUtils.js","sourceRoot":"","sources":["../../src/utils/marketUtils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,UAAU,oBAAoB,CAClC,OAA0B;IAE1B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC9B,GAAG,MAAM;QACT,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1D,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,IAAI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OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IAEpD,OAAO,OAAO,CAAC,MAAM,CACnB,CAAC,MAAM,EAAE,EAAE,CACT,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;QACjD,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAClD,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type {\n GetMarketDataWithPricesParams,\n MarketTypeFilter,\n PerpsMarketData,\n} from '../types/index.js';\nimport type { CandleData, CandleStick } from '../types/perps-types.js';\nimport { sortMarkets } from './sortMarkets.js';\n\nexport function clonePerpsMarketData(\n markets: PerpsMarketData[],\n): PerpsMarketData[] {\n return markets.map((market) => ({\n ...market,\n ...(market.keywords && { keywords: [...market.keywords] }),\n ...(market.tags && { tags: [...market.tags] }),\n ...(market.categories && { categories: [...market.categories] }),\n ...(market.trend && {\n trend: market.trend.map(([timestamp, price]): [number, string] => [\n timestamp,\n price,\n ]),\n }),\n }));\n}\n\n// ============================================================================\n// Market category classification (pure functions)\n// No service dependencies — pure data transformations that can be tested and\n// reused independently. `matchesCategory` and `getMarketTypeFilter` share the\n// same category model.\n// ============================================================================\n\n/**\n * Whether a market is a HIP-3 (non-main-DEX) market. A `marketSource` DEX id\n * marks a HIP-3 market even when the `isHip3` flag is unset (e.g. partial route\n * params), so both signals are checked. Used as the single HIP-3 signal so the\n * classifiers stay consistent.\n *\n * @param market - The market data to test.\n * @returns True if the market is HIP-3.\n */\nexport const isHip3Market = (\n market: Pick<PerpsMarketData, 'isHip3' | 'marketSource'>,\n): boolean => Boolean(market.isHip3) || Boolean(market.marketSource);\n\n/**\n * Returns true when a market matches the given UI filter category.\n *\n * @param market - The market data to test.\n * @param category - The filter category to test against.\n * @returns Whether the market matches the category.\n */\nexport function matchesCategory(\n market: PerpsMarketData,\n category: MarketTypeFilter,\n): boolean {\n switch (category) {\n case 'all':\n return true;\n case 'new':\n // Explicitly flagged, or an uncategorized HIP-3 market (kept in sync with\n // getMarketTypeFilter's 'new' bucket).\n return (\n market.isNewMarket === true ||\n (isHip3Market(market) && market.marketType === undefined)\n );\n case 'crypto':\n // Main-DEX markets, plus HIP-3 assets explicitly typed as CryptoCurrency.\n return !isHip3Market(market) || market.marketType === 'crypto';\n case 'memecoin':\n // Derived category: a crypto market that carries the 'memecoin' tag.\n // Aligned with the 'crypto' case above so tagged main-DEX markets\n // still match when their marketType is unset (the common\n // provider-sourced shape prior to Terminal enrichment). Overlaps\n // with 'crypto' by design — memecoins appear under both pills.\n return (\n (!isHip3Market(market) || market.marketType === 'crypto') &&\n (market.tags?.includes('memecoin') ?? false)\n );\n default:\n // Every other filter is a 1:1 data-model category match.\n return market.marketType !== undefined && market.marketType === category;\n }\n}\n\n/**\n * Resolve the user-facing category bucket for a market — one of `crypto`,\n * `stock`, `pre-ipo`, `index`, `etf`, `commodity`, `forex`, or `new`. Data-model\n * categories map 1:1. A market with no data-model category is `crypto` when it\n * is main-DEX, or `new` when it is an uncategorized HIP-3 market (`isHip3`, or a\n * `marketSource` DEX id when `isHip3` is unset, e.g. minimal route params).\n * Never returns the `all` sentinel.\n *\n * Centralised as the single source of truth so consumers (e.g. category\n * shortcuts, related markets) share one classification instead of re-deriving\n * it per client and drifting as new categories are added.\n *\n * @param market - The market data to classify.\n * @returns The market type filter bucket.\n */\nexport function getMarketTypeFilter(market: PerpsMarketData): MarketTypeFilter {\n const { marketType } = market;\n if (marketType) {\n return marketType;\n }\n // No data-model category: an uncategorized HIP-3 market is the 'new' bucket;\n // otherwise it's a main-DEX crypto market.\n return isHip3Market(market) ? 'new' : 'crypto';\n}\n\n/**\n * Applies optional category filtering, sorting, and limit to a list of markets.\n *\n * @param markets - Source market array.\n * @param params - Optional filter/sort/limit params.\n * @returns Filtered, sorted, and/or sliced market array.\n */\nexport function applyMarketFilters(\n markets: PerpsMarketData[],\n params?: GetMarketDataWithPricesParams,\n): PerpsMarketData[] {\n let result = markets;\n\n if (params?.categories?.length) {\n const { categories } = params;\n result = result.filter((market) =>\n // A market is included if it matches ANY of the requested categories.\n categories.some((category) => matchesCategory(market, category)),\n );\n }\n\n if (params?.excludeSymbols?.length) {\n const excluded = new Set(params.excludeSymbols);\n result = result.filter((market) => !excluded.has(market.symbol));\n }\n\n if (params?.sortBy) {\n result = sortMarkets({\n markets: result,\n sortBy: params.sortBy,\n direction: params.direction,\n });\n }\n\n if (params?.limit !== undefined) {\n result = result.slice(0, params.limit);\n }\n\n return result;\n}\n\n/**\n * Maximum length for market filter patterns (prevents DoS attacks)\n */\nexport const MAX_MARKET_PATTERN_LENGTH = 100;\n\nexport type MarketPatternMatcher = RegExp | string;\n\nexport type CompiledMarketPattern = {\n pattern: string;\n matcher: MarketPatternMatcher;\n};\n\nexport const escapeRegex = (str: string): string =>\n str.replace(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n\nexport const validateMarketPattern = (pattern: string): boolean => {\n if (!pattern || pattern.trim().length === 0) {\n throw new Error('Market pattern cannot be empty');\n }\n\n const normalizedPattern = pattern.trim();\n\n if (normalizedPattern.length > MAX_MARKET_PATTERN_LENGTH) {\n throw new Error(\n `Market pattern exceeds maximum length (${MAX_MARKET_PATTERN_LENGTH} chars): ${normalizedPattern}`,\n );\n }\n\n const dangerousChars = /[\\\\()[\\]{}^$+?.|]/u;\n if (dangerousChars.test(normalizedPattern)) {\n throw new Error(\n `Market pattern contains invalid regex characters: ${normalizedPattern}`,\n );\n }\n\n const validPattern = /^[a-zA-Z0-9:_\\-*]+$/u;\n if (!validPattern.test(normalizedPattern)) {\n throw new Error(\n `Market pattern contains invalid characters: ${normalizedPattern}`,\n );\n }\n\n return true;\n};\n\nexport const compileMarketPattern = (pattern: string): MarketPatternMatcher => {\n const normalizedPattern = pattern.trim();\n validateMarketPattern(normalizedPattern);\n\n if (normalizedPattern.endsWith(':*')) {\n const prefix = normalizedPattern.slice(0, -2);\n return new RegExp(`^${escapeRegex(prefix)}:`, 'u');\n }\n\n if (!normalizedPattern.includes(':')) {\n return new RegExp(`^${escapeRegex(normalizedPattern)}:`, 'u');\n }\n\n return normalizedPattern;\n};\n\nexport const matchesMarketPattern = (\n symbol: string,\n matcher: MarketPatternMatcher,\n): boolean => {\n if (typeof matcher === 'string') {\n return symbol === matcher;\n }\n\n return matcher.test(symbol);\n};\n\nexport const shouldIncludeMarket = (\n symbol: string,\n dex: string | null,\n hip3Enabled: boolean,\n compiledEnabledPatterns: CompiledMarketPattern[],\n compiledBlockedPatterns: CompiledMarketPattern[],\n): boolean => {\n if (dex === null) {\n return true;\n }\n\n if (!hip3Enabled) {\n return false;\n }\n\n if (compiledEnabledPatterns.length > 0) {\n const whitelisted = compiledEnabledPatterns.some(({ matcher }) =>\n matchesMarketPattern(symbol, matcher),\n );\n if (!whitelisted) {\n return false;\n }\n }\n\n if (compiledBlockedPatterns.length === 0) {\n return true;\n }\n\n const blacklisted = compiledBlockedPatterns.some(({ matcher }) =>\n matchesMarketPattern(symbol, matcher),\n );\n\n return !blacklisted;\n};\n\nexport const getPerpsDisplaySymbol = (symbol: string): string => {\n if (!symbol || typeof symbol !== 'string') {\n return symbol;\n }\n\n const colonIndex = symbol.indexOf(':');\n if (colonIndex > 0 && colonIndex < symbol.length - 1) {\n return symbol.substring(colonIndex + 1);\n }\n\n return symbol;\n};\n\nexport const getPerpsDexFromSymbol = (symbol: string): string | null => {\n if (!symbol || typeof symbol !== 'string') {\n return null;\n }\n\n const colonIndex = symbol.indexOf(':');\n if (colonIndex > 0 && colonIndex < symbol.length - 1) {\n return symbol.substring(0, colonIndex);\n }\n\n return null;\n};\n\ntype FundingCountdownParams = {\n nextFundingTime?: number;\n fundingIntervalHours?: number;\n};\n\nexport const calculateFundingCountdown = (\n params?: FundingCountdownParams,\n): string => {\n const now = new Date();\n const nowMs = now.getTime();\n\n if (params?.nextFundingTime && params.nextFundingTime > nowMs) {\n const msUntilFunding = params.nextFundingTime - nowMs;\n const hoursUntilFunding = msUntilFunding / (1000 * 60 * 60);\n\n if (hoursUntilFunding <= 1.1) {\n const totalSeconds = Math.floor(msUntilFunding / 1000);\n\n const hours = Math.floor(totalSeconds / 3600);\n const minutes = Math.floor((totalSeconds % 3600) / 60);\n const seconds = totalSeconds % 60;\n\n const formattedHours = String(hours).padStart(2, '0');\n const formattedMinutes = String(minutes).padStart(2, '0');\n const formattedSeconds = String(seconds).padStart(2, '0');\n\n return `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;\n }\n }\n\n const utcMinutes = now.getUTCMinutes();\n const utcSeconds = now.getUTCSeconds();\n\n const minutesUntilNextHour = 59 - utcMinutes;\n const secondsUntilNextHour = 60 - utcSeconds;\n\n const finalSeconds = secondsUntilNextHour === 60 ? 0 : secondsUntilNextHour;\n const finalMinutes =\n secondsUntilNextHour === 60\n ? minutesUntilNextHour + 1\n : minutesUntilNextHour;\n\n const finalHours = finalMinutes === 60 ? 1 : 0;\n const adjustedMinutes = finalMinutes === 60 ? 0 : finalMinutes;\n\n const formattedHours = String(finalHours).padStart(2, '0');\n const formattedMinutes = String(adjustedMinutes).padStart(2, '0');\n const formattedSeconds = String(finalSeconds).padStart(2, '0');\n\n return `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;\n};\n\nexport const calculate24hHighLow = (\n candleData: CandleData | null,\n): { high: number; low: number } => {\n if (!candleData?.candles || candleData.candles.length === 0) {\n return { high: 0, low: 0 };\n }\n\n const now = Date.now();\n const twentyFourHoursAgo = now - 24 * 60 * 60 * 1000;\n\n let last24hCandles = candleData.candles.filter(\n (candle: CandleStick) => candle.time >= twentyFourHoursAgo,\n );\n\n if (last24hCandles.length === 0) {\n last24hCandles = [...candleData.candles];\n }\n\n const highs = last24hCandles.map((candle: CandleStick) =>\n parseFloat(candle.high),\n );\n const lows = last24hCandles.map((candle: CandleStick) =>\n parseFloat(candle.low),\n );\n\n return {\n high: Math.max(...highs),\n low: Math.min(...lows),\n };\n};\n\nexport const filterMarketsByQuery = (\n markets: PerpsMarketData[],\n searchQuery: string,\n): PerpsMarketData[] => {\n if (!searchQuery?.trim()) {\n return markets;\n }\n\n const lowerQuery = searchQuery.toLowerCase().trim();\n\n return markets.filter(\n (market) =>\n market.symbol?.toLowerCase().includes(lowerQuery) ||\n market.name?.toLowerCase().includes(lowerQuery),\n );\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/perps-controller",
3
- "version": "17.0.0-preview-95104ffdb",
3
+ "version": "17.1.0-preview-e81860e6b",
4
4
  "description": "Controller for perpetual trading functionality in MetaMask",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -71,7 +71,7 @@
71
71
  "@metamask/controller-utils": "^13.0.0",
72
72
  "@metamask/messenger": "^3.0.0",
73
73
  "@metamask/superstruct": "^3.4.1",
74
- "@metamask/utils": "^11.12.0",
74
+ "@metamask/utils": "^12.0.0",
75
75
  "@nktkas/hyperliquid": "^0.33.1",
76
76
  "bignumber.js": "^9.1.2",
77
77
  "reselect": "^5.1.1",
@@ -85,7 +85,7 @@
85
85
  "@metamask/keyring-controller": "^28.0.0",
86
86
  "@metamask/keyring-internal-api": "^12.0.0",
87
87
  "@metamask/network-controller": "^37.0.0",
88
- "@metamask/profile-sync-controller": "^32.1.0",
88
+ "@metamask/profile-sync-controller": "^32.1.1",
89
89
  "@metamask/remote-feature-flag-controller": "^7.0.0",
90
90
  "@metamask/transaction-controller": "^70.0.0",
91
91
  "@types/jest": "^30.0.0",