diff --git a/Cargo.toml b/Cargo.toml index e43a75a..8101e7d 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,13 +30,14 @@ members = [ "examples/nonce_cache", "examples/pumpswap_direct_trading", "examples/wsol_wrapper", + "examples/seed_trading", ] [lib] crate-type = ["cdylib", "rlib"] [dependencies] -solana-streamer-sdk = "0.4.2" +solana-streamer-sdk = "0.4.3" solana-sdk = "2.3.0" solana-client = "2.3.6" solana-program = "2.3.0" diff --git a/README.md b/README.md index 7697ba0..10675eb 100644 --- a/README.md +++ b/README.md @@ -54,12 +54,10 @@ In PumpSwap, Bonk, and Raydium trading, the `create_wsol_ata` and `close_wsol_at - **create_wsol_ata**: - When `create_wsol_ata: true`, the SDK automatically creates and wraps SOL to wSOL before trading - When buying: automatically wraps SOL to wSOL for trading - - Default value is `true` - **close_wsol_ata**: - When `close_wsol_ata: true`, the SDK automatically closes the wSOL account and unwraps to SOL after trading - When selling: automatically unwraps the received wSOL to SOL and reclaims rent - - Default value is `true` - **Benefits of Separate Parameters**: - Allows independent control of wSOL account creation and closure diff --git a/README_CN.md b/README_CN.md index e08fea2..9c6d864 100755 --- a/README_CN.md +++ b/README_CN.md @@ -54,12 +54,10 @@ sol-trade-sdk = "0.6.1" - **create_wsol_ata**: - 当 `create_wsol_ata: true` 时,SDK 会在交易前自动创建并将 SOL 包装为 wSOL - 买入时:自动将 SOL 包装为 wSOL 进行交易 - - 默认值为 `true` - **close_wsol_ata**: - 当 `close_wsol_ata: true` 时,SDK 会在交易后自动关闭 wSOL 账户并解包装为 SOL - 卖出时:自动将获得的 wSOL 解包装为 SOL 并回收租金 - - 默认值为 `true` - **分离参数的优势**: - 允许独立控制 wSOL 账户的创建和关闭 diff --git a/examples/address_lookup/src/main.rs b/examples/address_lookup/src/main.rs index 95180f4..0879648 100644 --- a/examples/address_lookup/src/main.rs +++ b/examples/address_lookup/src/main.rs @@ -170,6 +170,8 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul Some(lookup_table_key), // you still need to update the AddressLookupTableCache true, false, + false, + false, ) .await?; diff --git a/examples/bonk_copy_trading/src/main.rs b/examples/bonk_copy_trading/src/main.rs index e70297e..c703644 100644 --- a/examples/bonk_copy_trading/src/main.rs +++ b/examples/bonk_copy_trading/src/main.rs @@ -151,6 +151,8 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()> Box::new(BonkParams::from_trade(trade_info.clone())), None, true, + true, + true, false, ) .await?; @@ -178,6 +180,8 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()> Box::new(BonkParams::from_trade(trade_info.clone())), None, true, + true, + true, false, ) .await?; diff --git a/examples/bonk_sniper_trading/src/main.rs b/examples/bonk_sniper_trading/src/main.rs index c8623e0..1f261e3 100644 --- a/examples/bonk_sniper_trading/src/main.rs +++ b/examples/bonk_sniper_trading/src/main.rs @@ -120,6 +120,8 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult< Box::new(BonkParams::from_dev_trade(trade_info.clone())), None, true, + true, + true, false, ) .await?; @@ -152,6 +154,8 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult< )), None, true, + true, + true, false, ) .await?; diff --git a/examples/middleware_system/src/main.rs b/examples/middleware_system/src/main.rs index 5496bff..0457683 100644 --- a/examples/middleware_system/src/main.rs +++ b/examples/middleware_system/src/main.rs @@ -102,6 +102,8 @@ async fn test_middleware() -> AnyResult<()> { Box::new(PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool_address).await?), None, true, + true, + true, false, ) .await?; diff --git a/examples/nonce_cache/src/main.rs b/examples/nonce_cache/src/main.rs index 5f832ca..7fa258d 100644 --- a/examples/nonce_cache/src/main.rs +++ b/examples/nonce_cache/src/main.rs @@ -153,6 +153,8 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul None, true, false, + false, + false, ) .await?; diff --git a/examples/pumpfun_copy_trading/src/main.rs b/examples/pumpfun_copy_trading/src/main.rs index a5ff3e7..bbf1443 100644 --- a/examples/pumpfun_copy_trading/src/main.rs +++ b/examples/pumpfun_copy_trading/src/main.rs @@ -146,6 +146,8 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul None, true, false, + false, + false, ) .await?; @@ -173,6 +175,8 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul None, true, false, + false, + false, ) .await?; diff --git a/examples/pumpfun_sniper_trading/src/main.rs b/examples/pumpfun_sniper_trading/src/main.rs index 587c70a..a3cafce 100644 --- a/examples/pumpfun_sniper_trading/src/main.rs +++ b/examples/pumpfun_sniper_trading/src/main.rs @@ -113,6 +113,8 @@ async fn pumpfun_sniper_trade_with_shreds(trade_info: PumpFunTradeEvent) -> AnyR Box::new(PumpFunParams::from_dev_trade(&trade_info, None)), None, true, + true, + true, false, ) .await?; @@ -140,6 +142,8 @@ async fn pumpfun_sniper_trade_with_shreds(trade_info: PumpFunTradeEvent) -> AnyR Box::new(PumpFunParams::immediate_sell(trade_info.creator_vault, true)), None, true, + true, + true, false, ) .await?; diff --git a/examples/pumpswap_direct_trading/src/main.rs b/examples/pumpswap_direct_trading/src/main.rs index b93830a..808d5d2 100644 --- a/examples/pumpswap_direct_trading/src/main.rs +++ b/examples/pumpswap_direct_trading/src/main.rs @@ -33,6 +33,8 @@ async fn main() -> Result<(), Box> { Box::new(PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?), None, true, + true, + true, false, ) .await?; @@ -58,6 +60,8 @@ async fn main() -> Result<(), Box> { Box::new(PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?), None, true, + true, + true, false, ) .await?; diff --git a/examples/pumpswap_trading/src/main.rs b/examples/pumpswap_trading/src/main.rs index 92c337c..26e39f0 100644 --- a/examples/pumpswap_trading/src/main.rs +++ b/examples/pumpswap_trading/src/main.rs @@ -187,6 +187,8 @@ async fn pumpswap_trade_with_grpc(mint_pubkey: Pubkey, params: PumpSwapParams) - Box::new(params.clone()), None, true, + true, + true, false, ) .await?; @@ -216,6 +218,8 @@ async fn pumpswap_trade_with_grpc(mint_pubkey: Pubkey, params: PumpSwapParams) - Box::new(params.clone()), None, true, + true, + true, false, ) .await?; diff --git a/examples/raydium_amm_v4_trading/src/main.rs b/examples/raydium_amm_v4_trading/src/main.rs index 1404e5d..f8934e7 100644 --- a/examples/raydium_amm_v4_trading/src/main.rs +++ b/examples/raydium_amm_v4_trading/src/main.rs @@ -158,6 +158,8 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent) Box::new(params), None, true, + true, + true, false, ) .await?; @@ -186,6 +188,8 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent) Box::new(params), None, true, + true, + true, false, ) .await?; diff --git a/examples/raydium_cpmm_trading/src/main.rs b/examples/raydium_cpmm_trading/src/main.rs index d02ed5f..9081968 100644 --- a/examples/raydium_cpmm_trading/src/main.rs +++ b/examples/raydium_cpmm_trading/src/main.rs @@ -162,6 +162,8 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) -> Box::new(buy_params), None, true, + true, + true, false, ) .await?; @@ -192,6 +194,8 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) -> Box::new(sell_params), None, true, + true, + true, false, ) .await?; diff --git a/examples/seed_trading/Cargo.toml b/examples/seed_trading/Cargo.toml new file mode 100644 index 0000000..1fe9a6e --- /dev/null +++ b/examples/seed_trading/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "seed_trading" +version = "0.1.0" +edition = "2021" + +[dependencies] +sol-trade-sdk = { path = "../.." } +solana-sdk = "2.3.0" +spl-associated-token-account = "7.0.0" +tokio = { version = "1", features = ["full"] } +spl-token= "8.0.0" +spl-token-2022 = { version = "8.0.0", features = ["no-entrypoint"] } \ No newline at end of file diff --git a/examples/seed_trading/src/main.rs b/examples/seed_trading/src/main.rs new file mode 100644 index 0000000..4d73cd8 --- /dev/null +++ b/examples/seed_trading/src/main.rs @@ -0,0 +1,109 @@ +use sol_trade_sdk::{ + common::{ + fast_fn::get_associated_token_address_with_program_id_fast_use_seed, AnyResult, + PriorityFee, TradeConfig, + }, + swqos::SwqosConfig, + trading::{core::params::PumpSwapParams, factory::DexType}, + SolanaTrade, +}; +use solana_sdk::{commitment_config::CommitmentConfig, signature::Keypair}; +use solana_sdk::{pubkey::Pubkey, signer::Signer}; +use std::{str::FromStr, sync::Arc}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + println!("Testing PumpSwap trading..."); + + let client = create_solana_trade_client().await?; + let slippage_basis_points = Some(100); + let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let pool = Pubkey::from_str("9qKxzRejsV6Bp2zkefXWCbGvg61c3hHei7ShXJ4FythA").unwrap(); + let mint_pubkey = Pubkey::from_str("2zMMhcVQEXDtdE6vsFS7S7D5oUodfJHE8vd1gnBouauv").unwrap(); + + // 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, // ❗️❗️❗️❗️ open seed optimize + ) + .await?; + + tokio::time::sleep(std::time::Duration::from_secs(4)).await; + + // Sell tokens + println!("Selling tokens from PumpSwap..."); + + let rpc = client.rpc.clone(); + let payer = client.payer.pubkey(); + let program_id = spl_token::ID; + // ❗️❗️❗️❗️ Must use the 'use seed' method to get the ATA account, otherwise the transaction will fail + let account = get_associated_token_address_with_program_id_fast_use_seed( + &payer, + &mint_pubkey, + &program_id, + true, + ); + let balance = rpc.get_token_account_balance(&account).await?; + let amount_token = balance.amount.parse::().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?; + + tokio::signal::ctrl_c().await?; + Ok(()) +} + +/// Create SolanaTrade client +/// Initializes a new SolanaTrade client with configuration +async fn create_solana_trade_client() -> AnyResult { + println!("Creating SolanaTrade client..."); + + let payer = Keypair::from_base58_string("use_your_own_keypair"); + 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) +} diff --git a/src/instruction/bonk.rs b/src/instruction/bonk.rs index f36d1c3..a76065e 100755 --- a/src/instruction/bonk.rs +++ b/src/instruction/bonk.rs @@ -91,7 +91,7 @@ impl InstructionBuilder for BonkInstructionBuilder { // ======================================== let mut instructions = Vec::with_capacity(6); - if protocol_params.create_wsol_ata { + if params.create_wsol_ata { instructions .extend(crate::trading::common::handle_wsol(¶ms.payer.pubkey(), amount_in)); } @@ -135,7 +135,7 @@ impl InstructionBuilder for BonkInstructionBuilder { instructions.push(Instruction::new_with_bytes(accounts::BONK, &data, accounts.to_vec())); - if protocol_params.close_wsol_ata { + if params.close_wsol_ata { instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); } @@ -220,7 +220,7 @@ impl InstructionBuilder for BonkInstructionBuilder { // ======================================== let mut instructions = Vec::with_capacity(3); - if protocol_params.create_wsol_ata { + if params.create_wsol_ata { instructions.extend(crate::trading::common::create_wsol_ata(¶ms.payer.pubkey())); } @@ -253,7 +253,7 @@ impl InstructionBuilder for BonkInstructionBuilder { instructions.push(Instruction::new_with_bytes(accounts::BONK, &data, accounts.to_vec())); - if protocol_params.close_wsol_ata { + if params.close_wsol_ata { instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); } diff --git a/src/instruction/pumpswap.rs b/src/instruction/pumpswap.rs index 6d4eaa8..c3a7e64 100755 --- a/src/instruction/pumpswap.rs +++ b/src/instruction/pumpswap.rs @@ -46,8 +46,8 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { let pool_quote_token_reserves = protocol_params.pool_quote_token_reserves; let params_coin_creator_vault_ata = protocol_params.coin_creator_vault_ata; let params_coin_creator_vault_authority = protocol_params.coin_creator_vault_authority; - let create_wsol_ata = protocol_params.create_wsol_ata; - let close_wsol_ata = protocol_params.close_wsol_ata; + let create_wsol_ata = params.create_wsol_ata; + let close_wsol_ata = params.close_wsol_ata; let base_token_program = protocol_params.base_token_program; let quote_token_program = protocol_params.quote_token_program; let pool_base_token_account = protocol_params.pool_base_token_account; @@ -214,8 +214,8 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { let pool_quote_token_account = protocol_params.pool_quote_token_account; let params_coin_creator_vault_ata = protocol_params.coin_creator_vault_ata; let params_coin_creator_vault_authority = protocol_params.coin_creator_vault_authority; - let create_wsol_ata = protocol_params.create_wsol_ata; - let close_wsol_ata = protocol_params.close_wsol_ata; + let create_wsol_ata = params.create_wsol_ata; + let close_wsol_ata = params.close_wsol_ata; let base_token_program = protocol_params.base_token_program; let quote_token_program = protocol_params.quote_token_program; diff --git a/src/instruction/raydium_amm_v4.rs b/src/instruction/raydium_amm_v4.rs index ba3f941..f4833a9 100755 --- a/src/instruction/raydium_amm_v4.rs +++ b/src/instruction/raydium_amm_v4.rs @@ -65,7 +65,7 @@ impl InstructionBuilder for RaydiumAmmV4InstructionBuilder { // ======================================== let mut instructions = Vec::with_capacity(6); - if protocol_params.create_wsol_ata { + if params.create_wsol_ata { instructions .extend(crate::trading::common::handle_wsol(¶ms.payer.pubkey(), amount_in)); } @@ -112,7 +112,7 @@ impl InstructionBuilder for RaydiumAmmV4InstructionBuilder { accounts.to_vec(), )); - if protocol_params.close_wsol_ata { + if params.close_wsol_ata { // Close wSOL ATA account, reclaim rent instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); } @@ -167,7 +167,7 @@ impl InstructionBuilder for RaydiumAmmV4InstructionBuilder { // ======================================== let mut instructions = Vec::with_capacity(3); - if protocol_params.create_wsol_ata { + if params.create_wsol_ata { instructions.extend(crate::trading::common::create_wsol_ata(¶ms.payer.pubkey())); } @@ -203,7 +203,7 @@ impl InstructionBuilder for RaydiumAmmV4InstructionBuilder { accounts.to_vec(), )); - if protocol_params.close_wsol_ata { + if params.close_wsol_ata { instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); } diff --git a/src/instruction/raydium_cpmm.rs b/src/instruction/raydium_cpmm.rs index c1ef2ed..45ad102 100755 --- a/src/instruction/raydium_cpmm.rs +++ b/src/instruction/raydium_cpmm.rs @@ -100,7 +100,7 @@ impl InstructionBuilder for RaydiumCpmmInstructionBuilder { // ======================================== let mut instructions = Vec::with_capacity(6); - if protocol_params.create_wsol_ata { + if params.create_wsol_ata { instructions .extend(crate::trading::common::handle_wsol(¶ms.payer.pubkey(), amount_in)); } @@ -143,7 +143,7 @@ impl InstructionBuilder for RaydiumCpmmInstructionBuilder { accounts.to_vec(), )); - if protocol_params.close_wsol_ata { + if params.close_wsol_ata { // Close wSOL ATA account, reclaim rent instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); } @@ -228,7 +228,7 @@ impl InstructionBuilder for RaydiumCpmmInstructionBuilder { // ======================================== let mut instructions = Vec::with_capacity(3); - if protocol_params.create_wsol_ata { + if params.create_wsol_ata { instructions.extend(crate::trading::common::create_wsol_ata(¶ms.payer.pubkey())); } @@ -260,7 +260,7 @@ impl InstructionBuilder for RaydiumCpmmInstructionBuilder { accounts.to_vec(), )); - if protocol_params.close_wsol_ata { + if params.close_wsol_ata { // Close wSOL ATA account, reclaim rent instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); } diff --git a/src/lib.rs b/src/lib.rs index 1fba8fb..519343c 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -133,6 +133,9 @@ impl SolanaTrade { /// * `extension_params` - Optional protocol-specific parameters (uses defaults if None) /// * `lookup_table_key` - Optional address lookup table key for transaction optimization /// * `wait_transaction_confirmed` - Whether to wait for the transaction to be confirmed + /// * `create_wsol_ata` - Whether to create wSOL ATA account + /// * `close_wsol_ata` - Whether to close wSOL ATA account + /// * `open_seed_optimize` - Whether to open seed optimize /// /// # Returns /// @@ -156,6 +159,8 @@ impl SolanaTrade { extension_params: Box, lookup_table_key: Option, wait_transaction_confirmed: bool, + create_wsol_ata: bool, + close_wsol_ata: bool, open_seed_optimize: bool, ) -> Result { if slippage_basis_points.is_none() { @@ -180,6 +185,8 @@ impl SolanaTrade { wait_transaction_confirmed: wait_transaction_confirmed, protocol_params: protocol_params.clone(), open_seed_optimize, + create_wsol_ata, + close_wsol_ata, swqos_clients: self.swqos_clients.clone(), middleware_manager: self.middleware_manager.clone(), }; @@ -223,6 +230,9 @@ impl SolanaTrade { /// * `extension_params` - Optional protocol-specific parameters (uses defaults if None) /// * `lookup_table_key` - Optional address lookup table key for transaction optimization /// * `wait_transaction_confirmed` - Whether to wait for the transaction to be confirmed + /// * `create_wsol_ata` - Whether to create wSOL ATA account + /// * `close_wsol_ata` - Whether to close wSOL ATA account + /// * `open_seed_optimize` - Whether to open seed optimize /// /// # Returns /// @@ -248,6 +258,8 @@ impl SolanaTrade { extension_params: Box, lookup_table_key: Option, wait_transaction_confirmed: bool, + create_wsol_ata: bool, + close_wsol_ata: bool, open_seed_optimize: bool, ) -> Result { if slippage_basis_points.is_none() { @@ -278,6 +290,8 @@ impl SolanaTrade { self.swqos_clients.clone() }, middleware_manager: self.middleware_manager.clone(), + create_wsol_ata, + close_wsol_ata, }; if custom_priority_fee.is_some() { sell_params.priority_fee = Arc::new(custom_priority_fee.unwrap()); @@ -302,9 +316,6 @@ impl SolanaTrade { return Err(anyhow::anyhow!("Invalid protocol params for Trade")); } - let _swqos_clients = - if !with_tip { self.rpc_client.clone() } else { self.swqos_clients.clone() }; - // Execute sell based on tip preference executor.sell_with_tip(sell_params).await } @@ -354,6 +365,8 @@ impl SolanaTrade { extension_params: Box, lookup_table_key: Option, wait_transaction_confirmed: bool, + create_wsol_ata: bool, + close_wsol_ata: bool, open_seed_optimize: bool, ) -> Result { if percent == 0 || percent > 100 { @@ -371,6 +384,8 @@ impl SolanaTrade { extension_params, lookup_table_key, wait_transaction_confirmed, + create_wsol_ata, + close_wsol_ata, open_seed_optimize, ) .await diff --git a/src/trading/core/params.rs b/src/trading/core/params.rs index 4ec3b06..5040e77 100755 --- a/src/trading/core/params.rs +++ b/src/trading/core/params.rs @@ -32,6 +32,8 @@ pub struct BuyParams { pub open_seed_optimize: bool, pub swqos_clients: Vec>, pub middleware_manager: Option>, + pub create_wsol_ata: bool, + pub close_wsol_ata: bool, } /// Sell parameters @@ -51,6 +53,8 @@ pub struct SellParams { pub open_seed_optimize: bool, pub swqos_clients: Vec>, pub middleware_manager: Option>, + pub create_wsol_ata: bool, + pub close_wsol_ata: bool, } /// PumpFun protocol specific parameters @@ -150,8 +154,6 @@ pub struct PumpSwapParams { pub base_token_program: Pubkey, /// Quote token program ID pub quote_token_program: Pubkey, - pub create_wsol_ata: bool, - pub close_wsol_ata: bool, } impl PumpSwapParams { @@ -168,8 +170,6 @@ impl PumpSwapParams { coin_creator_vault_authority: event.coin_creator_vault_authority, base_token_program: event.base_token_program, quote_token_program: event.quote_token_program, - create_wsol_ata: true, - close_wsol_ata: true, } } @@ -186,8 +186,6 @@ impl PumpSwapParams { coin_creator_vault_authority: event.coin_creator_vault_authority, base_token_program: event.base_token_program, quote_token_program: event.quote_token_program, - create_wsol_ata: true, - close_wsol_ata: true, } } @@ -239,8 +237,6 @@ impl PumpSwapParams { } else { crate::constants::TOKEN_PROGRAM_2022 }, - create_wsol_ata: true, - close_wsol_ata: true, }) } } @@ -272,8 +268,6 @@ pub struct BonkParams { pub platform_config: Pubkey, pub platform_associated_account: Pubkey, pub creator_associated_account: Pubkey, - pub create_wsol_ata: bool, - pub close_wsol_ata: bool, } impl BonkParams { @@ -284,8 +278,6 @@ impl BonkParams { creator_associated_account: Pubkey, ) -> Self { Self { - create_wsol_ata: true, - close_wsol_ata: true, mint_token_program, platform_config, platform_associated_account, @@ -306,8 +298,6 @@ impl BonkParams { platform_config: trade_info.platform_config, platform_associated_account: trade_info.platform_associated_account, creator_associated_account: trade_info.creator_associated_account, - create_wsol_ata: true, - close_wsol_ata: true, } } @@ -363,8 +353,6 @@ impl BonkParams { platform_config: trade_info.platform_config, platform_associated_account: trade_info.platform_associated_account, creator_associated_account: trade_info.creator_associated_account, - create_wsol_ata: true, - close_wsol_ata: true, } } @@ -400,8 +388,6 @@ impl BonkParams { platform_config: pool_data.platform_config, platform_associated_account, creator_associated_account, - create_wsol_ata: true, - close_wsol_ata: true, }) } } @@ -442,8 +428,6 @@ pub struct RaydiumCpmmParams { pub quote_token_program: Pubkey, /// Observation state account pub observation_state: Pubkey, - pub create_wsol_ata: bool, - pub close_wsol_ata: bool, } impl RaydiumCpmmParams { @@ -464,8 +448,6 @@ impl RaydiumCpmmParams { base_token_program: trade_info.input_token_program, quote_token_program: trade_info.output_token_program, observation_state: trade_info.observation_state, - create_wsol_ata: true, - close_wsol_ata: true, } } @@ -495,8 +477,6 @@ impl RaydiumCpmmParams { base_token_program: pool.token0_program, quote_token_program: pool.token1_program, observation_state: pool.observation_key, - create_wsol_ata: true, - close_wsol_ata: true, }) } } @@ -529,8 +509,6 @@ pub struct RaydiumAmmV4Params { pub coin_reserve: u64, /// Current pc reserve amount in the pool pub pc_reserve: u64, - pub create_wsol_ata: bool, - pub close_wsol_ata: bool, } impl RaydiumAmmV4Params { @@ -548,8 +526,6 @@ impl RaydiumAmmV4Params { token_pc: amm_info.token_pc, coin_reserve, pc_reserve, - create_wsol_ata: true, - close_wsol_ata: true, } } pub async fn from_amm_address_by_rpc( @@ -567,8 +543,6 @@ impl RaydiumAmmV4Params { token_pc: amm_info.token_pc, coin_reserve, pc_reserve, - create_wsol_ata: true, - close_wsol_ata: true, }) } }