Installation
Install@lifi/perps-sdk plus a provider package for each venue you trade on. Each provider package (@lifi/perps-sdk-provider-hyperliquid, @lifi/perps-sdk-provider-lighter, @lifi/perps-sdk-provider-ondo) declares @lifi/perps-sdk as a peer dependency.
Configuration
Initialize the Perps SDK client. An API key selects your fee identity through the Partner Service. Theintegrator name is an optional assertion that must match the API key’s identity:
x-lifi-integrator only when both apiKey and integrator are set. integrator with no apiKey has no effect, because fee identity always comes from the API key. See API Reference / Authentication for the full contract.
DEFAULT_API_URL still resolves to the Development host (https://develop.li.quest/v1/perps). Pass apiUrl explicitly to target the Production host (https://li.quest/v1/perps), where an API key is optional — Development requires one:
Configuration Options
These options configurecreatePerpsClient, the low-level client the service functions (getProviders, getAssets, etc.) take:
PerpsClient constructor options
new PerpsClient(options) — the higher-level class covering setup, trading, and app-level meta actions (see SDK / Actions) — takes a narrower option set. It forwards integrator, apiKey, apiUrl, and providers to an internal createPerpsClient call:
PerpsClient has no userWallet or retry constructor option. Set the end-user wallet after construction with client.setUserWallet(wallet), and update switchChain at runtime with client.setSwitchChain(hook).
Provider Configuration
Theproviders option accepts two shapes. Pass an array of provider plugins (preferred for new code) to bind each DEX’s read surface to the client — looked up at runtime via client.getProvider(key):
ProviderConfigs object for per-provider tuning:
Storage for the agent / API-key signer is configured on the provider plugin (e.g.
hyperliquidProvider({ storage })), not on createPerpsClient.Request Interceptor
TherequestInterceptor option lets you modify request options before each API call. This is useful for adding custom headers, logging, or integrating with authentication systems:
Get an API key from the LI.FI Partner Portal to receive your own fee identity. A client with no API key is a supported configuration and uses the default
lifi fee structure.Quick Start
Fetch available providers and assets:Request Cancellation
All service functions accept an optionaloptions parameter with an AbortSignal for cancelling in-flight requests:
fetch is aborted and the promise rejects with an AbortError.
Next steps
- Providers / Hyperliquid — Signing Model — Agent provisioning, key storage, and the two-part signing scheme
- Concepts / Action Pattern — The create -> sign -> submit pattern
- Providers / Hyperliquid — Setup, signing model, and provider-specific details
- SDK / Trading — All order types, features, and a full end-to-end example
- SDK / Assets — Prices, orderbooks, and charts