Terp Network Docs
APIsRpcEvents
GET
/events

Fetch a batch of events posted by the consensus node and matching a specified query string.

The query grammar is defined in pubsub/query/syntax. An empty query matches all events; otherwise a query comprises one or more terms comparing event metadata to target values. For example, to select new block events:

tm.event = 'NewBlock'

Multiple terms can be combined with AND, for example to match the transaction event with a given hash, use:

tm.event = 'Tx' AND tx.hash = 'EA7B33F'

The comparison operators include =, <, <=, >, >=, and CONTAINS. Operands may be strings (in single quotes), numbers, dates, or timestamps. In addition, the EXISTS operator allows you to check for the presence of an attribute regardless of its value.

Tendermint defines a tm.event attribute for all events. Transactions are also assigned tx.hash and tx.height attributes. Other attributes are provided by the application as ABCI Event records. The name of the event in the query is formed by combining the type and attribute key with a period. For example, given:

[]abci.Event{{
    Type: "reward",
    Attributes: []abci.EventAttribute{
        {Key: "address", Value: "cosmos1xyz012pdq"},
        {Key: "amount", Value: "45.62"},
        {Key: "balance", Value: "100.390001"},
    },
}}

the query may refer to the names"reward.address,"reward.amount, and reward.balance, as in:

reward.address EXISTS AND reward.balance > 45

The node maintains a log of all events within an operator-defined time window. The /events method returns the most recent items from the log that match the query. Each item returned includes a cursor that marks its location in the log. Cursors can be passed via the before and after parameters to fetch events earlier in the log.

Query Parameters

filter?

Event filter query

maxItems?integer
after?string
before?string
waitTime?integer

Response Body

application/json

application/json

curl -X GET "https://rpc.terp.network/events"
{
  "id": 0,
  "jsonrpc": "2.0",
  "items": [
    {
      "cursor": "0005d7c09065e9a7-01cf",
      "data": {
        "type": "tendermint/event/Tx",
        "value": "string"
      }
    }
  ],
  "more": true,
  "oldest": "0005d7c09065e9a7-01cf",
  "newest": "0005d7c090660099-0200"
}
{
  "id": 0,
  "jsonrpc": "2.0",
  "error": "Description of failure"
}