TON DocsTON Docs
OnboardingNodesApplicationsAPIsContractsSmart contractsTolkTolk languageTVMTON Virtual MachineFoundationsBlockchain foundations

How to get jetton supply data

To retrieve jetton-specific data, use the jetton master contract's get_jetton_data() method.

This method returns the following data:

NameTypeDescription
total_supplyVarUInteger 16the total number of issued jettons measured in indivisible units
mintableBoolIndicates whether new jettons can be minted (-1 for true, 0 for false)
admin_addressAddressadmin's address
jetton_contentCelldata formatted according to TEP-64
jetton_wallet_codeCella code of the corresponding Jetton wallet

Call the get_jetton_data() method from TypeScript by using an API wrapper in @ton/ton:

import { TonClient, Address } from "@ton/ton";

async function main() {
  const client = new TonClient({
    endpoint: 'https://toncenter.com/api/v2/jsonRPC',
  });
  const JettonMasterAddress = Address
    .parse('0:b113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe');

  const data = await client.runMethod(JettonMasterAddress, 'get_jetton_data');
  const Stack = data.stack;

  // Total supply
  console.log(Stack.readNumber());

  // Mintable flag
  console.log(Stack.readNumber());

  // Admin address
  console.log(Stack.readAddress().toString());

  // jetton_content
  console.log(Stack.readCell());

  // jetton_wallet_code
  console.log(Stack.readCell());
}

void main();

Or call it through a blockchain explorer:

Finally, one can obtain this information by directly using the APIs.