Skip to main content
The planned approval builders will create the transactions that let a BDEX router spend your tokens, using either a standard ERC-20 approval or Permit2. You can check and set approvals today with viem.
In development. This describes the planned API. It is not published yet and details may change. Follow progress on GitHub.

Planned builders

The SDK plan includes builders for two kinds of approval. Their names and parameters aren’t published yet. Like the swap builders, they’ll return an unsigned transaction for you to sign.

Do it today: ERC-20

Check the allowance first, and approve only what you need:
erc20-approval.ts
If it says an approval is needed, send approve(router, amountIn) with a wallet client. Swap on BDEX V2 shows the full flow.
An unlimited approval (maxUint256) saves a transaction on later swaps, but it lets the router move all of that token for as long as the approval stands. Approve exact amounts unless you have a reason not to.

Do it today: Permit2

Permit2 keeps a second allowance for each owner, token and spender. Read it with permit2Abi:
permit2-allowance.ts
A Permit2 approval has two steps: an ERC-20 approve of the token to the Permit2 contract, then a Permit2 approve(token, spender, amount, expiration) or a signed permit for the router. The testnet UniversalRouter is the only Permit2 spender in the SDK’s addresses.

BDEX V2

Approve, then swap.

Contract addresses

Permit2 and router addresses.
Last modified on October 3, 2026