Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add conflux espace mainnet and testnet #80

Merged
merged 5 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ released at least six months ago. The current MSRV is 1.70.0.
Note that the MSRV is not increased automatically, and only as part of a minor
release.

## Adding a new chain

Check `src/named.rs`'s comment for the guidelines on how to add a new chain.

## Note on `no_std`

All crates in this workspace should support `no_std` environments, with the
Expand Down
24 changes: 24 additions & 0 deletions assets/chains.json

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

21 changes: 21 additions & 0 deletions src/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ pub enum NamedChain {

Metis = 1088,

#[cfg_attr(feature = "serde", serde(alias = "conflux-espace-testnet"))]
CfxTestnet = 71,
#[cfg_attr(feature = "serde", serde(alias = "conflux-espace"))]
Cfx = 1030,

#[strum(to_string = "xdai", serialize = "gnosis", serialize = "gnosis-chain")]
#[cfg_attr(feature = "serde", serde(alias = "xdai", alias = "gnosis", alias = "gnosis-chain"))]
Gnosis = 100,
Expand Down Expand Up @@ -512,6 +517,8 @@ impl NamedChain {

C::Degen => 600,

C::Cfx | C::CfxTestnet => 500,

C::Morden
| C::Ropsten
| C::Rinkeby
Expand Down Expand Up @@ -647,6 +654,8 @@ impl NamedChain {
| C::Scroll
| C::ScrollSepolia
| C::Darwinia
| C::Cfx
| C::CfxTestnet
| C::Crab
| C::Koi => false,

Expand Down Expand Up @@ -729,6 +738,8 @@ impl NamedChain {
| C::KaruraTestnet
| C::Darwinia
| C::Crab
| C::Cfx
| C::CfxTestnet
| C::Koi => true,
_ => false,
}
Expand Down Expand Up @@ -800,6 +811,7 @@ impl NamedChain {
| C::AcalaMandalaTestnet
| C::AcalaTestnet
| C::KaruraTestnet
| C::CfxTestnet
| C::Koi => true,

// Dev chains.
Expand Down Expand Up @@ -854,6 +866,7 @@ impl NamedChain {
| C::Acala
| C::Karura
| C::Darwinia
| C::Cfx
| C::Crab
| C::Etherlink => false,
}
Expand Down Expand Up @@ -902,6 +915,8 @@ impl NamedChain {

C::Koi => "KRING",

C::Cfx | C::CfxTestnet => "CFX",

_ => return None,
})
}
Expand Down Expand Up @@ -1207,6 +1222,10 @@ impl NamedChain {
C::Koi => {
("https://koi-scan.darwinia.network/api", "https://koi-scan.darwinia.network")
}
C::Cfx => ("https://evmapi.confluxscan.net/api", "https://evm.confluxscan.io"),
C::CfxTestnet => {
("https://evmapi-testnet.confluxscan.net/api", "https://evmtestnet.confluxscan.io")
}
})
}

Expand Down Expand Up @@ -1331,6 +1350,8 @@ impl NamedChain {
| C::Elastos
| C::Degen
| C::Ronin
| C::Cfx
| C::CfxTestnet
| C::AutonomysNovaTestnet => return None,
};

Expand Down
Loading