feat(types/chain): is_legacy helper (#835)

moving this into ethers-rs from foundry so it can be more easily use elsewhere
This commit is contained in:
Tarrence van As 2022-01-27 10:33:01 -08:00 committed by GitHub
parent f434e0f57f
commit c22dd8eab4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -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
)
}
}