TRC20 API
In this section we'll have a look at some examples using the TCR20 API.
Tether USD (USDT) Transfers in Realtime
To monitor USDT transfers on Tron in real-time, you can use the following query. You can run the query here
subscription {
Tron {
Transfers(
where: {Transfer: {Currency: {SmartContract: {is: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"}}}}
) {
Transaction {
Hash
}
Transfer {
Amount
Sender
Receiver
Currency {
SmartContract
Symbol
Name
Fungible
Native
}
Id
AmountInUSD
}
Block {
Number
}
}
}
}
USDT TRC20 DEX Trades in Realtime
This query retrieves real-time data on DEX trades involving USDT on the Tron network. It monitors trades where USDT is the bought currency, identified by the smart contract TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
. The subscription provides details about each trade, including the trade timestamp, protocol details, buyer and seller information, trade amounts, and order IDs.
subscription {
Tron {
DEXTrades(
where: {Trade: {Buy: {Currency: {SmartContract: {is: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"}}}}}
) {
Block {
Time
}
Trade {
Dex {
ProtocolName
ProtocolFamily
SmartContract
}
Buy {
Amount
Buyer
Seller
Currency {
Decimals
Fungible
HasURI
Name
ProtocolName
SmartContract
Symbol
}
OrderId
AmountInUSD
}
Sell {
Buyer
Seller
Currency {
Fungible
Decimals
Name
Native
SmartContract
Symbol
}
AmountInUSD
Amount
}
}
}
}
}
You can run the query here
TRC20 Mempool Transfers
This query retrieves real-time data on USDT transfers in the Tron network's mempool by filtering using the smart contract address TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
. The subscription provides details about each pending transfer, including the transaction hash, transfer amount, sender and receiver addresses, and the anticipated block number.
subscription {
Tron(mempool: true) {
Transfers(
where: {Transfer: {Currency: {SmartContract: {is: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"}}}}
) {
Transaction {
Hash
}
Transfer {
Amount
Sender
Receiver
Currency {
SmartContract
Symbol
Name
Fungible
Native
}
Id
AmountInUSD
}
Block {
Number
}
}
}
}