@lifi/perps-sdk
Core of the LI.FI Perps SDK — a TypeScript SDK for trading perpetuals across multiple DEXes through one unified interface.
- Unified API across perpetual DEXes (Hyperliquid, Lighter).
- Provider plugins — each DEX ships as a separate package you register on the client.
- Agent-based signing — trades execute without per-order wallet popups (one-time wallet signature during setup).
- Two layers — low-level service functions and the high-level
PerpsClient. - Streaming — WebSocket subscriptions for prices, orderbook, and fills.
- Fully typed — all types exported, sourced from
@lifi/perps-types.
Installation
Install the core SDK plus the provider plugin(s) for the DEX(es) you target:
pnpm add @lifi/perps-sdk @lifi/perps-sdk-provider-hyperliquid
| Package | Install for |
|---|---|
@lifi/perps-sdk |
every project |
@lifi/perps-sdk-provider-hyperliquid |
Hyperliquid |
@lifi/perps-sdk-provider-lighter |
Lighter |
Get an API key from the LI.FI Partner Portal.
Architecture
Package layering
@lifi/perps-types is a zero-dependency wire-type package at the base. The core @lifi/perps-sdk depends on it. Each provider plugin depends on @lifi/perps-types directly and takes the core SDK as a peer dependency — so your project installs exactly one copy of the SDK.
Examples
Runnable scripts live in the examples/ directory of the repository — market data, account data, agent trading, error handling, custom storage, and WebSocket subscriptions.