# RWA

## 用户登录token鉴权

<mark style="color:green;">`POST`</mark> `https://service.xxx.com/platformapi/chainup/open/rwa/token/verify`

需要将参数表格中的数据包装成json字符串 利用rsa 进行参数加密和签名 作为body中的data和sign

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | String | application/json |

#### Request Body

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| app\_id<mark style="color:red;">\*</mark> | String | 商家唯一app\_id |
| time<mark style="color:red;">\*</mark>    | String | 请求时间        |
| sign<mark style="color:red;">\*</mark>    | String | 签名          |
| data<mark style="color:red;">\*</mark>    | String | 加密字符串       |

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

```json
{
    "code": "", //返回code	
    "msg": "", //成功或失败提示信息	
    "data": "",
    "sign": ""
}

data 中解密后的结构体

{
    "uid":12345 // saas user id
}
```

{% endtab %}
{% endtabs %}

以下为参与rsa加密的参数:

| 名称    | 类型     | 是否必填 | 例子                                                               | 描述        |
| ----- | ------ | ---- | ---------------------------------------------------------------- | --------- |
| token | String | 是    | 63fe725e1fac6f6b279a125b5cc0acbecccf63728c884bf4ac9432ec3f87f88a | 用户登录token |

## 用户余额查询接口

<mark style="color:green;">`POST`</mark> `https://service.xxx.com/platformapi/chainup/open/rwa/user/balance`

需要将参数表格中的数据包装成json字符串 利用rsa 进行参数加密和签名 作为body中的data和sign

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | String | application/json |

#### Request Body

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| app\_id<mark style="color:red;">\*</mark> | String | 商家唯一app\_id |
| time<mark style="color:red;">\*</mark>    | String | 请求时间        |
| sign<mark style="color:red;">\*</mark>    | String | 签名          |
| data<mark style="color:red;">\*</mark>    | String | 加密字符串       |

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

```json
{
    "code": "", //返回code	
    "msg": "", //成功或失败提示信息	
    "data": "",
    "sign": ""
}

data 中解密后的结构体
[
    {
        "symbol":"TUSDT5248", //币种名称
        "showName":"TUSDT",//币种前台展示名称
        "totalBalance":"10000",//币币总余额
        "normalBalance":"5000",//币币可用余额
        "lockBalance":"5000"//币币冻结余额
    },
    {
        "symbol":"RWA5248",
        "showName":"RWA",
        "totalBalance":"10000",
        "normalBalance":"7000",
        "lockBalance":"3000"
    }
]
```

{% endtab %}
{% endtabs %}

以下为参与rsa加密的参数:

| 名称      | 类型      | 是否必填 | 例子                | 描述                       |
| ------- | ------- | ---- | ----------------- | ------------------------ |
| uid     | Integer | 是    | 12345             | saas交易所用户id              |
| symbols | String  | 是    | TUSDT5248,RWA5248 | saas币种名称，如果传多个以英文逗号","分隔 |

## 上RWA通证代币

<mark style="color:green;">`POST`</mark> `https://service.xxx.com/platformapi/chainup/open/rwa/rwaSymbol/add`

需要将参数表格中的数据包装成json字符串 利用rsa 进行参数加密和签名 作为body中的data和sign

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | String | application/json |

#### Request Body

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| app\_id<mark style="color:red;">\*</mark> | String | 商家唯一app\_id |
| time<mark style="color:red;">\*</mark>    | String | 请求时间        |
| sign<mark style="color:red;">\*</mark>    | String | 签名          |
| data<mark style="color:red;">\*</mark>    | String | 加密字符串       |

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

```json
{
    "code": "", //返回code	
    "msg": "", //成功或失败提示信息	
    "data": "",
    "sign": ""
}

data 中解密后的结构体
{
        "coinSymbol":"RWA5248", //币种名称
        "showName":"RWA",//币种前台展示名称
        "type":3,//rwa通证代币
        "tokenBase":"ETH5248",//主链币
        "contractAddress":"sdcdacad",//合约地址
        "contractPrecision":8,//合约精度
        "depositOpen":1,//充值开关 0关闭 1开启
        "withdrawOpen":1//提现开关 0关闭 1开启
    }
```

