🧪

LazorKit

Devnet
← Back to Home
🔄

Gasless Token Swaps with Raydium

Swap tokens on Raydium DEX without paying gas fees

⚠️

Devnet Limitations

Currently supporting SOL ↔ USDC pair on Devnet. Devnet liquidity pools can be unreliable - some swap directions may fail due to imbalanced pools or missing pool state.

Note: If USDC→SOL fails, try SOL→USDC instead. This is a devnet pool limitation, not a code issue.

💡 The same code works reliably on Mainnet where pools are properly maintained.

🤝 Raydium x LazorKit

Integrating with an existing Solana protocol while maintaining gasless UX.

Raydium Trade API for swap routing
LazorKit paymaster covers all gas fees
Works on Solana Devnet (SOL-USDC pair)
Swap more pairs on Mainnet

Making Raydium Work with LazorKit

1.Use Legacy Transactions

Request txVersion: 'LEGACY' from Raydium API to keep instructions simpler than versioned transactions.

2.Skip ComputeBudget Instructions

LazorKit manages compute budget automatically. Filter them out:

instructions.filter(ix => !ix.programId.equals(COMPUTE_BUDGET_PROGRAM))
3.Fix SyncNative Validation

LazorKit's execute_cpi expects smart wallet in ALL instructions. Some (like SyncNative) don't need it. Workaround:

if (!hasSmartWallet) {
  ix.keys.push({ pubkey: smartWallet, isSigner: false, isWritable: false })
}

💡 These patterns can be applied to most Solana protocols when integrating with LazorKit

What You'll Learn

  • Use Raydium Trade API for quotes & swaps
  • Handling legacy transactions
  • Work around LazorKit validation quirks
  • Manage token accounts & balances

Connect Your Wallet

Use LazorKit smart wallet for gasless swaps