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

feat(core): Utility to detect Shanghai-enabled chains #2431

Merged
merged 3 commits into from
May 25, 2023
Merged
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions ethers-core/src/types/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,13 @@ impl Chain {
}
}

pub const fn is_shanghai(&self) -> bool {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs docs, and I think we settled on supports_push0

#2430

match self {
Chain::Mainnet | Chain::Goerli | Chain::Sepolia => true,
_ => false,
}
}

/// Returns the chain's blockchain explorer and its API (Etherscan and Etherscan-like) URLs.
///
/// Returns `(API_URL, BASE_URL)`
Expand Down