feat: Upgrade SDK version to 0.2.4 and optimize tip fee setting logic

- Upgrade SDK version from 0.2.3 to 0.2.4
- Update solana-streamer-sdk dependency to version 0.1.3
- Optimize buy_tip_fees setting logic using map function instead of hardcoded array
- Update version numbers in README documentation
This commit is contained in:
ysq
2025-07-24 21:38:22 +08:00
parent 4f4edbf00a
commit 7a05ec216c
5 changed files with 19 additions and 21 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "sol-trade-sdk"
version = "0.2.3"
version = "0.2.4"
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.2"
solana-streamer-sdk = "0.1.3"
solana-sdk = "2.1.16"
solana-client = "2.1.16"
solana-program = "2.1.16"
+3 -3
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.3" }
sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.2.4" }
```
### Use crates.io
```toml
# Add to your Cargo.toml
sol-trade-sdk = "0.2.3"
sol-trade-sdk = "0.2.4"
```
## Usage Examples
@@ -127,7 +127,7 @@ async fn test_grpc() -> Result<(), Box<dyn std::error::Error>> {
// Subscribe to events from multiple protocols
println!("Starting to listen for events, press Ctrl+C to stop...");
let protocols = vec![Protocol::PumpFun, Protocol::PumpSwap, Protocol::Bonk, Protocol::RaydiumCpmm];
grpc.subscribe_events(protocols, None, None, None, callback)
grpc.subscribe_events(protocols, None, None, None, None, None, callback)
.await?;
Ok(())
+3 -3
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.3" }
sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.2.4" }
```
### 使用 crates.io
```toml
# 添加到您的 Cargo.toml
sol-trade-sdk = "0.2.3"
sol-trade-sdk = "0.2.4"
```
## 使用示例
@@ -127,7 +127,7 @@ async fn test_grpc() -> Result<(), Box<dyn std::error::Error>> {
// 订阅多个协议的事件
println!("开始监听事件,按 Ctrl+C 停止...");
let protocols = vec![Protocol::PumpFun, Protocol::PumpSwap, Protocol::Bonk, Protocol::RaydiumCpmm];
grpc.subscribe_events(protocols, None, None, None, callback)
grpc.subscribe_events(protocols, None, None, None, None, None, callback)
.await?;
Ok(())
+10 -12
View File
@@ -204,12 +204,11 @@ impl SolanaTrade {
let mut priority_fee = buy_params.priority_fee.clone();
if custom_buy_tip_fee.is_some() {
priority_fee.buy_tip_fee = custom_buy_tip_fee.unwrap();
priority_fee.buy_tip_fees = vec![
custom_buy_tip_fee.unwrap(),
custom_buy_tip_fee.unwrap(),
custom_buy_tip_fee.unwrap(),
custom_buy_tip_fee.unwrap(),
];
priority_fee.buy_tip_fees = priority_fee
.buy_tip_fees
.iter()
.map(|_| custom_buy_tip_fee.unwrap())
.collect();
}
let buy_with_tip_params = buy_params.clone().with_tip(self.swqos_clients.clone());
@@ -328,12 +327,11 @@ impl SolanaTrade {
let mut priority_fee = sell_params.priority_fee.clone();
if custom_buy_tip_fee.is_some() {
priority_fee.buy_tip_fee = custom_buy_tip_fee.unwrap();
priority_fee.buy_tip_fees = vec![
custom_buy_tip_fee.unwrap(),
custom_buy_tip_fee.unwrap(),
custom_buy_tip_fee.unwrap(),
custom_buy_tip_fee.unwrap(),
];
priority_fee.buy_tip_fees = priority_fee
.buy_tip_fees
.iter()
.map(|_| custom_buy_tip_fee.unwrap())
.collect();
}
let sell_with_tip_params = sell_params.clone().with_tip(self.swqos_clients.clone());
+1 -1
View File
@@ -399,7 +399,7 @@ async fn test_grpc() -> Result<(), Box<dyn std::error::Error>> {
let protocols = vec![Protocol::PumpFun, Protocol::PumpSwap, Protocol::Bonk, Protocol::RaydiumCpmm];
println!("开始监听事件,按 Ctrl+C 停止...");
grpc.subscribe_events(protocols, None, None, None, callback).await?;
grpc.subscribe_events(protocols, None, None, None, None, None, callback).await?;
Ok(())
}