feat: major gas fee strategy and documentation overhaul
- feat(gas): add comprehensive gas fee strategy management system * Implement GasFeeStrategyType with Default/LowTipHighCuPrice/HighTipLowCuPrice strategies * Add dynamic gas fee configuration per SWQOS service and trade type * Integrate arc-swap for thread-safe strategy updates - docs: restructure documentation with dedicated guides * Add ADDRESS_LOOKUP_TABLE.md/CN.md for lookup table configuration * Add NONCE_CACHE.md/CN.md for nonce management documentation * Add TRADING_PARAMETERS.md/CN.md for comprehensive parameter guides * Simplify main README.md with focused overview - refactor: update all examples with new gas fee strategy integration * Modernize 14 trading examples with consistent parameter handling * Improve error handling and configuration management * Enhance parallel trading implementation
This commit is contained in:
@@ -6,7 +6,6 @@ use std::{
|
||||
},
|
||||
};
|
||||
|
||||
use sol_trade_sdk::solana_streamer_sdk::match_event;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::protocols::pumpfun::parser::PUMPFUN_PROGRAM_ID;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::protocols::pumpfun::PumpFunTradeEvent;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::{Protocol, UnifiedEvent};
|
||||
@@ -19,15 +18,17 @@ use sol_trade_sdk::{
|
||||
solana_streamer_sdk::streaming::event_parser::common::EventType,
|
||||
};
|
||||
use sol_trade_sdk::{
|
||||
common::SolanaRpcClient,
|
||||
solana_streamer_sdk::streaming::event_parser::common::filter::EventTypeFilter,
|
||||
};
|
||||
use sol_trade_sdk::{
|
||||
common::{AnyResult, PriorityFee, TradeConfig},
|
||||
common::AnyResult,
|
||||
constants::trade::trade::{DEFAULT_CU_LIMIT, DEFAULT_CU_PRICE},
|
||||
swqos::SwqosConfig,
|
||||
trading::{core::params::PumpFunParams, factory::DexType},
|
||||
SolanaTrade,
|
||||
};
|
||||
use sol_trade_sdk::{
|
||||
common::SolanaRpcClient,
|
||||
solana_streamer_sdk::streaming::event_parser::common::filter::EventTypeFilter,
|
||||
};
|
||||
use sol_trade_sdk::{common::TradeConfig, solana_streamer_sdk::match_event};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::{commitment_config::CommitmentConfig, signature::Keypair};
|
||||
|
||||
@@ -117,28 +118,15 @@ async fn setup_lookup_table_cache(
|
||||
/// Create SolanaTrade client
|
||||
/// Initializes a new SolanaTrade client with configuration
|
||||
async fn create_solana_trade_client() -> AnyResult<SolanaTrade> {
|
||||
println!("Creating SolanaTrade client...");
|
||||
|
||||
println!("🚀 Initializing SolanaTrade client...");
|
||||
let payer = Keypair::from_base58_string("use_your_payer_keypair_here");
|
||||
let rpc_url = "https://api.mainnet-beta.solana.com".to_string();
|
||||
|
||||
let swqos_configs = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
|
||||
let mut priority_fee = PriorityFee::default();
|
||||
// Configure according to your needs
|
||||
priority_fee.rpc_unit_limit = 100000;
|
||||
|
||||
let trade_config = TradeConfig {
|
||||
rpc_url,
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee: priority_fee,
|
||||
swqos_configs,
|
||||
};
|
||||
|
||||
let solana_trade_client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("SolanaTrade client created successfully!");
|
||||
|
||||
Ok(solana_trade_client)
|
||||
let commitment = CommitmentConfig::confirmed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("✅ SolanaTrade client initialized successfully!");
|
||||
Ok(solana_trade)
|
||||
}
|
||||
|
||||
/// PumpFun sniper trade
|
||||
@@ -158,23 +146,21 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
|
||||
// Buy tokens
|
||||
println!("Buying tokens from PumpFun...");
|
||||
let buy_sol_amount = 100_000;
|
||||
client
|
||||
.buy(
|
||||
DexType::PumpFun,
|
||||
mint_pubkey,
|
||||
buy_sol_amount,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(PumpFunParams::from_trade(&trade_info, None)),
|
||||
Some(lookup_table_key), // you still need to update the AddressLookupTableCache
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let buy_params = sol_trade_sdk::TradeBuyParams {
|
||||
dex_type: DexType::PumpFun,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: buy_sol_amount,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(PumpFunParams::from_trade(&trade_info, None)),
|
||||
lookup_table_key: Some(lookup_table_key), // you still need to update the AddressLookupTableCache
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: false,
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
// Exit program
|
||||
std::process::exit(0);
|
||||
|
||||
@@ -3,7 +3,6 @@ use std::sync::{
|
||||
Arc,
|
||||
};
|
||||
|
||||
use sol_trade_sdk::solana_streamer_sdk::match_event;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::common::filter::EventTypeFilter;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::common::EventType;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::protocols::bonk::parser::BONK_PROGRAM_ID;
|
||||
@@ -14,11 +13,13 @@ use sol_trade_sdk::solana_streamer_sdk::streaming::yellowstone_grpc::{
|
||||
};
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::YellowstoneGrpc;
|
||||
use sol_trade_sdk::{
|
||||
common::{AnyResult, PriorityFee, TradeConfig},
|
||||
common::AnyResult,
|
||||
constants::trade::trade::{DEFAULT_CU_LIMIT, DEFAULT_CU_PRICE},
|
||||
swqos::SwqosConfig,
|
||||
trading::{core::params::BonkParams, factory::DexType},
|
||||
SolanaTrade,
|
||||
};
|
||||
use sol_trade_sdk::{common::TradeConfig, solana_streamer_sdk::match_event};
|
||||
use solana_sdk::signer::Signer;
|
||||
use solana_sdk::{commitment_config::CommitmentConfig, signature::Keypair};
|
||||
use spl_associated_token_account::get_associated_token_address;
|
||||
@@ -103,28 +104,15 @@ fn create_event_callback() -> impl Fn(Box<dyn UnifiedEvent>) {
|
||||
/// Create SolanaTrade client
|
||||
/// Initializes a new SolanaTrade client with configuration
|
||||
async fn create_solana_trade_client() -> AnyResult<SolanaTrade> {
|
||||
println!("Creating SolanaTrade client...");
|
||||
|
||||
println!("🚀 Initializing SolanaTrade client...");
|
||||
let payer = Keypair::from_base58_string("use_your_payer_keypair_here");
|
||||
let rpc_url = "https://api.mainnet-beta.solana.com".to_string();
|
||||
|
||||
let swqos_configs = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
|
||||
let mut priority_fee = PriorityFee::default();
|
||||
// Configure according to your needs
|
||||
priority_fee.rpc_unit_limit = 150000;
|
||||
|
||||
let trade_config = TradeConfig {
|
||||
rpc_url,
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee: priority_fee,
|
||||
swqos_configs,
|
||||
};
|
||||
|
||||
let solana_trade_client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("SolanaTrade client created successfully!");
|
||||
|
||||
Ok(solana_trade_client)
|
||||
let commitment = CommitmentConfig::confirmed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("✅ SolanaTrade client initialized successfully!");
|
||||
Ok(solana_trade)
|
||||
}
|
||||
|
||||
/// Bonk sniper trade
|
||||
@@ -140,23 +128,21 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()>
|
||||
// Buy tokens
|
||||
println!("Buying tokens from Bonk...");
|
||||
let buy_sol_amount = 100_000;
|
||||
client
|
||||
.buy(
|
||||
DexType::Bonk,
|
||||
mint_pubkey,
|
||||
buy_sol_amount,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(BonkParams::from_trade(trade_info.clone())),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let buy_params = sol_trade_sdk::TradeBuyParams {
|
||||
dex_type: DexType::Bonk,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: buy_sol_amount,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(BonkParams::from_trade(trade_info.clone())),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
// Sell tokens
|
||||
println!("Selling tokens from Bonk...");
|
||||
@@ -169,23 +155,21 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()>
|
||||
let amount_token = balance.amount.parse::<u64>().unwrap();
|
||||
|
||||
println!("Selling {} tokens", amount_token);
|
||||
client
|
||||
.sell(
|
||||
DexType::Bonk,
|
||||
mint_pubkey,
|
||||
amount_token,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
false,
|
||||
Box::new(BonkParams::from_trade(trade_info.clone())),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let sell_params = sol_trade_sdk::TradeSellParams {
|
||||
dex_type: DexType::Bonk,
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount_token,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(BonkParams::from_trade(trade_info.clone())),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: false,
|
||||
with_tip: false,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
// Exit program
|
||||
std::process::exit(0);
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
use sol_trade_sdk::common::TradeConfig;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::common::filter::EventTypeFilter;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::common::EventType;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::protocols::bonk::BonkTradeEvent;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::{Protocol, UnifiedEvent};
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::grpc::ClientConfig;
|
||||
use sol_trade_sdk::solana_streamer_sdk::{match_event, streaming::ShredStreamGrpc};
|
||||
use sol_trade_sdk::{
|
||||
common::{AnyResult, PriorityFee, TradeConfig},
|
||||
common::AnyResult,
|
||||
constants::trade::trade::{DEFAULT_CU_LIMIT, DEFAULT_CU_PRICE},
|
||||
swqos::SwqosConfig,
|
||||
trading::{core::params::BonkParams, factory::DexType},
|
||||
SolanaTrade,
|
||||
@@ -72,28 +73,15 @@ fn create_event_callback() -> impl Fn(Box<dyn UnifiedEvent>) {
|
||||
/// Create SolanaTrade client
|
||||
/// Initializes a new SolanaTrade client with configuration
|
||||
async fn create_solana_trade_client() -> AnyResult<SolanaTrade> {
|
||||
println!("Creating SolanaTrade client...");
|
||||
|
||||
println!("🚀 Initializing SolanaTrade client...");
|
||||
let payer = Keypair::from_base58_string("use_your_payer_keypair_here");
|
||||
let rpc_url = "https://api.mainnet-beta.solana.com".to_string();
|
||||
|
||||
let swqos_configs = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
|
||||
let mut priority_fee = PriorityFee::default();
|
||||
// Set RPC unit limit based on your requirements
|
||||
priority_fee.rpc_unit_limit = 150000;
|
||||
|
||||
let trade_config = TradeConfig {
|
||||
rpc_url,
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee: priority_fee,
|
||||
swqos_configs,
|
||||
};
|
||||
|
||||
let solana_trade_client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("SolanaTrade client created successfully!");
|
||||
|
||||
Ok(solana_trade_client)
|
||||
let commitment = CommitmentConfig::confirmed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("✅ SolanaTrade client initialized successfully!");
|
||||
Ok(solana_trade)
|
||||
}
|
||||
|
||||
/// Execute Bonk sniper trading strategy based on received token creation event
|
||||
@@ -109,23 +97,21 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult<
|
||||
// Buy tokens
|
||||
println!("Buying tokens from Bonk...");
|
||||
let buy_sol_amount = 100_000;
|
||||
client
|
||||
.buy(
|
||||
DexType::Bonk,
|
||||
mint_pubkey,
|
||||
buy_sol_amount,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(BonkParams::from_dev_trade(trade_info.clone())),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let buy_params = sol_trade_sdk::TradeBuyParams {
|
||||
dex_type: DexType::Bonk,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: buy_sol_amount,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(BonkParams::from_dev_trade(trade_info.clone())),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
// Sell tokens
|
||||
println!("Selling tokens from Bonk...");
|
||||
@@ -138,28 +124,26 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult<
|
||||
let amount_token = balance.amount.parse::<u64>().unwrap();
|
||||
|
||||
println!("Selling {} tokens", amount_token);
|
||||
client
|
||||
.sell(
|
||||
DexType::Bonk,
|
||||
mint_pubkey,
|
||||
amount_token,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
false,
|
||||
Box::new(BonkParams::immediate_sell(
|
||||
trade_info.base_token_program,
|
||||
trade_info.platform_config,
|
||||
trade_info.platform_associated_account,
|
||||
trade_info.creator_associated_account,
|
||||
)),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let sell_params = sol_trade_sdk::TradeSellParams {
|
||||
dex_type: DexType::Bonk,
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount_token,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(BonkParams::immediate_sell(
|
||||
trade_info.base_token_program,
|
||||
trade_info.platform_config,
|
||||
trade_info.platform_associated_account,
|
||||
trade_info.creator_associated_account,
|
||||
)),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: false,
|
||||
with_tip: false,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
// Exit program after completing the trade
|
||||
std::process::exit(0);
|
||||
|
||||
+163
-199
@@ -1,9 +1,9 @@
|
||||
use clap::Parser;
|
||||
use sol_trade_sdk::{
|
||||
common::{
|
||||
fast_fn::get_associated_token_address_with_program_id_fast_use_seed, AnyResult,
|
||||
PriorityFee, TradeConfig,
|
||||
fast_fn::get_associated_token_address_with_program_id_fast_use_seed, AnyResult, TradeConfig,
|
||||
},
|
||||
constants::trade::trade::{DEFAULT_CU_LIMIT, DEFAULT_CU_PRICE},
|
||||
swqos::SwqosConfig,
|
||||
trading::{
|
||||
core::params::{
|
||||
@@ -11,7 +11,7 @@ use sol_trade_sdk::{
|
||||
},
|
||||
factory::DexType,
|
||||
},
|
||||
SolanaTrade,
|
||||
SolanaTrade, TradeBuyParams, TradeSellParams,
|
||||
};
|
||||
use solana_sdk::{
|
||||
commitment_config::CommitmentConfig, native_token::sol_str_to_lamports, pubkey::Pubkey,
|
||||
@@ -604,24 +604,21 @@ async fn handle_buy_pumpfun(
|
||||
let recent_blockhash = client.rpc.get_latest_blockhash().await?;
|
||||
let sol_lamports = sol_str_to_lamports(sol_amount.to_string().as_str()).unwrap();
|
||||
|
||||
match client
|
||||
.buy(
|
||||
DexType::PumpFun,
|
||||
mint_pubkey,
|
||||
sol_lamports,
|
||||
slippage,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(param),
|
||||
None,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
create_mint_ata,
|
||||
use_seed,
|
||||
)
|
||||
.await
|
||||
{
|
||||
let buy_params = TradeBuyParams {
|
||||
dex_type: DexType::PumpFun,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: sol_lamports,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: false,
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: create_mint_ata,
|
||||
open_seed_optimize: use_seed,
|
||||
};
|
||||
match client.buy(buy_params).await {
|
||||
Ok(signature) => {
|
||||
println!(" ✅ Successfully bought tokens from PumpFun!");
|
||||
println!(" ✅ Transaction Signature: {}", signature);
|
||||
@@ -654,24 +651,21 @@ async fn handle_buy_pumpswap(
|
||||
let recent_blockhash = client.rpc.get_latest_blockhash().await?;
|
||||
let sol_lamports = sol_str_to_lamports(sol_amount.to_string().as_str()).unwrap();
|
||||
|
||||
match client
|
||||
.buy(
|
||||
DexType::PumpSwap,
|
||||
mint_pubkey,
|
||||
sol_lamports,
|
||||
slippage,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(param),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
create_mint_ata,
|
||||
use_seed,
|
||||
)
|
||||
.await
|
||||
{
|
||||
let buy_params = TradeBuyParams {
|
||||
dex_type: DexType::PumpSwap,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: sol_lamports,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: create_mint_ata,
|
||||
open_seed_optimize: use_seed,
|
||||
};
|
||||
match client.buy(buy_params).await {
|
||||
Ok(signature) => {
|
||||
println!(" ✅ Successfully bought tokens from PumpSwap!");
|
||||
println!(" ✅ Transaction Signature: {}", signature);
|
||||
@@ -703,24 +697,21 @@ async fn handle_buy_bonk(
|
||||
let recent_blockhash = client.rpc.get_latest_blockhash().await?;
|
||||
let sol_lamports = sol_str_to_lamports(sol_amount.to_string().as_str()).unwrap();
|
||||
|
||||
match client
|
||||
.buy(
|
||||
DexType::Bonk,
|
||||
mint_pubkey,
|
||||
sol_lamports,
|
||||
slippage,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(param),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
create_mint_ata,
|
||||
use_seed,
|
||||
)
|
||||
.await
|
||||
{
|
||||
let buy_params = TradeBuyParams {
|
||||
dex_type: DexType::Bonk,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: sol_lamports,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: create_mint_ata,
|
||||
open_seed_optimize: use_seed,
|
||||
};
|
||||
match client.buy(buy_params).await {
|
||||
Ok(signature) => {
|
||||
println!(" ✅ Successfully bought tokens from Bonk!");
|
||||
println!(" ✅ Transaction Signature: {}", signature);
|
||||
@@ -756,24 +747,21 @@ async fn handle_buy_raydium_v4(
|
||||
let recent_blockhash = client.rpc.get_latest_blockhash().await?;
|
||||
let sol_lamports = sol_str_to_lamports(sol_amount.to_string().as_str()).unwrap();
|
||||
|
||||
match client
|
||||
.buy(
|
||||
DexType::RaydiumAmmV4,
|
||||
mint_pubkey,
|
||||
sol_lamports,
|
||||
slippage,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(param),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
create_mint_ata,
|
||||
use_seed,
|
||||
)
|
||||
.await
|
||||
{
|
||||
let buy_params = TradeBuyParams {
|
||||
dex_type: DexType::RaydiumAmmV4,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: sol_lamports,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: create_mint_ata,
|
||||
open_seed_optimize: use_seed,
|
||||
};
|
||||
match client.buy(buy_params).await {
|
||||
Ok(signature) => {
|
||||
println!(" ✅ Successfully bought tokens from Raydium V4!");
|
||||
println!(" ✅ Transaction Signature: {}", signature);
|
||||
@@ -809,24 +797,21 @@ async fn handle_buy_raydium_cpmm(
|
||||
let recent_blockhash = client.rpc.get_latest_blockhash().await?;
|
||||
let sol_lamports = sol_str_to_lamports(sol_amount.to_string().as_str()).unwrap();
|
||||
|
||||
match client
|
||||
.buy(
|
||||
DexType::RaydiumCpmm,
|
||||
mint_pubkey,
|
||||
sol_lamports,
|
||||
slippage,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(param),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
create_mint_ata,
|
||||
use_seed,
|
||||
)
|
||||
.await
|
||||
{
|
||||
let buy_params = TradeBuyParams {
|
||||
dex_type: DexType::RaydiumCpmm,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: sol_lamports,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: create_mint_ata,
|
||||
open_seed_optimize: use_seed,
|
||||
};
|
||||
match client.buy(buy_params).await {
|
||||
Ok(signature) => {
|
||||
println!(" ✅ Successfully bought tokens from Raydium CPMM!");
|
||||
println!(" ✅ Transaction Signature: {}", signature);
|
||||
@@ -972,24 +957,22 @@ async fn handle_sell_pumpfun(
|
||||
let param = PumpFunParams::from_mint_by_rpc(&client.rpc, &mint_pubkey).await?;
|
||||
let recent_blockhash = client.rpc.get_latest_blockhash().await?;
|
||||
|
||||
match client
|
||||
.sell(
|
||||
DexType::PumpFun,
|
||||
mint_pubkey,
|
||||
amount as u64,
|
||||
slippage,
|
||||
recent_blockhash,
|
||||
None,
|
||||
false,
|
||||
Box::new(param),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
use_seed,
|
||||
)
|
||||
.await
|
||||
{
|
||||
let sell_params = TradeSellParams {
|
||||
dex_type: DexType::PumpFun,
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount as u64,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
with_tip: false,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: false,
|
||||
open_seed_optimize: use_seed,
|
||||
};
|
||||
|
||||
match client.sell(sell_params).await {
|
||||
Ok(signature) => {
|
||||
println!(" ✅ Successfully sold tokens from PumpFun!");
|
||||
println!(" ✅ Transaction Signature: {}", signature);
|
||||
@@ -1024,24 +1007,21 @@ async fn handle_sell_pumpswap(
|
||||
let param = PumpSwapParams::from_mint_by_rpc(&client.rpc, &mint_pubkey).await?;
|
||||
let recent_blockhash = client.rpc.get_latest_blockhash().await?;
|
||||
|
||||
match client
|
||||
.sell(
|
||||
DexType::PumpSwap,
|
||||
mint_pubkey,
|
||||
amount as u64,
|
||||
slippage,
|
||||
recent_blockhash,
|
||||
None,
|
||||
false,
|
||||
Box::new(param),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
use_seed,
|
||||
)
|
||||
.await
|
||||
{
|
||||
let sell_params = TradeSellParams {
|
||||
dex_type: DexType::PumpSwap,
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount as u64,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
with_tip: false,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: false,
|
||||
open_seed_optimize: use_seed,
|
||||
};
|
||||
match client.sell(sell_params).await {
|
||||
Ok(signature) => {
|
||||
println!(" ✅ Successfully sold tokens from PumpSwap!");
|
||||
println!(" ✅ Transaction Signature: {}", signature);
|
||||
@@ -1076,24 +1056,21 @@ async fn handle_sell_bonk(
|
||||
let param = BonkParams::from_mint_by_rpc(&client.rpc, &mint_pubkey).await?;
|
||||
let recent_blockhash = client.rpc.get_latest_blockhash().await?;
|
||||
|
||||
match client
|
||||
.sell(
|
||||
DexType::Bonk,
|
||||
mint_pubkey,
|
||||
amount as u64,
|
||||
slippage,
|
||||
recent_blockhash,
|
||||
None,
|
||||
false,
|
||||
Box::new(param),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
use_seed,
|
||||
)
|
||||
.await
|
||||
{
|
||||
let sell_params = TradeSellParams {
|
||||
dex_type: DexType::Bonk,
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount as u64,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
with_tip: false,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: false,
|
||||
open_seed_optimize: use_seed,
|
||||
};
|
||||
match client.sell(sell_params).await {
|
||||
Ok(signature) => {
|
||||
println!(" ✅ Successfully sold tokens from Bonk!");
|
||||
println!(" ✅ Transaction Signature: {}", signature);
|
||||
@@ -1131,24 +1108,21 @@ async fn handle_sell_raydium_v4(
|
||||
let param = RaydiumAmmV4Params::from_amm_address_by_rpc(&client.rpc, amm_pubkey).await?;
|
||||
let recent_blockhash = client.rpc.get_latest_blockhash().await?;
|
||||
|
||||
match client
|
||||
.sell(
|
||||
DexType::RaydiumAmmV4,
|
||||
mint_pubkey,
|
||||
amount as u64,
|
||||
slippage,
|
||||
recent_blockhash,
|
||||
None,
|
||||
false,
|
||||
Box::new(param),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
use_seed,
|
||||
)
|
||||
.await
|
||||
{
|
||||
let sell_params = TradeSellParams {
|
||||
dex_type: DexType::RaydiumAmmV4,
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount as u64,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
with_tip: false,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: false,
|
||||
open_seed_optimize: use_seed,
|
||||
};
|
||||
match client.sell(sell_params).await {
|
||||
Ok(signature) => {
|
||||
println!(" ✅ Successfully sold tokens from Raydium V4!");
|
||||
println!(" ✅ Transaction Signature: {}", signature);
|
||||
@@ -1186,24 +1160,21 @@ async fn handle_sell_raydium_cpmm(
|
||||
let param = RaydiumCpmmParams::from_pool_address_by_rpc(&client.rpc, &pool_pubkey).await?;
|
||||
let recent_blockhash = client.rpc.get_latest_blockhash().await?;
|
||||
|
||||
match client
|
||||
.sell(
|
||||
DexType::RaydiumCpmm,
|
||||
mint_pubkey,
|
||||
amount as u64,
|
||||
slippage,
|
||||
recent_blockhash,
|
||||
None,
|
||||
false,
|
||||
Box::new(param),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
use_seed,
|
||||
)
|
||||
.await
|
||||
{
|
||||
let sell_params = TradeSellParams {
|
||||
dex_type: DexType::RaydiumCpmm,
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount as u64,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
with_tip: false,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: false,
|
||||
open_seed_optimize: use_seed,
|
||||
};
|
||||
match client.sell(sell_params).await {
|
||||
Ok(signature) => {
|
||||
println!(" ✅ Successfully sold tokens from Raydium CPMM!");
|
||||
println!(" ✅ Transaction Signature: {}", signature);
|
||||
@@ -1307,22 +1278,15 @@ async fn handle_wallet() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Real implementation functions
|
||||
async fn initialize_real_client() -> AnyResult<SolanaTrade> {
|
||||
// You need to update this with a real RPC URL
|
||||
|
||||
let swqos_configs = vec![SwqosConfig::Default(RPC_URL.to_string())];
|
||||
|
||||
let mut priority_fee = PriorityFee::default();
|
||||
priority_fee.rpc_unit_limit = 200000;
|
||||
let trade_config = TradeConfig {
|
||||
rpc_url: RPC_URL.to_string(),
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee,
|
||||
swqos_configs,
|
||||
};
|
||||
|
||||
let client =
|
||||
SolanaTrade::new(Arc::new(Keypair::try_from(&PAYER.to_bytes()[..]).unwrap()), trade_config)
|
||||
.await;
|
||||
Ok(client)
|
||||
println!("🚀 Initializing SolanaTrade client...");
|
||||
let payer = Arc::new(Keypair::try_from(&PAYER.to_bytes()[..]).unwrap());
|
||||
let rpc_url = RPC_URL.to_string();
|
||||
let commitment = CommitmentConfig::confirmed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade = SolanaTrade::new(payer, trade_config).await;
|
||||
println!("✅ SolanaTrade client initialized successfully!");
|
||||
Ok(solana_trade)
|
||||
}
|
||||
|
||||
async fn wrap_sol_real(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use anyhow::Result;
|
||||
use sol_trade_sdk::{
|
||||
common::{AnyResult, PriorityFee, TradeConfig},
|
||||
common::{AnyResult, TradeConfig},
|
||||
constants::trade::trade::{DEFAULT_CU_LIMIT, DEFAULT_CU_PRICE},
|
||||
swqos::{SwqosConfig, SwqosRegion},
|
||||
trading::{
|
||||
core::params::PumpSwapParams, factory::DexType, middleware::builtin::LoggingMiddleware,
|
||||
@@ -59,25 +60,15 @@ impl InstructionMiddleware for CustomMiddleware {
|
||||
/// Create SolanaTrade client
|
||||
/// Initializes a new SolanaTrade client with configuration
|
||||
async fn create_solana_trade_client() -> AnyResult<SolanaTrade> {
|
||||
println!("Creating SolanaTrade client...");
|
||||
|
||||
// In real transactions, use your own private key to initialize the payer
|
||||
let payer = Keypair::new();
|
||||
println!("🚀 Initializing SolanaTrade client...");
|
||||
let payer = Keypair::from_base58_string("use_your_payer_keypair_here");
|
||||
let rpc_url = "https://api.mainnet-beta.solana.com".to_string();
|
||||
|
||||
let swqos_configs = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
|
||||
let trade_config = TradeConfig {
|
||||
rpc_url,
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee: PriorityFee::default(),
|
||||
swqos_configs,
|
||||
};
|
||||
|
||||
let solana_trade_client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("SolanaTrade client created successfully!");
|
||||
|
||||
Ok(solana_trade_client)
|
||||
let commitment = CommitmentConfig::confirmed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("✅ SolanaTrade client initialized successfully!");
|
||||
Ok(solana_trade)
|
||||
}
|
||||
|
||||
async fn test_middleware() -> AnyResult<()> {
|
||||
@@ -91,23 +82,24 @@ async fn test_middleware() -> AnyResult<()> {
|
||||
let slippage_basis_points = Some(100);
|
||||
let recent_blockhash = client.rpc.get_latest_blockhash().await?;
|
||||
let pool_address = Pubkey::from_str("539m4mVWt6iduB6W8rDGPMarzNCMesuqY5eUTiiYHAgR")?;
|
||||
client
|
||||
.buy(
|
||||
DexType::PumpSwap,
|
||||
mint_pubkey,
|
||||
buy_sol_cost,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool_address).await?),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
|
||||
let buy_params = sol_trade_sdk::TradeBuyParams {
|
||||
dex_type: DexType::PumpSwap,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: buy_sol_cost,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(
|
||||
PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool_address).await?,
|
||||
),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
println!("tip: This transaction will not succeed because we're using a test account. You can modify the code to initialize the payer with your own private key");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ use std::sync::{
|
||||
Arc,
|
||||
};
|
||||
|
||||
use sol_trade_sdk::solana_streamer_sdk::match_event;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::common::filter::EventTypeFilter;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::common::EventType;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::protocols::pumpfun::PumpFunTradeEvent;
|
||||
@@ -17,11 +16,13 @@ use sol_trade_sdk::{
|
||||
solana_streamer_sdk::streaming::event_parser::protocols::pumpfun::parser::PUMPFUN_PROGRAM_ID,
|
||||
};
|
||||
use sol_trade_sdk::{
|
||||
common::{AnyResult, PriorityFee, TradeConfig},
|
||||
common::AnyResult,
|
||||
constants::trade::trade::{DEFAULT_CU_LIMIT, DEFAULT_CU_PRICE},
|
||||
swqos::SwqosConfig,
|
||||
trading::{core::params::PumpFunParams, factory::DexType},
|
||||
SolanaTrade,
|
||||
};
|
||||
use sol_trade_sdk::{common::TradeConfig, solana_streamer_sdk::match_event};
|
||||
use solana_sdk::{commitment_config::CommitmentConfig, signature::Keypair};
|
||||
|
||||
// Global static flag to ensure transaction is executed only once
|
||||
@@ -98,28 +99,15 @@ fn create_event_callback() -> impl Fn(Box<dyn UnifiedEvent>) {
|
||||
/// Create SolanaTrade client
|
||||
/// Initializes a new SolanaTrade client with configuration
|
||||
async fn create_solana_trade_client() -> AnyResult<SolanaTrade> {
|
||||
println!("Creating SolanaTrade client...");
|
||||
|
||||
println!("🚀 Initializing SolanaTrade client...");
|
||||
let payer = Keypair::from_base58_string("use_your_payer_keypair_here");
|
||||
let rpc_url = "https://api.mainnet-beta.solana.com".to_string();
|
||||
|
||||
let swqos_configs = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
|
||||
let mut priority_fee = PriorityFee::default();
|
||||
// Configure according to your needs
|
||||
priority_fee.rpc_unit_limit = 100000;
|
||||
|
||||
let trade_config = TradeConfig {
|
||||
rpc_url,
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee: priority_fee,
|
||||
swqos_configs,
|
||||
};
|
||||
|
||||
let solana_trade_client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("SolanaTrade client created successfully!");
|
||||
|
||||
Ok(solana_trade_client)
|
||||
let commitment = CommitmentConfig::confirmed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("✅ SolanaTrade client initialized successfully!");
|
||||
Ok(solana_trade)
|
||||
}
|
||||
|
||||
/// PumpFun sniper trade
|
||||
@@ -141,23 +129,21 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
|
||||
// Buy tokens
|
||||
println!("Buying tokens from PumpFun...");
|
||||
let buy_sol_amount = 100_000;
|
||||
client
|
||||
.buy(
|
||||
DexType::PumpFun,
|
||||
mint_pubkey,
|
||||
buy_sol_amount,
|
||||
slippage_basis_points,
|
||||
last_nonce,
|
||||
None,
|
||||
Box::new(PumpFunParams::from_trade(&trade_info, None)),
|
||||
None,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let buy_params = sol_trade_sdk::TradeBuyParams {
|
||||
dex_type: DexType::PumpFun,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: buy_sol_amount,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: last_nonce,
|
||||
extension_params: Box::new(PumpFunParams::from_trade(&trade_info, None)),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: false,
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
// Exit program
|
||||
std::process::exit(0);
|
||||
|
||||
@@ -3,7 +3,6 @@ use std::sync::{
|
||||
Arc,
|
||||
};
|
||||
|
||||
use sol_trade_sdk::solana_streamer_sdk::match_event;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::common::filter::EventTypeFilter;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::common::EventType;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::protocols::pumpfun::parser::PUMPFUN_PROGRAM_ID;
|
||||
@@ -14,11 +13,13 @@ use sol_trade_sdk::solana_streamer_sdk::streaming::yellowstone_grpc::{
|
||||
};
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::YellowstoneGrpc;
|
||||
use sol_trade_sdk::{
|
||||
common::{AnyResult, PriorityFee, TradeConfig},
|
||||
common::AnyResult,
|
||||
constants::trade::trade::{DEFAULT_CU_LIMIT, DEFAULT_CU_PRICE},
|
||||
swqos::SwqosConfig,
|
||||
trading::{core::params::PumpFunParams, factory::DexType},
|
||||
SolanaTrade,
|
||||
};
|
||||
use sol_trade_sdk::{common::TradeConfig, solana_streamer_sdk::match_event};
|
||||
use solana_sdk::signer::Signer;
|
||||
use solana_sdk::{commitment_config::CommitmentConfig, signature::Keypair};
|
||||
use spl_associated_token_account::get_associated_token_address;
|
||||
@@ -97,28 +98,15 @@ fn create_event_callback() -> impl Fn(Box<dyn UnifiedEvent>) {
|
||||
/// Create SolanaTrade client
|
||||
/// Initializes a new SolanaTrade client with configuration
|
||||
async fn create_solana_trade_client() -> AnyResult<SolanaTrade> {
|
||||
println!("Creating SolanaTrade client...");
|
||||
|
||||
println!("🚀 Initializing SolanaTrade client...");
|
||||
let payer = Keypair::from_base58_string("use_your_payer_keypair_here");
|
||||
let rpc_url = "https://api.mainnet-beta.solana.com".to_string();
|
||||
|
||||
let swqos_configs = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
|
||||
let mut priority_fee = PriorityFee::default();
|
||||
// Configure according to your needs
|
||||
priority_fee.rpc_unit_limit = 100000;
|
||||
|
||||
let trade_config = TradeConfig {
|
||||
rpc_url,
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee: priority_fee,
|
||||
swqos_configs,
|
||||
};
|
||||
|
||||
let solana_trade_client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("SolanaTrade client created successfully!");
|
||||
|
||||
Ok(solana_trade_client)
|
||||
let commitment = CommitmentConfig::confirmed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("✅ SolanaTrade client initialized successfully!");
|
||||
Ok(solana_trade)
|
||||
}
|
||||
|
||||
/// PumpFun sniper trade
|
||||
@@ -134,23 +122,21 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
|
||||
// Buy tokens
|
||||
println!("Buying tokens from PumpFun...");
|
||||
let buy_sol_amount = 100_000;
|
||||
client
|
||||
.buy(
|
||||
DexType::PumpFun,
|
||||
mint_pubkey,
|
||||
buy_sol_amount,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(PumpFunParams::from_trade(&trade_info, None)),
|
||||
None,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let buy_params = sol_trade_sdk::TradeBuyParams {
|
||||
dex_type: DexType::PumpFun,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: buy_sol_amount,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(PumpFunParams::from_trade(&trade_info, None)),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: false,
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
// Sell tokens
|
||||
println!("Selling tokens from PumpFun...");
|
||||
@@ -163,23 +149,21 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
|
||||
let amount_token = balance.amount.parse::<u64>().unwrap();
|
||||
|
||||
println!("Selling {} tokens", amount_token);
|
||||
client
|
||||
.sell(
|
||||
DexType::PumpFun,
|
||||
mint_pubkey,
|
||||
amount_token,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
false,
|
||||
Box::new(PumpFunParams::from_trade(&trade_info, Some(true))),
|
||||
None,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let sell_params = sol_trade_sdk::TradeSellParams {
|
||||
dex_type: DexType::PumpFun,
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount_token,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
with_tip: false,
|
||||
extension_params: Box::new(PumpFunParams::from_trade(&trade_info, Some(true))),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: false,
|
||||
close_wsol_ata: false,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
// PumpFunParams can also be set as PumpFunParams::immediate_sell(creator_vault, close_token_account_when_sell)
|
||||
// creator_vault can be obtained from the trade event
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
use sol_trade_sdk::common::TradeConfig;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::common::filter::EventTypeFilter;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::common::EventType;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::protocols::pumpfun::PumpFunTradeEvent;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::{Protocol, UnifiedEvent};
|
||||
use sol_trade_sdk::solana_streamer_sdk::{match_event, streaming::ShredStreamGrpc};
|
||||
use sol_trade_sdk::{
|
||||
common::{AnyResult, PriorityFee, TradeConfig},
|
||||
common::AnyResult,
|
||||
constants::trade::trade::{DEFAULT_CU_LIMIT, DEFAULT_CU_PRICE},
|
||||
swqos::SwqosConfig,
|
||||
trading::{core::params::PumpFunParams, factory::DexType},
|
||||
SolanaTrade,
|
||||
@@ -65,28 +67,15 @@ fn create_event_callback() -> impl Fn(Box<dyn UnifiedEvent>) {
|
||||
/// Create SolanaTrade client
|
||||
/// Initializes a new SolanaTrade client with configuration
|
||||
async fn create_solana_trade_client() -> AnyResult<SolanaTrade> {
|
||||
println!("Creating SolanaTrade client...");
|
||||
|
||||
println!("🚀 Initializing SolanaTrade client...");
|
||||
let payer = Keypair::from_base58_string("use_your_payer_keypair_here");
|
||||
let rpc_url = "https://api.mainnet-beta.solana.com".to_string();
|
||||
|
||||
let swqos_configs = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
|
||||
let mut priority_fee = PriorityFee::default();
|
||||
// Set RPC unit limit based on your requirements
|
||||
priority_fee.rpc_unit_limit = 100000;
|
||||
|
||||
let trade_config = TradeConfig {
|
||||
rpc_url,
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee: priority_fee,
|
||||
swqos_configs,
|
||||
};
|
||||
|
||||
let solana_trade_client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("SolanaTrade client created successfully!");
|
||||
|
||||
Ok(solana_trade_client)
|
||||
let commitment = CommitmentConfig::confirmed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("✅ SolanaTrade client initialized successfully!");
|
||||
Ok(solana_trade)
|
||||
}
|
||||
|
||||
/// Execute PumpFun sniper trading strategy based on received token creation event
|
||||
@@ -102,23 +91,21 @@ async fn pumpfun_sniper_trade_with_shreds(trade_info: PumpFunTradeEvent) -> AnyR
|
||||
// Buy tokens
|
||||
println!("Buying tokens from PumpFun...");
|
||||
let buy_sol_amount = 100_000;
|
||||
client
|
||||
.buy(
|
||||
DexType::PumpFun,
|
||||
mint_pubkey,
|
||||
buy_sol_amount,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(PumpFunParams::from_dev_trade(&trade_info, None)),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let buy_params = sol_trade_sdk::TradeBuyParams {
|
||||
dex_type: DexType::PumpFun,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: buy_sol_amount,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(PumpFunParams::from_dev_trade(&trade_info, None)),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
// Sell tokens
|
||||
println!("Selling tokens from PumpFun...");
|
||||
@@ -131,23 +118,21 @@ async fn pumpfun_sniper_trade_with_shreds(trade_info: PumpFunTradeEvent) -> AnyR
|
||||
let amount_token = balance.amount.parse::<u64>().unwrap();
|
||||
|
||||
println!("Selling {} tokens", amount_token);
|
||||
client
|
||||
.sell(
|
||||
DexType::PumpFun,
|
||||
mint_pubkey,
|
||||
amount_token,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
false,
|
||||
Box::new(PumpFunParams::immediate_sell(trade_info.creator_vault, true)),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let sell_params = sol_trade_sdk::TradeSellParams {
|
||||
dex_type: DexType::PumpFun,
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount_token,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
with_tip: false,
|
||||
extension_params: Box::new(PumpFunParams::immediate_sell(trade_info.creator_vault, true)),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
// PumpFunParams can also be set as PumpFunParams::immediate_sell(creator_vault, close_token_account_when_sell)
|
||||
// creator_vault can be obtained from the trade event
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use sol_trade_sdk::{
|
||||
common::{AnyResult, PriorityFee, TradeConfig},
|
||||
common::{AnyResult, TradeConfig},
|
||||
constants::trade::trade::{DEFAULT_CU_LIMIT, DEFAULT_CU_PRICE},
|
||||
swqos::SwqosConfig,
|
||||
trading::{core::params::PumpSwapParams, factory::DexType},
|
||||
SolanaTrade,
|
||||
@@ -22,23 +23,23 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Buy tokens
|
||||
println!("Buying tokens from PumpSwap...");
|
||||
let buy_sol_amount = 100_000;
|
||||
client
|
||||
.buy(
|
||||
DexType::PumpSwap,
|
||||
mint_pubkey,
|
||||
buy_sol_amount,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let buy_params = sol_trade_sdk::TradeBuyParams {
|
||||
dex_type: DexType::PumpSwap,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: buy_sol_amount,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(
|
||||
PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?,
|
||||
),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
// Sell tokens
|
||||
println!("Selling tokens from PumpSwap...");
|
||||
@@ -49,23 +50,23 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let account = get_associated_token_address_with_program_id(&payer, &mint_pubkey, &program_id);
|
||||
let balance = rpc.get_token_account_balance(&account).await?;
|
||||
let amount_token = balance.amount.parse::<u64>().unwrap();
|
||||
client
|
||||
.sell(
|
||||
DexType::PumpSwap,
|
||||
mint_pubkey,
|
||||
amount_token,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
false,
|
||||
Box::new(PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let sell_params = sol_trade_sdk::TradeSellParams {
|
||||
dex_type: DexType::PumpSwap,
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount_token,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
with_tip: false,
|
||||
extension_params: Box::new(
|
||||
PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?,
|
||||
),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
tokio::signal::ctrl_c().await?;
|
||||
Ok(())
|
||||
@@ -74,27 +75,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
/// Create SolanaTrade client
|
||||
/// Initializes a new SolanaTrade client with configuration
|
||||
async fn create_solana_trade_client() -> AnyResult<SolanaTrade> {
|
||||
println!("Creating SolanaTrade client...");
|
||||
|
||||
let payer = Keypair::from_base58_string("use_your_own_keypair");
|
||||
println!("🚀 Initializing SolanaTrade client...");
|
||||
let payer = Keypair::from_base58_string("use_your_payer_keypair_here");
|
||||
let rpc_url = "https://api.mainnet-beta.solana.com".to_string();
|
||||
|
||||
let swqos_configs = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
|
||||
let mut priority_fee = PriorityFee::default();
|
||||
priority_fee.buy_tip_fees = vec![0.001];
|
||||
// Configure according to your needs
|
||||
priority_fee.rpc_unit_limit = 150000;
|
||||
|
||||
let trade_config = TradeConfig {
|
||||
rpc_url,
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee: priority_fee,
|
||||
swqos_configs,
|
||||
};
|
||||
|
||||
let solana_trade_client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("SolanaTrade client created successfully!");
|
||||
|
||||
Ok(solana_trade_client)
|
||||
let commitment = CommitmentConfig::confirmed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("✅ SolanaTrade client initialized successfully!");
|
||||
Ok(solana_trade)
|
||||
}
|
||||
|
||||
@@ -3,9 +3,6 @@ use std::sync::{
|
||||
Arc,
|
||||
};
|
||||
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::{
|
||||
common::EventType, protocols::pumpswap::PumpSwapSellEvent,
|
||||
};
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::{Protocol, UnifiedEvent};
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::yellowstone_grpc::{
|
||||
AccountFilter, TransactionFilter,
|
||||
@@ -15,11 +12,18 @@ use sol_trade_sdk::solana_streamer_sdk::{
|
||||
match_event, streaming::event_parser::protocols::pumpswap::parser::PUMPSWAP_PROGRAM_ID,
|
||||
};
|
||||
use sol_trade_sdk::{
|
||||
common::{AnyResult, PriorityFee, TradeConfig},
|
||||
common::AnyResult,
|
||||
constants::trade::trade::{DEFAULT_CU_LIMIT, DEFAULT_CU_PRICE},
|
||||
swqos::SwqosConfig,
|
||||
trading::{core::params::PumpSwapParams, factory::DexType},
|
||||
SolanaTrade,
|
||||
};
|
||||
use sol_trade_sdk::{
|
||||
common::TradeConfig,
|
||||
solana_streamer_sdk::streaming::event_parser::{
|
||||
common::EventType, protocols::pumpswap::PumpSwapSellEvent,
|
||||
},
|
||||
};
|
||||
use sol_trade_sdk::{
|
||||
instruction::utils::pumpswap::accounts,
|
||||
solana_streamer_sdk::streaming::event_parser::{
|
||||
@@ -120,28 +124,15 @@ fn create_event_callback() -> impl Fn(Box<dyn UnifiedEvent>) {
|
||||
/// Create SolanaTrade client
|
||||
/// Initializes a new SolanaTrade client with configuration
|
||||
async fn create_solana_trade_client() -> AnyResult<SolanaTrade> {
|
||||
println!("Creating SolanaTrade client...");
|
||||
|
||||
println!("🚀 Initializing SolanaTrade client...");
|
||||
let payer = Keypair::from_base58_string("use_your_payer_keypair_here");
|
||||
let rpc_url = "https://api.mainnet-beta.solana.com".to_string();
|
||||
|
||||
let swqos_configs = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
|
||||
let mut priority_fee = PriorityFee::default();
|
||||
// Configure according to your needs
|
||||
priority_fee.rpc_unit_limit = 150000;
|
||||
|
||||
let trade_config = TradeConfig {
|
||||
rpc_url,
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee: priority_fee,
|
||||
swqos_configs,
|
||||
};
|
||||
|
||||
let solana_trade_client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("SolanaTrade client created successfully!");
|
||||
|
||||
Ok(solana_trade_client)
|
||||
let commitment = CommitmentConfig::confirmed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("✅ SolanaTrade client initialized successfully!");
|
||||
Ok(solana_trade)
|
||||
}
|
||||
|
||||
async fn pumpswap_trade_with_grpc_buy_event(trade_info: PumpSwapBuyEvent) -> AnyResult<()> {
|
||||
@@ -176,23 +167,21 @@ async fn pumpswap_trade_with_grpc(mint_pubkey: Pubkey, params: PumpSwapParams) -
|
||||
// Buy tokens
|
||||
println!("Buying tokens from PumpSwap...");
|
||||
let buy_sol_amount = 100_000;
|
||||
client
|
||||
.buy(
|
||||
DexType::PumpSwap,
|
||||
mint_pubkey,
|
||||
buy_sol_amount,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(params.clone()),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let buy_params = sol_trade_sdk::TradeBuyParams {
|
||||
dex_type: DexType::PumpSwap,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: buy_sol_amount,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(params.clone()),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
// Sell tokens
|
||||
println!("Selling tokens from PumpSwap...");
|
||||
@@ -207,23 +196,21 @@ async fn pumpswap_trade_with_grpc(mint_pubkey: Pubkey, params: PumpSwapParams) -
|
||||
let account = get_associated_token_address_with_program_id(&payer, &mint_pubkey, &program_id);
|
||||
let balance = rpc.get_token_account_balance(&account).await?;
|
||||
let amount_token = balance.amount.parse::<u64>().unwrap();
|
||||
client
|
||||
.sell(
|
||||
DexType::PumpSwap,
|
||||
mint_pubkey,
|
||||
amount_token,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
false,
|
||||
Box::new(params.clone()),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let sell_params = sol_trade_sdk::TradeSellParams {
|
||||
dex_type: DexType::PumpSwap,
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount_token,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
with_tip: false,
|
||||
extension_params: Box::new(params.clone()),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
// Exit program
|
||||
std::process::exit(0);
|
||||
|
||||
@@ -3,17 +3,18 @@ use std::sync::{
|
||||
Arc,
|
||||
};
|
||||
|
||||
use sol_trade_sdk::{instruction::utils::raydium_amm_v4::{accounts, fetch_amm_info}, solana_streamer_sdk::{match_event, streaming::event_parser::protocols::raydium_amm_v4::RaydiumAmmV4SwapEvent}, trading::common::get_multi_token_balances};
|
||||
use sol_trade_sdk::{common::TradeConfig, instruction::utils::raydium_amm_v4::{accounts, fetch_amm_info}, solana_streamer_sdk::{match_event, streaming::event_parser::protocols::raydium_amm_v4::RaydiumAmmV4SwapEvent}, trading::common::get_multi_token_balances};
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::common::filter::EventTypeFilter;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::common::EventType;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::protocols::raydium_amm_v4::parser::RAYDIUM_AMM_V4_PROGRAM_ID;
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::{Protocol, UnifiedEvent};
|
||||
use sol_trade_sdk::{solana_streamer_sdk::streaming::event_parser::{Protocol, UnifiedEvent}};
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::yellowstone_grpc::{
|
||||
AccountFilter, TransactionFilter,
|
||||
};
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::YellowstoneGrpc;
|
||||
use sol_trade_sdk::{
|
||||
common::{AnyResult, PriorityFee, TradeConfig},
|
||||
common::AnyResult,
|
||||
constants::trade::trade::{DEFAULT_CU_LIMIT, DEFAULT_CU_PRICE},
|
||||
swqos::SwqosConfig,
|
||||
trading::{core::params::RaydiumAmmV4Params, factory::DexType},
|
||||
SolanaTrade,
|
||||
@@ -97,28 +98,15 @@ fn create_event_callback() -> impl Fn(Box<dyn UnifiedEvent>) {
|
||||
/// Create SolanaTrade client
|
||||
/// Initializes a new SolanaTrade client with configuration
|
||||
async fn create_solana_trade_client() -> AnyResult<SolanaTrade> {
|
||||
println!("Creating SolanaTrade client...");
|
||||
|
||||
println!("🚀 Initializing SolanaTrade client...");
|
||||
let payer = Keypair::from_base58_string("use_your_payer_keypair_here");
|
||||
let rpc_url = "https://api.mainnet-beta.solana.com".to_string();
|
||||
|
||||
let swqos_configs = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
|
||||
let mut priority_fee = PriorityFee::default();
|
||||
// Configure according to your needs
|
||||
priority_fee.rpc_unit_limit = 150000;
|
||||
|
||||
let trade_config = TradeConfig {
|
||||
rpc_url,
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee: priority_fee,
|
||||
swqos_configs,
|
||||
};
|
||||
|
||||
let solana_trade_client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("SolanaTrade client created successfully!");
|
||||
|
||||
Ok(solana_trade_client)
|
||||
let commitment = CommitmentConfig::confirmed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("✅ SolanaTrade client initialized successfully!");
|
||||
Ok(solana_trade)
|
||||
}
|
||||
|
||||
/// Raydium_amm_v4 sniper trade
|
||||
@@ -147,23 +135,21 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent)
|
||||
// Buy tokens
|
||||
println!("Buying tokens from Raydium_amm_v4...");
|
||||
let buy_sol_amount = 100_000;
|
||||
client
|
||||
.buy(
|
||||
DexType::RaydiumAmmV4,
|
||||
mint_pubkey,
|
||||
buy_sol_amount,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(params),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let buy_params = sol_trade_sdk::TradeBuyParams {
|
||||
dex_type: DexType::RaydiumAmmV4,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: buy_sol_amount,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(params),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
// Sell tokens
|
||||
println!("Selling tokens from Raydium_amm_v4...");
|
||||
@@ -177,23 +163,21 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent)
|
||||
|
||||
println!("Selling {} tokens", amount_token);
|
||||
let params = RaydiumAmmV4Params::from_amm_address_by_rpc(&client.rpc, trade_info.amm).await?;
|
||||
client
|
||||
.sell(
|
||||
DexType::RaydiumAmmV4,
|
||||
mint_pubkey,
|
||||
amount_token,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
false,
|
||||
Box::new(params),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let sell_params = sol_trade_sdk::TradeSellParams {
|
||||
dex_type: DexType::RaydiumAmmV4,
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount_token,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
with_tip: false,
|
||||
extension_params: Box::new(params),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
// Exit program
|
||||
std::process::exit(0);
|
||||
|
||||
@@ -3,18 +3,18 @@ use std::sync::{
|
||||
Arc,
|
||||
};
|
||||
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::{Protocol, UnifiedEvent};
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::yellowstone_grpc::{
|
||||
AccountFilter, TransactionFilter,
|
||||
};
|
||||
use sol_trade_sdk::solana_streamer_sdk::streaming::YellowstoneGrpc;
|
||||
use sol_trade_sdk::solana_streamer_sdk::{
|
||||
match_event, streaming::event_parser::protocols::raydium_cpmm::RaydiumCpmmSwapEvent,
|
||||
};
|
||||
use sol_trade_sdk::{common::AnyResult, swqos::SwqosConfig, SolanaTrade};
|
||||
use sol_trade_sdk::{
|
||||
common::{AnyResult, PriorityFee, TradeConfig},
|
||||
swqos::SwqosConfig,
|
||||
SolanaTrade,
|
||||
common::TradeConfig,
|
||||
solana_streamer_sdk::streaming::yellowstone_grpc::{AccountFilter, TransactionFilter},
|
||||
};
|
||||
use sol_trade_sdk::{
|
||||
constants::trade::trade::{DEFAULT_CU_LIMIT, DEFAULT_CU_PRICE},
|
||||
solana_streamer_sdk::streaming::event_parser::{Protocol, UnifiedEvent},
|
||||
};
|
||||
use sol_trade_sdk::{
|
||||
instruction::utils::raydium_cpmm::accounts,
|
||||
@@ -107,28 +107,15 @@ fn create_event_callback() -> impl Fn(Box<dyn UnifiedEvent>) {
|
||||
/// Create SolanaTrade client
|
||||
/// Initializes a new SolanaTrade client with configuration
|
||||
async fn create_solana_trade_client() -> AnyResult<SolanaTrade> {
|
||||
println!("Creating SolanaTrade client...");
|
||||
|
||||
println!("🚀 Initializing SolanaTrade client...");
|
||||
let payer = Keypair::from_base58_string("use_your_payer_keypair_here");
|
||||
let rpc_url = "https://api.mainnet-beta.solana.com".to_string();
|
||||
|
||||
let swqos_configs = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
|
||||
let mut priority_fee = PriorityFee::default();
|
||||
// Configure according to your needs
|
||||
priority_fee.rpc_unit_limit = 150000;
|
||||
|
||||
let trade_config = TradeConfig {
|
||||
rpc_url,
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee: priority_fee,
|
||||
swqos_configs,
|
||||
};
|
||||
|
||||
let solana_trade_client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("SolanaTrade client created successfully!");
|
||||
|
||||
Ok(solana_trade_client)
|
||||
let commitment = CommitmentConfig::confirmed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("✅ SolanaTrade client initialized successfully!");
|
||||
Ok(solana_trade)
|
||||
}
|
||||
|
||||
/// Raydium_cpmm sniper trade
|
||||
@@ -151,23 +138,21 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) ->
|
||||
// Buy tokens
|
||||
println!("Buying tokens from Raydium_cpmm...");
|
||||
let buy_sol_amount = 100_000;
|
||||
client
|
||||
.buy(
|
||||
DexType::RaydiumCpmm,
|
||||
mint_pubkey,
|
||||
buy_sol_amount,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(buy_params),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let buy_params = sol_trade_sdk::TradeBuyParams {
|
||||
dex_type: DexType::RaydiumCpmm,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: buy_sol_amount,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(buy_params),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
// Sell tokens
|
||||
println!("Selling tokens from Raydium_cpmm...");
|
||||
@@ -183,23 +168,21 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) ->
|
||||
RaydiumCpmmParams::from_pool_address_by_rpc(&client.rpc, &trade_info.pool_state).await?;
|
||||
|
||||
println!("Selling {} tokens", amount_token);
|
||||
client
|
||||
.sell(
|
||||
DexType::RaydiumCpmm,
|
||||
mint_pubkey,
|
||||
amount_token,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
false,
|
||||
Box::new(sell_params),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
let sell_params = sol_trade_sdk::TradeSellParams {
|
||||
dex_type: DexType::RaydiumCpmm,
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount_token,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
with_tip: false,
|
||||
extension_params: Box::new(sell_params),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: false,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
// Exit program
|
||||
std::process::exit(0);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use sol_trade_sdk::{
|
||||
common::{
|
||||
fast_fn::get_associated_token_address_with_program_id_fast_use_seed, AnyResult,
|
||||
PriorityFee, TradeConfig,
|
||||
fast_fn::get_associated_token_address_with_program_id_fast_use_seed, AnyResult, TradeConfig,
|
||||
},
|
||||
constants::trade::trade::{DEFAULT_CU_LIMIT, DEFAULT_CU_PRICE},
|
||||
swqos::SwqosConfig,
|
||||
trading::{core::params::PumpSwapParams, factory::DexType},
|
||||
SolanaTrade,
|
||||
@@ -24,23 +24,23 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Buy tokens
|
||||
println!("Buying tokens from PumpSwap...");
|
||||
let buy_sol_amount = 100_000;
|
||||
client
|
||||
.buy(
|
||||
DexType::PumpSwap,
|
||||
mint_pubkey,
|
||||
buy_sol_amount,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
Box::new(PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true, // ❗️❗️❗️❗️ open seed optimize
|
||||
)
|
||||
.await?;
|
||||
let buy_params = sol_trade_sdk::TradeBuyParams {
|
||||
dex_type: DexType::PumpSwap,
|
||||
mint: mint_pubkey,
|
||||
sol_amount: buy_sol_amount,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
extension_params: Box::new(
|
||||
PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?,
|
||||
),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: true, // ❗️❗️❗️❗️ open seed optimize
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
tokio::time::sleep(std::time::Duration::from_secs(4)).await;
|
||||
|
||||
@@ -59,23 +59,23 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
);
|
||||
let balance = rpc.get_token_account_balance(&account).await?;
|
||||
let amount_token = balance.amount.parse::<u64>().unwrap();
|
||||
client
|
||||
.sell(
|
||||
DexType::PumpSwap,
|
||||
mint_pubkey,
|
||||
amount_token,
|
||||
slippage_basis_points,
|
||||
recent_blockhash,
|
||||
None,
|
||||
false,
|
||||
Box::new(PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?),
|
||||
None,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true, // ❗️❗️❗️❗️ open seed optimize
|
||||
)
|
||||
.await?;
|
||||
let sell_params = sol_trade_sdk::TradeSellParams {
|
||||
dex_type: DexType::PumpSwap,
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount_token,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
with_tip: false,
|
||||
extension_params: Box::new(
|
||||
PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?,
|
||||
),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: true, // ❗️❗️❗️❗️ open seed optimize
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
tokio::signal::ctrl_c().await?;
|
||||
Ok(())
|
||||
@@ -84,27 +84,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
/// Create SolanaTrade client
|
||||
/// Initializes a new SolanaTrade client with configuration
|
||||
async fn create_solana_trade_client() -> AnyResult<SolanaTrade> {
|
||||
println!("Creating SolanaTrade client...");
|
||||
|
||||
let payer = Keypair::from_base58_string("use_your_own_keypair");
|
||||
println!("🚀 Initializing SolanaTrade client...");
|
||||
let payer = Keypair::from_base58_string("use_your_payer_keypair_here");
|
||||
let rpc_url = "https://api.mainnet-beta.solana.com".to_string();
|
||||
|
||||
let swqos_configs = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
|
||||
let mut priority_fee = PriorityFee::default();
|
||||
priority_fee.buy_tip_fees = vec![0.001];
|
||||
// Configure according to your needs
|
||||
priority_fee.rpc_unit_limit = 150000;
|
||||
|
||||
let trade_config = TradeConfig {
|
||||
rpc_url,
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee: priority_fee,
|
||||
swqos_configs,
|
||||
};
|
||||
|
||||
let solana_trade_client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("SolanaTrade client created successfully!");
|
||||
|
||||
Ok(solana_trade_client)
|
||||
let commitment = CommitmentConfig::confirmed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("✅ SolanaTrade client initialized successfully!");
|
||||
Ok(solana_trade)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use sol_trade_sdk::{
|
||||
common::{AnyResult, PriorityFee, TradeConfig},
|
||||
common::{AnyResult, TradeConfig},
|
||||
swqos::{SwqosConfig, SwqosRegion},
|
||||
SolanaTrade,
|
||||
};
|
||||
@@ -8,53 +8,33 @@ use std::sync::Arc;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let _ = test_create_solana_trade_client().await?;
|
||||
let _ = create_solana_trade_client().await?;
|
||||
println!("Successfully created SolanaTrade client!");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Create SolanaTrade client
|
||||
/// Initializes a new SolanaTrade client with configuration
|
||||
async fn test_create_solana_trade_client() -> AnyResult<SolanaTrade> {
|
||||
async fn create_solana_trade_client() -> AnyResult<SolanaTrade> {
|
||||
println!("Creating SolanaTrade client...");
|
||||
|
||||
let payer = Keypair::new();
|
||||
let payer = Keypair::from_base58_string("use_your_payer_keypair_here");
|
||||
let rpc_url = "https://mainnet.helius-rpc.com/?api-key=xxxxxx".to_string();
|
||||
|
||||
println!("rpc_url: {}", rpc_url);
|
||||
|
||||
let swqos_configs = create_swqos_configs(&rpc_url);
|
||||
let trade_config = create_trade_config(rpc_url, swqos_configs);
|
||||
|
||||
let solana_trade_client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("SolanaTrade client created successfully!");
|
||||
|
||||
Ok(solana_trade_client)
|
||||
}
|
||||
|
||||
fn create_swqos_configs(rpc_url: &str) -> Vec<SwqosConfig> {
|
||||
vec![
|
||||
// First parameter is UUID, pass empty string if no UUID
|
||||
let commitment = CommitmentConfig::processed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![
|
||||
SwqosConfig::Default(rpc_url.clone()),
|
||||
SwqosConfig::Jito("your uuid".to_string(), SwqosRegion::Frankfurt, None),
|
||||
SwqosConfig::NextBlock("your api_token".to_string(), SwqosRegion::Frankfurt, None),
|
||||
SwqosConfig::Bloxroute("your api_token".to_string(), SwqosRegion::Frankfurt, None),
|
||||
SwqosConfig::ZeroSlot("your api_token".to_string(), SwqosRegion::Frankfurt, None),
|
||||
SwqosConfig::Temporal("your api_token".to_string(), SwqosRegion::Frankfurt, None),
|
||||
// Add tg official customer https://t.me/FlashBlock_Official to get free FlashBlock key
|
||||
SwqosConfig::FlashBlock("your api_token".to_string(), SwqosRegion::Frankfurt, None),
|
||||
// Add tg official customer https://t.me/node1_me to get free Node1 key
|
||||
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::Default(rpc_url.to_string()),
|
||||
]
|
||||
}
|
||||
|
||||
fn create_trade_config(rpc_url: String, swqos_configs: Vec<SwqosConfig>) -> TradeConfig {
|
||||
TradeConfig {
|
||||
rpc_url,
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee: PriorityFee::default(),
|
||||
swqos_configs,
|
||||
}
|
||||
];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade_client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("SolanaTrade client created successfully!");
|
||||
Ok(solana_trade_client)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
use sol_trade_sdk::{
|
||||
common::{PriorityFee, TradeConfig},
|
||||
common::TradeConfig,
|
||||
constants::trade::trade::{DEFAULT_CU_LIMIT, DEFAULT_CU_PRICE},
|
||||
swqos::SwqosConfig,
|
||||
SolanaTrade,
|
||||
};
|
||||
use solana_sdk::{commitment_config::CommitmentConfig, signature::Keypair};
|
||||
@@ -57,12 +59,9 @@ async fn create_solana_trade_client() -> Result<SolanaTrade, Box<dyn std::error:
|
||||
println!("🚀 Initializing SolanaTrade client...");
|
||||
let payer = Keypair::from_base58_string("use_your_payer_keypair_here");
|
||||
let rpc_url = "https://api.mainnet-beta.solana.com".to_string();
|
||||
let trade_config = TradeConfig {
|
||||
rpc_url,
|
||||
commitment: CommitmentConfig::confirmed(),
|
||||
priority_fee: PriorityFee::default(),
|
||||
swqos_configs: vec![],
|
||||
};
|
||||
let commitment = CommitmentConfig::confirmed();
|
||||
let swqos_configs: Vec<SwqosConfig> = vec![SwqosConfig::Default(rpc_url.clone())];
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
let solana_trade = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
println!("✅ SolanaTrade client initialized successfully!");
|
||||
Ok(solana_trade)
|
||||
|
||||
Reference in New Issue
Block a user