feat: Astralane QUIC, code review fixes, README & example updates
- Add Astralane QUIC client (astralane_quic.rs) and SwqosTransport::Quic - README: Astralane QUIC usage, remove third-party doc links, add QUIC to examples - Code review: API key not in logs, PumpSwap no clone, PDA Result, SELL_DISCRIMINATOR, ensure_wsol_ata refactor, tracing in astralane, only supports fix - instruction/utils: pumpfun/pumpswap PDA & discriminator unit tests - trading_client example: SwqosTransport, Astralane QUIC in config - cli_trading: fix all unused variable warnings (_prefix) - Add docs/CODE_REVIEW_REPORT.md Made-with: Cursor
This commit is contained in:
@@ -531,7 +531,7 @@ async fn handle_buy(
|
||||
|
||||
let client = initialize_real_client().await?;
|
||||
|
||||
let (create_mint_ata, use_seed, owner_pubkey, amount_f64, decimals) =
|
||||
let (create_mint_ata, use_seed, owner_pubkey, _amount_f64, _decimals) =
|
||||
check_mint_ata(&client, mint).await?;
|
||||
|
||||
match dex {
|
||||
@@ -565,7 +565,7 @@ async fn handle_buy_rv4(
|
||||
slippage: Option<u64>,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let client = initialize_real_client().await?;
|
||||
let (create_mint_ata, use_seed, owner_pubkey, amount_f64, decimals) =
|
||||
let (create_mint_ata, use_seed, owner_pubkey, _amount_f64, _decimals) =
|
||||
check_mint_ata(&client, mint).await?;
|
||||
handle_buy_raydium_v4(mint, amm, sol_amount, slippage, create_mint_ata, use_seed, owner_pubkey)
|
||||
.await?;
|
||||
@@ -579,7 +579,7 @@ async fn handle_buy_rcpmm(
|
||||
slippage: Option<u64>,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let client = initialize_real_client().await?;
|
||||
let (create_mint_ata, use_seed, owner_pubkey, amount_f64, decimals) =
|
||||
let (create_mint_ata, use_seed, owner_pubkey, _amount_f64, _decimals) =
|
||||
check_mint_ata(&client, mint).await?;
|
||||
handle_buy_raydium_cpmm(
|
||||
mint,
|
||||
@@ -599,8 +599,8 @@ async fn handle_buy_pumpfun(
|
||||
sol_amount: f64,
|
||||
slippage: Option<u64>,
|
||||
create_mint_ata: bool,
|
||||
use_seed: bool,
|
||||
owner_pubkey: Pubkey,
|
||||
_use_seed: bool,
|
||||
_owner_pubkey: Pubkey,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
println!("🔥 BUY PUMPFUN COMMAND");
|
||||
println!(" Token Mint: {}", mint);
|
||||
@@ -655,7 +655,7 @@ async fn handle_buy_pumpswap(
|
||||
sol_amount: f64,
|
||||
slippage: Option<u64>,
|
||||
create_mint_ata: bool,
|
||||
use_seed: bool,
|
||||
_use_seed: bool,
|
||||
_owner_pubkey: Pubkey,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let client = initialize_real_client().await?;
|
||||
@@ -710,8 +710,8 @@ async fn handle_buy_bonk(
|
||||
sol_amount: f64,
|
||||
slippage: Option<u64>,
|
||||
create_mint_ata: bool,
|
||||
use_seed: bool,
|
||||
owner_pubkey: Pubkey,
|
||||
_use_seed: bool,
|
||||
_owner_pubkey: Pubkey,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let client = initialize_real_client().await?;
|
||||
println!("🔥 BUY BONK COMMAND");
|
||||
@@ -766,8 +766,8 @@ async fn handle_buy_raydium_v4(
|
||||
sol_amount: f64,
|
||||
slippage: Option<u64>,
|
||||
create_mint_ata: bool,
|
||||
use_seed: bool,
|
||||
owner_pubkey: Pubkey,
|
||||
_use_seed: bool,
|
||||
_owner_pubkey: Pubkey,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let client = initialize_real_client().await?;
|
||||
println!("🔥 BUY RAYDIUM V4 COMMAND");
|
||||
@@ -825,8 +825,8 @@ async fn handle_buy_raydium_cpmm(
|
||||
sol_amount: f64,
|
||||
slippage: Option<u64>,
|
||||
create_mint_ata: bool,
|
||||
use_seed: bool,
|
||||
owner_pubkey: Pubkey,
|
||||
_use_seed: bool,
|
||||
_owner_pubkey: Pubkey,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let client = initialize_real_client().await?;
|
||||
println!("🔥 BUY RAYDIUM CPMM COMMAND");
|
||||
@@ -992,11 +992,11 @@ async fn handle_sell_pumpfun(
|
||||
mint: &str,
|
||||
token_amount: Option<f64>,
|
||||
slippage: Option<u64>,
|
||||
create_mint_ata: bool,
|
||||
use_seed: bool,
|
||||
owner_pubkey: Pubkey,
|
||||
_create_mint_ata: bool,
|
||||
_use_seed: bool,
|
||||
_owner_pubkey: Pubkey,
|
||||
amount_f64: f64,
|
||||
decimals: u8,
|
||||
_decimals: u8,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let amount = if token_amount.is_some() { token_amount.unwrap() } else { amount_f64 };
|
||||
|
||||
@@ -1053,11 +1053,11 @@ async fn handle_sell_pumpswap(
|
||||
mint: &str,
|
||||
token_amount: Option<f64>,
|
||||
slippage: Option<u64>,
|
||||
create_mint_ata: bool,
|
||||
use_seed: bool,
|
||||
owner_pubkey: Pubkey,
|
||||
_create_mint_ata: bool,
|
||||
_use_seed: bool,
|
||||
_owner_pubkey: Pubkey,
|
||||
amount_f64: f64,
|
||||
decimals: u8,
|
||||
_decimals: u8,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let amount = if token_amount.is_some() { token_amount.unwrap() } else { amount_f64 };
|
||||
println!("🔥 SELL PUMPSWAP COMMAND");
|
||||
@@ -1111,11 +1111,11 @@ async fn handle_sell_bonk(
|
||||
mint: &str,
|
||||
token_amount: Option<f64>,
|
||||
slippage: Option<u64>,
|
||||
create_mint_ata: bool,
|
||||
use_seed: bool,
|
||||
owner_pubkey: Pubkey,
|
||||
_create_mint_ata: bool,
|
||||
_use_seed: bool,
|
||||
_owner_pubkey: Pubkey,
|
||||
amount_f64: f64,
|
||||
decimals: u8,
|
||||
_decimals: u8,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let amount = if token_amount.is_some() { token_amount.unwrap() } else { amount_f64 };
|
||||
println!("🔥 SELL PUMPSWAP COMMAND");
|
||||
@@ -1170,11 +1170,11 @@ async fn handle_sell_raydium_v4(
|
||||
mint: &str,
|
||||
token_amount: Option<f64>,
|
||||
slippage: Option<u64>,
|
||||
create_mint_ata: bool,
|
||||
use_seed: bool,
|
||||
owner_pubkey: Pubkey,
|
||||
_create_mint_ata: bool,
|
||||
_use_seed: bool,
|
||||
_owner_pubkey: Pubkey,
|
||||
amount_f64: f64,
|
||||
decimals: u8,
|
||||
_decimals: u8,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let amount = if token_amount.is_some() { token_amount.unwrap() } else { amount_f64 };
|
||||
println!("🔥 SELL RAYDIUM V4 COMMAND");
|
||||
@@ -1231,11 +1231,11 @@ async fn handle_sell_raydium_cpmm(
|
||||
pool_address: &str,
|
||||
token_amount: Option<f64>,
|
||||
slippage: Option<u64>,
|
||||
create_mint_ata: bool,
|
||||
use_seed: bool,
|
||||
owner_pubkey: Pubkey,
|
||||
_create_mint_ata: bool,
|
||||
_use_seed: bool,
|
||||
_owner_pubkey: Pubkey,
|
||||
amount_f64: f64,
|
||||
decimals: u8,
|
||||
_decimals: u8,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let amount = if token_amount.is_some() { token_amount.unwrap() } else { amount_f64 };
|
||||
println!("🔥 SELL RAYDIUM CPMM COMMAND");
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
use sol_trade_sdk::{
|
||||
common::{AnyResult, InfrastructureConfig, TradeConfig},
|
||||
swqos::{SwqosConfig, SwqosRegion},
|
||||
TradingClient, TradingInfrastructure,
|
||||
SwqosTransport, TradingClient, TradingInfrastructure,
|
||||
};
|
||||
use solana_commitment_config::CommitmentConfig;
|
||||
use solana_sdk::signature::Keypair;
|
||||
@@ -48,7 +48,7 @@ async fn create_trading_client_simple() -> AnyResult<TradingClient> {
|
||||
SwqosConfig::FlashBlock("your_api_token".to_string(), SwqosRegion::Frankfurt, None),
|
||||
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),
|
||||
SwqosConfig::Astralane("your_api_token".to_string(), SwqosRegion::Frankfurt, None, Some(SwqosTransport::Quic)), // QUIC; use None for HTTP
|
||||
// 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)),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user