xrpl_hooks/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(accid: &mut [u8], field_id: FieldId) -> Result<u64> {
12    buf_write_1arg(accid, field_id as _, _c::otxn_field)
13}
14
15/// Output a field from the originating transaction as a human readable string
16#[inline(always)]
17pub fn otxn_field_txt(acctxt: &mut [u8], field_id: FieldId) -> Result<u64> {
18    buf_write_1arg(acctxt, field_id as _, _c::otxn_field_txt)
19}
20
21/// Get the generation of the originating transaction
22#[inline(always)]
23pub fn otxn_generation() -> i64 {
24    unsafe { _c::otxn_generation() }
25}
26
27/// Output the canonical hash of the originating transaction
28#[inline(always)]
29pub fn otxn_id(hash: &mut [u8]) -> Result<u64> {
30    buf_write(hash, _c::otxn_id)
31}
32
33/// Get the Transaction Type of the originating transaction
34#[inline(always)]
35pub fn otxn_type() -> i64 {
36    unsafe { _c::otxn_type() }
37}
38
39/// Load the originating transaction into a slot
40#[inline(always)]
41pub fn otxn_slot(slot_no: u32) -> Result<u64> {
42    api_1arg_call(slot_no, _c::otxn_slot)
43}