# 询价

### 接口调用

<mark style="color:green;">`POST`</mark> `https://api.bridgers.xyz/api/sswap/quote`

**以下参数带\*字段为必填，不带\*号为选填**

#### Request Body

| Name                                               | Type    | Description                                                            |
| -------------------------------------------------- | ------- | ---------------------------------------------------------------------- |
| equipmentNo<mark style="color:red;">\*</mark>      | String  | 设备号（该字段将作为用户的唯一标识，三方可通过自己的方式获得，如fromAddress的前32位字符，或者32位随机数字与字母结合的字符串） |
| sourceFlag<mark style="color:red;">\*</mark>       | String  | <p>渠道来源（需要双方约定一个名称来代表三方的渠道）</p><p></p>                                 |
| fromTokenAddress<mark style="color:red;">\*</mark> | String  | 出售币种合约地址（可通过获取币种列表中的address字段获得）                                       |
| toTokenAddress<mark style="color:red;">\*</mark>   | String  | 获得币种合约地址（可通过获取币种列表中的address字段获得）                                       |
| fromTokenAmount<mark style="color:red;">\*</mark>  | String  | 出售币种数量(带精度)                                                            |
| fromTokenChain<mark style="color:red;">\*</mark>   | String  | 出售币种链（可通过获取币种列表中的chain字段获得,详细支持链的情况可查看【基本说明】）                          |
| toTokenChain<mark style="color:red;">\*</mark>     | String  | 获得币种链（可通过获取币种列表中的chain字段获得，详细支持链的情况可查看【基本说明】）                          |
| userAddr                                           | String  | 用户地址                                                                   |
| sourceType                                         | String  | 设备类型（H5/IOS/Android 该字段为选填，如通过直接通过API调用，可为空)                           |
| fixedRateFlag                                      | Integer | <p>固定费率<br>0：关闭固定费率<br>1 ：开启固定费率,<br>默认: 0</p>                         |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
 "resCode":"100",
 "resMsg":"Success",
 "data":{
  "txData":{
   "amountOutMin": "5055580656532273000" // 预期发币数量 带精度
   "chainFee":"0.02" // 链上矿工费
   "contractAddress":"0x6b4427caa371627e2a73521a2568fcf1212cd4d9", // 合约地址
   "depositMin": "30", //兑换范围最小值 若用户兑换值小于该值，将不能兑换得到目标币
   "depositMax": "21738659651027.298142", //兑换范围最大值 若用户兑换的值大于该值，将只能得到该值兑换所能得到的目标币种数量
   "dex":"Bridgers1",
   "fee":0.002, // 手续费比例
   "feeToken":"",
   "fromTokenAmount":"47079490000000000000",
   "fromTokenDecimal":18,
   "toTokenAmount":"5.0555806565",  // 预期发币数量 不带精度 
   "toTokenDecimal":18,
   "path":["0x55d398326f99059ff775485246999027b3197955","0x6b4427caa371627e2a73521a2568fcf1212cd4d9","0xa71edc38d189767582c38a3145b5873052c3e47a"],
   "logoUrl":"https://images.bridgers.xyz/dex/sSwap.png",
  }
 }
}
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

### 调用示例

{% tabs %}
{% tab title="JavaScript" %}

```
// 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://api.bridgers.xyz/api/sswap/quote',params)
  console.log(res)
```

{% endtab %}
{% endtabs %}

### Postman 示例

![](/files/BWWf9HVGRgfiTkYIBHCM)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-bridgers.bridgers.xyz/bridgers-api-jie-kou/request-quote.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
