@binance/c2c 1.0.0 → 1.0.1
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/README.md +0 -15
- package/dist/index.d.mts +32 -40
- package/dist/index.d.ts +32 -40
- package/dist/index.js +13 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -139,21 +139,6 @@ The REST API provides detailed error types to help you handle issues effectively
|
|
|
139
139
|
|
|
140
140
|
See the [Error Handling example](./docs/rest-api/error-handling.md) for detailed usage.
|
|
141
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
142
|
If `basePath` is not provided, it defaults to `https://api.binance.com`.
|
|
158
143
|
|
|
159
144
|
## Testing
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RestApiResponse, ConfigurationRestAPI } from '@binance/common';
|
|
2
|
-
export { BadRequestError, C2C_REST_API_PROD_URL,
|
|
2
|
+
export { BadRequestError, C2C_REST_API_PROD_URL, ConnectorClientError, ForbiddenError, NetworkError, NotFoundError, RateLimitBanError, RequiredError, ServerError, TooManyRequestsError, UnauthorizedError } from '@binance/common';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Binance
|
|
5
|
+
* Binance C2C REST API
|
|
6
6
|
*
|
|
7
|
-
* OpenAPI Specification for the Binance
|
|
7
|
+
* OpenAPI Specification for the Binance C2C REST API
|
|
8
8
|
*
|
|
9
9
|
* The version of the OpenAPI document: 1.0.0
|
|
10
10
|
*
|
|
@@ -34,9 +34,9 @@ interface BadRequest {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* Binance
|
|
37
|
+
* Binance C2C REST API
|
|
38
38
|
*
|
|
39
|
-
* OpenAPI Specification for the Binance
|
|
39
|
+
* OpenAPI Specification for the Binance C2C REST API
|
|
40
40
|
*
|
|
41
41
|
* The version of the OpenAPI document: 1.0.0
|
|
42
42
|
*
|
|
@@ -138,9 +138,9 @@ interface GetC2CTradeHistoryResponseDataInner {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
|
-
* Binance
|
|
141
|
+
* Binance C2C REST API
|
|
142
142
|
*
|
|
143
|
-
* OpenAPI Specification for the Binance
|
|
143
|
+
* OpenAPI Specification for the Binance C2C REST API
|
|
144
144
|
*
|
|
145
145
|
* The version of the OpenAPI document: 1.0.0
|
|
146
146
|
*
|
|
@@ -189,9 +189,9 @@ interface GetC2CTradeHistoryResponse {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
|
-
* Binance
|
|
192
|
+
* Binance C2C REST API
|
|
193
193
|
*
|
|
194
|
-
* OpenAPI Specification for the Binance
|
|
194
|
+
* OpenAPI Specification for the Binance C2C REST API
|
|
195
195
|
*
|
|
196
196
|
* The version of the OpenAPI document: 1.0.0
|
|
197
197
|
*
|
|
@@ -202,10 +202,10 @@ interface GetC2CTradeHistoryResponse {
|
|
|
202
202
|
*/
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
|
-
*
|
|
206
|
-
* @interface
|
|
205
|
+
* C2CApi - interface
|
|
206
|
+
* @interface C2CApi
|
|
207
207
|
*/
|
|
208
|
-
interface
|
|
208
|
+
interface C2CApiInterface {
|
|
209
209
|
/**
|
|
210
210
|
* Get C2C Trade History
|
|
211
211
|
*
|
|
@@ -220,45 +220,45 @@ interface C2cApiInterface {
|
|
|
220
220
|
* @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.
|
|
221
221
|
*
|
|
222
222
|
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
223
|
-
* @memberof
|
|
223
|
+
* @memberof C2CApiInterface
|
|
224
224
|
*/
|
|
225
225
|
getC2CTradeHistory(requestParameters?: GetC2CTradeHistoryRequest): Promise<RestApiResponse<GetC2CTradeHistoryResponse>>;
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
228
|
-
* Request parameters for getC2CTradeHistory operation in
|
|
228
|
+
* Request parameters for getC2CTradeHistory operation in C2CApi.
|
|
229
229
|
* @interface GetC2CTradeHistoryRequest
|
|
230
230
|
*/
|
|
231
231
|
interface GetC2CTradeHistoryRequest {
|
|
232
232
|
/**
|
|
233
233
|
*
|
|
234
234
|
* @type {number}
|
|
235
|
-
* @memberof
|
|
235
|
+
* @memberof C2CApiGetC2CTradeHistory
|
|
236
236
|
*/
|
|
237
237
|
readonly startTime?: number;
|
|
238
238
|
/**
|
|
239
239
|
*
|
|
240
240
|
* @type {number}
|
|
241
|
-
* @memberof
|
|
241
|
+
* @memberof C2CApiGetC2CTradeHistory
|
|
242
242
|
*/
|
|
243
243
|
readonly endTime?: number;
|
|
244
244
|
/**
|
|
245
245
|
* Default 1
|
|
246
246
|
* @type {number}
|
|
247
|
-
* @memberof
|
|
247
|
+
* @memberof C2CApiGetC2CTradeHistory
|
|
248
248
|
*/
|
|
249
249
|
readonly page?: number;
|
|
250
250
|
/**
|
|
251
251
|
*
|
|
252
252
|
* @type {number}
|
|
253
|
-
* @memberof
|
|
253
|
+
* @memberof C2CApiGetC2CTradeHistory
|
|
254
254
|
*/
|
|
255
255
|
readonly recvWindow?: number;
|
|
256
256
|
}
|
|
257
257
|
/**
|
|
258
|
-
*
|
|
259
|
-
* @class
|
|
258
|
+
* C2CApi - object-oriented interface
|
|
259
|
+
* @class C2CApi
|
|
260
260
|
*/
|
|
261
|
-
declare class
|
|
261
|
+
declare class C2CApi implements C2CApiInterface {
|
|
262
262
|
private readonly configuration;
|
|
263
263
|
private localVarAxiosParamCreator;
|
|
264
264
|
constructor(configuration: ConfigurationRestAPI);
|
|
@@ -276,16 +276,16 @@ declare class C2cApi implements C2cApiInterface {
|
|
|
276
276
|
* @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.
|
|
277
277
|
* @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}
|
|
278
278
|
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
279
|
-
* @memberof
|
|
279
|
+
* @memberof C2CApi
|
|
280
280
|
* @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}
|
|
281
281
|
*/
|
|
282
282
|
getC2CTradeHistory(requestParameters?: GetC2CTradeHistoryRequest): Promise<RestApiResponse<GetC2CTradeHistoryResponse>>;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
/**
|
|
286
|
-
* Binance
|
|
286
|
+
* Binance C2C REST API
|
|
287
287
|
*
|
|
288
|
-
* OpenAPI Specification for the Binance
|
|
288
|
+
* OpenAPI Specification for the Binance C2C REST API
|
|
289
289
|
*
|
|
290
290
|
* The version of the OpenAPI document: 1.0.0
|
|
291
291
|
*
|
|
@@ -297,7 +297,7 @@ declare class C2cApi implements C2cApiInterface {
|
|
|
297
297
|
|
|
298
298
|
declare class RestAPI {
|
|
299
299
|
private configuration;
|
|
300
|
-
private
|
|
300
|
+
private c2CApi;
|
|
301
301
|
constructor(configuration: ConfigurationRestAPI);
|
|
302
302
|
/**
|
|
303
303
|
* Generic function to send a request.
|
|
@@ -337,9 +337,9 @@ declare class RestAPI {
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
/**
|
|
340
|
-
* Binance
|
|
340
|
+
* Binance C2C REST API
|
|
341
341
|
*
|
|
342
|
-
* OpenAPI Specification for the Binance
|
|
342
|
+
* OpenAPI Specification for the Binance C2C REST API
|
|
343
343
|
*
|
|
344
344
|
* The version of the OpenAPI document: 1.0.0
|
|
345
345
|
*
|
|
@@ -350,24 +350,16 @@ declare class RestAPI {
|
|
|
350
350
|
*/
|
|
351
351
|
|
|
352
352
|
type index_BadRequest = BadRequest;
|
|
353
|
-
type
|
|
354
|
-
declare const
|
|
355
|
-
type
|
|
353
|
+
type index_C2CApi = C2CApi;
|
|
354
|
+
declare const index_C2CApi: typeof C2CApi;
|
|
355
|
+
type index_C2CApiInterface = C2CApiInterface;
|
|
356
356
|
type index_GetC2CTradeHistoryRequest = GetC2CTradeHistoryRequest;
|
|
357
357
|
type index_GetC2CTradeHistoryResponse = GetC2CTradeHistoryResponse;
|
|
358
358
|
type index_GetC2CTradeHistoryResponseDataInner = GetC2CTradeHistoryResponseDataInner;
|
|
359
359
|
type index_RestAPI = RestAPI;
|
|
360
360
|
declare const index_RestAPI: typeof RestAPI;
|
|
361
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
|
-
};
|
|
362
|
+
export { type index_BadRequest as BadRequest, index_C2CApi as C2CApi, type index_C2CApiInterface as C2CApiInterface, type index_GetC2CTradeHistoryRequest as GetC2CTradeHistoryRequest, type index_GetC2CTradeHistoryResponse as GetC2CTradeHistoryResponse, type index_GetC2CTradeHistoryResponseDataInner as GetC2CTradeHistoryResponseDataInner, index_RestAPI as RestAPI };
|
|
371
363
|
}
|
|
372
364
|
|
|
373
365
|
interface ConfigurationC2C {
|
|
@@ -378,4 +370,4 @@ declare class C2C {
|
|
|
378
370
|
constructor(config: ConfigurationC2C);
|
|
379
371
|
}
|
|
380
372
|
|
|
381
|
-
export { C2C, index as C2CRestAPI, ConfigurationC2C };
|
|
373
|
+
export { C2C, index as C2CRestAPI, type ConfigurationC2C };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RestApiResponse, ConfigurationRestAPI } from '@binance/common';
|
|
2
|
-
export { BadRequestError, C2C_REST_API_PROD_URL,
|
|
2
|
+
export { BadRequestError, C2C_REST_API_PROD_URL, ConnectorClientError, ForbiddenError, NetworkError, NotFoundError, RateLimitBanError, RequiredError, ServerError, TooManyRequestsError, UnauthorizedError } from '@binance/common';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Binance
|
|
5
|
+
* Binance C2C REST API
|
|
6
6
|
*
|
|
7
|
-
* OpenAPI Specification for the Binance
|
|
7
|
+
* OpenAPI Specification for the Binance C2C REST API
|
|
8
8
|
*
|
|
9
9
|
* The version of the OpenAPI document: 1.0.0
|
|
10
10
|
*
|
|
@@ -34,9 +34,9 @@ interface BadRequest {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* Binance
|
|
37
|
+
* Binance C2C REST API
|
|
38
38
|
*
|
|
39
|
-
* OpenAPI Specification for the Binance
|
|
39
|
+
* OpenAPI Specification for the Binance C2C REST API
|
|
40
40
|
*
|
|
41
41
|
* The version of the OpenAPI document: 1.0.0
|
|
42
42
|
*
|
|
@@ -138,9 +138,9 @@ interface GetC2CTradeHistoryResponseDataInner {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
|
-
* Binance
|
|
141
|
+
* Binance C2C REST API
|
|
142
142
|
*
|
|
143
|
-
* OpenAPI Specification for the Binance
|
|
143
|
+
* OpenAPI Specification for the Binance C2C REST API
|
|
144
144
|
*
|
|
145
145
|
* The version of the OpenAPI document: 1.0.0
|
|
146
146
|
*
|
|
@@ -189,9 +189,9 @@ interface GetC2CTradeHistoryResponse {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
|
-
* Binance
|
|
192
|
+
* Binance C2C REST API
|
|
193
193
|
*
|
|
194
|
-
* OpenAPI Specification for the Binance
|
|
194
|
+
* OpenAPI Specification for the Binance C2C REST API
|
|
195
195
|
*
|
|
196
196
|
* The version of the OpenAPI document: 1.0.0
|
|
197
197
|
*
|
|
@@ -202,10 +202,10 @@ interface GetC2CTradeHistoryResponse {
|
|
|
202
202
|
*/
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
|
-
*
|
|
206
|
-
* @interface
|
|
205
|
+
* C2CApi - interface
|
|
206
|
+
* @interface C2CApi
|
|
207
207
|
*/
|
|
208
|
-
interface
|
|
208
|
+
interface C2CApiInterface {
|
|
209
209
|
/**
|
|
210
210
|
* Get C2C Trade History
|
|
211
211
|
*
|
|
@@ -220,45 +220,45 @@ interface C2cApiInterface {
|
|
|
220
220
|
* @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.
|
|
221
221
|
*
|
|
222
222
|
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
223
|
-
* @memberof
|
|
223
|
+
* @memberof C2CApiInterface
|
|
224
224
|
*/
|
|
225
225
|
getC2CTradeHistory(requestParameters?: GetC2CTradeHistoryRequest): Promise<RestApiResponse<GetC2CTradeHistoryResponse>>;
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
228
|
-
* Request parameters for getC2CTradeHistory operation in
|
|
228
|
+
* Request parameters for getC2CTradeHistory operation in C2CApi.
|
|
229
229
|
* @interface GetC2CTradeHistoryRequest
|
|
230
230
|
*/
|
|
231
231
|
interface GetC2CTradeHistoryRequest {
|
|
232
232
|
/**
|
|
233
233
|
*
|
|
234
234
|
* @type {number}
|
|
235
|
-
* @memberof
|
|
235
|
+
* @memberof C2CApiGetC2CTradeHistory
|
|
236
236
|
*/
|
|
237
237
|
readonly startTime?: number;
|
|
238
238
|
/**
|
|
239
239
|
*
|
|
240
240
|
* @type {number}
|
|
241
|
-
* @memberof
|
|
241
|
+
* @memberof C2CApiGetC2CTradeHistory
|
|
242
242
|
*/
|
|
243
243
|
readonly endTime?: number;
|
|
244
244
|
/**
|
|
245
245
|
* Default 1
|
|
246
246
|
* @type {number}
|
|
247
|
-
* @memberof
|
|
247
|
+
* @memberof C2CApiGetC2CTradeHistory
|
|
248
248
|
*/
|
|
249
249
|
readonly page?: number;
|
|
250
250
|
/**
|
|
251
251
|
*
|
|
252
252
|
* @type {number}
|
|
253
|
-
* @memberof
|
|
253
|
+
* @memberof C2CApiGetC2CTradeHistory
|
|
254
254
|
*/
|
|
255
255
|
readonly recvWindow?: number;
|
|
256
256
|
}
|
|
257
257
|
/**
|
|
258
|
-
*
|
|
259
|
-
* @class
|
|
258
|
+
* C2CApi - object-oriented interface
|
|
259
|
+
* @class C2CApi
|
|
260
260
|
*/
|
|
261
|
-
declare class
|
|
261
|
+
declare class C2CApi implements C2CApiInterface {
|
|
262
262
|
private readonly configuration;
|
|
263
263
|
private localVarAxiosParamCreator;
|
|
264
264
|
constructor(configuration: ConfigurationRestAPI);
|
|
@@ -276,16 +276,16 @@ declare class C2cApi implements C2cApiInterface {
|
|
|
276
276
|
* @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.
|
|
277
277
|
* @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}
|
|
278
278
|
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
279
|
-
* @memberof
|
|
279
|
+
* @memberof C2CApi
|
|
280
280
|
* @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}
|
|
281
281
|
*/
|
|
282
282
|
getC2CTradeHistory(requestParameters?: GetC2CTradeHistoryRequest): Promise<RestApiResponse<GetC2CTradeHistoryResponse>>;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
/**
|
|
286
|
-
* Binance
|
|
286
|
+
* Binance C2C REST API
|
|
287
287
|
*
|
|
288
|
-
* OpenAPI Specification for the Binance
|
|
288
|
+
* OpenAPI Specification for the Binance C2C REST API
|
|
289
289
|
*
|
|
290
290
|
* The version of the OpenAPI document: 1.0.0
|
|
291
291
|
*
|
|
@@ -297,7 +297,7 @@ declare class C2cApi implements C2cApiInterface {
|
|
|
297
297
|
|
|
298
298
|
declare class RestAPI {
|
|
299
299
|
private configuration;
|
|
300
|
-
private
|
|
300
|
+
private c2CApi;
|
|
301
301
|
constructor(configuration: ConfigurationRestAPI);
|
|
302
302
|
/**
|
|
303
303
|
* Generic function to send a request.
|
|
@@ -337,9 +337,9 @@ declare class RestAPI {
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
/**
|
|
340
|
-
* Binance
|
|
340
|
+
* Binance C2C REST API
|
|
341
341
|
*
|
|
342
|
-
* OpenAPI Specification for the Binance
|
|
342
|
+
* OpenAPI Specification for the Binance C2C REST API
|
|
343
343
|
*
|
|
344
344
|
* The version of the OpenAPI document: 1.0.0
|
|
345
345
|
*
|
|
@@ -350,24 +350,16 @@ declare class RestAPI {
|
|
|
350
350
|
*/
|
|
351
351
|
|
|
352
352
|
type index_BadRequest = BadRequest;
|
|
353
|
-
type
|
|
354
|
-
declare const
|
|
355
|
-
type
|
|
353
|
+
type index_C2CApi = C2CApi;
|
|
354
|
+
declare const index_C2CApi: typeof C2CApi;
|
|
355
|
+
type index_C2CApiInterface = C2CApiInterface;
|
|
356
356
|
type index_GetC2CTradeHistoryRequest = GetC2CTradeHistoryRequest;
|
|
357
357
|
type index_GetC2CTradeHistoryResponse = GetC2CTradeHistoryResponse;
|
|
358
358
|
type index_GetC2CTradeHistoryResponseDataInner = GetC2CTradeHistoryResponseDataInner;
|
|
359
359
|
type index_RestAPI = RestAPI;
|
|
360
360
|
declare const index_RestAPI: typeof RestAPI;
|
|
361
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
|
-
};
|
|
362
|
+
export { type index_BadRequest as BadRequest, index_C2CApi as C2CApi, type index_C2CApiInterface as C2CApiInterface, type index_GetC2CTradeHistoryRequest as GetC2CTradeHistoryRequest, type index_GetC2CTradeHistoryResponse as GetC2CTradeHistoryResponse, type index_GetC2CTradeHistoryResponseDataInner as GetC2CTradeHistoryResponseDataInner, index_RestAPI as RestAPI };
|
|
371
363
|
}
|
|
372
364
|
|
|
373
365
|
interface ConfigurationC2C {
|
|
@@ -378,4 +370,4 @@ declare class C2C {
|
|
|
378
370
|
constructor(config: ConfigurationC2C);
|
|
379
371
|
}
|
|
380
372
|
|
|
381
|
-
export { C2C, index as C2CRestAPI, ConfigurationC2C };
|
|
373
|
+
export { C2C, index as C2CRestAPI, type ConfigurationC2C };
|
package/dist/index.js
CHANGED
|
@@ -18,13 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
BadRequestError: () => import_common4.BadRequestError,
|
|
24
24
|
C2C: () => C2C,
|
|
25
25
|
C2CRestAPI: () => rest_api_exports,
|
|
26
26
|
C2C_REST_API_PROD_URL: () => import_common4.C2C_REST_API_PROD_URL,
|
|
27
|
-
C2C_REST_API_TESTNET_URL: () => import_common4.C2C_REST_API_TESTNET_URL,
|
|
28
27
|
ConnectorClientError: () => import_common4.ConnectorClientError,
|
|
29
28
|
ForbiddenError: () => import_common4.ForbiddenError,
|
|
30
29
|
NetworkError: () => import_common4.NetworkError,
|
|
@@ -35,7 +34,7 @@ __export(src_exports, {
|
|
|
35
34
|
TooManyRequestsError: () => import_common4.TooManyRequestsError,
|
|
36
35
|
UnauthorizedError: () => import_common4.UnauthorizedError
|
|
37
36
|
});
|
|
38
|
-
module.exports = __toCommonJS(
|
|
37
|
+
module.exports = __toCommonJS(index_exports);
|
|
39
38
|
|
|
40
39
|
// src/c2c.ts
|
|
41
40
|
var import_os = require("os");
|
|
@@ -43,18 +42,18 @@ var import_common3 = require("@binance/common");
|
|
|
43
42
|
|
|
44
43
|
// package.json
|
|
45
44
|
var name = "@binance/c2c";
|
|
46
|
-
var version = "1.0.
|
|
45
|
+
var version = "1.0.1";
|
|
47
46
|
|
|
48
47
|
// src/rest-api/index.ts
|
|
49
48
|
var rest_api_exports = {};
|
|
50
49
|
__export(rest_api_exports, {
|
|
51
|
-
|
|
50
|
+
C2CApi: () => C2CApi,
|
|
52
51
|
RestAPI: () => RestAPI
|
|
53
52
|
});
|
|
54
53
|
|
|
55
|
-
// src/rest-api/modules/
|
|
54
|
+
// src/rest-api/modules/c2-capi.ts
|
|
56
55
|
var import_common = require("@binance/common");
|
|
57
|
-
var
|
|
56
|
+
var C2CApiAxiosParamCreator = function(configuration) {
|
|
58
57
|
return {
|
|
59
58
|
/**
|
|
60
59
|
* Get C2C Trade History
|
|
@@ -89,8 +88,7 @@ var C2cApiAxiosParamCreator = function(configuration) {
|
|
|
89
88
|
localVarQueryParameter["recvWindow"] = recvWindow;
|
|
90
89
|
}
|
|
91
90
|
let _timeUnit;
|
|
92
|
-
if ("timeUnit" in configuration)
|
|
93
|
-
_timeUnit = configuration.timeUnit;
|
|
91
|
+
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
94
92
|
return {
|
|
95
93
|
endpoint: "/sapi/v1/c2c/orderMatch/listUserOrderHistory",
|
|
96
94
|
method: "GET",
|
|
@@ -100,10 +98,10 @@ var C2cApiAxiosParamCreator = function(configuration) {
|
|
|
100
98
|
}
|
|
101
99
|
};
|
|
102
100
|
};
|
|
103
|
-
var
|
|
101
|
+
var C2CApi = class {
|
|
104
102
|
constructor(configuration) {
|
|
105
103
|
this.configuration = configuration;
|
|
106
|
-
this.localVarAxiosParamCreator =
|
|
104
|
+
this.localVarAxiosParamCreator = C2CApiAxiosParamCreator(configuration);
|
|
107
105
|
}
|
|
108
106
|
/**
|
|
109
107
|
* Get C2C Trade History
|
|
@@ -119,7 +117,7 @@ var C2cApi = class {
|
|
|
119
117
|
* @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.
|
|
120
118
|
* @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}
|
|
121
119
|
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
122
|
-
* @memberof
|
|
120
|
+
* @memberof C2CApi
|
|
123
121
|
* @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}
|
|
124
122
|
*/
|
|
125
123
|
async getC2CTradeHistory(requestParameters = {}) {
|
|
@@ -145,7 +143,7 @@ var import_common2 = require("@binance/common");
|
|
|
145
143
|
var RestAPI = class {
|
|
146
144
|
constructor(configuration) {
|
|
147
145
|
this.configuration = configuration;
|
|
148
|
-
this.
|
|
146
|
+
this.c2CApi = new C2CApi(configuration);
|
|
149
147
|
}
|
|
150
148
|
/**
|
|
151
149
|
* Generic function to send a request.
|
|
@@ -188,7 +186,7 @@ var RestAPI = class {
|
|
|
188
186
|
* @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}
|
|
189
187
|
*/
|
|
190
188
|
getC2CTradeHistory(requestParameters = {}) {
|
|
191
|
-
return this.
|
|
189
|
+
return this.c2CApi.getC2CTradeHistory(requestParameters);
|
|
192
190
|
}
|
|
193
191
|
};
|
|
194
192
|
|
|
@@ -216,7 +214,6 @@ var import_common4 = require("@binance/common");
|
|
|
216
214
|
C2C,
|
|
217
215
|
C2CRestAPI,
|
|
218
216
|
C2C_REST_API_PROD_URL,
|
|
219
|
-
C2C_REST_API_TESTNET_URL,
|
|
220
217
|
ConnectorClientError,
|
|
221
218
|
ForbiddenError,
|
|
222
219
|
NetworkError,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/c2c.ts","../package.json","../src/rest-api/index.ts","../src/rest-api/modules/c2c-api.ts","../src/rest-api/rest-api.ts"],"sourcesContent":["export { C2C, ConfigurationC2C } from './c2c';\nexport * as C2CRestAPI from './rest-api';\n\nexport {\n C2C_REST_API_PROD_URL,\n C2C_REST_API_TESTNET_URL,\n ConnectorClientError,\n RequiredError,\n UnauthorizedError,\n ForbiddenError,\n TooManyRequestsError,\n RateLimitBanError,\n ServerError,\n NetworkError,\n NotFoundError,\n BadRequestError,\n} from '@binance/common';\n","import { platform, arch } from 'os';\nimport { ConfigurationRestAPI, C2C_REST_API_PROD_URL } from '@binance/common';\nimport { name, version } from '../package.json';\nimport { RestAPI } from './rest-api';\n\nexport interface ConfigurationC2C {\n configurationRestAPI?: ConfigurationRestAPI;\n}\n\nexport class C2C {\n public restAPI!: RestAPI;\n\n constructor(config: ConfigurationC2C) {\n if (config?.configurationRestAPI) {\n const configRestAPI = new ConfigurationRestAPI(config.configurationRestAPI);\n configRestAPI.basePath = configRestAPI.basePath || C2C_REST_API_PROD_URL;\n configRestAPI.baseOptions = configRestAPI.baseOptions || {};\n configRestAPI.baseOptions.headers = {\n ...(configRestAPI.baseOptions.headers || {}),\n 'User-Agent': `${name}/${version} (Node.js/${process.version}; ${platform()}; ${arch()})`,\n };\n this.restAPI = new RestAPI(configRestAPI);\n }\n }\n}\n","{\n \"name\": \"@binance/c2c\",\n \"description\": \"Official Binance C2C Connector - A lightweight library that provides a convenient interface to Binance's C2C REST API.\",\n \"version\": \"1.0.0\",\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"scripts\": {\n \"prepublishOnly\": \"npm run build\",\n \"build\": \"tsup\",\n \"typecheck\": \"tsc --noEmit\",\n \"clean\": \"rm -rf dist\",\n \"test\": \"npx jest --maxWorkers=4 --bail\",\n \"test:watch\": \"npx jest --watch\",\n \"format\": \"npx prettier --ignore-path .prettierignore --write .\",\n \"lint\": \"npx eslint '**/*.ts' --fix\"\n },\n \"keywords\": [\n \"Binance\",\n \"API\",\n \"C2C\",\n \"Connector\",\n \"REST\",\n \"Trading\"\n ],\n \"author\": \"Binance\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/binance/binance-connector-js.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/binance/binance-connector-js/issues\"\n },\n \"homepage\": \"https://github.com/binance/binance-connector-js#readme\",\n \"files\": [\n \"dist\"\n ],\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.4\",\n \"@types/node\": \"^20.17.24\",\n \"eslint\": \"8.57.0\",\n \"jest\": \"^29.6.4\",\n \"prettier\": \"^3.3.3\",\n \"ts-jest\": \"^29.1.1\",\n \"ts-node\": \"^10.9.1\",\n \"tsup\": \"^7.2.0\",\n \"typescript\": \"^5.7.2\",\n \"typescript-eslint\": \"^8.24.0\"\n },\n \"dependencies\": {\n \"@binance/common\": \"1.0.0\",\n \"axios\": \"^1.7.4\"\n }\n}\n","/**\n * Binance Public C2C REST API\n *\n * OpenAPI Specification for the Binance Public C2C REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nexport * from './types';\nexport * from './modules';\nexport * from './rest-api';\n","/**\n * Binance Public C2C REST API\n *\n * OpenAPI Specification for the Binance Public C2C REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nimport {\n ConfigurationRestAPI,\n TimeUnit,\n RestApiResponse,\n sendRequest,\n type RequestArgs,\n} from '@binance/common';\nimport type { GetC2CTradeHistoryResponse } from '../types';\n\n/**\n * C2cApi - axios parameter creator\n */\nconst C2cApiAxiosParamCreator = function (configuration: ConfigurationRestAPI) {\n return {\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {number} [startTime]\n * @param {number} [endTime]\n * @param {number} [page] Default 1\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getC2CTradeHistory: async (\n startTime?: number,\n endTime?: number,\n page?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (startTime !== undefined && startTime !== null) {\n localVarQueryParameter['startTime'] = startTime;\n }\n\n if (endTime !== undefined && endTime !== null) {\n localVarQueryParameter['endTime'] = endTime;\n }\n\n if (page !== undefined && page !== null) {\n localVarQueryParameter['page'] = page;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/sapi/v1/c2c/orderMatch/listUserOrderHistory',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n };\n};\n\n/**\n * C2cApi - interface\n * @interface C2cApi\n */\nexport interface C2cApiInterface {\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof C2cApiInterface\n */\n getC2CTradeHistory(\n requestParameters?: GetC2CTradeHistoryRequest\n ): Promise<RestApiResponse<GetC2CTradeHistoryResponse>>;\n}\n\n/**\n * Request parameters for getC2CTradeHistory operation in C2cApi.\n * @interface GetC2CTradeHistoryRequest\n */\nexport interface GetC2CTradeHistoryRequest {\n /**\n *\n * @type {number}\n * @memberof C2cApiGetC2CTradeHistory\n */\n readonly startTime?: number;\n\n /**\n *\n * @type {number}\n * @memberof C2cApiGetC2CTradeHistory\n */\n readonly endTime?: number;\n\n /**\n * Default 1\n * @type {number}\n * @memberof C2cApiGetC2CTradeHistory\n */\n readonly page?: number;\n\n /**\n *\n * @type {number}\n * @memberof C2cApiGetC2CTradeHistory\n */\n readonly recvWindow?: number;\n}\n\n/**\n * C2cApi - object-oriented interface\n * @class C2cApi\n */\nexport class C2cApi implements C2cApiInterface {\n private readonly configuration: ConfigurationRestAPI;\n private localVarAxiosParamCreator;\n\n constructor(configuration: ConfigurationRestAPI) {\n this.configuration = configuration;\n this.localVarAxiosParamCreator = C2cApiAxiosParamCreator(configuration);\n }\n\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof C2cApi\n * @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}\n */\n public async getC2CTradeHistory(\n requestParameters: GetC2CTradeHistoryRequest = {}\n ): Promise<RestApiResponse<GetC2CTradeHistoryResponse>> {\n const localVarAxiosArgs = await this.localVarAxiosParamCreator.getC2CTradeHistory(\n requestParameters?.startTime,\n requestParameters?.endTime,\n requestParameters?.page,\n requestParameters?.recvWindow\n );\n return sendRequest<GetC2CTradeHistoryResponse>(\n this.configuration,\n localVarAxiosArgs.endpoint,\n localVarAxiosArgs.method,\n localVarAxiosArgs.params,\n localVarAxiosArgs?.timeUnit,\n { isSigned: true }\n );\n }\n}\n","/**\n * Binance Public C2C REST API\n *\n * OpenAPI Specification for the Binance Public C2C REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nimport { ConfigurationRestAPI, RestApiResponse, sendRequest } from '@binance/common';\nimport { C2cApi } from './modules/c2c-api';\n\nimport type { GetC2CTradeHistoryRequest } from './modules/c2c-api';\n\nimport type { GetC2CTradeHistoryResponse } from './types';\n\nexport class RestAPI {\n private configuration: ConfigurationRestAPI;\n private c2cApi: C2cApi;\n\n constructor(configuration: ConfigurationRestAPI) {\n this.configuration = configuration;\n this.c2cApi = new C2cApi(configuration);\n }\n\n /**\n * Generic function to send a request.\n * @param endpoint - The API endpoint to call.\n * @param method - HTTP method to use (GET, POST, DELETE, etc.).\n * @param params - Query parameters for the request.\n *\n * @returns A promise resolving to the response data object.\n */\n sendRequest<T>(\n endpoint: string,\n method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH',\n params: Record<string, unknown> = {}\n ): Promise<RestApiResponse<T>> {\n return sendRequest<T>(this.configuration, endpoint, method, params, undefined);\n }\n\n /**\n * Generic function to send a signed request.\n * @param endpoint - The API endpoint to call.\n * @param method - HTTP method to use (GET, POST, DELETE, etc.).\n * @param params - Query parameters for the request.\n *\n * @returns A promise resolving to the response data object.\n */\n sendSignedRequest<T>(\n endpoint: string,\n method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH',\n params: Record<string, unknown> = {}\n ): Promise<RestApiResponse<T>> {\n return sendRequest<T>(this.configuration, endpoint, method, params, undefined, {\n isSigned: true,\n });\n }\n\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}\n */\n getC2CTradeHistory(\n requestParameters: GetC2CTradeHistoryRequest = {}\n ): Promise<RestApiResponse<GetC2CTradeHistoryResponse>> {\n return this.c2cApi.getC2CTradeHistory(requestParameters);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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OAAO,aAAa,QAAQ,OAAO,SAAK,oBAAS,CAAC,SAAK,gBAAK,CAAC;AAAA,MAC1F;AACA,WAAK,UAAU,IAAI,QAAQ,aAAa;AAAA,IAC5C;AAAA,EACJ;AACJ;;;ADrBA,IAAAC,iBAaO;","names":["import_common","import_common","import_common"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/c2c.ts","../package.json","../src/rest-api/index.ts","../src/rest-api/modules/c2-capi.ts","../src/rest-api/rest-api.ts"],"sourcesContent":["export { C2C, ConfigurationC2C } from './c2c';\nexport * as C2CRestAPI from './rest-api';\n\nexport {\n C2C_REST_API_PROD_URL,\n ConnectorClientError,\n RequiredError,\n UnauthorizedError,\n ForbiddenError,\n TooManyRequestsError,\n RateLimitBanError,\n ServerError,\n NetworkError,\n NotFoundError,\n BadRequestError,\n} from '@binance/common';\n","import { platform, arch } from 'os';\nimport { ConfigurationRestAPI, C2C_REST_API_PROD_URL } from '@binance/common';\nimport { name, version } from '../package.json';\nimport { RestAPI } from './rest-api';\n\nexport interface ConfigurationC2C {\n configurationRestAPI?: ConfigurationRestAPI;\n}\n\nexport class C2C {\n public restAPI!: RestAPI;\n\n constructor(config: ConfigurationC2C) {\n if (config?.configurationRestAPI) {\n const configRestAPI = new ConfigurationRestAPI(config.configurationRestAPI);\n configRestAPI.basePath = configRestAPI.basePath || C2C_REST_API_PROD_URL;\n configRestAPI.baseOptions = configRestAPI.baseOptions || {};\n configRestAPI.baseOptions.headers = {\n ...(configRestAPI.baseOptions.headers || {}),\n 'User-Agent': `${name}/${version} (Node.js/${process.version}; ${platform()}; ${arch()})`,\n };\n this.restAPI = new RestAPI(configRestAPI);\n }\n }\n}\n","{\n \"name\": \"@binance/c2c\",\n \"description\": \"Official Binance C2C Connector - A lightweight library that provides a convenient interface to Binance's C2C REST API.\",\n \"version\": \"1.0.1\",\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"scripts\": {\n \"prepublishOnly\": \"npm run build\",\n \"build\": \"tsup\",\n \"typecheck\": \"tsc --noEmit\",\n \"clean\": \"rm -rf dist\",\n \"test\": \"npx jest --maxWorkers=4 --bail\",\n \"test:watch\": \"npx jest --watch\",\n \"format\": \"npx prettier --ignore-path .prettierignore --write .\",\n \"lint\": \"npx eslint '**/*.ts' --fix\"\n },\n \"keywords\": [\n \"Binance\",\n \"API\",\n \"C2C\",\n \"Connector\",\n \"REST\",\n \"Trading\"\n ],\n \"author\": \"Binance\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/binance/binance-connector-js.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/binance/binance-connector-js/issues\"\n },\n \"homepage\": \"https://github.com/binance/binance-connector-js#readme\",\n \"files\": [\n \"dist\"\n ],\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.4\",\n \"@types/node\": \"^20.17.24\",\n \"eslint\": \"8.57.0\",\n \"jest\": \"^29.6.4\",\n \"prettier\": \"^3.3.3\",\n \"ts-jest\": \"^29.1.1\",\n \"ts-node\": \"^10.9.1\",\n \"tsup\": \"^8.4.0\",\n \"typescript\": \"^5.7.2\",\n \"typescript-eslint\": \"^8.24.0\"\n },\n \"dependencies\": {\n \"@binance/common\": \"1.0.1\",\n \"axios\": \"^1.7.4\"\n }\n}\n","/**\n * Binance C2C REST API\n *\n * OpenAPI Specification for the Binance C2C REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nexport * from './types';\nexport * from './modules';\nexport * from './rest-api';\n","/**\n * Binance C2C REST API\n *\n * OpenAPI Specification for the Binance C2C REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nimport {\n ConfigurationRestAPI,\n TimeUnit,\n RestApiResponse,\n sendRequest,\n type RequestArgs,\n} from '@binance/common';\nimport type { GetC2CTradeHistoryResponse } from '../types';\n\n/**\n * C2CApi - axios parameter creator\n */\nconst C2CApiAxiosParamCreator = function (configuration: ConfigurationRestAPI) {\n return {\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {number} [startTime]\n * @param {number} [endTime]\n * @param {number} [page] Default 1\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getC2CTradeHistory: async (\n startTime?: number,\n endTime?: number,\n page?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (startTime !== undefined && startTime !== null) {\n localVarQueryParameter['startTime'] = startTime;\n }\n\n if (endTime !== undefined && endTime !== null) {\n localVarQueryParameter['endTime'] = endTime;\n }\n\n if (page !== undefined && page !== null) {\n localVarQueryParameter['page'] = page;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/sapi/v1/c2c/orderMatch/listUserOrderHistory',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n };\n};\n\n/**\n * C2CApi - interface\n * @interface C2CApi\n */\nexport interface C2CApiInterface {\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof C2CApiInterface\n */\n getC2CTradeHistory(\n requestParameters?: GetC2CTradeHistoryRequest\n ): Promise<RestApiResponse<GetC2CTradeHistoryResponse>>;\n}\n\n/**\n * Request parameters for getC2CTradeHistory operation in C2CApi.\n * @interface GetC2CTradeHistoryRequest\n */\nexport interface GetC2CTradeHistoryRequest {\n /**\n *\n * @type {number}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly startTime?: number;\n\n /**\n *\n * @type {number}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly endTime?: number;\n\n /**\n * Default 1\n * @type {number}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly page?: number;\n\n /**\n *\n * @type {number}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly recvWindow?: number;\n}\n\n/**\n * C2CApi - object-oriented interface\n * @class C2CApi\n */\nexport class C2CApi implements C2CApiInterface {\n private readonly configuration: ConfigurationRestAPI;\n private localVarAxiosParamCreator;\n\n constructor(configuration: ConfigurationRestAPI) {\n this.configuration = configuration;\n this.localVarAxiosParamCreator = C2CApiAxiosParamCreator(configuration);\n }\n\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof C2CApi\n * @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}\n */\n public async getC2CTradeHistory(\n requestParameters: GetC2CTradeHistoryRequest = {}\n ): Promise<RestApiResponse<GetC2CTradeHistoryResponse>> {\n const localVarAxiosArgs = await this.localVarAxiosParamCreator.getC2CTradeHistory(\n requestParameters?.startTime,\n requestParameters?.endTime,\n requestParameters?.page,\n requestParameters?.recvWindow\n );\n return sendRequest<GetC2CTradeHistoryResponse>(\n this.configuration,\n localVarAxiosArgs.endpoint,\n localVarAxiosArgs.method,\n localVarAxiosArgs.params,\n localVarAxiosArgs?.timeUnit,\n { isSigned: true }\n );\n }\n}\n","/**\n * Binance C2C REST API\n *\n * OpenAPI Specification for the Binance C2C REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nimport { ConfigurationRestAPI, RestApiResponse, sendRequest } from '@binance/common';\nimport { C2CApi } from './modules/c2-capi';\n\nimport type { GetC2CTradeHistoryRequest } from './modules/c2-capi';\n\nimport type { GetC2CTradeHistoryResponse } from './types';\n\nexport class RestAPI {\n private configuration: ConfigurationRestAPI;\n private c2CApi: C2CApi;\n\n constructor(configuration: ConfigurationRestAPI) {\n this.configuration = configuration;\n this.c2CApi = new C2CApi(configuration);\n }\n\n /**\n * Generic function to send a request.\n * @param endpoint - The API endpoint to call.\n * @param method - HTTP method to use (GET, POST, DELETE, etc.).\n * @param params - Query parameters for the request.\n *\n * @returns A promise resolving to the response data object.\n */\n sendRequest<T>(\n endpoint: string,\n method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH',\n params: Record<string, unknown> = {}\n ): Promise<RestApiResponse<T>> {\n return sendRequest<T>(this.configuration, endpoint, method, params, undefined);\n }\n\n /**\n * Generic function to send a signed request.\n * @param endpoint - The API endpoint to call.\n * @param method - HTTP method to use (GET, POST, DELETE, etc.).\n * @param params - Query parameters for the request.\n *\n * @returns A promise resolving to the response data object.\n */\n sendSignedRequest<T>(\n endpoint: string,\n method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH',\n params: Record<string, unknown> = {}\n ): Promise<RestApiResponse<T>> {\n return sendRequest<T>(this.configuration, endpoint, method, params, undefined, {\n isSigned: true,\n });\n }\n\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}\n */\n getC2CTradeHistory(\n requestParameters: GetC2CTradeHistoryRequest = {}\n ): Promise<RestApiResponse<GetC2CTradeHistoryResponse>> {\n return this.c2CApi.getC2CTradeHistory(requestParameters);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,gBAA+B;AAC/B,IAAAA,iBAA4D;;;ACAxD,WAAQ;AAER,cAAW;;;ACHf;AAAA;AAAA;AAAA;AAAA;;;ACaA,oBAMO;AAMP,IAAM,0BAA0B,SAAU,eAAqC;AAC3E,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAmBH,oBAAoB,OAChB,WACA,SACA,MACA,eACuB;AACvB,YAAM,yBAAkD,CAAC;AAEzD,UAAI,cAAc,UAAa,cAAc,MAAM;AAC/C,+B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,CAAC,GACR;AAC3B,eAAO,4BAAe,KAAK,eAAe,UAAU,QAAQ,QAAQ,MAAS;AAAA,EACjF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,kBACI,UACA,QACA,SAAkC,CAAC,GACR;AAC3B,eAAO,4BAAe,KAAK,eAAe,UAAU,QAAQ,QAAQ,QAAW;AAAA,MAC3E,UAAU;AAAA,IACd,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBA,mBACI,oBAA+C,CAAC,GACI;AACpD,WAAO,KAAK,OAAO,mBAAmB,iBAAiB;AAAA,EAC3D;AACJ;;;AJ3EO,IAAM,MAAN,MAAU;AAAA,EAGb,YAAY,QAA0B;AAClC,QAAI,QAAQ,sBAAsB;AAC9B,YAAM,gBAAgB,IAAI,oCAAqB,OAAO,oBAAoB;AAC1E,oBAAc,WAAW,cAAc,YAAY;AACnD,oBAAc,cAAc,cAAc,eAAe,CAAC;AAC1D,oBAAc,YAAY,UAAU;AAAA,QAChC,GAAI,cAAc,YAAY,WAAW,CAAC;AAAA,QAC1C,cAAc,GAAG,IAAI,IAAI,OAAO,aAAa,QAAQ,OAAO,SAAK,oBAAS,CAAC,SAAK,gBAAK,CAAC;AAAA,MAC1F;AACA,WAAK,UAAU,IAAI,QAAQ,aAAa;AAAA,IAC5C;AAAA,EACJ;AACJ;;;ADrBA,IAAAC,iBAYO;","names":["import_common","import_common","import_common"]}
|
package/dist/index.mjs
CHANGED
|
@@ -10,20 +10,20 @@ import { ConfigurationRestAPI as ConfigurationRestAPI3, C2C_REST_API_PROD_URL }
|
|
|
10
10
|
|
|
11
11
|
// package.json
|
|
12
12
|
var name = "@binance/c2c";
|
|
13
|
-
var version = "1.0.
|
|
13
|
+
var version = "1.0.1";
|
|
14
14
|
|
|
15
15
|
// src/rest-api/index.ts
|
|
16
16
|
var rest_api_exports = {};
|
|
17
17
|
__export(rest_api_exports, {
|
|
18
|
-
|
|
18
|
+
C2CApi: () => C2CApi,
|
|
19
19
|
RestAPI: () => RestAPI
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
// src/rest-api/modules/
|
|
22
|
+
// src/rest-api/modules/c2-capi.ts
|
|
23
23
|
import {
|
|
24
24
|
sendRequest
|
|
25
25
|
} from "@binance/common";
|
|
26
|
-
var
|
|
26
|
+
var C2CApiAxiosParamCreator = function(configuration) {
|
|
27
27
|
return {
|
|
28
28
|
/**
|
|
29
29
|
* Get C2C Trade History
|
|
@@ -58,8 +58,7 @@ var C2cApiAxiosParamCreator = function(configuration) {
|
|
|
58
58
|
localVarQueryParameter["recvWindow"] = recvWindow;
|
|
59
59
|
}
|
|
60
60
|
let _timeUnit;
|
|
61
|
-
if ("timeUnit" in configuration)
|
|
62
|
-
_timeUnit = configuration.timeUnit;
|
|
61
|
+
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
63
62
|
return {
|
|
64
63
|
endpoint: "/sapi/v1/c2c/orderMatch/listUserOrderHistory",
|
|
65
64
|
method: "GET",
|
|
@@ -69,10 +68,10 @@ var C2cApiAxiosParamCreator = function(configuration) {
|
|
|
69
68
|
}
|
|
70
69
|
};
|
|
71
70
|
};
|
|
72
|
-
var
|
|
71
|
+
var C2CApi = class {
|
|
73
72
|
constructor(configuration) {
|
|
74
73
|
this.configuration = configuration;
|
|
75
|
-
this.localVarAxiosParamCreator =
|
|
74
|
+
this.localVarAxiosParamCreator = C2CApiAxiosParamCreator(configuration);
|
|
76
75
|
}
|
|
77
76
|
/**
|
|
78
77
|
* Get C2C Trade History
|
|
@@ -88,7 +87,7 @@ var C2cApi = class {
|
|
|
88
87
|
* @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.
|
|
89
88
|
* @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}
|
|
90
89
|
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
91
|
-
* @memberof
|
|
90
|
+
* @memberof C2CApi
|
|
92
91
|
* @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}
|
|
93
92
|
*/
|
|
94
93
|
async getC2CTradeHistory(requestParameters = {}) {
|
|
@@ -114,7 +113,7 @@ import { sendRequest as sendRequest2 } from "@binance/common";
|
|
|
114
113
|
var RestAPI = class {
|
|
115
114
|
constructor(configuration) {
|
|
116
115
|
this.configuration = configuration;
|
|
117
|
-
this.
|
|
116
|
+
this.c2CApi = new C2CApi(configuration);
|
|
118
117
|
}
|
|
119
118
|
/**
|
|
120
119
|
* Generic function to send a request.
|
|
@@ -157,7 +156,7 @@ var RestAPI = class {
|
|
|
157
156
|
* @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}
|
|
158
157
|
*/
|
|
159
158
|
getC2CTradeHistory(requestParameters = {}) {
|
|
160
|
-
return this.
|
|
159
|
+
return this.c2CApi.getC2CTradeHistory(requestParameters);
|
|
161
160
|
}
|
|
162
161
|
};
|
|
163
162
|
|
|
@@ -180,7 +179,6 @@ var C2C = class {
|
|
|
180
179
|
// src/index.ts
|
|
181
180
|
import {
|
|
182
181
|
C2C_REST_API_PROD_URL as C2C_REST_API_PROD_URL2,
|
|
183
|
-
C2C_REST_API_TESTNET_URL,
|
|
184
182
|
ConnectorClientError,
|
|
185
183
|
RequiredError,
|
|
186
184
|
UnauthorizedError,
|
|
@@ -197,7 +195,6 @@ export {
|
|
|
197
195
|
C2C,
|
|
198
196
|
rest_api_exports as C2CRestAPI,
|
|
199
197
|
C2C_REST_API_PROD_URL2 as C2C_REST_API_PROD_URL,
|
|
200
|
-
C2C_REST_API_TESTNET_URL,
|
|
201
198
|
ConnectorClientError,
|
|
202
199
|
ForbiddenError,
|
|
203
200
|
NetworkError,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/c2c.ts","../package.json","../src/rest-api/index.ts","../src/rest-api/modules/c2c-api.ts","../src/rest-api/rest-api.ts","../src/index.ts"],"sourcesContent":["import { platform, arch } from 'os';\nimport { ConfigurationRestAPI, C2C_REST_API_PROD_URL } from '@binance/common';\nimport { name, version } from '../package.json';\nimport { RestAPI } from './rest-api';\n\nexport interface ConfigurationC2C {\n configurationRestAPI?: ConfigurationRestAPI;\n}\n\nexport class C2C {\n public restAPI!: RestAPI;\n\n constructor(config: ConfigurationC2C) {\n if (config?.configurationRestAPI) {\n const configRestAPI = new ConfigurationRestAPI(config.configurationRestAPI);\n configRestAPI.basePath = configRestAPI.basePath || C2C_REST_API_PROD_URL;\n configRestAPI.baseOptions = configRestAPI.baseOptions || {};\n configRestAPI.baseOptions.headers = {\n ...(configRestAPI.baseOptions.headers || {}),\n 'User-Agent': `${name}/${version} (Node.js/${process.version}; ${platform()}; ${arch()})`,\n };\n this.restAPI = new RestAPI(configRestAPI);\n }\n }\n}\n","{\n \"name\": \"@binance/c2c\",\n \"description\": \"Official Binance C2C Connector - A lightweight library that provides a convenient interface to Binance's C2C REST API.\",\n \"version\": \"1.0.0\",\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"scripts\": {\n \"prepublishOnly\": \"npm run build\",\n \"build\": \"tsup\",\n \"typecheck\": \"tsc --noEmit\",\n \"clean\": \"rm -rf dist\",\n \"test\": \"npx jest --maxWorkers=4 --bail\",\n \"test:watch\": \"npx jest --watch\",\n \"format\": \"npx prettier --ignore-path .prettierignore --write .\",\n \"lint\": \"npx eslint '**/*.ts' --fix\"\n },\n \"keywords\": [\n \"Binance\",\n \"API\",\n \"C2C\",\n \"Connector\",\n \"REST\",\n \"Trading\"\n ],\n \"author\": \"Binance\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/binance/binance-connector-js.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/binance/binance-connector-js/issues\"\n },\n \"homepage\": \"https://github.com/binance/binance-connector-js#readme\",\n \"files\": [\n \"dist\"\n ],\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.4\",\n \"@types/node\": \"^20.17.24\",\n \"eslint\": \"8.57.0\",\n \"jest\": \"^29.6.4\",\n \"prettier\": \"^3.3.3\",\n \"ts-jest\": \"^29.1.1\",\n \"ts-node\": \"^10.9.1\",\n \"tsup\": \"^7.2.0\",\n \"typescript\": \"^5.7.2\",\n \"typescript-eslint\": \"^8.24.0\"\n },\n \"dependencies\": {\n \"@binance/common\": \"1.0.0\",\n \"axios\": \"^1.7.4\"\n }\n}\n","/**\n * Binance Public C2C REST API\n *\n * OpenAPI Specification for the Binance Public C2C REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nexport * from './types';\nexport * from './modules';\nexport * from './rest-api';\n","/**\n * Binance Public C2C REST API\n *\n * OpenAPI Specification for the Binance Public C2C REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nimport {\n ConfigurationRestAPI,\n TimeUnit,\n RestApiResponse,\n sendRequest,\n type RequestArgs,\n} from '@binance/common';\nimport type { GetC2CTradeHistoryResponse } from '../types';\n\n/**\n * C2cApi - axios parameter creator\n */\nconst C2cApiAxiosParamCreator = function (configuration: ConfigurationRestAPI) {\n return {\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {number} [startTime]\n * @param {number} [endTime]\n * @param {number} [page] Default 1\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getC2CTradeHistory: async (\n startTime?: number,\n endTime?: number,\n page?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (startTime !== undefined && startTime !== null) {\n localVarQueryParameter['startTime'] = startTime;\n }\n\n if (endTime !== undefined && endTime !== null) {\n localVarQueryParameter['endTime'] = endTime;\n }\n\n if (page !== undefined && page !== null) {\n localVarQueryParameter['page'] = page;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/sapi/v1/c2c/orderMatch/listUserOrderHistory',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n };\n};\n\n/**\n * C2cApi - interface\n * @interface C2cApi\n */\nexport interface C2cApiInterface {\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof C2cApiInterface\n */\n getC2CTradeHistory(\n requestParameters?: GetC2CTradeHistoryRequest\n ): Promise<RestApiResponse<GetC2CTradeHistoryResponse>>;\n}\n\n/**\n * Request parameters for getC2CTradeHistory operation in C2cApi.\n * @interface GetC2CTradeHistoryRequest\n */\nexport interface GetC2CTradeHistoryRequest {\n /**\n *\n * @type {number}\n * @memberof C2cApiGetC2CTradeHistory\n */\n readonly startTime?: number;\n\n /**\n *\n * @type {number}\n * @memberof C2cApiGetC2CTradeHistory\n */\n readonly endTime?: number;\n\n /**\n * Default 1\n * @type {number}\n * @memberof C2cApiGetC2CTradeHistory\n */\n readonly page?: number;\n\n /**\n *\n * @type {number}\n * @memberof C2cApiGetC2CTradeHistory\n */\n readonly recvWindow?: number;\n}\n\n/**\n * C2cApi - object-oriented interface\n * @class C2cApi\n */\nexport class C2cApi implements C2cApiInterface {\n private readonly configuration: ConfigurationRestAPI;\n private localVarAxiosParamCreator;\n\n constructor(configuration: ConfigurationRestAPI) {\n this.configuration = configuration;\n this.localVarAxiosParamCreator = C2cApiAxiosParamCreator(configuration);\n }\n\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof C2cApi\n * @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}\n */\n public async getC2CTradeHistory(\n requestParameters: GetC2CTradeHistoryRequest = {}\n ): Promise<RestApiResponse<GetC2CTradeHistoryResponse>> {\n const localVarAxiosArgs = await this.localVarAxiosParamCreator.getC2CTradeHistory(\n requestParameters?.startTime,\n requestParameters?.endTime,\n requestParameters?.page,\n requestParameters?.recvWindow\n );\n return sendRequest<GetC2CTradeHistoryResponse>(\n this.configuration,\n localVarAxiosArgs.endpoint,\n localVarAxiosArgs.method,\n localVarAxiosArgs.params,\n localVarAxiosArgs?.timeUnit,\n { isSigned: true }\n );\n }\n}\n","/**\n * Binance Public C2C REST API\n *\n * OpenAPI Specification for the Binance Public C2C REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nimport { ConfigurationRestAPI, RestApiResponse, sendRequest } from '@binance/common';\nimport { C2cApi } from './modules/c2c-api';\n\nimport type { GetC2CTradeHistoryRequest } from './modules/c2c-api';\n\nimport type { GetC2CTradeHistoryResponse } from './types';\n\nexport class RestAPI {\n private configuration: ConfigurationRestAPI;\n private c2cApi: C2cApi;\n\n constructor(configuration: ConfigurationRestAPI) {\n this.configuration = configuration;\n this.c2cApi = new C2cApi(configuration);\n }\n\n /**\n * Generic function to send a request.\n * @param endpoint - The API endpoint to call.\n * @param method - HTTP method to use (GET, POST, DELETE, etc.).\n * @param params - Query parameters for the request.\n *\n * @returns A promise resolving to the response data object.\n */\n sendRequest<T>(\n endpoint: string,\n method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH',\n params: Record<string, unknown> = {}\n ): Promise<RestApiResponse<T>> {\n return sendRequest<T>(this.configuration, endpoint, method, params, undefined);\n }\n\n /**\n * Generic function to send a signed request.\n * @param endpoint - The API endpoint to call.\n * @param method - HTTP method to use (GET, POST, DELETE, etc.).\n * @param params - Query parameters for the request.\n *\n * @returns A promise resolving to the response data object.\n */\n sendSignedRequest<T>(\n endpoint: string,\n method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH',\n params: Record<string, unknown> = {}\n ): Promise<RestApiResponse<T>> {\n return sendRequest<T>(this.configuration, endpoint, method, params, undefined, {\n isSigned: true,\n });\n }\n\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}\n */\n getC2CTradeHistory(\n requestParameters: GetC2CTradeHistoryRequest = {}\n ): Promise<RestApiResponse<GetC2CTradeHistoryResponse>> {\n return this.c2cApi.getC2CTradeHistory(requestParameters);\n }\n}\n","export { C2C, ConfigurationC2C } from './c2c';\nexport * as C2CRestAPI from './rest-api';\n\nexport {\n C2C_REST_API_PROD_URL,\n C2C_REST_API_TESTNET_URL,\n ConnectorClientError,\n RequiredError,\n UnauthorizedError,\n ForbiddenError,\n TooManyRequestsError,\n RateLimitBanError,\n ServerError,\n NetworkError,\n NotFoundError,\n BadRequestError,\n} from '@binance/common';\n"],"mappings":";;;;;;;AAAA,SAAS,UAAU,YAAY;AAC/B,SAAS,wBAAAA,uBAAsB,6BAA6B;;;ACAxD,WAAQ;AAER,cAAW;;;ACHf;AAAA;AAAA;AAAA;AAAA;;;ACaA;AAAA,EAII;AAAA,OAEG;AAMP,IAAM,0BAA0B,SAAU,eAAqC;AAC3E,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAmBH,oBAAoB,OAChB,WACA,SACA,MACA,eACuB;AACvB,YAAM,yBAAkD,CAAC;AAEzD,UAAI,cAAc,UAAa,cAAc,MAAM;AAC/C,+BAAuB,WAAW,IAAI;AAAA,MAC1C;AAEA,UAAI,YAAY,UAAa,YAAY,MAAM;AAC3C,+BAAuB,SAAS,IAAI;AAAA,MACxC;AAEA,UAAI,SAAS,UAAa,SAAS,MAAM;AACrC,+BAAuB,MAAM,IAAI;AAAA,MACrC;AAEA,UAAI,eAAe,UAAa,eAAe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,eAAe,UAAU,QAAQ,QAAQ,QAAW;AAAA,MAC3E,UAAU;AAAA,IACd,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBA,mBACI,oBAA+C,CAAC,GACI;AACpD,WAAO,KAAK,OAAO,mBAAmB,iBAAiB;AAAA,EAC3D;AACJ;;;AJ3EO,IAAM,MAAN,MAAU;AAAA,EAGb,YAAY,QAA0B;AAClC,QAAI,QAAQ,sBAAsB;AAC9B,YAAM,gBAAgB,IAAIC,sBAAqB,OAAO,oBAAoB;AAC1E,oBAAc,WAAW,cAAc,YAAY;AACnD,oBAAc,cAAc,cAAc,eAAe,CAAC;AAC1D,oBAAc,YAAY,UAAU;AAAA,QAChC,GAAI,cAAc,YAAY,WAAW,CAAC;AAAA,QAC1C,cAAc,GAAG,IAAI,IAAI,OAAO,aAAa,QAAQ,OAAO,KAAK,SAAS,CAAC,KAAK,KAAK,CAAC;AAAA,MAC1F;AACA,WAAK,UAAU,IAAI,QAAQ,aAAa;AAAA,IAC5C;AAAA,EACJ;AACJ;;;AKrBA;AAAA,EACI,yBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;","names":["ConfigurationRestAPI","sendRequest","sendRequest","ConfigurationRestAPI","C2C_REST_API_PROD_URL"]}
|
|
1
|
+
{"version":3,"sources":["../src/c2c.ts","../package.json","../src/rest-api/index.ts","../src/rest-api/modules/c2-capi.ts","../src/rest-api/rest-api.ts","../src/index.ts"],"sourcesContent":["import { platform, arch } from 'os';\nimport { ConfigurationRestAPI, C2C_REST_API_PROD_URL } from '@binance/common';\nimport { name, version } from '../package.json';\nimport { RestAPI } from './rest-api';\n\nexport interface ConfigurationC2C {\n configurationRestAPI?: ConfigurationRestAPI;\n}\n\nexport class C2C {\n public restAPI!: RestAPI;\n\n constructor(config: ConfigurationC2C) {\n if (config?.configurationRestAPI) {\n const configRestAPI = new ConfigurationRestAPI(config.configurationRestAPI);\n configRestAPI.basePath = configRestAPI.basePath || C2C_REST_API_PROD_URL;\n configRestAPI.baseOptions = configRestAPI.baseOptions || {};\n configRestAPI.baseOptions.headers = {\n ...(configRestAPI.baseOptions.headers || {}),\n 'User-Agent': `${name}/${version} (Node.js/${process.version}; ${platform()}; ${arch()})`,\n };\n this.restAPI = new RestAPI(configRestAPI);\n }\n }\n}\n","{\n \"name\": \"@binance/c2c\",\n \"description\": \"Official Binance C2C Connector - A lightweight library that provides a convenient interface to Binance's C2C REST API.\",\n \"version\": \"1.0.1\",\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"scripts\": {\n \"prepublishOnly\": \"npm run build\",\n \"build\": \"tsup\",\n \"typecheck\": \"tsc --noEmit\",\n \"clean\": \"rm -rf dist\",\n \"test\": \"npx jest --maxWorkers=4 --bail\",\n \"test:watch\": \"npx jest --watch\",\n \"format\": \"npx prettier --ignore-path .prettierignore --write .\",\n \"lint\": \"npx eslint '**/*.ts' --fix\"\n },\n \"keywords\": [\n \"Binance\",\n \"API\",\n \"C2C\",\n \"Connector\",\n \"REST\",\n \"Trading\"\n ],\n \"author\": \"Binance\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/binance/binance-connector-js.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/binance/binance-connector-js/issues\"\n },\n \"homepage\": \"https://github.com/binance/binance-connector-js#readme\",\n \"files\": [\n \"dist\"\n ],\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.4\",\n \"@types/node\": \"^20.17.24\",\n \"eslint\": \"8.57.0\",\n \"jest\": \"^29.6.4\",\n \"prettier\": \"^3.3.3\",\n \"ts-jest\": \"^29.1.1\",\n \"ts-node\": \"^10.9.1\",\n \"tsup\": \"^8.4.0\",\n \"typescript\": \"^5.7.2\",\n \"typescript-eslint\": \"^8.24.0\"\n },\n \"dependencies\": {\n \"@binance/common\": \"1.0.1\",\n \"axios\": \"^1.7.4\"\n }\n}\n","/**\n * Binance C2C REST API\n *\n * OpenAPI Specification for the Binance C2C REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nexport * from './types';\nexport * from './modules';\nexport * from './rest-api';\n","/**\n * Binance C2C REST API\n *\n * OpenAPI Specification for the Binance C2C REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nimport {\n ConfigurationRestAPI,\n TimeUnit,\n RestApiResponse,\n sendRequest,\n type RequestArgs,\n} from '@binance/common';\nimport type { GetC2CTradeHistoryResponse } from '../types';\n\n/**\n * C2CApi - axios parameter creator\n */\nconst C2CApiAxiosParamCreator = function (configuration: ConfigurationRestAPI) {\n return {\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {number} [startTime]\n * @param {number} [endTime]\n * @param {number} [page] Default 1\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getC2CTradeHistory: async (\n startTime?: number,\n endTime?: number,\n page?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (startTime !== undefined && startTime !== null) {\n localVarQueryParameter['startTime'] = startTime;\n }\n\n if (endTime !== undefined && endTime !== null) {\n localVarQueryParameter['endTime'] = endTime;\n }\n\n if (page !== undefined && page !== null) {\n localVarQueryParameter['page'] = page;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/sapi/v1/c2c/orderMatch/listUserOrderHistory',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n };\n};\n\n/**\n * C2CApi - interface\n * @interface C2CApi\n */\nexport interface C2CApiInterface {\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof C2CApiInterface\n */\n getC2CTradeHistory(\n requestParameters?: GetC2CTradeHistoryRequest\n ): Promise<RestApiResponse<GetC2CTradeHistoryResponse>>;\n}\n\n/**\n * Request parameters for getC2CTradeHistory operation in C2CApi.\n * @interface GetC2CTradeHistoryRequest\n */\nexport interface GetC2CTradeHistoryRequest {\n /**\n *\n * @type {number}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly startTime?: number;\n\n /**\n *\n * @type {number}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly endTime?: number;\n\n /**\n * Default 1\n * @type {number}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly page?: number;\n\n /**\n *\n * @type {number}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly recvWindow?: number;\n}\n\n/**\n * C2CApi - object-oriented interface\n * @class C2CApi\n */\nexport class C2CApi implements C2CApiInterface {\n private readonly configuration: ConfigurationRestAPI;\n private localVarAxiosParamCreator;\n\n constructor(configuration: ConfigurationRestAPI) {\n this.configuration = configuration;\n this.localVarAxiosParamCreator = C2CApiAxiosParamCreator(configuration);\n }\n\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof C2CApi\n * @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}\n */\n public async getC2CTradeHistory(\n requestParameters: GetC2CTradeHistoryRequest = {}\n ): Promise<RestApiResponse<GetC2CTradeHistoryResponse>> {\n const localVarAxiosArgs = await this.localVarAxiosParamCreator.getC2CTradeHistory(\n requestParameters?.startTime,\n requestParameters?.endTime,\n requestParameters?.page,\n requestParameters?.recvWindow\n );\n return sendRequest<GetC2CTradeHistoryResponse>(\n this.configuration,\n localVarAxiosArgs.endpoint,\n localVarAxiosArgs.method,\n localVarAxiosArgs.params,\n localVarAxiosArgs?.timeUnit,\n { isSigned: true }\n );\n }\n}\n","/**\n * Binance C2C REST API\n *\n * OpenAPI Specification for the Binance C2C REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nimport { ConfigurationRestAPI, RestApiResponse, sendRequest } from '@binance/common';\nimport { C2CApi } from './modules/c2-capi';\n\nimport type { GetC2CTradeHistoryRequest } from './modules/c2-capi';\n\nimport type { GetC2CTradeHistoryResponse } from './types';\n\nexport class RestAPI {\n private configuration: ConfigurationRestAPI;\n private c2CApi: C2CApi;\n\n constructor(configuration: ConfigurationRestAPI) {\n this.configuration = configuration;\n this.c2CApi = new C2CApi(configuration);\n }\n\n /**\n * Generic function to send a request.\n * @param endpoint - The API endpoint to call.\n * @param method - HTTP method to use (GET, POST, DELETE, etc.).\n * @param params - Query parameters for the request.\n *\n * @returns A promise resolving to the response data object.\n */\n sendRequest<T>(\n endpoint: string,\n method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH',\n params: Record<string, unknown> = {}\n ): Promise<RestApiResponse<T>> {\n return sendRequest<T>(this.configuration, endpoint, method, params, undefined);\n }\n\n /**\n * Generic function to send a signed request.\n * @param endpoint - The API endpoint to call.\n * @param method - HTTP method to use (GET, POST, DELETE, etc.).\n * @param params - Query parameters for the request.\n *\n * @returns A promise resolving to the response data object.\n */\n sendSignedRequest<T>(\n endpoint: string,\n method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH',\n params: Record<string, unknown> = {}\n ): Promise<RestApiResponse<T>> {\n return sendRequest<T>(this.configuration, endpoint, method, params, undefined, {\n isSigned: true,\n });\n }\n\n /**\n * Get C2C Trade History\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}\n */\n getC2CTradeHistory(\n requestParameters: GetC2CTradeHistoryRequest = {}\n ): Promise<RestApiResponse<GetC2CTradeHistoryResponse>> {\n return this.c2CApi.getC2CTradeHistory(requestParameters);\n }\n}\n","export { C2C, ConfigurationC2C } from './c2c';\nexport * as C2CRestAPI from './rest-api';\n\nexport {\n C2C_REST_API_PROD_URL,\n ConnectorClientError,\n RequiredError,\n UnauthorizedError,\n ForbiddenError,\n TooManyRequestsError,\n RateLimitBanError,\n ServerError,\n NetworkError,\n NotFoundError,\n BadRequestError,\n} from '@binance/common';\n"],"mappings":";;;;;;;AAAA,SAAS,UAAU,YAAY;AAC/B,SAAS,wBAAAA,uBAAsB,6BAA6B;;;ACAxD,WAAQ;AAER,cAAW;;;ACHf;AAAA;AAAA;AAAA;AAAA;;;ACaA;AAAA,EAII;AAAA,OAEG;AAMP,IAAM,0BAA0B,SAAU,eAAqC;AAC3E,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAmBH,oBAAoB,OAChB,WACA,SACA,MACA,eACuB;AACvB,YAAM,yBAAkD,CAAC;AAEzD,UAAI,cAAc,UAAa,cAAc,MAAM;AAC/C,+BAAuB,WAAW,IAAI;AAAA,MAC1C;AAEA,UAAI,YAAY,UAAa,YAAY,MAAM;AAC3C,+BAAuB,SAAS,IAAI;AAAA,MACxC;AAEA,UAAI,SAAS,UAAa,SAAS,MAAM;AACrC,+BAAuB,MAAM,IAAI;AAAA,MACrC;AAEA,UAAI,eAAe,UAAa,eAAe,MAAM;AACjD,+BAAuB,YAAY,IAAI;AAAA,MAC3C;AAEA,UAAI;AACJ,UAAI,cAAc,cAAe,aAAY,cAAc;AAE3D,aAAO;AAAA,QACH,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,UAAU;AAAA,MACd;AAAA,IACJ;AAAA,EACJ;AACJ;AAkEO,IAAM,SAAN,MAAwC;AAAA,EAI3C,YAAY,eAAqC;AAC7C,SAAK,gBAAgB;AACrB,SAAK,4BAA4B,wBAAwB,aAAa;AAAA,E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AAI,QAAQ,sBAAsB;AAC9B,YAAM,gBAAgB,IAAIC,sBAAqB,OAAO,oBAAoB;AAC1E,oBAAc,WAAW,cAAc,YAAY;AACnD,oBAAc,cAAc,cAAc,eAAe,CAAC;AAC1D,oBAAc,YAAY,UAAU;AAAA,QAChC,GAAI,cAAc,YAAY,WAAW,CAAC;AAAA,QAC1C,cAAc,GAAG,IAAI,IAAI,OAAO,aAAa,QAAQ,OAAO,KAAK,SAAS,CAAC,KAAK,KAAK,CAAC;AAAA,MAC1F;AACA,WAAK,UAAU,IAAI,QAAQ,aAAa;AAAA,IAC5C;AAAA,EACJ;AACJ;;;AKrBA;AAAA,EACI,yBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;","names":["ConfigurationRestAPI","sendRequest","sendRequest","ConfigurationRestAPI","C2C_REST_API_PROD_URL"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@binance/c2c",
|
|
3
3
|
"description": "Official Binance C2C Connector - A lightweight library that provides a convenient interface to Binance's C2C REST API.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"prettier": "^3.3.3",
|
|
45
45
|
"ts-jest": "^29.1.1",
|
|
46
46
|
"ts-node": "^10.9.1",
|
|
47
|
-
"tsup": "^
|
|
47
|
+
"tsup": "^8.4.0",
|
|
48
48
|
"typescript": "^5.7.2",
|
|
49
49
|
"typescript-eslint": "^8.24.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@binance/common": "1.0.
|
|
52
|
+
"@binance/common": "1.0.1",
|
|
53
53
|
"axios": "^1.7.4"
|
|
54
54
|
}
|
|
55
55
|
}
|