ic_cdk::api::call

Function notify_with_payment128

Source
pub fn notify_with_payment128<T: ArgumentEncoder>(
    id: Principal,
    method: &str,
    args: T,
    payment: u128,
) -> Result<(), RejectionCode>
Expand description

Sends a one-way message with payment cycles attached to it that invokes method with arguments args on the principal identified by id, ignoring the reply.

Returns Ok(()) if the message was successfully enqueued, otherwise returns a reject code.

§Notes

  • The caller has no way of checking whether the destination processed the notification. The system can drop the notification if the destination does not have resources to process the message (for example, if it’s out of cycles or queue slots).

  • The callee cannot tell whether the call is one-way or not. The callee must produce replies for all incoming messages.

  • It is safe to upgrade a canister without stopping it first if it sends out only one-way messages.

  • If the payment is non-zero and the system fails to deliver the notification, the behaviour is unspecified: the funds can be either reimbursed or consumed irrevocably by the IC depending on the underlying implementation of one-way calls.