@binance/c2c 4.0.0 → 4.0.2
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/dist/chunk.mjs +13 -0
- package/dist/index.d.mts +243 -296
- package/dist/index.d.ts +245 -298
- package/dist/index.js +229 -219
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +150 -204
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,218 +1,164 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
for (var name2 in all)
|
|
4
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
// src/c2c.ts
|
|
8
|
-
import { buildUserAgent, ConfigurationRestAPI as ConfigurationRestAPI3, C2C_REST_API_PROD_URL } from "@binance/common";
|
|
1
|
+
import { t as __export } from "./chunk.mjs";
|
|
2
|
+
import { BadRequestError, C2C_REST_API_PROD_URL, C2C_REST_API_PROD_URL as C2C_REST_API_PROD_URL$1, ConfigurationRestAPI, ConnectorClientError, ForbiddenError, NetworkError, NotFoundError, RateLimitBanError, RequiredError, ServerError, TooManyRequestsError, UnauthorizedError, buildUserAgent, sendRequest } from "@binance/common";
|
|
9
3
|
|
|
10
|
-
|
|
4
|
+
//#region package.json
|
|
11
5
|
var name = "@binance/c2c";
|
|
12
|
-
var version = "4.0.
|
|
13
|
-
|
|
14
|
-
// src/rest-api/index.ts
|
|
15
|
-
var rest_api_exports = {};
|
|
16
|
-
__export(rest_api_exports, {
|
|
17
|
-
C2CApi: () => C2CApi,
|
|
18
|
-
RestAPI: () => RestAPI
|
|
19
|
-
});
|
|
6
|
+
var version = "4.0.2";
|
|
20
7
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
if (page !== void 0 && page !== null) {
|
|
58
|
-
localVarQueryParameter["page"] = page;
|
|
59
|
-
}
|
|
60
|
-
if (rows !== void 0 && rows !== null) {
|
|
61
|
-
localVarQueryParameter["rows"] = rows;
|
|
62
|
-
}
|
|
63
|
-
if (recvWindow !== void 0 && recvWindow !== null) {
|
|
64
|
-
localVarQueryParameter["recvWindow"] = recvWindow;
|
|
65
|
-
}
|
|
66
|
-
let _timeUnit;
|
|
67
|
-
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
68
|
-
return {
|
|
69
|
-
endpoint: "/sapi/v1/c2c/orderMatch/listUserOrderHistory",
|
|
70
|
-
method: "GET",
|
|
71
|
-
params: localVarQueryParameter,
|
|
72
|
-
timeUnit: _timeUnit
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
};
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/rest-api/modules/c2-capi.ts
|
|
10
|
+
/**
|
|
11
|
+
* Binance C2C REST API
|
|
12
|
+
*
|
|
13
|
+
* OpenAPI Specification for the Binance C2C REST API
|
|
14
|
+
*
|
|
15
|
+
* The version of the OpenAPI document: 1.0.0
|
|
16
|
+
*
|
|
17
|
+
*
|
|
18
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
19
|
+
* https://openapi-generator.tech
|
|
20
|
+
* Do not edit the class manually.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* C2CApi - axios parameter creator
|
|
24
|
+
*/
|
|
25
|
+
const C2CApiAxiosParamCreator = function(configuration) {
|
|
26
|
+
return { getC2CTradeHistory: async (tradeType, startTimestamp, endTimestamp, page, rows, recvWindow) => {
|
|
27
|
+
const localVarQueryParameter = {};
|
|
28
|
+
if (tradeType !== void 0 && tradeType !== null) localVarQueryParameter["tradeType"] = tradeType;
|
|
29
|
+
if (startTimestamp !== void 0 && startTimestamp !== null) localVarQueryParameter["startTimestamp"] = startTimestamp;
|
|
30
|
+
if (endTimestamp !== void 0 && endTimestamp !== null) localVarQueryParameter["endTimestamp"] = endTimestamp;
|
|
31
|
+
if (page !== void 0 && page !== null) localVarQueryParameter["page"] = page;
|
|
32
|
+
if (rows !== void 0 && rows !== null) localVarQueryParameter["rows"] = rows;
|
|
33
|
+
if (recvWindow !== void 0 && recvWindow !== null) localVarQueryParameter["recvWindow"] = recvWindow;
|
|
34
|
+
let _timeUnit;
|
|
35
|
+
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
36
|
+
return {
|
|
37
|
+
endpoint: "/sapi/v1/c2c/orderMatch/listUserOrderHistory",
|
|
38
|
+
method: "GET",
|
|
39
|
+
params: localVarQueryParameter,
|
|
40
|
+
timeUnit: _timeUnit
|
|
41
|
+
};
|
|
42
|
+
} };
|
|
76
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* C2CApi - object-oriented interface
|
|
46
|
+
* @class C2CApi
|
|
47
|
+
*/
|
|
77
48
|
var C2CApi = class {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
requestParameters?.endTimestamp,
|
|
103
|
-
requestParameters?.page,
|
|
104
|
-
requestParameters?.rows,
|
|
105
|
-
requestParameters?.recvWindow
|
|
106
|
-
);
|
|
107
|
-
return sendRequest(
|
|
108
|
-
this.configuration,
|
|
109
|
-
localVarAxiosArgs.endpoint,
|
|
110
|
-
localVarAxiosArgs.method,
|
|
111
|
-
localVarAxiosArgs.params,
|
|
112
|
-
localVarAxiosArgs?.timeUnit,
|
|
113
|
-
{ isSigned: true }
|
|
114
|
-
);
|
|
115
|
-
}
|
|
49
|
+
constructor(configuration) {
|
|
50
|
+
this.configuration = configuration;
|
|
51
|
+
this.localVarAxiosParamCreator = C2CApiAxiosParamCreator(configuration);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get C2C Trade History
|
|
55
|
+
*
|
|
56
|
+
* The max interval between startTimestamp and endTimestamp is 30 days.
|
|
57
|
+
* If startTimestamp and endTimestamp are not sent, the recent 30 days' data will be returned.
|
|
58
|
+
* You can only view data from the past 6 months. To see all C2C orders, please check https://c2c.binance.com/en/fiatOrder
|
|
59
|
+
*
|
|
60
|
+
* Weight: 1
|
|
61
|
+
*
|
|
62
|
+
* @summary Get C2C Trade History (USER_DATA)
|
|
63
|
+
* @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.
|
|
64
|
+
* @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}
|
|
65
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
66
|
+
* @memberof C2CApi
|
|
67
|
+
* @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}
|
|
68
|
+
*/
|
|
69
|
+
async getC2CTradeHistory(requestParameters = {}) {
|
|
70
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.getC2CTradeHistory(requestParameters?.tradeType, requestParameters?.startTimestamp, requestParameters?.endTimestamp, requestParameters?.page, requestParameters?.rows, requestParameters?.recvWindow);
|
|
71
|
+
return sendRequest(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
|
|
72
|
+
}
|
|
116
73
|
};
|
|
117
74
|
|
|
118
|
-
|
|
119
|
-
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/rest-api/rest-api.ts
|
|
77
|
+
/**
|
|
78
|
+
* Binance C2C REST API
|
|
79
|
+
*
|
|
80
|
+
* OpenAPI Specification for the Binance C2C REST API
|
|
81
|
+
*
|
|
82
|
+
* The version of the OpenAPI document: 1.0.0
|
|
83
|
+
*
|
|
84
|
+
*
|
|
85
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
86
|
+
* https://openapi-generator.tech
|
|
87
|
+
* Do not edit the class manually.
|
|
88
|
+
*/
|
|
120
89
|
var RestAPI = class {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return this.c2CApi.getC2CTradeHistory(requestParameters);
|
|
167
|
-
}
|
|
90
|
+
constructor(configuration) {
|
|
91
|
+
this.configuration = configuration;
|
|
92
|
+
this.c2CApi = new C2CApi(configuration);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Generic function to send a request.
|
|
96
|
+
* @param endpoint - The API endpoint to call.
|
|
97
|
+
* @param method - HTTP method to use (GET, POST, DELETE, etc.).
|
|
98
|
+
* @param params - Query parameters for the request.
|
|
99
|
+
*
|
|
100
|
+
* @returns A promise resolving to the response data object.
|
|
101
|
+
*/
|
|
102
|
+
sendRequest(endpoint, method, params = {}) {
|
|
103
|
+
return sendRequest(this.configuration, endpoint, method, params, void 0);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Generic function to send a signed request.
|
|
107
|
+
* @param endpoint - The API endpoint to call.
|
|
108
|
+
* @param method - HTTP method to use (GET, POST, DELETE, etc.).
|
|
109
|
+
* @param params - Query parameters for the request.
|
|
110
|
+
*
|
|
111
|
+
* @returns A promise resolving to the response data object.
|
|
112
|
+
*/
|
|
113
|
+
sendSignedRequest(endpoint, method, params = {}) {
|
|
114
|
+
return sendRequest(this.configuration, endpoint, method, params, void 0, { isSigned: true });
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Get C2C Trade History
|
|
118
|
+
*
|
|
119
|
+
* The max interval between startTimestamp and endTimestamp is 30 days.
|
|
120
|
+
* If startTimestamp and endTimestamp are not sent, the recent 30 days' data will be returned.
|
|
121
|
+
* You can only view data from the past 6 months. To see all C2C orders, please check https://c2c.binance.com/en/fiatOrder
|
|
122
|
+
*
|
|
123
|
+
* Weight: 1
|
|
124
|
+
*
|
|
125
|
+
* @summary Get C2C Trade History (USER_DATA)
|
|
126
|
+
* @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.
|
|
127
|
+
*
|
|
128
|
+
* @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>}
|
|
129
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
130
|
+
* @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation}
|
|
131
|
+
*/
|
|
132
|
+
getC2CTradeHistory(requestParameters = {}) {
|
|
133
|
+
return this.c2CApi.getC2CTradeHistory(requestParameters);
|
|
134
|
+
}
|
|
168
135
|
};
|
|
169
136
|
|
|
170
|
-
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/rest-api/index.ts
|
|
139
|
+
var rest_api_exports = /* @__PURE__ */ __export({
|
|
140
|
+
C2CApi: () => C2CApi,
|
|
141
|
+
RestAPI: () => RestAPI
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/c2c.ts
|
|
171
146
|
var C2C = class {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
}
|
|
147
|
+
constructor(config) {
|
|
148
|
+
const userAgent = buildUserAgent(name, version);
|
|
149
|
+
if (config?.configurationRestAPI) {
|
|
150
|
+
const configRestAPI = new ConfigurationRestAPI(config.configurationRestAPI);
|
|
151
|
+
configRestAPI.basePath = configRestAPI.basePath || C2C_REST_API_PROD_URL$1;
|
|
152
|
+
configRestAPI.baseOptions = configRestAPI.baseOptions || {};
|
|
153
|
+
configRestAPI.baseOptions.headers = {
|
|
154
|
+
...configRestAPI.baseOptions.headers || {},
|
|
155
|
+
"User-Agent": userAgent
|
|
156
|
+
};
|
|
157
|
+
this.restAPI = new RestAPI(configRestAPI);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
187
160
|
};
|
|
188
161
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
C2C_REST_API_PROD_URL as C2C_REST_API_PROD_URL2,
|
|
192
|
-
ConnectorClientError,
|
|
193
|
-
RequiredError,
|
|
194
|
-
UnauthorizedError,
|
|
195
|
-
ForbiddenError,
|
|
196
|
-
TooManyRequestsError,
|
|
197
|
-
RateLimitBanError,
|
|
198
|
-
ServerError,
|
|
199
|
-
NetworkError,
|
|
200
|
-
NotFoundError,
|
|
201
|
-
BadRequestError
|
|
202
|
-
} from "@binance/common";
|
|
203
|
-
export {
|
|
204
|
-
BadRequestError,
|
|
205
|
-
C2C,
|
|
206
|
-
rest_api_exports as C2CRestAPI,
|
|
207
|
-
C2C_REST_API_PROD_URL2 as C2C_REST_API_PROD_URL,
|
|
208
|
-
ConnectorClientError,
|
|
209
|
-
ForbiddenError,
|
|
210
|
-
NetworkError,
|
|
211
|
-
NotFoundError,
|
|
212
|
-
RateLimitBanError,
|
|
213
|
-
RequiredError,
|
|
214
|
-
ServerError,
|
|
215
|
-
TooManyRequestsError,
|
|
216
|
-
UnauthorizedError
|
|
217
|
-
};
|
|
162
|
+
//#endregion
|
|
163
|
+
export { BadRequestError, C2C, rest_api_exports as C2CRestAPI, C2C_REST_API_PROD_URL, ConnectorClientError, ForbiddenError, NetworkError, NotFoundError, RateLimitBanError, RequiredError, ServerError, TooManyRequestsError, UnauthorizedError };
|
|
218
164
|
//# sourceMappingURL=index.mjs.map
|
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/c2-capi.ts","../src/rest-api/rest-api.ts","../src/index.ts"],"sourcesContent":["import { buildUserAgent, 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 const userAgent = buildUserAgent(name, version);\n\n if (config?.configurationRestAPI) {\n const configRestAPI = new ConfigurationRestAPI(\n config.configurationRestAPI\n ) as ConfigurationRestAPI & {\n baseOptions: Record<string, unknown>;\n };\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': userAgent,\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\": \"4.0.0\",\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"require\": \"./dist/index.js\",\n \"import\": \"./dist/index.mjs\"\n }\n },\n \"scripts\": {\n \"prepublishOnly\": \"npm run build\",\n \"build\": \"npm run clean && 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 \"json-with-bigint\": \"^3.4.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\": \"2.0.0\",\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 startTimestamp and endTimestamp is 30 days.\n * If startTimestamp and endTimestamp are not sent, the recent 30 days' data will be returned.\n * You can only view data from the past 6 months. To see all C2C orders, please check https://c2c.binance.com/en/fiatOrder\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {string} [tradeType] BUY, SELL\n * @param {number | bigint} [startTimestamp]\n * @param {number | bigint} [endTimestamp]\n * @param {number | bigint} [page] Default 1\n * @param {number | bigint} [rows] default 100, max 100\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getC2CTradeHistory: async (\n tradeType?: string,\n startTimestamp?: number | bigint,\n endTimestamp?: number | bigint,\n page?: number | bigint,\n rows?: number | bigint,\n recvWindow?: number | bigint\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (tradeType !== undefined && tradeType !== null) {\n localVarQueryParameter['tradeType'] = tradeType;\n }\n\n if (startTimestamp !== undefined && startTimestamp !== null) {\n localVarQueryParameter['startTimestamp'] = startTimestamp;\n }\n\n if (endTimestamp !== undefined && endTimestamp !== null) {\n localVarQueryParameter['endTimestamp'] = endTimestamp;\n }\n\n if (page !== undefined && page !== null) {\n localVarQueryParameter['page'] = page;\n }\n\n if (rows !== undefined && rows !== null) {\n localVarQueryParameter['rows'] = rows;\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 startTimestamp and endTimestamp is 30 days.\n * If startTimestamp and endTimestamp are not sent, the recent 30 days' data will be returned.\n * You can only view data from the past 6 months. To see all C2C orders, please check https://c2c.binance.com/en/fiatOrder\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 * BUY, SELL\n * @type {string}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly tradeType?: string;\n\n /**\n *\n * @type {number | bigint}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly startTimestamp?: number | bigint;\n\n /**\n *\n * @type {number | bigint}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly endTimestamp?: number | bigint;\n\n /**\n * Default 1\n * @type {number | bigint}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly page?: number | bigint;\n\n /**\n * default 100, max 100\n * @type {number | bigint}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly rows?: number | bigint;\n\n /**\n *\n * @type {number | bigint}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly recvWindow?: number | bigint;\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 startTimestamp and endTimestamp is 30 days.\n * If startTimestamp and endTimestamp are not sent, the recent 30 days' data will be returned.\n * You can only view data from the past 6 months. To see all C2C orders, please check https://c2c.binance.com/en/fiatOrder\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?.tradeType,\n requestParameters?.startTimestamp,\n requestParameters?.endTimestamp,\n requestParameters?.page,\n requestParameters?.rows,\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 startTimestamp and endTimestamp is 30 days.\n * If startTimestamp and endTimestamp are not sent, the recent 30 days' data will be returned.\n * You can only view data from the past 6 months. To see all C2C orders, please check https://c2c.binance.com/en/fiatOrder\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.\n *\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,gBAAgB,wBAAAA,uBAAsB,6BAA6B;;;ACCxE,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;AAAA,IAoBH,oBAAoB,OAChB,WACA,gBACA,cACA,MACA,MACA,eACuB;AACvB,YAAM,yBAAkD,CAAC;AAE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AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;","names":["ConfigurationRestAPI","sendRequest","sendRequest","ConfigurationRestAPI","C2C_REST_API_PROD_URL"]}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["localVarQueryParameter: Record<string, unknown>","_timeUnit: TimeUnit | undefined","C2C_REST_API_PROD_URL"],"sources":["../package.json","../src/rest-api/modules/c2-capi.ts","../src/rest-api/rest-api.ts","../src/rest-api/index.ts","../src/c2c.ts"],"sourcesContent":["{\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\": \"4.0.2\",\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"require\": \"./dist/index.js\",\n \"import\": \"./dist/index.mjs\"\n }\n },\n \"scripts\": {\n \"prepublishOnly\": \"npm run build\",\n \"build\": \"npm run clean && tsdown\",\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 \"json-with-bigint\": \"^3.4.4\",\n \"prettier\": \"^3.3.3\",\n \"ts-jest\": \"^29.1.1\",\n \"ts-node\": \"^10.9.1\",\n \"tsdown\": \"^0.16.5\",\n \"typescript\": \"^5.7.2\",\n \"typescript-eslint\": \"^8.24.0\"\n },\n \"dependencies\": {\n \"@binance/common\": \"2.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\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 startTimestamp and endTimestamp is 30 days.\n * If startTimestamp and endTimestamp are not sent, the recent 30 days' data will be returned.\n * You can only view data from the past 6 months. To see all C2C orders, please check https://c2c.binance.com/en/fiatOrder\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {string} [tradeType] BUY, SELL\n * @param {number | bigint} [startTimestamp]\n * @param {number | bigint} [endTimestamp]\n * @param {number | bigint} [page] Default 1\n * @param {number | bigint} [rows] default 100, max 100\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getC2CTradeHistory: async (\n tradeType?: string,\n startTimestamp?: number | bigint,\n endTimestamp?: number | bigint,\n page?: number | bigint,\n rows?: number | bigint,\n recvWindow?: number | bigint\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (tradeType !== undefined && tradeType !== null) {\n localVarQueryParameter['tradeType'] = tradeType;\n }\n\n if (startTimestamp !== undefined && startTimestamp !== null) {\n localVarQueryParameter['startTimestamp'] = startTimestamp;\n }\n\n if (endTimestamp !== undefined && endTimestamp !== null) {\n localVarQueryParameter['endTimestamp'] = endTimestamp;\n }\n\n if (page !== undefined && page !== null) {\n localVarQueryParameter['page'] = page;\n }\n\n if (rows !== undefined && rows !== null) {\n localVarQueryParameter['rows'] = rows;\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 startTimestamp and endTimestamp is 30 days.\n * If startTimestamp and endTimestamp are not sent, the recent 30 days' data will be returned.\n * You can only view data from the past 6 months. To see all C2C orders, please check https://c2c.binance.com/en/fiatOrder\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 * BUY, SELL\n * @type {string}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly tradeType?: string;\n\n /**\n *\n * @type {number | bigint}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly startTimestamp?: number | bigint;\n\n /**\n *\n * @type {number | bigint}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly endTimestamp?: number | bigint;\n\n /**\n * Default 1\n * @type {number | bigint}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly page?: number | bigint;\n\n /**\n * default 100, max 100\n * @type {number | bigint}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly rows?: number | bigint;\n\n /**\n *\n * @type {number | bigint}\n * @memberof C2CApiGetC2CTradeHistory\n */\n readonly recvWindow?: number | bigint;\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 startTimestamp and endTimestamp is 30 days.\n * If startTimestamp and endTimestamp are not sent, the recent 30 days' data will be returned.\n * You can only view data from the past 6 months. To see all C2C orders, please check https://c2c.binance.com/en/fiatOrder\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?.tradeType,\n requestParameters?.startTimestamp,\n requestParameters?.endTimestamp,\n requestParameters?.page,\n requestParameters?.rows,\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 startTimestamp and endTimestamp is 30 days.\n * If startTimestamp and endTimestamp are not sent, the recent 30 days' data will be returned.\n * You can only view data from the past 6 months. To see all C2C orders, please check https://c2c.binance.com/en/fiatOrder\n *\n * Weight: 1\n *\n * @summary Get C2C Trade History (USER_DATA)\n * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters.\n *\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","/**\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","import { buildUserAgent, 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 const userAgent = buildUserAgent(name, version);\n\n if (config?.configurationRestAPI) {\n const configRestAPI = new ConfigurationRestAPI(\n config.configurationRestAPI\n ) as ConfigurationRestAPI & {\n baseOptions: Record<string, unknown>;\n };\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': userAgent,\n };\n this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ACA,SAAkC,EAAE,EACT;AAC3B,SAAO,YAAe,KAAK,eAAe,UAAU,QAAQ,QAAQ,OAAU;;;;;;;;;;CAWlF,kBACI,UACA,QACA,SAAkC,EAAE,EACT;AAC3B,SAAO,YAAe,KAAK,eAAe,UAAU,QAAQ,QAAQ,QAAW,EAC3E,UAAU,MACb,CAAC;;;;;;;;;;;;;;;;;;CAmBN,mBACI,oBAA+C,EAAE,EACG;AACpD,SAAO,KAAK,OAAO,mBAAmB,kBAAkB;;;;;;;;;;;;;AE1EhE,IAAa,MAAb,MAAiB;CAGb,YAAY,QAA0B;EAClC,MAAM,YAAY,eAAe,MAAM,QAAQ;AAE/C,MAAI,QAAQ,sBAAsB;GAC9B,MAAM,gBAAgB,IAAI,qBACtB,OAAO,qBACV;AAGD,iBAAc,WAAW,cAAc,YAAYC;AACnD,iBAAc,cAAc,cAAc,eAAe,EAAE;AAC3D,iBAAc,YAAY,UAAU;IAChC,GAAI,cAAc,YAAY,WAAW,EAAE;IAC3C,cAAc;IACjB;AACD,QAAK,UAAU,IAAI,QAAQ,cAAc"}
|
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": "4.0.
|
|
4
|
+
"version": "4.0.2",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"prepublishOnly": "npm run build",
|
|
16
|
-
"build": "npm run clean &&
|
|
16
|
+
"build": "npm run clean && tsdown",
|
|
17
17
|
"typecheck": "tsc --noEmit",
|
|
18
18
|
"clean": "rm -rf dist",
|
|
19
19
|
"test": "npx jest --maxWorkers=4 --bail",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"prettier": "^3.3.3",
|
|
52
52
|
"ts-jest": "^29.1.1",
|
|
53
53
|
"ts-node": "^10.9.1",
|
|
54
|
-
"
|
|
54
|
+
"tsdown": "^0.16.5",
|
|
55
55
|
"typescript": "^5.7.2",
|
|
56
56
|
"typescript-eslint": "^8.24.0"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@binance/common": "2.0.
|
|
59
|
+
"@binance/common": "2.0.1",
|
|
60
60
|
"axios": "^1.7.4"
|
|
61
61
|
}
|
|
62
62
|
}
|