Skip to content

Commit

Permalink
chore: correct bnb smart chain name
Browse files Browse the repository at this point in the history
  • Loading branch information
forcodedancing committed Sep 10, 2024
1 parent 1a9e492 commit dd1d95d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
12 changes: 12 additions & 0 deletions src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,18 @@ impl Chain {
Self::from_named(NamedChain::Dev)
}

/// Returns the bsc mainnet chain.
#[inline]
pub const fn bsc_mainnet() -> Self {
Self::from_named(NamedChain::BNBSmartChain)
}

/// Returns the bsc testnet chain.
#[inline]
pub const fn bsc_testnet() -> Self {
Self::from_named(NamedChain::BNBSmartChainTestnet)
}

/// Returns the opbnb mainnet chain.
#[inline]
pub const fn opbnb_mainnet() -> Self {
Expand Down
38 changes: 19 additions & 19 deletions src/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ pub enum NamedChain {
#[cfg_attr(feature = "serde", serde(alias = "koi"))]
Koi = 701,

#[strum(to_string = "bsc", serialize = "binance-smart-chain")]
#[cfg_attr(feature = "serde", serde(alias = "bsc", alias = "binance-smart-chain"))]
BinanceSmartChain = 56,
#[strum(to_string = "bsc-testnet", serialize = "binance-smart-chain-testnet")]
#[strum(to_string = "bsc", serialize = "bnb-smart-chain")]
#[cfg_attr(feature = "serde", serde(alias = "bsc", alias = "bnb-smart-chain"))]
BNBSmartChain = 56,
#[strum(to_string = "bsc-testnet", serialize = "bnb-smart-chain-testnet")]
#[cfg_attr(
feature = "serde",
serde(alias = "bsc_testnet", alias = "bsc-testnet", alias = "binance-smart-chain-testnet")
serde(alias = "bsc_testnet", alias = "bsc-testnet", alias = "bnb-smart-chain-testnet")
)]
BinanceSmartChainTestnet = 97,
BNBSmartChainTestnet = 97,

Poa = 99,
Sokol = 77,
Expand Down Expand Up @@ -510,7 +510,7 @@ impl NamedChain {
| C::Moonbeam
| C::Moonriver => 12_500,

C::BinanceSmartChain | C::BinanceSmartChainTestnet => 3_000,
C::BNBSmartChain | C::BNBSmartChainTestnet => 3_000,

C::Avalanche | C::AvalancheFuji => 2_000,

Expand Down Expand Up @@ -605,8 +605,8 @@ impl NamedChain {
| C::AcalaMandalaTestnet
| C::AcalaTestnet
| C::ArbitrumTestnet
| C::BinanceSmartChain
| C::BinanceSmartChainTestnet
| C::BNBSmartChain
| C::BNBSmartChainTestnet
| C::Boba
| C::Celo
| C::CeloAlfajores
Expand Down Expand Up @@ -822,7 +822,7 @@ impl NamedChain {
| C::BaseGoerli
| C::BaseSepolia
| C::BlastSepolia
| C::BinanceSmartChainTestnet
| C::BNBSmartChainTestnet
| C::CantoTestnet
| C::CronosTestnet
| C::CeloAlfajores
Expand Down Expand Up @@ -876,7 +876,7 @@ impl NamedChain {
| C::Syndr
| C::Cronos
| C::Rsk
| C::BinanceSmartChain
| C::BNBSmartChain
| C::Poa
| C::Sokol
| C::Scroll
Expand Down Expand Up @@ -949,8 +949,8 @@ impl NamedChain {

C::Xai | C::XaiSepolia => "XAI",

C::BinanceSmartChain
| C::BinanceSmartChainTestnet
C::BNBSmartChain
| C::BNBSmartChainTestnet
| C::OpBNBMainnet
| C::OpBNBTestnet => "BNB",

Expand Down Expand Up @@ -1054,8 +1054,8 @@ impl NamedChain {
("https://api-testnet.ftmscan.com/api", "https://testnet.ftmscan.com")
}

C::BinanceSmartChain => ("https://api.bscscan.com/api", "https://bscscan.com"),
C::BinanceSmartChainTestnet => {
C::BNBSmartChain => ("https://api.bscscan.com/api", "https://bscscan.com"),
C::BNBSmartChainTestnet => {
("https://api-testnet.bscscan.com/api", "https://testnet.bscscan.com")
}

Expand Down Expand Up @@ -1328,8 +1328,8 @@ impl NamedChain {
| C::OptimismGoerli
| C::OptimismKovan
| C::OptimismSepolia
| C::BinanceSmartChain
| C::BinanceSmartChainTestnet
| C::BNBSmartChain
| C::BNBSmartChainTestnet
| C::OpBNBMainnet
| C::OpBNBTestnet
| C::Arbitrum
Expand Down Expand Up @@ -1530,8 +1530,8 @@ mod tests {
// kebab-case
const ALIASES: &[(NamedChain, &[&str])] = &[
(Mainnet, &["ethlive"]),
(BinanceSmartChain, &["bsc", "binance-smart-chain"]),
(BinanceSmartChainTestnet, &["bsc-testnet", "binance-smart-chain-testnet"]),
(BNBSmartChain, &["bsc", "bnb-smart-chain"]),
(BNBSmartChainTestnet, &["bsc-testnet", "bnb-smart-chain-testnet"]),
(Gnosis, &["gnosis", "gnosis-chain"]),
(PolygonMumbai, &["mumbai"]),
(PolygonZkEvm, &["zkevm", "polygon-zkevm"]),
Expand Down

0 comments on commit dd1d95d

Please sign in to comment.