Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

feat(ethers-core/Chain): implement Default trait #976

Merged
merged 1 commit into from
Feb 28, 2022
Merged
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
13 changes: 12 additions & 1 deletion ethers-core/src/types/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::Deserialize;
use thiserror::Error;

use core::convert::TryFrom;
use std::{fmt, str::FromStr};
use std::{default, fmt, str::FromStr};

use crate::types::U256;

Expand Down Expand Up @@ -177,3 +177,14 @@ impl Chain {
)
}
}

impl default::Default for Chain {
fn default() -> Self {
Chain::Mainnet
}
}

#[test]
fn test_default_chain() {
assert_eq!(Chain::default(), Chain::Mainnet);
}