{% endtab %}
{% endtabs %}

以下为参与rsa加密的参数:

| 名称                | 类型      | 是否必填 | 例子      | 描述                         |
| ----------------- | ------- | ---- | ------- | -------------------------- |
| symbolName        | String  | 是    | RWATEST | rwa通证代币前台显示名称              |
| contractAddress   | String  | 是    | scdaca  | 合约地址                       |
| contractPrecision | Integer | 是    | 8       | 合约精度                       |
| tokenBase         | String  | 是    | ETH     | 主链币，固定值：ETH，此接口目前只能上ETH的代币 |

## 查询币种列表

<mark style="color:green;">`POST`</mark> `https://service.xxx.com/platformapi/chainup/open/rwa/symbol/list`

需要将参数表格中的数据包装成json字符串 利用rsa 进行参数加密和签名 作为body中的data和sign

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | String | application/json |

#### Request Body

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| app\_id<mark style="color:red;">\*</mark> | String | 商家唯一app\_id |
| time<mark style="color:red;">\*</mark>    | String | 请求时间        |
| sign<mark style="color:red;">\*</mark>    | String | 签名          |
| data<mark style="color:red;">\*</mark>    | String | 加密字符串       |

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

```json
{
    "code": "", //返回code	
    "msg": "", //成功或失败提示信息	
    "data": "",
    "sign": ""
}

data 中解密后的结构体
[
   {
        "coinSymbol":"RWA5248", //币种名称
        "showName":"RWA",//币种前台展示名称
        "type":3,//币种类型 1 数字货币 2 法币 3 RWA通证代币
        "tokenBase":"ETH5248",//主链币
        "contractAddress":"sdcdacad",//合约地址
        "showPrecision":8,//显示精度
        "depositOpen":1,//充值开关 0关闭 1开启
        "withdrawOpen":1//提现开关 0关闭 1开启
    }
]
```

{% endtab %}
{% endtabs %}

以下为参与rsa加密的参数:

| 名称     | 类型      | 是否必填 | 例子      | 描述                                            |
| ------ | ------- | ---- | ------- | --------------------------------------------- |
| type   | Integer | 否    | 3       | 币种类型，非必填，1 数字货币  2 法币  3 RWA通证代币 ， 不传则默认查所有类型 |
| symbol | String  | 否    | RWA1563 | 币种名称，非必填，传则查指定币种                              |

## rwa下单冻结/撤单解冻

<mark style="color:green;">`POST`</mark> `https://service.xxx.com/platformapi/chainup/open/rwa/order`

需要将参数表格中的数据包装成json字符串 利用rsa 进行参数加密和签名 作为body中的data和sign

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | String | application/json |

#### Request Body

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| app\_id<mark style="color:red;">\*</mark> | String | 商家唯一app\_id |
| time<mark style="color:red;">\*</mark>    | String | 请求时间        |
| sign<mark style="color:red;">\*</mark>    | String | 签名          |
| data<mark style="color:red;">\*</mark>    | String | 加密字符串       |

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

```json
{
    "code": "", //返回code	
    "msg": "", //成功或失败提示信息	
    "data": "",
    "sign": ""
}

data 中解密后的结构体
{
    "orderId":"12345"//交易所冻结解冻订单id
}
```

{% endtab %}
{% endtabs %}

以下为参与rsa加密的参数:

| 名称         | 类型      | 是否必填 | 例子            | 描述                                    |
| ---------- | ------- | ---- | ------------- | ------------------------------------- |
| uid        | Integer | 是    | 552233        | 下单用户uid                               |
| side       | String  | 是    | BUY           | 买卖方向，固定值：BUY、SELL                     |
| type       | Integer | 是    | 0             | 转账类型：0 下单冻结 ； 1 撤单解冻                  |
| coinSymbol | String  | 是    | RWA1711       | 币种名称                                  |
| amount     | Integer | 是    | 100           | 金额                                    |
| fee        | Integer | 否    | 5             | 手续费，没有可不传或者传0                         |
| orderType  | Integer | 是    | 1             | 订单类型：1 认购订单  2 otc市场订单                |
| rwaOrderId | String  | 是    | 123456        | rwa外部系统订单id                           |
| remark     | String  | 否    | remark        | 订单备注，非必填                              |
| token      | String  | 否    | sncjdankcnkda | 用户登录token，除开【认购订单】&【SELL】之外，其余订单均需要校验 |

