canic-host 0.100.80

Host-side App build, Fleet install, deployment, and release-set library for Canic workspaces
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Module: replica_query::wire
//!
//! Responsibility: decode typed Candid responses returned by direct replica queries.
//! Does not own: HTTP transport, registry projection, or operator rendering.
//! Boundary: preserves canonical endpoint DTOs and typed Canic rejections.

#[cfg(test)]
mod tests;

use super::ReplicaQueryError;
use candid::Decode;
use canic_core::dto::error::Error as CanicError;

pub(super) fn decode_cycle_balance_response(bytes: &[u8]) -> Result<u128, ReplicaQueryError> {
    let result = Decode!(bytes, Result<u128, CanicError>).map_err(ReplicaQueryError::Candid)?;
    result.map_err(ReplicaQueryError::Canister)
}