Expand description
Inner field access: encode a path (sfield codes and array indices) into the compact binary
format the host understands, then read a field like Memos[0].MemoType.
Two APIs share the same buffer layout:
TxPathBuilderandLedgerPathBuilderare the recommended fluent builders. Each is rooted at its context โctx.tx().path()for the current transaction,obj.path()orctx.escrow().path()for a ledger object โ so no bare buffer escapes and the terminalgetalways dispatches to the host function matching that context. Field codes come from typedSFieldconstants:use xrpl_common_stdlib::current_tx::traits::TransactionCommonFields; use xrpl_common_stdlib::sfield; // Read Memos[0].MemoData from the current transaction. let data = tx.path() .field(sfield::Memos) .index(0) .field(sfield::MemoData) .get::<u32>();Locatoritself is the lower-level buffer:packvalues in and passas_ptr/num_packed_bytesto a raw host call. Prefer the builder unless you need that manual control.use xrpl_common_stdlib::fields::locator::Locator; use xrpl_common_stdlib::sfield; let mut l = Locator::new(); l.pack(sfield::Memos); l.pack(0); l.pack(sfield::MemoType);
Structsยง
- Ledger
Path Builder - Fluent builder for reading an inner field from a ledger object โ either the object the contract is attached to, or one cached into a slot.
- Locator
- A Locator encodes a path to an inner field as a sequence of 4-byte packed values (sfield codes or array indices) in a compact binary format understood by the host.
- TxPath
Builder - Fluent builder for reading an inner field from the current transaction.