TriportRPC

getLedgerEntries

POSThttps://triport.io/rpc/stellar

Returns 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 stringrequired
Array containing the keys of the ledger entries you wish to retrieve. (an array of serialized base64 strings)
xdrFormatstringoptional
Lets 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.

resultobject
Method result object.
result.entriesarray of object
Array of objects containing all found ledger entries
result.entries[].keystring
The LedgerKey corresponding to the ledger entry (base64 string).
result.entries[].lastModifiedLedgerSeqnumber
The ledger sequence number of the last time this entry was updated.
result.entries[].liveUntilLedgerSeqnumber
The 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[].xdrstring
The key's current LedgerEntryData value (base64 string).
result.latestLedgernumber
The 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.

CodeMeaningWhen it happens
-32602Invalid paramsthe by-name object or a field has the wrong type; positional-array style params are rejected.
-32601Method not foundThe method is absent from the published Stellar OpenRPC catalog.
401UnauthorizedThe API key is missing or invalid.
429Rate limitedThe 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: getEvents and simulateTransaction.
  • This is a read-only surface. No write or transaction-submission method is published.