GET
/
api
/
v1
/
shortcuts
/
route
Optimal route between two tokens
curl --request GET \
  --url https://api.enso.finance/api/v1/shortcuts/route
{
  "gas": "<string>",
  "amountOut": "<string>",
  "priceImpact": 123,
  "feeAmount": [
    "<string>"
  ],
  "createdAt": 123,
  "tx": {
    "data": "<string>",
    "to": "<string>",
    "from": "<string>",
    "value": "<string>"
  },
  "route": [
    {
      "tokenIn": [
        "<string>"
      ],
      "tokenOut": [
        "<string>"
      ],
      "protocol": "<string>",
      "action": "<string>",
      "primary": "<string>",
      "internalRoutes": [
        "<string>"
      ],
      "args": {},
      "chainId": 123,
      "sourceChainId": 123,
      "destinationChainId": 123
    }
  ],
  "ensoFeeAmount": [
    "<string>"
  ]
}

Query Parameters

chainId
number
default:1

Chain ID of the network to execute the transaction on

fromAddress
string
required

Ethereum address of the wallet to send the transaction from

Example:

"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"

routingStrategy
enum<string> | null

Routing strategy to use. in majority of cases you can use router. Use delegate with EOA when you want to specify a spender

Available options:
ensowallet,
router,
delegate,
router-legacy,
delegate-legacy
toEoa
boolean | null
deprecated

Flag that indicates if gained tokenOut should be sent to EOA

receiver
string

Ethereum address of the receiver of the tokenOut

Example:

"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"

spender
string

Ethereum address of the spender of the tokenIn

Example:

"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"

amountIn
string[]
required

Amount of tokenIn to swap in wei

Example:
["1000000000000000000"]
minAmountOut
string[]

Minimum amount out in wei. If specified, slippage should not be specified

slippage
string
default:50

Slippage in basis points (1/10000). If specified, minAmountOut should not be specified

Example:

"300"

fee
string[]

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

Example:
["100"]
feeReceiver
string

The Ethereum address that will receive the collected fee. Required if fee is provided

Example:

"0x220866B1A2219f40e72f5c628B65D54268cA3A9D"

ignoreAggregators
string[] | null

A list of swap aggregators to be ignored from consideration

ignoreStandards
string[] | null

A list of standards to be ignored from consideration

tokenIn
string[]
required

Ethereum address of the token to swap from. For ETH, use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

Example:
[
"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
]
tokenOut
string[]
required

Ethereum address of the token to swap to. For ETH, use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

Example:
[
"0x6b175474e89094c44da98b954eedeac495271d0f"
]
referralCode
string

Referral code that will be included in an on-chain event.

Maximum length: 16
Example:

"0123456789ABCDEF"

destinationChainId
number

Chain ID of the network to bridge to and receive tokenOut

refundReceiver
string

Ethereum address of the receiver of any dust tokens that might be produced during the execution of actions

Example:

"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"

Response

200
application/json

The response is of type object.