> ## Documentation Index
> Fetch the complete documentation index at: https://docs.satora.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup

> Initialize the SDK and verify API connectivity

## Installation

```bash theme={null}
npm install @satora/swap
# or
pnpm add @satora/swap
```

> [!NOTE]
>
> **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`.

> [!NOTE]
>
> The SDK is pure TypeScript - no WASM, no native dependencies.
> It works in browsers, React Native, and Node.js without any bundler configuration.

> [!WARNING]
>
> **React Native:** These examples use browser storage (`IdbWalletStorage`).
> For React Native, replace with MMKV-based storage adapters - see
> [React Native Setup](https://docs.satora.io/setup/react-native.md) for the full implementations.

***

## Initialize Client

```ts theme={null}
import { Client, IdbSwapStorage, IdbWalletStorage } from "@satora/swap";

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

**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](https://docs.satora.io/setup/api-keys.md).

***

## Get Version

Verify the API is running before making swap requests.

```ts theme={null}
const version = await client.getVersion();
console.log(`${JSON.stringify(version)}`);
```

***

## 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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.