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