---
# System prepended metadata

title: TokensHelper

---

# TokensHelper

This contract is a utility to allow backend and frontend get token balances and allowances for multiple accounts in one call.

## Functions

### getBalances(address account, address[] calldata tokens)

- ***Return:*** uint256[] memory balances

It returns the multiple balances for a given account. It supports ERC20 and/or ERC721 as tokens since both standards use the `balanceOf(address)` function.

Each value in the output array is the balance of the same position in the input `tokens` array.

### getERC20Allowances(address account, address spender, address[] calldata tokens)

- ***Return:*** uint256[] memory allowances

It returns the current allowance given from an `account` to a `spender` account for a list of `tokens`.

Each value in the output array is the allowance of the same position in the input `tokens` array and `spender` account.

### getERC1155Balances(address account, address[] calldata tokens, uint256 typeId)

- uint256[] memory balances

It is similar to `getBalances` but the balance is for a given token type id (ERC1155) in the multiple tokens.
The tokens must be ERC1155 implementations.

### function getAllBalances(address account)
        
 - ***Return:*** address[] memory tokens, uint256[] memory balances

It returns the balances for all the tokens created in our registry contract. All these tokens are ERC721.

It returns the token addresses, and balances (two arrays) where the position in the `balances` array represents the balance for the token at the same position in the `tokens` array.

**PENDING: Add symbol as out parameter (array)**