avalanche-types 0.1.5

Avalanche primitive types in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Chain alias functionality for the avalanchego node.
use std::collections::HashMap;

/// A map from blockchainIDs to custom aliases
/// ref. <https://docs.avax.network/nodes/maintain/avalanchego-config-flags#--chain-aliases-file-string>.
pub type Aliases = HashMap<String, Vec<String>>;

#[test]
fn test_aliases_json() {
    let json = r#"{"q2aTwKuyzgs8pynF7UXBZCU7DejbZbZ6EUyHr3JQzYgwNPUPi": ["DFK"]}"#;
    let aliases: Aliases = serde_json::from_str(json).unwrap();
    assert_eq!(
        aliases
            .get("q2aTwKuyzgs8pynF7UXBZCU7DejbZbZ6EUyHr3JQzYgwNPUPi")
            .unwrap(),
        &vec!["DFK".to_string()]
    )
}