Solana Kite 🪁
A Rust library that works great with LiteSVM for testing your Solana programs. High-level abstractions for common Solana operations — wallets, transactions, SPL tokens, Token Extensions, transfer hooks, PDAs, and program deployment.
Features
- 🚀 Program Deployment: Deploy programs from files or bytes (
include_bytes!) - 💸 Transaction Utilities: Send transactions from instructions with proper signing
- 🪙 SPL Token Operations: Create mints, ATAs, mint tokens, check balances
- 🔐 Token Extensions: Create mints with transfer hooks, transfer fees, permanent delegates, non-transferable tokens, and more
- 🪝 Transfer Hook Support: ExtraAccountMetaList setup and transfer helpers
- 👛 Wallet Management: Create funded wallets in one call
- 🔑 PDA Utilities: Type-safe seed handling with the
seeds!macro - 📚 Well Documented: Extensive docs and examples
Installation
cargo add --dev solana-kite
or add to your Cargo.toml:
[]
= "0.3"
Compatibility: Solana 3.x / Anchor 1.0 / LiteSVM 0.11
Quick Start
use ;
use LiteSVM;
use Signer;
let mut svm = new;
// Create a funded wallet
let authority = create_wallet.unwrap;
// Create a token mint (6 decimals, like USDC)
let mint = create_token_mint.unwrap;
// Create associated token account
let ata = create_associated_token_account.unwrap;
// Mint 1000 tokens
mint_tokens_to_token_account.unwrap;
API Overview
Wallets
use ;
let wallet = create_wallet?; // 1 SOL
let wallets = create_wallets?; // 5 wallets, 1 SOL each
SOL Balances
use ;
let balance = get_sol_balance; // returns lamports, 0 if account missing
assert_sol_balance;
Transactions
use send_transaction_from_instructions;
send_transaction_from_instructions?;
SPL Token Operations
use ;
let mint = create_token_mint?;
// Pre-compute the ATA address before creating it
let ata_address = get_token_account_address;
let ata = create_associated_token_account?;
assert_eq!;
mint_tokens_to_token_account?;
assert_token_account_balance;
Token Extensions
Create mints with extensions — transfer hooks, transfer fees, permanent delegates, non-transferable tokens, and more:
use ;
// Create a mint with transfer fee extension
let mint = create_token_extensions_mint?;
// Pre-compute an ATA address before creating it (e.g. to pass to a program instruction)
let sender_ata_address = get_token_extensions_account_address;
// Create token accounts, mint, and transfer
let sender_ata = create_token_extensions_account?;
let receiver_ata = create_token_extensions_account?;
mint_tokens_to_token_extensions_account?;
transfer_checked_token_extensions?;
Supported extensions:
TransferHook— attach a hook program to transfersTransferFee— automatic fee collection on transfersMintCloseAuthority— allow closing the mint accountPermanentDelegate— irrevocable delegate authorityNonTransferable— soulbound tokensDefaultAccountState— new token accounts start in a givenTokenAccountState(Frozen, Initialized, or Uninitialized)InterestBearing— display interest rate on tokenMetadataPointer— point to onchain metadata
Transfer Hooks
use ;
// Initialize the ExtraAccountMetaList PDA for your hook program
initialize_hook_accounts?;
// Build accounts to pass into a hook-aware transfer
let hook_accounts = build_hook_accounts;
Program Deployment
use ;
// From a file path
deploy_program?;
// From bytes (works with include_bytes!)
let bytes = include_bytes!;
deploy_program_bytes?;
PDAs
use ;
let = get_pda_and_bump;
Account Utilities
use check_account_is_closed;
check_account_is_closed;
Error Handling
All functions return Result<T, SolanaKiteError>:
use SolanaKiteError;
match some_operation
Examples
Testing
License
MIT — see LICENSE.md.
Made with ❤️ for the Solana ecosystem