ic-query 0.98.0

Internet Computer query library for CloudEngine, NNS, SNS, ICRC, system canisters, and public network metadata
Documentation
use ic_query::nns::registry::{
    NnsRegistryCertification, NnsRegistryInventoryProvenance, NnsRegistryVersionReport,
};

#[test]
fn downstream_report_data_and_json_do_not_require_cli_presentation() {
    let report = NnsRegistryVersionReport {
        schema_version: 1,
        provenance: NnsRegistryInventoryProvenance {
            network: "ic".into(),
            registry_canister_id: "rwlgt-iiaaa-aaaaa-aaaaa-cai".into(),
            registry_version: 42,
            fetched_at: "2023-11-14T22:13:20Z".into(),
            source_endpoint: "https://icp-api.io".into(),
            fetched_by: "embedding-tool".into(),
        },
        certification: NnsRegistryCertification {
            certificate_verified: true,
            certificate_time_nanos: 1_700_000_000_000_000_000,
            root_key_digest: "ab".repeat(32),
            certificate_hex: "cd".repeat(8),
            hash_tree_hex: "ef".repeat(4),
        },
    };
    assert_eq!(report.provenance.registry_version, 42);
    let json = serde_json::to_value(&report).unwrap();
    assert_eq!(json["registry_version"], 42);
    assert_eq!(json["source_endpoint"], "https://icp-api.io");
}