Expand description
Ledger-object field access.
Reading a field from a ledger object is the same two steps as reading one from the current
transaction: call a host function into a buffer, then decode the bytes into a typed value.
That decode step is captured once per type by crate::fields::decoder::FieldDecoder, and a
type opts into being readable from a ledger object via the
crate::fields::decoder::FromLedger marker.
Two entry points, mirroring the transaction side:
ledger_object— read from a ledger object cached into a slot (viacache_le).current_ledger_object— read from the current ledger object, without a slot.
Both are the generic FieldDecoder-based accessors re-exported from crate::fields; see
that module for the decode machinery and the Blob<N> zero-copy accessors.
use xrpl_common_stdlib::objects::{ledger_object, current_ledger_object};
use xrpl_common_stdlib::sfield;
fn example() {
let slot = 0;
// Get a required field from a specific (slot-cached) ledger object
let balance = ledger_object::get_field(slot, sfield::Balance).unwrap();
let account = ledger_object::get_field(slot, sfield::Account).unwrap();
// Get an optional field from the current ledger object
let flags = current_ledger_object::get_field_optional(sfield::Flags).unwrap();
}Re-exports§
pub use crate::fields::current_ledger_obj as current_ledger_object;pub use crate::fields::ledger_obj as ledger_object;pub use any_object::LedgerObject;pub use cache::cache_le;
Modules§
- any_
object - Untyped handle to a slot-cached ledger object.
- array_
object - Placeholder types for array and object SFields.
- cache
- Caching a ledger entry into a host slot.
- test_
utils - Shared mock-host-binding helpers used by the
#[cfg(test)]blocks thattools/generateLedgerObjects.jsemits at the bottom of everyobjects::generated::<entry>file. - traits
- Generic ledger-object field accessor traits.
Structs§
- AMM
- Account
Root - Amendments
- Bridge
- Check
- Credential
- DID
- Delegate
- Deposit
Preauth - Directory
Node - Escrow
- FeeSettings
- Ledger
Hashes - Loan
- Loan
Broker - MPToken
- MPToken
Issuance - NFToken
Offer - NFToken
Page - NegativeUNL
- Offer
- Oracle
- PayChannel
- Permissioned
Domain - Ripple
State - Signer
List - Sponsorship
- Ticket
- Vault
- XChain
Owned ClaimID - XChain
Owned Create Account ClaimID
Traits§
- AMMFields
- Trait providing access to fields specific to AMM objects in any ledger.
- Account
Root Fields - Trait providing access to fields specific to AccountRoot objects in any ledger.
- Amendments
Fields - Trait providing access to fields specific to Amendments objects in any ledger.
- Bridge
Fields - Trait providing access to fields specific to Bridge objects in any ledger.
- Check
Fields - Trait providing access to fields specific to Check objects in any ledger.
- Credential
Fields - Trait providing access to fields specific to Credential objects in any ledger.
- CurrentAMM
Fields - Trait providing access to fields specific to the current AMM object.
- Current
Account Root Fields - Trait providing access to fields specific to the current AccountRoot object.
- Current
Amendments Fields - Trait providing access to fields specific to the current Amendments object.
- Current
Bridge Fields - Trait providing access to fields specific to the current Bridge object.
- Current
Check Fields - Trait providing access to fields specific to the current Check object.
- Current
Credential Fields - Trait providing access to fields specific to the current Credential object.
- CurrentDID
Fields - Trait providing access to fields specific to the current DID object.
- Current
Delegate Fields - Trait providing access to fields specific to the current Delegate object.
- Current
Deposit Preauth Fields - Trait providing access to fields specific to the current DepositPreauth object.
- Current
Directory Node Fields - Trait providing access to fields specific to the current DirectoryNode object.
- Current
FeeSettings Fields - Trait providing access to fields specific to the current FeeSettings object.
- Current
Ledger Hashes Fields - Trait providing access to fields specific to the current LedgerHashes object.
- Current
Loan Broker Fields - Trait providing access to fields specific to the current LoanBroker object.
- Current
Loan Fields - Trait providing access to fields specific to the current Loan object.
- CurrentMP
Token Fields - Trait providing access to fields specific to the current MPToken object.
- CurrentMP
Token Issuance Fields - Trait providing access to fields specific to the current MPTokenIssuance object.
- CurrentNF
Token Offer Fields - Trait providing access to fields specific to the current NFTokenOffer object.
- CurrentNF
Token Page Fields - Trait providing access to fields specific to the current NFTokenPage object.
- Current
NegativeUNL Fields - Trait providing access to fields specific to the current NegativeUNL object.
- Current
Offer Fields - Trait providing access to fields specific to the current Offer object.
- Current
Oracle Fields - Trait providing access to fields specific to the current Oracle object.
- Current
PayChannel Fields - Trait providing access to fields specific to the current PayChannel object.
- Current
Permissioned Domain Fields - Trait providing access to fields specific to the current PermissionedDomain object.
- Current
Ripple State Fields - Trait providing access to fields specific to the current RippleState object.
- Current
Signer List Fields - Trait providing access to fields specific to the current SignerList object.
- Current
Sponsorship Fields - Trait providing access to fields specific to the current Sponsorship object.
- Current
Ticket Fields - Trait providing access to fields specific to the current Ticket object.
- Current
Vault Fields - Trait providing access to fields specific to the current Vault object.
- CurrentX
Chain Owned ClaimID Fields - Trait providing access to fields specific to the current XChainOwnedClaimID object.
- CurrentX
Chain Owned Create Account ClaimID Fields - Trait providing access to fields specific to the current XChainOwnedCreateAccountClaimID object.
- DIDFields
- Trait providing access to fields specific to DID objects in any ledger.
- Delegate
Fields - Trait providing access to fields specific to Delegate objects in any ledger.
- Deposit
Preauth Fields - Trait providing access to fields specific to DepositPreauth objects in any ledger.
- Directory
Node Fields - Trait providing access to fields specific to DirectoryNode objects in any ledger.
- Escrow
Fields - Trait providing access to fields specific to Escrow objects in any ledger.
- FeeSettings
Fields - Trait providing access to fields specific to FeeSettings objects in any ledger.
- Ledger
Hashes Fields - Trait providing access to fields specific to LedgerHashes objects in any ledger.
- Loan
Broker Fields - Trait providing access to fields specific to LoanBroker objects in any ledger.
- Loan
Fields - Trait providing access to fields specific to Loan objects in any ledger.
- MPToken
Fields - Trait providing access to fields specific to MPToken objects in any ledger.
- MPToken
Issuance Fields - Trait providing access to fields specific to MPTokenIssuance objects in any ledger.
- NFToken
Offer Fields - Trait providing access to fields specific to NFTokenOffer objects in any ledger.
- NFToken
Page Fields - Trait providing access to fields specific to NFTokenPage objects in any ledger.
- NegativeUNL
Fields - Trait providing access to fields specific to NegativeUNL objects in any ledger.
- Offer
Fields - Trait providing access to fields specific to Offer objects in any ledger.
- Oracle
Fields - Trait providing access to fields specific to Oracle objects in any ledger.
- PayChannel
Fields - Trait providing access to fields specific to PayChannel objects in any ledger.
- Permissioned
Domain Fields - Trait providing access to fields specific to PermissionedDomain objects in any ledger.
- Ripple
State Fields - Trait providing access to fields specific to RippleState objects in any ledger.
- Signer
List Fields - Trait providing access to fields specific to SignerList objects in any ledger.
- Sponsorship
Fields - Trait providing access to fields specific to Sponsorship objects in any ledger.
- Ticket
Fields - Trait providing access to fields specific to Ticket objects in any ledger.
- Vault
Fields - Trait providing access to fields specific to Vault objects in any ledger.
- XChain
Owned ClaimID Fields - Trait providing access to fields specific to XChainOwnedClaimID objects in any ledger.
- XChain
Owned Create Account ClaimID Fields - Trait providing access to fields specific to XChainOwnedCreateAccountClaimID objects in any ledger.