diff --git a/Cargo.toml b/Cargo.toml index 1d25d72..095408a 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sol-trade-sdk" -version = "0.2.4" +version = "0.2.5" edition = "2021" authors = ["William ", "sgxiang ", "wei <1415121722@qq.com>"] repository = "https://github.com/0xfnzero/sol-trade-sdk" @@ -13,7 +13,7 @@ readme = "README.md" crate-type = ["cdylib", "rlib"] [dependencies] -solana-streamer-sdk = "0.1.3" +solana-streamer-sdk = "0.1.4" solana-sdk = "2.1.16" solana-client = "2.1.16" solana-program = "2.1.16" diff --git a/README.md b/README.md index 5387f45..6125810 100755 --- a/README.md +++ b/README.md @@ -31,14 +31,14 @@ Add the dependency to your `Cargo.toml`: ```toml # Add to your Cargo.toml -sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.2.4" } +sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.2.5" } ``` ### Use crates.io ```toml # Add to your Cargo.toml -sol-trade-sdk = "0.2.4" +sol-trade-sdk = "0.2.5" ``` ## Usage Examples @@ -358,6 +358,7 @@ async fn test_pumpswap() -> AnyResult<()> { let buy_sol_amount = 100_000; let slippage_basis_points = Some(100); let recent_blockhash = trade_client.rpc.get_latest_blockhash().await?; + let pool_address = Pubkey::from_str("xxxxxxx")?; println!("Buying tokens from PumpSwap..."); // buy @@ -369,7 +370,10 @@ async fn test_pumpswap() -> AnyResult<()> { slippage_basis_points, recent_blockhash, None, - None, + Some(Box::new(PumpSwapParams { + pool: Some(pool_address), + auto_handle_wsol: true, + })), ) .await?; @@ -386,7 +390,10 @@ async fn test_pumpswap() -> AnyResult<()> { slippage_basis_points, recent_blockhash, None, - None, + Some(Box::new(PumpSwapParams { + pool: Some(pool_address), + auto_handle_wsol: true, + })), ) .await?; diff --git a/README_CN.md b/README_CN.md index 3c37837..4f4e7e7 100755 --- a/README_CN.md +++ b/README_CN.md @@ -31,14 +31,14 @@ git clone https://github.com/0xfnzero/sol-trade-sdk ```toml # 添加到您的 Cargo.toml -sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.2.4" } +sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.2.5" } ``` ### 使用 crates.io ```toml # 添加到您的 Cargo.toml -sol-trade-sdk = "0.2.4" +sol-trade-sdk = "0.2.5" ``` ## 使用示例 @@ -357,6 +357,7 @@ async fn test_pumpswap() -> AnyResult<()> { let buy_sol_amount = 100_000; let slippage_basis_points = Some(100); let recent_blockhash = trade_client.rpc.get_latest_blockhash().await?; + let pool_address = Pubkey::from_str("xxxxxxx")?; println!("Buying tokens from PumpSwap..."); // buy @@ -368,7 +369,10 @@ async fn test_pumpswap() -> AnyResult<()> { slippage_basis_points, recent_blockhash, None, - None, + Some(Box::new(PumpSwapParams { + pool: Some(pool_address), + auto_handle_wsol: true, + })), ) .await?; @@ -384,7 +388,10 @@ async fn test_pumpswap() -> AnyResult<()> { slippage_basis_points, recent_blockhash, None, - None, + Some(Box::new(PumpSwapParams { + pool: Some(pool_address), + auto_handle_wsol: true, + })), ) .await?; diff --git a/src/main.rs b/src/main.rs index 51ed403..df40ecb 100755 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,7 @@ use std::{str::FromStr, sync::Arc}; use sol_trade_sdk::{ common::{bonding_curve::BondingCurveAccount, AnyResult, PriorityFee, TradeConfig}, swqos::{SwqosConfig, SwqosRegion}, - trading::{core::params::{BonkParams, PumpFunParams, RaydiumCpmmParams}, factory::DexType, raydium_cpmm::{common::{get_buy_token_amount, get_sell_sol_amount}}}, + trading::{core::params::{BonkParams, PumpFunParams, PumpSwapParams, RaydiumCpmmParams}, factory::DexType, raydium_cpmm::common::{get_buy_token_amount, get_sell_sol_amount}}, SolanaTrade, }; use sol_trade_sdk::solana_streamer_sdk::{ @@ -178,6 +178,7 @@ async fn test_pumpswap() -> AnyResult<()> { let buy_sol_cost = 100_000; let slippage_basis_points = Some(100); let recent_blockhash = client.rpc.get_latest_blockhash().await?; + let pool_address = Pubkey::from_str("xxxxxxx")?; // Buy tokens println!("Buying tokens from PumpSwap..."); @@ -189,7 +190,10 @@ async fn test_pumpswap() -> AnyResult<()> { slippage_basis_points, recent_blockhash, None, - None, + Some(Box::new(PumpSwapParams { + pool: Some(pool_address), + auto_handle_wsol: true, + })), ).await?; // Sell tokens @@ -203,7 +207,10 @@ async fn test_pumpswap() -> AnyResult<()> { slippage_basis_points, recent_blockhash, None, - None, + Some(Box::new(PumpSwapParams { + pool: Some(pool_address), + auto_handle_wsol: true, + })), ).await?; Ok(())