> For the complete documentation index, see [llms.txt](https://bitlong.gitbook.io/api-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bitlong.gitbook.io/api-doc/tapd-api/pool-deprecated.md).

# Pool-Deprecated

## 业务请求

所有接口需要 `Bearer Token`

该部分接口只提交请求，异步处理后查询结果。

### 1.添加流动性

添加流动性，对于`sat`，至少为1000，否则无法添加。

#### 请求

<mark style="color:orange;">`POST`</mark> `/pool/request/add_liquidity`

#### 请求体

* `token_a` <mark style="color:orange;">string</mark> 代币A，`sat`或资产ID
* `token_b` <mark style="color:orange;">string</mark> 代币B，`sat`或资产ID
* `amount_a_desired` <mark style="color:orange;">string</mark> 代币A最大添加数量
* `amount_b_desired` <mark style="color:orange;">string</mark> 代币B最大添加数量
* `amount_a_min` <mark style="color:orange;">string</mark> 代币A最小添加数量
* `amount_b_min` <mark style="color:orange;">string</mark> 代币B最小添加数量
* `username` <mark style="color:orange;">string</mark> 用户名

```json
{
    "token_a": "sat",
    "token_b": "9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41",
    "amount_a_desired": "50000",
    "amount_b_desired": "50000",
    "amount_a_min": "40000",
    "amount_b_min": "40000",
    "username": "npubTestUserAlice01234567890123456789012345678901234567890123456789012345678901TotalLength92"
}
```

#### 响应

```json
{"errno":0,"errmsg":"","data":null}
```

### 2.移除流动性

添加流动性，至少移除1000`sat`，否则无法移除。

#### 请求

<mark style="color:orange;">`POST`</mark> `/pool/request/remove_liquidity`

#### 请求体

* `token_a` <mark style="color:orange;">string</mark> 代币A，`sat`或资产ID
* `token_b` <mark style="color:orange;">string</mark> 代币B，`sat`或资产ID
* `iquidity` <mark style="color:orange;">string</mark> 要移除的流动性数量
* `amount_a_min` <mark style="color:orange;">string</mark> 代币A最小移除数量
* `amount_b_min` <mark style="color:orange;">string</mark> 代币B最小移除数量
* `username` <mark style="color:orange;">string</mark> 用户名
* `fee_k` <mark style="color:orange;">string</mark> 手续费比例，固定填3，代表千分之三

```json
{
    "token_a": "sat",
    "token_b": "9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41",
    "liquidity": "2000",
    "amount_a_min": "1900",
    "amount_b_min": "1900",
    "username": "bob",
    "fee_k": 3
}
```

#### 响应

```json
{"errno":0,"errmsg":"","data":null}
```

### 3.用确切数量代币交换不确定数量代币(单池)

#### 请求

<mark style="color:orange;">`POST`</mark> `/pool/request/swap_exact_token_for_token_no_path`

#### 请求体

* `token_in` <mark style="color:orange;">string</mark> 换入代币
* `token_out` <mark style="color:orange;">string</mark> 换出代币
* `amount_in` <mark style="color:orange;">string</mark> 换入代币数量
* `amount_out_min` <mark style="color:orange;">string</mark> 换出代币最小数量
* `username` <mark style="color:orange;">string</mark> 用户名
* `project_party_fee_k` <mark style="color:orange;">int</mark> 项目方手续费比例，固定填3，代表千分之三
* `lp_award_fee_k` <mark style="color:orange;">int</mark> LP奖励手续费比例，固定填3，代表千分之三

```json
{
    "token_in": "sat",
    "token_out": "9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41",
    "amount_in": "3000",
    "amount_out_min": "2900",
    "username": "npubTestUserAlice01234567890123456789012345678901234567890123456789012345678901TotalLength92",
    "project_party_fee_k": 3,
    "lp_award_fee_k": 3
}
```

#### 响应

```json
{"errno":0,"errmsg":"","data":null}
```

### 4.用不确定数量代币交换确切数量代币(单池)

#### 请求

<mark style="color:orange;">`POST`</mark> `/pool/request/swap_token_for_exact_token_no_path`

#### 请求体

* `token_in` <mark style="color:orange;">string</mark> 换入代币
* `token_out` <mark style="color:orange;">string</mark> 换出代币
* `amount_out` <mark style="color:orange;">string</mark> 换出代币数量
* `amount_in_max` <mark style="color:orange;">string</mark> 换入代币最大数量
* `username` <mark style="color:orange;">string</mark> 用户名
* `project_party_fee_k` <mark style="color:orange;">int</mark> 项目方手续费比例，固定填3，代表千分之三
* `lp_award_fee_k` <mark style="color:orange;">int</mark> LP奖励手续费比例，固定填3，代表千分之三

```json
{
    "token_in": "sat",
    "token_out": "9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41",
    "amount_out": "5000",
    "amount_in_max": "5100",
    "username": "npubTestUserAlice01234567890123456789012345678901234567890123456789012345678901TotalLength92",
    "project_party_fee_k": 3,
    "lp_award_fee_k": 3
}
```

#### 响应

```json
{"errno":0,"errmsg":"","data":null}
```

### 5.LP奖励提现

提现到托管账户

#### 请求

<mark style="color:orange;">`POST`</mark> `/pool/request/withdraw_award`

#### 请求体

* `username` <mark style="color:orange;">string</mark> 用户名
* `amount` <mark style="color:orange;">string</mark> 提现数量，至少为100，整数

```json
{
    "username": "npubTestUserAlice01234567890123456789012345678901234567890123456789012345678901TotalLength92",
    "amount": "200"
}
```

#### 响应

```json
{"errno":0,"errmsg":"","data":null}
```

## 业务请求记录和结果查询

所有接口需要 `Bearer Token`

### 1.1.\[总数]添加流动性

#### 请求

<mark style="color:green;">`GET`</mark> `/pool/batch/add_liquidity/count`

示例

/pool/batch/add\_liquidity/count

#### 参数

无

#### 响应

`data` 总数

```json
{"errno":0,"errmsg":"","data":3}
```

### 1.2.\[分页]添加流动性

#### 请求

<mark style="color:green;">`GET`</mark> `/pool/batch/add_liquidity`

示例

/pool/batch/add\_liquidity?<mark style="color:orange;">limit</mark>=<mark style="color:blue;">10</mark>&<mark style="color:orange;">offset</mark>=<mark style="color:blue;">1</mark>

#### 参数

* `limit` 限制数据条数
* `offset` 跳过数据条数

#### 响应

* `id` <mark style="color:orange;">uint</mark> ID
* `token_a` <mark style="color:orange;">string</mark> 代币A，`sat`或资产ID
* `token_b` <mark style="color:orange;">string</mark> 代币B，`sat`或资产ID
* `amount_a_desired` <mark style="color:orange;">string</mark> 代币A最大添加数量
* `amount_b_desired` <mark style="color:orange;">string</mark> 代币B最大添加数量
* `amount_a_min` <mark style="color:orange;">string</mark> 代币A最小添加数量
* `amount_b_min` <mark style="color:orange;">string</mark> 代币B最小添加数量
* `username` <mark style="color:orange;">string</mark> 用户名
* `result_amount_a` <mark style="color:orange;">string</mark> 处理结果代币A实际添加数量
* `result_amount_b` <mark style="color:orange;">string</mark> 处理结果代币B实际添加数量
* `result_liquidity` <mark style="color:orange;">string</mark> 处理结果获得流动性
* `result_err` <mark style="color:orange;">string</mark> 处理错误
* `state` <mark style="color:orange;">int</mark> 处理阶段、状态

```json
{"errno":0,"errmsg":"","data":[{"id":2,"token_a":"sat","token_b":"9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41","amount_a_desired":"50000","amount_b_desired":"50000","amount_a_min":"40000","amount_b_min":"40000","username":"npubTestUserAlice01234567890123456789012345678901234567890123456789012345678901TotalLength92","result_amount_a":"","result_amount_b":"","result_liquidity":"","result_err":"","state":0},{"id":1,"token_a":"sat","token_b":"9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41","amount_a_desired":"50000","amount_b_desired":"50000","amount_a_min":"50000","amount_b_min":"50000","username":"npubTestUserAlice01234567890123456789012345678901234567890123456789012345678901TotalLength92","result_amount_a":"","result_amount_b":"","result_liquidity":"","result_err":"","state":0}]}
```

### 2.1.\[总数]移除流动性

#### 请求

<mark style="color:green;">`GET`</mark> `/pool/batch/remove_liquidity/count`

示例

/pool/batch/remove\_liquidity/count

#### 参数

无

#### 响应

`data` 总数

```json
{"errno":0,"errmsg":"","data":2}
```

### 2.2.\[分页]移除流动性

#### 请求

<mark style="color:green;">`GET`</mark> `/pool/batch/remove_liquidity`

示例

/pool/batch/remove\_liquidity?<mark style="color:orange;">limit</mark>=<mark style="color:blue;">10</mark>&<mark style="color:orange;">offset</mark>=<mark style="color:blue;">1</mark>

#### 参数

* `limit` 限制数据条数
* `offset` 跳过数据条数

#### 响应

* `id` <mark style="color:orange;">uint</mark> ID
* `token_a` <mark style="color:orange;">string</mark> 代币A，`sat`或资产ID
* `token_b` <mark style="color:orange;">string</mark> 代币B，`sat`或资产ID
* `iquidity` <mark style="color:orange;">string</mark> 要移除的流动性数量
* `amount_a_min` <mark style="color:orange;">string</mark> 代币A最小移除数量
* `amount_b_min` <mark style="color:orange;">string</mark> 代币B最小移除数量
* `username` <mark style="color:orange;">string</mark> 用户名
* `fee_k` <mark style="color:orange;">string</mark> 手续费比例
* `result_amount_a` <mark style="color:orange;">string</mark> 处理结果代币A实际移除数量
* `result_amount_b` <mark style="color:orange;">string</mark> 处理结果代币B实际移除数量
* `result_err` <mark style="color:orange;">string</mark> 处理错误
* `state` <mark style="color:orange;">int</mark> 处理阶段、状态

```json
{"errno":0,"errmsg":"","data":[{"id":1,"token_a":"sat","token_b":"9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41","liquidity":"1000","amount_a_min":"20000","amount_b_min":"20000","username":"npubTestUserAlice01234567890123456789012345678901234567890123456789012345678901TotalLength92","fee_k":3,"result_amount_a":"","result_amount_b":"","result_err":"","state":0}]}
```

### 3.1.\[总数]用确切数量代币交换不确定数量代币(单池)

#### 请求

<mark style="color:green;">`GET`</mark> `/pool/batch/swap_exact_token_for_token_no_path/count`

示例

/pool/batch/swap\_exact\_token\_for\_token\_no\_path/count

#### 参数

无

#### 响应

`data` 总数

```json
{"errno":0,"errmsg":"","data":2}
```

### 3.2.\[分页]用确切数量代币交换不确定数量代币(单池)

#### 请求

<mark style="color:green;">`GET`</mark> `/pool/batch/swap_exact_token_for_token_no_path`

示例

/pool/batch/swap\_exact\_token\_for\_token\_no\_path?<mark style="color:orange;">limit</mark>=<mark style="color:blue;">10</mark>&<mark style="color:orange;">offset</mark>=<mark style="color:blue;">1</mark>

#### 参数

* `limit` 限制数据条数
* `offset` 跳过数据条数

#### 响应

* `id` <mark style="color:orange;">uint</mark> ID
* `token_in` <mark style="color:orange;">string</mark> 换入代币
* `token_out` <mark style="color:orange;">string</mark> 换出代币
* `amount_in` <mark style="color:orange;">string</mark> 换入代币数量
* `amount_out_min` <mark style="color:orange;">string</mark> 换出代币最小数量
* `username` <mark style="color:orange;">string</mark> 用户名
* `project_party_fee_k` <mark style="color:orange;">int</mark> 项目方手续费比例
* `lp_award_fee_k` <mark style="color:orange;">int</mark> LP奖励手续费比例
* `result_amount_out` <mark style="color:orange;">string</mark> 处理结果换出代币实际数量
* `result_err` <mark style="color:orange;">string</mark> 处理错误
* `state` <mark style="color:orange;">int</mark> 处理阶段、状态

```json
{"errno":0,"errmsg":"","data":[{"id":1,"token_in":"sat","token_out":"9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41","amount_in":"3000","amount_out_min":"100","username":"npubTestUserAlice01234567890123456789012345678901234567890123456789012345678901TotalLength92","project_party_fee_k":3,"lp_award_fee_k":3,"result_amount_out":"","result_err":"","state":0}]}
```

### 4.1.\[总数]用不确定数量代币交换确切数量代币(单池)

#### 请求

<mark style="color:green;">`GET`</mark> `/pool/batch/swap_token_for_exact_token_no_path/count`

示例

/pool/batch/swap\_token\_for\_exact\_token\_no\_path/count

#### 参数

无

#### 响应

`data` 总数

```json
{"errno":0,"errmsg":"","data":3}
```

### 4.2.\[分页]用不确定数量代币交换确切数量代币(单池)

#### 请求

<mark style="color:green;">`GET`</mark> `/pool/batch/swap_token_for_exact_token_no_path`

示例

/pool/batch/swap\_token\_for\_exact\_token\_no\_path?<mark style="color:orange;">limit</mark>=<mark style="color:blue;">10</mark>&<mark style="color:orange;">offset</mark>=<mark style="color:blue;">1</mark>

#### 参数

* `limit` 限制数据条数
* `offset` 跳过数据条数

#### 响应

* `id` <mark style="color:orange;">uint</mark> ID
* `token_in` <mark style="color:orange;">string</mark> 换入代币
* `token_out` <mark style="color:orange;">string</mark> 换出代币
* `amount_out` <mark style="color:orange;">string</mark> 换出代币数量
* `amount_in_max` <mark style="color:orange;">string</mark> 换入代币最大数量
* `username` <mark style="color:orange;">string</mark> 用户名
* `project_party_fee_k` <mark style="color:orange;">int</mark> 项目方手续费比例
* `lp_award_fee_k` <mark style="color:orange;">int</mark> LP奖励手续费比例
* `result_amount_in` <mark style="color:orange;">string</mark> 处理结果换入代币实际数量
* `result_err` <mark style="color:orange;">string</mark> 处理错误
* `state` <mark style="color:orange;">int</mark> 处理阶段、状态

```json
{"errno":0,"errmsg":"","data":[{"id":2,"token_in":"sat","token_out":"9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41","amount_out":"5000","amount_in_max":"5100","username":"npubTestUserAlice01234567890123456789012345678901234567890123456789012345678901TotalLength92","project_party_fee_k":3,"lp_award_fee_k":3,"result_amount_in":"","result_err":"","state":0},{"id":1,"token_in":"sat","token_out":"9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41","amount_out":"5000","amount_in_max":"9000","username":"npubTestUserAlice01234567890123456789012345678901234567890123456789012345678901TotalLength92","project_party_fee_k":3,"lp_award_fee_k":3,"result_amount_in":"","result_err":"","state":0}]}
```

### 5.1.\[总数]LP奖励提现

#### 请求

<mark style="color:green;">`GET`</mark> `/pool/batch/withdraw_award/count`

示例

/pool/batch/withdraw\_award/count

#### 参数

无

#### 响应

`data` 总数

```json
{"errno":0,"errmsg":"","data":1}
```

### 5.2.\[分页]LP奖励提现

#### 请求

<mark style="color:green;">`GET`</mark> `/pool/batch/withdraw_award`

示例

/pool/batch/withdraw\_award?<mark style="color:orange;">limit</mark>=<mark style="color:blue;">10</mark>&<mark style="color:orange;">offset</mark>=<mark style="color:blue;">1</mark>

#### 参数

* `limit` 限制数据条数
* `offset` 跳过数据条数

#### 响应

* `id` <mark style="color:orange;">uint</mark> ID
* `username` <mark style="color:orange;">string</mark> 用户名
* `amount` <mark style="color:orange;">string</mark> 提现数量
* `result_new_balance` <mark style="color:orange;">string</mark> 处理结果提现后余额
* `result_err` <mark style="color:orange;">string</mark> 处理错误
* `state` <mark style="color:orange;">int</mark> 处理阶段、状态

```json
{"errno":0,"errmsg":"","data":[{"id":1,"username":"npubTestUserAlice01234567890123456789012345678901234567890123456789012345678901TotalLength92","amount":"1000","result_new_balance":"","result_err":"","state":0}]}
```
