Skip to main content

Module objects

Module objects 

Source
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:

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 that tools/generateLedgerObjects.js emits at the bottom of every objects::generated::<entry> file.
traits
Generic ledger-object field accessor traits.

Structs§

AMM
AccountRoot
Amendments
Bridge
Check
Credential
DID
Delegate
DepositPreauth
DirectoryNode
Escrow
FeeSettings
LedgerHashes
Loan
LoanBroker
MPToken
MPTokenIssuance
NFTokenOffer
NFTokenPage
NegativeUNL
Offer
Oracle
PayChannel
PermissionedDomain
RippleState
SignerList
Sponsorship
Ticket
Vault
XChainOwnedClaimID
XChainOwnedCreateAccountClaimID

Traits§

AMMFields
Trait providing access to fields specific to AMM objects in any ledger.
AccountRootFields
Trait providing access to fields specific to AccountRoot objects in any ledger.
AmendmentsFields
Trait providing access to fields specific to Amendments objects in any ledger.
BridgeFields
Trait providing access to fields specific to Bridge objects in any ledger.
CheckFields
Trait providing access to fields specific to Check objects in any ledger.
CredentialFields
Trait providing access to fields specific to Credential objects in any ledger.
CurrentAMMFields
Trait providing access to fields specific to the current AMM object.
CurrentAccountRootFields
Trait providing access to fields specific to the current AccountRoot object.
CurrentAmendmentsFields
Trait providing access to fields specific to the current Amendments object.
CurrentBridgeFields
Trait providing access to fields specific to the current Bridge object.
CurrentCheckFields
Trait providing access to fields specific to the current Check object.
CurrentCredentialFields
Trait providing access to fields specific to the current Credential object.
CurrentDIDFields
Trait providing access to fields specific to the current DID object.
CurrentDelegateFields
Trait providing access to fields specific to the current Delegate object.
CurrentDepositPreauthFields
Trait providing access to fields specific to the current DepositPreauth object.
CurrentDirectoryNodeFields
Trait providing access to fields specific to the current DirectoryNode object.
CurrentFeeSettingsFields
Trait providing access to fields specific to the current FeeSettings object.
CurrentLedgerHashesFields
Trait providing access to fields specific to the current LedgerHashes object.
CurrentLoanBrokerFields
Trait providing access to fields specific to the current LoanBroker object.
CurrentLoanFields
Trait providing access to fields specific to the current Loan object.
CurrentMPTokenFields
Trait providing access to fields specific to the current MPToken object.
CurrentMPTokenIssuanceFields
Trait providing access to fields specific to the current MPTokenIssuance object.
CurrentNFTokenOfferFields
Trait providing access to fields specific to the current NFTokenOffer object.
CurrentNFTokenPageFields
Trait providing access to fields specific to the current NFTokenPage object.
CurrentNegativeUNLFields
Trait providing access to fields specific to the current NegativeUNL object.
CurrentOfferFields
Trait providing access to fields specific to the current Offer object.
CurrentOracleFields
Trait providing access to fields specific to the current Oracle object.
CurrentPayChannelFields
Trait providing access to fields specific to the current PayChannel object.
CurrentPermissionedDomainFields
Trait providing access to fields specific to the current PermissionedDomain object.
CurrentRippleStateFields
Trait providing access to fields specific to the current RippleState object.
CurrentSignerListFields
Trait providing access to fields specific to the current SignerList object.
CurrentSponsorshipFields
Trait providing access to fields specific to the current Sponsorship object.
CurrentTicketFields
Trait providing access to fields specific to the current Ticket object.
CurrentVaultFields
Trait providing access to fields specific to the current Vault object.
CurrentXChainOwnedClaimIDFields
Trait providing access to fields specific to the current XChainOwnedClaimID object.
CurrentXChainOwnedCreateAccountClaimIDFields
Trait providing access to fields specific to the current XChainOwnedCreateAccountClaimID object.
DIDFields
Trait providing access to fields specific to DID objects in any ledger.
DelegateFields
Trait providing access to fields specific to Delegate objects in any ledger.
DepositPreauthFields
Trait providing access to fields specific to DepositPreauth objects in any ledger.
DirectoryNodeFields
Trait providing access to fields specific to DirectoryNode objects in any ledger.
EscrowFields
Trait providing access to fields specific to Escrow objects in any ledger.
FeeSettingsFields
Trait providing access to fields specific to FeeSettings objects in any ledger.
LedgerHashesFields
Trait providing access to fields specific to LedgerHashes objects in any ledger.
LoanBrokerFields
Trait providing access to fields specific to LoanBroker objects in any ledger.
LoanFields
Trait providing access to fields specific to Loan objects in any ledger.
MPTokenFields
Trait providing access to fields specific to MPToken objects in any ledger.
MPTokenIssuanceFields
Trait providing access to fields specific to MPTokenIssuance objects in any ledger.
NFTokenOfferFields
Trait providing access to fields specific to NFTokenOffer objects in any ledger.
NFTokenPageFields
Trait providing access to fields specific to NFTokenPage objects in any ledger.
NegativeUNLFields
Trait providing access to fields specific to NegativeUNL objects in any ledger.
OfferFields
Trait providing access to fields specific to Offer objects in any ledger.
OracleFields
Trait providing access to fields specific to Oracle objects in any ledger.
PayChannelFields
Trait providing access to fields specific to PayChannel objects in any ledger.
PermissionedDomainFields
Trait providing access to fields specific to PermissionedDomain objects in any ledger.
RippleStateFields
Trait providing access to fields specific to RippleState objects in any ledger.
SignerListFields
Trait providing access to fields specific to SignerList objects in any ledger.
SponsorshipFields
Trait providing access to fields specific to Sponsorship objects in any ledger.
TicketFields
Trait providing access to fields specific to Ticket objects in any ledger.
VaultFields
Trait providing access to fields specific to Vault objects in any ledger.
XChainOwnedClaimIDFields
Trait providing access to fields specific to XChainOwnedClaimID objects in any ledger.
XChainOwnedCreateAccountClaimIDFields
Trait providing access to fields specific to XChainOwnedCreateAccountClaimID objects in any ledger.