Skip to main content
GET
/
api
/
{blockchain}
/
quote
TypeScript
const options = {method: 'GET'};

fetch('https://swap.ggp.gg/api/{blockchain}/quote', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "aggregatorAddress": "<string>",
  "data": {
    "rawTotalGasEstimate": 1,
    "steps": [
      [
        {
          "exchanger": {
            "address": "<string>",
            "fee": 1,
            "name": "<string>"
          },
          "amountIn": "<string>",
          "amountOut": "<string>",
          "percentBps": 1,
          "tokenIn": "<string>",
          "tokenOut": "<string>",
          "priceImpact": 1
        }
      ]
    ],
    "totalAmountOut": "<string>",
    "totalPriceImpact": 1,
    "addressTokenIn": "<string>",
    "addressTokenOut": "<string>",
    "amountIn": "<string>",
    "amountInUsd": 123,
    "amountOutUsd": 123,
    "usdDifference": 123
  },
  "tokenApprovalAddress": "<string>"
}

Path Parameters

blockchain
enum<string>
required
Available options:
ethereum,
bsc,
arbitrum

Query Parameters

addressTokenIn
string
required

Source token contract address (ERC20 or native token)

addressTokenOut
string
required

Destination token contract address (ERC20 or native token)

amountIn
string

Amount of source token to swap (in token's normalized unit, e.g., eth for ETH). Ignored when amountInWei is provided.

amountInWei
string

Amount of source token in the smallest unit (wei). Takes precedence over amountIn

  • useful for callers that don't account for token decimals.
apiKey
string

Partner API key. Header X-Api-Key takes precedence.

Response

Quote for aggregation swap through POST /{blockchain}/swap

aggregatorAddress
string
required

Address to send the swap transaction to. Use this for tx.to when building the transaction.

data
object
tokenApprovalAddress
string | null

Address that the user must approve for ERC20 spending before calling /swap. Null when the input token is native.