> 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/safebatchtransferfrom.md).

# safeBatchTransferFrom

The `safeBatchTransferFrom` method in the ERC-1155 token standard orchestrates the secure transfer of specified amounts of multiple tokens with their respective IDs from one Ethereum address to another. This method ensures a streamlined and secure transaction by verifying if the receiving address implements the essential ERC-1155 token receiver interface. This method is encompassed within the `ERC1155Instance` object, obtainable via the relevant method of the `ZkyugaClient` or the corresponding library.

## Method Signature

```javascript
async safeBatchTransferFrom(
    from: string,
    to: string,
    ids: string[],
    values: string[],
    data: string,
    signer: WalletSigner
): Promise<TransactionResponse>
```

### Parameters

<table><thead><tr><th width="125">Parameter</th><th width="130">Type</th><th>Description</th></tr></thead><tbody><tr><td>from</td><td>string</td><td>The Ethereum address initiating the token transfer.</td></tr><tr><td>to</td><td>string</td><td>The Ethereum address intended to receive the tokens.</td></tr><tr><td>ids</td><td>string[]</td><td>An array of specific IDs of the ERC-1155 tokens involved in the transfer.</td></tr><tr><td>values</td><td>string[]</td><td>An array specifying the quantities of each token to be transferred, correlating with the provided IDs.</td></tr><tr><td>data</td><td>string</td><td>Optional additional data or bytes accompanying the transfer.</td></tr><tr><td>signer</td><td>WalletSigner</td><td>The wallet signer instance tasked with signing the transaction.</td></tr></tbody></table>

### Returns

* A `Promise` resolving to a `TransactionResponse`, offering details concerning the batch transfer transaction.

## Usage Example

First, instantiate the desired ERC-1155 token contract:

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

Subsequently, employ the `safeBatchTransferFrom` method with the pertinent parameters:

```javascript
const senderAddress = "0x315cbb881Ac891D28F78FFd47A9fe6b0D5a23D86";
const recipientAddress = "0xF39Fd6e51aad88F6F4ce6aB8827279cffFb92266";
const tokenIds = ["token-id-1", "token-id-2", "token-id-3"];
const transferAmounts = ["100", "125", "175"];
const dataBytes = "0x";  // Optional data bytes
const signer = zkyugaClient.createWalletSigner("your private key");

const batchTransferTransaction = await erc1155.safeBatchTransferFrom(senderAddress, recipientAddress, tokenIds, transferAmounts, dataBytes, signer);
console.log(`Batch Transfer Transaction Hash: ${batchTransferTransaction.hash}`);
```

## Notes

* The `safeBatchTransferFrom` method enhances efficiency by consolidating multiple token transfers into a single transaction, while also ensuring the recipient's capability to handle ERC-1155 tokens.
* Prior to initiating a batch transfer, always validate the Ethereum addresses, token IDs, and other parameters to guarantee the precision and security of the token movement.

***
