xrpl_hooks/api/
state.rs

1use super::*;
2
3/// Retrieve the data pointed to by a Hook State key and write it to an output buffer
4#[inline(always)]
5pub fn state(data: &mut [u8], key: &[u8]) -> Result<u64> {
6    buf_write_read(data, key, _c::state)
7}
8
9/// Set the Hook State for a given key and value
10#[inline(always)]
11pub fn state_set(data: &[u8], key: &[u8]) -> Result<u64> {
12    buf_2read(data, key, _c::state_set)
13}
14
15/// Retrieve the data pointed to, on another account, by a Hook State key and write it to an output buffer
16#[inline(always)]
17pub fn state_foreign(data: &mut [u8], key: &[u8], accid: &[u8]) -> Result<u64> {
18    let res = unsafe {
19        _c::state_foreign(
20            data.as_mut_ptr() as u32,
21            data.len() as u32,
22            key.as_ptr() as u32,
23            key.len() as u32,
24            accid.as_ptr() as u32,
25            accid.len() as u32,
26        )
27    };
28
29    result_u64(res)
30}