# withdrawEther

Withdraw L2 ETH (or base layer native token) 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 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();

rollup.run({
    advance: chain(wallet.handler, ({ msgSender }) => {
        const user = msgSender;
        const value = wallet.etherBalanceOf(user);
        if (value > 0) {
            const voucher = wallet.withdrawEther(user, value); // [!code focus]
            rollup.emitVoucher(voucher);
        }
        return true;
    }),
});
```

## Returns

Type: `Voucher`

## Parameters

Type: `string`

User to withdraw from.

Type: `bigint`

Amount to withdraw.
