Route
Routing is the action for taking funds from the caller's wallet, and converting it into a token, whether that is a DeFi Position Token, or a Base Token.
This endpoint is a pathfinder for determine best price and gas execution across Enso dataset, DEX aggregators, and direct depositing into DeFi protocols.
Entering into a DeFi position
With Enso you can use Route to obtain the DeFi position token resulting in quick, and easy integration with all the logic for each particular protocol interaction logic abstracted away.
You can use the route action:
- As an individual call
- Or in a bundle of calls
tokenIn: 'Address of token to send'
tokenOut: 'Address of token to receive'
amountIn: 'Raw amount to send'
slippage: 'Amount of slippage'
Example
POST /api/v1/shortcuts/bundle
The bundle endpoint enables bundling of many actions into one transaction, and for the examples below we will simply do one action of deposit.
For example we can bundle the following operations in one single transaction:
- Deposit from ETH to stEth (opens in a new tab)
- Deposit from ETH to the ETH/stEth Curve pool steCrv (opens in a new tab)
curl -X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer 1e02632d-6feb-4a75-a157-documentation' \
-d '[
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
"amountIn": "1000000000"
"slippage": 300
}
},
{
"protocol": "enso",
"action": "route",
"args": {
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut": "0x06325440d014e39736583c165c2963ba99faf14e",
"amountIn": "1000000000"
}
}
]' \
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045'