thruput-sdk 0.58.0

Thruput smart-contract SDK for Rust (rv32 guest runtime and native test harness)
Documentation
use crate::re_throw::OrSyscallThrow;
use crate::sys::SyscallNo;
use crate::transaction::TransactionStatistic;
use crate::{GasAmount, sys};

/// The gas remaining in the current transaction.
///
/// Throws a syscall exception (aborting the frame) if the host call fails.
pub fn gas_remaining() -> GasAmount {
    let mut n: u64 = 0;

    sys::raw_GetTransactionStatistics(
        TransactionStatistic::GasRemaining,
        &mut n,
    )
    .or_syscall_throw(SyscallNo::kGetTransactionStatistics);

    n
}