> ## Documentation Index
> Fetch the complete documentation index at: https://creator-a1160a86.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start

> Get up and running with Saros DLMM SDK in minutes

[YouTube video player](https://www.youtube.com/embed/4gkEHqVbw4w?si=uB4g_8pPsBhiXSDA)

## Prerequisites

Before you begin, ensure you have the following development environment set up:

### Required Tools

**1. Package Manager**

Choose either npm or yarn as your package manager:

```bash theme={null}
npm --version
# or
yarn --version
```

**2. Development Environment**

Setup a TypeScript/Javascript/React project.

**3. Solana CLI**

Install the Solana CLI and create a new system keypair.

```bash theme={null}
sh -c "$(curl -sSfL https://release.solana.com/v1.18.4/install)"
solana-keygen new --outfile ~/.config/solana/id.json
```

## Installation

Install the Saros DLMM SDK package:

```bash npm theme={null}
npm install @saros-finance/dlmm-sdk
```

```bash yarn theme={null}
yarn add @saros-finance/dlmm-sdk
```

> [!NOTE]
>
> The SDK includes all necessary dependencies for interacting with Saros DLMM pools, including Solana Web3.js integration and Liquidity Book utilities.

## Initialize Client

Create a client instance of `LiquidityBookServices` from **@saros-finance/dlmm-sdk**. This client object will
provide access to all methods for interacting with the Saros DLMM protocol.

```typescript services.ts theme={null}
import { LiquidityBookServices, MODE } from "@saros-finance/dlmm-sdk";
import { Connection, PublicKey } from "@solana/web3.js";

export const sarosDLMM = new LiquidityBookServices({
  mode: MODE.DEVNET,
  options: {
    rpcUrl: "https://devnet.helius-rpc.com/?api-key=YOUR_API_KEY",
    commitmentOrConfig: "confirmed"
  },
});

// For mainnet usage, change to:
// mode: MODE.MAINNET,
// rpcUrl: "https://api.mainnet-beta.solana.com"
```

> [!WARNING]
>
> Replace `YOUR_API_KEY` with your actual RPC. You can get one from [helius](https://helius.dev/). For production applications, use environment variables to store sensitive keys.

## Start Using the Client

Let's begin by exploring available pools using the `fetchPoolAddresses` method:

### Fetch All Pool Addresses

Create an `index.ts` file to demonstrate basic usage:

```typescript index.ts theme={null}
import { sarosDLMM } from "./services.js";

async function explorePools() {
  try {
    const poolAddresses = await sarosDLMM.fetchPoolAddresses();
    
    console.log(`Found ${poolAddresses.length} pools:`);
    
    poolAddresses.slice(0, 5).forEach((address, index) => {
      console.log(`${index + 1}. ${address}`);
    });
    
    if (poolAddresses.length > 0) {
      const firstPoolAddress = poolAddresses[0];
      const poolMetadata = await sarosDLMM.fetchPoolMetadata(firstPoolAddress);
      
      console.log(`\nPool Details for ${firstPoolAddress}:`);
      console.log(`Base Token: ${poolMetadata.baseMint}`);
      console.log(`Quote Token: ${poolMetadata.quoteMint}`);
      console.log(`Base Reserve: ${poolMetadata.baseReserve}`);
      console.log(`Quote Reserve: ${poolMetadata.quoteReserve}`);
      console.log(`Trade Fee: ${poolMetadata.tradeFee}%`);
    }
    
  } catch (error) {
    console.error("Error fetching pools:", error);
  }
}

explorePools();
```

### Run Your First Script

Execute the script to see available pools:

```bash React theme={null}
npm run dev
```

```bash TypeScript theme={null}
npx tsx index.ts
```

> [!NOTE]
>
> If you don't have `tsx` installed, you can install it globally with `npm install -g tsx` or use `ts-node` instead.

### Expected Output

You should see output similar to:

```bash theme={null}
Found 12 pools:
1. 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
2. 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
3. 5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1
4. 8xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
5. 2WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM

Pool Details for 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU:
Base Token: So11111111111111111111111111111111111111112
Quote Token: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
Base Reserve: 1000000000
Quote Reserve: 50000000000
Trade Fee: 0.25%
```

## Next Steps

Now that you have the SDK set up and can fetch pool information, you're ready to explore more advanced features:

> [card] [Create a Pool](https://creator-a1160a86.mintlify.site/dlmm/create-pool.md)
>
> Learn how to create new liquidity pools for token pairs

> [card] [Add Liquidity](https://creator-a1160a86.mintlify.site/dlmm/adding-liquidity.md)
>
> Discover how to add liquidity to existing pools

> [card] [Swap Tokens](https://creator-a1160a86.mintlify.site/dlmm/swapping-tokens.md)
>
> Execute token swaps using the DLMM protocol

> [card] [Core Concepts](https://creator-a1160a86.mintlify.site/dlmm/core-concepts)
>
> Understand the underlying Liquidity Book mechanics

> [!NOTE]
>
> This quick start guide covers the basics. For production applications, make sure to handle errors properly, implement proper logging, and consider using environment variables for sensitive configuration.


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