> For the complete documentation index, see [llms.txt](https://docs.blockz.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blockz.fi/on-chain-helpers/wrap-native-tokens.md).

# Wrap Native Tokens

When swapping a native asset (for example ETH), it must first be wrapped into its ERC-20 equivalent (for example WETH).

This is required because the swap infrastructure operates on token contracts rather than native assets.

Wrapping is performed by calling the `deposit` method on the wrapped token contract.

```ts
import { ethers } from "ethers";

const WETH_ABI = [\
  "function deposit() external payable"\
];

async function wrapNative(
  wethAddress: string,
  amount: bigint,
  signer: ethers.Signer
) {
  const weth = new ethers.Contract(wethAddress, WETH_ABI, signer);

  const tx = await weth.deposit({
    value: amount
  });

  await tx.wait();
}
```

The amount of native asset sent with the `deposit` call determines the amount of wrapped tokens minted.
