tronprotocol / tronweb

Javascript API Library for interacting with the TRON Network
MIT License
423 stars 271 forks source link

get total supply TRX #400

Closed Melekhin closed 1 year ago

Melekhin commented 1 year ago

Hello!

Is there any way to get the total supply of a TRX token?

I found how to get for TRC20 tokens using a contract, but the native token has no contract. for get total supply by contract address

  const contractInstance = await tronWeb.contract(CONTRACTS.TRON.USDT.abi, CONTRACTS.TRON.USDT.address);
  const totalSupply = await contractInstance.totalSupply().call();

I use tronWeb v 5.2.0

unicornonea commented 1 year ago

As far as we know, the total supply of TRX cannot be directly obtained from the TRON network because it is the native token. You can check the data statistics on the tronscan website here, which displays the total supply of TRX.

Melekhin commented 1 year ago

As far as we know, the total supply of TRX cannot be directly obtained from the TRON network because it is the native token. You can check the data statistics on the tronscan website here, which displays the total supply of TRX.

Thank you! I was assuming there was a separate method for getting it..... I will get this value then, as you indicated, via one of the queries on the tronscan website.