Optimal route between two tokens
Calculates optimal transaction with the best route between two tokens, which may involve several actions that interact with various DeFi protocols. To enter a non-tokenized position, use GET /shortcuts/route/nontokenized
.
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
Ethereum address of the wallet to send the transaction from
Ethereum address of the token to swap from. For ETH, use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
[
"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
]
Ethereum address of the token to swap to. For ETH, use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
[
"0x6b175474e89094c44da98b954eedeac495271d0f"
]
Amount of tokenIn to swap in wei
["1000000000000000000"]
Chain ID of the network to execute the transaction on
Routing strategy to use
router
, delegate
, ensowallet
Flag that indicates if gained tokenOut should be sent to EOA
Ethereum address of the receiver of the tokenOut
"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
Ethereum address of the spender of the tokenIn
"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
Minimum amount out in wei. If specified, slippage
should not be specified
Slippage in basis points (1/10000). If specified, minAmountOut
should not be specified
"300"
Fee in basis points (1/10000) for each amountIn value. Must be in range 0-100. If specified, this percentage of each amountIn
value will be sent to feeReceiver
["100"]
The Ethereum address that will receive the collected fee. Required if fee is provided
"0x220866B1A2219f40e72f5c628B65D54268cA3A9D"
A list of swap aggregators to be ignored from consideration
A list of standards to be ignored from consideration
Response
Quoted amount OUT of tokenOut
, accounting for slippage
Price impact in basis points, null if USD price not found
An array of the fee amount collected for each tokenIn
Block number the transaction was created on
The tx object to use in ethers
The route the shortcut will use
Was this page helpful?