Solutions to common issues when working with Saros SDKs and Solana development.
If you're experiencing issues not covered in this guide, here are the best ways to get help:
Join our Discord server to ask questions and get help from other developers.
Join DiscordReport bugs or request features on our GitHub repositories.
View IssuesEnsure you're using the correct RPC endpoint: // For Devnet const connection = new Connection(clusterApiUrl('devnet')); // For Mainnet const connection = new Connection(clusterApiUrl('mainnet-beta')); // For a custom RPC provider const connection = new Connection('https://your-rpc-provider.com');
clusterApiUrl('devnet')
Try using a more reliable RPC endpoint or a dedicated provider: // Try different endpoints const connection = new Connection('https://solana-devnet.g.alchemy.com/solana/v1/xyz123'); // Or use a local validator for development // solana-test-validator (run in terminal)
solana-test-validator
Ensure you have a wallet adapter properly configured: import { PhantomWalletAdapter } from '@solana/wallet-adapter-wallets'; import { useWallet } from '@solana/wallet-adapter-react'; // Initialize wallets const wallets = useMemo( () => [ new PhantomWalletAdapter(), // Add other wallet adapters here ], [] ); // Use the wallet in your component const { connected, publicKey } = useWallet();
useWallet()
Check your wallet balance and get more SOL if needed: // Check balance const balance = await connection.getBalance(wallet.publicKey); // Get Devnet SOL // Visit https://solfaucet.com/ or use: // solana airdrop 1 <WALLET_ADDRESS> --url devnet
solana airdrop 1
Create token accounts before using tokens: import { getOrCreateAssociatedTokenAccount } from '@solana/spl-token'; const tokenAccount = await getOrCreateAssociatedTokenAccount( connection, payer, // Transaction payer mint, // Token mint address owner // Token owner );
getOrCreateAssociatedTokenAccount
Verify pool addresses are correct for the network: // For Devnet, use Devnet pool addresses // For Mainnet, use Mainnet pool addresses // You can query available pools: const pools = await SarosFarmService.getListPool({ page: 1, size: 10 });
getListPool
Check transaction parameters and account balances: 1. Verify all account addresses are correct 2. Ensure sufficient token balances 3. Check slippage settings 4. Verify pool parameters // Add detailed error logging try { const result = await someSarosOperation(); } catch (error) { console.error('Transaction error:', error); console.error('Error code:', error.code); console.error('Error message:', error.message); }
console.error(error)
Increase slippage tolerance or try with smaller amounts: // Adjust slippage tolerance (in percentage) const slippage = 1.0; // 1% instead of 0.5% // Or break large swaps into smaller transactions const amount = 0.1; // Smaller amount
slippage = 1.0
Add console.log statements throughout your code to track the flow of execution and identify where issues occur.
Check transaction details on Solana Explorer to see error messages and transaction information.
When testing swaps or liquidity operations, start with small token amounts to reduce the impact of errors.
Ensure all Solana addresses (wallets, tokens, pools) are valid and exist on the correct network.
Use the Saros Playground to test code snippets in isolation before integrating them into your application.