getLedgerEntries
POST
https://triport.io/rpc/stellarReturns ledger entries through Stellar Soroban JSON-RPC.
Stellar mainnetstellar:rpcstellar_read_rpc — 15 / 20 / 100 / 250 RPS (free / basic / pro / business) (default, unmeasured)
Reads current ledger state for base64-encoded XDR ledger keys, including accounts, trustlines, offers, data, claimable balances, liquidity pools, and contract entries.
Use it for the current value of a known key. Use getEvents for retained activity or simulateTransaction for a prospective invocation.
At most 200 keys are accepted. Missing keys are not fabricated in entries; correlate results by key.
Parameters
JSON-RPC params is a by-name object. Only the fields below are defined by the OpenRPC catalog.
keysarray of stringrequiredArray containing the keys of the ledger entries you wish to retrieve. (an array of serialized base64 strings)
xdrFormatstringoptionalLets the user choose the format in which the response should be returned - either as unpacked JSON or as base64-encoded XDR strings. Note that you should not rely on any schema for the JSON, as it will change when the underlying XDR changes.
Response
The response is copied unchanged from the accepted fixture.
resultobjectMethod result object.
result.entriesarray of objectArray of objects containing all found ledger entries
result.entries[].keystringThe LedgerKey corresponding to the ledger entry (base64 string).
result.entries[].lastModifiedLedgerSeqnumberThe ledger sequence number of the last time this entry was updated.
result.entries[].liveUntilLedgerSeqnumberThe ledger sequence number of the ledger that the entry will be live until. May be zero if the entry is no longer live.
result.entries[].xdrstringThe key's current LedgerEntryData value (base64 string).
result.latestLedgernumberThe sequence number of the latest ledger known to Stellar RPC at the time it handled the request.
Errors
Errors use the standard JSON-RPC envelope. See Stellar errors and the shared error reference.
| Code | Meaning | When it happens |
|---|---|---|
-32602 | Invalid params | the by-name object or a field has the wrong type; positional-array style params are rejected. |
-32601 | Method not found | The method is absent from the published Stellar OpenRPC catalog. |
401 | Unauthorized | The API key is missing or invalid. |
429 | Rate limited | The stellar_read_rpc RPS budget is exceeded. |
Examples
JavaScript (fetch)
const request = {
"jsonrpc": "2.0",
"id": 1,
"method": "getLedgerEntries",
"params": {
"keys": [
"AAAAAAAAAAA7mRE4Dv6Yi6CokA6xz+RPNm99vpRr7QdyQPf2JN8VxQ=="
]
}
};
const response = await fetch("https://triport.io/rpc/stellar", {
method: "POST",
headers: {
"x-token": process.env.TRIPORT_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify(request),
});
const payload = await response.json();
if (!response.ok || payload.error) throw new Error(JSON.stringify(payload.error));
console.log(payload.result);Notes
- At most 200 ledger keys are accepted.
- JSON XDR representation can change when underlying XDR changes.
- Related:
getEventsandsimulateTransaction. - This is a read-only surface. No write or transaction-submission method is published.