@binance/fiat 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,325 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name2 in all)
4
+ __defProp(target, name2, { get: all[name2], enumerable: true });
5
+ };
6
+
7
+ // src/fiat.ts
8
+ import { platform, arch } from "os";
9
+ import { ConfigurationRestAPI as ConfigurationRestAPI3, FIAT_REST_API_PROD_URL } from "@binance/common";
10
+
11
+ // package.json
12
+ var name = "@binance/fiat";
13
+ var version = "1.0.0";
14
+
15
+ // src/rest-api/index.ts
16
+ var rest_api_exports = {};
17
+ __export(rest_api_exports, {
18
+ FiatApi: () => FiatApi,
19
+ RestAPI: () => RestAPI
20
+ });
21
+
22
+ // src/rest-api/modules/fiat-api.ts
23
+ import {
24
+ assertParamExists,
25
+ sendRequest
26
+ } from "@binance/common";
27
+ var FiatApiAxiosParamCreator = function(configuration) {
28
+ return {
29
+ /**
30
+ * Get Fiat Deposit/Withdraw History
31
+ *
32
+ * If beginTime and endTime are not sent, the recent 30-day data will be returned.
33
+ *
34
+ * Weight: 90000
35
+ *
36
+ * @summary Get Fiat Deposit/Withdraw History (USER_DATA)
37
+ * @param {string} transactionType 0-buy,1-sell
38
+ * @param {number} [beginTime]
39
+ * @param {number} [endTime]
40
+ * @param {number} [page] default 1
41
+ * @param {number} [rows] default 100, max 500
42
+ * @param {number} [recvWindow]
43
+ *
44
+ * @throws {RequiredError}
45
+ */
46
+ getFiatDepositWithdrawHistory: async (transactionType, beginTime, endTime, page, rows, recvWindow) => {
47
+ assertParamExists("getFiatDepositWithdrawHistory", "transactionType", transactionType);
48
+ const localVarQueryParameter = {};
49
+ if (transactionType !== void 0 && transactionType !== null) {
50
+ localVarQueryParameter["transactionType"] = transactionType;
51
+ }
52
+ if (beginTime !== void 0 && beginTime !== null) {
53
+ localVarQueryParameter["beginTime"] = beginTime;
54
+ }
55
+ if (endTime !== void 0 && endTime !== null) {
56
+ localVarQueryParameter["endTime"] = endTime;
57
+ }
58
+ if (page !== void 0 && page !== null) {
59
+ localVarQueryParameter["page"] = page;
60
+ }
61
+ if (rows !== void 0 && rows !== null) {
62
+ localVarQueryParameter["rows"] = rows;
63
+ }
64
+ if (recvWindow !== void 0 && recvWindow !== null) {
65
+ localVarQueryParameter["recvWindow"] = recvWindow;
66
+ }
67
+ let _timeUnit;
68
+ if ("timeUnit" in configuration)
69
+ _timeUnit = configuration.timeUnit;
70
+ return {
71
+ endpoint: "/sapi/v1/fiat/orders",
72
+ method: "GET",
73
+ params: localVarQueryParameter,
74
+ timeUnit: _timeUnit
75
+ };
76
+ },
77
+ /**
78
+ * Get Fiat Deposit/Withdraw History
79
+ *
80
+ * If beginTime and endTime are not sent, the recent 30-day data will be returned.
81
+ * paymentMethod: Only when requesting payments history for buy (transactionType=0), response contains paymentMethod representing the way of purchase. Now we have:
82
+ * Cash Balance
83
+ * Credit Card
84
+ * Online Banking
85
+ * Bank Transfer
86
+ *
87
+ * Weight: 1
88
+ *
89
+ * @summary Get Fiat Payments History (USER_DATA)
90
+ * @param {string} transactionType 0-buy,1-sell
91
+ * @param {number} [beginTime]
92
+ * @param {number} [endTime]
93
+ * @param {number} [page] default 1
94
+ * @param {number} [rows] default 100, max 500
95
+ * @param {number} [recvWindow]
96
+ *
97
+ * @throws {RequiredError}
98
+ */
99
+ getFiatPaymentsHistory: async (transactionType, beginTime, endTime, page, rows, recvWindow) => {
100
+ assertParamExists("getFiatPaymentsHistory", "transactionType", transactionType);
101
+ const localVarQueryParameter = {};
102
+ if (transactionType !== void 0 && transactionType !== null) {
103
+ localVarQueryParameter["transactionType"] = transactionType;
104
+ }
105
+ if (beginTime !== void 0 && beginTime !== null) {
106
+ localVarQueryParameter["beginTime"] = beginTime;
107
+ }
108
+ if (endTime !== void 0 && endTime !== null) {
109
+ localVarQueryParameter["endTime"] = endTime;
110
+ }
111
+ if (page !== void 0 && page !== null) {
112
+ localVarQueryParameter["page"] = page;
113
+ }
114
+ if (rows !== void 0 && rows !== null) {
115
+ localVarQueryParameter["rows"] = rows;
116
+ }
117
+ if (recvWindow !== void 0 && recvWindow !== null) {
118
+ localVarQueryParameter["recvWindow"] = recvWindow;
119
+ }
120
+ let _timeUnit;
121
+ if ("timeUnit" in configuration)
122
+ _timeUnit = configuration.timeUnit;
123
+ return {
124
+ endpoint: "/sapi/v1/fiat/payments",
125
+ method: "GET",
126
+ params: localVarQueryParameter,
127
+ timeUnit: _timeUnit
128
+ };
129
+ }
130
+ };
131
+ };
132
+ var FiatApi = class {
133
+ constructor(configuration) {
134
+ this.configuration = configuration;
135
+ this.localVarAxiosParamCreator = FiatApiAxiosParamCreator(configuration);
136
+ }
137
+ /**
138
+ * Get Fiat Deposit/Withdraw History
139
+ *
140
+ * If beginTime and endTime are not sent, the recent 30-day data will be returned.
141
+ *
142
+ * Weight: 90000
143
+ *
144
+ * @summary Get Fiat Deposit/Withdraw History (USER_DATA)
145
+ * @param {GetFiatDepositWithdrawHistoryRequest} requestParameters Request parameters.
146
+ * @returns {Promise<RestApiResponse<GetFiatDepositWithdrawHistoryResponse>>}
147
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
148
+ * @memberof FiatApi
149
+ * @see {@link https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Deposit-Withdraw-History Binance API Documentation}
150
+ */
151
+ async getFiatDepositWithdrawHistory(requestParameters) {
152
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getFiatDepositWithdrawHistory(
153
+ requestParameters?.transactionType,
154
+ requestParameters?.beginTime,
155
+ requestParameters?.endTime,
156
+ requestParameters?.page,
157
+ requestParameters?.rows,
158
+ requestParameters?.recvWindow
159
+ );
160
+ return sendRequest(
161
+ this.configuration,
162
+ localVarAxiosArgs.endpoint,
163
+ localVarAxiosArgs.method,
164
+ localVarAxiosArgs.params,
165
+ localVarAxiosArgs?.timeUnit,
166
+ { isSigned: true }
167
+ );
168
+ }
169
+ /**
170
+ * Get Fiat Deposit/Withdraw History
171
+ *
172
+ * If beginTime and endTime are not sent, the recent 30-day data will be returned.
173
+ * paymentMethod: Only when requesting payments history for buy (transactionType=0), response contains paymentMethod representing the way of purchase. Now we have:
174
+ * Cash Balance
175
+ * Credit Card
176
+ * Online Banking
177
+ * Bank Transfer
178
+ *
179
+ * Weight: 1
180
+ *
181
+ * @summary Get Fiat Payments History (USER_DATA)
182
+ * @param {GetFiatPaymentsHistoryRequest} requestParameters Request parameters.
183
+ * @returns {Promise<RestApiResponse<GetFiatPaymentsHistoryResponse>>}
184
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
185
+ * @memberof FiatApi
186
+ * @see {@link https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Payments-History Binance API Documentation}
187
+ */
188
+ async getFiatPaymentsHistory(requestParameters) {
189
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getFiatPaymentsHistory(
190
+ requestParameters?.transactionType,
191
+ requestParameters?.beginTime,
192
+ requestParameters?.endTime,
193
+ requestParameters?.page,
194
+ requestParameters?.rows,
195
+ requestParameters?.recvWindow
196
+ );
197
+ return sendRequest(
198
+ this.configuration,
199
+ localVarAxiosArgs.endpoint,
200
+ localVarAxiosArgs.method,
201
+ localVarAxiosArgs.params,
202
+ localVarAxiosArgs?.timeUnit,
203
+ { isSigned: true }
204
+ );
205
+ }
206
+ };
207
+
208
+ // src/rest-api/rest-api.ts
209
+ import { sendRequest as sendRequest2 } from "@binance/common";
210
+ var RestAPI = class {
211
+ constructor(configuration) {
212
+ this.configuration = configuration;
213
+ this.fiatApi = new FiatApi(configuration);
214
+ }
215
+ /**
216
+ * Generic function to send a request.
217
+ * @param endpoint - The API endpoint to call.
218
+ * @param method - HTTP method to use (GET, POST, DELETE, etc.).
219
+ * @param params - Query parameters for the request.
220
+ *
221
+ * @returns A promise resolving to the response data object.
222
+ */
223
+ sendRequest(endpoint, method, params = {}) {
224
+ return sendRequest2(this.configuration, endpoint, method, params, void 0);
225
+ }
226
+ /**
227
+ * Generic function to send a signed request.
228
+ * @param endpoint - The API endpoint to call.
229
+ * @param method - HTTP method to use (GET, POST, DELETE, etc.).
230
+ * @param params - Query parameters for the request.
231
+ *
232
+ * @returns A promise resolving to the response data object.
233
+ */
234
+ sendSignedRequest(endpoint, method, params = {}) {
235
+ return sendRequest2(this.configuration, endpoint, method, params, void 0, {
236
+ isSigned: true
237
+ });
238
+ }
239
+ /**
240
+ * Get Fiat Deposit/Withdraw History
241
+ *
242
+ * If beginTime and endTime are not sent, the recent 30-day data will be returned.
243
+ *
244
+ * Weight: 90000
245
+ *
246
+ * @summary Get Fiat Deposit/Withdraw History (USER_DATA)
247
+ * @param {GetFiatDepositWithdrawHistoryRequest} requestParameters Request parameters.
248
+ * @returns {Promise<RestApiResponse<GetFiatDepositWithdrawHistoryResponse>>}
249
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
250
+ * @see {@link https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Deposit-Withdraw-History Binance API Documentation}
251
+ */
252
+ getFiatDepositWithdrawHistory(requestParameters) {
253
+ return this.fiatApi.getFiatDepositWithdrawHistory(requestParameters);
254
+ }
255
+ /**
256
+ * Get Fiat Deposit/Withdraw History
257
+ *
258
+ * If beginTime and endTime are not sent, the recent 30-day data will be returned.
259
+ * paymentMethod: Only when requesting payments history for buy (transactionType=0), response contains paymentMethod representing the way of purchase. Now we have:
260
+ * Cash Balance
261
+ * Credit Card
262
+ * Online Banking
263
+ * Bank Transfer
264
+ *
265
+ * Weight: 1
266
+ *
267
+ * @summary Get Fiat Payments History (USER_DATA)
268
+ * @param {GetFiatPaymentsHistoryRequest} requestParameters Request parameters.
269
+ * @returns {Promise<RestApiResponse<GetFiatPaymentsHistoryResponse>>}
270
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
271
+ * @see {@link https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Payments-History Binance API Documentation}
272
+ */
273
+ getFiatPaymentsHistory(requestParameters) {
274
+ return this.fiatApi.getFiatPaymentsHistory(requestParameters);
275
+ }
276
+ };
277
+
278
+ // src/fiat.ts
279
+ var Fiat = class {
280
+ constructor(config) {
281
+ if (config?.configurationRestAPI) {
282
+ const configRestAPI = new ConfigurationRestAPI3(config.configurationRestAPI);
283
+ configRestAPI.basePath = configRestAPI.basePath || FIAT_REST_API_PROD_URL;
284
+ configRestAPI.baseOptions = configRestAPI.baseOptions || {};
285
+ configRestAPI.baseOptions.headers = {
286
+ ...configRestAPI.baseOptions.headers || {},
287
+ "User-Agent": `${name}/${version} (Node.js/${process.version}; ${platform()}; ${arch()})`
288
+ };
289
+ this.restAPI = new RestAPI(configRestAPI);
290
+ }
291
+ }
292
+ };
293
+
294
+ // src/index.ts
295
+ import {
296
+ FIAT_REST_API_PROD_URL as FIAT_REST_API_PROD_URL2,
297
+ FIAT_REST_API_TESTNET_URL,
298
+ ConnectorClientError,
299
+ RequiredError,
300
+ UnauthorizedError,
301
+ ForbiddenError,
302
+ TooManyRequestsError,
303
+ RateLimitBanError,
304
+ ServerError,
305
+ NetworkError,
306
+ NotFoundError,
307
+ BadRequestError
308
+ } from "@binance/common";
309
+ export {
310
+ BadRequestError,
311
+ ConnectorClientError,
312
+ FIAT_REST_API_PROD_URL2 as FIAT_REST_API_PROD_URL,
313
+ FIAT_REST_API_TESTNET_URL,
314
+ Fiat,
315
+ rest_api_exports as FiatRestAPI,
316
+ ForbiddenError,
317
+ NetworkError,
318
+ NotFoundError,
319
+ RateLimitBanError,
320
+ RequiredError,
321
+ ServerError,
322
+ TooManyRequestsError,
323
+ UnauthorizedError
324
+ };
325
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/fiat.ts","../package.json","../src/rest-api/index.ts","../src/rest-api/modules/fiat-api.ts","../src/rest-api/rest-api.ts","../src/index.ts"],"sourcesContent":["import { platform, arch } from 'os';\nimport { ConfigurationRestAPI, FIAT_REST_API_PROD_URL } from '@binance/common';\nimport { name, version } from '../package.json';\nimport { RestAPI } from './rest-api';\n\nexport interface ConfigurationFiat {\n configurationRestAPI?: ConfigurationRestAPI;\n}\n\nexport class Fiat {\n public restAPI!: RestAPI;\n\n constructor(config: ConfigurationFiat) {\n if (config?.configurationRestAPI) {\n const configRestAPI = new ConfigurationRestAPI(config.configurationRestAPI);\n configRestAPI.basePath = configRestAPI.basePath || FIAT_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/fiat\",\n \"description\": \"Official Binance Fiat Connector - A lightweight library that provides a convenient interface to Binance's Fiat 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 \"Fiat\",\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 Fiat REST API\n *\n * OpenAPI Specification for the Binance Public Fiat 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 Fiat REST API\n *\n * OpenAPI Specification for the Binance Public Fiat 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 assertParamExists,\n sendRequest,\n type RequestArgs,\n} from '@binance/common';\nimport type {\n GetFiatDepositWithdrawHistoryResponse,\n GetFiatPaymentsHistoryResponse,\n} from '../types';\n\n/**\n * FiatApi - axios parameter creator\n */\nconst FiatApiAxiosParamCreator = function (configuration: ConfigurationRestAPI) {\n return {\n /**\n * Get Fiat Deposit/Withdraw History\n *\n * If beginTime and endTime are not sent, the recent 30-day data will be returned.\n *\n * Weight: 90000\n *\n * @summary Get Fiat Deposit/Withdraw History (USER_DATA)\n * @param {string} transactionType 0-buy,1-sell\n * @param {number} [beginTime]\n * @param {number} [endTime]\n * @param {number} [page] default 1\n * @param {number} [rows] default 100, max 500\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getFiatDepositWithdrawHistory: async (\n transactionType: string,\n beginTime?: number,\n endTime?: number,\n page?: number,\n rows?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'transactionType' is not null or undefined\n assertParamExists('getFiatDepositWithdrawHistory', 'transactionType', transactionType);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (transactionType !== undefined && transactionType !== null) {\n localVarQueryParameter['transactionType'] = transactionType;\n }\n\n if (beginTime !== undefined && beginTime !== null) {\n localVarQueryParameter['beginTime'] = beginTime;\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 (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/fiat/orders',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get Fiat Deposit/Withdraw History\n *\n * If beginTime and endTime are not sent, the recent 30-day data will be returned.\n * paymentMethod: Only when requesting payments history for buy (transactionType=0), response contains paymentMethod representing the way of purchase. Now we have:\n * Cash Balance\n * Credit Card\n * Online Banking\n * Bank Transfer\n *\n * Weight: 1\n *\n * @summary Get Fiat Payments History (USER_DATA)\n * @param {string} transactionType 0-buy,1-sell\n * @param {number} [beginTime]\n * @param {number} [endTime]\n * @param {number} [page] default 1\n * @param {number} [rows] default 100, max 500\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getFiatPaymentsHistory: async (\n transactionType: string,\n beginTime?: number,\n endTime?: number,\n page?: number,\n rows?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'transactionType' is not null or undefined\n assertParamExists('getFiatPaymentsHistory', 'transactionType', transactionType);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (transactionType !== undefined && transactionType !== null) {\n localVarQueryParameter['transactionType'] = transactionType;\n }\n\n if (beginTime !== undefined && beginTime !== null) {\n localVarQueryParameter['beginTime'] = beginTime;\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 (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/fiat/payments',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n };\n};\n\n/**\n * FiatApi - interface\n * @interface FiatApi\n */\nexport interface FiatApiInterface {\n /**\n * Get Fiat Deposit/Withdraw History\n *\n * If beginTime and endTime are not sent, the recent 30-day data will be returned.\n *\n * Weight: 90000\n *\n * @summary Get Fiat Deposit/Withdraw History (USER_DATA)\n * @param {GetFiatDepositWithdrawHistoryRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof FiatApiInterface\n */\n getFiatDepositWithdrawHistory(\n requestParameters: GetFiatDepositWithdrawHistoryRequest\n ): Promise<RestApiResponse<GetFiatDepositWithdrawHistoryResponse>>;\n /**\n * Get Fiat Deposit/Withdraw History\n *\n * If beginTime and endTime are not sent, the recent 30-day data will be returned.\n * paymentMethod: Only when requesting payments history for buy (transactionType=0), response contains paymentMethod representing the way of purchase. Now we have:\n * Cash Balance\n * Credit Card\n * Online Banking\n * Bank Transfer\n *\n * Weight: 1\n *\n * @summary Get Fiat Payments History (USER_DATA)\n * @param {GetFiatPaymentsHistoryRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof FiatApiInterface\n */\n getFiatPaymentsHistory(\n requestParameters: GetFiatPaymentsHistoryRequest\n ): Promise<RestApiResponse<GetFiatPaymentsHistoryResponse>>;\n}\n\n/**\n * Request parameters for getFiatDepositWithdrawHistory operation in FiatApi.\n * @interface GetFiatDepositWithdrawHistoryRequest\n */\nexport interface GetFiatDepositWithdrawHistoryRequest {\n /**\n * 0-buy,1-sell\n * @type {string}\n * @memberof FiatApiGetFiatDepositWithdrawHistory\n */\n readonly transactionType: string;\n\n /**\n *\n * @type {number}\n * @memberof FiatApiGetFiatDepositWithdrawHistory\n */\n readonly beginTime?: number;\n\n /**\n *\n * @type {number}\n * @memberof FiatApiGetFiatDepositWithdrawHistory\n */\n readonly endTime?: number;\n\n /**\n * default 1\n * @type {number}\n * @memberof FiatApiGetFiatDepositWithdrawHistory\n */\n readonly page?: number;\n\n /**\n * default 100, max 500\n * @type {number}\n * @memberof FiatApiGetFiatDepositWithdrawHistory\n */\n readonly rows?: number;\n\n /**\n *\n * @type {number}\n * @memberof FiatApiGetFiatDepositWithdrawHistory\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getFiatPaymentsHistory operation in FiatApi.\n * @interface GetFiatPaymentsHistoryRequest\n */\nexport interface GetFiatPaymentsHistoryRequest {\n /**\n * 0-buy,1-sell\n * @type {string}\n * @memberof FiatApiGetFiatPaymentsHistory\n */\n readonly transactionType: string;\n\n /**\n *\n * @type {number}\n * @memberof FiatApiGetFiatPaymentsHistory\n */\n readonly beginTime?: number;\n\n /**\n *\n * @type {number}\n * @memberof FiatApiGetFiatPaymentsHistory\n */\n readonly endTime?: number;\n\n /**\n * default 1\n * @type {number}\n * @memberof FiatApiGetFiatPaymentsHistory\n */\n readonly page?: number;\n\n /**\n * default 100, max 500\n * @type {number}\n * @memberof FiatApiGetFiatPaymentsHistory\n */\n readonly rows?: number;\n\n /**\n *\n * @type {number}\n * @memberof FiatApiGetFiatPaymentsHistory\n */\n readonly recvWindow?: number;\n}\n\n/**\n * FiatApi - object-oriented interface\n * @class FiatApi\n */\nexport class FiatApi implements FiatApiInterface {\n private readonly configuration: ConfigurationRestAPI;\n private localVarAxiosParamCreator;\n\n constructor(configuration: ConfigurationRestAPI) {\n this.configuration = configuration;\n this.localVarAxiosParamCreator = FiatApiAxiosParamCreator(configuration);\n }\n\n /**\n * Get Fiat Deposit/Withdraw History\n *\n * If beginTime and endTime are not sent, the recent 30-day data will be returned.\n *\n * Weight: 90000\n *\n * @summary Get Fiat Deposit/Withdraw History (USER_DATA)\n * @param {GetFiatDepositWithdrawHistoryRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetFiatDepositWithdrawHistoryResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof FiatApi\n * @see {@link https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Deposit-Withdraw-History Binance API Documentation}\n */\n public async getFiatDepositWithdrawHistory(\n requestParameters: GetFiatDepositWithdrawHistoryRequest\n ): Promise<RestApiResponse<GetFiatDepositWithdrawHistoryResponse>> {\n const localVarAxiosArgs =\n await this.localVarAxiosParamCreator.getFiatDepositWithdrawHistory(\n requestParameters?.transactionType,\n requestParameters?.beginTime,\n requestParameters?.endTime,\n requestParameters?.page,\n requestParameters?.rows,\n requestParameters?.recvWindow\n );\n return sendRequest<GetFiatDepositWithdrawHistoryResponse>(\n this.configuration,\n localVarAxiosArgs.endpoint,\n localVarAxiosArgs.method,\n localVarAxiosArgs.params,\n localVarAxiosArgs?.timeUnit,\n { isSigned: true }\n );\n }\n\n /**\n * Get Fiat Deposit/Withdraw History\n *\n * If beginTime and endTime are not sent, the recent 30-day data will be returned.\n * paymentMethod: Only when requesting payments history for buy (transactionType=0), response contains paymentMethod representing the way of purchase. Now we have:\n * Cash Balance\n * Credit Card\n * Online Banking\n * Bank Transfer\n *\n * Weight: 1\n *\n * @summary Get Fiat Payments History (USER_DATA)\n * @param {GetFiatPaymentsHistoryRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetFiatPaymentsHistoryResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof FiatApi\n * @see {@link https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Payments-History Binance API Documentation}\n */\n public async getFiatPaymentsHistory(\n requestParameters: GetFiatPaymentsHistoryRequest\n ): Promise<RestApiResponse<GetFiatPaymentsHistoryResponse>> {\n const localVarAxiosArgs = await this.localVarAxiosParamCreator.getFiatPaymentsHistory(\n requestParameters?.transactionType,\n requestParameters?.beginTime,\n requestParameters?.endTime,\n requestParameters?.page,\n requestParameters?.rows,\n requestParameters?.recvWindow\n );\n return sendRequest<GetFiatPaymentsHistoryResponse>(\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 Fiat REST API\n *\n * OpenAPI Specification for the Binance Public Fiat 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 { FiatApi } from './modules/fiat-api';\n\nimport type {\n GetFiatDepositWithdrawHistoryRequest,\n GetFiatPaymentsHistoryRequest,\n} from './modules/fiat-api';\n\nimport type {\n GetFiatDepositWithdrawHistoryResponse,\n GetFiatPaymentsHistoryResponse,\n} from './types';\n\nexport class RestAPI {\n private configuration: ConfigurationRestAPI;\n private fiatApi: FiatApi;\n\n constructor(configuration: ConfigurationRestAPI) {\n this.configuration = configuration;\n this.fiatApi = new FiatApi(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 Fiat Deposit/Withdraw History\n *\n * If beginTime and endTime are not sent, the recent 30-day data will be returned.\n *\n * Weight: 90000\n *\n * @summary Get Fiat Deposit/Withdraw History (USER_DATA)\n * @param {GetFiatDepositWithdrawHistoryRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetFiatDepositWithdrawHistoryResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @see {@link https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Deposit-Withdraw-History Binance API Documentation}\n */\n getFiatDepositWithdrawHistory(\n requestParameters: GetFiatDepositWithdrawHistoryRequest\n ): Promise<RestApiResponse<GetFiatDepositWithdrawHistoryResponse>> {\n return this.fiatApi.getFiatDepositWithdrawHistory(requestParameters);\n }\n\n /**\n * Get Fiat Deposit/Withdraw History\n *\n * If beginTime and endTime are not sent, the recent 30-day data will be returned.\n * paymentMethod: Only when requesting payments history for buy (transactionType=0), response contains paymentMethod representing the way of purchase. Now we have:\n * Cash Balance\n * Credit Card\n * Online Banking\n * Bank Transfer\n *\n * Weight: 1\n *\n * @summary Get Fiat Payments History (USER_DATA)\n * @param {GetFiatPaymentsHistoryRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetFiatPaymentsHistoryResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @see {@link https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Payments-History Binance API Documentation}\n */\n getFiatPaymentsHistory(\n requestParameters: GetFiatPaymentsHistoryRequest\n ): Promise<RestApiResponse<GetFiatPaymentsHistoryResponse>> {\n return this.fiatApi.getFiatPaymentsHistory(requestParameters);\n }\n}\n","export { Fiat, ConfigurationFiat } from './fiat';\nexport * as FiatRestAPI from './rest-api';\n\nexport {\n FIAT_REST_API_PROD_URL,\n FIAT_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,8BAA8B;;;ACAzD,WAAQ;AAER,cAAW;;;ACHf;AAAA;AAAA;AAAA;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EAoBA,uBACI,mBACwD;AACxD,WAAO,KAAK,QAAQ,uBAAuB,iBAAiB;AAAA,EAChE;AACJ;;;AJtGO,IAAM,OAAN,MAAW;AAAA,EAGd,YAAY,QAA2B;AACnC,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,0BAAAC;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","FIAT_REST_API_PROD_URL"]}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@binance/fiat",
3
+ "description": "Official Binance Fiat Connector - A lightweight library that provides a convenient interface to Binance's Fiat REST API.",
4
+ "version": "1.0.0",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "scripts": {
9
+ "prepublishOnly": "npm run build",
10
+ "build": "tsup",
11
+ "typecheck": "tsc --noEmit",
12
+ "clean": "rm -rf dist",
13
+ "test": "npx jest --maxWorkers=4 --bail",
14
+ "test:watch": "npx jest --watch",
15
+ "format": "npx prettier --ignore-path .prettierignore --write .",
16
+ "lint": "npx eslint '**/*.ts' --fix"
17
+ },
18
+ "keywords": [
19
+ "Binance",
20
+ "API",
21
+ "Fiat",
22
+ "Connector",
23
+ "REST",
24
+ "Trading"
25
+ ],
26
+ "author": "Binance",
27
+ "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/binance/binance-connector-js.git"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/binance/binance-connector-js/issues"
34
+ },
35
+ "homepage": "https://github.com/binance/binance-connector-js#readme",
36
+ "files": [
37
+ "dist"
38
+ ],
39
+ "devDependencies": {
40
+ "@types/jest": "^29.5.4",
41
+ "@types/node": "^20.17.24",
42
+ "eslint": "8.57.0",
43
+ "jest": "^29.6.4",
44
+ "prettier": "^3.3.3",
45
+ "ts-jest": "^29.1.1",
46
+ "ts-node": "^10.9.1",
47
+ "tsup": "^7.2.0",
48
+ "typescript": "^5.7.2",
49
+ "typescript-eslint": "^8.24.0"
50
+ },
51
+ "dependencies": {
52
+ "@binance/common": "1.0.0",
53
+ "axios": "^1.7.4"
54
+ }
55
+ }