## rwa 成交

<mark style="color:green;">`POST`</mark> `https://service.xxx.com/platformapi/chainup/open/rwa/trade`

需要将参数表格中的数据包装成json字符串 利用rsa 进行参数加密和签名 作为body中的data和sign

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | String | application/json |

#### Request Body

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| app\_id<mark style="color:red;">\*</mark> | String | 商家唯一app\_id |
| time<mark style="color:red;">\*</mark>    | String | 请求时间        |
| sign<mark style="color:red;">\*</mark>    | String | 签名          |
| data<mark style="color:red;">\*</mark>    | String | 加密字符串       |

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

```json
{
    "code": "", //返回code	
    "msg": "", //成功或失败提示信息	
    "data": "",
    "sign": ""
}

data 中解密后的结构体
{
    "tradeId":"12345"//交易所成交单id
}
```

{% endtab %}
{% endtabs %}

以下为参与rsa加密的参数:

| 名称          | 类型          | 是否必填 | 例子      | 描述                            |
| ----------- | ----------- | ---- | ------- | ----------------------------- |
| rwaBuyId    | String      | 是    | 12345   | rwa外部系统买单id                   |
| rwaSellId   | String      | 是    | 54321   | rwa外部系统卖单id                   |
| trendSide   | String      | 是    | BUY     | 主动单方向，固定值：BUY、SELL            |
| bidUserId   | Integer     | 是    | 223344  | 买方用户id                        |
| askUserId   | Integer     | 是    | 445566  | 卖方用户id                        |
| buyCoin     | String      | 是    | USD1711 | 买单需要支付的币种                     |
| sellCoin    | String      | 是    | RWA1711 | 卖单需要支付的币种                     |
| buyAmount   | BigDeceimal | 是    | 100     | 买单需要成交的金额                     |
| sellAmount  | BigDeceimal | 是    | 500     | 卖单需要成交的金额                     |
| buyFeeCoin  | String      | 是    | USD1711 | 买单支付手续费的币种                    |
| sellFeeCoin | String      | 是    | USD1711 | 卖单支付手续费的币种                    |
| buyFee      | BigDeceimal | 否    | 5       | 买单手续费，没有就不传或者传0               |
| sellFee     | BigDeceimal | 否    | 10      | 卖单手续费，没有就不传或者传0               |
| tradeType   | Integer     | 是    | 1       | 成交类型：1 认购订单成交 2 otc市场订单成交     |
| remark      | String      | 否    | remark  | 成交备注，非必填                      |
| feeUserId   | Integer     | 是    | 12345   | 手续费接收uid，买卖双方交的手续费，会交到此用户的账户中 |

## 币种持仓列表

<mark style="color:green;">`POST`</mark> `https://service.xxx.com/platformapi/chainup/open/rwa/symbol/balance`

需要将参数表格中的数据包装成json字符串 利用rsa 进行参数加密和签名 作为body中的data和sign

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | String | application/json |

#### Request Body

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| app\_id<mark style="color:red;">\*</mark> | String | 商家唯一app\_id |
| time<mark style="color:red;">\*</mark>    | String | 请求时间        |
| sign<mark style="color:red;">\*</mark>    | String | 签名          |
| data<mark style="color:red;">\*</mark>    | String | 加密字符串       |

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

```json
{
    "code": "", //返回code	
    "msg": "", //成功或失败提示信息	
    "data": "",
    "sign": ""
}

data 中解密后的结构体
{
    "count": 15,  //总记录数
    "pageSize": 10,  //分页参数：每页大小
    "page": 1,  //分页参数：页码
    "list": [  //结果集
        {
            "uid": 24003810,  //uid
            "balance": 9999999.0000000000000000  //总余额（可用+冻结）
            "lockBalance": 0   //冻结余额
            "normalBalance": 9999999.0000000000000000   //可用余额
        }
    ]
}
```

