Swap Quotes

Swap Details Endpoint

  • Endpoint: /swap/details

  • Description: This endpoint allows you to obtain the best exchange rate between two tokens and identify the best pool to perform the swap.

  • Response Includes:

    • Best pool for performing the swap.

    • amountIn and amountOut values.

    • Network fees and liquidity provider fees.

    • Price impact of the swap.

Important Notes:

  • Swap from Rune to BTC:

    • The amountOut provided by the /swap/details endpoint does not account for the network fees.

    • You need to subtract the network fees from the amountOut to get the correct amount to send to the endpoint.

Get Swap Details

Retrieves detailed information about a potential swap, including expected amounts and fees.

GEThttps://api-dev.saturnbtc.io/v0/pool/swap/details
Query parameters
Response

An object containing detailed swap information such as expected amounts, price, price impact, fees, and pool ID.

Body
amountIn*The amount of input token to swap

The amount of input token to swap.

amountOut*The amount of output token expected

The amount of output token expected.

price*The price of the swap

The price of the swap.

priceImpact*The price impact of the swap

The price impact of the swap.

fees*The fees paid for the swap

The fees paid for the swap.

poolId*The identifier of the pool

The identifier of the pool.

Request
const response = await fetch('https://api-dev.saturnbtc.io/v0/pool/swap/details?token0=text&token1=text&amount=text&feeRate=0&zeroToOne=false&exactIn=false', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "amountIn": "text",
  "amountOut": "text",
  "price": "text",
  "priceImpact": "text",
  "fees": {
    "makers": "text",
    "network": "text"
  },
  "poolId": "text"
}

Last updated