canic_core/spec/nns/
mod.rs

1//!
2//! Handy wrappers for selected NNS candid types with consistent naming.
3//!
4
5use crate::spec::prelude::*;
6
7///
8/// GetSubnetForCanisterRequest
9///
10
11#[derive(CandidType, Debug, Deserialize)]
12pub struct GetSubnetForCanisterRequest {
13    pub principal: Principal,
14}
15
16impl GetSubnetForCanisterRequest {
17    pub fn new(pid: impl Into<Principal>) -> Self {
18        Self {
19            principal: pid.into(),
20        }
21    }
22}
23
24///
25/// GetSubnetForCanisterResponse
26/// Minimal NNS response describing the assigned subnet for a canister.
27///
28
29pub type GetSubnetForCanisterResponse = Result<GetSubnetForCanisterPayload, String>;
30
31#[derive(CandidType, Debug, Deserialize)]
32pub struct GetSubnetForCanisterPayload {
33    pub subnet_id: Option<Principal>,
34}