diff --git a/README.md b/README.md index 2625017..e308935 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,9 @@ let swqos_configs: Vec = vec![ SwqosConfig::Default(rpc_url.clone()), SwqosConfig::Jito("your uuid".to_string(), SwqosRegion::Frankfurt, None), SwqosConfig::Bloxroute("your api_token".to_string(), SwqosRegion::Frankfurt, None), - SwqosConfig::Astralane("your_astralane_api_key".to_string(), SwqosRegion::Frankfurt, None, Some(SwqosTransport::Quic)), + // Astralane: HTTP (4th param None) or QUIC (Some(SwqosTransport::Quic)); same API key + SwqosConfig::Astralane("your_astralane_api_key".to_string(), SwqosRegion::Frankfurt, None, None), // HTTP + SwqosConfig::Astralane("your_astralane_api_key".to_string(), SwqosRegion::Frankfurt, None, Some(SwqosTransport::Quic)), // QUIC ]; // Create TradeConfig instance let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment); diff --git a/README_CN.md b/README_CN.md index 367973e..4f97fa3 100755 --- a/README_CN.md +++ b/README_CN.md @@ -48,6 +48,7 @@ - [⚡ 交易参数](#-交易参数) - [📊 使用示例汇总表格](#-使用示例汇总表格) - [⚙️ SWQoS 服务配置说明](#️-swqos-服务配置说明) + - [Astralane QUIC(低延迟)](#astralane-quic低延迟) - [🔧 中间件系统说明](#-中间件系统说明) - [🔍 地址查找表](#-地址查找表) - [🔍 Nonce 缓存](#-nonce-缓存) @@ -119,6 +120,9 @@ let swqos_configs: Vec = vec![ SwqosConfig::Default(rpc_url.clone()), SwqosConfig::Jito("your uuid".to_string(), SwqosRegion::Frankfurt, None), SwqosConfig::Bloxroute("your api_token".to_string(), SwqosRegion::Frankfurt, None), + // Astralane:第4个参数 None 为 HTTP,Some(SwqosTransport::Quic) 为 QUIC;同一 API key + SwqosConfig::Astralane("your_astralane_api_key".to_string(), SwqosRegion::Frankfurt, None, None), // HTTP + SwqosConfig::Astralane("your_astralane_api_key".to_string(), SwqosRegion::Frankfurt, None, Some(SwqosTransport::Quic)), // QUIC ]; // 创建 TradeConfig 实例 let trade_config = TradeConfig::new(rpc_url, swqos_configs, commitment); @@ -256,6 +260,29 @@ let bloxroute_config = SwqosConfig::Bloxroute( 当使用多个MEV服务时,需要使用`Durable Nonce`。你需要使用`fetch_nonce_info`函数获取最新的`nonce`值,并在交易的时候将`durable_nonce`填入交易参数。 +#### Astralane QUIC(低延迟) + +Astralane 支持 **HTTP** 与 **QUIC** 两种传输方式。QUIC 可减少连接开销,降低提交延迟。使用 QUIC 时,将 `SwqosConfig::Astralane` 的第四个参数设为 `Some(SwqosTransport::Quic)`。Astralane 的 QUIC 服务使用**单一端点**(无分区域端点),选 QUIC 时 SDK 会忽略 `region` 与可选自定义 URL;为与其他 SWQoS 配置一致,可传入相同 region。 + +```rust +use sol_trade_sdk::{SwqosConfig, SwqosRegion, SwqosTransport}; + +// Astralane 使用 QUIC(低延迟);region 会被忽略(QUIC 单一端点) +let swqos_configs: Vec = vec![ + SwqosConfig::Default(rpc_url.clone()), + SwqosConfig::Astralane( + "your_astralane_api_key".to_string(), + SwqosRegion::Frankfurt, // 与其他服务一致即可;QUIC 时会被忽略 + None, + Some(SwqosTransport::Quic), + ), +]; +// 然后照常使用 swqos_configs 创建 TradeConfig / TradingClient +``` + +- **HTTP**(默认):第四个参数为 `None` 或 `Some(SwqosTransport::Http)`;region 与可选自定义 URL 生效。 +- **QUIC**:第四个参数为 `Some(SwqosTransport::Quic)`;SDK 使用单一 QUIC 端点并忽略 region。与 HTTP 使用同一 API key。 + --- ### 🔧 中间件系统说明 @@ -296,10 +323,10 @@ PumpFun 与 PumpSwap 支持**返现(Cashback)**:部分手续费可返还 - **ZeroSlot**: 零延迟交易 - **Temporal**: 时间敏感交易 - **Bloxroute**: 区块链网络加速 -- **FlashBlock**: 高速交易执行,支持 API 密钥认证 - [官方文档](https://doc.flashblock.trade/) -- **BlockRazor**: 高速交易执行,支持 API 密钥认证 - [官方文档](https://blockrazor.gitbook.io/blockrazor/) -- **Node1**: 高速交易执行,支持 API 密钥认证 - [官方文档](https://node1.me/docs.html) -- **Astralane**: 高速交易执行,支持 API 密钥认证 +- **FlashBlock**: 高速交易执行,支持 API 密钥认证 +- **BlockRazor**: 高速交易执行,支持 API 密钥认证 +- **Node1**: 高速交易执行,支持 API 密钥认证 +- **Astralane**: 区块链网络加速(支持 HTTP 与 QUIC,见上方 [Astralane QUIC](#astralane-quic低延迟)) ## 📁 项目结构