canic_core/ops/ic/
call.rs

1#![allow(clippy::disallowed_methods)]
2
3use crate::{
4    cdk::{call::Call as IcCall, candid::Principal},
5    model::metrics::{
6        icc::IccMetrics,
7        system::{SystemMetricKind, SystemMetrics},
8    },
9};
10
11///
12/// Call
13/// Wrapper around `ic_cdk::api::call::Call` that records metrics.
14///
15
16pub struct Call;
17
18impl Call {
19    /// Create a call builder that will be awaited without cycle limits.
20    #[must_use]
21    pub fn unbounded_wait(canister_id: Principal, method: &str) -> IcCall<'_, '_> {
22        SystemMetrics::increment(SystemMetricKind::CanisterCall);
23        IccMetrics::increment(canister_id, method);
24
25        IcCall::unbounded_wait(canister_id, method)
26    }
27}