@binance/c2c 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENCE +21 -0
- package/README.md +195 -0
- package/dist/index.d.mts +381 -0
- package/dist/index.d.ts +381 -0
- package/dist/index.js +230 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +211 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +55 -0
package/LICENCE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Binance
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Binance JavaScript C2C Connector
|
|
2
|
+
|
|
3
|
+
[](https://github.com/binance/binance-connector-js/issues)
|
|
4
|
+
[](https://prettier.io/)
|
|
5
|
+
[](https://badge.fury.io/js/@binance%2Fc2c)
|
|
6
|
+
[](https://www.npmjs.com/package/@binance/c2c)
|
|
7
|
+

|
|
8
|
+
[](https://snyk.io/test/github/binance/binance-connector-js)
|
|
9
|
+
[](https://opensource.org/licenses/MIT)
|
|
10
|
+
|
|
11
|
+
This is a client library for the Binance C2C API, enabling developers to interact programmatically with Binance's C2C trading platform. The library provides tools to query Fiat transaction history through the REST API:
|
|
12
|
+
|
|
13
|
+
- [REST API](./src/rest-api/rest-api.ts)
|
|
14
|
+
|
|
15
|
+
## Table of Contents
|
|
16
|
+
|
|
17
|
+
- [Supported Features](#supported-features)
|
|
18
|
+
- [Installation](#installation)
|
|
19
|
+
- [Documentation](#documentation)
|
|
20
|
+
- [REST APIs](#rest-apis)
|
|
21
|
+
- [Testing](#testing)
|
|
22
|
+
- [Migration Guide](#migration-guide)
|
|
23
|
+
- [Contributing](#contributing)
|
|
24
|
+
- [Licence](#licence)
|
|
25
|
+
|
|
26
|
+
## Supported Features
|
|
27
|
+
|
|
28
|
+
- REST API Endpoints:
|
|
29
|
+
- `/sapi/v1/c2c/*`
|
|
30
|
+
- Inclusion of test cases and examples for quick onboarding.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
To use this library, ensure your environment is running Node.js version **22.12.0** or later. If you're using `nvm` (Node Version Manager), you can set the correct version as follows:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
nvm install 22.12.0
|
|
38
|
+
nvm use 22.12.0
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Then install the library using `npm`:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install @binance/c2c
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Documentation
|
|
48
|
+
|
|
49
|
+
For detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/c2c).
|
|
50
|
+
|
|
51
|
+
### REST APIs
|
|
52
|
+
|
|
53
|
+
All REST API endpoints are available through the [`rest-api`](./src/rest-api/rest-api.ts) module. Note that some endpoints require authentication using your Binance API credentials.
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { C2C, C2CRestAPI } from '@binance/c2c';
|
|
57
|
+
|
|
58
|
+
const configurationRestAPI = {
|
|
59
|
+
apiKey: 'your-api-key',
|
|
60
|
+
apiSecret: 'your-api-secret',
|
|
61
|
+
};
|
|
62
|
+
const client = new C2C({ configurationRestAPI });
|
|
63
|
+
|
|
64
|
+
client.restAPI
|
|
65
|
+
.getC2CTradeHistory()
|
|
66
|
+
.then((res) => res.data())
|
|
67
|
+
.then((data: C2CRestAPI.GetC2CTradeHistoryResponse) => console.log(data))
|
|
68
|
+
.catch((err) => console.error(err));
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
More examples can be found in the [`examples/rest-api`](./examples/rest-api/) folder.
|
|
72
|
+
|
|
73
|
+
#### Configuration Options
|
|
74
|
+
|
|
75
|
+
The REST API supports the following advanced configuration options:
|
|
76
|
+
|
|
77
|
+
- `timeout`: Timeout for requests in milliseconds (default: 1000 ms).
|
|
78
|
+
- `proxy`: Proxy configuration:
|
|
79
|
+
- `host`: Proxy server hostname.
|
|
80
|
+
- `port`: Proxy server port.
|
|
81
|
+
- `protocol`: Proxy protocol (http or https).
|
|
82
|
+
- `auth`: Proxy authentication credentials:
|
|
83
|
+
- `username`: Proxy username.
|
|
84
|
+
- `password`: Proxy password.
|
|
85
|
+
- `keepAlive`: Enable HTTP keep-alive (default: true).
|
|
86
|
+
- `compression`: Enable response compression (default: true).
|
|
87
|
+
- `retries`: Number of retry attempts for failed requests (default: 3).
|
|
88
|
+
- `backoff`: Delay in milliseconds between retries (default: 1000 ms).
|
|
89
|
+
- `httpsAgent`: Custom HTTPS agent for advanced TLS configuration.
|
|
90
|
+
- `privateKey`: RSA or ED25519 private key for authentication.
|
|
91
|
+
- `privateKeyPassphrase`: Passphrase for the private key, if encrypted.
|
|
92
|
+
|
|
93
|
+
##### Timeout
|
|
94
|
+
|
|
95
|
+
You can configure a timeout for requests in milliseconds. If the request exceeds the specified timeout, it will be aborted. See the [Timeout example](./docs/rest-api/timeout.md) for detailed usage.
|
|
96
|
+
|
|
97
|
+
##### Proxy
|
|
98
|
+
|
|
99
|
+
The REST API supports HTTP/HTTPS proxy configurations. See the [Proxy example](./docs/rest-api/proxy.md) for detailed usage.
|
|
100
|
+
|
|
101
|
+
##### Keep-Alive
|
|
102
|
+
|
|
103
|
+
Enable HTTP keep-alive for persistent connections. See the [Keep-Alive example](./docs/rest-api/keepAlive.md) for detailed usage.
|
|
104
|
+
|
|
105
|
+
##### Compression
|
|
106
|
+
|
|
107
|
+
Enable or disable response compression. See the [Compression example](./docs/rest-api/compression.md) for detailed usage.
|
|
108
|
+
|
|
109
|
+
##### Retries
|
|
110
|
+
|
|
111
|
+
Configure the number of retry attempts and delay in milliseconds between retries for failed requests. See the [Retries example](./docs/rest-api/retries.md) for detailed usage.
|
|
112
|
+
|
|
113
|
+
##### HTTPS Agent
|
|
114
|
+
|
|
115
|
+
Customize the HTTPS agent for advanced TLS configurations. See the [HTTPS Agent example](./docs/rest-api/httpsAgent.md) for detailed usage.
|
|
116
|
+
|
|
117
|
+
##### Key Pair Based Authentication
|
|
118
|
+
|
|
119
|
+
The REST API supports key pair-based authentication for secure communication. You can use `RSA` or `ED25519` keys for signing requests. See the [Key Pair Based Authentication example](./docs/rest-api/key-pair-authentication.md) for detailed usage.
|
|
120
|
+
|
|
121
|
+
##### Certificate Pinning
|
|
122
|
+
|
|
123
|
+
To enhance security, you can use certificate pinning with the `httpsAgent` option in the configuration. This ensures the client only communicates with servers using specific certificates. See the [Certificate Pinning example](./docs/rest-api/certificate-pinning.md) for detailed usage.
|
|
124
|
+
|
|
125
|
+
#### Error Handling
|
|
126
|
+
|
|
127
|
+
The REST API provides detailed error types to help you handle issues effectively:
|
|
128
|
+
|
|
129
|
+
- `ConnectorClientError`: General client error.
|
|
130
|
+
- `RequiredError`: Thrown when a required parameter is missing.
|
|
131
|
+
- `UnauthorizedError`: Indicates missing or invalid authentication credentials.
|
|
132
|
+
- `ForbiddenError`: Access to the requested resource is forbidden.
|
|
133
|
+
- `TooManyRequestsError`: Rate limit exceeded.
|
|
134
|
+
- `RateLimitBanError`: IP address banned for exceeding rate limits.
|
|
135
|
+
- `ServerError`: Internal server error.
|
|
136
|
+
- `NetworkError`: Issues with network connectivity.
|
|
137
|
+
- `NotFoundError`: Resource not found.
|
|
138
|
+
- `BadRequestError`: Invalid request.
|
|
139
|
+
|
|
140
|
+
See the [Error Handling example](./docs/rest-api/error-handling.md) for detailed usage.
|
|
141
|
+
|
|
142
|
+
#### Testnet
|
|
143
|
+
|
|
144
|
+
For testing purposes, `/sapi/v1/c2c/*` endpoints can be used in the [Testnet](https://testnet.binance.vision/). Update the `basePath` in your configuration:
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { C2C, C2CRestAPI, C2C_REST_API_TESTNET_URL } from '@binance/c2c';
|
|
148
|
+
|
|
149
|
+
const configurationRestAPI = {
|
|
150
|
+
apiKey: 'your-api-key',
|
|
151
|
+
apiSecret: 'your-api-secret',
|
|
152
|
+
basePath: C2C_REST_API_TESTNET_URL,
|
|
153
|
+
};
|
|
154
|
+
const client = new C2C({ configurationRestAPI });
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
If `basePath` is not provided, it defaults to `https://api.binance.com`.
|
|
158
|
+
|
|
159
|
+
## Testing
|
|
160
|
+
|
|
161
|
+
To run the tests:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
npm install
|
|
165
|
+
|
|
166
|
+
npm run test
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
The tests cover:
|
|
170
|
+
|
|
171
|
+
- REST API endpoints
|
|
172
|
+
- Error handling and edge cases
|
|
173
|
+
|
|
174
|
+
## Migration Guide
|
|
175
|
+
|
|
176
|
+
If you are upgrading to the new modularized structure, refer to the [Migration Guide](./docs/migration_guide_c2c_connector.md) for detailed steps.
|
|
177
|
+
|
|
178
|
+
## Contributing
|
|
179
|
+
|
|
180
|
+
Contributions are welcome!
|
|
181
|
+
|
|
182
|
+
Since this repository contains auto-generated code, we encourage you to start by opening a GitHub issue to discuss your ideas or suggest improvements. This helps ensure that changes align with the project's goals and auto-generation processes.
|
|
183
|
+
|
|
184
|
+
To contribute:
|
|
185
|
+
|
|
186
|
+
1. Open a GitHub issue describing your suggestion or the bug you've identified.
|
|
187
|
+
2. If it's determined that changes are necessary, the maintainers will merge the changes into the main branch.
|
|
188
|
+
|
|
189
|
+
Please ensure that all tests pass if you're making a direct contribution. Submit a pull request only after discussing and confirming the change.
|
|
190
|
+
|
|
191
|
+
Thank you for your contributions!
|
|
192
|
+
|
|
193
|
+
## Licence
|
|
194
|
+
|
|
195
|
+
This project is licensed under the MIT License. See the [LICENCE](./LICENCE) file for details.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import { RestApiResponse, ConfigurationRestAPI } from '@binance/common';
|
|
2
|
+
export { BadRequestError, C2C_REST_API_PROD_URL, C2C_REST_API_TESTNET_URL, ConnectorClientError, ForbiddenError, NetworkError, NotFoundError, RateLimitBanError, RequiredError, ServerError, TooManyRequestsError, UnauthorizedError } from '@binance/common';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Binance Public C2C REST API
|
|
6
|
+
*
|
|
7
|
+
* OpenAPI Specification for the Binance Public C2C REST API
|
|
8
|
+
*
|
|
9
|
+
* The version of the OpenAPI document: 1.0.0
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
13
|
+
* https://openapi-generator.tech
|
|
14
|
+
* Do not edit the class manually.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
* @interface BadRequest
|
|
20
|
+
*/
|
|
21
|
+
interface BadRequest {
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {number}
|
|
25
|
+
* @memberof BadRequest
|
|
26
|
+
*/
|
|
27
|
+
code: number;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @type {string}
|
|
31
|
+
* @memberof BadRequest
|
|
32
|
+
*/
|
|
33
|
+
message: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Binance Public C2C REST API
|
|
38
|
+
*
|
|
39
|
+
* OpenAPI Specification for the Binance Public C2C REST API
|
|
40
|
+
*
|
|
41
|
+
* The version of the OpenAPI document: 1.0.0
|
|
42
|
+
*
|
|
43
|
+
*
|
|
44
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
45
|
+
* https://openapi-generator.tech
|
|
46
|
+
* Do not edit the class manually.
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @export
|
|
51
|
+
* @interface GetC2CTradeHistoryResponseDataInner
|
|
52
|
+
*/
|
|
53
|
+
interface GetC2CTradeHistoryResponseDataInner {
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @type {string}
|
|
57
|
+
* @memberof GetC2CTradeHistoryResponseDataInner
|
|
58
|
+
*/
|
|
59
|
+
orderNumber?: string;
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @type {string}
|
|
63
|
+
* @memberof GetC2CTradeHistoryResponseDataInner
|
|
64
|
+
*/
|
|
65
|
+
advNo?: string;
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @type {string}
|
|
69
|
+
* @memberof GetC2CTradeHistoryResponseDataInner
|
|
70
|
+
*/
|
|
71
|
+
tradeType?: string;
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* @type {string}
|
|
75
|
+
* @memberof GetC2CTradeHistoryResponseDataInner
|
|
76
|
+
*/
|
|
77
|
+
asset?: string;
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
* @type {string}
|
|
81
|
+
* @memberof GetC2CTradeHistoryResponseDataInner
|
|
82
|
+
*/
|
|
83
|
+
fiat?: string;
|
|
84
|
+
/**
|
|
85
|
+
*
|
|
86
|
+
* @type {string}
|
|
87
|
+
* @memberof GetC2CTradeHistoryResponseDataInner
|
|
88
|
+
*/
|
|
89
|
+
fiatSymbol?: string;
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* @type {string}
|
|
93
|
+
* @memberof GetC2CTradeHistoryResponseDataInner
|
|
94
|
+
*/
|
|
95
|
+
amount?: string;
|
|
96
|
+
/**
|
|
97
|
+
*
|
|
98
|
+
* @type {string}
|
|
99
|
+
* @memberof GetC2CTradeHistoryResponseDataInner
|
|
100
|
+
*/
|
|
101
|
+
totalPrice?: string;
|
|
102
|
+
/**
|
|
103
|
+
*
|
|
104
|
+
* @type {string}
|
|
105
|
+
* @memberof GetC2CTradeHistoryResponseDataInner
|
|
106
|
+
*/
|
|
107
|
+
unitPrice?: string;
|
|
108
|
+
/**
|
|
109
|
+
*
|
|
110
|
+
* @type {string}
|
|
111
|
+
* @memberof GetC2CTradeHistoryResponseDataInner
|
|
112
|
+
*/
|
|
113
|
+
orderStatus?: string;
|
|
114
|
+
/**
|
|
115
|
+
*
|
|
116
|
+
* @type {number}
|
|
117
|
+
* @memberof GetC2CTradeHistoryResponseDataInner
|
|
118
|
+
*/
|
|
119
|
+
createTime?: number;
|
|
120
|
+
/**
|
|
121
|
+
*
|
|
122
|
+
* @type {string}
|
|
123
|
+
* @memberof GetC2CTradeHistoryResponseDataInner
|
|
124
|
+
*/
|
|
125
|
+
commission?: string;
|
|
126
|
+
/**
|
|
127
|
+
*
|
|
128
|
+
* @type {string}
|
|
129
|
+
* @memberof GetC2CTradeHistoryResponseDataInner
|
|
130
|
+
*/
|
|
131
|
+
counterPartNickName?: string;
|
|
132
|
+
/**
|
|
133
|
+
*
|
|
134
|
+
* @type {string}
|
|
135
|
+
* @memberof GetC2CTradeHistoryResponseDataInner
|
|
136
|
+
*/
|
|
137
|
+
advertisementRole?: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Binance Public C2C REST API
|
|
142
|
+
*
|
|
143
|
+
* OpenAPI Specification for the Binance Public C2C REST API
|
|
144
|
+
*
|
|
145
|
+
* The version of the OpenAPI document: 1.0.0
|
|
146
|
+
*
|
|
147
|
+
*
|
|
148
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
149
|
+
* https://openapi-generator.tech
|
|
150
|
+
* Do not edit the class manually.
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
*
|
|
155
|
+
* @export
|
|
156
|
+
* @interface GetC2CTradeHistoryResponse
|
|
157
|
+
*/
|
|
158
|
+
interface GetC2CTradeHistoryResponse {
|
|
159
|
+
/**
|
|
160
|
+
*
|
|
161
|
+
* @type {string}
|
|
162
|
+
* @memberof GetC2CTradeHistoryResponse
|
|
163
|
+
*/
|
|
164
|
+
code?: string;
|
|
165
|
+
/**
|
|
166
|
+
*
|
|
167
|
+
* @type {string}
|
|
168
|
+
* @memberof GetC2CTradeHistoryResponse
|
|
169
|
+
*/
|
|
170
|
+
message?: string;
|
|
171
|
+
/**
|
|
172
|
+
*
|
|
173
|
+
* @type {Array<GetC2CTradeHistoryResponseDataInner>}
|
|
174
|
+
* @memberof GetC2CTradeHistoryResponse
|
|
175
|
+
*/
|
|
176
|
+
data?: Array<GetC2CTradeHistoryResponseDataInner>;
|
|
177
|
+
/**
|
|
178
|
+
*
|
|
179
|
+
* @type {number}
|
|
180
|
+
* @memberof GetC2CTradeHistoryResponse
|
|
181
|
+
*/
|
|
182
|
+
total?: number;
|
|
183
|
+
/**
|
|
184
|
+
*
|
|
185
|
+
* @type {boolean}
|
|
186
|
+
* @memberof GetC2CTradeHistoryResponse
|
|
187
|
+
*/
|
|
188
|
+
success?: boolean;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Binance Public C2C REST API
|
|
193
|
+
*
|
|
194
|
+
* OpenAPI Specification for the Binance Public C2C REST API
|
|
195
|
+
*
|
|
196
|
+
* The version of the OpenAPI document: 1.0.0
|
|
197
|
+
*
|
|
198
|
+
*
|
|
199
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
200
|
+
* https://openapi-generator.tech
|
|
201
|
+
* Do not edit the class manually.
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* C2cApi - interface
|
|
206
|
+
* @interface C2cApi
|
|
207
|
+
*/
|
|
208
|
+
interface C2cApiInterface {
|
|
209
|
+
/**
|
|
210
|
+
* Get C2C Trade History
|
|
211
|
+
*
|
|
212
|
+
* The max interval between startTime and endTime is 30 days.
|
|
213
|
+
* If startTime and endTime are not sent, the recent 7 days' data will be returned.
|
|
214
|
+
* The earliest startTime is supported on June 10, 2020
|
|
215
|
+
* Return up to 200 records per request.
|
|
216
|
+
*
|
|
217
|
+
* Weight: 1
|
|
218
|
+
*
|
|
219
|
+
* @summary Get C2C Trade History (USER_DATA)
|
|
220
|
+
* @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.
|
|
221
|
+
*
|
|
222
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
223
|
+
* @memberof C2cApiInterface
|
|
224
|
+
*/
|
|
225
|
+
getC2CTradeHistory(requestParameters?: GetC2CTradeHistoryRequest): Promise<RestApiResponse<GetC2CTradeHistoryResponse>>;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Request parameters for getC2CTradeHistory operation in C2cApi.
|
|
229
|
+
* @interface GetC2CTradeHistoryRequest
|
|
230
|
+
*/
|
|
231
|
+
interface GetC2CTradeHistoryRequest {
|
|
232
|
+
/**
|
|
233
|
+
*
|
|
234
|
+
* @type {number}
|
|
235
|
+
* @memberof C2cApiGetC2CTradeHistory
|
|
236
|
+
*/
|
|
237
|
+
readonly startTime?: number;
|
|
238
|
+
/**
|
|
239
|
+
*
|
|
240
|
+
* @type {number}
|
|
241
|
+
* @memberof C2cApiGetC2CTradeHistory
|
|
242
|
+
*/
|
|
243
|
+
readonly endTime?: number;
|
|
244
|
+
/**
|
|
245
|
+
* Default 1
|
|
246
|
+
* @type {number}
|
|
247
|
+
* @memberof C2cApiGetC2CTradeHistory
|
|
248
|
+
*/
|
|
249
|
+
readonly page?: number;
|
|
250
|
+
/**
|
|
251
|
+
*
|
|
252
|
+
* @type {number}
|
|
253
|
+
* @memberof C2cApiGetC2CTradeHistory
|
|
254
|
+
*/
|
|
255
|
+
readonly recvWindow?: number;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* C2cApi - object-oriented interface
|
|
259
|
+
* @class C2cApi
|
|
260
|
+
*/
|
|
261
|
+
declare class C2cApi implements C2cApiInterface {
|
|
262
|
+
private readonly configuration;
|
|
263
|
+
private localVarAxiosParamCreator;
|
|
264
|
+
constructor(configuration: ConfigurationRestAPI);
|
|
265
|
+
/**
|
|
266
|
+
* Get C2C Trade History
|
|
267
|
+
*
|
|
268
|
+
* The max interval between startTime and endTime is 30 days.
|
|
269
|
+
* If startTime and endTime are not sent, the recent 7 days' data will be returned.
|
|
270
|
+
* The earliest startTime is supported on June 10, 2020
|
|
271
|
+
* Return up to 200 records per request.
|
|
272
|
+
*
|
|
273
|
+
* Weight: 1
|
|
274
|
+
*
|
|
275
|
+
* @summary Get C2C Trade History (USER_DATA)
|
|
276
|
+
* @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.
|
|
277
|
+
* @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}
|
|
278
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
279
|
+
* @memberof C2cApi
|
|
280
|
+
* @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}
|
|
281
|
+
*/
|
|
282
|
+
getC2CTradeHistory(requestParameters?: GetC2CTradeHistoryRequest): Promise<RestApiResponse<GetC2CTradeHistoryResponse>>;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Binance Public C2C REST API
|
|
287
|
+
*
|
|
288
|
+
* OpenAPI Specification for the Binance Public C2C REST API
|
|
289
|
+
*
|
|
290
|
+
* The version of the OpenAPI document: 1.0.0
|
|
291
|
+
*
|
|
292
|
+
*
|
|
293
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
294
|
+
* https://openapi-generator.tech
|
|
295
|
+
* Do not edit the class manually.
|
|
296
|
+
*/
|
|
297
|
+
|
|
298
|
+
declare class RestAPI {
|
|
299
|
+
private configuration;
|
|
300
|
+
private c2cApi;
|
|
301
|
+
constructor(configuration: ConfigurationRestAPI);
|
|
302
|
+
/**
|
|
303
|
+
* Generic function to send a request.
|
|
304
|
+
* @param endpoint - The API endpoint to call.
|
|
305
|
+
* @param method - HTTP method to use (GET, POST, DELETE, etc.).
|
|
306
|
+
* @param params - Query parameters for the request.
|
|
307
|
+
*
|
|
308
|
+
* @returns A promise resolving to the response data object.
|
|
309
|
+
*/
|
|
310
|
+
sendRequest<T>(endpoint: string, method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH', params?: Record<string, unknown>): Promise<RestApiResponse<T>>;
|
|
311
|
+
/**
|
|
312
|
+
* Generic function to send a signed request.
|
|
313
|
+
* @param endpoint - The API endpoint to call.
|
|
314
|
+
* @param method - HTTP method to use (GET, POST, DELETE, etc.).
|
|
315
|
+
* @param params - Query parameters for the request.
|
|
316
|
+
*
|
|
317
|
+
* @returns A promise resolving to the response data object.
|
|
318
|
+
*/
|
|
319
|
+
sendSignedRequest<T>(endpoint: string, method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH', params?: Record<string, unknown>): Promise<RestApiResponse<T>>;
|
|
320
|
+
/**
|
|
321
|
+
* Get C2C Trade History
|
|
322
|
+
*
|
|
323
|
+
* The max interval between startTime and endTime is 30 days.
|
|
324
|
+
* If startTime and endTime are not sent, the recent 7 days' data will be returned.
|
|
325
|
+
* The earliest startTime is supported on June 10, 2020
|
|
326
|
+
* Return up to 200 records per request.
|
|
327
|
+
*
|
|
328
|
+
* Weight: 1
|
|
329
|
+
*
|
|
330
|
+
* @summary Get C2C Trade History (USER_DATA)
|
|
331
|
+
* @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.
|
|
332
|
+
* @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}
|
|
333
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
334
|
+
* @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}
|
|
335
|
+
*/
|
|
336
|
+
getC2CTradeHistory(requestParameters?: GetC2CTradeHistoryRequest): Promise<RestApiResponse<GetC2CTradeHistoryResponse>>;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Binance Public C2C REST API
|
|
341
|
+
*
|
|
342
|
+
* OpenAPI Specification for the Binance Public C2C REST API
|
|
343
|
+
*
|
|
344
|
+
* The version of the OpenAPI document: 1.0.0
|
|
345
|
+
*
|
|
346
|
+
*
|
|
347
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
348
|
+
* https://openapi-generator.tech
|
|
349
|
+
* Do not edit the class manually.
|
|
350
|
+
*/
|
|
351
|
+
|
|
352
|
+
type index_BadRequest = BadRequest;
|
|
353
|
+
type index_C2cApi = C2cApi;
|
|
354
|
+
declare const index_C2cApi: typeof C2cApi;
|
|
355
|
+
type index_C2cApiInterface = C2cApiInterface;
|
|
356
|
+
type index_GetC2CTradeHistoryRequest = GetC2CTradeHistoryRequest;
|
|
357
|
+
type index_GetC2CTradeHistoryResponse = GetC2CTradeHistoryResponse;
|
|
358
|
+
type index_GetC2CTradeHistoryResponseDataInner = GetC2CTradeHistoryResponseDataInner;
|
|
359
|
+
type index_RestAPI = RestAPI;
|
|
360
|
+
declare const index_RestAPI: typeof RestAPI;
|
|
361
|
+
declare namespace index {
|
|
362
|
+
export {
|
|
363
|
+
index_BadRequest as BadRequest,
|
|
364
|
+
index_C2cApi as C2cApi,
|
|
365
|
+
index_C2cApiInterface as C2cApiInterface,
|
|
366
|
+
index_GetC2CTradeHistoryRequest as GetC2CTradeHistoryRequest,
|
|
367
|
+
index_GetC2CTradeHistoryResponse as GetC2CTradeHistoryResponse,
|
|
368
|
+
index_GetC2CTradeHistoryResponseDataInner as GetC2CTradeHistoryResponseDataInner,
|
|
369
|
+
index_RestAPI as RestAPI,
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
interface ConfigurationC2C {
|
|
374
|
+
configurationRestAPI?: ConfigurationRestAPI;
|
|
375
|
+
}
|
|
376
|
+
declare class C2C {
|
|
377
|
+
restAPI: RestAPI;
|
|
378
|
+
constructor(config: ConfigurationC2C);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export { C2C, index as C2CRestAPI, ConfigurationC2C };
|