Get token info

Gets information about a token instance. The token info query returns the following information:

Item

Description

TokenId

ID of the token instance

Name

The name of the token. It is a string of ASCII only characters

Symbol

The symbol of the token. It is a UTF-8 capitalized alphabetical string

Decimals

The number of decimal places a token is divisible by

Total Supply

The total supply of tokens that are currently in circulation

Treasury

The ID of the account which is set as Treasury

Admin Key

The key which can perform update/delete operations on the token. If empty, the token can be perceived as immutable (not being able to be updated/deleted)

KYC Key

The key which can grant or revoke KYC of an account for the token's transactions. If empty, KYC is not required, and KYC grant or revoke operations are not possible.

Freeze Key

The key which can freeze or unfreeze an account for token transactions. If empty, freezing is not possible

Wipe Key

The key which can wipe token balance of an account. If empty, wipe is not possible

Supply Key

The key which can change the supply of a token. The key is used to sign Token Mint/Burn operations

Default Freeze Status

The default Freeze status (not applicable = null, frozen = false, or unfrozen = true) of Hedera accounts relative to this token. FreezeNotApplicable is returned if Token Freeze Key is empty. Frozen is returned if Token Freeze Key is set and defaultFreeze is set to true. Unfrozen is returned if Token Freeze Key is set and defaultFreeze is set to false.

FreezeNotApplicable = null;

Frozen = false;

Unfrozen = true;

Default KYC Status

The default KYC status (KycNotApplicable or Revoked) of Hedera accounts relative to this token. KycNotApplicable is returned if KYC key is not set, otherwise Revoked.

KycNotApplicable = null;

Granted = false;

Revoked = true;

Auto Renew Account

An account which will be automatically charged to renew the token's expiration, at autoRenewPeriod interval

Auto Renew Period

The interval at which the auto-renew account will be charged to extend the token's expiry

Expiry

The epoch second at which the token will expire; if an auto-renew account and period are specified, this is coerced to the current epoch second plus the autoRenewPeriod

Constructor

Description

new TokenInfoQuery()

Initializes the TokenInfoQuery object

new TokenInfoQuery()

Methods

V2
V1
V2

Method

Type

Requirement

setTokenId(<tokenId>)

TokenId

Required

<TokenInfoQuery>.tokenId

TokenId

Optional

<TokenInfoQuery>.name

String

Optional

<TokenInfoQuery>.symbol

String

Optional

<TokenInfoQuery>.decimals

int

Optional

<TokenInfoQuery>.totalSupply

long

Optional

<TokenInfoQuery>.treasury

AccountId

Optional

<TokenInfoQuery>.adminKey

PublicKey

Optional

<TokenInfoQuery>.kycKey

PublicKey

Optional

<TokenInfoQuery>.freezeKey

PublicKey

Optional

<TokenInfoQuery>.wipeKey

PublicKey

Optional

<TokenInfoQuery>.supplyKey

PublicKey

Optional

<TokenInfoQuery>.defaultFreezeStatus

Boolean

Optional

<TokenInfoQuery>.defaultKycStatus

Boolean

Optional

<TokenInfoQuery>.isDeleted

Boolean

Optional

<TokenInfoQuery>.autoRenewAccount

AccountId

Optional

<TokenInfoQuery>.autoRenewPeriod

Duration

Optional

<TokenInfoQuery>.expiry

Instant

Optional

Java
//Create the query
TokenInfoQuery query = new TokenInfoQuery()
.setTokenId(newTokenId);
//Sign with the client operator private key, submit the query to the network and get the token supply
long tokenSupply = query.execute(client).totalSupply;
System.out.println("The token info is " +tokenSupply);
JavaScript
//Create the query
const query = new TokenInfoQuery()
.setTokenId(newTokenId);
//Sign with the client operator private key, submit the query to the network and get the token supply
const tokenSupply = await query.execute(client).totalSupply;
console.log("The total supply of this token is " +tokenSupply);
//v2.0.7
Go
//Create the query (issue logged)
query := hedera.NewTokenInfoQuery().
SetTokenID(tokenId)
//Sign with the client operator private key and submit to a Hedera network
tokenInfo, err := query.Execute(client)
if err != nil {
panic(err)
}
fmt.Printf("The token info is %v\n", tokenIinfo)
//v2.1.0
V1

Method

Type

Requirement

setTokenId(<tokenId>)

TokenId

Required

<TokenInfoQuery>.tokenId

TokenId

Optional

<TokenInfoQuery>.name

String

Optional

<TokenInfoQuery>.symbol

String

Optional

<TokenInfoQuery>.decimals

int

Optional

<TokenInfoQuery>.totalSupply

long

Optional

<TokenInfoQuery>.treasury

AccountId

Optional

<TokenInfoQuery>.adminKey

PublicKey

Optional

<TokenInfoQuery>.kycKey

PublicKey

Optional

<TokenInfoQuery>.freezeKey

PublicKey

Optional

<TokenInfoQuery>.wipeKey

PublicKey

Optional

<TokenInfoQuery>.supplyKey

PublicKey

Optional

<TokenInfoQuery>.defaultFreezeStatus

Boolean

Optional

<TokenInfoQuery>.defaultKycStatus

Boolean

Optional

<TokenInfoQuery>.isDeleted

Boolean

Optional

<TokenInfoQuery>.autoRenewAccount

AccountId

Optional

<TokenInfoQuery>.autoRenewPeriod

Duration

Optional

<TokenInfoQuery>.expiry

Instant

Optional

Java
//Create the query
TokenInfoQuery tokenInfo = new TokenInfoQuery()
.setTokenId(newTokenId);
//Submit the query to the network and obtain the token supply
long totalSupply = tokenInfo.execute(client).totalSupply;
System.out.println("The total supply of this token is " +totalSupply)
//Version: 1.2.2
JavaScript (Not working)
//Create the query
const tokenInfo = new TokenInfoQuery()
.setTokenId(newTokenId);
//Submit the query to the network and obtain the token supply
const totalSupply = await tokenInfo.execute(client).totalSupply;
console.log("The total supply of this token is " +totalSupply)
//Version 1.4.3