quote

Get a quote based on network, token addresses and sell amount. (On-Chain Transaction)

Request Parameters:

NameTypeDescriptionExample

networkName (required)

String

The network for which to retrieve the quote

Eg: bsc

fromTokenAddress (required)

String

The token address of the token to sell

0x55d398326f99059ff775485246999027b3197955

toTokenAddress (required)

String

The token address of the token to buy

0xac51066d7bec65dc4589368da368b212745d63e8

sellAmount (required)

String

The amount of the token to sell. Includes decimals.

1000000000000000000000

slippage (required)

Number

The slippage tolerance for the transaction

0.1

liquiditySources (optional)

String[]

An array of liquidity sources to consider for the quote

Request URL Example:

https://api.magpiefi.xyz/aggregator/quote?network=ethereum&fromTokenAddress=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&toTokenAddress=0xdac17f958d2ee523a2206206994597c13d831ec7&sellAmount=1000000&slippage=0.1&liquiditySources=kyber-swap-elastic

Response Example:

{
  "id": "227b64c2-c002-4696-9d84-8fb965f7f915",
  "amountOut": "974106551",
  "magpieAggregatorAddress": "0xba7bAC71a8Ee550d89B827FE6d67bc3dCA07b104",
  "fees": [
    {
      "type": "gas",
      "value": "0.5983"
    }
  ]
}

Last updated