getTokenBalances

Returns token balances for a specific address given a list of contracts. Alchemy Enhanced API.

Parameters


  1. DATA, 20 Bytes - The address for which token balances will be checked
  2. One of:
    1. Array - A list of contract addresses. Suggested limit: 100 addresses.
    2. The String "DEFAULT_TOKENS" - denotes a query for the top 100 tokens by 24-hour volume - only available on Mainnet for Ethereum, Polygon, and Arbitrum.
    3. The String "erc20" - denotes the set of erc20 tokens that the address has ever held. This list is produced by an address's historical transfer activity and includes all tokens that the address has ever received.
  3. Options (optional) - An object that contains the following settings:
    1. pageKey: Applies only to the erc20 request type. Used to paginate through tokens that an owner has held.

Returns


Object - An object with the following fields:

  • address: DATA, 20 Bytes - The address for which token balances were checked
  • tokenBalances: Array - returns an array of token balance objects. Each object contains:
    • contractAddress
    • tokenBalance: hex encoded
    • error
    • One of tokenBalance or error will be null.
  • pageKey: String - Applies only to the erc20 request type. An address to be passed into the pageKey of the next request in order to paginate through all of an owner's tokens.


Use Cases


For guidance on how to leverage this method, check out the following tutorials:


❗️

The below parameter inputs do not work, please reference the section above instead.

Language