feat: add global MEV protection and refactor TradeConfig to builder pattern

- Add `mev_protection: bool` to `TradeConfig` and `InfrastructureConfig` (default: false)
  - Astralane QUIC: switches to port 9000 (MEV-protected endpoint) when enabled
  - BlockRazor HTTP: uses `mode=sandwichMitigation` query param when enabled
  - BlockRazor gRPC: uses `mode=sandwichMitigation` when enabled
- Add `SWQOS_ENDPOINTS_ASTRALANE_QUIC_MEV` constants (port 9000) to `constants/swqos.rs`
- Fix `astralane_quic.rs` IP candidates to use the actual port from the address (supports both 7000 and 9000)
- Refactor `TradeConfig` to builder pattern via `TradeConfig::builder()`
  - Introduce `TradeConfigBuilder` with all optional fields and clear defaults
  - `TradeConfig::new()` kept as a shortcut (calls `builder().build()`) for backward compatibility
  - Remove old `with_wsol_ata_config` / `with_check_min_tip` / `with_swqos_cores_from_end` / `with_mev_protection` chain methods
- Update all 16 examples to use `TradeConfig::builder()` with commented-out options so users can discover all available settings at a glance
- Update README.md and README_CN.md code snippets to use builder pattern

🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
0xfnzero
2026-04-08 02:13:37 +08:00
parent 35bfa93516
commit 971ef41fad
44 changed files with 6783 additions and 74 deletions
+13
View File
@@ -323,6 +323,19 @@ pub const SWQOS_ENDPOINTS_ASTRALANE_QUIC: [&str; 8] = [
"lim.gateway.astralane.io:7000", // Default
];
/// Astralane QUIC MEV-protected endpoints (port 9000). Same region order as SWQOS_ENDPOINTS_ASTRALANE_QUIC.
/// Use these when mev_protection=true to route through Astralane's MEV-protected path.
pub const SWQOS_ENDPOINTS_ASTRALANE_QUIC_MEV: [&str; 8] = [
"ny.gateway.astralane.io:9000", // NewYork
"fr.gateway.astralane.io:9000", // Frankfurt
"ams.gateway.astralane.io:9000", // Amsterdam
"lim.gateway.astralane.io:9000", // SLC (no slc, use lim)
"sg.gateway.astralane.io:9000", // Tokyo (Asia)
"ams.gateway.astralane.io:9000", // London (Europe)
"la.gateway.astralane.io:9000", // LosAngeles
"lim.gateway.astralane.io:9000", // Default
];
pub const SWQOS_ENDPOINTS_STELLIUM: [&str; 8] = [
"http://ewr1.flashrpc.com",
"http://fra1.flashrpc.com",