Introduction
Swap Router API
Using Swap Router API, you can find the best route to exchange assets and make the exchange.
Step by step:
- Lookup chains you want to swap Supported Chains
- Lookup addresses of tokens you want to swap, for example ‘0xxx’ , ‘0xxxx’ for MATIC -> USDC
- Lookup spender is trusted Spender
- Check for allowance of swap router contract to spend source asset (/approve/allowance) Check Allowance
- If necessary, give approval for swap router to spend source token (/approve/transaction) Allowance transaction
- Monitor the best exchange route using (/swap/calculateTrade) Swap Route
- Monitor the best cross chain exchange route using (/swap/calculateCrossTrade) Cross Chain Route
Swap API Endpoint:
Version | Note | Endpoint |
---|---|---|
V1 | The latest version | http://router-api.openliq.com/ |