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

Commit

Permalink
feat(types/chain): is_legacy helper
Browse files Browse the repository at this point in the history
moving this into ethers-rs from foundry so it can be more easily use elsewhere
  • Loading branch information
tarrencev committed Jan 27, 2022
1 parent a97526d commit 4f47ccf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ethers-core/src/types/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,17 @@ 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 {
let chain = match self {
Ok(inner) => inner,
_ => return false,
};

// TODO: Add other chains which do not support EIP1559.
matches!(chain, Chain::Optimism | Chain::OptimismKovan | Chain::Fantom | Chain::FantomTestnet)
}
}

0 comments on commit 4f47ccf

Please sign in to comment.