otxn_param
Behaviour
Section titled “Behaviour”- Look up the value for a named parameter specified in
read_ptr
on the originating transaction (ttINVOKE only). - Write the parameter’s value to
write_ptr
- Look up the value for a named parameter specified on the originating transaction.
- Returns the value of the specified parameter, or an ErrorCode if the lookup fails.
Definition
Section titled “Definition”int64_t otxn_param ( uint32_t write_ptr, uint32_t write_len, uint32_t read_ptr, uint32_t read_len);
function otxn_param(name: ByteArray | HexString): ErrorCode | ByteArray
Example
Section titled “Example”uint8_t pname[] = {0xCAU, 0xFEU};uint8_t pvalue[32];int64_t value_len = otxn_param(pvalue, 32, pname, 2);
const pname = [0xCA, 0xFE]const pvalue = otxn_param(pname)
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
write_ptr | uint32_t | Pointer to a buffer of a suitable size to store the output. Should be at least 32 bytes. |
write_len | uint32_t | Length of the output buffer. |
read_ptr | uint32_t | Pointer to a buffer containing the parameter’s name |
read_len | uint32_t | Length of the parameter’s name |
Name | Type | Description |
---|---|---|
name | ByteArray | HexString | The name of the parameter to look up, specified as a ByteArray or string. |
Return Code
Section titled “Return Code”Type | Description |
---|---|
int64_t | The number of bytes written |
Type | Description |
---|---|
ErrorCode | ByteArray | Returns the value of the specified parameter, or an ErrorCode if the lookup fails. |