Retrieve the parameter value for a named Invoke transaction parameter
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
Definition
int64_t otxn_param (
uint32_t write_ptr,
uint32_t write_len,
uint32_t read_ptr,
uint32_t read_len
);
Example
uint8_t pname[] = {0xCAU, 0xFEU};
uint8_t pvalue[32];
int64_t value_len =
otxn_param(pvalue, 32, pname, 2);
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 |
Return Code
Type | Description |
---|---|
int64_t | The number of bytes written If negative, an error: OUT_OF_BOUNDS - pointers/lengths specified outside of hook memory. DOESNT_EXIST - The specified paramater doesn't exist or is null TOO_SMALL - The parameter name can't be null TOO_BIG - The parameter name is greater than 32 bytes |