ledger_data
Retrieves contents of the specified ledger's state tree. You can iterate through several calls with the returned marker to retrieve the entire contents of a single ledger version.
This method will use 40 Compute Units.
Reference: Here
Parameters
ledger_hash(string, optional) The hash of the ledger version to use.ledger_index(number or string, optional) The ledger index of the ledger to use, or a shortcut string such asvalidated.binary(boolean, optional) Iftrue, return ledger entries as hexadecimal strings instead of JSON. The default isfalse.limit(number, optional) Limit the number of ledger entries to retrieve. Cannot be more than 2048 (binary) or 256 (JSON).marker(marker, optional) Value from a previous paginated response. Resume retrieving data where that response left off.type(string, optional) Filter results to a specific type of ledger entry, such asaccount,amm,offer,state,nft_pageorpayment_channel.
Returns
ledger(object) The complete ledger header data for this ledger version.ledger_index(unsigned integer) The ledger index of this ledger version.ledger_hash(string) Unique identifying hash of this ledger version.state(array) Array of ledger entries from the ledger's state tree. In JSON mode each hasLedgerEntryType,indexand the fields for that entry type; in binary mode each hasdataandindex.marker(marker) Server-defined value indicating the response is paginated. Pass this to the next call to resume.
Over WebSocket, send {"id":1,"command":"ledger_data","ledger_index":"validated","limit":2} to wss://mainnet.xrpl.validationcloud.io/v1/<YOUR_API_KEY_HERE>.
With a
typefilter the server still scanslimitentries per call and returns only the matching ones, so a page can come back with an emptystatearray and amarker. Keep paging with the marker.
Last updated
Was this helpful?