Prior to executing a swap or a bridge, you need to request the best route from our API
getRoutes
function to fetch routes/quotes from the Sauve Aggregator API.
Here is a simple example of how to request routes to bridge 10 USDC on Arbitrum to the maximum amount of DAI on Polygon.
getRoutes
function along with their descriptions:
fromChainId number
required
The ID of the source chain.
Chain Name | Chain ID |
---|---|
Ethereum | 1 |
Optimism | 10 |
Polygon | 137 |
Arbitrum | 42161 |
string
required
The contract address of the token on the source chain. Ensure this address corresponds to the specified fromChainId.
fromAmount string
required
The amount to be transferred from the source chain, specified in the smallest unit of the token (e.g., wei for ETH).
fromAddress string
optional
The address from which the tokens are being transferred.
toChainId number
required
The ID of the destination chain
Chain Name | Chain ID |
---|---|
Ethereum | 1 |
Optimism | 10 |
Polygon | 137 |
Arbitrum | 42161 |
string
required
The contract address of the token on the destination chain. Ensure this address corresponds to the specified toChainId.