pub fn send_from_reservation(
    reservation_id: ReservationId,
    destination: ActorId,
    payload: &[u8],
    value: u128
) -> Result<MessageId>
Expand description

Same as send, but it spends gas from a reservation instead of borrowing it from the gas limit provided with the incoming message.

The first argument is the reservation identifier ReservationId obtained by calling the corresponding API. The second argument is the address of the target account (ActorId). The third argument is the payload buffer. Finally, the last argument is the value to be transferred from the current program account to the message target account.

§Examples

Send a message with value to the arbitrary address (don’t repeat it in your program!):

use gcore::{exec, msg, ActorId};

#[no_mangle]
extern "C" fn handle() {
    // Reserve 5 million of gas for 100 blocks
    let reservation_id = exec::reserve_gas(5_000_000, 100).expect("Unable to reserve");
    // Receiver id is collected from bytes from 0 to 31
    let actor_id: [u8; 32] = core::array::from_fn(|i| i as u8);
    msg::send_from_reservation(reservation_id, ActorId(actor_id), b"HELLO", 42)
        .expect("Unable to send");
}

§See also