Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

feat(types/chain): is_legacy helper #835

Merged
merged 1 commit into from
Jan 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ethers-core/src/types/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}
}