util_raddr
Convert a 20 byte Account ID to an r-address
Behaviour
Read a 20 byte Account ID from the
read_ptr
Write the equivalent r-address for that Account ID to
write_ptr
Definition
int64_t util_raddr (
uint32_t write_ptr,
uint32_t write_len,
uint32_t read_ptr,
uint32_t read_len
);
Example
uint8_t raddr_out[40];
uint8_t acc_id[20] =
{
0x2dU, 0xd8U, 0xaaU, 0xdbU, 0x4eU, 0x15U,
0xebU, 0xeaU, 0xeU, 0xfdU, 0x78U, 0xd1U, 0xb0U,
0x35U, 0x91U, 0x4U, 0x7bU, 0xfaU, 0x1eU, 0xeU
};
int64_t bytes_written =
util_raddr(raddr_out, sizeof(raddr_out), acc_id, 20);
Parameters
Name
Type
Description
write_ptr
uint32_t
Pointer to a buffer of a suitable size to store the output r-address. Recommend at least 35 bytes.
write_len
uint32_t
Length of the output buffer.
read_ptr
uint32_t
Pointer to the Account ID.
read_len
uint32_t
The length of the input. Always 20.
Return Code
Type
Description
int64_t
The number of bytes written (the length of the output r-address).
If negative, an error:
OUT_OF_BOUNDS
- pointers/lengths specified outside of hook memory.
INVALID_ARGUMENT
- read_len
was not 20.
TOO_SMALL
- write_len
was not large enough to store produced r-address in.
Last updated
Was this helpful?