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:
2
Development Environment
Setup a TypeScript/Javascript/React project.
3
Solana CLI
Install the Solana CLI and create a new system keypair.
Installation
Install the Saros DLMM SDK package: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 ofLiquidityBookServices from @saros-finance/dlmm-sdk. This client object will
provide access to all methods for interacting with the Saros DLMM protocol.
services.ts
Start Using the Client
Let’s begin by exploring available pools using thefetchPoolAddresses method:
Fetch All Pool Addresses
Create anindex.ts file to demonstrate basic usage:
index.ts
Run Your First Script
Execute the script to see available pools: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:Next Steps
Now that you have the SDK set up and can fetch pool information, you’re ready to explore more advanced features:Create a Pool
Learn how to create new liquidity pools for token pairs
Add Liquidity
Discover how to add liquidity to existing pools
Swap Tokens
Execute token swaps using the DLMM protocol
Core Concepts
Understand the underlying Liquidity Book mechanics
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.
