diff --git a/src/common/bonding_curve.rs b/src/common/bonding_curve.rs index 59a214b..2633623 100755 --- a/src/common/bonding_curve.rs +++ b/src/common/bonding_curve.rs @@ -54,14 +54,14 @@ pub struct BondingCurveAccount { } impl BondingCurveAccount { - pub fn from_dev_trade(mint: &Pubkey, dev_buy_token: u64, dev_cost_sol: u64, creator: Pubkey) -> Self { + pub fn from_dev_trade(mint: &Pubkey, dev_token_amount: u64, dev_sol_amount: u64, creator: Pubkey) -> Self { Self { discriminator: 0, account: get_bonding_curve_pda(mint).unwrap(), - virtual_token_reserves: INITIAL_VIRTUAL_TOKEN_RESERVES - dev_buy_token, - virtual_sol_reserves: INITIAL_VIRTUAL_SOL_RESERVES + dev_cost_sol, - real_token_reserves: INITIAL_REAL_TOKEN_RESERVES - dev_buy_token, - real_sol_reserves: dev_cost_sol, + virtual_token_reserves: INITIAL_VIRTUAL_TOKEN_RESERVES - dev_token_amount, + virtual_sol_reserves: INITIAL_VIRTUAL_SOL_RESERVES + dev_sol_amount, + real_token_reserves: INITIAL_REAL_TOKEN_RESERVES - dev_token_amount, + real_sol_reserves: dev_sol_amount, token_total_supply: TOKEN_TOTAL_SUPPLY, complete: false, creator: creator, diff --git a/src/instruction/bonk.rs b/src/instruction/bonk.rs index dd2459e..159941c 100755 --- a/src/instruction/bonk.rs +++ b/src/instruction/bonk.rs @@ -24,7 +24,7 @@ pub struct BonkInstructionBuilder; #[async_trait::async_trait] impl InstructionBuilder for BonkInstructionBuilder { async fn build_buy_instructions(&self, params: &BuyParams) -> Result> { - if params.amount_sol == 0 { + if params.sol_amount == 0 { return Err(anyhow!("Amount cannot be zero")); } self.build_buy_instructions_with_accounts(params).await @@ -81,7 +81,7 @@ impl BonkInstructionBuilder { real_quote_before = pool.real_quote as u128; } - let amount_in: u64 = params.amount_sol; + let amount_in: u64 = params.sol_amount; let share_fee_rate: u64 = 0; let minimum_amount_out: u64 = get_amount_out( amount_in, @@ -194,8 +194,8 @@ impl BonkInstructionBuilder { let rpc = params.rpc.as_ref().unwrap().clone(); // 获取代币余额 - let mut amount = params.amount_token; - if params.amount_token.is_none() || params.amount_token.unwrap_or(0) == 0 { + let mut amount = params.token_amount; + if params.token_amount.is_none() || params.token_amount.unwrap_or(0) == 0 { let balance_u64 = get_token_balance(rpc.as_ref(), ¶ms.payer.pubkey(), ¶ms.mint).await?; amount = Some(balance_u64); diff --git a/src/instruction/pumpfun.rs b/src/instruction/pumpfun.rs index 687e169..eb9c5e0 100755 --- a/src/instruction/pumpfun.rs +++ b/src/instruction/pumpfun.rs @@ -38,7 +38,7 @@ impl InstructionBuilder for PumpFunInstructionBuilder { .downcast_ref::() .ok_or_else(|| anyhow!("Invalid protocol params for PumpFun"))?; - if params.amount_sol == 0 { + if params.sol_amount == 0 { return Err(anyhow!("Amount cannot be zero")); } @@ -49,13 +49,13 @@ impl InstructionBuilder for PumpFunInstructionBuilder { }; let max_sol_cost = calculate_with_slippage_buy( - params.amount_sol, + params.sol_amount, params.slippage_basis_points.unwrap_or(DEFAULT_SLIPPAGE), ); let creator_vault_pda = bonding_curve.get_creator_vault_pda(); let mut buy_token_amount = - get_buy_token_amount_from_sol_amount(&bonding_curve, params.amount_sol); + get_buy_token_amount_from_sol_amount(&bonding_curve, params.sol_amount); if buy_token_amount <= 100 * 1_000_000_u64 { buy_token_amount = if max_sol_cost > sol_to_lamports(0.01) { 25547619 * 1_000_000_u64 @@ -91,7 +91,7 @@ impl InstructionBuilder for PumpFunInstructionBuilder { } async fn build_sell_instructions(&self, params: &SellParams) -> Result> { - let amount_token = if let Some(amount) = params.amount_token { + let token_amount = if let Some(amount) = params.token_amount { if amount == 0 { return Err(anyhow!("Amount cannot be zero")); } @@ -113,9 +113,9 @@ impl InstructionBuilder for PumpFunInstructionBuilder { return Err(anyhow!("RPC client is required to get token balance")); }; - let mut amount_token = amount_token; - if amount_token > balance_u64 { - amount_token = balance_u64; + let mut token_amount = token_amount; + if token_amount > balance_u64 { + token_amount = balance_u64; } let mut instructions = vec![sell( @@ -124,13 +124,13 @@ impl InstructionBuilder for PumpFunInstructionBuilder { &creator_vault_pda, &FEE_RECIPIENT, Sell { - _amount: amount_token, + _amount: token_amount, _min_sol_output: 1, }, )]; // 如果卖出全部代币,关闭账户 - if amount_token >= balance_u64 { + if token_amount >= balance_u64 { instructions.push(close_account( &spl_token::ID, &ata, diff --git a/src/instruction/pumpswap.rs b/src/instruction/pumpswap.rs index 4689660..ef6c503 100755 --- a/src/instruction/pumpswap.rs +++ b/src/instruction/pumpswap.rs @@ -31,7 +31,7 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { .downcast_ref::() .ok_or_else(|| anyhow!("Invalid protocol params for PumpSwap"))?; - if params.amount_sol == 0 { + if params.sol_amount == 0 { return Err(anyhow!("Amount cannot be zero")); } @@ -114,11 +114,11 @@ impl PumpSwapInstructionBuilder { } let rpc = params.rpc.as_ref().unwrap().clone(); // 计算预期的代币数量 - let token_amount = get_buy_token_amount(rpc.as_ref(), &pool, params.amount_sol).await?; + let token_amount = get_buy_token_amount(rpc.as_ref(), &pool, params.sol_amount).await?; // 计算滑点后的最大SOL数量 let max_sol_amount = calculate_with_slippage_buy( - params.amount_sol, + params.sol_amount, params.slippage_basis_points.unwrap_or(DEFAULT_SLIPPAGE), ); @@ -257,8 +257,8 @@ impl PumpSwapInstructionBuilder { let rpc = params.rpc.as_ref().unwrap().clone(); // 获取代币余额 - let mut amount = params.amount_token; - if params.amount_token.is_none() { + let mut amount = params.token_amount; + if params.token_amount.is_none() { let balance_u64 = get_token_balance(rpc.as_ref(), ¶ms.payer.pubkey(), ¶ms.mint).await?; amount = Some(balance_u64); diff --git a/src/lib.rs b/src/lib.rs index 2c48a5c..27564d8 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -156,7 +156,7 @@ impl SolanaTrade { dex_type: DexType, mint: Pubkey, creator: Option, - amount_sol: u64, + sol_amount: u64, slippage_basis_points: Option, recent_blockhash: Hash, custom_buy_tip_fee: Option, @@ -182,7 +182,7 @@ impl SolanaTrade { payer: self.payer.clone(), mint: mint, creator: creator.unwrap_or(Pubkey::default()), - amount_sol: amount_sol, + sol_amount: sol_amount, slippage_basis_points: slippage_basis_points, priority_fee: self.trade_config.priority_fee.clone(), lookup_table_key: self.trade_config.lookup_table_key, @@ -286,7 +286,7 @@ impl SolanaTrade { dex_type: DexType, mint: Pubkey, creator: Option, - amount_token: u64, + token_amount: u64, slippage_basis_points: Option, recent_blockhash: Hash, custom_buy_tip_fee: Option, @@ -312,7 +312,7 @@ impl SolanaTrade { payer: self.payer.clone(), mint: mint, creator: creator.unwrap_or(Pubkey::default()), - amount_token: Some(amount_token), + token_amount: Some(token_amount), slippage_basis_points: slippage_basis_points, priority_fee: self.trade_config.priority_fee.clone(), lookup_table_key: self.trade_config.lookup_table_key, diff --git a/src/main.rs b/src/main.rs index 37bd89a..e1af85a 100755 --- a/src/main.rs +++ b/src/main.rs @@ -18,9 +18,7 @@ use sol_trade_sdk::{ ShredStreamGrpc, YellowstoneGrpc, }, swqos::{SwqosConfig, SwqosRegion}, - trading::{ - core::params::PumpFunParams, factory::DexType, - }, + trading::{core::params::PumpFunParams, factory::DexType}, SolanaTrade, }; use solana_sdk::{commitment_config::CommitmentConfig, pubkey::Pubkey, signature::Keypair}; @@ -35,31 +33,15 @@ async fn main() -> Result<(), Box> { Ok(()) } -/// 创建 SolanaTrade 客户端的示例 +/// 创建 SolanaTrade 客户端 async fn test_create_solana_trade_client() -> AnyResult { println!("Creating SolanaTrade client..."); let payer = Keypair::new(); let rpc_url = "https://mainnet.helius-rpc.com/?api-key=xxxxxx".to_string(); - // 配置各种 SWQOS 服务 - let swqos_configs = vec![ - SwqosConfig::Jito(SwqosRegion::Frankfurt), - SwqosConfig::NextBlock("your api_token".to_string(), SwqosRegion::Frankfurt), - SwqosConfig::Bloxroute("your api_token".to_string(), SwqosRegion::Frankfurt), - SwqosConfig::ZeroSlot("your api_token".to_string(), SwqosRegion::Frankfurt), - SwqosConfig::Temporal("your api_token".to_string(), SwqosRegion::Frankfurt), - SwqosConfig::Default(rpc_url.clone()), - ]; - - // 定义交易配置 - let trade_config = TradeConfig { - rpc_url: rpc_url.clone(), - commitment: CommitmentConfig::confirmed(), - priority_fee: PriorityFee::default(), - swqos_configs, - lookup_table_key: None, - }; + 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!"); @@ -67,204 +49,211 @@ async fn test_create_solana_trade_client() -> AnyResult { Ok(solana_trade_client) } -async fn test_pumpfun_copy_trade_width_grpc(trade_info: PumpFunTradeEvent) -> AnyResult<()> { +fn create_swqos_configs(rpc_url: &str) -> Vec { + vec![ + SwqosConfig::Jito(SwqosRegion::Frankfurt), + SwqosConfig::NextBlock("your api_token".to_string(), SwqosRegion::Frankfurt), + SwqosConfig::Bloxroute("your api_token".to_string(), SwqosRegion::Frankfurt), + SwqosConfig::ZeroSlot("your api_token".to_string(), SwqosRegion::Frankfurt), + SwqosConfig::Temporal("your api_token".to_string(), SwqosRegion::Frankfurt), + SwqosConfig::Default(rpc_url.to_string()), + ] +} +fn create_trade_config(rpc_url: String, swqos_configs: Vec) -> TradeConfig { + TradeConfig { + rpc_url, + commitment: CommitmentConfig::confirmed(), + priority_fee: PriorityFee::default(), + swqos_configs, + lookup_table_key: None, + } +} + +async fn test_pumpfun_copy_trade_width_grpc(trade_info: PumpFunTradeEvent) -> AnyResult<()> { println!("Testing PumpFun trading..."); - let solana_trade_client = test_create_solana_trade_client().await?; - let creator = Pubkey::from_str("xxxxxx")?; // dev account - let buy_sol_cost = 100_000; // 0.0001 SOL + let client = test_create_solana_trade_client().await?; + let creator = Pubkey::from_str("xxxxxx")?; + let mint_pubkey = Pubkey::from_str("xxxxxx")?; + let buy_sol_cost = 100_000; let slippage_basis_points = Some(100); - let recent_blockhash = solana_trade_client.rpc.get_latest_blockhash().await?; - let mint_pubkey = Pubkey::from_str("xxxxxx")?; // token mint - - println!("Buying tokens from PumpFun..."); - + let recent_blockhash = client.rpc.get_latest_blockhash().await?; let bonding_curve = BondingCurveAccount::from_trade(&trade_info); - solana_trade_client - .buy( - DexType::PumpFun, - mint_pubkey, - Some(creator), - buy_sol_cost, - slippage_basis_points, - recent_blockhash, - None, - false, - Some(Box::new(PumpFunParams { - bonding_curve: Some(Arc::new(bonding_curve.clone())), - })), - ) - .await?; - // sell + // Buy tokens + println!("Buying tokens from PumpFun..."); + client.buy( + DexType::PumpFun, + mint_pubkey, + Some(creator), + buy_sol_cost, + slippage_basis_points, + recent_blockhash, + None, + false, + Some(Box::new(PumpFunParams { + bonding_curve: Some(Arc::new(bonding_curve.clone())), + })), + ).await?; + + // Sell tokens println!("Selling tokens from PumpFun..."); - let amount_token = 0; // 写上真实的amount_token - solana_trade_client - .sell( - DexType::PumpFun, - mint_pubkey, - Some(creator), - amount_token, - slippage_basis_points, - recent_blockhash, - None, - false, - None, - ) - .await?; + let amount_token = 0; + client.sell( + DexType::PumpFun, + mint_pubkey, + Some(creator), + amount_token, + slippage_basis_points, + recent_blockhash, + None, + false, + None, + ).await?; + Ok(()) } async fn test_pumpfun_sniper_trade_width_shreds(trade_info: PumpFunTradeEvent) -> AnyResult<()> { - println!("Testing PumpFun trading..."); - // if not dev trade, return if !trade_info.is_dev_create_token_trade { return Ok(()); } - let solana_trade_client = test_create_solana_trade_client().await?; + let client = test_create_solana_trade_client().await?; let mint_pubkey = trade_info.mint; let creator = trade_info.creator; - let buy_sol_cost = trade_info.max_sol_cost; - let amount_token = trade_info.token_amount; let slippage_basis_points = Some(100); - let recent_blockhash = solana_trade_client.rpc.get_latest_blockhash().await?; - - println!("Buying tokens from PumpFun..."); - + let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let bonding_curve = BondingCurveAccount::from_dev_trade( &mint_pubkey, - amount_token, - buy_sol_cost, + trade_info.token_amount, + trade_info.max_sol_cost, creator, ); - - solana_trade_client - .buy( - DexType::PumpFun, - mint_pubkey, - Some(creator), - buy_sol_cost, - slippage_basis_points, - recent_blockhash, - None, - false, - Some(Box::new(PumpFunParams { - bonding_curve: Some(Arc::new(bonding_curve.clone())), - })), - ) - .await?; - // sell + + // Buy tokens + println!("Buying tokens from PumpFun..."); + let buy_sol_amount = 100_000; + client.buy( + DexType::PumpFun, + mint_pubkey, + Some(creator), + buy_sol_amount, + slippage_basis_points, + recent_blockhash, + None, + false, + Some(Box::new(PumpFunParams { + bonding_curve: Some(Arc::new(bonding_curve.clone())), + })), + ).await?; + + // Sell tokens println!("Selling tokens from PumpFun..."); - let amount_token = 0; // 写上真实的amount_token - solana_trade_client - .sell( - DexType::PumpFun, - mint_pubkey, - Some(creator), - amount_token, - slippage_basis_points, - recent_blockhash, - None, - false, - None, - ) - .await?; + let amount_token = 0; + client.sell( + DexType::PumpFun, + mint_pubkey, + Some(creator), + amount_token, + slippage_basis_points, + recent_blockhash, + None, + false, + None, + ).await?; + Ok(()) } async fn test_pumpswap() -> AnyResult<()> { println!("Testing PumpSwap trading..."); - let solana_trade_client = test_create_solana_trade_client().await?; - let creator = Pubkey::from_str("11111111111111111111111111111111")?; // dev account - let buy_sol_cost = 100_000; // 0.0001 SOL + let client = test_create_solana_trade_client().await?; + let creator = Pubkey::from_str("11111111111111111111111111111111")?; + let mint_pubkey = Pubkey::from_str("2zMMhcVQEXDtdE6vsFS7S7D5oUodfJHE8vd1gnBouauv")?; + let buy_sol_cost = 100_000; let slippage_basis_points = Some(100); - let recent_blockhash = solana_trade_client.rpc.get_latest_blockhash().await?; - let mint_pubkey = Pubkey::from_str("2zMMhcVQEXDtdE6vsFS7S7D5oUodfJHE8vd1gnBouauv")?; // token mint + let recent_blockhash = client.rpc.get_latest_blockhash().await?; + // Buy tokens println!("Buying tokens from PumpSwap..."); - // buy - solana_trade_client - .buy( - DexType::PumpFun, - mint_pubkey, - Some(creator), - buy_sol_cost, - slippage_basis_points, - recent_blockhash, - None, - false, - None, - ) - .await?; - // sell + client.buy( + DexType::PumpFun, + mint_pubkey, + Some(creator), + buy_sol_cost, + slippage_basis_points, + recent_blockhash, + None, + false, + None, + ).await?; + + // Sell tokens println!("Selling tokens from PumpSwap..."); - let amount_token = 0; // 写上真实的amount_token - solana_trade_client - .sell( - DexType::PumpSwap, - mint_pubkey, - Some(creator), - amount_token, - slippage_basis_points, - recent_blockhash, - None, - false, - None, - ) - .await?; + let amount_token = 0; + client.sell( + DexType::PumpSwap, + mint_pubkey, + Some(creator), + amount_token, + slippage_basis_points, + recent_blockhash, + None, + false, + None, + ).await?; + Ok(()) } async fn test_bonk() -> Result<(), Box> { println!("Testing Bonk trading..."); - let solana_trade_client = test_create_solana_trade_client().await?; - let buy_sol_cost = 100_000; // 0.0001 SOL - let slippage_basis_points = Some(100); // 1% - let recent_blockhash = solana_trade_client.rpc.get_latest_blockhash().await?; + let client = test_create_solana_trade_client().await?; let mint_pubkey = Pubkey::from_str("xxxxxxx")?; + let buy_sol_cost = 100_000; + let slippage_basis_points = Some(100); + let recent_blockhash = client.rpc.get_latest_blockhash().await?; + // Buy tokens println!("Buying tokens from letsbonk.fun..."); - // buy - solana_trade_client - .buy( - DexType::Bonk, - mint_pubkey, - None, - buy_sol_cost, - slippage_basis_points, - recent_blockhash, - None, - false, - None, - ) - .await?; - // sell + client.buy( + DexType::Bonk, + mint_pubkey, + None, + buy_sol_cost, + slippage_basis_points, + recent_blockhash, + None, + false, + None, + ).await?; + + // Sell tokens println!("Selling tokens from letsbonk.fun..."); - let amount_token = 0; // 写上真实的amount_token - solana_trade_client - .sell( - DexType::Bonk, - mint_pubkey, - None, - amount_token, - slippage_basis_points, - recent_blockhash, - None, - false, - None, - ) - .await?; + let amount_token = 0; + client.sell( + DexType::Bonk, + mint_pubkey, + None, + amount_token, + slippage_basis_points, + recent_blockhash, + None, + false, + None, + ).await?; + Ok(()) } async fn test_grpc() -> Result<(), Box> { - // 使用 GRPC 客户端订阅事件 println!("正在订阅 GRPC 事件..."); let grpc = YellowstoneGrpc::new( @@ -272,56 +261,30 @@ async fn test_grpc() -> Result<(), Box> { None, )?; - // 定义回调函数处理 PumpSwap 事件 - let callback = |event: Box| { - match_event!(event, { - BonkPoolCreateEvent => |e: BonkPoolCreateEvent| { - println!("BonkPoolCreateEvent: {:?}", e.base_mint_param.symbol); - }, - BonkTradeEvent => |e: BonkTradeEvent| { - println!("BonkTradeEvent: {:?}", e); - }, - PumpFunTradeEvent => |e: PumpFunTradeEvent| { - println!("PumpFunTradeEvent: {:?}", e); - }, - PumpFunCreateTokenEvent => |e: PumpFunCreateTokenEvent| { - println!("PumpFunCreateTokenEvent: {:?}", e); - }, - PumpSwapBuyEvent => |e: PumpSwapBuyEvent| { - println!("Buy event: {:?}", e); - }, - PumpSwapSellEvent => |e: PumpSwapSellEvent| { - println!("Sell event: {:?}", e); - }, - PumpSwapCreatePoolEvent => |e: PumpSwapCreatePoolEvent| { - println!("CreatePool event: {:?}", e); - }, - PumpSwapDepositEvent => |e: PumpSwapDepositEvent| { - println!("Deposit event: {:?}", e); - }, - PumpSwapWithdrawEvent => |e: PumpSwapWithdrawEvent| { - println!("Withdraw event: {:?}", e); - }, - }); - }; - - // 订阅 PumpSwap 事件 - println!("开始监听事件,按 Ctrl+C 停止..."); + let callback = create_event_callback(); let protocols = vec![Protocol::PumpFun, Protocol::PumpSwap, Protocol::Bonk]; - grpc.subscribe_events(protocols, None, None, None, callback) - .await?; + + println!("开始监听事件,按 Ctrl+C 停止..."); + grpc.subscribe_events(protocols, None, None, None, callback).await?; Ok(()) } async fn test_shreds() -> Result<(), Box> { - // 使用 ShredStream 客户端订阅事件 println!("正在订阅 ShredStream 事件..."); let shred_stream = ShredStreamGrpc::new("http://127.0.0.1:10800".to_string()).await?; + let callback = create_event_callback(); + let protocols = vec![Protocol::PumpFun, Protocol::PumpSwap, Protocol::Bonk]; - // 定义回调函数处理 PumpSwap 事件 - let callback = |event: Box| { + println!("开始监听事件,按 Ctrl+C 停止..."); + shred_stream.shredstream_subscribe(protocols, None, callback).await?; + + Ok(()) +} + +fn create_event_callback() -> impl Fn(Box) { + |event: Box| { match_event!(event, { BonkPoolCreateEvent => |e: BonkPoolCreateEvent| { println!("BonkPoolCreateEvent: {:?}", e.base_mint_param.symbol); @@ -351,14 +314,5 @@ async fn test_shreds() -> Result<(), Box> { println!("Withdraw event: {:?}", e); }, }); - }; - - // 订阅 PumpSwap 事件 - println!("开始监听事件,按 Ctrl+C 停止..."); - let protocols = vec![Protocol::PumpFun, Protocol::PumpSwap, Protocol::Bonk]; - shred_stream - .shredstream_subscribe(protocols, None, callback) - .await?; - - Ok(()) + } } diff --git a/src/trading/core/executor.rs b/src/trading/core/executor.rs index d9292ff..b58c277 100755 --- a/src/trading/core/executor.rs +++ b/src/trading/core/executor.rs @@ -81,7 +81,7 @@ impl TradeExecutor for GenericTradeExecutor { payer: params.payer.clone(), mint: params.mint, creator: params.creator, - amount_sol: params.amount_sol, + sol_amount: params.sol_amount, slippage_basis_points: params.slippage_basis_points, priority_fee: params.priority_fee.clone(), lookup_table_key: params.lookup_table_key, @@ -155,7 +155,7 @@ impl TradeExecutor for GenericTradeExecutor { payer: params.payer.clone(), mint: params.mint, creator: params.creator, - amount_token: params.amount_token, + token_amount: params.token_amount, slippage_basis_points: params.slippage_basis_points, priority_fee: params.priority_fee.clone(), lookup_table_key: params.lookup_table_key, diff --git a/src/trading/core/params.rs b/src/trading/core/params.rs index 3553a56..265b321 100755 --- a/src/trading/core/params.rs +++ b/src/trading/core/params.rs @@ -14,7 +14,7 @@ pub struct BuyParams { pub payer: Arc, pub mint: Pubkey, pub creator: Pubkey, - pub amount_sol: u64, + pub sol_amount: u64, pub slippage_basis_points: Option, pub priority_fee: PriorityFee, pub lookup_table_key: Option, @@ -31,7 +31,7 @@ pub struct BuyWithTipParams { pub payer: Arc, pub mint: Pubkey, pub creator: Pubkey, - pub amount_sol: u64, + pub sol_amount: u64, pub slippage_basis_points: Option, pub priority_fee: PriorityFee, pub lookup_table_key: Option, @@ -47,7 +47,7 @@ pub struct SellParams { pub payer: Arc, pub mint: Pubkey, pub creator: Pubkey, - pub amount_token: Option, + pub token_amount: Option, pub slippage_basis_points: Option, pub priority_fee: PriorityFee, pub lookup_table_key: Option, @@ -63,7 +63,7 @@ pub struct SellWithTipParams { pub payer: Arc, pub mint: Pubkey, pub creator: Pubkey, - pub amount_token: Option, + pub token_amount: Option, pub slippage_basis_points: Option, pub priority_fee: PriorityFee, pub lookup_table_key: Option, @@ -162,7 +162,7 @@ impl BuyParams { payer: self.payer, mint: self.mint, creator: self.creator, - amount_sol: self.amount_sol, + sol_amount: self.sol_amount, slippage_basis_points: self.slippage_basis_points, priority_fee: self.priority_fee, lookup_table_key: self.lookup_table_key, @@ -182,7 +182,7 @@ impl SellParams { payer: self.payer, mint: self.mint, creator: self.creator, - amount_token: self.amount_token, + token_amount: self.token_amount, slippage_basis_points: self.slippage_basis_points, priority_fee: self.priority_fee, lookup_table_key: self.lookup_table_key,