| Crates.io | lightspeed-sdk |
| lib.rs | lightspeed-sdk |
| version | 0.1.4 |
| created_at | 2025-10-14 01:36:15.811851+00 |
| updated_at | 2025-10-26 22:26:20.294457+00 |
| description | Rust SDK for Solana Vibe Station Lightspeed RPC service |
| homepage | |
| repository | https://github.com/Solana-Vibe-Station/lightspeed-sdk-rust |
| max_upload_size | |
| id | 1881444 |
| size | 248,204 |
Fast, reliable transaction processing for Solana using Solana Vibe Station's Lightspeed RPC service.
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.
Add this to your Cargo.toml:
[dependencies]
lightspeed-sdk = "0.1.3"
solana-sdk = "2.1"
tokio = { version = "1", features = ["full"] }
use lightspeed_sdk::{LightspeedClientBuilder, Priority};
use solana_sdk::{
signature::Keypair,
signer::Signer,
system_instruction,
hash::Hash,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize client
let client = LightspeedClientBuilder::new("your-api-key")
.svs_rpc_url("https://basic.rpc.solanavibestation.com")
.default_priority(Priority::Standard)
.build()?;
// Start keep-alive for connection management
client.start_keep_alive().await?;
// Create a transaction
let payer = Keypair::new();
let recipient = solana_sdk::pubkey::Pubkey::new_unique();
let instruction = system_instruction::transfer(
&payer.pubkey(),
&recipient,
1_000_000, // 0.001 SOL
);
// Send with automatic tip injection
let result = client.send_transaction(
vec![instruction],
&payer.pubkey(),
&[&payer],
Hash::default(), // Use real blockhash in production
).await?;
println!("Transaction sent: {}", result.signature);
println!("Tip paid: {} lamports", result.tip_amount);
Ok(())
}
use lightspeed_sdk::Priority;
// Standard priority (0.001 SOL tip)
let result = client.send_transaction(
instructions,
&payer.pubkey(),
&[&payer],
blockhash,
).await?;
// Minimum priority (0.0001 SOL tip)
let result = client.send_transaction_with_priority(
instructions,
&payer.pubkey(),
&[&payer],
blockhash,
Priority::Minimum,
).await?;
// Rush priority (0.005 SOL tip)
let result = client.send_transaction_with_priority(
instructions,
&payer.pubkey(),
&[&payer],
blockhash,
Priority::Rush,
).await?;
// Custom tip amount (0.01 SOL)
let result = client.send_transaction_with_tip(
instructions,
&payer.pubkey(),
&[&payer],
blockhash,
10_000_000, // lamports
).await?;
// Create tip instruction manually
let tip_instruction = client.create_tip_instruction_with_priority(
&payer.pubkey(),
Priority::Rush,
);
// Build transaction with tip
let mut transaction = Transaction::new_with_payer(
&[transfer_instruction, tip_instruction],
Some(&payer.pubkey()),
);
// Sign and send
transaction.sign(&[&payer], blockhash);
let signature = client.send_prebuilt_transaction(&transaction).await?;
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 lightspeed_sdk::LightspeedError;
// Enable balance checking when building the client
let client = LightspeedClientBuilder::new("your-api-key")
.svs_rpc_url("https://basic.rpc.solanavibestation.com")
.check_balance_before_send(true) // Enable balance checking
.build()?;
// Send transaction - will check balance first
match client.send_transaction_with_tip(
instructions,
&payer.pubkey(),
&[&payer],
blockhash,
10_000_000, // 0.01 SOL tip
).await {
Ok(result) => {
println!("Transaction sent: {}", result.signature);
}
Err(LightspeedError::InsufficientBalance(needed, have)) => {
println!("Not enough SOL! Need {} but only have {}", needed, have);
println!("No transaction fees were wasted!");
}
Err(e) => {
println!("Error: {}", e);
}
}
Note: Balance checking uses the public SVS RPC endpoint by default. You can specify a custom endpoint:
let client = LightspeedClientBuilder::new("your-api-key")
.svs_rpc_url("https://basic.rpc.solanavibestation.com")
.balance_check_rpc_url("https://custom-rpc.example.com") // Custom RPC for balance checks
.check_balance_before_send(true)
.build()?;
use std::time::Duration;
let client = LightspeedClientBuilder::new("your-api-key")
.svs_rpc_url("https://elite.rpc.solanavibestation.com") // SVS RPC URL
.default_priority(Priority::Rush) // Default priority
.timeout(Duration::from_secs(60)) // Request timeout
.keep_alive_interval(Duration::from_secs(30)) // Keep-alive interval
.check_balance_before_send(true) // Enable balance checking
.balance_check_rpc_url("https://custom-rpc.example.com") // Custom RPC for balance checks
.debug(true) // Enable debug logging
.build()?;
| 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 |
| 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 |
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
Check out the examples directory for more detailed usage examples:
basic_usage.rs - Complete example showing all featuresWe welcome contributions! Please see our Contributing Guide for details.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)Licensed under either of
at your option.
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.
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