1use crate::candid::utils::{ArgumentDecoder, ArgumentEncoder};
2use crate::ic;
3use crate::{CallResponse, Principal};
4
5pub mod management;
6
7pub trait Method {
9 const NAME: &'static str;
10 type Arguments: ArgumentEncoder;
11 type Response: for<'de> ArgumentDecoder<'de>;
12
13 #[inline]
14 fn perform(id: Principal, args: Self::Arguments) -> CallResponse<Self::Response> {
15 ic::call(id, Self::NAME, args)
16 }
17
18 #[inline]
19 fn perform_with_payment(
20 id: Principal,
21 args: Self::Arguments,
22 cycles: u64,
23 ) -> CallResponse<Self::Response> {
24 ic::call_with_payment(id, Self::NAME, args, cycles)
25 }
26}