@metamask-previews/perps-controller 23.1.0-preview-d0ecc4dd6 → 23.1.0-preview-fe3c580ff
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 +58 -0
- package/README.md +35 -0
- package/dist/PerpsController-method-action-types.d.ts +96 -7
- package/dist/PerpsController-method-action-types.d.ts.map +1 -1
- package/dist/PerpsController-method-action-types.js.map +1 -1
- package/dist/PerpsController.d.ts +131 -52
- package/dist/PerpsController.d.ts.map +1 -1
- package/dist/PerpsController.js +854 -54
- package/dist/PerpsController.js.map +1 -1
- package/dist/constants/lighterConfig.d.ts +4 -0
- package/dist/constants/lighterConfig.d.ts.map +1 -1
- package/dist/constants/lighterConfig.js +4 -0
- package/dist/constants/lighterConfig.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/perpsErrorCodes.d.ts +1 -0
- package/dist/perpsErrorCodes.d.ts.map +1 -1
- package/dist/perpsErrorCodes.js +2 -0
- package/dist/perpsErrorCodes.js.map +1 -1
- package/dist/providers/AggregatedPerpsProvider.d.ts +31 -1
- package/dist/providers/AggregatedPerpsProvider.d.ts.map +1 -1
- package/dist/providers/AggregatedPerpsProvider.js +250 -38
- package/dist/providers/AggregatedPerpsProvider.js.map +1 -1
- package/dist/providers/HyperLiquidProvider.d.ts +20 -1
- package/dist/providers/HyperLiquidProvider.d.ts.map +1 -1
- package/dist/providers/HyperLiquidProvider.js +227 -67
- package/dist/providers/HyperLiquidProvider.js.map +1 -1
- package/dist/providers/LighterProvider.d.ts +3 -1
- package/dist/providers/LighterProvider.d.ts.map +1 -1
- package/dist/providers/LighterProvider.js +100 -2
- package/dist/providers/LighterProvider.js.map +1 -1
- package/dist/routing/isPerpsProviderType.d.ts +10 -0
- package/dist/routing/isPerpsProviderType.d.ts.map +1 -0
- package/dist/routing/isPerpsProviderType.js +11 -0
- package/dist/routing/isPerpsProviderType.js.map +1 -0
- package/dist/routing/resolveTradeConfigProviderKey.d.ts +22 -0
- package/dist/routing/resolveTradeConfigProviderKey.d.ts.map +1 -0
- package/dist/routing/resolveTradeConfigProviderKey.js +25 -0
- package/dist/routing/resolveTradeConfigProviderKey.js.map +1 -0
- package/dist/selectors.d.ts +35 -233
- package/dist/selectors.d.ts.map +1 -1
- package/dist/selectors.js +36 -13
- package/dist/selectors.js.map +1 -1
- package/dist/services/HyperLiquidClientService.d.ts +26 -0
- package/dist/services/HyperLiquidClientService.d.ts.map +1 -1
- package/dist/services/HyperLiquidClientService.js +73 -0
- package/dist/services/HyperLiquidClientService.js.map +1 -1
- package/dist/services/LighterClientService.d.ts +9 -1
- package/dist/services/LighterClientService.d.ts.map +1 -1
- package/dist/services/LighterClientService.js +32 -1
- package/dist/services/LighterClientService.js.map +1 -1
- package/dist/services/MarketDataService.d.ts.map +1 -1
- package/dist/services/MarketDataService.js +12 -6
- package/dist/services/MarketDataService.js.map +1 -1
- package/dist/services/ServiceContext.d.ts +15 -3
- package/dist/services/ServiceContext.d.ts.map +1 -1
- package/dist/services/ServiceContext.js.map +1 -1
- package/dist/services/TradingService.d.ts +3 -1
- package/dist/services/TradingService.d.ts.map +1 -1
- package/dist/services/TradingService.js +9 -4
- package/dist/services/TradingService.js.map +1 -1
- package/dist/types/hyperliquid-types.d.ts +2 -1
- package/dist/types/hyperliquid-types.d.ts.map +1 -1
- package/dist/types/hyperliquid-types.js.map +1 -1
- package/dist/types/index.d.ts +125 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/lighter-types.d.ts +31 -0
- package/dist/types/lighter-types.d.ts.map +1 -1
- package/dist/types/lighter-types.js.map +1 -1
- package/dist/utils/hyperLiquidAdapter.d.ts +14 -2
- package/dist/utils/hyperLiquidAdapter.d.ts.map +1 -1
- package/dist/utils/hyperLiquidAdapter.js +41 -0
- package/dist/utils/hyperLiquidAdapter.js.map +1 -1
- package/dist/utils/lighterAdapter.d.ts +13 -1
- package/dist/utils/lighterAdapter.d.ts.map +1 -1
- package/dist/utils/lighterAdapter.js +47 -0
- package/dist/utils/lighterAdapter.js.map +1 -1
- package/dist/utils/publicTrades.d.ts +30 -0
- package/dist/utils/publicTrades.d.ts.map +1 -0
- package/dist/utils/publicTrades.js +45 -0
- package/dist/utils/publicTrades.js.map +1 -0
- package/package.json +1 -1
|
@@ -627,6 +627,37 @@ export type LighterTradesResponse = {
|
|
|
627
627
|
nextCursor?: string;
|
|
628
628
|
trades: LighterRestTrade[];
|
|
629
629
|
};
|
|
630
|
+
/**
|
|
631
|
+
* One public trade from `GET /api/v1/recentTrades` or the `trade/{market_id}`
|
|
632
|
+
* WebSocket channel (post-camelization). Only the fields the public trade
|
|
633
|
+
* feed reads; the venue sends more.
|
|
634
|
+
*/
|
|
635
|
+
export type LighterPublicTrade = {
|
|
636
|
+
tradeId: number;
|
|
637
|
+
tradeIdStr?: string;
|
|
638
|
+
txHash: string;
|
|
639
|
+
marketId: number;
|
|
640
|
+
size: string;
|
|
641
|
+
price: string;
|
|
642
|
+
/** True when the maker sold, so the taker (aggressor) bought. */
|
|
643
|
+
isMakerAsk: boolean;
|
|
644
|
+
timestamp: number;
|
|
645
|
+
};
|
|
646
|
+
/** `GET /api/v1/recentTrades` response (post-camelization). */
|
|
647
|
+
export type LighterRecentTradesResponse = {
|
|
648
|
+
code: number;
|
|
649
|
+
message?: string;
|
|
650
|
+
trades: LighterPublicTrade[];
|
|
651
|
+
};
|
|
652
|
+
/**
|
|
653
|
+
* `trade/{market_id}` WebSocket payload (post-camelization). `subscribed/trade`
|
|
654
|
+
* carries the venue's recent trades, `update/trade` each new batch.
|
|
655
|
+
*/
|
|
656
|
+
export type LighterWsPublicTradesMessage = {
|
|
657
|
+
type?: string;
|
|
658
|
+
channel?: string;
|
|
659
|
+
trades?: unknown;
|
|
660
|
+
};
|
|
630
661
|
/** Query parameters supported by the Lighter trades endpoint. */
|
|
631
662
|
export type LighterTradesQuery = {
|
|
632
663
|
/** Exact uint60 order ID; a number would lose precision for large IDs. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lighter-types.d.ts","sourceRoot":"","sources":["../../src/types/lighter-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,OAAO,EAAE,qBAAqB,CAAC;CAChC,CAAC;AAMF;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,QAAQ,EAAE,MAAM;IAChB,gBAAgB,EAAE,MAAM;IACxB,UAAU,EAAE,MAAM;IAClB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,MAAM;IACnB,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,MAAM;IACpB,WAAW,EAAE,MAAM;CACpB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,GAAG,KAAK,EAAE,4BAA4B;IACtC,GAAG,MAAM,EAAE,4BAA4B;CACxC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,OAAO,EAAE,MAAM;IACf,YAAY,EAAE,MAAM;IACpB,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,MAAM;CACpB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,YAAY,EAAE,MAAM;IACpB,WAAW,EAAE,MAAM;IACnB,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,MAAM;CACpB,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,YAAY,EA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AAE,0BAA0B,EAAE,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qFAAqF;AACrF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,IAAI,EAAE,gBAAgB,EAAE,CAAC;CAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lighter-types.js","sourceRoot":"","sources":["../../src/types/lighter-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG","sourcesContent":["/**\n * Lighter Protocol Type Definitions\n *\n * Types for the zkLighter REST API, the Go/WASM signer bridge, and\n * provider configuration. No SDK dependency — shapes are derived from\n * the public API (https://apidocs.lighter.xyz) and the reference\n * WebView bridge (elliottech/lighter-go, `web-wasm` branch).\n */\n\n// ============================================================================\n// Network Configuration Types\n// ============================================================================\n\n/**\n * Lighter Network type - mainnet or testnet\n */\nexport type LighterNetwork = 'mainnet' | 'testnet';\n\n/**\n * Lighter endpoint configuration for a single network\n */\nexport type LighterEndpointConfig = {\n http: string;\n ws: string;\n};\n\n/**\n * Lighter endpoints for all networks\n */\nexport type LighterEndpoints = {\n mainnet: LighterEndpointConfig;\n testnet: LighterEndpointConfig;\n};\n\n// ============================================================================\n// Signer Bridge (WASM seam)\n// ============================================================================\n\n/**\n * A single call into the Lighter Go/WASM signer.\n *\n * Mirrors the postMessage protocol of the reference React Native WebView\n * bridge (`{ function, params }`), so a WebView-backed bridge on mobile and\n * an in-process WASM bridge in Node are interchangeable implementations.\n */\nexport type LighterCreateOrderWireParams = [\n marketId: number,\n clientOrderIndex: number,\n baseAmount: string,\n price: string,\n isAsk: number,\n orderType: number,\n timeInForce: number,\n reduceOnly: number,\n triggerPrice: string,\n orderExpiry: number,\n];\n\nexport type LighterGroupedOrderWireParams = [\n ...first: LighterCreateOrderWireParams,\n ...second: LighterCreateOrderWireParams,\n];\n\nexport type LighterCreateClientWireParams = [\n chainId: number,\n accountIndex: number,\n nonce: number,\n apiKeyIndex: number,\n];\n\nexport type LighterSignChangePubKeyWireParams = [\n accountIndex: number,\n l1Signature: string,\n nonce: number,\n apiKeyIndex: number,\n];\n\nexport type LighterSignCreateOrderWireParams = [\n accountIndex: number,\n ...order: LighterCreateOrderWireParams,\n nonce: number,\n];\n\n/** Native OTO/OCO use two orders; OTOCO uses a parent and two children. */\nexport type LighterSignCreateGroupedOrdersWireParams =\n | [\n accountIndex: number,\n groupingType: 1 | 2,\n orderCount: 2,\n ...orders: LighterGroupedOrderWireParams,\n nonce: number,\n ]\n | [\n accountIndex: number,\n groupingType: 3,\n orderCount: 3,\n ...parentAndFirstChild: LighterGroupedOrderWireParams,\n ...secondChild: LighterCreateOrderWireParams,\n nonce: number,\n ];\n\n/** Seven-argument ModifyOrder ABI of the pinned embedded signer. */\nexport type LighterSignModifyOrderWireParams = [\n accountIndex: number,\n marketIndex: number,\n orderIndex: string,\n baseAmount: number,\n price: number,\n triggerPrice: number,\n nonce: number,\n];\n\nexport type LighterSignCancelOrderWireParams = [\n accountIndex: number,\n marketId: number,\n orderId: string,\n nonce: number,\n];\n\nexport type LighterSignUpdateLeverageWireParams = [\n accountIndex: number,\n marketId: number,\n leverageImfHundredths: number,\n marginMode: number,\n nonce: number,\n];\n\nexport type LighterSignUpdateMarginWireParams = [\n accountIndex: number,\n marketId: number,\n amount: number,\n direction: number,\n nonce: number,\n];\n\nexport type LighterSignWithdrawWireParams = [\n accountIndex: number,\n assetIndex: number,\n routeType: number,\n amount: string,\n nonce: number,\n];\n\nexport type LighterCreateAuthTokenWireParams = [\n accountIndex: number,\n apiKeyIndex: number,\n];\n\nexport type LighterSignerOperationDefinition<\n Params extends unknown[],\n Result,\n> = {\n params: Params;\n result: Result;\n};\n\nexport type LighterSignerOperationMap = {\n _createClient: LighterSignerOperationDefinition<\n LighterCreateClientWireParams,\n LighterCreateClientResult\n >;\n _signChangePubKey: LighterSignerOperationDefinition<\n LighterSignChangePubKeyWireParams,\n LighterSignChangePubKeyResult\n >;\n _signCreateOrder: LighterSignerOperationDefinition<\n LighterSignCreateOrderWireParams,\n LighterTxResult\n >;\n _signCreateGroupedOrders: LighterSignerOperationDefinition<\n LighterSignCreateGroupedOrdersWireParams,\n LighterTxResult\n >;\n _signModifyOrder: LighterSignerOperationDefinition<\n LighterSignModifyOrderWireParams,\n LighterTxResult\n >;\n _signCancelOrder: LighterSignerOperationDefinition<\n LighterSignCancelOrderWireParams,\n LighterTxResult\n >;\n _signUpdateLeverage: LighterSignerOperationDefinition<\n LighterSignUpdateLeverageWireParams,\n LighterTxResult\n >;\n _signUpdateMargin: LighterSignerOperationDefinition<\n LighterSignUpdateMarginWireParams,\n LighterTxResult\n >;\n _signWithdraw: LighterSignerOperationDefinition<\n LighterSignWithdrawWireParams,\n LighterTxResult\n >;\n _createAuthToken: LighterSignerOperationDefinition<\n LighterCreateAuthTokenWireParams,\n LighterCreateAuthTokenResult\n >;\n};\n\nexport type LighterSignerOperation = keyof LighterSignerOperationMap;\n\nexport type LighterWasmCall<\n Operation extends LighterSignerOperation = LighterSignerOperation,\n> = Operation extends LighterSignerOperation\n ? {\n function: Operation;\n params: LighterSignerOperationMap[Operation]['params'];\n }\n : never;\n\nexport type LighterSignerResult<Operation extends LighterSignerOperation> =\n LighterSignerOperationMap[Operation]['result'];\n\n/** Public metadata needed to create or restore a client-owned venue signer. */\nexport type LighterCreateClientParams = {\n chainId: number;\n accountIndex: number;\n apiKeyIndex: number;\n nonce: number;\n /** Expected Core wallet binding. Hosts must reject a different selected account. */\n walletAddress?: string;\n};\n\n/**\n * Transport-agnostic seam to the Lighter Go/WASM signer.\n *\n * Implementations:\n * - Mobile: off-screen WebView loading the locally-bundled\n * `wasm-wrapper.standalone.html`, dispatching calls via postMessage.\n * - Node (e2e): in-process `WebAssembly.instantiate` via Go's `wasm_exec.js`.\n */\nexport type LighterSignerBridge = {\n /**\n * Return requested slots whose keys can be restored from local storage or\n * wallet-owned deterministic derivation. This must never generate unrelated\n * random keys for slots reported as recoverable. Core still verifies the\n * derived public key against the venue before reusing any registration.\n * When both discovery hooks exist, Core uses this hook exclusively;\n * getStoredKeyIndices is the fallback only when this hook is absent.\n */\n getRecoverableKeyIndices?(params: {\n chainId: number;\n accountIndex: number;\n apiKeyIndices: number[];\n walletAddress?: string;\n }): Promise<number[]>;\n /**\n * Opt in to device-key recovery. Return only requested slots whose private\n * keys are persisted locally for this network and account. No key material\n * crosses this boundary. Core verifies public-key ownership before reuse.\n */\n getStoredKeyIndices?(params: {\n chainId: number;\n accountIndex: number;\n apiKeyIndices: number[];\n walletAddress?: string;\n }): Promise<number[]>;\n\n /**\n * Create or restore the client-owned venue signer. The implementation owns\n * key generation and persistence; Core never receives the seed or private\n * key.\n *\n * @param params - Public venue/session metadata required by the signer.\n */\n createClient(\n params: LighterCreateClientParams,\n ): Promise<LighterCreateClientResult>;\n\n /**\n * Execute one WASM signer call and resolve with its result object.\n *\n * @param call - The function name and positional params to invoke.\n */\n execute<Operation extends LighterSignerOperation>(\n call: LighterWasmCall<Operation>,\n ): Promise<LighterSignerResult<Operation>>;\n\n /**\n * Optional subscription to bridge resets (WebView reload / process\n * loss). The provider uses it to invalidate its cached signer session\n * IMMEDIATELY instead of learning about the reset from the next failed\n * trading call.\n *\n * @param listener - Invoked on every reset.\n * @returns Unsubscribe function.\n */\n onReset?(listener: () => void): () => void;\n\n /**\n * Optional hook to re-arm the bridge after a reload (WebView remount).\n */\n reset?(): void;\n};\n\n// ============================================================================\n// WASM signer response shapes (from lighter-go react-native/src/lighterSdk.ts)\n// ============================================================================\n\n/**\n * Response of `_createClient` / `_createClientByPrv`.\n */\nexport type LighterCreateClientResult = {\n success: boolean;\n /** Venue public key, hex (80 chars / 40 bytes, Schnorr over ECgFp5). */\n pk: string;\n pubKeySuccess: boolean;\n /**\n * ChangePubKey plaintext body to be signed with EIP-191 `personal_sign`\n * by the user's L1 (EVM) account.\n */\n body: string;\n error?: string;\n};\n\n/**\n * Response of `_signChangePubKey`.\n */\nexport type LighterSignChangePubKeyResult = {\n /** Serialized L2 transaction JSON (includes the injected `L1Sig`). */\n txInfo: string;\n /**\n * Signed transaction hash (pinned WASM contract: the signing RESULT\n * carries the hash; `txInfo` never does). Required for the durable\n * dispatch ledger's exact-identity reconciliation.\n */\n txHash?: string;\n error?: string;\n};\n\n/**\n * Response of `_createAuthToken`.\n */\nexport type LighterCreateAuthTokenResult = {\n token: string;\n deadline: number;\n error?: string;\n};\n\n/**\n * Response of signing functions returning a full L2 transaction\n * (`_signCreateOrder`, `_signCancelOrder`, ...).\n */\nexport type LighterTxResult = {\n txInfo: string;\n txHash?: string;\n error?: string;\n};\n\n// ============================================================================\n// Auth Configuration\n// ============================================================================\n\n/**\n * Lighter auth/config passed at construction time.\n */\nexport type LighterAuthConfig = {\n /** Whether the Lighter provider is enabled via local override. */\n enabled?: boolean;\n /** Lighter account index (assigned at first deposit). */\n accountIndex?: number;\n /** API key slot to register/use (0-254). */\n apiKeyIndex?: number;\n};\n\n// ============================================================================\n// REST API response shapes (subset used by the POC)\n//\n// The zkLighter wire format is snake_case; LighterClientService converts\n// keys to camelCase at the fetch boundary so these parsed shapes follow\n// package conventions.\n// ============================================================================\n\n/**\n * One market entry from `GET /api/v1/orderBooks`.\n */\nexport type LighterOrderBookMeta = {\n symbol: string;\n marketId: number;\n marketType: string;\n status: string;\n takerFee: string;\n makerFee: string;\n minBaseAmount: string;\n minQuoteAmount: string;\n supportedSizeDecimals: number;\n supportedPriceDecimals: number;\n supportedQuoteDecimals: number;\n};\n\n/**\n * Response of `GET /api/v1/orderBooks`.\n */\nexport type LighterOrderBooksResponse = {\n code: number;\n orderBooks: LighterOrderBookMeta[];\n};\n\n/**\n * Market stats from `GET /api/v1/orderBookDetails`.\n */\nexport type LighterOrderBookDetail = LighterOrderBookMeta & {\n lastTradePrice: number;\n /** Default initial margin fraction, hundredths of a percent (666 = 6.66%). */\n defaultInitialMarginFraction?: number;\n /** Minimum initial margin fraction, hundredths of a percent (400 → 25x max). */\n minInitialMarginFraction?: number;\n /** Maintenance margin fraction, hundredths of a percent (240 = 2.4%). */\n maintenanceMarginFraction?: number;\n dailyTradesCount: number;\n dailyBaseTokenVolume: number;\n dailyQuoteTokenVolume: number;\n dailyPriceLow: number;\n dailyPriceHigh: number;\n dailyPriceChange: number;\n openInterest: number;\n dailyChart: Record<string, number>;\n};\n\n/**\n * Response of `GET /api/v1/orderBookDetails`.\n */\nexport type LighterOrderBookDetailsResponse = {\n code: number;\n orderBookDetails: LighterOrderBookDetail[];\n};\n\n/**\n * One sub-account from `GET /api/v1/accountsByL1Address` or `account`.\n */\nexport type LighterSubAccount = {\n code: number;\n accountType: number;\n index: number;\n l1Address: string;\n cancelAllTime: number;\n totalOrderCount: number;\n pendingOrderCount: number;\n status: number;\n collateral: string;\n availableBalance: string;\n positions?: LighterApiPosition[];\n};\n\n/**\n * Identity fields returned by `GET /api/v1/accountsByL1Address`.\n *\n * Lighter's address-discovery endpoint may leave balance fields empty even\n * though the full `account` endpoint returns validated decimal values. Account\n * discovery only consumes these identity fields; financial reads continue to\n * use {@link LighterSubAccount} and its stricter response validation.\n */\nexport type LighterAccountSummary = Pick<\n LighterSubAccount,\n 'accountType' | 'index' | 'l1Address'\n>;\n\n/**\n * Response of `GET /api/v1/accountsByL1Address`.\n */\nexport type LighterAccountsByL1AddressResponse = {\n code: number;\n message?: string;\n l1Address: string;\n subAccounts: LighterAccountSummary[];\n};\n\n/**\n * Response of `GET /api/v1/account` (`by=index`).\n */\nexport type LighterAccountResponse = {\n code: number;\n message?: string;\n accounts: LighterSubAccount[];\n};\n\n/**\n * One position inside an account payload.\n */\nexport type LighterApiPosition = {\n marketId: number;\n symbol: string;\n initialMarginFraction: string;\n openOrderCount: number;\n /** Optional in legacy captures; live mode changes require authoritative counts. */\n pendingOrderCount?: number;\n positionTiedOrderCount?: number;\n /** Isolated collateral allocated to this market, in USDC. */\n allocatedMargin?: string;\n /** 1 = long, -1 = short (sign convention per API). */\n sign: number;\n position: string;\n avgEntryPrice: string;\n positionValue: string;\n unrealizedPnl: string;\n realizedPnl: string;\n liquidationPrice: string;\n /** 0 = cross, 1 = isolated. Older captures omit it (venue default cross). */\n marginMode?: number;\n};\n\n/**\n * One API key entry from `GET /api/v1/apikeys`.\n */\nexport type LighterApiKey = {\n accountIndex: number;\n apiKeyIndex: number;\n nonce: number;\n publicKey: string;\n};\n\n/**\n * Response of `GET /api/v1/apikeys`.\n */\nexport type LighterApiKeysResponse = {\n code: number;\n message?: string;\n apiKeys: LighterApiKey[];\n};\n\n/**\n * Response of `GET /api/v1/nextNonce`.\n */\nexport type LighterNextNonceResponse = {\n code: number;\n message?: string;\n nonce: number;\n};\n\n/**\n * Response of `GET /api/v1/tx?by=hash&value=...` (EnrichedTx). Only the\n * identity fields the settlement reconciler verifies are typed; a\n * successful exact-hash match proves the signed payload reached the\n * sequencer.\n */\nexport type LighterTxLookupResponse = {\n code: number;\n message?: string;\n hash: string;\n accountIndex: number;\n apiKeyIndex: number;\n nonce: number;\n status: number;\n};\n\n/**\n * Response of `POST /api/v1/sendTx`.\n */\nexport type LighterSendTxResponse = {\n code: number;\n message?: string;\n txHash: string;\n};\n\n/**\n * One market entry from the `market_stats/all` WebSocket channel\n * (`subscribed/market_stats` snapshot and `update/market_stats` deltas),\n * after snake→camel conversion at the socket boundary.\n */\nexport type LighterWsMarketStat = {\n symbol: string;\n marketId: number;\n indexPrice: string;\n markPrice: string;\n midPrice: string;\n bestAskPrice: string;\n bestBidPrice: string;\n lastTradePrice: string;\n openInterest: string;\n fundingRate: string;\n currentFundingRate?: string;\n dailyQuoteTokenVolume: number;\n dailyPriceChange: number;\n};\n\n/**\n * Envelope of a `market_stats` WebSocket message (post-camelization).\n */\nexport type LighterWsMarketStatsMessage = {\n type: string;\n channel?: string;\n timestamp?: number;\n marketStats?: Record<string, LighterWsMarketStat>;\n};\n\n/**\n * Stats block of a `user_stats/{account_index}` WebSocket message\n * (post-camelization). Live-verified against testnet account 28.\n */\nexport type LighterWsUserStats = {\n collateral: string;\n portfolioValue: string;\n leverage: string;\n availableBalance: string;\n marginUsage: string;\n buyingPower: string;\n};\n\n/**\n * Generic account-channel WebSocket envelope (post-camelization):\n * `user_stats` carries `stats`, `account_all_positions` carries `positions`\n * (same field shape as the REST account payload), `account_all_orders`\n * carries `orders` keyed by market id.\n */\nexport type LighterWsAccountMessage = {\n type: string;\n channel?: string;\n timestamp?: number;\n stats?: LighterWsUserStats;\n positions?: Record<string, LighterApiPosition>;\n orders?: Record<string, LighterApiOrder[]>;\n};\n\n/**\n * Minimal structural WebSocket surface the Lighter stream manager uses.\n * Structural (rather than the DOM/Node `WebSocket` type) so platforms and\n * tests can supply any compatible implementation.\n */\nexport type LighterWebSocketLike = {\n readyState: number;\n send(data: string): void;\n close(): void;\n onopen: (() => void) | null;\n onmessage: ((event: { data: unknown }) => void) | null;\n onclose: (() => void) | null;\n onerror: (() => void) | null;\n};\n\n/**\n * Constructor for {@link LighterWebSocketLike} transports.\n */\nexport type LighterWebSocketCtor = new (url: string) => LighterWebSocketLike;\n\n/**\n * `order_book/{market_id}` WebSocket payload (post-camelization).\n * `subscribed/*` carries a full snapshot; `update/*` carries deltas where\n * `size: \"0.000\"` removes a level.\n */\nexport type LighterWsOrderBookMessage = {\n type: string;\n channel?: string;\n timestamp?: number;\n orderBook?: {\n /** Last nonce represented by this snapshot or delta. */\n nonce?: number;\n /** Previous book nonce required before applying an update. */\n beginNonce?: number;\n bids?: { price: string; size: string }[];\n asks?: { price: string; size: string }[];\n };\n};\n\n/**\n * `candle/{market_id}/{resolution}` WebSocket payload (post-camelization,\n * candle entries keep the compact t/o/h/l/c/v wire keys).\n */\nexport type LighterWsCandleMessage = {\n type: string;\n channel?: string;\n timestamp?: number;\n candles?: LighterCandle[];\n};\n\n/**\n * One trade entry from the `account_all_trades/{account_index}` channel\n * (post-camelization).\n */\nexport type LighterWsTrade = {\n tradeId: number;\n marketId: number;\n size: string;\n price: string;\n askId: number;\n bidId: number;\n askAccountId: number;\n bidAccountId: number;\n isMakerAsk: boolean;\n timestamp: number;\n /** Realized pnl per side; may be omitted on opens or adds, as in REST trades. */\n askAccountPnl?: string;\n bidAccountPnl?: string;\n /** Fees, present when nonzero; unit unproven — see LighterRestTrade. */\n takerFee?: number | string;\n makerFee?: number | string;\n takerPositionSizeBefore?: string;\n makerPositionSizeBefore?: string;\n /** Whether the side's position sign changed; omission is unknown. */\n takerPositionSignChanged?: boolean;\n makerPositionSignChanged?: boolean;\n};\n\n/**\n * `account_all_trades/{account_index}` WebSocket payload (post-camelization).\n */\nexport type LighterWsTradesMessage = {\n type: string;\n channel?: string;\n timestamp?: number;\n trades?: Record<string, LighterWsTrade[]>;\n};\n\n/**\n * One trade from `GET /api/v1/trades` (post-camelization).\n */\nexport type LighterRestTrade = {\n tradeIdStr?: string;\n bidIdStr?: string;\n askIdStr?: string;\n tradeId: number;\n txHash: string;\n type: string;\n marketId: number;\n size: string;\n price: string;\n usdAmount: string;\n askId: number;\n bidId: number;\n askAccountId: number;\n bidAccountId: number;\n isMakerAsk: boolean;\n timestamp: number;\n /** Realized pnl for the ask-side account, signed USDC; may be omitted on opens or adds. */\n askAccountPnl?: string;\n /** Realized pnl for the bid-side account, signed USDC; may be omitted on opens or adds. */\n bidAccountPnl?: string;\n /**\n * Taker/maker fees, present when nonzero. The official model types them\n * as StrictInt with NO documented unit or scale; until a captured\n * nonzero payload proves one, adapters must treat these as unavailable.\n */\n takerFee?: number | string;\n makerFee?: number | string;\n /** Position size (absolute) of each side before the trade executed. */\n takerPositionSizeBefore: string;\n makerPositionSizeBefore: string;\n /** Whether the side's position sign changed (crossed or left zero); omission is unknown. */\n takerPositionSignChanged?: boolean;\n makerPositionSignChanged?: boolean;\n};\n\n/**\n * Response of `GET /api/v1/trades`.\n */\nexport type LighterTradesResponse = {\n code: number;\n message?: string;\n nextCursor?: string;\n trades: LighterRestTrade[];\n};\n\n/** Query parameters supported by the Lighter trades endpoint. */\nexport type LighterTradesQuery = {\n /** Exact uint60 order ID; a number would lose precision for large IDs. */\n orderIndex?: string;\n /** False preserves individual trade identities for reconciliation. */\n aggregate?: boolean;\n limit: number;\n cursor?: string;\n from?: number;\n marketId?: number;\n};\n\n/**\n * One entry from `GET /api/v1/positionFunding` (post-camelization).\n */\nexport type LighterPositionFunding = {\n timestamp: number;\n marketId: number;\n fundingId: number;\n change: string;\n rate: string;\n positionSize: string;\n positionSide: string;\n};\n\n/**\n * Response of `GET /api/v1/positionFunding`.\n */\nexport type LighterPositionFundingsResponse = {\n code: number;\n message?: string;\n positionFundings: LighterPositionFunding[];\n};\n\n/**\n * One record from `GET /api/v1/pnl` (post-camelization).\n */\nexport type LighterPnlRecord = {\n timestamp: number;\n tradePnl: number;\n inflow: number;\n outflow: number;\n volume: number;\n};\n\n/**\n * Response of `GET /api/v1/pnl`.\n */\nexport type LighterPnlResponse = {\n code: number;\n message?: string;\n resolution?: string;\n pnl?: LighterPnlRecord[];\n};\n\n/**\n * One candle from `GET /api/v1/candles` (compact wire keys: t/o/h/l/c/v).\n */\nexport type LighterCandle = {\n t: number;\n o: number;\n h: number;\n l: number;\n c: number;\n v: number;\n};\n\n/**\n * Response of `GET /api/v1/candles`.\n */\nexport type LighterCandlesResponse = {\n code: number;\n message?: string;\n /** Resolution echo (e.g. `15m`). */\n r?: string;\n /** Ascending candle series. */\n c?: LighterCandle[];\n};\n\n/**\n * One order from `GET /api/v1/accountActiveOrders`.\n */\nexport type LighterApiOrder = {\n orderIndex: number;\n clientOrderIndex: number;\n marketIndex: number;\n ownerAccountIndex: number;\n initialBaseAmount: string;\n remainingBaseAmount: string;\n /** Executed base amount; zero remaining does not imply a fill on cancellation. */\n filledBaseAmount?: string;\n filledQuoteAmount?: string;\n clientOrderId?: string;\n /** Venue order nonce, independent of the signing API key transaction nonce. */\n nonce?: number;\n createdAt?: number;\n updatedAt?: number;\n transactionTime?: number;\n price: string;\n isAsk: boolean;\n type: string;\n timeInForce: string;\n reduceOnly: number | boolean;\n status: string;\n orderExpiry: number;\n /** Unix seconds from order endpoints, unlike millisecond trade timestamps. */\n timestamp: number;\n /**\n * Trigger level for stop-loss/take-profit orders. Note `price` on a\n * trigger order is the ±5% protection EXECUTION price, not this level.\n */\n triggerPrice?: string;\n /** Venue string order id (linkage fields reference this form). */\n orderId?: string;\n /** OCO/linkage: parent order references. */\n parentOrderIndex?: number;\n parentOrderId?: string;\n /** OCO linkage: the sibling this order auto-cancels when it fires. */\n toCancelOrderId0?: string;\n toTriggerOrderId0?: string;\n toTriggerOrderId1?: string;\n};\n\n/** Edit-only reader preserves venue int64 identities instead of rounding them. */\nexport type LighterEditableOrder = Omit<\n LighterApiOrder,\n 'orderIndex' | 'parentOrderIndex'\n> & {\n orderIndex: number | string;\n parentOrderIndex?: number | string;\n};\n\nexport type LighterEditableOrdersResponse = {\n code: number;\n message?: string;\n orders: LighterEditableOrder[];\n};\n\n/**\n * Response of `GET /api/v1/accountActiveOrders`.\n */\nexport type LighterActiveOrdersResponse = {\n code: number;\n message?: string;\n orders: LighterApiOrder[];\n};\n\n/**\n * Response of `GET /api/v1/accountInactiveOrders` (historical order\n * lifecycle: filled / canceled orders, newest first, cursor-paged).\n */\nexport type LighterInactiveOrdersResponse = {\n code: number;\n message?: string;\n nextCursor?: string;\n orders: LighterApiOrder[];\n};\n\n/**\n * One entry of `GET /api/v1/deposit/history` (camelized).\n */\nexport type LighterDepositHistoryItem = {\n id: string;\n assetId: number;\n amount: string;\n timestamp: number;\n status: string;\n l1TxHash: string;\n};\n\n/**\n * Response of `GET /api/v1/deposit/history`.\n */\nexport type LighterDepositHistoryResponse = {\n code: number;\n message?: string;\n deposits: LighterDepositHistoryItem[];\n cursor?: string;\n};\n\n/**\n * One entry of `GET /api/v1/withdraw/history` (camelized).\n */\nexport type LighterWithdrawHistoryItem = {\n id: string;\n assetId: number;\n amount: string;\n timestamp: number;\n status: string;\n type: string;\n l1TxHash: string;\n};\n\n/**\n * Response of `GET /api/v1/withdraw/history`.\n */\nexport type LighterWithdrawHistoryResponse = {\n code: number;\n message?: string;\n withdraws: LighterWithdrawHistoryItem[];\n cursor?: string;\n};\n\nexport type LighterTransferType = 'L2TransferInflow' | 'L2TransferOutflow';\n\n/**\n * One entry of `GET /api/v1/transfer/history` (camelized).\n */\nexport type LighterTransferHistoryItem = {\n id: string;\n assetId: number;\n amount: string;\n fee: string;\n timestamp: number;\n type: LighterTransferType;\n fromL1Address: string;\n toL1Address: string;\n fromAccountIndex: number;\n toAccountIndex: number;\n txHash: string;\n};\n\n/**\n * Response of `GET /api/v1/transfer/history`.\n */\nexport type LighterTransferHistoryResponse = {\n code: number;\n message?: string;\n transfers: LighterTransferHistoryItem[];\n cursor?: string;\n};\n\n/** Public native book rows; individual orders permit exact own-order subtraction. */\nexport type LighterBookOrder = {\n orderIndex: number;\n orderId: string;\n ownerAccountIndex: number;\n initialBaseAmount: string;\n remainingBaseAmount: string;\n price: string;\n orderExpiry: number;\n transactionTime: number;\n};\n\nexport type LighterOrderBookOrdersResponse = {\n code: number;\n totalBids: number;\n totalAsks: number;\n bids: LighterBookOrder[];\n asks: LighterBookOrder[];\n};\n"]}
|
|
1
|
+
{"version":3,"file":"lighter-types.js","sourceRoot":"","sources":["../../src/types/lighter-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG","sourcesContent":["/**\n * Lighter Protocol Type Definitions\n *\n * Types for the zkLighter REST API, the Go/WASM signer bridge, and\n * provider configuration. No SDK dependency — shapes are derived from\n * the public API (https://apidocs.lighter.xyz) and the reference\n * WebView bridge (elliottech/lighter-go, `web-wasm` branch).\n */\n\n// ============================================================================\n// Network Configuration Types\n// ============================================================================\n\n/**\n * Lighter Network type - mainnet or testnet\n */\nexport type LighterNetwork = 'mainnet' | 'testnet';\n\n/**\n * Lighter endpoint configuration for a single network\n */\nexport type LighterEndpointConfig = {\n http: string;\n ws: string;\n};\n\n/**\n * Lighter endpoints for all networks\n */\nexport type LighterEndpoints = {\n mainnet: LighterEndpointConfig;\n testnet: LighterEndpointConfig;\n};\n\n// ============================================================================\n// Signer Bridge (WASM seam)\n// ============================================================================\n\n/**\n * A single call into the Lighter Go/WASM signer.\n *\n * Mirrors the postMessage protocol of the reference React Native WebView\n * bridge (`{ function, params }`), so a WebView-backed bridge on mobile and\n * an in-process WASM bridge in Node are interchangeable implementations.\n */\nexport type LighterCreateOrderWireParams = [\n marketId: number,\n clientOrderIndex: number,\n baseAmount: string,\n price: string,\n isAsk: number,\n orderType: number,\n timeInForce: number,\n reduceOnly: number,\n triggerPrice: string,\n orderExpiry: number,\n];\n\nexport type LighterGroupedOrderWireParams = [\n ...first: LighterCreateOrderWireParams,\n ...second: LighterCreateOrderWireParams,\n];\n\nexport type LighterCreateClientWireParams = [\n chainId: number,\n accountIndex: number,\n nonce: number,\n apiKeyIndex: number,\n];\n\nexport type LighterSignChangePubKeyWireParams = [\n accountIndex: number,\n l1Signature: string,\n nonce: number,\n apiKeyIndex: number,\n];\n\nexport type LighterSignCreateOrderWireParams = [\n accountIndex: number,\n ...order: LighterCreateOrderWireParams,\n nonce: number,\n];\n\n/** Native OTO/OCO use two orders; OTOCO uses a parent and two children. */\nexport type LighterSignCreateGroupedOrdersWireParams =\n | [\n accountIndex: number,\n groupingType: 1 | 2,\n orderCount: 2,\n ...orders: LighterGroupedOrderWireParams,\n nonce: number,\n ]\n | [\n accountIndex: number,\n groupingType: 3,\n orderCount: 3,\n ...parentAndFirstChild: LighterGroupedOrderWireParams,\n ...secondChild: LighterCreateOrderWireParams,\n nonce: number,\n ];\n\n/** Seven-argument ModifyOrder ABI of the pinned embedded signer. */\nexport type LighterSignModifyOrderWireParams = [\n accountIndex: number,\n marketIndex: number,\n orderIndex: string,\n baseAmount: number,\n price: number,\n triggerPrice: number,\n nonce: number,\n];\n\nexport type LighterSignCancelOrderWireParams = [\n accountIndex: number,\n marketId: number,\n orderId: string,\n nonce: number,\n];\n\nexport type LighterSignUpdateLeverageWireParams = [\n accountIndex: number,\n marketId: number,\n leverageImfHundredths: number,\n marginMode: number,\n nonce: number,\n];\n\nexport type LighterSignUpdateMarginWireParams = [\n accountIndex: number,\n marketId: number,\n amount: number,\n direction: number,\n nonce: number,\n];\n\nexport type LighterSignWithdrawWireParams = [\n accountIndex: number,\n assetIndex: number,\n routeType: number,\n amount: string,\n nonce: number,\n];\n\nexport type LighterCreateAuthTokenWireParams = [\n accountIndex: number,\n apiKeyIndex: number,\n];\n\nexport type LighterSignerOperationDefinition<\n Params extends unknown[],\n Result,\n> = {\n params: Params;\n result: Result;\n};\n\nexport type LighterSignerOperationMap = {\n _createClient: LighterSignerOperationDefinition<\n LighterCreateClientWireParams,\n LighterCreateClientResult\n >;\n _signChangePubKey: LighterSignerOperationDefinition<\n LighterSignChangePubKeyWireParams,\n LighterSignChangePubKeyResult\n >;\n _signCreateOrder: LighterSignerOperationDefinition<\n LighterSignCreateOrderWireParams,\n LighterTxResult\n >;\n _signCreateGroupedOrders: LighterSignerOperationDefinition<\n LighterSignCreateGroupedOrdersWireParams,\n LighterTxResult\n >;\n _signModifyOrder: LighterSignerOperationDefinition<\n LighterSignModifyOrderWireParams,\n LighterTxResult\n >;\n _signCancelOrder: LighterSignerOperationDefinition<\n LighterSignCancelOrderWireParams,\n LighterTxResult\n >;\n _signUpdateLeverage: LighterSignerOperationDefinition<\n LighterSignUpdateLeverageWireParams,\n LighterTxResult\n >;\n _signUpdateMargin: LighterSignerOperationDefinition<\n LighterSignUpdateMarginWireParams,\n LighterTxResult\n >;\n _signWithdraw: LighterSignerOperationDefinition<\n LighterSignWithdrawWireParams,\n LighterTxResult\n >;\n _createAuthToken: LighterSignerOperationDefinition<\n LighterCreateAuthTokenWireParams,\n LighterCreateAuthTokenResult\n >;\n};\n\nexport type LighterSignerOperation = keyof LighterSignerOperationMap;\n\nexport type LighterWasmCall<\n Operation extends LighterSignerOperation = LighterSignerOperation,\n> = Operation extends LighterSignerOperation\n ? {\n function: Operation;\n params: LighterSignerOperationMap[Operation]['params'];\n }\n : never;\n\nexport type LighterSignerResult<Operation extends LighterSignerOperation> =\n LighterSignerOperationMap[Operation]['result'];\n\n/** Public metadata needed to create or restore a client-owned venue signer. */\nexport type LighterCreateClientParams = {\n chainId: number;\n accountIndex: number;\n apiKeyIndex: number;\n nonce: number;\n /** Expected Core wallet binding. Hosts must reject a different selected account. */\n walletAddress?: string;\n};\n\n/**\n * Transport-agnostic seam to the Lighter Go/WASM signer.\n *\n * Implementations:\n * - Mobile: off-screen WebView loading the locally-bundled\n * `wasm-wrapper.standalone.html`, dispatching calls via postMessage.\n * - Node (e2e): in-process `WebAssembly.instantiate` via Go's `wasm_exec.js`.\n */\nexport type LighterSignerBridge = {\n /**\n * Return requested slots whose keys can be restored from local storage or\n * wallet-owned deterministic derivation. This must never generate unrelated\n * random keys for slots reported as recoverable. Core still verifies the\n * derived public key against the venue before reusing any registration.\n * When both discovery hooks exist, Core uses this hook exclusively;\n * getStoredKeyIndices is the fallback only when this hook is absent.\n */\n getRecoverableKeyIndices?(params: {\n chainId: number;\n accountIndex: number;\n apiKeyIndices: number[];\n walletAddress?: string;\n }): Promise<number[]>;\n /**\n * Opt in to device-key recovery. Return only requested slots whose private\n * keys are persisted locally for this network and account. No key material\n * crosses this boundary. Core verifies public-key ownership before reuse.\n */\n getStoredKeyIndices?(params: {\n chainId: number;\n accountIndex: number;\n apiKeyIndices: number[];\n walletAddress?: string;\n }): Promise<number[]>;\n\n /**\n * Create or restore the client-owned venue signer. The implementation owns\n * key generation and persistence; Core never receives the seed or private\n * key.\n *\n * @param params - Public venue/session metadata required by the signer.\n */\n createClient(\n params: LighterCreateClientParams,\n ): Promise<LighterCreateClientResult>;\n\n /**\n * Execute one WASM signer call and resolve with its result object.\n *\n * @param call - The function name and positional params to invoke.\n */\n execute<Operation extends LighterSignerOperation>(\n call: LighterWasmCall<Operation>,\n ): Promise<LighterSignerResult<Operation>>;\n\n /**\n * Optional subscription to bridge resets (WebView reload / process\n * loss). The provider uses it to invalidate its cached signer session\n * IMMEDIATELY instead of learning about the reset from the next failed\n * trading call.\n *\n * @param listener - Invoked on every reset.\n * @returns Unsubscribe function.\n */\n onReset?(listener: () => void): () => void;\n\n /**\n * Optional hook to re-arm the bridge after a reload (WebView remount).\n */\n reset?(): void;\n};\n\n// ============================================================================\n// WASM signer response shapes (from lighter-go react-native/src/lighterSdk.ts)\n// ============================================================================\n\n/**\n * Response of `_createClient` / `_createClientByPrv`.\n */\nexport type LighterCreateClientResult = {\n success: boolean;\n /** Venue public key, hex (80 chars / 40 bytes, Schnorr over ECgFp5). */\n pk: string;\n pubKeySuccess: boolean;\n /**\n * ChangePubKey plaintext body to be signed with EIP-191 `personal_sign`\n * by the user's L1 (EVM) account.\n */\n body: string;\n error?: string;\n};\n\n/**\n * Response of `_signChangePubKey`.\n */\nexport type LighterSignChangePubKeyResult = {\n /** Serialized L2 transaction JSON (includes the injected `L1Sig`). */\n txInfo: string;\n /**\n * Signed transaction hash (pinned WASM contract: the signing RESULT\n * carries the hash; `txInfo` never does). Required for the durable\n * dispatch ledger's exact-identity reconciliation.\n */\n txHash?: string;\n error?: string;\n};\n\n/**\n * Response of `_createAuthToken`.\n */\nexport type LighterCreateAuthTokenResult = {\n token: string;\n deadline: number;\n error?: string;\n};\n\n/**\n * Response of signing functions returning a full L2 transaction\n * (`_signCreateOrder`, `_signCancelOrder`, ...).\n */\nexport type LighterTxResult = {\n txInfo: string;\n txHash?: string;\n error?: string;\n};\n\n// ============================================================================\n// Auth Configuration\n// ============================================================================\n\n/**\n * Lighter auth/config passed at construction time.\n */\nexport type LighterAuthConfig = {\n /** Whether the Lighter provider is enabled via local override. */\n enabled?: boolean;\n /** Lighter account index (assigned at first deposit). */\n accountIndex?: number;\n /** API key slot to register/use (0-254). */\n apiKeyIndex?: number;\n};\n\n// ============================================================================\n// REST API response shapes (subset used by the POC)\n//\n// The zkLighter wire format is snake_case; LighterClientService converts\n// keys to camelCase at the fetch boundary so these parsed shapes follow\n// package conventions.\n// ============================================================================\n\n/**\n * One market entry from `GET /api/v1/orderBooks`.\n */\nexport type LighterOrderBookMeta = {\n symbol: string;\n marketId: number;\n marketType: string;\n status: string;\n takerFee: string;\n makerFee: string;\n minBaseAmount: string;\n minQuoteAmount: string;\n supportedSizeDecimals: number;\n supportedPriceDecimals: number;\n supportedQuoteDecimals: number;\n};\n\n/**\n * Response of `GET /api/v1/orderBooks`.\n */\nexport type LighterOrderBooksResponse = {\n code: number;\n orderBooks: LighterOrderBookMeta[];\n};\n\n/**\n * Market stats from `GET /api/v1/orderBookDetails`.\n */\nexport type LighterOrderBookDetail = LighterOrderBookMeta & {\n lastTradePrice: number;\n /** Default initial margin fraction, hundredths of a percent (666 = 6.66%). */\n defaultInitialMarginFraction?: number;\n /** Minimum initial margin fraction, hundredths of a percent (400 → 25x max). */\n minInitialMarginFraction?: number;\n /** Maintenance margin fraction, hundredths of a percent (240 = 2.4%). */\n maintenanceMarginFraction?: number;\n dailyTradesCount: number;\n dailyBaseTokenVolume: number;\n dailyQuoteTokenVolume: number;\n dailyPriceLow: number;\n dailyPriceHigh: number;\n dailyPriceChange: number;\n openInterest: number;\n dailyChart: Record<string, number>;\n};\n\n/**\n * Response of `GET /api/v1/orderBookDetails`.\n */\nexport type LighterOrderBookDetailsResponse = {\n code: number;\n orderBookDetails: LighterOrderBookDetail[];\n};\n\n/**\n * One sub-account from `GET /api/v1/accountsByL1Address` or `account`.\n */\nexport type LighterSubAccount = {\n code: number;\n accountType: number;\n index: number;\n l1Address: string;\n cancelAllTime: number;\n totalOrderCount: number;\n pendingOrderCount: number;\n status: number;\n collateral: string;\n availableBalance: string;\n positions?: LighterApiPosition[];\n};\n\n/**\n * Identity fields returned by `GET /api/v1/accountsByL1Address`.\n *\n * Lighter's address-discovery endpoint may leave balance fields empty even\n * though the full `account` endpoint returns validated decimal values. Account\n * discovery only consumes these identity fields; financial reads continue to\n * use {@link LighterSubAccount} and its stricter response validation.\n */\nexport type LighterAccountSummary = Pick<\n LighterSubAccount,\n 'accountType' | 'index' | 'l1Address'\n>;\n\n/**\n * Response of `GET /api/v1/accountsByL1Address`.\n */\nexport type LighterAccountsByL1AddressResponse = {\n code: number;\n message?: string;\n l1Address: string;\n subAccounts: LighterAccountSummary[];\n};\n\n/**\n * Response of `GET /api/v1/account` (`by=index`).\n */\nexport type LighterAccountResponse = {\n code: number;\n message?: string;\n accounts: LighterSubAccount[];\n};\n\n/**\n * One position inside an account payload.\n */\nexport type LighterApiPosition = {\n marketId: number;\n symbol: string;\n initialMarginFraction: string;\n openOrderCount: number;\n /** Optional in legacy captures; live mode changes require authoritative counts. */\n pendingOrderCount?: number;\n positionTiedOrderCount?: number;\n /** Isolated collateral allocated to this market, in USDC. */\n allocatedMargin?: string;\n /** 1 = long, -1 = short (sign convention per API). */\n sign: number;\n position: string;\n avgEntryPrice: string;\n positionValue: string;\n unrealizedPnl: string;\n realizedPnl: string;\n liquidationPrice: string;\n /** 0 = cross, 1 = isolated. Older captures omit it (venue default cross). */\n marginMode?: number;\n};\n\n/**\n * One API key entry from `GET /api/v1/apikeys`.\n */\nexport type LighterApiKey = {\n accountIndex: number;\n apiKeyIndex: number;\n nonce: number;\n publicKey: string;\n};\n\n/**\n * Response of `GET /api/v1/apikeys`.\n */\nexport type LighterApiKeysResponse = {\n code: number;\n message?: string;\n apiKeys: LighterApiKey[];\n};\n\n/**\n * Response of `GET /api/v1/nextNonce`.\n */\nexport type LighterNextNonceResponse = {\n code: number;\n message?: string;\n nonce: number;\n};\n\n/**\n * Response of `GET /api/v1/tx?by=hash&value=...` (EnrichedTx). Only the\n * identity fields the settlement reconciler verifies are typed; a\n * successful exact-hash match proves the signed payload reached the\n * sequencer.\n */\nexport type LighterTxLookupResponse = {\n code: number;\n message?: string;\n hash: string;\n accountIndex: number;\n apiKeyIndex: number;\n nonce: number;\n status: number;\n};\n\n/**\n * Response of `POST /api/v1/sendTx`.\n */\nexport type LighterSendTxResponse = {\n code: number;\n message?: string;\n txHash: string;\n};\n\n/**\n * One market entry from the `market_stats/all` WebSocket channel\n * (`subscribed/market_stats` snapshot and `update/market_stats` deltas),\n * after snake→camel conversion at the socket boundary.\n */\nexport type LighterWsMarketStat = {\n symbol: string;\n marketId: number;\n indexPrice: string;\n markPrice: string;\n midPrice: string;\n bestAskPrice: string;\n bestBidPrice: string;\n lastTradePrice: string;\n openInterest: string;\n fundingRate: string;\n currentFundingRate?: string;\n dailyQuoteTokenVolume: number;\n dailyPriceChange: number;\n};\n\n/**\n * Envelope of a `market_stats` WebSocket message (post-camelization).\n */\nexport type LighterWsMarketStatsMessage = {\n type: string;\n channel?: string;\n timestamp?: number;\n marketStats?: Record<string, LighterWsMarketStat>;\n};\n\n/**\n * Stats block of a `user_stats/{account_index}` WebSocket message\n * (post-camelization). Live-verified against testnet account 28.\n */\nexport type LighterWsUserStats = {\n collateral: string;\n portfolioValue: string;\n leverage: string;\n availableBalance: string;\n marginUsage: string;\n buyingPower: string;\n};\n\n/**\n * Generic account-channel WebSocket envelope (post-camelization):\n * `user_stats` carries `stats`, `account_all_positions` carries `positions`\n * (same field shape as the REST account payload), `account_all_orders`\n * carries `orders` keyed by market id.\n */\nexport type LighterWsAccountMessage = {\n type: string;\n channel?: string;\n timestamp?: number;\n stats?: LighterWsUserStats;\n positions?: Record<string, LighterApiPosition>;\n orders?: Record<string, LighterApiOrder[]>;\n};\n\n/**\n * Minimal structural WebSocket surface the Lighter stream manager uses.\n * Structural (rather than the DOM/Node `WebSocket` type) so platforms and\n * tests can supply any compatible implementation.\n */\nexport type LighterWebSocketLike = {\n readyState: number;\n send(data: string): void;\n close(): void;\n onopen: (() => void) | null;\n onmessage: ((event: { data: unknown }) => void) | null;\n onclose: (() => void) | null;\n onerror: (() => void) | null;\n};\n\n/**\n * Constructor for {@link LighterWebSocketLike} transports.\n */\nexport type LighterWebSocketCtor = new (url: string) => LighterWebSocketLike;\n\n/**\n * `order_book/{market_id}` WebSocket payload (post-camelization).\n * `subscribed/*` carries a full snapshot; `update/*` carries deltas where\n * `size: \"0.000\"` removes a level.\n */\nexport type LighterWsOrderBookMessage = {\n type: string;\n channel?: string;\n timestamp?: number;\n orderBook?: {\n /** Last nonce represented by this snapshot or delta. */\n nonce?: number;\n /** Previous book nonce required before applying an update. */\n beginNonce?: number;\n bids?: { price: string; size: string }[];\n asks?: { price: string; size: string }[];\n };\n};\n\n/**\n * `candle/{market_id}/{resolution}` WebSocket payload (post-camelization,\n * candle entries keep the compact t/o/h/l/c/v wire keys).\n */\nexport type LighterWsCandleMessage = {\n type: string;\n channel?: string;\n timestamp?: number;\n candles?: LighterCandle[];\n};\n\n/**\n * One trade entry from the `account_all_trades/{account_index}` channel\n * (post-camelization).\n */\nexport type LighterWsTrade = {\n tradeId: number;\n marketId: number;\n size: string;\n price: string;\n askId: number;\n bidId: number;\n askAccountId: number;\n bidAccountId: number;\n isMakerAsk: boolean;\n timestamp: number;\n /** Realized pnl per side; may be omitted on opens or adds, as in REST trades. */\n askAccountPnl?: string;\n bidAccountPnl?: string;\n /** Fees, present when nonzero; unit unproven — see LighterRestTrade. */\n takerFee?: number | string;\n makerFee?: number | string;\n takerPositionSizeBefore?: string;\n makerPositionSizeBefore?: string;\n /** Whether the side's position sign changed; omission is unknown. */\n takerPositionSignChanged?: boolean;\n makerPositionSignChanged?: boolean;\n};\n\n/**\n * `account_all_trades/{account_index}` WebSocket payload (post-camelization).\n */\nexport type LighterWsTradesMessage = {\n type: string;\n channel?: string;\n timestamp?: number;\n trades?: Record<string, LighterWsTrade[]>;\n};\n\n/**\n * One trade from `GET /api/v1/trades` (post-camelization).\n */\nexport type LighterRestTrade = {\n tradeIdStr?: string;\n bidIdStr?: string;\n askIdStr?: string;\n tradeId: number;\n txHash: string;\n type: string;\n marketId: number;\n size: string;\n price: string;\n usdAmount: string;\n askId: number;\n bidId: number;\n askAccountId: number;\n bidAccountId: number;\n isMakerAsk: boolean;\n timestamp: number;\n /** Realized pnl for the ask-side account, signed USDC; may be omitted on opens or adds. */\n askAccountPnl?: string;\n /** Realized pnl for the bid-side account, signed USDC; may be omitted on opens or adds. */\n bidAccountPnl?: string;\n /**\n * Taker/maker fees, present when nonzero. The official model types them\n * as StrictInt with NO documented unit or scale; until a captured\n * nonzero payload proves one, adapters must treat these as unavailable.\n */\n takerFee?: number | string;\n makerFee?: number | string;\n /** Position size (absolute) of each side before the trade executed. */\n takerPositionSizeBefore: string;\n makerPositionSizeBefore: string;\n /** Whether the side's position sign changed (crossed or left zero); omission is unknown. */\n takerPositionSignChanged?: boolean;\n makerPositionSignChanged?: boolean;\n};\n\n/**\n * Response of `GET /api/v1/trades`.\n */\nexport type LighterTradesResponse = {\n code: number;\n message?: string;\n nextCursor?: string;\n trades: LighterRestTrade[];\n};\n\n/**\n * One public trade from `GET /api/v1/recentTrades` or the `trade/{market_id}`\n * WebSocket channel (post-camelization). Only the fields the public trade\n * feed reads; the venue sends more.\n */\nexport type LighterPublicTrade = {\n tradeId: number;\n tradeIdStr?: string;\n txHash: string;\n marketId: number;\n size: string;\n price: string;\n /** True when the maker sold, so the taker (aggressor) bought. */\n isMakerAsk: boolean;\n timestamp: number;\n};\n\n/** `GET /api/v1/recentTrades` response (post-camelization). */\nexport type LighterRecentTradesResponse = {\n code: number;\n message?: string;\n trades: LighterPublicTrade[];\n};\n\n/**\n * `trade/{market_id}` WebSocket payload (post-camelization). `subscribed/trade`\n * carries the venue's recent trades, `update/trade` each new batch.\n */\nexport type LighterWsPublicTradesMessage = {\n type?: string;\n channel?: string;\n trades?: unknown;\n};\n\n/** Query parameters supported by the Lighter trades endpoint. */\nexport type LighterTradesQuery = {\n /** Exact uint60 order ID; a number would lose precision for large IDs. */\n orderIndex?: string;\n /** False preserves individual trade identities for reconciliation. */\n aggregate?: boolean;\n limit: number;\n cursor?: string;\n from?: number;\n marketId?: number;\n};\n\n/**\n * One entry from `GET /api/v1/positionFunding` (post-camelization).\n */\nexport type LighterPositionFunding = {\n timestamp: number;\n marketId: number;\n fundingId: number;\n change: string;\n rate: string;\n positionSize: string;\n positionSide: string;\n};\n\n/**\n * Response of `GET /api/v1/positionFunding`.\n */\nexport type LighterPositionFundingsResponse = {\n code: number;\n message?: string;\n positionFundings: LighterPositionFunding[];\n};\n\n/**\n * One record from `GET /api/v1/pnl` (post-camelization).\n */\nexport type LighterPnlRecord = {\n timestamp: number;\n tradePnl: number;\n inflow: number;\n outflow: number;\n volume: number;\n};\n\n/**\n * Response of `GET /api/v1/pnl`.\n */\nexport type LighterPnlResponse = {\n code: number;\n message?: string;\n resolution?: string;\n pnl?: LighterPnlRecord[];\n};\n\n/**\n * One candle from `GET /api/v1/candles` (compact wire keys: t/o/h/l/c/v).\n */\nexport type LighterCandle = {\n t: number;\n o: number;\n h: number;\n l: number;\n c: number;\n v: number;\n};\n\n/**\n * Response of `GET /api/v1/candles`.\n */\nexport type LighterCandlesResponse = {\n code: number;\n message?: string;\n /** Resolution echo (e.g. `15m`). */\n r?: string;\n /** Ascending candle series. */\n c?: LighterCandle[];\n};\n\n/**\n * One order from `GET /api/v1/accountActiveOrders`.\n */\nexport type LighterApiOrder = {\n orderIndex: number;\n clientOrderIndex: number;\n marketIndex: number;\n ownerAccountIndex: number;\n initialBaseAmount: string;\n remainingBaseAmount: string;\n /** Executed base amount; zero remaining does not imply a fill on cancellation. */\n filledBaseAmount?: string;\n filledQuoteAmount?: string;\n clientOrderId?: string;\n /** Venue order nonce, independent of the signing API key transaction nonce. */\n nonce?: number;\n createdAt?: number;\n updatedAt?: number;\n transactionTime?: number;\n price: string;\n isAsk: boolean;\n type: string;\n timeInForce: string;\n reduceOnly: number | boolean;\n status: string;\n orderExpiry: number;\n /** Unix seconds from order endpoints, unlike millisecond trade timestamps. */\n timestamp: number;\n /**\n * Trigger level for stop-loss/take-profit orders. Note `price` on a\n * trigger order is the ±5% protection EXECUTION price, not this level.\n */\n triggerPrice?: string;\n /** Venue string order id (linkage fields reference this form). */\n orderId?: string;\n /** OCO/linkage: parent order references. */\n parentOrderIndex?: number;\n parentOrderId?: string;\n /** OCO linkage: the sibling this order auto-cancels when it fires. */\n toCancelOrderId0?: string;\n toTriggerOrderId0?: string;\n toTriggerOrderId1?: string;\n};\n\n/** Edit-only reader preserves venue int64 identities instead of rounding them. */\nexport type LighterEditableOrder = Omit<\n LighterApiOrder,\n 'orderIndex' | 'parentOrderIndex'\n> & {\n orderIndex: number | string;\n parentOrderIndex?: number | string;\n};\n\nexport type LighterEditableOrdersResponse = {\n code: number;\n message?: string;\n orders: LighterEditableOrder[];\n};\n\n/**\n * Response of `GET /api/v1/accountActiveOrders`.\n */\nexport type LighterActiveOrdersResponse = {\n code: number;\n message?: string;\n orders: LighterApiOrder[];\n};\n\n/**\n * Response of `GET /api/v1/accountInactiveOrders` (historical order\n * lifecycle: filled / canceled orders, newest first, cursor-paged).\n */\nexport type LighterInactiveOrdersResponse = {\n code: number;\n message?: string;\n nextCursor?: string;\n orders: LighterApiOrder[];\n};\n\n/**\n * One entry of `GET /api/v1/deposit/history` (camelized).\n */\nexport type LighterDepositHistoryItem = {\n id: string;\n assetId: number;\n amount: string;\n timestamp: number;\n status: string;\n l1TxHash: string;\n};\n\n/**\n * Response of `GET /api/v1/deposit/history`.\n */\nexport type LighterDepositHistoryResponse = {\n code: number;\n message?: string;\n deposits: LighterDepositHistoryItem[];\n cursor?: string;\n};\n\n/**\n * One entry of `GET /api/v1/withdraw/history` (camelized).\n */\nexport type LighterWithdrawHistoryItem = {\n id: string;\n assetId: number;\n amount: string;\n timestamp: number;\n status: string;\n type: string;\n l1TxHash: string;\n};\n\n/**\n * Response of `GET /api/v1/withdraw/history`.\n */\nexport type LighterWithdrawHistoryResponse = {\n code: number;\n message?: string;\n withdraws: LighterWithdrawHistoryItem[];\n cursor?: string;\n};\n\nexport type LighterTransferType = 'L2TransferInflow' | 'L2TransferOutflow';\n\n/**\n * One entry of `GET /api/v1/transfer/history` (camelized).\n */\nexport type LighterTransferHistoryItem = {\n id: string;\n assetId: number;\n amount: string;\n fee: string;\n timestamp: number;\n type: LighterTransferType;\n fromL1Address: string;\n toL1Address: string;\n fromAccountIndex: number;\n toAccountIndex: number;\n txHash: string;\n};\n\n/**\n * Response of `GET /api/v1/transfer/history`.\n */\nexport type LighterTransferHistoryResponse = {\n code: number;\n message?: string;\n transfers: LighterTransferHistoryItem[];\n cursor?: string;\n};\n\n/** Public native book rows; individual orders permit exact own-order subtraction. */\nexport type LighterBookOrder = {\n orderIndex: number;\n orderId: string;\n ownerAccountIndex: number;\n initialBaseAmount: string;\n remainingBaseAmount: string;\n price: string;\n orderExpiry: number;\n transactionTime: number;\n};\n\nexport type LighterOrderBookOrdersResponse = {\n code: number;\n totalBids: number;\n totalAsks: number;\n bids: LighterBookOrder[];\n asks: LighterBookOrder[];\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AssetPosition, FrontendOrder, ClearinghouseStateResponse, MetaResponse, SDKOrderParams } from '../types/hyperliquid-types.js';
|
|
2
|
-
import type { AccountState, MarketInfo, Order, OrderParams as PerpsOrderParams, Position, PositionTriggerOrder, RawLedgerUpdate, UserHistoryItem } from '../types/index.js';
|
|
1
|
+
import type { AssetPosition, FrontendOrder, ClearinghouseStateResponse, HyperLiquidPublicTrade, MetaResponse, SDKOrderParams } from '../types/hyperliquid-types.js';
|
|
2
|
+
import type { AccountState, MarketInfo, Order, OrderParams as PerpsOrderParams, Position, PositionTriggerOrder, PublicTrade, RawLedgerUpdate, UserHistoryItem } from '../types/index.js';
|
|
3
3
|
import type { TpslLinkage, TriggerOrderType } from '../types/perps-types.js';
|
|
4
4
|
export declare const HYPERLIQUID_SCALE_CLOID_MARKER = "4d4d5343";
|
|
5
5
|
/**
|
|
@@ -102,4 +102,16 @@ export declare function parseAssetName(assetName: string): {
|
|
|
102
102
|
symbol: string;
|
|
103
103
|
};
|
|
104
104
|
export declare function adaptHyperLiquidLedgerUpdateToUserHistoryItem(rawLedgerUpdates: RawLedgerUpdate[]): UserHistoryItem[];
|
|
105
|
+
/**
|
|
106
|
+
* Adapt Hyperliquid public trades (REST `recentTrades` or WS `trades`) to
|
|
107
|
+
* {@link PublicTrade}, newest first. Trades for another coin and malformed
|
|
108
|
+
* trades are dropped. `side` is the aggressor's: `B` bought, `A` sold. The id
|
|
109
|
+
* comes from {@link buildHyperLiquidFillId}, so both transports give one
|
|
110
|
+
* execution the same id.
|
|
111
|
+
*
|
|
112
|
+
* @param trades - SDK trades.
|
|
113
|
+
* @param symbol - Requested coin; other coins are dropped.
|
|
114
|
+
* @returns The trades for `symbol`, newest first.
|
|
115
|
+
*/
|
|
116
|
+
export declare function adaptPublicTradesFromHyperLiquid(trades: readonly HyperLiquidPublicTrade[], symbol: string): PublicTrade[];
|
|
105
117
|
//# sourceMappingURL=hyperLiquidAdapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hyperLiquidAdapter.d.ts","sourceRoot":"","sources":["../../src/utils/hyperLiquidAdapter.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACf,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,YAAY,EAEZ,UAAU,EACV,KAAK,EACL,WAAW,IAAI,gBAAgB,EAC/B,QAAQ,EACR,oBAAoB,EACpB,eAAe,EACf,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,yBAAyB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ACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,GAAG,MAAM,GAAG,SAAS,CAKrB;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG;IACjD,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CASA;AAED,wBAAgB,6CAA6C,CAC3D,gBAAgB,EAAE,eAAe,EAAE,GAClC,eAAe,EAAE,CAkDnB;AAKD;;;;;;;;;;GAUG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,SAAS,sBAAsB,EAAE,EACzC,MAAM,EAAE,MAAM,GACb,WAAW,EAAE,CA4Bf"}
|
|
@@ -3,6 +3,7 @@ import { BASIS_POINTS_DIVISOR, HIP3_ASSET_ID_CONFIG, } from '../constants/hyperL
|
|
|
3
3
|
import { DECIMAL_PRECISION_CONFIG, ORDER_SLIPPAGE_CONFIG, } from '../constants/perpsConfig.js';
|
|
4
4
|
import { PERPS_ERROR_CODES } from '../perpsErrorCodes.js';
|
|
5
5
|
import { buildTriggerOrderType, classifyTriggerDirection, getTriggerDirection, getTriggerExecution, isLimitExecutionOrderType, isTriggerOrderType, toSDKTimeInForce, } from './orderTypes.js';
|
|
6
|
+
import { buildPublicTrade, sortPublicTradesNewestFirst, } from './publicTrades.js';
|
|
6
7
|
import { countSignificantFigures, roundToSignificantFigures, } from './significantFigures.js';
|
|
7
8
|
import { parseFiniteDecimal } from './stringParseUtils.js';
|
|
8
9
|
export const HYPERLIQUID_SCALE_CLOID_MARKER = '4d4d5343';
|
|
@@ -542,4 +543,44 @@ export function adaptHyperLiquidLedgerUpdateToUserHistoryItem(rawLedgerUpdates)
|
|
|
542
543
|
};
|
|
543
544
|
});
|
|
544
545
|
}
|
|
546
|
+
const HYPERLIQUID_ZERO_HASH = /^0x0+$/u;
|
|
547
|
+
const HYPERLIQUID_TRADE_SIDE = { B: 'buy', A: 'sell' };
|
|
548
|
+
/**
|
|
549
|
+
* Adapt Hyperliquid public trades (REST `recentTrades` or WS `trades`) to
|
|
550
|
+
* {@link PublicTrade}, newest first. Trades for another coin and malformed
|
|
551
|
+
* trades are dropped. `side` is the aggressor's: `B` bought, `A` sold. The id
|
|
552
|
+
* comes from {@link buildHyperLiquidFillId}, so both transports give one
|
|
553
|
+
* execution the same id.
|
|
554
|
+
*
|
|
555
|
+
* @param trades - SDK trades.
|
|
556
|
+
* @param symbol - Requested coin; other coins are dropped.
|
|
557
|
+
* @returns The trades for `symbol`, newest first.
|
|
558
|
+
*/
|
|
559
|
+
export function adaptPublicTradesFromHyperLiquid(trades, symbol) {
|
|
560
|
+
const adapted = [];
|
|
561
|
+
for (const trade of trades) {
|
|
562
|
+
if (trade.coin !== symbol) {
|
|
563
|
+
continue;
|
|
564
|
+
}
|
|
565
|
+
const publicTrade = buildPublicTrade({
|
|
566
|
+
id: typeof trade.tid === 'number'
|
|
567
|
+
? buildHyperLiquidFillId(trade)
|
|
568
|
+
: undefined,
|
|
569
|
+
symbol,
|
|
570
|
+
price: trade.px,
|
|
571
|
+
size: trade.sz,
|
|
572
|
+
side: HYPERLIQUID_TRADE_SIDE[trade.side] ?? null,
|
|
573
|
+
timestamp: trade.time,
|
|
574
|
+
txHash: typeof trade.hash === 'string' &&
|
|
575
|
+
!HYPERLIQUID_ZERO_HASH.test(trade.hash)
|
|
576
|
+
? trade.hash
|
|
577
|
+
: undefined,
|
|
578
|
+
providerId: 'hyperliquid',
|
|
579
|
+
});
|
|
580
|
+
if (publicTrade) {
|
|
581
|
+
adapted.push(publicTrade);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return sortPublicTradesNewestFirst(adapted);
|
|
585
|
+
}
|
|
545
586
|
//# sourceMappingURL=hyperLiquidAdapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{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C,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC9D,CAAC;QACD,IACE,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC;YACjC,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,EACrC,CAAC;YACD,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;QAC5B,CAAC;QAED,OAAO;YACL,EAAE,EAAE,WAAW,MAAM,CAAC,IAAI,EAAE;YAC5B,SAAS,EAAE,MAAM,CAAC,IAAI;YACtB,MAAM;YACN,KAAK;YACL,MAAM,EAAE,MAAM,CAAC,IAAI;YACnB,MAAM,EAAE,WAAoB;YAC5B,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS;YACjE,OAAO,EAAE;gBACP,MAAM,EAAE,EAAE;gBACV,cAAc,EAAE,SAAS;gBACzB,SAAS,EAAE,SAAS;gBACpB,WAAW,EAAE,SAAS;gBACtB,OAAO,EAAE,SAAS;gBAClB,SAAS,EAAE,SAAS;aACrB;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { hasProperty, Hex, isHexString } from '@metamask/utils';\n\nimport {\n BASIS_POINTS_DIVISOR,\n HIP3_ASSET_ID_CONFIG,\n} from '../constants/hyperLiquidConfig.js';\nimport {\n DECIMAL_PRECISION_CONFIG,\n ORDER_SLIPPAGE_CONFIG,\n} from '../constants/perpsConfig.js';\nimport { PERPS_ERROR_CODES } from '../perpsErrorCodes.js';\nimport type {\n AssetPosition,\n FrontendOrder,\n ClearinghouseStateResponse,\n MetaResponse,\n SDKOrderParams,\n} from '../types/hyperliquid-types.js';\nimport type {\n AccountState,\n CrossMarginSummary,\n MarketInfo,\n Order,\n OrderParams as PerpsOrderParams,\n Position,\n PositionTriggerOrder,\n RawLedgerUpdate,\n UserHistoryItem,\n} from '../types/index.js';\nimport type { TpslLinkage, TriggerOrderType } from '../types/perps-types.js';\nimport {\n buildTriggerOrderType,\n classifyTriggerDirection,\n getTriggerDirection,\n getTriggerExecution,\n isLimitExecutionOrderType,\n isTriggerOrderType,\n toSDKTimeInForce,\n} from './orderTypes.js';\nimport {\n countSignificantFigures,\n roundToSignificantFigures,\n} from './significantFigures.js';\nimport { parseFiniteDecimal } from './stringParseUtils.js';\n\ntype FrontendOrderWithParentTpsl = FrontendOrder & {\n takeProfitPrice?: unknown;\n stopLossPrice?: unknown;\n takeProfitOrderId?: unknown;\n stopLossOrderId?: unknown;\n};\n\nexport const HYPERLIQUID_SCALE_CLOID_MARKER = '4d4d5343';\n\n/**\n * Recover the Scale group shared by MetaMask-generated rung CLOIDs.\n *\n * @param clientOrderId - HyperLiquid client order ID.\n * @returns The Scale handle, or undefined for an unrelated order.\n */\nexport const readScaleGroupId = (\n clientOrderId: string | null | undefined,\n): string | undefined => {\n const normalized = clientOrderId?.toLowerCase();\n if (\n normalized?.length !== 34 ||\n !normalized.startsWith(`0x${HYPERLIQUID_SCALE_CLOID_MARKER}`)\n ) {\n return undefined;\n }\n return `scale:${normalized.slice(2, -2)}`;\n};\n\nconst readOptionalString = (value: unknown): string | undefined =>\n typeof value === 'string' && value.length > 0 ? value : undefined;\n\nconst readOptionalOrderId = (value: unknown): string | undefined => {\n if (typeof value === 'string' && value.length > 0) {\n return value;\n }\n\n if (typeof value === 'number' && Number.isFinite(value)) {\n return value.toString();\n }\n\n return undefined;\n};\n\nconst getParentTpslMetadata = (\n rawOrder: FrontendOrderWithParentTpsl,\n): {\n takeProfitPrice?: string;\n stopLossPrice?: string;\n takeProfitOrderId?: string;\n stopLossOrderId?: string;\n} => ({\n takeProfitPrice: readOptionalString(rawOrder.takeProfitPrice),\n stopLossPrice: readOptionalString(rawOrder.stopLossPrice),\n takeProfitOrderId: readOptionalOrderId(rawOrder.takeProfitOrderId),\n stopLossOrderId: readOptionalOrderId(rawOrder.stopLossOrderId),\n});\n\n/**\n * HyperLiquid SDK Adapter Utilities\n *\n * These functions transform between MetaMask Perps API types and HyperLiquid SDK types.\n * The SDK uses cryptic property names for efficiency, but our API uses descriptive names\n * to provide a consistent interface across different perps protocols.\n */\n\nexport function adaptOrderToSDK(\n order: PerpsOrderParams,\n symbolToAssetId: Map<string, number>,\n): SDKOrderParams {\n const assetId = symbolToAssetId.get(order.symbol);\n if (assetId === undefined) {\n const availableDexs = new Set<string>();\n symbolToAssetId.forEach((_, symbol) => {\n if (symbol.includes(':')) {\n const dex = symbol.split(':')[0];\n availableDexs.add(dex);\n }\n });\n\n const dexHint =\n availableDexs.size > 0\n ? ` Available HIP-3 DEXs: ${Array.from(availableDexs).join(', ')}`\n : ' No HIP-3 DEXs currently available.';\n\n throw new Error(\n `Asset ${order.symbol} not found in asset mapping.${dexHint} Check console logs for \"HyperLiquidProvider: Asset mapping built\" to see available assets.`,\n );\n }\n\n return {\n a: assetId,\n b: order.isBuy,\n p: order.price ?? resolveTriggerCapPrice(order) ?? '0',\n s: order.size,\n r: order.reduceOnly ?? false,\n t: adaptOrderTypeToSDK(order),\n c:\n order.clientOrderId && isHexString(order.clientOrderId)\n ? order.clientOrderId\n : undefined,\n };\n}\n\n/**\n * Derive the slippage cap a market-on-trigger order submits as its price.\n *\n * A `stop_market` / `take_profit_market` order legitimately carries no limit\n * price, but the SDK still requires a positive `p` — it is the cap the order\n * fills against once the trigger fires, not a resting price. Sending `'0'`\n * fails SDK validation before the request is ever made.\n *\n * The cap follows the order's own tolerance, matching `calculateOrderPriceAndSize`\n * on the `placeOrder` path, so the same order priced through either route gets\n * the same execution bound.\n *\n * @param order - Order params carrying the placement type, trigger price, and\n * slippage tolerance.\n * @returns The formatted cap price, or undefined when the order needs no cap.\n */\nfunction resolveTriggerCapPrice(order: PerpsOrderParams): string | undefined {\n if (\n !isTriggerOrderType(order.orderType) ||\n isLimitExecutionOrderType(order.orderType) ||\n !order.triggerPrice\n ) {\n return undefined;\n }\n\n const triggerPrice = parseFloat(order.triggerPrice);\n if (!Number.isFinite(triggerPrice)) {\n return undefined;\n }\n\n // Accept the deprecated decimal `slippage` too, normalizing it to bps the way\n // `placeOrder` does, so neither spelling silently falls back to the default.\n const effectiveBps =\n order.maxSlippageBps ??\n (typeof order.slippage === 'number'\n ? Math.round(order.slippage * BASIS_POINTS_DIVISOR)\n : undefined) ??\n ORDER_SLIPPAGE_CONFIG.DefaultTpslSlippageBps;\n\n // Buying pays up to the cap, selling accepts down to it.\n const slippage = effectiveBps / BASIS_POINTS_DIVISOR;\n const capPrice = order.isBuy\n ? triggerPrice * (1 + slippage)\n : triggerPrice * (1 - slippage);\n\n return capPrice.toString();\n}\n\n/**\n * Map a placement type onto the SDK's order-type field.\n *\n * @param order - Order params carrying the placement type and trigger price\n * @returns The SDK order-type field\n */\nfunction adaptOrderTypeToSDK(order: PerpsOrderParams): SDKOrderParams['t'] {\n if (isTriggerOrderType(order.orderType)) {\n if (order.timeInForce !== undefined) {\n throw new Error(PERPS_ERROR_CODES.ORDER_TIME_IN_FORCE_NOT_SUPPORTED);\n }\n if (!order.triggerPrice) {\n throw new Error(PERPS_ERROR_CODES.ORDER_TRIGGER_PRICE_REQUIRED);\n }\n\n return {\n trigger: {\n isMarket: !isLimitExecutionOrderType(order.orderType),\n triggerPx: order.triggerPrice,\n tpsl: getTriggerDirection(order.orderType) === 'stop' ? 'sl' : 'tp',\n },\n };\n }\n\n if (order.orderType === 'limit') {\n return { limit: { tif: toSDKTimeInForce(order.timeInForce) } };\n }\n if (order.timeInForce !== undefined) {\n throw new Error(PERPS_ERROR_CODES.ORDER_TIME_IN_FORCE_NOT_SUPPORTED);\n }\n return { limit: { tif: 'FrontendMarket' } };\n}\n\n/**\n * Map the provider-agnostic TP/SL linkage onto HyperLiquid's grouping vocabulary.\n *\n * @param linkage - How the attached TP/SL is linked.\n * @returns The HyperLiquid grouping value.\n */\nexport function adaptTpslLinkageToGrouping(\n linkage: TpslLinkage,\n): 'na' | 'normalTpsl' | 'positionTpsl' {\n switch (linkage) {\n case 'position':\n return 'positionTpsl';\n case 'order':\n return 'normalTpsl';\n default:\n return 'na';\n }\n}\n\nexport function adaptPositionFromSDK(assetPosition: AssetPosition): Position {\n const pos = assetPosition.position;\n return {\n symbol: pos.coin,\n size: pos.szi,\n entryPrice: pos.entryPx,\n positionValue: pos.positionValue,\n unrealizedPnl: pos.unrealizedPnl,\n marginUsed: pos.marginUsed,\n leverage: {\n type: pos.leverage.type,\n value: pos.leverage.value,\n rawUsd:\n pos.leverage.type === 'isolated' ? pos.leverage.rawUsd : undefined,\n },\n liquidationPrice: pos.liquidationPx,\n maxLeverage: pos.maxLeverage,\n returnOnEquity: pos.returnOnEquity,\n cumulativeFunding: pos.cumFunding,\n takeProfitCount: 0,\n stopLossCount: 0,\n };\n}\n\nexport function adaptOrderFromSDK(\n rawOrder: FrontendOrder,\n position?: Position,\n): Order {\n // TODO: Remove this widened boundary type when FrontendOrder includes\n // takeProfitPrice/stopLossPrice and takeProfitOrderId/stopLossOrderId.\n const parentTpslMetadata = getParentTpslMetadata(rawOrder);\n\n // Extract basic fields with appropriate conversions\n const orderId = rawOrder.oid?.toString() || '';\n const symbol = rawOrder.coin;\n const side: 'buy' | 'sell' = rawOrder.side === 'B' ? 'buy' : 'sell';\n const detailedOrderType = rawOrder.orderType;\n const { isTrigger } = rawOrder;\n const { reduceOnly } = rawOrder;\n\n const triggerOrderType = adaptTriggerOrderTypeFromSDK(detailedOrderType);\n\n let orderType: 'limit' | 'market' = 'market';\n if (triggerOrderType) {\n // Trigger orders always carry a limitPx (the slippage cap for\n // market-on-trigger execution), so the placement type is the only reliable\n // source for how the order actually executes.\n orderType = getTriggerExecution(triggerOrderType);\n } else if (\n detailedOrderType?.toLowerCase().includes('limit') ||\n rawOrder.limitPx\n ) {\n orderType = 'limit';\n }\n\n const price = rawOrder.limitPx || rawOrder.triggerPx || '0';\n\n let size = rawOrder.sz;\n let originalSize = rawOrder.origSz || size;\n\n let currentSize = parseFloat(size);\n let origSize = parseFloat(originalSize);\n\n if (rawOrder.isPositionTpsl && origSize === 0 && position) {\n const absPositionSize = Math.abs(parseFloat(position.size));\n currentSize = absPositionSize;\n origSize = absPositionSize;\n size = absPositionSize.toString();\n originalSize = absPositionSize.toString();\n }\n\n const filledSize = origSize - currentSize;\n\n let takeProfitPrice: string | undefined;\n let stopLossPrice: string | undefined;\n let takeProfitOrderId: string | undefined;\n let stopLossOrderId: string | undefined;\n\n // TODO: We assume that there can only be 1 TP and 1 SL as children but there can be several TPSLs as children\n if (rawOrder.children && rawOrder.children.length > 0) {\n rawOrder.children.forEach((child) => {\n if (child.isTrigger && child.orderType) {\n if (child.orderType.includes('Take Profit')) {\n // HyperLiquid represents \"no trigger price\" as an empty string, not\n // null/undefined, so `||` (not `??`) is required to fall back to\n // limitPx when triggerPx is ''.\n takeProfitPrice = child.triggerPx || child.limitPx;\n takeProfitOrderId = child.oid.toString();\n } else if (child.orderType.includes('Stop')) {\n stopLossPrice = child.triggerPx || child.limitPx;\n stopLossOrderId = child.oid.toString();\n }\n }\n });\n }\n\n // Fallback: preserve parent-level TP/SL metadata when children are absent.\n takeProfitPrice ??= parentTpslMetadata.takeProfitPrice;\n stopLossPrice ??= parentTpslMetadata.stopLossPrice;\n takeProfitOrderId ??= parentTpslMetadata.takeProfitOrderId;\n stopLossOrderId ??= parentTpslMetadata.stopLossOrderId;\n\n // Build the order object\n const order: Order = {\n orderId,\n symbol,\n side,\n orderType,\n size,\n originalSize,\n price,\n filledSize: filledSize.toString(),\n remainingSize: size,\n status: 'open' as const,\n timestamp: rawOrder.timestamp,\n detailedOrderType,\n isTrigger,\n reduceOnly,\n };\n\n const strategyGroupId = readScaleGroupId(rawOrder.cloid);\n if (strategyGroupId) {\n order.strategyGroupId = strategyGroupId;\n }\n\n if (typeof rawOrder.isPositionTpsl === 'boolean') {\n order.isPositionTpsl = rawOrder.isPositionTpsl;\n }\n\n if (takeProfitPrice) {\n order.takeProfitPrice = takeProfitPrice;\n order.takeProfitOrderId = takeProfitOrderId;\n }\n if (stopLossPrice) {\n order.stopLossPrice = stopLossPrice;\n order.stopLossOrderId = stopLossOrderId;\n }\n if (rawOrder.triggerPx) {\n order.triggerPrice = rawOrder.triggerPx;\n }\n\n if (triggerOrderType) {\n order.triggerOrderType = triggerOrderType;\n }\n\n return order;\n}\n\n/**\n * Map HyperLiquid's human-readable order type string onto the provider-agnostic\n * trigger placement type.\n *\n * @param detailedOrderType - HyperLiquid `orderType` string (e.g. `'Stop Limit'`)\n * @returns The normalized trigger placement type, or undefined for non-trigger orders\n */\nexport function adaptTriggerOrderTypeFromSDK(\n detailedOrderType: string | undefined,\n): TriggerOrderType | undefined {\n if (!detailedOrderType) {\n return undefined;\n }\n\n const isTakeProfit = detailedOrderType.includes('Take Profit');\n const isStop = detailedOrderType.includes('Stop');\n\n if (!isTakeProfit && !isStop) {\n return undefined;\n }\n\n return buildTriggerOrderType({\n direction: isTakeProfit ? 'take_profit' : 'stop',\n execution: detailedOrderType.includes('Limit') ? 'limit' : 'market',\n });\n}\n\n/**\n * Build the position-state view of a trigger order attached to a position.\n *\n * HyperLiquid encodes \"the whole position\" as size `0` for position-bound TP/SL,\n * which is resolved here against the position size so consumers always see a\n * concrete quantity and can tell partial triggers apart.\n *\n * @param params - Mapping parameters\n * @param params.rawOrder - Raw HyperLiquid frontend order\n * @param params.positionSize - Signed or unsigned position size\n * @param params.entryPrice - Entry price, used to classify a trigger the exchange left unnamed\n * @returns The normalized trigger order, or undefined when the order is not a trigger\n */\nexport function adaptPositionTriggerOrderFromSDK(params: {\n rawOrder: Pick<\n FrontendOrder,\n 'oid' | 'orderType' | 'triggerPx' | 'limitPx' | 'sz' | 'reduceOnly'\n >;\n positionSize: string;\n entryPrice?: string;\n}): PositionTriggerOrder | undefined {\n const { rawOrder, positionSize, entryPrice } = params;\n\n const orderType = adaptTriggerOrderTypeFromSDK(rawOrder.orderType);\n\n // HyperLiquid uses '' for \"no trigger price\", so `||` (not `??`) is required.\n const triggerPrice = rawOrder.triggerPx || rawOrder.limitPx || '0';\n\n // Same rule as the WebSocket path: an unnamed trigger keeps its recoverable\n // direction and leaves its execution mode unstated, so both transports\n // report the same set of orders.\n const direction = orderType\n ? getTriggerDirection(orderType)\n : classifyTriggerDirection({ triggerPrice, entryPrice, positionSize });\n\n if (!direction) {\n return undefined;\n }\n const absolutePositionSize = Math.abs(parseFloat(positionSize || '0'));\n const rawSize = Math.abs(parseFloat(rawOrder.sz || '0'));\n\n // Position-bound TP/SL carries size 0, meaning the whole position.\n const size = rawSize > 0 ? rawSize : absolutePositionSize;\n\n return {\n orderId: rawOrder.oid.toString(),\n direction,\n orderType,\n triggerPrice,\n size: size.toString(),\n isPartial:\n rawSize > 0 && absolutePositionSize > 0 && rawSize < absolutePositionSize,\n reduceOnly: Boolean(rawOrder.reduceOnly),\n };\n}\n\nexport function adaptMarketFromSDK(\n sdkMarket: MetaResponse['universe'][number],\n): MarketInfo {\n return {\n name: sdkMarket.name,\n szDecimals: sdkMarket.szDecimals,\n maxLeverage: sdkMarket.maxLeverage,\n marginTableId: sdkMarket.marginTableId,\n onlyIsolated: sdkMarket.onlyIsolated,\n marginMode: sdkMarket.marginMode,\n isDelisted: sdkMarket.isDelisted,\n };\n}\n\n/**\n * Read one clearinghouse's cross-margin summary. A payload without the cross\n * fields reports none; present values must be finite decimals.\n *\n * @param perpsState - Clearinghouse state for one DEX.\n * @returns The summary, or undefined when the payload carries none.\n */\nfunction adaptCrossMarginSummaryFromSDK(\n perpsState: ClearinghouseStateResponse,\n): CrossMarginSummary | undefined {\n const { crossMarginSummary, crossMaintenanceMarginUsed } = perpsState;\n if (!crossMarginSummary || crossMaintenanceMarginUsed === undefined) {\n return undefined;\n }\n const summary: CrossMarginSummary = {\n accountValue: crossMarginSummary.accountValue,\n maintenanceMargin: crossMaintenanceMarginUsed,\n marginUsed: crossMarginSummary.totalMarginUsed,\n notional: crossMarginSummary.totalNtlPos,\n };\n for (const [field, value] of Object.entries(summary)) {\n if (parseFiniteDecimal(value) === null) {\n throw new Error(\n `Invalid HyperLiquid cross margin ${field} '${String(value)}'`,\n );\n }\n }\n return summary;\n}\n\n// Perps-only account adapter. Spot balances are layered on afterwards by\n// addSpotBalanceToAccountState, which enforces the USDC-only policy via\n// SPOT_COLLATERAL_COINS. Keeping spot logic out of here preserves a single\n// source of truth for spot balance math.\nexport function adaptAccountStateFromSDK(\n perpsState: ClearinghouseStateResponse,\n): AccountState {\n const { totalUnrealizedPnl, weightedReturnOnEquity } =\n perpsState.assetPositions.reduce(\n (acc, assetPos: AssetPosition) => {\n const unrealizedPnl = parseFloat(\n assetPos.position.unrealizedPnl || '0',\n );\n const marginUsed = parseFloat(assetPos.position.marginUsed || '0');\n const returnOnEquity = parseFloat(\n assetPos.position.returnOnEquity || '0',\n );\n acc.totalUnrealizedPnl += unrealizedPnl;\n acc.weightedReturnOnEquity += returnOnEquity * marginUsed;\n return acc;\n },\n {\n totalUnrealizedPnl: 0,\n weightedReturnOnEquity: 0,\n },\n );\n const totalMarginUsed = parseFloat(\n perpsState.marginSummary.totalMarginUsed || '0',\n );\n const totalReturnOnEquityPercentage =\n totalMarginUsed > 0\n ? ((weightedReturnOnEquity / totalMarginUsed) * 100).toString()\n : '0';\n\n const perpsBalance = parseFloat(perpsState.marginSummary.accountValue);\n\n const withdrawable = perpsState.withdrawable || '0';\n const crossMarginSummary = adaptCrossMarginSummaryFromSDK(perpsState);\n const accountState: AccountState = {\n spendableBalance: withdrawable,\n withdrawableBalance: withdrawable,\n totalBalance: perpsBalance.toString() || '0',\n marginUsed: perpsState.marginSummary.totalMarginUsed || '0',\n unrealizedPnl: totalUnrealizedPnl.toString() || '0',\n returnOnEquity: totalReturnOnEquityPercentage || '0',\n ...(crossMarginSummary ? { crossMarginSummary } : {}),\n };\n\n return accountState;\n}\n\nexport function buildAssetMapping(params: {\n metaUniverse: MetaResponse['universe'];\n dex?: string | null;\n perpDexIndex: number;\n}): {\n symbolToAssetId: Map<string, number>;\n assetIdToSymbol: Map<number, string>;\n} {\n const { metaUniverse, perpDexIndex } = params;\n const symbolToAssetId = new Map<string, number>();\n const assetIdToSymbol = new Map<number, string>();\n\n metaUniverse.forEach((asset, index) => {\n const assetId = calculateHip3AssetId(perpDexIndex, index);\n symbolToAssetId.set(asset.name, assetId);\n assetIdToSymbol.set(assetId, asset.name);\n });\n\n return { symbolToAssetId, assetIdToSymbol };\n}\n\nexport function formatHyperLiquidPrice(params: {\n price: string | number;\n szDecimals: number;\n}): string {\n const { price, szDecimals } = params;\n const priceNum = typeof price === 'string' ? parseFloat(price) : price;\n\n if (Number.isInteger(priceNum)) {\n return priceNum.toString();\n }\n\n const maxDecimalPlaces =\n DECIMAL_PRECISION_CONFIG.MaxPriceDecimals - szDecimals;\n\n let formattedPrice = priceNum.toFixed(maxDecimalPlaces);\n formattedPrice = parseFloat(formattedPrice).toString();\n\n const significantDigits = countSignificantFigures(formattedPrice);\n\n if (significantDigits > DECIMAL_PRECISION_CONFIG.MaxSignificantFigures) {\n formattedPrice = roundToSignificantFigures(formattedPrice);\n }\n\n return formattedPrice;\n}\n\nexport function formatHyperLiquidSize(params: {\n size: string | number;\n szDecimals: number;\n}): string {\n const { size, szDecimals } = params;\n const number = typeof size === 'string' ? parseFloat(size) : size;\n\n if (isNaN(number)) {\n return '0';\n }\n\n const formatted = number.toFixed(szDecimals);\n\n if (!formatted.includes('.')) {\n return formatted;\n }\n\n return formatted.replace(/\\.?0+$/u, '');\n}\n\nexport function calculatePositionSize(params: {\n usdValue: number;\n leverage: number;\n assetPrice: number;\n}): number {\n const { usdValue, leverage, assetPrice } = params;\n return (usdValue * leverage) / assetPrice;\n}\n\nexport function calculateHip3AssetId(\n perpDexIndex: number,\n indexInMeta: number,\n): number {\n if (perpDexIndex === 0) {\n return indexInMeta;\n }\n return (\n HIP3_ASSET_ID_CONFIG.BaseAssetId +\n perpDexIndex * HIP3_ASSET_ID_CONFIG.DexMultiplier +\n indexInMeta\n );\n}\n\n/**\n * Build the provider-neutral execution id for a HyperLiquid fill.\n *\n * HyperLiquid's `tid` is a 50-bit hash, and the venue documents\n * `(block_time, coin, tid)` as a trade's global identity, so all three go into\n * the id. REST and websocket fills report the same `time`, `coin` and `tid` for\n * one execution, so both transports yield the same id.\n *\n * @param fill - The raw HyperLiquid fill.\n * @param fill.coin - Venue asset name, including any HIP-3 dex prefix.\n * @param fill.time - Fill block time in milliseconds.\n * @param fill.tid - Venue trade id.\n * @returns The id, or `undefined` when the payload carries no `tid`. Omitting\n * it, rather than stringifying a missing value, keeps malformed fills from\n * sharing one id.\n */\nexport function buildHyperLiquidFillId(fill: {\n coin: string;\n time: number;\n tid?: number | null;\n}): string | undefined {\n if (fill.tid === undefined || fill.tid === null) {\n return undefined;\n }\n return `${fill.coin}:${fill.time}:${fill.tid}`;\n}\n\nexport function parseAssetName(assetName: string): {\n dex: string | null;\n symbol: string;\n} {\n const colonIndex = assetName.indexOf(':');\n if (colonIndex === -1) {\n return { dex: null, symbol: assetName };\n }\n return {\n dex: assetName.substring(0, colonIndex),\n symbol: assetName.substring(colonIndex + 1),\n };\n}\n\nexport function adaptHyperLiquidLedgerUpdateToUserHistoryItem(\n rawLedgerUpdates: RawLedgerUpdate[],\n): UserHistoryItem[] {\n return (rawLedgerUpdates || [])\n .filter((update) => {\n if (update.delta.type === 'deposit') {\n return true;\n }\n if (update.delta.type === 'withdraw') {\n return true;\n }\n if (update.delta.type === 'internalTransfer') {\n const usdc = Number.parseFloat(update.delta.usdc ?? '0');\n if (Number.isNaN(usdc)) {\n return false;\n }\n return usdc > 0;\n }\n return false;\n })\n .map((update) => {\n let amount = '0';\n let asset = 'USDC';\n\n if (hasProperty(update.delta, 'usdc') && update.delta.usdc) {\n amount = Math.abs(parseFloat(update.delta.usdc)).toString();\n }\n if (\n hasProperty(update.delta, 'coin') &&\n typeof update.delta.coin === 'string'\n ) {\n asset = update.delta.coin;\n }\n\n return {\n id: `history-${update.hash}`,\n timestamp: update.time,\n amount,\n asset,\n txHash: update.hash,\n status: 'completed' as const,\n type: update.delta.type === 'withdraw' ? 'withdrawal' : 'deposit',\n details: {\n source: '',\n bridgeContract: undefined,\n recipient: undefined,\n blockNumber: undefined,\n chainId: undefined,\n synthetic: undefined,\n },\n };\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"hyperLiquidAdapter.js","sourceRoot":"","sources":["../../src/utils/hyperLiquidAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAO,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAsB1D,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAS3D,MAAM,CAAC,MAAM,8BAA8B,GAAG,UAAU,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,aAAwC,EACpB,EAAE;IACtB,MAAM,UAAU,GAAG,aAAa,EAAE,WAAW,EAAE,CAAC;IAChD,IACE,UAAU,EAAE,MAAM,KAAK,EAAE;QACzB,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,8BAA8B,EAAE,CAAC,EAC7D,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,SAAS,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EA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AI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YAC1B,SAAS;QACX,CAAC;QACD,MAAM,WAAW,GAAG,gBAAgB,CAAC;YACnC,EAAE,EACA,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ;gBAC3B,CAAC,CAAC,sBAAsB,CAAC,KAAK,CAAC;gBAC/B,CAAC,CAAC,SAAS;YACf,MAAM;YACN,KAAK,EAAE,KAAK,CAAC,EAAE;YACf,IAAI,EAAE,KAAK,CAAC,EAAE;YACd,IAAI,EAAE,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI;YAChD,SAAS,EAAE,KAAK,CAAC,IAAI;YACrB,MAAM,EACJ,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;gBAC9B,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;gBACrC,CAAC,CAAC,KAAK,CAAC,IAAI;gBACZ,CAAC,CAAC,SAAS;YACf,UAAU,EAAE,aAAa;SAC1B,CAAC,CAAC;QACH,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,2BAA2B,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["import { hasProperty, Hex, isHexString } from '@metamask/utils';\n\nimport {\n BASIS_POINTS_DIVISOR,\n HIP3_ASSET_ID_CONFIG,\n} from '../constants/hyperLiquidConfig.js';\nimport {\n DECIMAL_PRECISION_CONFIG,\n ORDER_SLIPPAGE_CONFIG,\n} from '../constants/perpsConfig.js';\nimport { PERPS_ERROR_CODES } from '../perpsErrorCodes.js';\nimport type {\n AssetPosition,\n FrontendOrder,\n ClearinghouseStateResponse,\n HyperLiquidPublicTrade,\n MetaResponse,\n SDKOrderParams,\n} from '../types/hyperliquid-types.js';\nimport type {\n AccountState,\n CrossMarginSummary,\n MarketInfo,\n Order,\n OrderParams as PerpsOrderParams,\n Position,\n PositionTriggerOrder,\n PublicTrade,\n RawLedgerUpdate,\n UserHistoryItem,\n} from '../types/index.js';\nimport type { TpslLinkage, TriggerOrderType } from '../types/perps-types.js';\nimport {\n buildTriggerOrderType,\n classifyTriggerDirection,\n getTriggerDirection,\n getTriggerExecution,\n isLimitExecutionOrderType,\n isTriggerOrderType,\n toSDKTimeInForce,\n} from './orderTypes.js';\nimport {\n buildPublicTrade,\n sortPublicTradesNewestFirst,\n} from './publicTrades.js';\nimport {\n countSignificantFigures,\n roundToSignificantFigures,\n} from './significantFigures.js';\nimport { parseFiniteDecimal } from './stringParseUtils.js';\n\ntype FrontendOrderWithParentTpsl = FrontendOrder & {\n takeProfitPrice?: unknown;\n stopLossPrice?: unknown;\n takeProfitOrderId?: unknown;\n stopLossOrderId?: unknown;\n};\n\nexport const HYPERLIQUID_SCALE_CLOID_MARKER = '4d4d5343';\n\n/**\n * Recover the Scale group shared by MetaMask-generated rung CLOIDs.\n *\n * @param clientOrderId - HyperLiquid client order ID.\n * @returns The Scale handle, or undefined for an unrelated order.\n */\nexport const readScaleGroupId = (\n clientOrderId: string | null | undefined,\n): string | undefined => {\n const normalized = clientOrderId?.toLowerCase();\n if (\n normalized?.length !== 34 ||\n !normalized.startsWith(`0x${HYPERLIQUID_SCALE_CLOID_MARKER}`)\n ) {\n return undefined;\n }\n return `scale:${normalized.slice(2, -2)}`;\n};\n\nconst readOptionalString = (value: unknown): string | undefined =>\n typeof value === 'string' && value.length > 0 ? value : undefined;\n\nconst readOptionalOrderId = (value: unknown): string | undefined => {\n if (typeof value === 'string' && value.length > 0) {\n return value;\n }\n\n if (typeof value === 'number' && Number.isFinite(value)) {\n return value.toString();\n }\n\n return undefined;\n};\n\nconst getParentTpslMetadata = (\n rawOrder: FrontendOrderWithParentTpsl,\n): {\n takeProfitPrice?: string;\n stopLossPrice?: string;\n takeProfitOrderId?: string;\n stopLossOrderId?: string;\n} => ({\n takeProfitPrice: readOptionalString(rawOrder.takeProfitPrice),\n stopLossPrice: readOptionalString(rawOrder.stopLossPrice),\n takeProfitOrderId: readOptionalOrderId(rawOrder.takeProfitOrderId),\n stopLossOrderId: readOptionalOrderId(rawOrder.stopLossOrderId),\n});\n\n/**\n * HyperLiquid SDK Adapter Utilities\n *\n * These functions transform between MetaMask Perps API types and HyperLiquid SDK types.\n * The SDK uses cryptic property names for efficiency, but our API uses descriptive names\n * to provide a consistent interface across different perps protocols.\n */\n\nexport function adaptOrderToSDK(\n order: PerpsOrderParams,\n symbolToAssetId: Map<string, number>,\n): SDKOrderParams {\n const assetId = symbolToAssetId.get(order.symbol);\n if (assetId === undefined) {\n const availableDexs = new Set<string>();\n symbolToAssetId.forEach((_, symbol) => {\n if (symbol.includes(':')) {\n const dex = symbol.split(':')[0];\n availableDexs.add(dex);\n }\n });\n\n const dexHint =\n availableDexs.size > 0\n ? ` Available HIP-3 DEXs: ${Array.from(availableDexs).join(', ')}`\n : ' No HIP-3 DEXs currently available.';\n\n throw new Error(\n `Asset ${order.symbol} not found in asset mapping.${dexHint} Check console logs for \"HyperLiquidProvider: Asset mapping built\" to see available assets.`,\n );\n }\n\n return {\n a: assetId,\n b: order.isBuy,\n p: order.price ?? resolveTriggerCapPrice(order) ?? '0',\n s: order.size,\n r: order.reduceOnly ?? false,\n t: adaptOrderTypeToSDK(order),\n c:\n order.clientOrderId && isHexString(order.clientOrderId)\n ? order.clientOrderId\n : undefined,\n };\n}\n\n/**\n * Derive the slippage cap a market-on-trigger order submits as its price.\n *\n * A `stop_market` / `take_profit_market` order legitimately carries no limit\n * price, but the SDK still requires a positive `p` — it is the cap the order\n * fills against once the trigger fires, not a resting price. Sending `'0'`\n * fails SDK validation before the request is ever made.\n *\n * The cap follows the order's own tolerance, matching `calculateOrderPriceAndSize`\n * on the `placeOrder` path, so the same order priced through either route gets\n * the same execution bound.\n *\n * @param order - Order params carrying the placement type, trigger price, and\n * slippage tolerance.\n * @returns The formatted cap price, or undefined when the order needs no cap.\n */\nfunction resolveTriggerCapPrice(order: PerpsOrderParams): string | undefined {\n if (\n !isTriggerOrderType(order.orderType) ||\n isLimitExecutionOrderType(order.orderType) ||\n !order.triggerPrice\n ) {\n return undefined;\n }\n\n const triggerPrice = parseFloat(order.triggerPrice);\n if (!Number.isFinite(triggerPrice)) {\n return undefined;\n }\n\n // Accept the deprecated decimal `slippage` too, normalizing it to bps the way\n // `placeOrder` does, so neither spelling silently falls back to the default.\n const effectiveBps =\n order.maxSlippageBps ??\n (typeof order.slippage === 'number'\n ? Math.round(order.slippage * BASIS_POINTS_DIVISOR)\n : undefined) ??\n ORDER_SLIPPAGE_CONFIG.DefaultTpslSlippageBps;\n\n // Buying pays up to the cap, selling accepts down to it.\n const slippage = effectiveBps / BASIS_POINTS_DIVISOR;\n const capPrice = order.isBuy\n ? triggerPrice * (1 + slippage)\n : triggerPrice * (1 - slippage);\n\n return capPrice.toString();\n}\n\n/**\n * Map a placement type onto the SDK's order-type field.\n *\n * @param order - Order params carrying the placement type and trigger price\n * @returns The SDK order-type field\n */\nfunction adaptOrderTypeToSDK(order: PerpsOrderParams): SDKOrderParams['t'] {\n if (isTriggerOrderType(order.orderType)) {\n if (order.timeInForce !== undefined) {\n throw new Error(PERPS_ERROR_CODES.ORDER_TIME_IN_FORCE_NOT_SUPPORTED);\n }\n if (!order.triggerPrice) {\n throw new Error(PERPS_ERROR_CODES.ORDER_TRIGGER_PRICE_REQUIRED);\n }\n\n return {\n trigger: {\n isMarket: !isLimitExecutionOrderType(order.orderType),\n triggerPx: order.triggerPrice,\n tpsl: getTriggerDirection(order.orderType) === 'stop' ? 'sl' : 'tp',\n },\n };\n }\n\n if (order.orderType === 'limit') {\n return { limit: { tif: toSDKTimeInForce(order.timeInForce) } };\n }\n if (order.timeInForce !== undefined) {\n throw new Error(PERPS_ERROR_CODES.ORDER_TIME_IN_FORCE_NOT_SUPPORTED);\n }\n return { limit: { tif: 'FrontendMarket' } };\n}\n\n/**\n * Map the provider-agnostic TP/SL linkage onto HyperLiquid's grouping vocabulary.\n *\n * @param linkage - How the attached TP/SL is linked.\n * @returns The HyperLiquid grouping value.\n */\nexport function adaptTpslLinkageToGrouping(\n linkage: TpslLinkage,\n): 'na' | 'normalTpsl' | 'positionTpsl' {\n switch (linkage) {\n case 'position':\n return 'positionTpsl';\n case 'order':\n return 'normalTpsl';\n default:\n return 'na';\n }\n}\n\nexport function adaptPositionFromSDK(assetPosition: AssetPosition): Position {\n const pos = assetPosition.position;\n return {\n symbol: pos.coin,\n size: pos.szi,\n entryPrice: pos.entryPx,\n positionValue: pos.positionValue,\n unrealizedPnl: pos.unrealizedPnl,\n marginUsed: pos.marginUsed,\n leverage: {\n type: pos.leverage.type,\n value: pos.leverage.value,\n rawUsd:\n pos.leverage.type === 'isolated' ? pos.leverage.rawUsd : undefined,\n },\n liquidationPrice: pos.liquidationPx,\n maxLeverage: pos.maxLeverage,\n returnOnEquity: pos.returnOnEquity,\n cumulativeFunding: pos.cumFunding,\n takeProfitCount: 0,\n stopLossCount: 0,\n };\n}\n\nexport function adaptOrderFromSDK(\n rawOrder: FrontendOrder,\n position?: Position,\n): Order {\n // TODO: Remove this widened boundary type when FrontendOrder includes\n // takeProfitPrice/stopLossPrice and takeProfitOrderId/stopLossOrderId.\n const parentTpslMetadata = getParentTpslMetadata(rawOrder);\n\n // Extract basic fields with appropriate conversions\n const orderId = rawOrder.oid?.toString() || '';\n const symbol = rawOrder.coin;\n const side: 'buy' | 'sell' = rawOrder.side === 'B' ? 'buy' : 'sell';\n const detailedOrderType = rawOrder.orderType;\n const { isTrigger } = rawOrder;\n const { reduceOnly } = rawOrder;\n\n const triggerOrderType = adaptTriggerOrderTypeFromSDK(detailedOrderType);\n\n let orderType: 'limit' | 'market' = 'market';\n if (triggerOrderType) {\n // Trigger orders always carry a limitPx (the slippage cap for\n // market-on-trigger execution), so the placement type is the only reliable\n // source for how the order actually executes.\n orderType = getTriggerExecution(triggerOrderType);\n } else if (\n detailedOrderType?.toLowerCase().includes('limit') ||\n rawOrder.limitPx\n ) {\n orderType = 'limit';\n }\n\n const price = rawOrder.limitPx || rawOrder.triggerPx || '0';\n\n let size = rawOrder.sz;\n let originalSize = rawOrder.origSz || size;\n\n let currentSize = parseFloat(size);\n let origSize = parseFloat(originalSize);\n\n if (rawOrder.isPositionTpsl && origSize === 0 && position) {\n const absPositionSize = Math.abs(parseFloat(position.size));\n currentSize = absPositionSize;\n origSize = absPositionSize;\n size = absPositionSize.toString();\n originalSize = absPositionSize.toString();\n }\n\n const filledSize = origSize - currentSize;\n\n let takeProfitPrice: string | undefined;\n let stopLossPrice: string | undefined;\n let takeProfitOrderId: string | undefined;\n let stopLossOrderId: string | undefined;\n\n // TODO: We assume that there can only be 1 TP and 1 SL as children but there can be several TPSLs as children\n if (rawOrder.children && rawOrder.children.length > 0) {\n rawOrder.children.forEach((child) => {\n if (child.isTrigger && child.orderType) {\n if (child.orderType.includes('Take Profit')) {\n // HyperLiquid represents \"no trigger price\" as an empty string, not\n // null/undefined, so `||` (not `??`) is required to fall back to\n // limitPx when triggerPx is ''.\n takeProfitPrice = child.triggerPx || child.limitPx;\n takeProfitOrderId = child.oid.toString();\n } else if (child.orderType.includes('Stop')) {\n stopLossPrice = child.triggerPx || child.limitPx;\n stopLossOrderId = child.oid.toString();\n }\n }\n });\n }\n\n // Fallback: preserve parent-level TP/SL metadata when children are absent.\n takeProfitPrice ??= parentTpslMetadata.takeProfitPrice;\n stopLossPrice ??= parentTpslMetadata.stopLossPrice;\n takeProfitOrderId ??= parentTpslMetadata.takeProfitOrderId;\n stopLossOrderId ??= parentTpslMetadata.stopLossOrderId;\n\n // Build the order object\n const order: Order = {\n orderId,\n symbol,\n side,\n orderType,\n size,\n originalSize,\n price,\n filledSize: filledSize.toString(),\n remainingSize: size,\n status: 'open' as const,\n timestamp: rawOrder.timestamp,\n detailedOrderType,\n isTrigger,\n reduceOnly,\n };\n\n const strategyGroupId = readScaleGroupId(rawOrder.cloid);\n if (strategyGroupId) {\n order.strategyGroupId = strategyGroupId;\n }\n\n if (typeof rawOrder.isPositionTpsl === 'boolean') {\n order.isPositionTpsl = rawOrder.isPositionTpsl;\n }\n\n if (takeProfitPrice) {\n order.takeProfitPrice = takeProfitPrice;\n order.takeProfitOrderId = takeProfitOrderId;\n }\n if (stopLossPrice) {\n order.stopLossPrice = stopLossPrice;\n order.stopLossOrderId = stopLossOrderId;\n }\n if (rawOrder.triggerPx) {\n order.triggerPrice = rawOrder.triggerPx;\n }\n\n if (triggerOrderType) {\n order.triggerOrderType = triggerOrderType;\n }\n\n return order;\n}\n\n/**\n * Map HyperLiquid's human-readable order type string onto the provider-agnostic\n * trigger placement type.\n *\n * @param detailedOrderType - HyperLiquid `orderType` string (e.g. `'Stop Limit'`)\n * @returns The normalized trigger placement type, or undefined for non-trigger orders\n */\nexport function adaptTriggerOrderTypeFromSDK(\n detailedOrderType: string | undefined,\n): TriggerOrderType | undefined {\n if (!detailedOrderType) {\n return undefined;\n }\n\n const isTakeProfit = detailedOrderType.includes('Take Profit');\n const isStop = detailedOrderType.includes('Stop');\n\n if (!isTakeProfit && !isStop) {\n return undefined;\n }\n\n return buildTriggerOrderType({\n direction: isTakeProfit ? 'take_profit' : 'stop',\n execution: detailedOrderType.includes('Limit') ? 'limit' : 'market',\n });\n}\n\n/**\n * Build the position-state view of a trigger order attached to a position.\n *\n * HyperLiquid encodes \"the whole position\" as size `0` for position-bound TP/SL,\n * which is resolved here against the position size so consumers always see a\n * concrete quantity and can tell partial triggers apart.\n *\n * @param params - Mapping parameters\n * @param params.rawOrder - Raw HyperLiquid frontend order\n * @param params.positionSize - Signed or unsigned position size\n * @param params.entryPrice - Entry price, used to classify a trigger the exchange left unnamed\n * @returns The normalized trigger order, or undefined when the order is not a trigger\n */\nexport function adaptPositionTriggerOrderFromSDK(params: {\n rawOrder: Pick<\n FrontendOrder,\n 'oid' | 'orderType' | 'triggerPx' | 'limitPx' | 'sz' | 'reduceOnly'\n >;\n positionSize: string;\n entryPrice?: string;\n}): PositionTriggerOrder | undefined {\n const { rawOrder, positionSize, entryPrice } = params;\n\n const orderType = adaptTriggerOrderTypeFromSDK(rawOrder.orderType);\n\n // HyperLiquid uses '' for \"no trigger price\", so `||` (not `??`) is required.\n const triggerPrice = rawOrder.triggerPx || rawOrder.limitPx || '0';\n\n // Same rule as the WebSocket path: an unnamed trigger keeps its recoverable\n // direction and leaves its execution mode unstated, so both transports\n // report the same set of orders.\n const direction = orderType\n ? getTriggerDirection(orderType)\n : classifyTriggerDirection({ triggerPrice, entryPrice, positionSize });\n\n if (!direction) {\n return undefined;\n }\n const absolutePositionSize = Math.abs(parseFloat(positionSize || '0'));\n const rawSize = Math.abs(parseFloat(rawOrder.sz || '0'));\n\n // Position-bound TP/SL carries size 0, meaning the whole position.\n const size = rawSize > 0 ? rawSize : absolutePositionSize;\n\n return {\n orderId: rawOrder.oid.toString(),\n direction,\n orderType,\n triggerPrice,\n size: size.toString(),\n isPartial:\n rawSize > 0 && absolutePositionSize > 0 && rawSize < absolutePositionSize,\n reduceOnly: Boolean(rawOrder.reduceOnly),\n };\n}\n\nexport function adaptMarketFromSDK(\n sdkMarket: MetaResponse['universe'][number],\n): MarketInfo {\n return {\n name: sdkMarket.name,\n szDecimals: sdkMarket.szDecimals,\n maxLeverage: sdkMarket.maxLeverage,\n marginTableId: sdkMarket.marginTableId,\n onlyIsolated: sdkMarket.onlyIsolated,\n marginMode: sdkMarket.marginMode,\n isDelisted: sdkMarket.isDelisted,\n };\n}\n\n/**\n * Read one clearinghouse's cross-margin summary. A payload without the cross\n * fields reports none; present values must be finite decimals.\n *\n * @param perpsState - Clearinghouse state for one DEX.\n * @returns The summary, or undefined when the payload carries none.\n */\nfunction adaptCrossMarginSummaryFromSDK(\n perpsState: ClearinghouseStateResponse,\n): CrossMarginSummary | undefined {\n const { crossMarginSummary, crossMaintenanceMarginUsed } = perpsState;\n if (!crossMarginSummary || crossMaintenanceMarginUsed === undefined) {\n return undefined;\n }\n const summary: CrossMarginSummary = {\n accountValue: crossMarginSummary.accountValue,\n maintenanceMargin: crossMaintenanceMarginUsed,\n marginUsed: crossMarginSummary.totalMarginUsed,\n notional: crossMarginSummary.totalNtlPos,\n };\n for (const [field, value] of Object.entries(summary)) {\n if (parseFiniteDecimal(value) === null) {\n throw new Error(\n `Invalid HyperLiquid cross margin ${field} '${String(value)}'`,\n );\n }\n }\n return summary;\n}\n\n// Perps-only account adapter. Spot balances are layered on afterwards by\n// addSpotBalanceToAccountState, which enforces the USDC-only policy via\n// SPOT_COLLATERAL_COINS. Keeping spot logic out of here preserves a single\n// source of truth for spot balance math.\nexport function adaptAccountStateFromSDK(\n perpsState: ClearinghouseStateResponse,\n): AccountState {\n const { totalUnrealizedPnl, weightedReturnOnEquity } =\n perpsState.assetPositions.reduce(\n (acc, assetPos: AssetPosition) => {\n const unrealizedPnl = parseFloat(\n assetPos.position.unrealizedPnl || '0',\n );\n const marginUsed = parseFloat(assetPos.position.marginUsed || '0');\n const returnOnEquity = parseFloat(\n assetPos.position.returnOnEquity || '0',\n );\n acc.totalUnrealizedPnl += unrealizedPnl;\n acc.weightedReturnOnEquity += returnOnEquity * marginUsed;\n return acc;\n },\n {\n totalUnrealizedPnl: 0,\n weightedReturnOnEquity: 0,\n },\n );\n const totalMarginUsed = parseFloat(\n perpsState.marginSummary.totalMarginUsed || '0',\n );\n const totalReturnOnEquityPercentage =\n totalMarginUsed > 0\n ? ((weightedReturnOnEquity / totalMarginUsed) * 100).toString()\n : '0';\n\n const perpsBalance = parseFloat(perpsState.marginSummary.accountValue);\n\n const withdrawable = perpsState.withdrawable || '0';\n const crossMarginSummary = adaptCrossMarginSummaryFromSDK(perpsState);\n const accountState: AccountState = {\n spendableBalance: withdrawable,\n withdrawableBalance: withdrawable,\n totalBalance: perpsBalance.toString() || '0',\n marginUsed: perpsState.marginSummary.totalMarginUsed || '0',\n unrealizedPnl: totalUnrealizedPnl.toString() || '0',\n returnOnEquity: totalReturnOnEquityPercentage || '0',\n ...(crossMarginSummary ? { crossMarginSummary } : {}),\n };\n\n return accountState;\n}\n\nexport function buildAssetMapping(params: {\n metaUniverse: MetaResponse['universe'];\n dex?: string | null;\n perpDexIndex: number;\n}): {\n symbolToAssetId: Map<string, number>;\n assetIdToSymbol: Map<number, string>;\n} {\n const { metaUniverse, perpDexIndex } = params;\n const symbolToAssetId = new Map<string, number>();\n const assetIdToSymbol = new Map<number, string>();\n\n metaUniverse.forEach((asset, index) => {\n const assetId = calculateHip3AssetId(perpDexIndex, index);\n symbolToAssetId.set(asset.name, assetId);\n assetIdToSymbol.set(assetId, asset.name);\n });\n\n return { symbolToAssetId, assetIdToSymbol };\n}\n\nexport function formatHyperLiquidPrice(params: {\n price: string | number;\n szDecimals: number;\n}): string {\n const { price, szDecimals } = params;\n const priceNum = typeof price === 'string' ? parseFloat(price) : price;\n\n if (Number.isInteger(priceNum)) {\n return priceNum.toString();\n }\n\n const maxDecimalPlaces =\n DECIMAL_PRECISION_CONFIG.MaxPriceDecimals - szDecimals;\n\n let formattedPrice = priceNum.toFixed(maxDecimalPlaces);\n formattedPrice = parseFloat(formattedPrice).toString();\n\n const significantDigits = countSignificantFigures(formattedPrice);\n\n if (significantDigits > DECIMAL_PRECISION_CONFIG.MaxSignificantFigures) {\n formattedPrice = roundToSignificantFigures(formattedPrice);\n }\n\n return formattedPrice;\n}\n\nexport function formatHyperLiquidSize(params: {\n size: string | number;\n szDecimals: number;\n}): string {\n const { size, szDecimals } = params;\n const number = typeof size === 'string' ? parseFloat(size) : size;\n\n if (isNaN(number)) {\n return '0';\n }\n\n const formatted = number.toFixed(szDecimals);\n\n if (!formatted.includes('.')) {\n return formatted;\n }\n\n return formatted.replace(/\\.?0+$/u, '');\n}\n\nexport function calculatePositionSize(params: {\n usdValue: number;\n leverage: number;\n assetPrice: number;\n}): number {\n const { usdValue, leverage, assetPrice } = params;\n return (usdValue * leverage) / assetPrice;\n}\n\nexport function calculateHip3AssetId(\n perpDexIndex: number,\n indexInMeta: number,\n): number {\n if (perpDexIndex === 0) {\n return indexInMeta;\n }\n return (\n HIP3_ASSET_ID_CONFIG.BaseAssetId +\n perpDexIndex * HIP3_ASSET_ID_CONFIG.DexMultiplier +\n indexInMeta\n );\n}\n\n/**\n * Build the provider-neutral execution id for a HyperLiquid fill.\n *\n * HyperLiquid's `tid` is a 50-bit hash, and the venue documents\n * `(block_time, coin, tid)` as a trade's global identity, so all three go into\n * the id. REST and websocket fills report the same `time`, `coin` and `tid` for\n * one execution, so both transports yield the same id.\n *\n * @param fill - The raw HyperLiquid fill.\n * @param fill.coin - Venue asset name, including any HIP-3 dex prefix.\n * @param fill.time - Fill block time in milliseconds.\n * @param fill.tid - Venue trade id.\n * @returns The id, or `undefined` when the payload carries no `tid`. Omitting\n * it, rather than stringifying a missing value, keeps malformed fills from\n * sharing one id.\n */\nexport function buildHyperLiquidFillId(fill: {\n coin: string;\n time: number;\n tid?: number | null;\n}): string | undefined {\n if (fill.tid === undefined || fill.tid === null) {\n return undefined;\n }\n return `${fill.coin}:${fill.time}:${fill.tid}`;\n}\n\nexport function parseAssetName(assetName: string): {\n dex: string | null;\n symbol: string;\n} {\n const colonIndex = assetName.indexOf(':');\n if (colonIndex === -1) {\n return { dex: null, symbol: assetName };\n }\n return {\n dex: assetName.substring(0, colonIndex),\n symbol: assetName.substring(colonIndex + 1),\n };\n}\n\nexport function adaptHyperLiquidLedgerUpdateToUserHistoryItem(\n rawLedgerUpdates: RawLedgerUpdate[],\n): UserHistoryItem[] {\n return (rawLedgerUpdates || [])\n .filter((update) => {\n if (update.delta.type === 'deposit') {\n return true;\n }\n if (update.delta.type === 'withdraw') {\n return true;\n }\n if (update.delta.type === 'internalTransfer') {\n const usdc = Number.parseFloat(update.delta.usdc ?? '0');\n if (Number.isNaN(usdc)) {\n return false;\n }\n return usdc > 0;\n }\n return false;\n })\n .map((update) => {\n let amount = '0';\n let asset = 'USDC';\n\n if (hasProperty(update.delta, 'usdc') && update.delta.usdc) {\n amount = Math.abs(parseFloat(update.delta.usdc)).toString();\n }\n if (\n hasProperty(update.delta, 'coin') &&\n typeof update.delta.coin === 'string'\n ) {\n asset = update.delta.coin;\n }\n\n return {\n id: `history-${update.hash}`,\n timestamp: update.time,\n amount,\n asset,\n txHash: update.hash,\n status: 'completed' as const,\n type: update.delta.type === 'withdraw' ? 'withdrawal' : 'deposit',\n details: {\n source: '',\n bridgeContract: undefined,\n recipient: undefined,\n blockNumber: undefined,\n chainId: undefined,\n synthetic: undefined,\n },\n };\n });\n}\n\nconst HYPERLIQUID_ZERO_HASH = /^0x0+$/u;\nconst HYPERLIQUID_TRADE_SIDE = { B: 'buy', A: 'sell' } as const;\n\n/**\n * Adapt Hyperliquid public trades (REST `recentTrades` or WS `trades`) to\n * {@link PublicTrade}, newest first. Trades for another coin and malformed\n * trades are dropped. `side` is the aggressor's: `B` bought, `A` sold. The id\n * comes from {@link buildHyperLiquidFillId}, so both transports give one\n * execution the same id.\n *\n * @param trades - SDK trades.\n * @param symbol - Requested coin; other coins are dropped.\n * @returns The trades for `symbol`, newest first.\n */\nexport function adaptPublicTradesFromHyperLiquid(\n trades: readonly HyperLiquidPublicTrade[],\n symbol: string,\n): PublicTrade[] {\n const adapted: PublicTrade[] = [];\n for (const trade of trades) {\n if (trade.coin !== symbol) {\n continue;\n }\n const publicTrade = buildPublicTrade({\n id:\n typeof trade.tid === 'number'\n ? buildHyperLiquidFillId(trade)\n : undefined,\n symbol,\n price: trade.px,\n size: trade.sz,\n side: HYPERLIQUID_TRADE_SIDE[trade.side] ?? null,\n timestamp: trade.time,\n txHash:\n typeof trade.hash === 'string' &&\n !HYPERLIQUID_ZERO_HASH.test(trade.hash)\n ? trade.hash\n : undefined,\n providerId: 'hyperliquid',\n });\n if (publicTrade) {\n adapted.push(publicTrade);\n }\n }\n return sortPublicTradesNewestFirst(adapted);\n}\n"]}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - Position side is a `sign` field (1 = long, -1 = short).
|
|
12
12
|
* - USDC collateral, single margin mode per account in the POC (cross).
|
|
13
13
|
*/
|
|
14
|
-
import type { AccountState, CrossMarginSummary, MarketDataFormatters, MarketInfo, Order, OrderFill, PerpsMarketData, Position, PriceUpdate } from '../types/index.js';
|
|
14
|
+
import type { AccountState, CrossMarginSummary, MarketDataFormatters, MarketInfo, Order, OrderFill, PerpsMarketData, Position, PriceUpdate, PublicTrade } from '../types/index.js';
|
|
15
15
|
import type { LighterApiOrder, LighterApiPosition, LighterOrderBookDetail, LighterOrderBookMeta, LighterRestTrade, LighterWsTrade, LighterSubAccount, LighterWsMarketStat, LighterWsUserStats } from '../types/lighter-types.js';
|
|
16
16
|
/**
|
|
17
17
|
* Transform a Lighter order book meta entry into canonical MarketInfo.
|
|
@@ -90,6 +90,18 @@ export declare function deriveLighterFillDirection(context: {
|
|
|
90
90
|
signChanged: boolean | undefined;
|
|
91
91
|
pnl: number | undefined;
|
|
92
92
|
}): string;
|
|
93
|
+
/**
|
|
94
|
+
* Adapt Lighter public trades (REST `recentTrades` or the `trade/{market_id}`
|
|
95
|
+
* channel, camelized) to {@link PublicTrade}, newest first. Trades for
|
|
96
|
+
* another market and malformed trades are dropped. A maker ask means the
|
|
97
|
+
* taker (aggressor) bought.
|
|
98
|
+
*
|
|
99
|
+
* @param trades - Camelized venue trades.
|
|
100
|
+
* @param marketId - Requested market; other markets are dropped.
|
|
101
|
+
* @param symbol - Symbol to stamp on each trade.
|
|
102
|
+
* @returns The trades for the market, newest first.
|
|
103
|
+
*/
|
|
104
|
+
export declare function adaptPublicTradesFromLighter(trades: readonly unknown[], marketId: number, symbol: string): PublicTrade[];
|
|
93
105
|
export declare function adaptFillFromLighterTrade(trade: LighterRestTrade | LighterWsTrade, symbol: string, accountIndex: number): OrderFill;
|
|
94
106
|
/**
|
|
95
107
|
* Transform a Lighter account position into canonical Position.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lighterAdapter.d.ts","sourceRoot":"","sources":["../../src/utils/lighterAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,KAAK,EACL,SAAS,EACT,eAAe,EACf,QAAQ,EACR,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"lighterAdapter.d.ts","sourceRoot":"","sources":["../../src/utils/lighterAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,KAAK,EACL,SAAS,EACT,eAAe,EACf,QAAQ,EACR,WAAW,EACX,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AAmDnC;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,oBAAoB,EAC5B,WAAW,EAAE,MAAM,GAClB,UAAU,CAgBZ;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,sBAAsB,EAC9B,UAAU,EAAE,oBAAoB,GAC/B,eAAe,CAmCjB;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,sBAAsB,EAC9B,SAAS,EAAE,MAAM,GAChB,WAAW,CAUb;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,mBAAmB,EACzB,SAAS,EAAE,MAAM,GAChB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