Skip to content

Latest commit

 

History

History
67 lines (47 loc) · 8.05 KB

get-token-info.md

File metadata and controls

67 lines (47 loc) · 8.05 KB

Get token info

Gets information about a fungible or non-fungible token instance.

Query Fees

  • Please see the transaction and query fees table for the base transaction fee.
  • Please use the Hedera fee estimator to estimate the cost of your query fee.

The token info query returns the following information:

ItemDescription
TokenIdID of the token instance
Token TypeThe type of token (fungible or non-fungible)
NameThe name of the token. It is a string of ASCII only characters
SymbolThe symbol of the token. It is a UTF-8 capitalized alphabetical string
DecimalsThe number of decimal places a token is divisible by
Total SupplyThe total supply of tokens that are currently in circulation
TreasuryThe ID of the account which is set as Treasury
Custom FeesThe custom fee schedule of the token, if any
Fee Schedule KeyFee schedule key, if any
Admin KeyThe 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 KeyThe 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 KeyThe key which can freeze or unfreeze an account for token transactions. If empty, freezing is not possible
Wipe KeyThe key which can wipe token balance of an account. If empty, wipe is not possible
Supply KeyThe key which can change the supply of a token. The key is used to sign Token Mint/Burn operations
Pause KeyThe key that can pause or unpause the token from participating in transactions.
Pause Status

Whether or not the token is paused.

false = not paused

true = paused

Max SupplyThe max supply of the token
Supply TypeThe supply type of the token
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 = true;

Unfrozen = false;

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 AccountAn account which will be automatically charged to renew the token's expiration, at autoRenewPeriod interval
Auto Renew PeriodThe interval at which the auto-renew account will be charged to extend the token's expiry
ExpiryThe 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
Ledger IDThe ID of the network the response came from. See HIP-198.
MemoShort publicly visible memo about the token, if any
Metadata KeyThe key which can change the metadata of a token definition or individual NFT.
MetadataThe metadata for the token.

Methods

MethodTypeRequirement
setTokenId(<tokenId>)TokenIdRequired
<TokenInfo>.tokenIdTokenIdOptional
<TokenInfo>.nameStringOptional
<TokenInfo>.symbolStringOptional
<TokenInfo>.decimalsintOptional
<TokenInfo>.customFeesList<CustomFee>Optional
<TokenInfo>.totalSupplylongOptional
<TokenInfo>.treasuryAccountIdAccountIdOptional
<TokenInfo>.adminKeyKeyOptional
<TokenInfo>.kycKeyKeyOptional
<TokenInfo>.freezeKeyKeyOptional
<TokenInfo>.feeScheduleKeyKeyOptional
<TokenInfo>.wipeKeyKeyOptional
<TokenInfo>.supplyKeyKeyOptional
<TokenInfo>.defaultFreezeStatusbooleanOptional
<TokenInfo>.defaultKycStatusbooleanOptional
<TokenInfo>.isDeletedbooleanOptional
<TokenInfo>.tokenTypeTokenTypeOptional
<TokenInfo>.supplyTypeTokenSupplyTypeOptional
<TokenInfo>.maxSupplylongOptional
<TokenInfo>.pauseKeyKeyOptional
<TokenInfo>.pauseStatusbooleanOptional
<TokenInfo>.autoRenewAccountAccountIdOptional
<TokenInfo>.autoRenewPeriodDurationOptional
<TokenInfo>.ledgerIdLedgerIdOptional
<TokenInfo>.expiryInstantOptional
<TokenInfo>.metadatabytesOptional

{% tabs %} {% tab title="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);

//v2.0.14

{% endtab %}

{% tab title="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

{% endtab %}

{% tab title="Go" %}

//Create the query
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", tokenInfo)

//v2.1.0

{% endtab %} {% endtabs %}