Interactive API Explorer
Test Saros SDK methods directly in your browser without writing any code. This interactive tool allows you to:
- Test API calls with real Solana networks (devnet/mainnet)
- Explore all SDK methods with auto-generated documentation
- See live examples and copy-paste ready code
- Debug API responses with detailed error messages
- Start with devnet to avoid transaction fees while testing
- Use the code examples section to copy working code to your project
- Check the response format to understand what data is returned
- Try different parameter combinations to see how the API behaves
🔧 Interactive API Explorer
Test Saros SDK methods directly in your browser
getPoolInfo
Parameters
Code Example
import { Connection, PublicKey } from '@solana/web3.js';
import { SarosSDK } from '@saros-finance/sdk';
const connection = new Connection('https://api.devnet.solana.com');
const sdk = new SarosSDK(connection);
async function getPoolInfoExample() {
try {
const poolId = new PublicKey('YOUR_POOLID');
const result = await sdk.getPoolInfo(poolId);
console.log('Result:', result);
return result;
} catch (error) {
console.error('Error:', error);
}
}API Categories
🏊♂️ Pools
Methods for querying and interacting with Saros liquidity pools:
getPoolInfo- Get detailed pool informationgetAllPools- List all available poolsgetPoolPrice- Get current pool price
🔄 Swaps
Methods for token swapping and quote generation:
getQuote- Get swap quotes with slippageexecuteSwap- Execute token swapsgetSwapHistory- View swap transaction history
📊 Positions
Methods for managing liquidity positions:
getUserPositions- Get all user positionsgetPositionValue- Calculate position valueclaimFees- Claim accumulated fees
📈 DLMM
Dynamic Liquidity Market Maker specific methods:
createDLMMPosition- Create concentrated liquidity positionsgetDLMMBins- Get price bin informationcalculateDLMMStrategy- Analyze DLMM strategies
🌾 Farming
Yield farming and staking methods:
getFarms- List available farmsgetUserFarmPositions- Get user farming positionsclaimFarmRewards- Claim farming rewards
Common Use Cases
Getting Pool Information
// Get comprehensive pool data
const poolInfo = await sdk.getPoolInfo(poolId);
console.log('Pool TVL:', poolInfo.totalLiquidity);
console.log('Pool APY:', poolInfo.apy);
console.log('Token Pair:', poolInfo.tokenA.symbol, '/', poolInfo.tokenB.symbol);
Calculating Swap Quotes
// Get the best swap quote
const quote = await sdk.getQuote({
inputMint: usdcMint,
outputMint: solMint,
amount: 100 * 1e6, // $100 USDC
slippageBps: 100 // 1% slippage
});
console.log('Output amount:', quote.outAmount);
console.log('Price impact:', quote.priceImpact);
console.log('Route:', quote.routePlan);
Tracking User Positions
// Monitor all user positions
const positions = await sdk.getUserPositions(userAddress);
for (const position of positions) {
console.log(`${position.tokenA}/${position.tokenB}:`);
console.log(' Value:', position.currentValue);
console.log(' P&L:', position.unrealizedPnl);
console.log(' Fees:', position.accumulatedFees);
}
Network Configuration
The API Explorer supports multiple Solana networks:
- Devnet - Free testing environment with faucet tokens
- Mainnet - Production network with real assets
- Testnet - Alternative testing environment
When using mainnet, be aware that:
- API calls may involve real transaction fees
- Position creation requires actual tokens
- Failed transactions will consume SOL for fees
Error Handling
Common errors and solutions:
| Error | Cause | Solution |
|---|---|---|
Invalid PublicKey | Malformed address | Use valid base58 encoded addresses |
Pool not found | Non-existent pool ID | Check pool exists using getAllPools |
Insufficient balance | Not enough tokens | Add devnet tokens via faucet |
Slippage exceeded | Price moved too much | Increase slippage tolerance |
Network timeout | RPC connection issues | Try different RPC endpoint |
SDK Integration
Once you've tested methods in the explorer, integrate them into your application:
npm install @saros-finance/sdk @saros-finance/dlmm-sdk
import { SarosSDK } from '@saros-finance/sdk';
import { Connection } from '@solana/web3.js';
const connection = new Connection('YOUR_RPC_URL');
const sdk = new SarosSDK(connection);
// Use the methods you tested in the explorer
const pools = await sdk.getAllPools();
The API Explorer is a powerful tool for understanding the Saros SDK before implementing it in your applications. Experiment with different parameters and network configurations to find the best approach for your use case.