/** * Lighter Spot Adapter. * * Uses the same `/api/v1/sendTx` endpoint as perps — the only difference * is the market_id (spot markets have different IDs from perp markets). * * Composes with LighterAdapter for signing and API access. */ import type { SpotAdapter, SpotMarketInfo, SpotBalance } from "./spot-interface.js"; import type { LighterAdapter } from "./lighter.js"; export declare class LighterSpotAdapter implements SpotAdapter { readonly name = "lighter"; private _lt; private _spotMarketMap; private _spotBaseMap; private _spotDecimals; private _spotMinSize; private _spotPrices; private _initialized; private _clientOrderCounter; constructor(ltAdapter: LighterAdapter); init(): Promise; private _loadSpotMarkets; /** Resolve a symbol (e.g., "ETH" or "ETH/USDC") to the full spot symbol */ /** Get decimals for a symbol — always from API data, never hardcoded fallback */ private _getDecimals; private resolveSymbol; 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; /** Cancel all orders across all markets (spot + perp) */ spotCancelAllOrders(_symbol?: string): Promise; /** Transfer USDC from perp account to spot account (required before spot buys) */ transferUsdcToSpot(amount: number): Promise; /** Transfer USDC from spot account back to perp account */ transferUsdcToPerp(amount: number): Promise; /** * Internal self-transfer using raw WASM signTransfer. * TS SDK's is_spot_account mapping is buggy (sets both fromRoute and toRoute * to the same value), so we call the WASM module directly with explicit routes. * Route types: 0 = Perp, 1 = Spot */ private _selfTransfer; /** Get the spot market ID for a symbol */ getSpotMarketId(symbol: string): number | undefined; /** Check if a base token has a spot market */ hasSpotMarket(base: string): boolean; /** Query open orders across all spot markets (market_id ≥ 2048). */ getSpotOpenOrders(): Promise>; /** Cancel a spot order by clientOrderIndex (safe integer, avoids order_id overflow). */ spotCancelByClientIndex(symbol: string, clientOrderIndex: number): Promise; private _placeOrder; /** Generate a unique client order index (uint48). Uses timestamp + counter. */ private _nextClientOrderIndex; private _getNextNonce; private _sendTx; private _restGet; private _restGetAuth; }