{% endtab %}
{% endtabs %}

以下为参与rsa加密的参数:

| 名称       | 类型     | 是否必填 | 例子       | 描述            |
| -------- | ------ | ---- | -------- | ------------- |
| symbol   | String | 是    | USDT1563 | 币种名称          |
| page     | number | 是    | 1        | 分页参数：页码，最小值 1 |
| pageSize | number | 是    | 20       | 分页参数：每页大小     |

## 用户充值地址

<mark style="color:green;">`POST`</mark> `https://service.xxx.com/platformapi/chainup/open/rwa/user/depositAddress`

需要将参数表格中的数据包装成json字符串 利用rsa 进行参数加密和签名 作为body中的data和sign

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | String | application/json |

#### Request Body

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| app\_id<mark style="color:red;">\*</mark> | String | 商家唯一app\_id |
| time<mark style="color:red;">\*</mark>    | String | 请求时间        |
| sign<mark style="color:red;">\*</mark>    | String | 签名          |
| data<mark style="color:red;">\*</mark>    | String | 加密字符串       |

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

```json
{
    "code": "", //返回code	
    "msg": "", //成功或失败提示信息	
    "data": "",
    "sign": ""
}

data 中解密后的结构体
{
    "address": "ascsabjcbaksdbckasabcab",  //充值地址
    "memo": "5237687"  //memo
}
```

{% endtab %}
{% endtabs %}

以下为参与rsa加密的参数:

| 名称     | 类型     | 是否必填 | 例子       | 描述     |
| ------ | ------ | ---- | -------- | ------ |
| symbol | String | 是    | USDT1563 | 币种名称   |
| uid    | number | 是    | 3728238  | 交易所uid |

## 用户谷歌验证

<mark style="color:green;">`POST`</mark> `https://service.xxx.com/platformapi/chainup/open/rwa/user/googleVerify`

需要将参数表格中的数据包装成json字符串 利用rsa 进行参数加密和签名 作为body中的data和sign

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | String | application/json |

#### Request Body

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| app\_id<mark style="color:red;">\*</mark> | String | 商家唯一app\_id |
| time<mark style="color:red;">\*</mark>    | String | 请求时间        |
| sign<mark style="color:red;">\*</mark>    | String | 签名          |
| data<mark style="color:red;">\*</mark>    | String | 加密字符串       |

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

```json
{
    "code": "", //返回code	
    "msg": "", //成功或失败提示信息	
    "data": "",
    "sign": ""
}
```

{% endtab %}
{% endtabs %}

以下为参与rsa加密的参数:

| 名称         | 类型     | 是否必填 | 例子      | 描述     |
| ---------- | ------ | ---- | ------- | ------ |
| googleCode | String | 是    | 123456  | 谷歌验证码  |
| uid        | number | 是    | 3728238 | 交易所uid |

## 通证资产投资交易开关

<mark style="color:green;">`POST`</mark> `https://service.xxx.com/platformapi/chainup/open/rwa/symbol/investTransaction`

需要将参数表格中的数据包装成json字符串 利用rsa 进行参数加密和签名 作为body中的data和sign

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | String | application/json |

#### Request Body

<table><thead><tr><th width="166">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>String</td><td>商家唯一app_id</td></tr><tr><td>time<mark style="color:red;">*</mark></td><td>String</td><td>请求时间</td></tr><tr><td>sign<mark style="color:red;">*</mark></td><td>String</td><td>签名</td></tr><tr><td>data<mark style="color:red;">*</mark></td><td>String</td><td>加密字符串</td></tr></tbody></table>

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

```json
{
    "code": "", //返回code	
    "msg": "", //成功或失败提示信息	
    "data": "",
    "sign": ""
}
```

{% endtab %}
{% endtabs %}

以下为参与rsa加密的参数:

<table><thead><tr><th>名称</th><th width="125">类型</th><th>是否必填</th><th>例子</th><th>描述</th></tr></thead><tbody><tr><td>symbol</td><td>String</td><td>是</td><td>RWA1711</td><td>通证资产币种名称</td></tr><tr><td>investOpen</td><td>number</td><td>是</td><td>1</td><td>投资开关： 0 关闭    1 开启</td></tr><tr><td>transactionOpen</td><td>number</td><td>是</td><td>1</td><td>交易开关： 0 关闭    1 开启</td></tr></tbody></table>

