ic-query 0.2.17

Internet Computer query CLI for NNS, SNS, and related public network metadata
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Module: sns::report::lookup::network
//!
//! Responsibility: SNS report network guard.
//! Does not own: command parsing, live transport, or report construction.
//! Boundary: rejects unsupported networks before mainnet-only SNS queries.

use crate::sns::report::SnsHostError;
use crate::subnet_catalog::MAINNET_NETWORK;

/// Ensure an SNS report request targets the supported mainnet network.
pub(in crate::sns::report) fn enforce_mainnet_network(network: &str) -> Result<(), SnsHostError> {
    if network == MAINNET_NETWORK {
        return Ok(());
    }
    Err(SnsHostError::UnsupportedNetwork {
        network: network.to_string(),
    })
}