Devnet Testing Guide

Learn how to test your Saros SDK integrations on Solana Devnet with real transactions.

Why Test on Devnet?

Solana Devnet is a replica of the main Solana blockchain specifically for testing and development. It provides all the functionality of mainnet but with fake SOL tokens, making it perfect for testing your Saros SDK integrations without risking real funds.

  • Test all Saros SDK functionality with real transactions
  • Create and manage your own test tokens
  • Experiment with liquidity pools and staking without financial risk
  • Debug transaction issues in a safe environment
Devnet RPC Endpoints

Main Devnet Endpoint

Primary endpoint for Solana Devnet

https://api.devnet.solana.com

Alternative Endpoints

Alternative endpoints for better reliability

https://solana-devnet.g.alchemy.com/solana/v1/xyz123
Getting Devnet SOL

Solana Faucet

Get free SOL for testing on Devnet

https://solfaucet.com/

CLI Command

Airdrop SOL to your wallet using the Solana CLI

solana airdrop 1 <WALLET_ADDRESS> --url devnet
Getting Test SPL Tokens

SPL Token Faucet

Get common test SPL tokens like USDC, USDT, etc.

https://spl-token-faucet.com/

Create Your Own Tokens

Create your own custom SPL tokens for testing.

spl-token create-token --url devnet
Creating Test Tokens

SPL Token CLI

Create a new token on Devnet

spl-token create-token --url devnet

Token Faucet

Get test tokens for development

https://spl-token-faucet.com/

Step-by-Step Testing Guide

11. Set up your development environment
Install the Solana CLI tools and set the cluster to devnet
# Install Solana CLI
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"

# Set cluster to devnet
solana config set --url devnet

# Confirm your configuration
solana config get
solana config set --url devnet
22. Create and fund a devnet wallet
Generate a new wallet and get some SOL for testing
# Create a new wallet
solana-keygen new --outfile devnet-wallet.json

# Set the wallet as default
solana config set --keypair devnet-wallet.json

# Airdrop SOL to your wallet
solana airdrop 1

# Check your balance
solana balance
solana airdrop 1
33. Create test tokens
Create your own tokens for testing swap and liquidity operations
# Install SPL Token CLI
npm install -g @solana/spl-token

# Create a new token
spl-token create-token --url devnet

# Create an account for the token
spl-token create-account <TOKEN_MINT_ADDRESS> --url devnet

# Mint tokens to your account
spl-token mint <TOKEN_MINT_ADDRESS> 1000 --url devnet

# Check your token balance
spl-token balance <TOKEN_MINT_ADDRESS> --url devnet
spl-token create-token --url devnet
44. Connect to Devnet in your code
Configure your Saros SDK to use Devnet
import { Connection, clusterApiUrl } from '@solana/web3.js';
import { genConnectionSolana } from '@saros-finance/sdk';

// Method 1: Using clusterApiUrl
const connection = new Connection(clusterApiUrl('devnet'));

// Method 2: Using Saros SDK utility
const connection = genConnectionSolana(); // Automatically connects to devnet in development

// Method 3: Using custom endpoint
const connection = new Connection('https://api.devnet.solana.com');
clusterApiUrl('devnet')
Best Practices for Devnet Testing

1. Use Dedicated Test Wallets

Create separate wallets specifically for Devnet testing to avoid confusion with mainnet wallets.

2. Document Your Test Setup

Keep track of the tokens, pools, and accounts you create during testing for reproducibility.

3. Test Edge Cases

Test scenarios like insufficient funds, slippage limits, and network failures to ensure your application handles them gracefully.

4. Monitor Transaction Fees

While Devnet SOL is free, it's still good practice to monitor transaction fees to understand costs on mainnet.

Pro Tip

Use the Saros Playground to test code snippets before implementing them in your full application. It's already configured to connect to Devnet!