Planned function
createRoutingClient
The name comes from the SDK plan. Parameters and return types aren’t final, but two rules are set:string
required
The Routing API base URL. It isn’t public, so the SDK can’t include a default. If you leave it out, the client is planned to throw
MissingConfigError instead of guessing.Address[]
The routers you trust. Routing API responses include calldata for a router contract. The client is planned to check that router against an allowlist and throw
RouterNotAllowedError if it isn’t on the list. The exact option name isn’t final.Why the allowlist matters
When you sign calldata that came from an API, you’re trusting the API to send your tokens to the right contract. If the API is wrong or compromised, the calldata could target a contract that drains your approval. Checking the target router against addresses you already trust, such as the ones ingetAddresses, limits that risk.
Do it today
Without the Routing API, you can still find a good route yourself:- List pools. The public BDEX API lists V2 pairs and V3 pools, so you can see which routes exist.
- Quote each candidate. For V2, pass a multi-hop path such as
[tokenA, wbot, usdt]togetAmountsOut. For V3, compare fee tiers with QuoterV2. See BDEX V2 and BDEX V3. - Swap through a router you know. Use Router02 or SwapRouter from
getAddresses, as in the swap guides.
universalRouterAbi and the testnet universalRouter address, but building commands by hand isn’t covered in these docs.
Related
Swaps overview
Which router to use and why.
Errors
The errors this client will throw.