Skip to main content
This section covers behavior shared by the Lighter deployments exposed through the perps SDK. For general concepts, see Action Pattern. Lighter signs actions with a per-account native keypair registered on-chain through REGISTER_API_KEY. Public provider metadata calls this an SDK signer: the Lighter plugin owns key generation, persistence, WASM loading, signing, and read-only token lifecycle. Applications do not instantiate a signer or pass a key store separately.

Provider instances

Both providers expose the same normalized SDK contract but keep endpoints, caches, credentials, signing configuration, and asset registries isolated.
Each provider defaults to encrypted browser localStorage for its signing key and read-only token. Pass storage to a provider factory only for SSR, tests, or a different persistence backend. Authenticated WebSocket channels automatically reuse resolveAuthToken from the co-registered REST provider; a custom resolver is only needed for a standalone WebSocket client.

Topics

  • Signing Model — WASM signing, the native key versus the L1 wallet, and dual-authorized setup
  • Deposits — provider-owned deposit discovery for Lighter mainnet and Robinhood Chain
  • Setup — registering the trading key and satisfying conditional gates
  • Trading — trading and account actions
  • Withdrawals — per-asset/per-route balance discovery and settlement paths
  • WebSocket Protocol — channel mapping and provider-owned authentication

Defaults and constraints

  • Default margin mode: CROSS when marginMode is omitted from placeOrder or updateLeverage.
  • Trade signing: actions are authorized by the plugin’s SDK signer with no per-trade wallet popup.
  • Order fields: price is required.
  • Withdrawal destination: the account owner address only.
  • Mainnet deposit: Ethereum mainnet USDC plus ETH for gas.
  • Robinhood deposit: Robinhood Chain USDG plus native gas.
  • Key slot: slot 42 by default; re-registering the same slot replaces the prior key.