diff --git a/ethers-core/src/types/chain.rs b/ethers-core/src/types/chain.rs index 6bcbdd560..9bbb16d2b 100644 --- a/ethers-core/src/types/chain.rs +++ b/ethers-core/src/types/chain.rs @@ -110,3 +110,15 @@ impl FromStr for Chain { }) } } + +impl Chain { + /// Helper function for checking if a chainid corresponds to a legacy chainid + /// without eip1559 + pub fn is_legacy(&self) -> bool { + // TODO: Add other chains which do not support EIP1559. + matches!( + self, + Chain::Optimism | Chain::OptimismKovan | Chain::Fantom | Chain::FantomTestnet + ) + } +}