diff --git a/examples/address_lookup/src/main.rs b/examples/address_lookup/src/main.rs index 14ff199..341bb60 100644 --- a/examples/address_lookup/src/main.rs +++ b/examples/address_lookup/src/main.rs @@ -118,11 +118,11 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul let client = create_solana_trade_client().await?; let mint_pubkey = trade_info.mint; let slippage_basis_points = Some(100); - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let lookup_table_key = Pubkey::from_str("use_your_lookup_table_key_here").unwrap(); let address_lookup_table_account = - fetch_address_lookup_table_account(&client.rpc, &lookup_table_key).await.ok(); + fetch_address_lookup_table_account(&client.infrastructure.rpc, &lookup_table_key).await.ok(); let gas_fee_strategy = GasFeeStrategy::new(); gas_fee_strategy.set_global_fee_strategy(150000, 150000, 500000, 500000, 0.001, 0.001); diff --git a/examples/bonk_copy_trading/src/main.rs b/examples/bonk_copy_trading/src/main.rs index a58837a..ac2b1b4 100644 --- a/examples/bonk_copy_trading/src/main.rs +++ b/examples/bonk_copy_trading/src/main.rs @@ -124,7 +124,7 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()> let client = create_solana_trade_client().await?; let mint_pubkey = trade_info.base_token_mint; let slippage_basis_points = Some(100); - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let gas_fee_strategy = GasFeeStrategy::new(); gas_fee_strategy.set_global_fee_strategy( @@ -182,7 +182,7 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()> // Sell tokens println!("Selling tokens from Bonk..."); - let rpc = client.rpc.clone(); + let rpc = client.infrastructure.rpc.clone(); let payer = client.payer.pubkey(); let account = get_associated_token_address_with_program_id_fast_use_seed( &payer, diff --git a/examples/bonk_sniper_trading/src/main.rs b/examples/bonk_sniper_trading/src/main.rs index 6df794d..6a27d07 100644 --- a/examples/bonk_sniper_trading/src/main.rs +++ b/examples/bonk_sniper_trading/src/main.rs @@ -92,7 +92,7 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult< let client = create_solana_trade_client().await?; let mint_pubkey = trade_info.base_token_mint; let slippage_basis_points = Some(300); - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); gas_fee_strategy.set_global_fee_strategy( @@ -150,7 +150,7 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult< // Sell tokens println!("Selling tokens from Bonk..."); - let rpc = client.rpc.clone(); + let rpc = client.infrastructure.rpc.clone(); let payer = client.payer.pubkey(); let account = get_associated_token_address_with_program_id_fast_use_seed( &payer, diff --git a/examples/cli_trading/src/main.rs b/examples/cli_trading/src/main.rs index c60333d..c2fae5e 100644 --- a/examples/cli_trading/src/main.rs +++ b/examples/cli_trading/src/main.rs @@ -475,7 +475,7 @@ async fn check_mint_ata( let mint_pubkey = Pubkey::from_str(mint).unwrap(); - if let Ok(mint_info) = client.rpc.get_account(&mint_pubkey).await { + if let Ok(mint_info) = client.infrastructure.rpc.get_account(&mint_pubkey).await { let owner_pubkey = mint_info.owner.clone(); let mint_ata = get_associated_token_address_with_program_id_fast_use_seed( &client.get_payer_pubkey(), @@ -483,7 +483,7 @@ async fn check_mint_ata( &owner_pubkey, false, ); - match client.rpc.get_token_account_balance(&mint_ata).await { + match client.infrastructure.rpc.get_token_account_balance(&mint_ata).await { Ok(balance) => { let amount = balance.ui_amount.unwrap_or(0.0); decimals = balance.decimals; @@ -504,7 +504,7 @@ async fn check_mint_ata( &owner_pubkey, true, ); - match client.rpc.get_token_account_balance(&mint_ata).await { + match client.infrastructure.rpc.get_token_account_balance(&mint_ata).await { Ok(_) => { create_mint_ata = false; use_seed = true; @@ -610,8 +610,8 @@ async fn handle_buy_pumpfun( } let client = initialize_real_client().await?; let mint_pubkey = Pubkey::from_str(mint)?; - let param = PumpFunParams::from_mint_by_rpc(&client.rpc, &mint_pubkey).await?; - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let param = PumpFunParams::from_mint_by_rpc(&client.infrastructure.rpc, &mint_pubkey).await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let sol_lamports = sol_str_to_lamports(sol_amount.to_string().as_str()).unwrap(); let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); @@ -665,8 +665,8 @@ async fn handle_buy_pumpswap( println!(" Slippage: {}%", slippage.unwrap()); } let mint_pubkey = Pubkey::from_str(mint)?; - let param = PumpSwapParams::from_mint_by_rpc(&client.rpc, &mint_pubkey).await?; - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let param = PumpSwapParams::from_mint_by_rpc(&client.infrastructure.rpc, &mint_pubkey).await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let sol_lamports = sol_str_to_lamports(sol_amount.to_string().as_str()).unwrap(); let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); @@ -719,8 +719,8 @@ async fn handle_buy_bonk( println!(" Slippage: {}%", slippage.unwrap()); } let mint_pubkey = Pubkey::from_str(mint)?; - let param = BonkParams::from_mint_by_rpc(&client.rpc, &mint_pubkey, false).await?; - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let param = BonkParams::from_mint_by_rpc(&client.infrastructure.rpc, &mint_pubkey, false).await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let sol_lamports = sol_str_to_lamports(sol_amount.to_string().as_str()).unwrap(); let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); @@ -777,8 +777,8 @@ async fn handle_buy_raydium_v4( let mint_pubkey = Pubkey::from_str(mint)?; let amm_pubkey = Pubkey::from_str(amm)?; - let param = RaydiumAmmV4Params::from_amm_address_by_rpc(&client.rpc, amm_pubkey).await?; - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let param = RaydiumAmmV4Params::from_amm_address_by_rpc(&client.infrastructure.rpc, amm_pubkey).await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let sol_lamports = sol_str_to_lamports(sol_amount.to_string().as_str()).unwrap(); let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); @@ -835,8 +835,8 @@ async fn handle_buy_raydium_cpmm( let mint_pubkey = Pubkey::from_str(mint)?; let pool_pubkey = Pubkey::from_str(pool_address)?; - let param = RaydiumCpmmParams::from_pool_address_by_rpc(&client.rpc, &pool_pubkey).await?; - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let param = RaydiumCpmmParams::from_pool_address_by_rpc(&client.infrastructure.rpc, &pool_pubkey).await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let sol_lamports = sol_str_to_lamports(sol_amount.to_string().as_str()).unwrap(); let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); @@ -1004,8 +1004,8 @@ async fn handle_sell_pumpfun( let client = initialize_real_client().await?; let mint_pubkey = Pubkey::from_str(mint)?; - let param = PumpFunParams::from_mint_by_rpc(&client.rpc, &mint_pubkey).await?; - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let param = PumpFunParams::from_mint_by_rpc(&client.infrastructure.rpc, &mint_pubkey).await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); gas_fee_strategy.set_global_fee_strategy(150000, 150000, 500000, 500000, 0.001, 0.001); @@ -1062,8 +1062,8 @@ async fn handle_sell_pumpswap( } let client = initialize_real_client().await?; let mint_pubkey = Pubkey::from_str(mint)?; - let param = PumpSwapParams::from_mint_by_rpc(&client.rpc, &mint_pubkey).await?; - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let param = PumpSwapParams::from_mint_by_rpc(&client.infrastructure.rpc, &mint_pubkey).await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); gas_fee_strategy.set_global_fee_strategy(150000, 150000, 500000, 500000, 0.001, 0.001); @@ -1119,8 +1119,8 @@ async fn handle_sell_bonk( } let client = initialize_real_client().await?; let mint_pubkey = Pubkey::from_str(mint)?; - let param = BonkParams::from_mint_by_rpc(&client.rpc, &mint_pubkey, false).await?; - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let param = BonkParams::from_mint_by_rpc(&client.infrastructure.rpc, &mint_pubkey, false).await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); gas_fee_strategy.set_global_fee_strategy(150000, 150000, 500000, 500000, 0.001, 0.001); @@ -1179,8 +1179,8 @@ async fn handle_sell_raydium_v4( let client = initialize_real_client().await?; let amm_pubkey = Pubkey::from_str(amm)?; let mint_pubkey = Pubkey::from_str(mint)?; - let param = RaydiumAmmV4Params::from_amm_address_by_rpc(&client.rpc, amm_pubkey).await?; - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let param = RaydiumAmmV4Params::from_amm_address_by_rpc(&client.infrastructure.rpc, amm_pubkey).await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); gas_fee_strategy.set_global_fee_strategy(150000, 150000, 500000, 500000, 0.001, 0.001); @@ -1239,8 +1239,8 @@ async fn handle_sell_raydium_cpmm( let client = initialize_real_client().await?; let pool_pubkey = Pubkey::from_str(pool_address)?; let mint_pubkey = Pubkey::from_str(mint)?; - let param = RaydiumCpmmParams::from_pool_address_by_rpc(&client.rpc, &pool_pubkey).await?; - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let param = RaydiumCpmmParams::from_pool_address_by_rpc(&client.infrastructure.rpc, &pool_pubkey).await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); gas_fee_strategy.set_global_fee_strategy(150000, 150000, 500000, 500000, 0.001, 0.001); @@ -1425,7 +1425,7 @@ async fn wrap_sol_real( ]; // Build and send transaction - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let transaction = Transaction::new_signed_with_payer( &instructions, Some(&client.get_payer_pubkey()), @@ -1433,7 +1433,7 @@ async fn wrap_sol_real( recent_blockhash, ); - let signature = client.rpc.send_and_confirm_transaction(&transaction).await?; + let signature = client.infrastructure.rpc.send_and_confirm_transaction(&transaction).await?; println!(" 📝 Transaction Signature: {}", signature); Ok(()) } @@ -1445,7 +1445,7 @@ async fn close_wsol_real(client: &SolanaTrade) -> Result<(), Box Result<(), Box Result<(), Box Result<(), Box> { let client = create_solana_trade_client().await?; let slippage_basis_points = Some(100); - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let pool = Pubkey::from_str("7dVri3qjYD3uobSZL3Zth8vSCgU6r6R2nvFsh7uVfDte").unwrap(); let mint_pubkey = Pubkey::from_str("PRVT6TB7uss3FrUd2D9xs2zqDBsa3GbMJMwCQsgmeta").unwrap(); @@ -32,7 +32,7 @@ async fn main() -> Result<(), Box> { slippage_basis_points: slippage_basis_points, recent_blockhash: Some(recent_blockhash), extension_params: DexParamEnum::MeteoraDammV2( - MeteoraDammV2Params::from_pool_address_by_rpc(&client.rpc, &pool).await?, + MeteoraDammV2Params::from_pool_address_by_rpc(&client.infrastructure.rpc, &pool).await?, ), address_lookup_table_account: None, wait_transaction_confirmed: true, @@ -50,7 +50,7 @@ async fn main() -> Result<(), Box> { // Sell tokens println!("Selling tokens from Metaora Damm V2..."); - let rpc = client.rpc.clone(); + let rpc = client.infrastructure.rpc.clone(); let payer = client.payer.pubkey(); let program_id = sol_trade_sdk::constants::TOKEN_PROGRAM; let account = get_associated_token_address_with_program_id_fast_use_seed(&payer, &mint_pubkey, &program_id, client.use_seed_optimize); @@ -66,7 +66,7 @@ async fn main() -> Result<(), Box> { recent_blockhash: Some(recent_blockhash), with_tip: false, extension_params: DexParamEnum::MeteoraDammV2( - MeteoraDammV2Params::from_pool_address_by_rpc(&client.rpc, &pool).await?, + MeteoraDammV2Params::from_pool_address_by_rpc(&client.infrastructure.rpc, &pool).await?, ), address_lookup_table_account: None, wait_transaction_confirmed: true, diff --git a/examples/middleware_system/src/main.rs b/examples/middleware_system/src/main.rs index ee6c82e..54040e1 100644 --- a/examples/middleware_system/src/main.rs +++ b/examples/middleware_system/src/main.rs @@ -77,7 +77,7 @@ async fn test_middleware() -> AnyResult<()> { let mint_pubkey = Pubkey::from_str("pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn")?; let buy_sol_cost = 100_000; let slippage_basis_points = Some(100); - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let pool_address = Pubkey::from_str("539m4mVWt6iduB6W8rDGPMarzNCMesuqY5eUTiiYHAgR")?; let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); @@ -91,7 +91,7 @@ async fn test_middleware() -> AnyResult<()> { slippage_basis_points: slippage_basis_points, recent_blockhash: Some(recent_blockhash), extension_params: DexParamEnum::PumpSwap( - PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool_address).await?, + PumpSwapParams::from_pool_address_by_rpc(&client.infrastructure.rpc, &pool_address).await?, ), address_lookup_table_account: None, wait_transaction_confirmed: true, diff --git a/examples/nonce_cache/src/main.rs b/examples/nonce_cache/src/main.rs index 852e122..df531d6 100644 --- a/examples/nonce_cache/src/main.rs +++ b/examples/nonce_cache/src/main.rs @@ -118,11 +118,11 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul let client = create_solana_trade_client().await?; let mint_pubkey = trade_info.mint; let slippage_basis_points = Some(100); - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; // Setup nonce cache let nonce_account_str = Pubkey::from_str("use_your_nonce_account_here")?; - let durable_nonce = fetch_nonce_info(&client.rpc, nonce_account_str).await; + let durable_nonce = fetch_nonce_info(&client.infrastructure.rpc, nonce_account_str).await; let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); gas_fee_strategy.set_global_fee_strategy(150000, 150000, 500000, 500000, 0.001, 0.001); diff --git a/examples/pumpfun_copy_trading/src/main.rs b/examples/pumpfun_copy_trading/src/main.rs index 0bbfab8..9603131 100644 --- a/examples/pumpfun_copy_trading/src/main.rs +++ b/examples/pumpfun_copy_trading/src/main.rs @@ -118,7 +118,7 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul let client = create_solana_trade_client().await?; let mint_pubkey = trade_info.mint; let slippage_basis_points = Some(100); - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); gas_fee_strategy.set_global_fee_strategy( @@ -170,7 +170,7 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul // Sell tokens println!("Selling tokens from PumpFun..."); - let rpc = client.rpc.clone(); + let rpc = client.infrastructure.rpc.clone(); let payer = client.payer.pubkey(); let account = get_associated_token_address_with_program_id_fast_use_seed( &payer, diff --git a/examples/pumpfun_sniper_trading/src/main.rs b/examples/pumpfun_sniper_trading/src/main.rs index 36edaec..78e5bcf 100644 --- a/examples/pumpfun_sniper_trading/src/main.rs +++ b/examples/pumpfun_sniper_trading/src/main.rs @@ -86,7 +86,7 @@ async fn pumpfun_sniper_trade_with_shreds(trade_info: PumpFunTradeEvent) -> AnyR let client = create_solana_trade_client().await?; let mint_pubkey = trade_info.mint; let slippage_basis_points = Some(300); - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); gas_fee_strategy.set_global_fee_strategy(150000, 150000, 500000, 500000, 0.001, 0.001); @@ -129,7 +129,7 @@ async fn pumpfun_sniper_trade_with_shreds(trade_info: PumpFunTradeEvent) -> AnyR // Sell tokens println!("Selling tokens from PumpFun..."); - let rpc = client.rpc.clone(); + let rpc = client.infrastructure.rpc.clone(); let payer = client.payer.pubkey(); let account = get_associated_token_address(&payer, &mint_pubkey); let balance = rpc.get_token_account_balance(&account).await?; diff --git a/examples/pumpswap_direct_trading/src/main.rs b/examples/pumpswap_direct_trading/src/main.rs index 3ce7e18..51922de 100644 --- a/examples/pumpswap_direct_trading/src/main.rs +++ b/examples/pumpswap_direct_trading/src/main.rs @@ -14,7 +14,7 @@ async fn main() -> Result<(), Box> { let client = create_solana_trade_client().await?; let slippage_basis_points = Some(100); - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let pool = Pubkey::from_str("539m4mVWt6iduB6W8rDGPMarzNCMesuqY5eUTiiYHAgR").unwrap(); let mint_pubkey = Pubkey::from_str("pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn").unwrap(); @@ -32,7 +32,7 @@ async fn main() -> Result<(), Box> { slippage_basis_points: slippage_basis_points, recent_blockhash: Some(recent_blockhash), extension_params: DexParamEnum::PumpSwap( - PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?, + PumpSwapParams::from_pool_address_by_rpc(&client.infrastructure.rpc, &pool).await?, ), address_lookup_table_account: None, wait_transaction_confirmed: true, @@ -50,7 +50,7 @@ async fn main() -> Result<(), Box> { // Sell tokens println!("Selling tokens from PumpSwap..."); - let rpc = client.rpc.clone(); + let rpc = client.infrastructure.rpc.clone(); let payer = client.payer.pubkey(); let program_id = sol_trade_sdk::constants::TOKEN_PROGRAM_2022; let account = get_associated_token_address_with_program_id_fast_use_seed(&payer, &mint_pubkey, &program_id, client.use_seed_optimize); @@ -65,7 +65,7 @@ async fn main() -> Result<(), Box> { recent_blockhash: Some(recent_blockhash), with_tip: false, extension_params: DexParamEnum::PumpSwap( - PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?, + PumpSwapParams::from_pool_address_by_rpc(&client.infrastructure.rpc, &pool).await?, ), address_lookup_table_account: None, wait_transaction_confirmed: true, diff --git a/examples/pumpswap_trading/src/main.rs b/examples/pumpswap_trading/src/main.rs index b259ac4..297e4c2 100644 --- a/examples/pumpswap_trading/src/main.rs +++ b/examples/pumpswap_trading/src/main.rs @@ -192,7 +192,7 @@ async fn pumpswap_trade_with_grpc(mint_pubkey: Pubkey, params: PumpSwapParams) - let client = create_solana_trade_client().await?; let slippage_basis_points = Some(500); - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); gas_fee_strategy.set_global_fee_strategy(150000, 150000, 500000, 500000, 0.001, 0.001); @@ -227,7 +227,7 @@ async fn pumpswap_trade_with_grpc(mint_pubkey: Pubkey, params: PumpSwapParams) - // Sell tokens println!("Selling tokens from PumpSwap..."); - let rpc = client.rpc.clone(); + let rpc = client.infrastructure.rpc.clone(); let payer = client.payer.pubkey(); let program_id = if params.base_mint == mint_pubkey { params.base_token_program diff --git a/examples/raydium_amm_v4_trading/src/main.rs b/examples/raydium_amm_v4_trading/src/main.rs index 77cbb74..05dafb1 100644 --- a/examples/raydium_amm_v4_trading/src/main.rs +++ b/examples/raydium_amm_v4_trading/src/main.rs @@ -119,11 +119,11 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent) let client = create_solana_trade_client().await?; let slippage_basis_points = Some(100); - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; - let amm_info = fetch_amm_info(&client.rpc, trade_info.amm).await?; + let amm_info = fetch_amm_info(&client.infrastructure.rpc, trade_info.amm).await?; let (coin_reserve, pc_reserve) = - get_multi_token_balances(&client.rpc, &amm_info.token_coin, &amm_info.token_pc).await?; + get_multi_token_balances(&client.infrastructure.rpc, &amm_info.token_coin, &amm_info.token_pc).await?; let mint_pubkey = if amm_info.pc_mint == sol_trade_sdk::constants::WSOL_TOKEN_ACCOUNT || amm_info.pc_mint == sol_trade_sdk::constants::USDC_TOKEN_ACCOUNT { @@ -180,7 +180,7 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent) // Sell tokens println!("Selling tokens from Raydium_amm_v4..."); - let rpc = client.rpc.clone(); + let rpc = client.infrastructure.rpc.clone(); let payer = client.payer.pubkey(); let account = get_associated_token_address_with_program_id_fast_use_seed( &payer, @@ -193,7 +193,7 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent) let amount_token = balance.amount.parse::().unwrap(); println!("Selling {} tokens", amount_token); - let params = RaydiumAmmV4Params::from_amm_address_by_rpc(&client.rpc, trade_info.amm).await?; + let params = RaydiumAmmV4Params::from_amm_address_by_rpc(&client.infrastructure.rpc, trade_info.amm).await?; let sell_params = sol_trade_sdk::TradeSellParams { dex_type: DexType::RaydiumAmmV4, output_token_type: if is_wsol { TradeTokenType::WSOL } else { TradeTokenType::USDC }, diff --git a/examples/raydium_cpmm_trading/src/main.rs b/examples/raydium_cpmm_trading/src/main.rs index a033079..faa4e5f 100644 --- a/examples/raydium_cpmm_trading/src/main.rs +++ b/examples/raydium_cpmm_trading/src/main.rs @@ -127,13 +127,13 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) -> trade_info.input_token_mint }; let slippage_basis_points = Some(100); - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); gas_fee_strategy.set_global_fee_strategy(150000, 150000, 500000, 500000, 0.001, 0.001); let buy_params = - RaydiumCpmmParams::from_pool_address_by_rpc(&client.rpc, &trade_info.pool_state).await?; + RaydiumCpmmParams::from_pool_address_by_rpc(&client.infrastructure.rpc, &trade_info.pool_state).await?; let is_wsol = trade_info.input_token_mint == sol_trade_sdk::constants::WSOL_TOKEN_ACCOUNT || trade_info.output_token_mint == sol_trade_sdk::constants::WSOL_TOKEN_ACCOUNT; @@ -165,7 +165,7 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) -> // Sell tokens println!("Selling tokens from Raydium_cpmm..."); - let rpc = client.rpc.clone(); + let rpc = client.infrastructure.rpc.clone(); let payer = client.payer.pubkey(); let account = get_associated_token_address(&payer, &mint_pubkey); let balance = rpc.get_token_account_balance(&account).await?; @@ -173,7 +173,7 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) -> let amount_token = balance.amount.parse::().unwrap(); let sell_params = - RaydiumCpmmParams::from_pool_address_by_rpc(&client.rpc, &trade_info.pool_state).await?; + RaydiumCpmmParams::from_pool_address_by_rpc(&client.infrastructure.rpc, &trade_info.pool_state).await?; println!("Selling {} tokens", amount_token); let sell_params = sol_trade_sdk::TradeSellParams { diff --git a/examples/seed_trading/src/main.rs b/examples/seed_trading/src/main.rs index 69cb186..3af6c4e 100644 --- a/examples/seed_trading/src/main.rs +++ b/examples/seed_trading/src/main.rs @@ -17,7 +17,7 @@ async fn main() -> Result<(), Box> { let client = create_solana_trade_client().await?; let slippage_basis_points = Some(100); - let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; let pool = Pubkey::from_str("9qKxzRejsV6Bp2zkefXWCbGvg61c3hHei7ShXJ4FythA").unwrap(); let mint_pubkey = Pubkey::from_str("2zMMhcVQEXDtdE6vsFS7S7D5oUodfJHE8vd1gnBouauv").unwrap(); @@ -35,7 +35,7 @@ async fn main() -> Result<(), Box> { slippage_basis_points: slippage_basis_points, recent_blockhash: Some(recent_blockhash), extension_params: DexParamEnum::PumpSwap( - PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?, + PumpSwapParams::from_pool_address_by_rpc(&client.infrastructure.rpc, &pool).await?, ), address_lookup_table_account: None, wait_transaction_confirmed: true, @@ -55,7 +55,7 @@ async fn main() -> Result<(), Box> { // Sell tokens println!("Selling tokens from PumpSwap..."); - let rpc = client.rpc.clone(); + let rpc = client.infrastructure.rpc.clone(); let payer = client.payer.pubkey(); let program_id = sol_trade_sdk::constants::TOKEN_PROGRAM; // ❗️❗️❗️❗️ Must use the 'use seed' method to get the ATA account, otherwise the transaction will fail @@ -76,7 +76,7 @@ async fn main() -> Result<(), Box> { recent_blockhash: Some(recent_blockhash), with_tip: false, extension_params: DexParamEnum::PumpSwap( - PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?, + PumpSwapParams::from_pool_address_by_rpc(&client.infrastructure.rpc, &pool).await?, ), address_lookup_table_account: None, wait_transaction_confirmed: true,