TriportRPC

getLatestLedger

POSThttps://triport.io/rpc/stellar

Returns latest known ledger through Stellar Soroban JSON-RPC.

Stellar mainnetstellar:rpcstellar_read_rpc — 15 / 20 / 100 / 250 RPS (free / basic / pro / business) (default, unmeasured)

Returns the newest ledger known to the selected node, including sequence, identifier, close time, and protocol version.

Use it for a compact chain-head marker. Use getLedgers for retained history or getHealth for the oldest retained boundary.

Optional header and metadata XDR fields are described from the OpenRPC schema even when absent from the fixture.

Parameters

JSON-RPC params is a by-name object. Send an empty object ({}); this method defines no parameters.

optional
No method parameters.

Response

The response is copied unchanged from the accepted fixture.

resultobject
Method result object.
result.closeTimestring
The timestamp at which the latest ledger was closed.
result.headerXdrstring
The LedgerHeader structure for this ledger (base64-encoded string).
result.idstring
Hash identifier of the latest ledger (as a hex-encoded string) known to Stellar RPC at the time it handled the request.
result.metadataXdrstring
The LedgerCloseMeta union for this ledger (base64-encoded string).
result.protocolVersionnumber
Stellar Core protocol version associated with the latest ledger.
result.sequencenumber
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": "getLatestLedger",
  "params": {}
};
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

  • closeTime is a string in the schema.
  • XDR fields depend on the selected node response and representation.
  • Related: getHealth and getLedgers.
  • This is a read-only surface. No write or transaction-submission method is published.