Class: XRPL::LedgerEntry
Overview
A ledger entry - AccountRoot, RippleState, Offer, Escrow and the other objects that make up the ledger's state - built from LEDGER_ENTRY_FORMATS in definitions.json, the same way XRPL::Transaction is built from TRANSACTION_FORMATS.
entry = XRPL::LedgerEntry.from(response.dig('result', 'node'))
entry.class # => XRPL::LedgerEntry::AccountRoot
entry.balance # => "370000000"
entry.flag?(:lsf_default_ripple)
entry.flag_names # => ["lsfDefaultRipple"]
Where rippled hands out the entry's own hash under "index" (ledger_entry, account_objects, ledger_data), that value is kept as #index; it is not a field of the object and is left out of #to_h.
Constant Summary collapse
- COMMON_FORMAT =
Fields every ledger entry carries, regardless of type.
DEFINITIONS['LEDGER_ENTRY_FORMATS'].fetch('common').freeze
- FLAG_ALIASES =
LEDGER_ENTRY_FLAGS keys DirectoryNode's flags under rippled's short name for the type.
{ 'DirectoryNode' => 'DirNode' }.freeze
Constants inherited from Model
Model::ACCESSOR_TO_FIELD, Model::DEFAULT, Model::DEFINITIONS, Model::FIELD_TO_ACCESSOR, Model::OPTIONAL, Model::REQUIRED
Instance Attribute Summary collapse
-
#index ⇒ Object
The entry's hash, as rippled reports it under "index".
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Model
#==, #[], define_types!, #flag?, flag_bit, #flag_names, for, from, #hash, #initialize, #inspect, #missing_fields, resolve, supplied_later, #to_blob, #to_h, underscore, #valid?, #validate!
Constructor Details
This class inherits a constructor from XRPL::Model
Instance Attribute Details
#index ⇒ Object
The entry's hash, as rippled reports it under "index".
27 28 29 |
# File 'lib/xrpl/ledger_entry.rb', line 27 def index @index end |
Class Method Details
.label ⇒ Object
37 38 39 |
# File 'lib/xrpl/ledger_entry.rb', line 37 def label 'ledger entry' end |
.type_field ⇒ Object
33 34 35 |
# File 'lib/xrpl/ledger_entry.rb', line 33 def type_field 'LedgerEntryType' end |
Instance Method Details
#[]=(name, value) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/xrpl/ledger_entry.rb', line 42 def []=(name, value) if name.to_s == 'index' @index = value return end super end |