Skip to content

Commit

Permalink
chore: unify etherscan url format (#23)
Browse files Browse the repository at this point in the history
no trailing `/` on all etherscan urls
  • Loading branch information
mattsse authored Dec 23, 2023
1 parent c31bcfe commit 4edcc71
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 41 deletions.
36 changes: 18 additions & 18 deletions assets/chains.json

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

53 changes: 30 additions & 23 deletions src/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,8 @@ impl NamedChain {
///
/// Returns `(API_URL, BASE_URL)`.
///
/// All URLs have no trailing `/`
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -670,19 +672,15 @@ impl NamedChain {
C::ArbitrumSepolia => {
("https://api-sepolia.arbiscan.io/api", "https://sepolia.arbiscan.io")
}
C::ArbitrumNova => ("https://api-nova.arbiscan.io/api", "https://nova.arbiscan.io/"),
C::ArbitrumNova => ("https://api-nova.arbiscan.io/api", "https://nova.arbiscan.io"),

C::Cronos => ("https://api.cronoscan.com/api", "https://cronoscan.com"),
C::CronosTestnet => {
("https://api-testnet.cronoscan.com/api", "https://testnet.cronoscan.com")
}

C::Moonbeam => {
("https://api-moonbeam.moonscan.io/api", "https://moonbeam.moonscan.io/")
}
C::Moonbase => {
("https://api-moonbase.moonscan.io/api", "https://moonbase.moonscan.io/")
}
C::Moonbeam => ("https://api-moonbeam.moonscan.io/api", "https://moonbeam.moonscan.io"),
C::Moonbase => ("https://api-moonbase.moonscan.io/api", "https://moonbase.moonscan.io"),
C::Moonriver => {
("https://api-moonriver.moonscan.io/api", "https://moonriver.moonscan.io")
}
Expand All @@ -694,11 +692,11 @@ impl NamedChain {
("https://api-sepolia.scrollscan.com/api", "https://sepolia.scrollscan.com")
}
C::ScrollAlphaTestnet => {
("https://alpha-blockscout.scroll.io/api", "https://alpha-blockscout.scroll.io/")
("https://alpha-blockscout.scroll.io/api", "https://alpha-blockscout.scroll.io")
}

C::Metis => {
("https://andromeda-explorer.metis.io/api", "https://andromeda-explorer.metis.io/")
("https://andromeda-explorer.metis.io/api", "https://andromeda-explorer.metis.io")
}

C::Chiado => {
Expand All @@ -720,23 +718,23 @@ impl NamedChain {
("https://blockscout.com/rsk/mainnet/api", "https://blockscout.com/rsk/mainnet")
}

C::Oasis => ("https://scan.oasischain.io/api", "https://scan.oasischain.io/"),
C::Oasis => ("https://scan.oasischain.io/api", "https://scan.oasischain.io"),

C::Emerald => {
("https://explorer.emerald.oasis.dev/api", "https://explorer.emerald.oasis.dev/")
("https://explorer.emerald.oasis.dev/api", "https://explorer.emerald.oasis.dev")
}
C::EmeraldTestnet => (
"https://testnet.explorer.emerald.oasis.dev/api",
"https://testnet.explorer.emerald.oasis.dev/",
"https://testnet.explorer.emerald.oasis.dev",
),

C::Aurora => ("https://api.aurorascan.dev/api", "https://aurorascan.dev"),
C::AuroraTestnet => {
("https://testnet.aurorascan.dev/api", "https://testnet.aurorascan.dev")
}

C::Evmos => ("https://evm.evmos.org/api", "https://evm.evmos.org/"),
C::EvmosTestnet => ("https://evm.evmos.dev/api", "https://evm.evmos.dev/"),
C::Evmos => ("https://evm.evmos.org/api", "https://evm.evmos.org"),
C::EvmosTestnet => ("https://evm.evmos.dev/api", "https://evm.evmos.dev"),

C::Celo => {
("https://explorer.celo.org/mainnet/api", "https://explorer.celo.org/mainnet")
Expand All @@ -748,10 +746,10 @@ impl NamedChain {
("https://explorer.celo.org/baklava/api", "https://explorer.celo.org/baklava")
}

C::Canto => ("https://evm.explorer.canto.io/api", "https://evm.explorer.canto.io/"),
C::Canto => ("https://evm.explorer.canto.io/api", "https://evm.explorer.canto.io"),
C::CantoTestnet => (
"https://testnet-explorer.canto.neobase.one/api",
"https://testnet-explorer.canto.neobase.one/",
"https://testnet-explorer.canto.neobase.one",
),

C::Boba => ("https://api.bobascan.com/api", "https://bobascan.com"),
Expand All @@ -760,16 +758,15 @@ impl NamedChain {
C::BaseGoerli => ("https://api-goerli.basescan.org/api", "https://goerli.basescan.org"),

C::ZkSync => {
("https://zksync2-mainnet-explorer.zksync.io/", "https://explorer.zksync.io/")
("https://zksync2-mainnet-explorer.zksync.io", "https://explorer.zksync.io")
}
C::ZkSyncTestnet => {
("https://zksync2-testnet-explorer.zksync.dev", "https://goerli.explorer.zksync.io")
}
C::ZkSyncTestnet => (
"https://zksync2-testnet-explorer.zksync.dev/",
"https://goerli.explorer.zksync.io/",
),

C::Linea => ("https://api.lineascan.build/api", "https://lineascan.build/"),
C::Linea => ("https://api.lineascan.build/api", "https://lineascan.build"),
C::LineaTestnet => {
("https://explorer.goerli.linea.build/api", "https://explorer.goerli.linea.build/")
("https://explorer.goerli.linea.build/api", "https://explorer.goerli.linea.build")
}

C::Mantle => ("https://explorer.mantle.xyz/api", "https://explorer.mantle.xyz"),
Expand Down Expand Up @@ -1011,4 +1008,14 @@ mod tests {
let s = "enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.mainnet.ethdisco.net";
assert_eq!(NamedChain::Mainnet.public_dns_network_protocol().unwrap(), s);
}

#[test]
fn ensure_no_trailing_etherscan_url_separator() {
for chain in NamedChain::iter() {
if let Some((api, base)) = chain.etherscan_urls() {
assert!(!api.ends_with('/'), "{:?} api url has trailing /", chain);
assert!(!base.ends_with('/'), "{:?} base url has trailing /", chain);
}
}
}
}

0 comments on commit 4edcc71

Please sign in to comment.