Skip to content

Commit

Permalink
feat: add base sepolia (#24)
Browse files Browse the repository at this point in the history
add base sepolia https://docs.base.org/using-base/

---------

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
  • Loading branch information
zsluedem and mattsse authored Dec 29, 2023
1 parent 2f9b58d commit 6ae3497
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions assets/chains.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,12 @@ impl Chain {
Self::from_named(NamedChain::BaseGoerli)
}

/// Returns the base sepolia chain.
#[inline]
pub const fn base_sepolia() -> Self {
Self::from_named(NamedChain::BaseSepolia)
}

/// Returns the base mainnet chain.
#[inline]
pub const fn base_mainnet() -> Self {
Expand Down Expand Up @@ -322,6 +328,7 @@ impl Chain {
| NamedChain::OptimismSepolia
| NamedChain::Base
| NamedChain::BaseGoerli
| NamedChain::BaseSepolia
)
)
}
Expand Down
9 changes: 9 additions & 0 deletions src/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ pub enum NamedChain {

Base = 8453,
BaseGoerli = 84531,
BaseSepolia = 84532,

Linea = 59144,
LineaTestnet = 59140,
Expand Down Expand Up @@ -314,6 +315,7 @@ impl NamedChain {
| C::OptimismSepolia
| C::Base
| C::BaseGoerli
| C::BaseSepolia
| C::Zora
| C::ZoraGoerli
| C::ZoraSepolia => 2_000,
Expand Down Expand Up @@ -421,6 +423,7 @@ impl NamedChain {
| C::Holesky
| C::Base
| C::BaseGoerli
| C::BaseSepolia
| C::Optimism
| C::OptimismGoerli
| C::OptimismSepolia
Expand Down Expand Up @@ -480,6 +483,7 @@ impl NamedChain {
| C::OptimismGoerli
| C::OptimismSepolia
| C::BaseGoerli
| C::BaseSepolia
| C::Gnosis
| C::Chiado
| C::ZoraSepolia
Expand Down Expand Up @@ -516,6 +520,7 @@ impl NamedChain {
| C::AuroraTestnet
| C::AvalancheFuji
| C::BaseGoerli
| C::BaseSepolia
| C::BinanceSmartChainTestnet
| C::CantoTestnet
| C::CronosTestnet
Expand Down Expand Up @@ -770,6 +775,9 @@ impl NamedChain {

C::Base => ("https://api.basescan.org/api", "https://basescan.org"),
C::BaseGoerli => ("https://api-goerli.basescan.org/api", "https://goerli.basescan.org"),
C::BaseSepolia => {
("https://api-sepolia.basescan.org/api", "https://sepolia.basescan.org")
}

C::ZkSync => {
("https://zksync2-mainnet-explorer.zksync.io", "https://explorer.zksync.io")
Expand Down Expand Up @@ -846,6 +854,7 @@ impl NamedChain {
| C::Mantle
| C::MantleTestnet
| C::BaseGoerli
| C::BaseSepolia
| C::Gnosis
| C::Scroll
| C::ScrollSepolia => "ETHERSCAN_API_KEY",
Expand Down

0 comments on commit 6ae3497

Please sign in to comment.