solana_exec/
lib.rs

1//! # Solana DEX Swap Execution Library
2//!
3//! Library for building and executing DEX swap transactions on Solana.
4//!
5//! This library provides:
6//! - Entire solana transaction building from swap configurations (`create_tx_from_swap_configs`)
7//! - Protocol-specific swap instruction builders
8//!   - Raydium Ammv4
9//!   - Raydium Cpmm/Ammv5
10//!   - Raydium Launchpad
11//!   - Pumpswap
12//!   - Pumpfun Bonding Curve
13//!   - Meteora Dammv2
14//!   - Meteora Dbc
15//! - Token account management (opening/closing necessary token accounts when doing swaps)
16//! - Low latency Jito block engine integration with their gRPC API for bundle submission, private
17//! routing, MEV protect, faster fills, etc.
18//!
19//!
20//! ## Usage
21//!
22//! The easiest entry point is `create_tx_from_swap_configs`, which assembles a complete
23//! transaction from a list of swap configurations. The transaction can then be sent via
24//! Jito bundles (customizable tip) or standard JSON RPC.
25//!
26//! ## Environment Variables
27//! - `RPC_NODE_URL`: Solana JSON RPC node URL
28//! - `JITO_AUTH_SECRET_KEY`: Jito authentication keypair (base58) for bundle submission. If you do
29//! not have a specific whitelisted Jito block engine account you can use any private key and your rate limit will be 1 tx per second.
30
31mod types;
32mod raydium;
33mod pumpswap;
34mod pumpfun;
35mod meteora;
36mod utilities;
37pub mod constants;
38mod execution_context;
39mod jito;
40
41// Re-exports
42pub use execution_context::ExecutionContext;
43pub use types::swap_config::SwapConfig;
44pub use types::compute_budget_instruction_idl::{ComputeBudgetInstructionIdl, COMPUTE_BUDGET_LIMIT_DISCRIMINATOR};
45pub use utilities::create_tx_from_swap_configs::create_tx_from_swap_configs;
46pub use utilities::make_swap_instructions::make_swap_instructions;
47pub use utilities::get_min_amount_out::get_min_amount_out;
48pub use utilities::wrap_sol::wrap_sol;
49pub use utilities::open_token_account_check::open_token_account_check;
50pub use utilities::close_token_account_check::close_token_account_check;
51pub use utilities::close_all_token_accounts::close_all_token_accounts;
52pub use raydium::push_raydium_ammv4_swap_instruction::push_raydium_ammv4_swap_instruction;
53pub use raydium::push_raydium_cpmm_swap_instruction::push_raydium_cpmm_swap_instruction;
54pub use raydium::push_raydium_launchpad_swap_instruction::push_raydium_launchpad_swap_instruction;
55pub use pumpswap::push_pumpswap_swap_instruction::push_pumpswap_swap_instruction;
56pub use pumpfun::push_pumpfun_swap_instruction::push_pumpfun_swap_instruction;
57pub use pumpfun::get_pf_a_amount_out_no_price_impact::get_pf_a_amount_out_no_price_impact;
58pub use pumpfun::get_pf_max_b_amount_in_no_price_impact::get_pf_max_b_amount_in_no_price_impact;
59pub use jito::get_be_url_from_region::get_be_url_from_region;