The smartContractCalls field allows us to fetch details about the blocks from the Tron blockchain.
Here is an example that demonstrates how to fetch smart contract calls data:
{
tron {
smartContractCalls(
date: {after: "2023-07-25"}
options: {desc: "block.timestamp.iso8601", limit: 10}
) {
amount
arguments {
argument
argumentType
index
value
}
block {
timestamp {
iso8601
}
}
callDepth
energyUsageTotal
fee
netUsage
smartContract {
contractType
address {
address
annotation
}
}
smartContractMethod {
name
signature
signatureHash
}
txHash
}
}
}
Filtering Smart Contract Calls
Smart contract calls can be filtered using the following arguments:
any:date: filter by date of the smart contract callsexternal: filter by external or internal smart contract callsheight: filter by block heightoptions: filter returned data by ordering, limiting, and constraining itsmartContractAddress: filter by smart contract address being calledsmartContractMethod: filter by smart contract method being calledsuccess: filter by success of the calltime: filter by time on which smart contract call was madetxFrom: filter by action from addresstxHash: filter by transaction hash where transfer happenedtxTo: filter by action to address
The following fields are available for smartContractCalls:
amount: returns amount of currencyany:arguments: returns amount of smart contract callsblock: returns block where transaction is includedcallDepth: returns call depthcount: returns count and other metrics of smart contract callscountBigInt: returns count and other metrics asBigIntdate: returns date of smart contract callsenergyUsageTotal: returns total energy usage for smart contract callsexpression: performs arithematic operation on fields in the query and returns value of the operationexternal: returns if calls is external or internalfee: returns fee consumed by smart contract callmaximum: returns maximum for selected measurable field of Tron callsminimum: returns minimum for selected measurable field of Tron callsnetUsage: returns net energy usage of smart contract callsmartContract: returns details of smart contract being calledsmartContractMethod: returns details of smart contract method being calledsuccess: returns if call was success or nottxFrom: returns transaction from addresstxTo: returns transaction to address