# Generate order information

### Endpoint usage

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

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

#### Request Body

| Name                                               | Type   | Description                                                                                                                                                                                                                      |
| -------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| equipmentNo<mark style="color:red;">\*</mark>      | String | Equipment number  (This field will be used as the unique identifier of the user, and the third parties can obtain it on their own, such as the first 32 characters of fromAddress, or a string of 32 random numbers and letters) |
| sourceType                                         | String | Device type  (H5/IOS/Android The field is optional, if it is requested directly through the API, it can be empty)                                                                                                                |
| sourceFlag<mark style="color:red;">\*</mark>       | String | Source channel  (Both sides need to agree on a name to represent the channel of the third parties)                                                                                                                               |
| hash<mark style="color:red;">\*</mark>             | String | Transaction hash                                                                                                                                                                                                                 |
| fromTokenAddress<mark style="color:red;">\*</mark> | String | Contract address for the token to sell  (It can be obtained from the address field in the currency list)                                                                                                                         |
| toTokenAddress<mark style="color:red;">\*</mark>   | String | Contract address for the token to receive  (It can be obtained from the address field in the currency list)                                                                                                                      |
| fromAddress<mark style="color:red;">\*</mark>      | String | User address                                                                                                                                                                                                                     |
| toAddress<mark style="color:red;">\*</mark>        | String | receiving Address                                                                                                                                                                                                                |
| fromTokenChain<mark style="color:red;">\*</mark>   | String | Network of the token to sell (It can be obtained from the chain field in the currency list, For details of the support chain, please refer to \[Basic information])                                                              |
| toTokenChain<mark style="color:red;">\*</mark>     | String | Network of the token to received (It can be obtained from the chain field in the currency list, For details of the support chain, please refer to \[Basic information])                                                          |
| fromTokenAmount<mark style="color:red;">\*</mark>  | String | Amount of token to sell (with precision, which can be obtained through the fromTokenAmount field in the quote endpoint)                                                                                                          |
| amountOutMin<mark style="color:red;">\*</mark>     | String | Expected amount received (with precision, which can be obtained through the amountOutMin field in the quote endpoint)                                                                                                            |
| fromCoinCode<mark style="color:red;">\*</mark>     | String | Token name for sell token  (It can be obtained from the symbol field in the currency list)                                                                                                                                       |
| toCoinCode<mark style="color:red;">\*</mark>       | String | Token name for receive token  (It can be obtained from the symbol field in the currency list)                                                                                                                                    |
| slippage                                           | String | <p>e.g. '0.1' (<strong>meaning 10%</strong>)<br>Minimum amount received = amountOutMin \* (1 - slippage)</p>                                                                                                                     |

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

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

{% endtab %}
{% endtabs %}

### Code example

{% 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://1371637894-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBjj3xwD1ODc9uBxuQrlr%2Fuploads%2FW0GE3krIqoZFe2WAIYSU%2F4.jpg?alt=media\&token=3add8d76-c9e2-4667-a230-4f11cdd136e8)
