# 生成订单信息

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

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

#### Request Body

| Name                                               | Type   | Description                                                               |
| -------------------------------------------------- | ------ | ------------------------------------------------------------------------- |
| equipmentNo<mark style="color:red;">\*</mark>      | String | 设备号设备号（该字段将作为用户的唯一标识，三方可通过自己的方式获得，如fromAddress的前32位字符，或者32位随机数字与字母结合的字符串） |
| sourceFlag<mark style="color:red;">\*</mark>       | String | 渠道来源（需要双方约定一个名称来代表三方的渠道）                                                  |
| hash<mark style="color:red;">\*</mark>             | String | 交易哈希                                                                      |
| sourceType                                         | String | 设备类型（H5/IOS/Android 该字段为选填，如通过直接通过API调用，可为空)                              |
| fromTokenAddress<mark style="color:red;">\*</mark> | String | 出售币种合约地址（可通过获取币种列表中的address字段获得）                                          |
| toTokenAddress<mark style="color:red;">\*</mark>   | String | 获得币种合约地址（可通过获取币种列表中的address字段获得）                                          |
| fromAddress<mark style="color:red;">\*</mark>      | String | 用户地址                                                                      |
| toAddress<mark style="color:red;">\*</mark>        | String | 接受地址                                                                      |
| fromTokenChain<mark style="color:red;">\*</mark>   | String | 出售币种链（可通过获取币种列表中的chain字段获得，详细支持链的情况可查看【基本说明】）                             |
| toTokenChain<mark style="color:red;">\*</mark>     | String | 获得币种链（可通过获取币种列表中的chain字段获得，详细支持链的情况可查看【基本说明】）                             |
| fromTokenAmount<mark style="color:red;">\*</mark>  | String | 出售币种数量(带精度，可通过询价接口里的fromTokenAmount字段获得)                                  |
| amountOutMin<mark style="color:red;">\*</mark>     | String | 预期得到币种数量(带精度，可通过询价接口里的amountOutMin字段获得)                                   |
| fromCoinCode<mark style="color:red;">\*</mark>     | String | 出售代币名称 (可通过获取币种列表中的symbol字段获得）                                            |
| toCoinCode<mark style="color:red;">\*</mark>       | String | 获得代币名称  (可通过获取币种列表中的symbol字段获得）                                           |
| slippage                                           | String | 滑点，例如：0.1（代表10%）最低接收数量 = amountOutMin \* (1 - slippage)                   |

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

```javascript
{
 "resCode":100,
 "resMsg":"success",
 "data":{
  "orderId":"..." // 订单号orderId
  }
}
```

{% endtab %}
{% endtabs %}

### 调用示例

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

```
// example
//You can get the order number through the swap interface
const params = {
  hash: '0x05920386bc07d71b58109fab0ab591c5e07d7b15f7a8d77c692fd735048d9dba', //  User sends token hash
  fromTokenAddress: '0x55d398326f99059ff775485246999027b3197955',
  toTokenAddress: '0xa71edc38d189767582c38a3145b5873052c3e47a',
  fromAddress:"0x19...",
  toAddress:"0x19...",
  fromTokenChain:"HECO",
  toTokenChain:"HECO",
  fromTokenAmount: "3293000000000000000",
  amountOutMin:"28891153244504185000",
  fromCoinCode:"HT(HECO)",
  toCoinCode:"USDT(HECO)",
  sourceFlag:"widget",
  sourceType:"H5"
}
const res = await axios.post('https://api.bridgers.xyz/api/exchangeRecord/updateDataAndStatus',params)
console.log(res)
```

{% endtab %}
{% endtabs %}

### Postman 示例

![](https://2788010628-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbvHxRlkSqGfe4qMOuqzl%2Fuploads%2FjJ83L9cSUGWnSteKKJZf%2F4.jpg?alt=media\&token=93131b4f-03c1-44fa-b5b3-2d184c1470c1)
