Request quote

Provide a quote inquiry endpoint for users to inform users of currency transaction information and currency exchange range.

Note

Note: If the value filled in by the user is outside the convertible range, in order to avoid user losses, please remind the user to change the swap value

Endpoint usage

POST https://sswap.swft.pro/api/sswap/quote

The fields with * are required, and the fields without * are optional

Request Body

{
 "resCode":"100",
 "resMsg":"Success",
 "data":{
  "txData":{
   "amountOutMin": 5055580656532273000// Amount of token to receive (WEI version)
   "chainFee":"0.02" // Gas fee
   "contractAddress":"0x6b4427caa371627e2a73521a2568fcf1212cd4d9", // Contract Address
   "depositMin": 30, // minimum swap value
   "depositMax": 21738659651027.298142, // maximum swap value
   "dex":"Bridgers1",
   "fee":0.002, // Processing fee ratio 
   "feeToken":"",
   "fromTokenAmount":"47079490000000000000",
   "fromTokenDecimal":18,
   "toTokenAmount":"5.0555806565",  // Estimated amount to receive
   "toTokenDecimal":18,
   "path":["0x55d398326f99059ff775485246999027b3197955","0x6b4427caa371627e2a73521a2568fcf1212cd4d9","0xa71edc38d189767582c38a3145b5873052c3e47a"],
   "logoUrl":"https://images.swft.pro/dex/sSwap.png",
  }
 }
}

Code example

// quote example
 const params = {
   fromTokenAddress: '0x55d398326f99059ff775485246999027b3197955',
   toTokenAddress: '0xa71edc38d189767582c38a3145b5873052c3e47a',
   fromTokenAmount: '8000000000000000000',
   fromTokenChain: 'BSC',
   toTokenChain: 'HECO',
   userAddr: '0x...', //your wallet address
   equipmentNo:'', // your equipment number
   sourceFlag:'widget',
   sourceType:'H5',
  }
  const res = await axios.post('https://sswap.swft.pro/api/sswap/quote',params)
  console.log(res)

Postman example

Last updated