util_raddr
Behaviour
Section titled “Behaviour”- Read a 20 byte Account ID from the
read_ptr
- Write the equivalent r-address for that Account ID to
write_ptr
- Read a 20 byte Account ID from the
accountid
- Return the equivalent r-address for that Account ID
Definition
Section titled “Definition”int64_t util_raddr ( uint32_t write_ptr, uint32_t write_len, uint32_t read_ptr, uint32_t read_len);
function util_raddr(accountid: ByteArray | HexString): ErrorCode | string
Example
Section titled “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);
const raddr = util_raddr('8D329C03074A98EF0488AB6ABBF5883F68CCFD4E')// orconst raddr = util_raddr([ 0x8D, 0x32, 0x9C, 0x03, 0x07, 0x4A, 0x98, 0xEF, 0x04, 0x88, 0xAB, 0x6A, 0xBB, 0xF5, 0x88, 0x3F, 0x68, 0xCC, 0xFD, 0x4E])
Parameters
Section titled “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. |
Name | Type | Description |
---|---|---|
accountid | number[]/string | The HEX account ID to return as r-address, can be provided as an array of numbers or a string. |
Return Code
Section titled “Return Code”Type | Description |
---|---|
int64_t | The number of bytes written (the length of the output r-address). |
Type | Description |
---|---|
string/number | ErrorCode if there is an error in formatting, otherwise returns the r-address as a string |