feat: Helius Sender SWQOS support and global check_min_tip option

- Add Helius Sender client (helius.rs) with dual routing and swqos_only mode
- Helius min tip: 0.0002 SOL default, 0.000005 SOL when swqos_only=true
- Add TradeConfig.check_min_tip (default false) to skip min-tip validation for lower latency
- Thread check_min_tip through SwapParams and execute_parallel; only call min_tip_sol when enabled
- Add SWQOS_ENDPOINTS_HELIUS and HELIUS_TIP_ACCOUNTS in constants
- Extend SwqosConfig/SwqosType for Helius; add Helius to get_endpoint and get_swqos_client
- Update trading_client, shared_infrastructure and middleware_system examples

Made-with: Cursor
This commit is contained in:
Wood
2026-02-27 15:00:13 +08:00
parent 82438479d3
commit 0cd276d6cb
11 changed files with 351 additions and 43 deletions
+6 -6
View File
@@ -1,9 +1,9 @@
use anyhow::Result;
use sol_trade_sdk::{
common::{AnyResult, TradeConfig},
swqos::{SwqosConfig, SwqosRegion},
swqos::SwqosConfig,
trading::{
core::params::{PumpSwapParams, DexParamEnum}, factory::DexType, middleware::builtin::LoggingMiddleware,
core::params::{PumpSwapParams, DexParamEnum}, factory::DexType,
InstructionMiddleware, MiddlewareManager,
},
SolanaTrade, TradeTokenType,
@@ -30,8 +30,8 @@ impl InstructionMiddleware for CustomMiddleware {
fn process_protocol_instructions(
&self,
protocol_instructions: Vec<Instruction>,
protocol_name: String,
is_buy: bool,
_protocol_name: String,
_is_buy: bool,
) -> Result<Vec<Instruction>> {
// do anything you want here
// you can modify the instructions here
@@ -41,8 +41,8 @@ impl InstructionMiddleware for CustomMiddleware {
fn process_full_instructions(
&self,
full_instructions: Vec<Instruction>,
protocol_name: String,
is_buy: bool,
_protocol_name: String,
_is_buy: bool,
) -> Result<Vec<Instruction>> {
// do anything you want here
// you can modify the instructions here
@@ -31,6 +31,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
SwqosConfig::Default(rpc_url.clone()),
SwqosConfig::Jito("your_uuid".to_string(), SwqosRegion::Frankfurt, None),
SwqosConfig::Bloxroute("your_api_token".to_string(), SwqosRegion::Frankfurt, None),
SwqosConfig::Helius("".to_string(), SwqosRegion::Default, None, Some(true)),
];
// Step 1: Create shared infrastructure (expensive, do once)
+2
View File
@@ -49,6 +49,8 @@ async fn create_trading_client_simple() -> AnyResult<TradingClient> {
SwqosConfig::Node1("your_api_token".to_string(), SwqosRegion::Frankfurt, None),
SwqosConfig::BlockRazor("your_api_token".to_string(), SwqosRegion::Frankfurt, None),
SwqosConfig::Astralane("your_api_token".to_string(), SwqosRegion::Frankfurt, None),
// Helius Sender: 4th param swqos_only Some(true) => min tip 0.000005 SOL; None => 0.0002 SOL
SwqosConfig::Helius("".to_string(), SwqosRegion::Default, None, Some(true)),
];
// Optional: Customize WSOL ATA and Seed optimization settings