How to retrieve number of decimals for custom token (not DOT)?
api.registry.chainDecimals
is for DOT. I need to retrieve it for a custom token.
Substrate and Polkadot Stack Exchange is a question and answer site for developers building blockchains with the Substrate SDK. It only takes a minute to sign up.
Sign up to join this communityYou can query the asset metadata like this:
let asset = await api.query.assets.metadata(0 /* Asset Id */);
console.log("Asset has", asset.decimals, "decimals");