feat: Upgrade SDK version to 0.2.5 and enhance PumpSwap functionality

- Upgrade SDK version from 0.2.4 to 0.2.5
- Update solana-streamer-sdk dependency from 0.1.3 to 0.1.4
- Enhance PumpSwap examples with pool address parameter support
This commit is contained in:
ysq
2025-07-25 16:55:33 +08:00
parent 7a05ec216c
commit 92bc7aecfa
4 changed files with 34 additions and 13 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "sol-trade-sdk"
version = "0.2.4"
version = "0.2.5"
edition = "2021"
authors = ["William <byteblock6@gmail.com>", "sgxiang <sgxiang@gmail.com>", "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"
+11 -4
View File
@@ -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?;
+11 -4
View File
@@ -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?;
+10 -3
View File
@@ -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(())