feat: refactor seed optimization to global configuration in v3.2.0
- Remove open_seed_optimize parameter from TradeBuyParams and TradeSellParams structs - Add global use_seed_optimize configuration in TradeConfig with default value true - Add create_wsol_ata_on_startup configuration in TradeConfig with default value true - Implement automatic WSOL ATA creation and verification on SDK initialization - Add with_wsol_ata_config() builder method to TradeConfig for custom WSOL settings - Update all examples to remove open_seed_optimize parameter usage - Update documentation (README, TRADING_PARAMETERS) to reflect new configuration approach - Upgrade package version from 3.1.7 to 3.2.0 Breaking Changes: - open_seed_optimize parameter removed from trade parameters (now global setting) - Seed optimization is now enabled by default for all operations
This commit is contained in:
+11
-3
@@ -87,14 +87,14 @@ git clone https://github.com/0xfnzero/sol-trade-sdk
|
||||
|
||||
```toml
|
||||
# 添加到您的 Cargo.toml
|
||||
sol-trade-sdk = { path = "./sol-trade-sdk", version = "3.1.7" }
|
||||
sol-trade-sdk = { path = "./sol-trade-sdk", version = "3.2.0" }
|
||||
```
|
||||
|
||||
### 使用 crates.io
|
||||
|
||||
```toml
|
||||
# 添加到您的 Cargo.toml
|
||||
sol-trade-sdk = "3.1.7"
|
||||
sol-trade-sdk = "3.2.0"
|
||||
```
|
||||
|
||||
## 🛠️ 使用示例
|
||||
@@ -126,6 +126,14 @@ let swqos_configs: Vec<SwqosConfig> = vec![
|
||||
];
|
||||
// 创建 TradeConfig 实例
|
||||
let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment);
|
||||
|
||||
// 可选:自定义 WSOL ATA 和 Seed 优化设置
|
||||
// let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment)
|
||||
// .with_wsol_ata_config(
|
||||
// true, // create_wsol_ata_on_startup: 启动时检查并创建 WSOL ATA(默认: true)
|
||||
// true // use_seed_optimize: 全局启用所有 ATA 操作的 seed 优化(默认: true)
|
||||
// );
|
||||
|
||||
// 创建 SolanaTrade 客户端
|
||||
let client = SolanaTrade::new(Arc::new(payer), trade_config).await;
|
||||
```
|
||||
@@ -159,8 +167,8 @@ let buy_params = sol_trade_sdk::TradeBuyParams {
|
||||
create_input_token_ata: true,
|
||||
close_input_token_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
durable_nonce: None,
|
||||
// 注意:seed 优化现在在 TradeConfig 中全局配置
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user