otxn_field
Behaviour
Section titled “Behaviour”- Find the specified
sffield in the originating transaction - Write the serialized version of the field to the output buffer
- Retrieve the value of a specific field in the originating transaction.
- Returns the value of the specified field as an array of numbers, or an ErrorCode if the lookup fails.
Definition
Section titled “Definition”int64_t otxn_field ( uint32_t write_ptr, uint32_t write_len, uint32_t field_id);function otxn_field(field_id: number): ErrorCode | ByteArrayExample
Section titled “Example”int64_t account_field_len = otxn_field(account_field, 20, sfAccount);const account_field = otxn_field(sfAccount)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| write_ptr | uint32_t | Pointer to a buffer of a suitable size to store the output. |
| write_len | uint32_t | Length of the output buffer. |
| field_id | uint32_t | The |
| Name | Type | Description |
|---|---|---|
| field_id | number | Returns the value of the specified field as an array of numbers, if the lookup fails. |
Return Code
Section titled “Return Code”| Type | Description |
|---|---|
| int64_t | The number of bytes written |
| Type | Description |
|---|---|
| ByteArray or ErrorCode | Returns the value of the specified field as an array of numbers, or an ErrorCode if the lookup fails. |