util_accid
Behaviour
Section titled “Behaviour”- Read an r-address from the
read_ptr
- Write a 20 byte Account ID to the
write_ptr
- Read an r-address from the
raddress
- Returns a 20 byte Account ID or an ErrorCode
Definition
Section titled “Definition”int64_t util_accid ( uint32_t write_ptr, uint32_t write_len, uint32_t read_ptr, uint32_t read_len);
function util_accid(raddress: string): ErrorCode | ByteArray
Example
Section titled “Example”uint8_t accid_out[20];uint8_t raddr_in[] = "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh";
int64_t bytes_written = util_accid(accid_out, 20, raddr_in, sizeof(raddr_in)-1);// NB: if specified as a c-string as above, account for the nul char
const accId = util_accid('rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh')
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
write_ptr | uint32_t | Pointer to a buffer of a suitable size to store the output Account ID. Must be at least 20 bytes. |
write_len | uint32_t | Length of the output buffer. |
read_ptr | uint32_t | Pointer to the r-address. |
read_len | uint32_t | The length of the r-address. |
Name | Type | Description |
---|---|---|
raddress | string | The r-address to format as HEX account ID. |
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 | If there is an error in formatting, otherwise returns the HEX Account ID as an array of numbers. |