> For the complete documentation index, see [llms.txt](https://yuga.gitbook.io/zkyuga-whitepaper/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yuga.gitbook.io/zkyuga-whitepaper/developer-guide/erc1155/getbalanceofbatch.md).

# getBalanceOfBatch

The `getBalanceOfBatch` method for the ERC-1155 token standard retrieves the balances of multiple token IDs for a specified Ethereum address. This method is efficient for applications that need to check balances for a range of token IDs in a single call. The method is part of the `ERC1155Instance` object, which can be acquired through a suitable method of the `ZkyugaClient` or the corresponding library.

## Method Signature

```javascript
getBalanceOfBatch(address: string, ids: string[]): Promise<BigNumber[]>
```

### Parameters

| Parameter | Type      | Description                                                                                 |
| --------- | --------- | ------------------------------------------------------------------------------------------- |
| address   | string    | The Ethereum address for which you want to retrieve the token balances.                     |
| ids       | string\[] | An array of specific IDs of the ERC-1155 tokens for which the balances are being retrieved. |

### Returns

* A `Promise` resolving to an array of `BigNumber` values. Each value corresponds to the balance of the associated token ID for the provided Ethereum address.

## Usage Example

First, instantiate the desired ERC-1155 token contract:

```javascript
const erc1155 = zkyugaClient.getERC1155Instance("your ERC-1155 contract address here");
```

Then, call the `getBalanceOfBatch` method for the desired Ethereum address and array of token IDs:

```javascript
const userAddress = "0xBbF289D846208c16EDc8474705C748aff07732dB";
const tokenIds = ["token-id-1", "token-id-2", "token-id-3"];
const tokenBalances = await erc1155.getBalanceOfBatch(userAddress, tokenIds);
tokenBalances.forEach((balance, index) => {
  console.log(`Token Balance for ID ${tokenIds[index]}: ${balance.toString()}`);
});
```

## Notes

* The `getBalanceOfBatch` method is particularly useful when dealing with multiple token IDs, as it reduces the need for multiple individual queries, thus optimizing contract interactions.
* Ensure the Ethereum address and token IDs provided are valid; otherwise, the method might throw an error or return an array of zeroes.

***
