Retrieve the field code of an object in a slot and, optionally, some other information

Behaviour

  • Locate the object pointed to by the specified slot_no
  • Determine its sf field code and return this, or some other information (see below) if flags are used

Definition

int64_t slot_type (
    uint32_t slot_no,
    uint32_t flags
);

Example

uint8_t txn_id[32];
int64_t bytes_written = 
    slot_id(txn_id, 32, 1); // assumes a txn is slotted into slot=1

Parameters

NameTypeDescription
slot_nouint32_tThe slot number
flagsuin32_tFor normal operation this should be 0.

To determine whether or not an STI_AMOUNT type contains a native (XRP) amount or a floating point (IOU) amount set to 1.

Return Code

TypeDescription
int64_tIf flags is 0 then:
The sf field code of the slotted object

If flags is 1 then:
1 if and only if the slotted object is an STI_AMOUNT and the type of the amount is XRP.

If negative, an error:
DOESNT_EXIST
- the specified slot_no does not contain an object.

NOT_AN_AMOUNT
- flags was set to 1 but the slotted object is not an STI_AMOUNT object