## rwa otc市场订单批量成交

<mark style="color:green;">`POST`</mark> `https://service.xxx.com/platformapi/chainup/open/rwa/otc/batchTrade`

需要将参数表格中的数据包装成json字符串 利用rsa 进行参数加密和签名 作为body中的data和sign

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | String | application/json |

#### Request Body

<table><thead><tr><th width="354">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>String</td><td>商家唯一app_id</td></tr><tr><td>time<mark style="color:red;">*</mark></td><td>String</td><td>请求时间</td></tr><tr><td>sign<mark style="color:red;">*</mark></td><td>String</td><td>签名</td></tr><tr><td>data<mark style="color:red;">*</mark></td><td>String</td><td>加密字符串</td></tr></tbody></table>

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

```json
{
    "code": "", //返回code	
    "msg": "", //成功或失败提示信息	
    "data": "",
    "sign": ""
}

data 中解密后的结构体
{
   "tradeList":[
                  {
                    "rwaOrderId":"123",       //rwa外部系统主动单id
                    "passivityOrderId":"2",   //rwa外部系统被动单id
                    "tradeId":"222"           //交易所成交单id
                  }
               ]
}
```

{% endtab %}
{% endtabs %}

以下为参与rsa加密的参数:

```
{
    "trendSide":"BUY",              //主动单方向，固定值：BUY、SELL
    "rwaOrderId":"123",             //rwa外部系统主动单id
    "uid":123,                      //主动单用户id
    "coin":"USD1711",               //主动单需要支付的币种
    "feeCoin":"USD1711",            //主动单需要支付手续费的币种
    "remark":"成交备注",             //成交备注，非必填
    "feeUserId":11,                 //手续费接收uid，买卖双方交的手续费，会交到此用户的账户中
    "passivityCoin":"RAW1711",      //被动单需要支付的币种
    "passivityFeeCoin":"USD1711",   //被动单需要支付手续费的币种
    "passivityOrderList":[          //被动单信息列表
        {
            "amount":100,            //主动单需要支付的金额
            "fee":5,                 //主动单需要支付的手续费，没有就不传或者传0
            "passivityOrderId":"2",  //rwa外部系统被动单id
            "passivityUid":456,      //被动单用户id
            "passivityAmount":500,   //被动单需要支付的金额
            "passivityFee":10        //被动单需要支付的手续费，没有就不传或者传0
        }
    ]
}
```

## rwa 订单查询

<mark style="color:green;">`POST`</mark> `https://service.xxx.com/platformapi/chainup/open/rwa/select/order`

需要将参数表格中的数据包装成json字符串 利用rsa 进行参数加密和签名 作为body中的data和sign

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | String | application/json |

#### Request Body

<table><thead><tr><th width="166">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>app_id<mark style="color:red;">*</mark></td><td>String</td><td>商家唯一app_id</td></tr><tr><td>time<mark style="color:red;">*</mark></td><td>String</td><td>请求时间</td></tr><tr><td>sign<mark style="color:red;">*</mark></td><td>String</td><td>签名</td></tr><tr><td>data<mark style="color:red;">*</mark></td><td>String</td><td>加密字符串</td></tr></tbody></table>

```json
{
    "code": "", //返回code	
    "msg": "", //成功或失败提示信息	
    "data": "",
    "sign": ""
}

data 中解密后的结构体
{
    "orderId":"12345"//交易所冻结解冻订单id
}
```

以下为参与rsa加密的参数:

<table><thead><tr><th>名称</th><th width="125">类型</th><th>是否必填</th><th>例子</th><th>描述</th></tr></thead><tbody><tr><td>rwaOrderId</td><td>String</td><td>是</td><td>112233</td><td>rwa外部系统订单id</td></tr><tr><td>orderType</td><td>number</td><td>是</td><td>1</td><td>订单类型：1 认购订单  2 otc市场订单</td></tr></tbody></table>
