
Tronscan client
Client for receiving blockchain data through block explorers (in particular, tronscan).
At the moment, the number of available methods is limited to those indicated in the examples below:
Donation
To support this project, you can send crypto to:
- 0x3F2f0098310e654040f7794AB7E44Ac48E0eaF7B
- TLPh66vQ2QMb64rG3WEBV5qnAhefh2kcdw
Create client instance
import { TronScanClient } from 'tronscan-client';
const tronScanClient = new TronScanClient({
url: 'https://apilist.tronscanapi.com/api',
apiKey: 'your_api_key_from_tronscan_cabinet'
});
const ADDRESS = 'tron_address';
const FROM_ADDRESS = 'from_address';
const TOKEN_ADDRESS = 'token_address';
const START_TIMESTAMP = 1514764800000;
const response = await tronScanClient.getAccountList();
console.log(response.data);
const account = await tronScanClient.getAccountDetailInformation({
address: ADDRESS
});
console.log(account);
const accountTokensList = await tronScanClient.getTokenList({
address: ADDRESS
});
console.log(accountTokensList);
const votedList = await tronScanClient.getVotedList({
candidate: ADDRESS
});
console.log(votedList.data);
const resourcesList = await tronScanClient.getAccountResourcesList({
address: ADDRESS
});
console.log(resourcesList.data);
const resourcesStake2List = await tronScanClient.getAccountResourcesStake2List({
address: ADDRESS
});
console.log(resourcesStake2List.data);
const approvalList = await tronScanClient.getApprovalList({
address: ADDRESS
});
console.log(approvalList);
const accountAccessChangeRecords = await tronScanClient.getAccountAuthChangeRecords({
contract_address: TOKEN_ADDRESS,
from_address: FROM_ADDRESS,
to_address: ADDRESS,
type: 'approve'
});
console.log(accountAccessChangeRecords);
const accountDailyAnalytics = await tronScanClient.getAccountDailyAnalytics({
address: ADDRESS,
start_timestamp: START_TIMESTAMP
});
console.log(accountDailyAnalytics);
const projectParticipateInfo = await tronScanClient.getAccountParticipateProject({
address: ADDRESS
});
console.log(projectParticipateInfo);
const tokenOverview = await tronScanClient.getAccountWalletTokenOverview({
address: ADDRESS
});
console.log(tokenOverview);
const otherChainInfo = await tronScanClient.findAddressOnOtherChain({
address: ADDRESS
});
console.log(otherChainInfo);
const CONTRACT_ADDRESS = 'contract_address';
const contractsList = await tronScanClient.getListOfContracts();
console.log(contractsList);
const contractDetailInformation = await tronScanClient.getContractDetailInformation({
contract: CONTRACT_ADDRESS
});
console.log(contractDetailInformation);
const contractEventInfo = await tronScanClient.getContractEventInformation({
contractAddress: CONTRACT_ADDRESS
});
console.log(contractEventInfo);
const energyStatistics = await tronScanClient.getContractEnergyStatistics({
address: CONTRACT_ADDRESS
});
console.log(energyStatistics);
const callStatistics = await tronScanClient.getContractCallStatistics({
contract_address: CONTRACT_ADDRESS
});
console.log(callStatistics);
const uniqueAddressCount = await tronScanClient.getContractUniqueAddressesNumberPerDay({
address: CONTRACT_ADDRESS
});
console.log(uniqueAddressCount);
const callsNumber = await tronScanClient.getContractCallsNumberPerDay({
address: CONTRACT_ADDRESS
});
console.log(callsNumber);
const dailyAnalytics = await tronScanClient.getContractDailyAnalyticsList({
address: CONTRACT_ADDRESS
});
console.log(dailyAnalytics);
const callersList = await tronScanClient.getContractCallersList({
address: CONTRACT_ADDRESS
});
console.log(callersList);
const triggerTransactions = await tronScanClient.getTriggerTransactionsList();
console.log(triggerTransactions);
Some of these methods may work incorrectly (tx search methods), but you can use undocumented methods like getTrxTransfers,
getTrc10Transfers or getTrc20Transfers instead.
const ADDRESS = 'tron_address';
const START_TIMESTAMP = 1715855574000;
const END_TIMESTAMP = 1715855574000;
const CONTRACT_ADDRESS = 'contract_address';
const response = await tronScanClient.getTransactionsList({
address: ADDRESS
});
const txs = response.data;
console.log(txs);
const [tx] = txs;
const txDetails = await tronScanClient.getTransactionDetailByHash({
hash: tx.hash
});
console.log(txDetails);
const trc20Trc721TsList = await tronScanClient.getTrc20Trc721TransferList({
relatedAddress: ADDRESS
});
console.log(trc20Trc721TsList);
const trc1155TransfersList = await tronScanClient.getTrc1155TransferList({
relatedAddress: ADDRESS
});
console.log(trc1155TransfersList);
const trxTrx10TxList = await tronScanClient.getTrxTrc10TransferList({
address: ADDRESS,
start_timestamp: START_TIMESTAMP,
end_timestamp: END_TIMESTAMP
});
console.log(trxTrx10TxList);
const internalTxList = await tronScanClient.getInternalTxListForAddressOrBlock({
address: ADDRESS
});
console.log(internalTxList);
const accountTxData = await tronScanClient.getAccountTransactionData({
address: ADDRESS,
trc20Id: CONTRACT_ADDRESS
});
console.log(accountTxData);
const txStatisticsData = await tronScanClient.getTxsStatisticData();
console.log(txStatisticsData);
const distributionStatistics = await tronScanClient.getTransferDistributionStatisticData();
console.log(distributionStatistics);
const eligibleExchangeData = await tronScanClient.getEligibleExchangeTypeTransactions();
console.log(eligibleExchangeData);
const blocks = await tronScanClient.getBlocks();
console.log(blocks);
const statInfo = await tronScanClient.getBlocksStatisticalInformation();
console.log(statInfo);
const TOKEN_ID = 'token_id';
const TOKEN_ADDRESS = 'token_address';
const ISSUER_ADDRESS = 'issuer_address';
const TRC1155_TOKEN_ADDRESS = 'trc1155_token_address';
const tokensList = await tronScanClient.getTokensList();
console.log(tokensList);
const tokensDetails = await tronScanClient.getTrc20Trc721Trc1155TokensDetails({
contract: TOKEN_ADDRESS
});
console.log(tokensDetails);
const allTrc10TokensDetails = await tronScanClient.getDetailsOfAllTrc10Tokens();
console.log(allTrc10TokensDetails);
const tokenHolders = await tronScanClient.getTrc20Trc721Trc1155TokenHolders({
contract_address: TOKEN_ADDRESS
});
console.log(tokenHolders);
const trc10TokenHolders = await tronScanClient.getTrc10TokenHolders({
address: ISSUER_ADDRESS
});
console.log(trc10TokenHolders);
const tokenAmountDistribution = await tronScanClient.getTokenAmountDistributionByHolders({
tokenId: TOKEN_ADDRESS
});
console.log(tokenAmountDistribution);
const tokenPriceInfo = await tronScanClient.getSpecificTokenPriceInfo();
console.log(tokenPriceInfo);
const pricedTokensList = await tronScanClient.getPricedTokensList();
console.log(pricedTokensList);
const trc721TransfersList = await tronScanClient.getTransfersListOfOneTrc721TokenId({
contract: TOKEN_ADDRESS,
tokenId: TOKEN_ID
});
console.log(trc721TransfersList);
const trc10TrxTxsInfo = await tronScanClient.getOneTrc10TrxTransferInfo();
console.log(trc10TrxTxsInfo);
const trc1155InventoryInfo = await tronScanClient.getTrc1155InventoryInformation({
contract: TRC1155_TOKEN_ADDRESS
});
console.log(trc1155InventoryInfo);
const trc1155HoldingInfo = await tronScanClient.getTrc1155HoldingInformation({
contract: TRC1155_TOKEN_ADDRESS,
tokenId: TOKEN_ID
});
console.log(trc1155HoldingInfo);
const trc20Circulation = await tronScanClient.getTrc20TokenCirculation({
address: TOKEN_ADDRESS
});
console.log(trc20Circulation);
const trc721InventoryInfo = await tronScanClient.getTrc721InventoryInformation({
contract: TOKEN_ADDRESS
});
console.log(trc721InventoryInfo);
import { TronScanWitnessType } from 'tronscan-client';
const ADDRESS = 'tron_address';
const witnessList = await tronScanClient.getWitnessList({
witnesstype: TronScanWitnessType.Witness
});
console.log(witnessList);
const accountVotesList = tronScanClient.getWitnessList({
address: ADDRESS
});
console.log(accountVotesList);
const ADDRESS = 'tron_address';
const TRC10_TOKEN_ID = 'trc10_token_id';
const TRC20_TOKEN_ID = 'trc20_token_id';
const walletTrxTxList = await tronScanClient.getWalletTrxTransfersList({
address: ADDRESS
});
console.log(walletTrxTxList);
const walletTrc10TxList = await tronScanClient.getWalletTrc10TransfersList({
address: ADDRESS,
trc10Id: TRC10_TOKEN_ID
});
console.log(walletTrc10TxList);
const walletTrc20TxList = await tronScanClient.getWalletTrc20TransfersList({
address: ADDRESS,
trc20Id: TRC20_TOKEN_ID
});
console.log(walletTrc20TxList);
const walletTokens = await tronScanClient.getWalletTokensInformation({
address: ADDRESS
});
console.log(walletTokens);
const unfreezableTrxAmount = await tronScanClient.getWalletUnfreezableTrxAmount({
address: ADDRESS
});
console.log(unfreezableTrxAmount);
const ADDRESS = 'tron_address';
const TOKEN_ADDRESS = 'token_address';
const TX_HASH = 'some_tx_hash';
const URL = 'www.google.com.hk';
const accountSecurity = await tronScanClient.checkAccountSecurity({
address: ADDRESS
});
console.log(accountSecurity);
const tokenSecurity = await tronScanClient.checkTokenSecurity({
address: TOKEN_ADDRESS
});
console.log(tokenSecurity);
const urlSecurity = await tronScanClient.checkUrlSecurity({
url: URL
});
console.log(urlSecurity);
const txsSecurity = await tronScanClient.checkTransactionsSecurity({
hashes: TX_HASH
});
console.log(txsSecurity);
const multiSignSecurity = await tronScanClient.checkMultiSignSecurity({
address: ADDRESS
});
console.log(multiSignSecurity);
const accountAuthSecurity = await tronScanClient.checkAccountAuthSecurity({
address: ADDRESS
});
console.log(accountAuthSecurity);
const tokensList = await tronScanClient.getAllTokens({
limit: 1,
start: 0
});
console.log(tokensList);
You can find this method through developer tools in tronscan cabinet.
const ADDRESS = 'tron_address';
const CONTRACT_ADDRESS = 'contract_address';
const trxTransfers = await tronScanClient.getTrxTransfers({
address: ADDRESS
});
console.log(trxTransfers);
const trc19Transfers = await tronScanClient.getTrc10Transfers({
address: ADDRESS
});
console.log(trc19Transfers);
const trc20Transfers = await tronScanClient.getTrc20Transfers({
relatedAddress: ADDRESS,
contract_address: CONTRACT_ADDRESS
});
console.log(trc20Transfers);
Supported networks table
You must use the API key!!!
Just register an account on tronscan.org and generate an API key.