| Crates.io | solana-kite |
| lib.rs | solana-kite |
| version | 0.2.1 |
| created_at | 2025-06-26 02:00:35.375682+00 |
| updated_at | 2025-10-09 20:47:39.021286+00 |
| description | High level client-side tools for testing your Solana programs |
| homepage | https://github.com/solanakite/kite-rust |
| repository | https://github.com/solanakite/kite-rust |
| max_upload_size | |
| id | 1726777 |
| size | 189,646 |
[!NOTE] This is a new Rust port of Solana Kite! It works well but it may have some bugs - please report them!
A Rust library that works great with LiteSVM for testing your Solana programs. Solana Kite offers high-level abstractions for common Solana operations like program deployment, transaction sending, token operations, and account management.
cargo add --dev solana-kite
or add this to your Cargo.toml:
[dev-dependencies]
solana-kite = "0.2.0"
use solana_kite::{create_wallet, create_token_mint, create_associated_token_account, mint_tokens_to_account};
use litesvm::LiteSVM;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize test environment
let mut litesvm = LiteSVM::new();
// Create wallets
let mint_authority = create_wallet(&mut litesvm, 1_000_000_000)?; // 1 SOL
let user = create_wallet(&mut litesvm, 1_000_000_000)?; // 1 SOL
// Create a token mint (6 decimals, like USDC)
let mint = create_token_mint(&mut litesvm, &mint_authority, 6)?;
// Create associated token account for user
let user_token_account = create_associated_token_account(
&mut litesvm,
&user,
&mint.pubkey(),
&user,
)?;
// Mint 1000 tokens to user
mint_tokens_to_account(
&mut litesvm,
&mint.pubkey(),
&user_token_account,
1_000_000_000, // 1000 tokens with 6 decimals
&mint_authority,
)?;
println!("🎉 Successfully minted tokens!");
Ok(())
}
use solana_kite::{create_wallet, create_wallets};
// Create a single wallet with 1 SOL
let wallet = create_wallet(&mut litesvm, 1_000_000_000)?;
// Create multiple wallets
let wallets = create_wallets(&mut litesvm, 5, 1_000_000_000)?; // 5 wallets, 1 SOL each
use solana_kite::{
create_token_mint, create_associated_token_account,
mint_tokens_to_account, get_token_account_balance, assert_token_balance
};
// Create token mint with 9 decimals
let mint = create_token_mint(&mut litesvm, &mint_authority, 9)?;
// Create associated token account
let token_account = create_associated_token_account(&mut litesvm, &owner, &mint.pubkey(), &payer)?;
// Mint tokens
mint_tokens_to_account(&mut litesvm, &mint.pubkey(), &token_account, 1_000_000_000, &mint_authority)?;
// Check balance
let balance = get_token_account_balance(&litesvm, &token_account)?;
// Assert balance (useful for testing)
assert_token_balance(&litesvm, &token_account, 1_000_000_000, "Should have 1B tokens");
use solana_kite::{get_pda_and_bump, seeds, Seed};
use solana_pubkey::Pubkey;
let program_id = Pubkey::new_unique();
let user_address = Pubkey::new_unique();
// Using the convenient seeds! macro
let seed_vec = seeds!["user-account", user_address, 42u64];
let (pda, bump) = get_pda_and_bump(&seed_vec, &program_id);
// Or create seeds manually
let manual_seeds = vec![
Seed::String("user-account".to_string()),
Seed::Address(user_address),
Seed::U64(42),
];
let (pda2, bump2) = get_pda_and_bump(&manual_seeds, &program_id);
use solana_kite::send_transaction_from_instructions;
let instructions = vec![/* your instructions */];
send_transaction_from_instructions(
&mut litesvm,
instructions,
&[&signer1, &signer2],
&fee_payer.pubkey(),
)?;
use solana_kite::deploy_program;
deploy_program(
&mut litesvm,
&program_id,
"./target/deploy/my_program.so",
)?;
Solana Kite provides comprehensive error handling through the SolanaKiteError enum:
use solana_kite::SolanaKiteError;
match some_operation() {
Ok(result) => println!("Success: {:?}", result),
Err(SolanaKiteError::TransactionFailed(msg)) => eprintln!("Transaction failed: {}", msg),
Err(SolanaKiteError::TokenOperationFailed(msg)) => eprintln!("Token operation failed: {}", msg),
Err(SolanaKiteError::AccountOperationFailed(msg)) => eprintln!("Account operation failed: {}", msg),
Err(e) => eprintln!("Other error: {}", e),
}
The repository includes comprehensive examples:
cargo run --example basic_usagecargo run --example token_operationsRun the test suite:
# Run all tests
cargo test
# Run with output
cargo test -- --nocapture
# Run integration tests specifically
cargo test --test integration_tests
The crate supports the following Cargo features:
default: Standard functionalitytesting: Additional testing utilities (currently empty, reserved for future use)Full API documentation is available on docs.rs.
Generate local documentation:
cargo doc --open
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
cargo testcargo run --example basic_usageThis project is licensed under the MIT License. See LICENSE.md for details.
See CHANGELOG.md for details about changes in each version.
Made with ❤️ for the Solana ecosystem