Router
Computes the optimal path for swapping tokens.
For complete swap flow, refer to Swap Flow
Usage
Params
-
provider: Ethers Provider
-
tokenIn: Address of the token to swap
-
tokenOut: Address of the token to receive
-
tokenInDecimals: Decimals of the token to swap
-
amountIn: Amount of token to swap
-
pools: List of pools to consider for the path
-
baseTokens: List of base tokens to consider for multi-hop swaps
Returns
Swaps tokens using a computed path.
For complete swap flow, refer to Swap Flow
Usage
Params
-
signer: Ethers Signer
-
encodedPath: Encoded path of the swap
-
amountIn: Amount of token to swap
-
minAmountOut: Minimum amount of token to receive