diff --git a/ethers-core/src/types/chain.rs b/ethers-core/src/types/chain.rs index 49fc1f81..4f70e107 100644 --- a/ethers-core/src/types/chain.rs +++ b/ethers-core/src/types/chain.rs @@ -116,3 +116,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 + ) + } +}