TriportRPC

getEvents

Stellar / https://triport.io/rpc/stellar

Minimum tier: Pro

Stellar method guide

Last updated:

Returns contract and system events matching a ledger range and optional contract, topic, or type filters.

Use it for event ingestion and deduplicate retries by event id. Use getTransactions when envelopes and execution results are required.

Both measured Soroban nodes retained 120,960 ledgers. Check getHealth before choosing a historical start.

Parameters

getEvents parameters
NameTypeRequiredDescription
startLedgernumberNoLedger sequence number to start fetching responses from (inclusive). This method will return an error if `startLedger` is less than the oldest ledger stored in this node, or greater than the latest ledger seen by this node. If a cursor is included in the request, `startLedger` must be omitted.
endLedgernumberNoLedger sequence number represents the end of search window (exclusive). If a cursor is included in the request, `endLedger` must be omitted.
filtersarrayNoList of filters for the returned events. Events matching any of the filters are included. To match a filter, an event must match both a contractId and a topic. Maximum 5 filters are allowed per request.
paginationobjectNoPagination in stellar-rpc is similar to pagination in Horizon. See [Pagination](https://developers.stellar.org/docs/data/rpc/api-reference/structure/pagination).
xdrFormatstringNoLets 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.

Returns

getEvents return value
FieldType
getEventsResultobject

Examples

curl https://triport.io/rpc/stellar \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"jsonrpc":"2.0","id":1,"method":"getEvents","params":["<startLedger>","<endLedger>","<filters>","<pagination>","<xdrFormat>"]}'
const res = await fetch("https://triport.io/rpc/stellar", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
  body: JSON.stringify({
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getEvents",
  "params": [
    "<startLedger>",
    "<endLedger>",
    "<filters>",
    "<pagination>",
    "<xdrFormat>"
  ]
}),
});
const data = await res.json();
import requests
resp = requests.post(
    "https://triport.io/rpc/stellar",
    headers={"Authorization": "Bearer <api-key>"},
    json={"jsonrpc":"2.0","id":1,"method":"getEvents","params":["<startLedger>","<endLedger>","<filters>","<pagination>","<xdrFormat>"]},
)
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Chain: Stellar.
  3. Clusters: mainnet.
  4. Credit cost: 5 per call.

FAQ

What does getEvents do?
Returns contract events through Stellar Soroban JSON-RPC.
How many credits does getEvents cost?
getEvents costs 5 credit(s) per call on Triport by default.
Is getEvents available over WebSocket?
getEvents is an HTTP JSON-RPC method.