# withdrawBatchERC1155

Withdraw multiple ERC-1155 tokens from one user and returns a `Voucher` to the recipient on L1.
The voucher still needs to be emitted through an [emitVoucher](/app/outputs#vouchers) 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 { Rollup, chain } from "@cartesi/rollup";
import { createWallet } from "@deroll/wallet";

// open the rollup device
const rollup = new Rollup();

// create wallet
const wallet = createWallet();

const token = "0x04d724738873CB6a86328D2EbAEb2079D715e61e"; // ERC-1155 address
rollup.run({
    advance: chain(wallet.handler, ({ msgSender, appContract }) => {
        const user = msgSender;
        const dapp = 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]
            rollup.emitVoucher(voucher);
        }
        return true;
    }),
});
```

## 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.
