/** * Hyperliquid Spot Adapter. * * Uses the same exchange.placeOrder() endpoint as perps — the only difference * is the asset index: spot assets use `10000 + spotIndex`. * * Composes with HyperliquidAdapter for signing and API access. */ import type { SpotAdapter, SpotMarketInfo, SpotBalance } from "./spot-interface.js"; import type { HyperliquidAdapter } from "./hyperliquid.js"; export declare class HyperliquidSpotAdapter implements SpotAdapter { readonly name = "hyperliquid"; private _hl; private _spotAssetMap; private _spotAssetReverse; private _spotDecimals; private _spotCanonical; private _initialized; private _cachedMetaCtx; constructor(hlAdapter: HyperliquidAdapter); /** Load spot metadata from the Hyperliquid spot API */ init(): Promise; private _loadSpotMeta; getSpotMarkets(): Promise; getSpotOrderbook(symbol: string): Promise<{ bids: [string, string][]; asks: [string, string][]; }>; getSpotBalances(): Promise; spotMarketOrder(symbol: string, side: "buy" | "sell", size: string): Promise; spotLimitOrder(symbol: string, side: "buy" | "sell", price: string, size: string, opts?: { tif?: string; }): Promise; spotCancelOrder(symbol: string, orderId: string): Promise; /** * Transfer USDC between perp and spot accounts. * HL uses separate balances — spot buys require USDC in the spot account. * Uses SDK's transferBetweenSpotAndPerp (userSignedAction, not L1 action). */ transferUsdcToSpot(amount: number): Promise; transferUsdcToPerp(amount: number): Promise; /** Get the spot asset index (without the 10000 offset) */ getSpotIndex(base: string): number | undefined; /** Get spot size decimals for a base token — from API data, not hardcoded */ getSpotDecimals(base: string): { size: number; price: number; }; /** * Resolve a symbol to its actual spot base token and index. * Handles U-token mapping: "BTC" → "UBTC" (Unit protocol bridged token). * Throws if no mapping found. */ private _resolveBase; /** * Get the perp symbol for a spot token. * e.g., "UBTC" → "BTC", "ETH" → "ETH" */ getUnderlying(spotBase: string): string; /** * Validate that an order actually filled. * HL API returns status "ok" even for 0-fill IoC orders. * Response shape: { status: "ok", response: { type: "order", data: { statuses: [...] } } } * Each status is one of: { filled: { totalSz, avgPx, oid } }, { resting: { oid } }, { error: "msg" } */ private _validateOrderFill; private _rawPlaceSpotOrder; private _signAndSendAction; private _infoPost; }