Class TokenBalanceAPI

TokenBalanceAPI provides methods for retrieving token balances and rich token balance data for Cosmos chains.

Constructors

Properties

COSMWASM_CLIENTS: Record<string, CosmWasmClient> = {}

Fetches the token balances for a given address on a specific chain.

Param: address

The blockchain address.

Param: chains

An array of CosmosChainData objects.

Returns

A Promise resolving to an array of token amounts ([]).

Throws

An error if the chain is not supported or if there's a failure in fetching balances.

Methods

  • Parameters

    • address: string
    • chainId: string
    • chains: CosmosChainData[]
    • Optional isTestnet: boolean

    Returns Promise<Amount[]>

  • Fetches rich token balances which includes detailed token information along with the balance.

    Parameters

    • address: string

      The blockchain address.

    • chainId: string
    • denoms: Record<string, DenomData>

      A record of denom data indexed by denom strings.

    • chains: CosmosChainData[]

      An array of CosmosChainData objects.

    • cw20Tokens: SkipSupportedAsset[] = []
    • Optional isTestnet: boolean

    Returns Promise<ChainBalanceData>

    A Promise resolving to a ChainBalanceData object containing rich balance data (ChainBalanceData).

    Throws

    An error if the chain is not supported or if there's a failure in fetching rich balances.