feat: v0.5.5 - enhanced priority fee system and dependency updates

- Update solana-streamer-sdk to 0.4.1
- Refactor priority fee API (custom_buy_tip_fee → custom_priority_fee)
- Simplify documentation and clean up examples

BREAKING CHANGE: priority fee parameter type changed
This commit is contained in:
ysq
2025-09-03 17:47:10 +08:00
parent 6f953ffa0d
commit db3b50fc28
13 changed files with 49 additions and 266 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "sol-trade-sdk"
version = "0.5.4"
version = "0.5.5"
edition = "2021"
authors = [
"William <byteblock6@gmail.com>",
@@ -32,7 +32,7 @@ members = [
crate-type = ["cdylib", "rlib"]
[dependencies]
solana-streamer-sdk = "0.3.10"
solana-streamer-sdk = "0.4.1"
solana-sdk = "2.3.0"
solana-client = "2.3.6"
solana-program = "2.3.0"
+18 -99
View File
@@ -33,14 +33,14 @@ Add the dependency to your `Cargo.toml`:
```toml
# Add to your Cargo.toml
sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.5.4" }
sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.5.5" }
```
### Use crates.io
```toml
# Add to your Cargo.toml
sol-trade-sdk = "0.5.4"
sol-trade-sdk = "0.5.5"
```
## Usage Examples
@@ -90,18 +90,22 @@ The `priority_fee` parameter is an optional `PriorityFee` that allows you to ove
When using shred to subscribe to events, due to the nature of shreds, you cannot get complete information about transaction events.
Please ensure that the parameters your trading logic depends on are available in shreds when using them.
### 1. Event Subscription - Monitor Token Trading
### Usage Examples Summary Table
See the example code in [examples/event_subscription](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/event_subscription/src/main.rs).
| Feature Type | Package Name | Description | Run Command | Source Code |
|-------------|--------------|-------------|-------------|-------------|
| Event Subscription | `event_subscription` | Monitor token trading events | `cargo run --package event_subscription` | [examples/event_subscription](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/event_subscription/src/main.rs) |
| Trading Client | `trading_client` | Create and configure SolanaTrade instance | `cargo run --package trading_client` | [examples/trading_client](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/trading_client/src/main.rs) |
| PumpFun Sniping | `pumpfun_sniper_trading` | PumpFun token sniping trading | `cargo run --package pumpfun_sniper_trading` | [examples/pumpfun_sniper_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/pumpfun_sniper_trading/src/main.rs) |
| PumpFun Copy Trading | `pumpfun_copy_trading` | PumpFun token copy trading | `cargo run --package pumpfun_copy_trading` | [examples/pumpfun_copy_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/pumpfun_copy_trading/src/main.rs) |
| PumpSwap | `pumpswap_trading` | PumpSwap trading operations | `cargo run --package pumpswap_trading` | [examples/pumpswap_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/pumpswap_trading/src/main.rs) |
| Raydium CPMM | `raydium_cpmm_trading` | Raydium CPMM trading operations | `cargo run --package raydium_cpmm_trading` | [examples/raydium_cpmm_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/raydium_cpmm_trading/src/main.rs) |
| Raydium AMM V4 | `raydium_amm_v4_trading` | Raydium AMM V4 trading operations | `cargo run --package raydium_amm_v4_trading` | [examples/raydium_amm_v4_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/raydium_amm_v4_trading/src/main.rs) |
| Bonk Sniping | `bonk_sniper_trading` | Bonk token sniping trading | `cargo run --package bonk_sniper_trading` | [examples/bonk_sniper_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/bonk_sniper_trading/src/main.rs) |
| Bonk Copy Trading | `bonk_copy_trading` | Bonk token copy trading | `cargo run --package bonk_copy_trading` | [examples/bonk_copy_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/bonk_copy_trading/src/main.rs) |
| Middleware System | `middleware_system` | Custom instruction middleware example | `cargo run --package middleware_system` | [examples/middleware_system](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/middleware_system/src/main.rs) |
Run the example code:
```bash
cargo run --package event_subscription
```
### 2. Initialize SolanaTrade Instance
#### 2.1 SWQOS Service Configuration
### SWQOS Service Configuration
When configuring SWQOS services, note the different parameter requirements for each service:
@@ -115,94 +119,9 @@ When configuring SWQOS services, note the different parameter requirements for e
When using multiple MEV services, you need to use `Durable Nonce`. You need to initialize a `NonceCache` class (or write your own nonce management class), get the latest `nonce` value, and use it as the `blockhash` when trading.
#### 2.2 Creating SolanaTrade Instance
### Middleware System Explanation
See the example code in [examples/trading_client](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/trading_client/src/main.rs).
Run the example code:
```bash
cargo run --package trading_client
```
### 3. PumpFun Trading Operations
#### 3.1 Sniping
See the example code in [examples/pumpfun_sniper_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/pumpfun_sniper_trading/src/main.rs).
Run the example code:
```bash
cargo run --package pumpfun_sniper_trading
```
#### 3.2 Copy Trading
See the example code in [examples/pumpfun_copy_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/pumpfun_copy_trading/src/main.rs).
Run the example code:
```bash
cargo run --package pumpfun_copy_trading
```
### 4. PumpSwap Trading Operations
See the example code in [examples/pumpswap_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/pumpswap_trading/src/main.rs).
Run the example code:
```bash
cargo run --package pumpswap_trading
```
### 5. Raydium CPMM Trading Operations
See the example code in [examples/raydium_cpmm_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/raydium_cpmm_trading/src/main.rs).
Run the example code:
```bash
cargo run --package raydium_cpmm_trading
```
### 6. Raydium AMM V4 Trading Operations
See the example code in [examples/raydium_amm_v4_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/raydium_amm_v4_trading/src/main.rs).
Run the example code:
```bash
cargo run --package raydium_amm_v4_trading
```
### 7. Bonk Trading Operations
#### 7.1 Sniping
See the example code in [examples/bonk_sniper_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/bonk_sniper_trading/src/main.rs).
Run the example code:
```bash
cargo run --package bonk_sniper_trading
```
#### 7.2 Copy Trading
See the example code in [examples/bonk_copy_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/bonk_copy_trading/src/main.rs).
Run the example code:
```bash
cargo run --package bonk_copy_trading
```
### 8. Middleware System
The SDK provides a powerful middleware system that allows you to modify, add, or remove instructions before transaction execution. This gives you tremendous flexibility to customize trading behavior.
See the example code in [examples/middleware_system](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/middleware_system/src/main.rs).
Run the example code:
```bash
cargo run --package middleware_system
```
Middleware executes in the order they are added:
The SDK provides a powerful middleware system that allows you to modify, add, or remove instructions before transaction execution. Middleware executes in the order they are added:
```rust
let middleware_manager = MiddlewareManager::new()
+18 -100
View File
@@ -33,14 +33,14 @@ git clone https://github.com/0xfnzero/sol-trade-sdk
```toml
# 添加到您的 Cargo.toml
sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.5.4" }
sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.5.5" }
```
### 使用 crates.io
```toml
# 添加到您的 Cargo.toml
sol-trade-sdk = "0.5.4"
sol-trade-sdk = "0.5.5"
```
## 使用示例
@@ -90,18 +90,22 @@ sol-trade-sdk = "0.5.4"
当你使用 shred 订阅事件时,由于 shred 的特性,你无法获取到交易事件的完整信息。
请你在使用时,确保你的交易逻辑依赖的参数,在shred中都能获取到。
### 1. 事件订阅 - 监听代币交易
### 使用示例汇总表格
查看[examples/event_subscription](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/event_subscription/src/main.rs) 中的示例代码。
| 功能类型 | 示例包名 | 描述 | 运行命令 | 源码路径 |
|---------|---------|------|---------|----------|
| 事件订阅 | `event_subscription` | 监听代币交易事件 | `cargo run --package event_subscription` | [examples/event_subscription](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/event_subscription/src/main.rs) |
| 交易客户端 | `trading_client` | 创建和配置 SolanaTrade 实例 | `cargo run --package trading_client` | [examples/trading_client](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/trading_client/src/main.rs) |
| PumpFun 狙击 | `pumpfun_sniper_trading` | PumpFun 代币狙击交易 | `cargo run --package pumpfun_sniper_trading` | [examples/pumpfun_sniper_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/pumpfun_sniper_trading/src/main.rs) |
| PumpFun 跟单 | `pumpfun_copy_trading` | PumpFun 代币跟单交易 | `cargo run --package pumpfun_copy_trading` | [examples/pumpfun_copy_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/pumpfun_copy_trading/src/main.rs) |
| PumpSwap | `pumpswap_trading` | PumpSwap 交易操作 | `cargo run --package pumpswap_trading` | [examples/pumpswap_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/pumpswap_trading/src/main.rs) |
| Raydium CPMM | `raydium_cpmm_trading` | Raydium CPMM 交易操作 | `cargo run --package raydium_cpmm_trading` | [examples/raydium_cpmm_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/raydium_cpmm_trading/src/main.rs) |
| Raydium AMM V4 | `raydium_amm_v4_trading` | Raydium AMM V4 交易操作 | `cargo run --package raydium_amm_v4_trading` | [examples/raydium_amm_v4_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/raydium_amm_v4_trading/src/main.rs) |
| Bonk 狙击 | `bonk_sniper_trading` | Bonk 代币狙击交易 | `cargo run --package bonk_sniper_trading` | [examples/bonk_sniper_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/bonk_sniper_trading/src/main.rs) |
| Bonk 跟单 | `bonk_copy_trading` | Bonk 代币跟单交易 | `cargo run --package bonk_copy_trading` | [examples/bonk_copy_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/bonk_copy_trading/src/main.rs) |
| 中间件系统 | `middleware_system` | 自定义指令中间件示例 | `cargo run --package middleware_system` | [examples/middleware_system](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/middleware_system/src/main.rs) |
运行示例代码:
```bash
cargo run --package event_subscription
```
### 2. 初始化 SolanaTrade 实例
#### 2.1 SWQOS 服务配置说明
### SWQOS 服务配置说明
在配置 SWQOS 服务时,需要注意不同服务的参数要求:
@@ -115,95 +119,9 @@ cargo run --package event_subscription
当使用多个MEV服务时,需要使用`Durable Nonce`。你需要初始化`NonceCache`类(或者自行写一个管理nonce的类),获取最新的`nonce`值,并在交易的时候作为`blockhash`使用。
#### 2.2 创建 SolanaTrade 实例
### 中间件系统说明
查看[examples/trading_client](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/trading_client/src/main.rs) 中的示例代码。
运行示例代码:
```bash
cargo run --package trading_client
```
### 3. PumpFun 交易操作
#### 3.1 狙击
查看[examples/pumpfun_sniper_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/pumpfun_sniper_trading/src/main.rs) 中的示例代码。
运行示例代码:
```bash
cargo run --package pumpfun_sniper_trading
```
#### 3.2 跟单
查看[examples/pumpfun_copy_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/pumpfun_copy_trading/src/main.rs) 中的示例代码。
运行示例代码:
```bash
cargo run --package pumpfun_copy_trading
```
### 4. PumpSwap 交易操作
查看[examples/pumpswap_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/pumpswap_trading/src/main.rs) 中的示例代码。
运行示例代码:
```bash
cargo run --package pumpswap_trading
```
### 5. Raydium CPMM 交易操作
查看[examples/raydium_cpmm_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/raydium_cpmm_trading/src/main.rs) 中的示例代码。
运行示例代码:
```bash
cargo run --package raydium_cpmm_trading
```
### 6. Raydium AMM V4 交易操作
查看[examples/raydium_amm_v4_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/raydium_amm_v4_trading/src/main.rs) 中的示例代码。
运行示例代码:
```bash
cargo run --package raydium_amm_v4_trading
```
### 7. Bonk 交易操作
#### 7.1 狙击
查看[examples/bonk_sniper_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/bonk_sniper_trading/src/main.rs) 中的示例代码。
运行示例代码:
```bash
cargo run --package bonk_sniper_trading
```
#### 7.2 跟单
查看[examples/bonk_copy_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/bonk_copy_trading/src/main.rs) 中的示例代码。
运行示例代码:
```bash
cargo run --package bonk_copy_trading
```
### 8. 中间件系统
SDK 提供了强大的中间件系统,允许您在交易执行前对指令进行修改、添加或移除。这为您提供了极大的灵活性来自定义交易行为。
查看[examples/middleware_system](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/middleware_system/src/main.rs) 中的示例代码。
运行示例代码:
```bash
cargo run --package middleware_system
```
中间件按照添加顺序依次执行:
SDK 提供了强大的中间件系统,允许您在交易执行前对指令进行修改、添加或移除。中间件按照添加顺序依次执行:
```rust
let middleware_manager = MiddlewareManager::new()
-2
View File
@@ -152,7 +152,6 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()>
Box::new(BonkParams::from_trade(trade_info.clone())),
None,
true,
None,
)
.await?;
@@ -179,7 +178,6 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()>
Box::new(BonkParams::from_trade(trade_info.clone())),
None,
true,
None,
)
.await?;
-2
View File
@@ -121,7 +121,6 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult<
Box::new(BonkParams::from_dev_trade(trade_info.clone())),
None,
true,
None,
)
.await?;
@@ -153,7 +152,6 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult<
)),
None,
true,
None,
)
.await?;
-1
View File
@@ -103,7 +103,6 @@ async fn test_middleware() -> AnyResult<()> {
Box::new(PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool_address).await?),
None,
true,
None,
)
.await?;
println!("tip: This transaction will not succeed because we're using a test account. You can modify the code to initialize the payer with your own private key");
@@ -146,7 +146,6 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
Box::new(PumpFunParams::from_trade(&trade_info, None)),
None,
true,
None,
)
.await?;
@@ -173,7 +172,6 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
Box::new(PumpFunParams::from_trade(&trade_info, Some(true))),
None,
true,
None,
)
.await?;
@@ -114,7 +114,6 @@ async fn pumpfun_sniper_trade_with_shreds(trade_info: PumpFunTradeEvent) -> AnyR
Box::new(PumpFunParams::from_dev_trade(&trade_info, None)),
None,
true,
None,
)
.await?;
@@ -141,7 +140,6 @@ async fn pumpfun_sniper_trade_with_shreds(trade_info: PumpFunTradeEvent) -> AnyR
Box::new(PumpFunParams::immediate_sell(trade_info.creator_vault, true)),
None,
true,
None,
)
.await?;
-2
View File
@@ -188,7 +188,6 @@ async fn pumpswap_trade_with_grpc(mint_pubkey: Pubkey, params: PumpSwapParams) -
Box::new(params.clone()),
None,
true,
None,
)
.await?;
@@ -217,7 +216,6 @@ async fn pumpswap_trade_with_grpc(mint_pubkey: Pubkey, params: PumpSwapParams) -
Box::new(params.clone()),
None,
true,
None,
)
.await?;
@@ -161,7 +161,6 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent)
Box::new(params),
None,
true,
None,
)
.await?;
@@ -189,7 +188,6 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent)
Box::new(params),
None,
true,
None,
)
.await?;
@@ -162,7 +162,6 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) ->
Box::new(buy_params),
None,
true,
None,
)
.await?;
@@ -192,7 +191,6 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) ->
Box::new(sell_params),
None,
true,
None,
)
.await?;
+11 -33
View File
@@ -132,7 +132,7 @@ impl SolanaTrade {
/// * `sol_amount` - Amount of SOL to spend on the purchase (in lamports)
/// * `slippage_basis_points` - Optional slippage tolerance in basis points (e.g., 100 = 1%)
/// * `recent_blockhash` - Recent blockhash for transaction validity
/// * `custom_buy_tip_fee` - Optional custom tip fee for priority processing (in SOL)
/// * `custom_priority_fee` - Optional custom priority fee for priority processing
/// * `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
@@ -155,11 +155,10 @@ impl SolanaTrade {
sol_amount: u64,
slippage_basis_points: Option<u64>,
recent_blockhash: Hash,
custom_buy_tip_fee: Option<f64>,
custom_priority_fee: Option<PriorityFee>,
extension_params: Box<dyn ProtocolParams>,
lookup_table_key: Option<Pubkey>,
wait_transaction_confirmed: bool,
priority_fee: Option<PriorityFee>,
) -> Result<(), anyhow::Error> {
let executor = TradeFactory::create_executor(dex_type.clone());
let protocol_params = extension_params;
@@ -179,8 +178,8 @@ impl SolanaTrade {
wait_transaction_confirmed: wait_transaction_confirmed,
protocol_params: protocol_params.clone(),
};
if priority_fee.is_some() {
let mut custom_priority_fee = priority_fee.unwrap();
if custom_priority_fee.is_some() {
let mut custom_priority_fee = custom_priority_fee.unwrap();
// Fill the array, only fill the missing elements
if custom_priority_fee.buy_tip_fees.len() < self.swqos_clients.len() {
let mut buy_tip_fees = custom_priority_fee.buy_tip_fees.clone();
@@ -196,15 +195,6 @@ impl SolanaTrade {
}
buy_params.priority_fee = custom_priority_fee;
}
if custom_buy_tip_fee.is_some() {
buy_params.priority_fee.buy_tip_fee = custom_buy_tip_fee.unwrap();
buy_params.priority_fee.buy_tip_fees = buy_params
.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());
// Validate protocol params
@@ -238,7 +228,7 @@ impl SolanaTrade {
/// * `token_amount` - Amount of tokens to sell (in smallest token units)
/// * `slippage_basis_points` - Optional slippage tolerance in basis points (e.g., 100 = 1%)
/// * `recent_blockhash` - Recent blockhash for transaction validity
/// * `custom_buy_tip_fee` - Optional custom tip fee for priority processing (in SOL)
/// * `custom_priority_fee` - Optional custom priority fee for priority processing
/// * `with_tip` - Optional boolean to indicate if the transaction should be sent with tip
/// * `extension_params` - Optional protocol-specific parameters (uses defaults if None)
/// * `lookup_table_key` - Optional address lookup table key for transaction optimization
@@ -263,12 +253,11 @@ impl SolanaTrade {
token_amount: u64,
slippage_basis_points: Option<u64>,
recent_blockhash: Hash,
custom_buy_tip_fee: Option<f64>,
custom_priority_fee: Option<PriorityFee>,
with_tip: bool,
extension_params: Box<dyn ProtocolParams>,
lookup_table_key: Option<Pubkey>,
wait_transaction_confirmed: bool,
priority_fee: Option<PriorityFee>,
) -> Result<(), anyhow::Error> {
let executor = TradeFactory::create_executor(dex_type.clone());
let protocol_params = extension_params;
@@ -287,8 +276,8 @@ impl SolanaTrade {
wait_transaction_confirmed: wait_transaction_confirmed,
protocol_params: protocol_params.clone(),
};
if priority_fee.is_some() {
let mut custom_priority_fee = priority_fee.unwrap();
if custom_priority_fee.is_some() {
let mut custom_priority_fee = custom_priority_fee.unwrap();
// Fill the array, only fill the missing elements
if custom_priority_fee.buy_tip_fees.len() < self.swqos_clients.len() {
let mut buy_tip_fees = custom_priority_fee.buy_tip_fees.clone();
@@ -304,15 +293,6 @@ impl SolanaTrade {
}
sell_params.priority_fee = custom_priority_fee;
}
if custom_buy_tip_fee.is_some() {
sell_params.priority_fee.buy_tip_fee = custom_buy_tip_fee.unwrap();
sell_params.priority_fee.buy_tip_fees = sell_params
.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());
// Validate protocol params
@@ -355,7 +335,7 @@ impl SolanaTrade {
/// * `percent` - Percentage of tokens to sell (1-100, where 100 = 100%)
/// * `slippage_basis_points` - Optional slippage tolerance in basis points (e.g., 100 = 1%)
/// * `recent_blockhash` - Recent blockhash for transaction validity
/// * `custom_buy_tip_fee` - Optional custom tip fee for priority processing (in SOL)
/// * `custom_priority_fee` - Optional custom priority fee for priority processing
/// * `with_tip` - Whether to use tip for priority processing
/// * `extension_params` - Optional protocol-specific parameters (uses defaults if None)
/// * `lookup_table_key` - Optional lookup table key for address lookup optimization
@@ -382,12 +362,11 @@ impl SolanaTrade {
percent: u64,
slippage_basis_points: Option<u64>,
recent_blockhash: Hash,
custom_buy_tip_fee: Option<f64>,
custom_priority_fee: Option<PriorityFee>,
with_tip: bool,
extension_params: Box<dyn ProtocolParams>,
lookup_table_key: Option<Pubkey>,
wait_transaction_confirmed: bool,
priority_fee: Option<PriorityFee>,
) -> Result<(), anyhow::Error> {
if percent == 0 || percent > 100 {
return Err(anyhow::anyhow!("Percentage must be between 1 and 100"));
@@ -399,12 +378,11 @@ impl SolanaTrade {
amount,
slippage_basis_points,
recent_blockhash,
custom_buy_tip_fee,
custom_priority_fee,
with_tip,
extension_params,
lookup_table_key,
wait_transaction_confirmed,
priority_fee,
)
.await
}
-17
View File
@@ -120,7 +120,6 @@ async fn test_middleware() -> AnyResult<()> {
Box::new(PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool_address).await?),
None,
true,
None,
)
.await?;
Ok(())
@@ -148,7 +147,6 @@ async fn test_pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> Any
Box::new(PumpFunParams::from_trade(&trade_info, None)),
None,
true,
None,
)
.await?;
@@ -167,7 +165,6 @@ async fn test_pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> Any
Box::new(PumpFunParams::from_trade(&trade_info, None)),
None,
true,
None,
)
.await?;
@@ -200,7 +197,6 @@ async fn test_pumpfun_sniper_trade_with_shreds(trade_info: PumpFunTradeEvent) ->
Box::new(PumpFunParams::from_trade(&trade_info, None)),
None,
true,
None,
)
.await?;
@@ -219,7 +215,6 @@ async fn test_pumpfun_sniper_trade_with_shreds(trade_info: PumpFunTradeEvent) ->
Box::new(PumpFunParams::from_trade(&trade_info, None)),
None,
true,
None,
)
.await?;
@@ -250,7 +245,6 @@ async fn test_pumpswap() -> AnyResult<()> {
Box::new(PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool_address).await?),
None,
true,
None,
)
.await?;
@@ -270,7 +264,6 @@ async fn test_pumpswap() -> AnyResult<()> {
Box::new(PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool_address).await?),
None,
true,
None,
)
.await?;
@@ -299,7 +292,6 @@ async fn test_bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult
Box::new(BonkParams::from_trade(trade_info.clone())),
None,
true,
None,
)
.await?;
@@ -318,7 +310,6 @@ async fn test_bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult
Box::new(BonkParams::from_trade(trade_info)),
None,
true,
None,
)
.await?;
@@ -351,7 +342,6 @@ async fn test_bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyRe
Box::new(BonkParams::from_dev_trade(trade_info.clone())),
None,
true,
None,
)
.await?;
@@ -370,7 +360,6 @@ async fn test_bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyRe
Box::new(BonkParams::from_dev_trade(trade_info)),
None,
true,
None,
)
.await?;
@@ -400,7 +389,6 @@ async fn test_bonk() -> Result<(), Box<dyn std::error::Error>> {
Box::new(BonkParams::from_mint_by_rpc(&client.rpc, &mint_pubkey).await?),
None,
true,
None,
)
.await?;
@@ -420,7 +408,6 @@ async fn test_bonk() -> Result<(), Box<dyn std::error::Error>> {
Box::new(BonkParams::from_mint_by_rpc(&client.rpc, &mint_pubkey).await?),
None,
true,
None,
)
.await?;
@@ -452,7 +439,6 @@ async fn test_raydium_cpmm() -> Result<(), Box<dyn std::error::Error>> {
),
None,
true,
None,
)
.await?;
@@ -474,7 +460,6 @@ async fn test_raydium_cpmm() -> Result<(), Box<dyn std::error::Error>> {
),
None,
true,
None,
)
.await?;
@@ -504,7 +489,6 @@ async fn test_raydium_amm_v4() -> Result<(), Box<dyn std::error::Error>> {
Box::new(RaydiumAmmV4Params::from_amm_address_by_rpc(&client.rpc, amm_address).await?),
None,
true,
None,
)
.await?;
@@ -524,7 +508,6 @@ async fn test_raydium_amm_v4() -> Result<(), Box<dyn std::error::Error>> {
Box::new(RaydiumAmmV4Params::from_amm_address_by_rpc(&client.rpc, amm_address).await?),
None,
true,
None,
)
.await?;