The smartContractEvents field allows us to fetch information about the smart contract events from Tron blockchain.
Here is an example that demonstrates hwo to retrieve events data:
{
tron {
smartContractEvents(
date: {after: "2023-07-25"}
options: {desc: "block.timestamp.iso8601", limit: 10}
) {
arguments {
argument
argumentType
index
value
}
block {
height
timestamp {
iso8601
}
}
smartContract {
address {
address
}
contractType
}
smartContractEvent {
name
signature
signatureHash
}
txHash
txFrom {
address
}
}
}
}
Filtering Smart Contract Events
Smart contract events can be filtered using the following arguments:
any: A catch-all filter (OR Logic) that can be used to filter the results by any of the other fields.date: filter by date of smart contract eventsheight: filter by block height where transaction is includedoptions: filter returned data by ordering, limiting, and constraining itsmartContractAddress: filter by smart contract addresssmartContractEvent: filter by name of the smart contract eventtime: filter by time of the smart contract eventtxFrom: filter by transaction from addresstxHash: filter by transaction hashtxTo: filter by transaction to address
The following fields are available for smartContractEvents:
arguments: returns arguments of callblock: returns block where transaction is includedcount: returns count and other metrics of smart contract eventscountBigInt: returns count and other metrics as BigIntdate: returns date of smart contract eventsexpression: performs arithematic operation on fields in the query and returns value of the operationmaximum: returns maximum for selected measurable field of Tron Eventsminimum: returns minimum for selected measurable field of Tron EventssmartContract: returns smart contract being eventedsmartContractEvent: returns smart contract method invokedtxFrom: returns transaction from addresstxHash: returns transaction hashtxTo: returns transaction to address