These docs are for v2.0. Click to read the latest docs for v3.0.

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

NameTypeDescription
write_ptruint32_tPointer to a buffer of a suitable size to store the output. Should be at least 32 bytes.
write_lenuint32_tLength of the output buffer.
read_ptruint32_tPointer to a buffer containing the parameter's name
read_lenuint32_tLength of the parameter's name

Return Code

TypeDescription
int64_tThe 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