Multichain API
GET /v1/shortcuts/route

GET /v1/shortcuts/route

This endpoint allows you to calculate the optimal route for DeFi transactions or token swaps, specifying both the source and destination chains. It evaluates DeFi protocols and exchanges on the selected chains to determine the most efficient transaction path.

The API returns an unsigned transaction object (tx) that is ready for submission to the source blockchain node. If the input token is not the native token of the source chain, make sure to set the necessary allowances.

Body:

An object with the following structure:

{
  "amountIn": "", // Amount of token In
  "slippage": "", // Slippage tolerance in basis points
  "in": {
    "sourceChainId": , // Chain ID of the source chain
    "token": "" // Token address of the token in
  },
  "out": {
    "destinationChainId": , // Chain ID of the destination chain
    "token": "" // Token address of the token out
  },
  "fromAddress": "" // Address of the user
}

Examples

ETH from Arbitrum to stETH Curve pool on Mainnet

Spend Ether from the EOA and get stETH in return.

Specify a tokenIn (ETH), tokenOut (stETH) and either a sellAmount to get a route of 1 ETH for WETH. The route endpoint will calculate the best route for you, choosing between all the avilable AMM's and protocols (E.g. depositing directly to Lido).

If depositing directly to LIDO is the best route the tx object will contain the data to call the deposit function on the LIDO contract, otherwise it will contain the data to call the best AMM.

Request:

curl -X 'POST' \
  'https://api.enso.finance/api/experimental/multichain/shortcut/route' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -d '{
  "amountIn": "1000000000000000000",
  "slippage": "300",
  "in": {
    "sourceChainId": 42161,
    "token": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
  },
  "out": {
    "destinationChainId": 1,
    "token": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84"
  },
  "fromAddress": "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11"
}'

Response:

{
  "createdAt": 127337780,
  "tx": {
    "from": "0x93621DCA56fE26Cdee86e4F6B18E116e9758Ff11",
    "chainId": 42161,
    "value": "0x0e2b7dfa8f7d3263",
    "to": "0x3a23F943181408EAC424116Af7b7790c94Cb97a5",
    "data": "0x0000018ab1f98a6500000000000000000000000093621dca56fe26cdee86e4f6b18e116e9758ff11000000000000000000000000362c116779d2d27f822a497e4650b6e2616d38590000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000016382e0000000000000000000000000000000000000000000000000dc5038c3d9677a4000000000000000000000000000000000000000000000000004ac746e81932630000000000000000000000000000000000000000000000000000000000000065000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008c90000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000c6457fb90677430e1b62ade8756c72cd0915135200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000984fdb09f3c00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000000e70a082310100ffffffffff07e57180685e3348589e9521aa53af0bcd497e884d19198595a30182ffffffff821111111254eeb25477b68fb85ed929f73a9605829bd3b227018203ffffffff026675a323dedb77822fcf39eaa9d682f6abe72555ddcd52200102ffffffffff027e7d64d987cab6eed08a191c4c2459daf2f8ed0b095ea7b3010402ffffffffff865377367054516e17014ccded1e7d814edc9ce470a082310100ffffffffff04e57180685e3348589e9521aa53af0bcd497e884d0b4c7e4d01020303ffffffffe57180685e3348589e9521aa53af0bcd497e884d70a082310100ffffffffff02e57180685e3348589e9521aa53af0bcd497e884db67d77c5010204ffffffff02ca99eaa38e8f37a168214a3a57c9a45a58563ed56e7a43a3010205ffffffff027e7d64d987cab6eed08a191c4c2459daf2f8ed0b241c59120102ffffffffffff7e7d64d987cab6eed08a191c4c2459daf2f8ed0b70a082310100ffffffffff00e57180685e3348589e9521aa53af0bcd497e884db67d77c5010007ffffffff00ca99eaa38e8f37a168214a3a57c9a45a58563ed5a9059cbb010600ffffffffffe57180685e3348589e9521aa53af0bcd497e884d00000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000620000000000000000000000000000000000000000000000000000000000000066000000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000006e000000000000000000000000000000000000000000000000000000000000007200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000c6457fb90677430e1b62ade8756c72cd0915135200000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000046812aa3caf0000000000000000000000003208684f96458c540eb08f6f01b9e9afb2b7d4f0000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000865377367054516e17014ccded1e7d814edc9ce40000000000000000000000003208684f96458c540eb08f6f01b9e9afb2b7d4f0000000000000000000000000c6457fb90677430e1b62ade8756c72cd091513520000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000563948ec5f9b275bea000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ce0000000000000000000000000000000000000000000002b000028200023800a007e5c0d20000000000000000000000000000000000000002140001fa00014a00001a4041c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2d0e30db051204a585e0f7c18e2c414221d6402652d5e0990e5f8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200a4a5dcbcdf000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000011a653ddfbb61e0feff5484919f06d9d254bf65f0000000000000000000000003208684f96458c540eb08f6f01b9e9afb2b7d4f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005120e57180685e3348589e9521aa53af0bcd497e884da0b86991c6218b36c1d19d4a2e9eb0ce3606eb480044a6417ed60000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000563948ec5f9b275bea0020d6bdbf78865377367054516e17014ccded1e7d814edc9ce400a0f2fa6b66865377367054516e17014ccded1e7d814edc9ce4000000000000000000000000000000000000000000000058e3f6b99f4394c853000000000000000046127ddd53c04d7380a06c4eca27865377367054516e17014ccded1e7d814edc9ce41111111254eeb25477b68fb85ed929f73a960582000000000000000000000000000000000000d5504337000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e57180685e3348589e9521aa53af0bcd497e884d0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000055c49dbb944b427985000000000000000000000000000000000000000000000000000000000000002000000000000000000000000093621dca56fe26cdee86e4f6b18e116e9758ff11000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
  }
}