From 1b88bdfb0c9da3067b68528355c8d7cab4948bff Mon Sep 17 00:00:00 2001 From: MyTH-zyxeon Date: Thu, 21 May 2026 02:27:55 +0900 Subject: [PATCH] fix: reject unsupported UniswapX chains --- README.md | 2 ++ src/intents/types.rs | 2 +- src/intents/uniswapx.rs | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 36a42fd..2321a91 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,8 @@ cargo run -- monitor | Across | 📋 Planned | Multi-chain | | CoW Protocol | 📋 Planned | Ethereum | +UniswapX rejects unsupported chains instead of falling back to mainnet. + ## Revenue Model Solvers earn fees from filling intents: diff --git a/src/intents/types.rs b/src/intents/types.rs index 371e953..fec8fed 100644 --- a/src/intents/types.rs +++ b/src/intents/types.rs @@ -46,7 +46,7 @@ mod tests { use super::Chain; #[test] - fn unichain_id_round_trips() { + fn unichain_round_trips_chain_id() { assert_eq!(Chain::Unichain.chain_id(), 130); assert_eq!(Chain::from_id(130), Some(Chain::Unichain)); } diff --git a/src/intents/uniswapx.rs b/src/intents/uniswapx.rs index 4d2fcf9..f85850a 100644 --- a/src/intents/uniswapx.rs +++ b/src/intents/uniswapx.rs @@ -13,7 +13,7 @@ fn api_url(chain: Chain) -> Result<&'static str> { Chain::Ethereum => Ok("https://api.uniswap.org/v2/orders?orderStatus=open&chainId=1"), Chain::Arbitrum => Ok("https://api.uniswap.org/v2/orders?orderStatus=open&chainId=42161"), Chain::Base => Ok("https://api.uniswap.org/v2/orders?orderStatus=open&chainId=8453"), - Chain::Optimism | Chain::Polygon | Chain::Unichain => Err(unsupported_chain_error(chain)), + _ => Err(unsupported_chain_error(chain)), } } @@ -212,7 +212,7 @@ mod tests { } #[test] - fn api_url_uses_explicit_supported_chains() { + fn supported_chains_use_chain_specific_urls() { assert_eq!( api_url(Chain::Ethereum).unwrap(), "https://api.uniswap.org/v2/orders?orderStatus=open&chainId=1" @@ -228,7 +228,7 @@ mod tests { } #[test] - fn decoder_rejects_unsupported_uniswapx_chains() { + fn unsupported_chains_do_not_fall_back_to_mainnet() { for chain in [Chain::Optimism, Chain::Polygon, Chain::Unichain] { let err = expect_error(chain); assert_eq!(