feat(swqos): add Glaive transaction sender

This commit is contained in:
0xfnzero
2026-07-18 23:20:57 +08:00
parent c76c8d6ac2
commit cf3bef0dd5
11 changed files with 940 additions and 23 deletions
+2
View File
@@ -6,6 +6,8 @@ Shows two client-construction patterns: `TradingClient::new` for one wallet and
This is a configuration template. Set `PRIVATE_KEY`, RPC, and every enabled provider credential; it initializes network clients but does not submit a trade.
The Glaive entry uses QUIC by default. Its credential must be a UUID v4 API key from Glaive. Replace the fourth argument with `Some(SwqosTransport::Http)` to use binary HTTP instead.
```bash
cargo run --package trading_client
```
+2
View File
@@ -6,6 +6,8 @@
这是配置模板。运行前设置 `PRIVATE_KEY`、RPC 和所有已启用服务商凭证;程序会初始化网络客户端,但不会提交交易。
Glaive 配置默认使用 QUIC,其凭证必须是 Glaive 提供的 UUID v4 API key。若要改用 binary HTTP,把第四个参数替换为 `Some(SwqosTransport::Http)`
```bash
cargo run --package trading_client
```
+14
View File
@@ -55,6 +55,20 @@ async fn create_trading_client_simple() -> AnyResult<TradingClient> {
), // QUICNone / Some(Binary) / Some(Plain) 为 HTTP
// Helius Sender: 4th param swqos_only Some(true) => min tip 0.000005 SOL; None => 0.0002 SOL
SwqosConfig::Helius("".to_string(), SwqosRegion::Default, None, Some(true)),
// Glaive defaults to persistent QUIC (UDP/4000). Use Some(Http) for binary HTTP.
SwqosConfig::Glaive(
"your_glaive_uuid_v4_api_key".to_string(),
SwqosRegion::Frankfurt,
None,
None,
),
// HTTP alternative:
// SwqosConfig::Glaive(
// "your_glaive_uuid_v4_api_key".to_string(),
// SwqosRegion::Frankfurt,
// None,
// Some(sol_trade_sdk::SwqosTransport::Http),
// ),
];
let trade_config = TradeConfig::builder(rpc_url, swqos_configs, commitment)