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>'},
            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>",
  "to": "<string>",
  "value": "<string>",
  "computeUnits": 1,
  "tokenApprovalAddress": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.8dx.io/llms.txt

Use this file to discover all available pages before exploring further.

Path Parameters

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

Body

application/json

Params for building swap calldata

dstAddress
string
required

Destination/taker wallet or contract

path
object
required

Quote path

deadline
integer<int64> | null

Deadline in seconds, default 3600 seconds (1 hour)

Required range: x >= 0
fromAddress
string | null

Source wallet or contract

permit
object

Permit2 data with EIP-2612 signature, if exist

skipSimulation
boolean | null

Whether to skip simulation

slippageBps
integer<int32> | null

Custom slippage in bps, default using totalPriceImpact from the quote

Required range: x >= 0
usePermit
boolean | null

Whether to use permit

Response

Built swap calldata for 8dx aggregation smart contract

data
string
required

Calldata to send to the aggregator contract

minReturnAmountOut
string
required
to
string
required

Aggregator contract address - recipient of the transaction (transaction to)

value
string
required

Native value (msg.value) attached to the transaction, in wei

computeUnits
integer<int64> | null
Required range: x >= 0
tokenApprovalAddress
string | null

Address that the user must approve for ERC20 spending (null for native-token swaps; equals to for non-permit ERC20 swaps; equals Permit2 address when use_permit = true)