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