Lightspeed SDK for Rust
Fast, reliable transaction processing for Solana using Solana Vibe Station's Lightspeed RPC service.
Overview
Lightspeed SDK provides a simple, efficient way to submit prioritized transactions to the Solana blockchain through Solana Vibe Station's optimized RPC infrastructure. The SDK handles tip management, connection pooling, and transaction prioritization automatically.
Features
- 🚀 Automatic Tip Management - Transactions automatically include appropriate priority tips
- ⚡ Multiple Priority Levels - Choose between Minimum, Standard, Rush, or Custom priority
- 🔄 Connection Keep-Alive - Maintains persistent connections for optimal performance
- 💰 Balance Checking - Optional pre-flight balance verification to prevent wasting fees
- 📦 Full Solana SDK Compatibility - Works seamlessly with existing Solana code
- 🔐 Secure Authentication - API key authentication via HTTP headers
- 📊 Transaction Tracking - Returns signatures and tip amounts for monitoring
Installation
Add this to your Cargo.toml:
[]
= "0.1.3"
= "2.1"
= { = "1", = ["full"] }
Quick Start
use ;
use ;
async
Usage Examples
Different Priority Levels
use Priority;
// Standard priority (0.001 SOL tip)
let result = client.send_transaction.await?;
// Minimum priority (0.0001 SOL tip)
let result = client.send_transaction_with_priority.await?;
// Rush priority (0.005 SOL tip)
let result = client.send_transaction_with_priority.await?;
// Custom tip amount (0.01 SOL)
let result = client.send_transaction_with_tip.await?;
Manual Tip Control
// Create tip instruction manually
let tip_instruction = client.create_tip_instruction_with_priority;
// Build transaction with tip
let mut transaction = new_with_payer;
// Sign and send
transaction.sign;
let signature = client.send_prebuilt_transaction.await?;
Balance Checking (Prevent Wasting Fees)
Enable balance checking to verify sufficient funds before submitting transactions. This prevents wasting transaction fees on transactions that will fail due to insufficient balance.
use LightspeedError;
// Enable balance checking when building the client
let client = new
.svs_rpc_url
.check_balance_before_send // Enable balance checking
.build?;
// Send transaction - will check balance first
match client.send_transaction_with_tip.await
Note: Balance checking uses the public SVS RPC endpoint by default. You can specify a custom endpoint:
let client = new
.svs_rpc_url
.balance_check_rpc_url // Custom RPC for balance checks
.check_balance_before_send
.build?;
Configuration Options
use Duration;
let client = new
.svs_rpc_url // SVS RPC URL
.default_priority // Default priority
.timeout // Request timeout
.keep_alive_interval // Keep-alive interval
.check_balance_before_send // Enable balance checking
.balance_check_rpc_url // Custom RPC for balance checks
.debug // Enable debug logging
.build?;
API Documentation
Core Methods
| Method | Description |
|---|---|
send_transaction() |
Send transaction with default priority |
send_transaction_with_priority() |
Send with specific priority |
send_transaction_with_tip() |
Send with custom tip amount |
send_prebuilt_transaction() |
Send pre-built transaction |
create_tip_instruction() |
Create tip instruction |
start_keep_alive() |
Start connection maintenance |
stop_keep_alive() |
Stop connection maintenance |
Priority Levels
| Level | Tip Amount | Use Case |
|---|---|---|
Priority::Minimum |
0.0001 SOL | Regular transactions |
Priority::Standard |
0.001 SOL | Time-sensitive transactions |
Priority::Rush |
0.005 SOL | Extremely time-sensitive transactions |
Priority::Custom(u64) |
Custom | Fine-grained control |
Getting Started
-
Get an SVS RPC Subscription: Sign up for RPC services at Solana Vibe Station to get access to Lightspeed with your RPC url and API Key
-
Install the SDK: Add the dependency to your Cargo.toml
-
Start Building: Use the examples above to integrate Lightspeed into your application
Requirements
- Rust 1.75.0 or later
- Tokio runtime for async operations
- Valid Staked RPC/Lightspeed API key from Solana Vibe Station
Examples
Check out the examples directory for more detailed usage examples:
basic_usage.rs- Complete example showing all features- More examples coming soon!
Support
- Documentation: docs.rs/lightspeed-sdk
- Issues: GitHub Issues
- Discord: Join our Discord community
- Email: support@solanavibestation.com
Contributing
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
About Solana Vibe Station
Solana Vibe Station provides high-performance RPC infrastructure for the Solana blockchain. Our Lightspeed service offers prioritized transaction processing with guaranteed delivery and minimal latency.
Built with ❤️ by the Solana Vibe Station team