What it will do
@uzolabs/sdk/bdex is planned for SDK 0.3.0. It will cover four areas:
The function names come from the SDK plan. Their parameters and return types aren’t published yet, so these pages describe what each function is for, not its final signature.
How it will work
Like the rest of the SDK, the module won’t hold keys or send transactions. Quote functions read from the chain. Build functions return a transaction request that you sign and send with your own wallet client. Two safety checks are planned, and their error classes already exist in 0.2.0:- Slippage cap. A swap that asks for more slippage than the maximum throws
SlippageTooHighError. - Router allowlist. Calldata from the Routing API that targets an unknown router throws
RouterNotAllowedError.
Do it today
Everything the module will do is possible now with viem plus@uzolabs/sdk/contracts, which already ships the BDEX addresses and typed ABIs. This quote runs as is:
quote.ts
Output
Swap on BDEX V2
Quote, approve and swap through Router02.
Swap on BDEX V3
Compare fee tiers and swap through SwapRouter.
Slippage and deadlines
Set safe minimums before you build a swap.
BDEX API
List pairs and pools without reading the chain.