mesc 0.3.0

libraries for creating, loading, and modifying MESC configuation data
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::ChainId;

/// get chain id of given network name
pub(crate) fn get_network_chain_id(network_name: &str) -> Option<ChainId> {
    crate::network_names::NETWORKS
        .iter()
        .find(|(_, name)| *name == network_name)
        .map(|(chain_id, _)| (*chain_id).into())
}

/// get network name of given chain id
pub fn get_network_name(chain_id: &ChainId) -> Option<&'static str> {
    crate::network_names::get_network_names().get(chain_id).copied()
}