sto_erase
Concepts
Section titled “Concepts”Behaviour
Section titled “Behaviour”- Parse an STObject pointed to by
read_ptr
- Write a new STObject to
write_ptr
but withoutfield_id
if it was present in the original object.
- It will look for the STO object (binary encoded ledger data) from which the field will be removed.
- It will look for the ID of the field to be erased.
- Returns the updated STO object in binary encoded ledger data format, or an error code if the operation fails.
Definition
Section titled “Definition”int64_t sto_erase ( uint32_t write_ptr, uint32_t write_len, uint32_t read_ptr, uint32_t read_len, uint32_t field_id);
function sto_erase( sto: ByteArray | HexString, field_id: number ): ErrorCode | ByteArray
Example
Section titled “Example”int64_t result = sto_erase(tx_out, sizeof(tx_out), tx_in, tx_len, sfSigners);
if (tx_len <= 0) rollback("Erasing failed.", 15, 1);
const tx_out = sto_erase(tx_in, sfSigners)
if (typeof tx_out === 'number') rollback("Erasing failed.", 1)
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
write_ptr | uint32_t | The buffer to write the modified STObject to |
write_len | uint32_t | The length of the output buffer |
read_ptr | uint32_t | The buffer to read the source STObject from |
read_len | uint32_t | The Length of the source object |
field_id | uint32_t | The sf code (location) to erase |
Name | Type | Description |
---|---|---|
sto | ByteArray | HexString | The STO object (binary encoded ledger data) from which the field will be removed. |
field_id | number | The ID of the field to be erased. |
Return Code
Section titled “Return Code”Type | Description |
---|---|
int64_t | The number of bytes written to |
Type | Description |
---|---|
ErrorCode | ByteArray | The updated STO object in binary encoded ledger data format, or an error code if the operation fails. |