Contract Events

Mercury provides several queries for fetching contract events. All queries share the same structure and differ only by the entry point:

  • eventByTopic

  • eventByContractId

  • eventByContractIds

  • allContractEvents

Here’s an example GraphQL query using eventByContractId:

query MyQuery {
  eventByContractId(searchedContractId: "CONTRACT_ID") {
    nodes {
      contractId
      data
      topic1
      topic2
      topic3
      topic4
      txInfoByTx {
        ledgerByLedger {
          closeTime
          sequence
        }
        memo
        txHash
        opCount
        fee
      }
    }
  }
}

We recommend experimenting with the GraphiQL endpoint (see Endpoints) to build and test queries tailored to your needs.

Last updated