Skip to content
This repository was archived by the owner on Mar 23, 2021. It is now read-only.

Commit f9389bd

Browse files
committed
Rename from_network_id to from_chain_id
1 parent 7d1b01e commit f9389bd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cnd/src/http_api/ethereum_network.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub enum Network {
2929
pub struct UnknownChainId(String);
3030

3131
impl Network {
32-
pub fn from_network_id(s: &str) -> Result<Self, UnknownChainId> {
32+
pub fn from_chain_id(s: &str) -> Result<Self, UnknownChainId> {
3333
Ok(match s {
3434
"1" => Network::Mainnet,
3535
"3" => Network::Ropsten,
@@ -44,7 +44,7 @@ impl TryFrom<ChainId> for Network {
4444

4545
fn try_from(value: ChainId) -> Result<Self, Self::Error> {
4646
let value = u32::from(value).to_string();
47-
Network::from_network_id(value.as_str())
47+
Network::from_chain_id(value.as_str())
4848
}
4949
}
5050

@@ -77,10 +77,10 @@ mod test {
7777

7878
#[test]
7979
fn from_version() {
80-
assert_that(&Network::from_network_id("1")).is_ok_containing(Network::Mainnet);
81-
assert_that(&Network::from_network_id("3")).is_ok_containing(Network::Ropsten);
82-
assert_that(&Network::from_network_id("17")).is_ok_containing(Network::Regtest);
83-
assert_that(&Network::from_network_id("-1")).is_err();
80+
assert_that(&Network::from_chain_id("1")).is_ok_containing(Network::Mainnet);
81+
assert_that(&Network::from_chain_id("3")).is_ok_containing(Network::Ropsten);
82+
assert_that(&Network::from_chain_id("17")).is_ok_containing(Network::Regtest);
83+
assert_that(&Network::from_chain_id("-1")).is_err();
8484
}
8585

8686
fn assert_display<T: Display>(_t: T) {}

0 commit comments

Comments
 (0)