The contracts field allows us to fetch details about contract from Tron blockchain.
Here is an example that demonstrates how to use contracts query:
{
tron {
contracts(
date: {after: "2023-07-26"}
options: {desc: "block.timestamp.iso8601", limit: 10}
) {
block {
timestamp {
iso8601
}
}
amount
contractType
currency {
address
name
symbol
}
energyUsageTotal
fee
netUsage
txHash
txOwner {
address
annotation
}
}
}
}
Fileting Contracts
Contracts can be filtered using the following arguments:
any:contracType: filter by contract typecurrency: filter by currency of transferdate: filter by date of transferheight: filter by block heightoptions: filter returned data by ordering, limiting, and constraining it.success: filter by success of a calltime: filter by time of transactiontxHash: filter by transaction hashtxOwner: filter by address of transaction owner
The following fields are available for the contracts:
amount: returns amount of currency transferredany:block: returns block in which transaction is includedcontractType: returns contract typecount: returns count and other metrics of contractscountBigInt: returns count and other metrics as BigIntcurrency: returns currency detailsdate: returns date of the transactionenergyUsageTotal: returns total energy usageexpression: performs arithematic operation on fields in the query and returns value of the operationfee: returns fee consumedmaximum: returns maximum for selected measurable field of Tron contractsminimum: returns maximum for selected measurable field of Tron contractsnetUsage: returns net usagessuccess: returns is call was successful or nottxHash: returns transaction hashtxOwner: returns address of transaction owner