Skip to main content

Installation

Migrating from @lendasat/lendaswap-sdk-pure? @satora/swap is a drop-in replacement — change the package name in your imports and nothing else changes. The legacy package keeps working and stays supported; new features land in @satora/swap.
The SDK is pure TypeScript - no WASM, no native dependencies. It works in browsers, React Native, and Node.js without any bundler configuration.
React Native: These examples use browser storage (IdbWalletStorage). For React Native, replace with MMKV-based storage adapters - see React Native Setup for the full implementations.

Initialize Client

Authentication: The public API endpoints are open and don’t require authentication. Optionally, configure an API key via withReferralCode("your-api-key") on the ClientBuilder for swap attribution and custom fee markup — see API Keys.

Get Version

Verify the API is running before making swap requests.

Best Practices

  1. Initialize Once - Create the client once using the builder, then reuse it for all operations
  2. Check Version First - Use getVersion() to verify API connectivity before critical operations
  3. Handle Errors - Wrap SDK calls in try/catch for proper error handling
  4. Use SDK - The TypeScript SDK handles complexity like key management, state tracking, and storage automatically