Skip to main content
POST
/
api
/
{blockchain}
/
swap
TypeScript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    dstAddress: '<string>',
    path: {
      steps: [
        [
          {
            exchanger: {address: '<string>', fee: 1, name: '<string>', poolType: 'UniswapV2'},
            percentBps: 1,
            tokenIn: '<string>',
            tokenOut: '<string>'
          }
        ]
      ],
      totalAmountOut: '<string>',
      totalPriceImpact: 1,
      addressTokenIn: '<string>',
      addressTokenOut: '<string>',
      amountIn: '<string>'
    }
  })
};

fetch('https://swap.ggp.gg/api/{blockchain}/swap', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "data": "<string>",
  "minReturnAmountOut": "<string>",
  "computeUnits": 1
}

Path Parameters

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

Body

application/json

Params for building swap calldata

dstAddress
string
required
path
object
required
deadline
integer<int64> | null
Required range: x >= 0
fromAddress
string | null
permit
object
skipSimulation
boolean | null
slippageBps
integer<int32> | null
Required range: x >= 0
usePermit
boolean | null

Response

Built swap calldata for 8dx aggregation smart contract

data
string
required
minReturnAmountOut
string
required
computeUnits
integer<int64> | null
Required range: x >= 0