Skip to main content

rshooks_api/api/
otxn.rs

1use super::*;
2
3/// Get the burden of the originating transaction
4#[inline(always)]
5pub fn otxn_burden() -> i64 {
6    unsafe { _c::otxn_burden() }
7}
8
9/// Serialize and output a field from the originating transaction
10#[inline(always)]
11pub fn otxn_field(data: &mut [u8], field_id: FieldId) -> Result<i64> {
12    buf_write_1arg(data, field_id as _, _c::otxn_field)
13}
14
15/// Get the generation of the originating transaction
16#[inline(always)]
17pub fn otxn_generation() -> i64 {
18    unsafe { _c::otxn_generation() }
19}
20
21/// Output the canonical hash of the originating transaction
22#[inline(always)]
23pub fn otxn_id(hash: &mut [u8], flags: TxnTypeFlags) -> Result<i64> {
24    buf_write_1arg(hash, flags as u32, _c::otxn_id)
25}
26
27/// Get the Transaction Type of the originating transaction
28#[inline(always)]
29pub fn otxn_type() -> i64 {
30    unsafe { _c::otxn_type() }
31}
32
33/// Load the originating transaction into a slot
34#[inline(always)]
35pub fn otxn_slot(slot_no: u32) -> Result<i64> {
36    api_1arg_call(slot_no, _c::otxn_slot)
37}