pub fn reply_commit_from_reservation(
    id: ReservationId,
    value: u128
) -> Result<MessageId>
Expand description

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

§Examples

use gstd::{msg, ReservationId};

#[no_mangle]
extern "C" fn handle() {
    msg::reply_push(b"Hello,").expect("Unable to push");
    msg::reply_push(b" world!").expect("Unable to push");
    let reservation_id = ReservationId::reserve(5_000_000, 100).expect("Unable to reserves");
    msg::reply_commit_from_reservation(reservation_id, 42).expect("Unable to commit");
}

§See also

  • reply_push function allows forming a reply message in parts.
  • ReservationId struct allows reserve gas for later use.