quoteIn

Get a quote for swapping tokens from one network to another.

Request Parameters:

NameTypeDescriptionExample

fromNetwork (required)

String

The network to swap tokens from

bsc

toNetwork (required)

String

The address of the token to swap from

polygon

fromTokenAddress (required)

String

The address of the token to swap from

0xb58e26ac9cc14c0422c2b419b0ca555ee4dcb7cb

toTokenAddress (required)

String

The address of the token to swap to

0x2791bca1f2de4661ed88a30c99a7a9449aa84174

sellAmount (required)

String

The amount of tokens to sell in the swap

10000000000000000

slippageIn (required)

Number

The slippage tolerance for the token being swapped in

0.1

slippageOut (required)

Number

The slippage tolerance for the token being swapped out

0.1

liquiditySources (optional)

String[]

An array of liquidity sources to consider for the quote

bridgeTypes (optional)

String

An array of bridge types to consider for the swap 0: Wormhole 1: Stargate 2: Celer

dataTransferTypes (optional)

String

An array of data transfer types to consider for the swap 0: Wormhole 1: LayerZero

Request URL Example:

https://api.magpiefi.xyz/aggregator/quote-in?fromNetwork=ethereum&toNetwork=polygon&fromTokenAddress=0xdac17f958d2ee523a2206206994597c13d831ec7&toTokenAddress=0x3c499c542cef5e3811e1192ce70d8cc03d5c3359&sellAmount=10000000&slippageIn=0.1&slippageOut=0.1&liquiditySources=uniswap-v3&bridgeTypes=1&dataTransferTypes=0

Response Example:

{
  "id": "string",
  "amountOut": "string",
  "magpieAggregatorAddress": "string",
  "fees": [
    {
      "type": "gas",
      "value": "string"
    }
  ]
}

Last updated