pub fn get_field<T: FromCurrentTx, const CODE: i32>(
_: SField<T, CODE>,
) -> Result<T>Expand description
Retrieves a field from the current transaction using an SField constant.
§Arguments
field- An SField constant that encodes both the field code and expected type
§Returns
Returns a Result<T> where:
Ok(T)- The field value for the specified fieldErr(Error)- If the field cannot be retrieved, has unexpected size, or fails to decode
§Example
use xrpl_common_stdlib::fields::current_tx::get_field;
use xrpl_common_stdlib::sfield;
// Type is automatically inferred from the SField constant
let sequence = get_field(sfield::Sequence).unwrap(); // u32
let account = get_field(sfield::Account).unwrap(); // AccountID