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
approve(router, amountIn) with a wallet client. Swap on BDEX V2 shows the full flow.
Do it today: Permit2
Permit2 keeps a second allowance for each owner, token and spender. Read it withpermit2Abi:
permit2-allowance.ts
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.
Related
BDEX V2
Approve, then swap.
Contract addresses
Permit2 and router addresses.