# withdrawBatchERC1155

Withdraw multiple ERC-1155 tokens from one user and returns a `Voucher` to the recipient on L1.
The voucher still need to be created through a [createVoucher](../create-voucher) call.

## Usage

The following example withdraws the entire balance of token id 1 and 2 of the user who is submitting an input to the application.

```ts twoslash
import { createApp } from "@deroll/app";
import { createWallet } from "@deroll/wallet";

// create app
const app = createApp();

// create wallet
const wallet = createWallet();

app.addAdvanceHandler(wallet.handler);

const token = "0x04d724738873CB6a86328D2EbAEb2079D715e61e"; // ERC-1155 address
app.addAdvanceHandler(async ({ metadata }) => {
    const user = metadata.msgSender;
    const dapp = metadata.appContract;
    const value1 = wallet.erc1155BalanceOf(token, user, 1n);
    const value2 = wallet.erc1155BalanceOf(token, user, 2n);
    if (value1 > 0 && value2 > 0) {
        const voucher = wallet.withdrawBatchERC1155( // [!code focus]
            dapp, // [!code focus]
            token, // [!code focus]
            user, // [!code focus]
            [1n, 2n], // [!code focus]
            [value1, value2], // [!code focus]
            "0x", // [!code focus]
        ); // [!code focus]
        await app.createVoucher(voucher);
    }
    return "accept";
});
```

## Returns

Type: `Voucher`

## Parameters

Type: `Address`

Address of ERC-1155 token.

Type: `string`

User to withdraw from.

Type: `bigint[]`

Ids of the token.

Type: `bigint[]`

Amounts to withdraw.

Type: `Hex`

Extra payload to pass to the L1 voucher.
