Skip to main content

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
Pro Tips
  • 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
Get detailed information about a specific pool
getAllPools
Retrieve all available Saros pools

getPoolInfo

PoolsReturns: PoolInfo
Get detailed information about a specific pool

Parameters

The public key of the pool to query

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 information
  • getAllPools - List all available pools
  • getPoolPrice - Get current pool price

🔄 Swaps

Methods for token swapping and quote generation:

  • getQuote - Get swap quotes with slippage
  • executeSwap - Execute token swaps
  • getSwapHistory - View swap transaction history

📊 Positions

Methods for managing liquidity positions:

  • getUserPositions - Get all user positions
  • getPositionValue - Calculate position value
  • claimFees - Claim accumulated fees

📈 DLMM

Dynamic Liquidity Market Maker specific methods:

  • createDLMMPosition - Create concentrated liquidity positions
  • getDLMMBins - Get price bin information
  • calculateDLMMStrategy - Analyze DLMM strategies

🌾 Farming

Yield farming and staking methods:

  • getFarms - List available farms
  • getUserFarmPositions - Get user farming positions
  • claimFarmRewards - 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
Mainnet Usage

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:

ErrorCauseSolution
Invalid PublicKeyMalformed addressUse valid base58 encoded addresses
Pool not foundNon-existent pool IDCheck pool exists using getAllPools
Insufficient balanceNot enough tokensAdd devnet tokens via faucet
Slippage exceededPrice moved too muchIncrease slippage tolerance
Network timeoutRPC connection issuesTry 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.