Function gstd::msg::send_bytes_with_gas

source ·
pub fn send_bytes_with_gas<T: AsRef<[u8]>>(
    program: ActorId,
    payload: T,
    gas_limit: u64,
    value: u128
) -> Result<MessageId>
Expand description

Same as send_bytes, but with an explicit gas limit.

§Examples

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

use gstd::{msg, ActorId};

#[no_mangle]
extern "C" fn handle() {
    // Receiver id is collected from bytes from 0 to 31
    let id: [u8; 32] = core::array::from_fn(|i| i as u8);
    msg::send_bytes_with_gas(ActorId::new(id), b"HELLO", 5_000_000, 42)
        .expect("Unable to send");
}

§See also