Lendasat LogoLendasat Docs
Setup & Initialization

Get Version & Initialization

Initialize the SDK and verify API connectivity

Installation

npm install @lendasat/lendaswap-sdk-pure
# or
pnpm add @lendasat/lendaswap-sdk-pure

The SDK is pure TypeScript — no WASM, no native dependencies. It works in browsers, React Native, and Node.js without any bundler configuration.


Initialize Client

import { Client, IdbWalletStorage, IdbSwapStorage } from "@lendasat/lendaswap-sdk-pure";

const client = await Client.builder()
  .withSignerStorage(new IdbWalletStorage())
  .withSwapStorage(new IdbSwapStorage())
  .build();

Authentication: The API does not require authentication. All endpoints are publicly accessible.

Rate Limiting: Rate limits may apply to prevent abuse. Contact support for enterprise rate limits.


Get Version

Verify the API is running before making swap requests.

const version = await client.getVersion();
console.log("API version:", version.tag);
console.log("Commit:", version.commit_hash);

const health = await client.healthCheck();
console.log("API status:", health); // "ok"

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 wallet management, state tracking, and storage automatically