Denom Client (deprecated)
This is deprecated, refer to the injective-list guide instead.
The easiest way to get the token metadata information for a particular denom is to utilize the TokenFactory class and use its methods:
There are few edge cases that we have to consider while using the `TokenFactory`:
If you are trying to query token metadata for a denom that doesn't exist in thelist of tokenstheTokenFactorywill return undefined. If so, you should follow ourCONTRIBUTION guideto add the token metadata information in the package.IMPORTANTTokenFactorydoes not have the logic to query a denom trace for an IBC denom. Instead, we have a list of pre-defined IBC hashes which we use to get metadata from. We'll explore how to have this possibility as well below.
DenomClientAsync (deprecated)
As part of the @injectivelabs/sdk-ui-ts package we have an abstraction class DenomClientAsync which uses the TokenFactory class under the hood, has a caching mechanism for IBC hashes, fetches token metadata from the chain, ERC20 contract details, CW20 contract details, etc. With it, you can ensure that you get all of the Token information for the denoms used within your application.
The usage is pretty simple, here is an example:
Last updated