@binance/giftcard 4.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.js ADDED
@@ -0,0 +1,534 @@
1
+ //#region rolldown:runtime
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (all) => {
4
+ let target = {};
5
+ for (var name$1 in all) __defProp(target, name$1, {
6
+ get: all[name$1],
7
+ enumerable: true
8
+ });
9
+ return target;
10
+ };
11
+
12
+ //#endregion
13
+ let __binance_common = require("@binance/common");
14
+
15
+ //#region package.json
16
+ var name = "@binance/giftcard";
17
+ var version = "4.0.0";
18
+
19
+ //#endregion
20
+ //#region src/rest-api/modules/market-data-api.ts
21
+ /**
22
+ * Binance Gift Card REST API
23
+ *
24
+ * OpenAPI Specification for the Binance Gift Card REST API
25
+ *
26
+ * The version of the OpenAPI document: 1.0.0
27
+ *
28
+ *
29
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
30
+ * https://openapi-generator.tech
31
+ * Do not edit the class manually.
32
+ */
33
+ /**
34
+ * MarketDataApi - axios parameter creator
35
+ */
36
+ const MarketDataApiAxiosParamCreator = function(configuration) {
37
+ return {
38
+ createADualTokenGiftCard: async (baseToken, faceToken, baseTokenAmount, recvWindow) => {
39
+ (0, __binance_common.assertParamExists)("createADualTokenGiftCard", "baseToken", baseToken);
40
+ (0, __binance_common.assertParamExists)("createADualTokenGiftCard", "faceToken", faceToken);
41
+ (0, __binance_common.assertParamExists)("createADualTokenGiftCard", "baseTokenAmount", baseTokenAmount);
42
+ const localVarQueryParameter = {};
43
+ if (baseToken !== void 0 && baseToken !== null) localVarQueryParameter["baseToken"] = baseToken;
44
+ if (faceToken !== void 0 && faceToken !== null) localVarQueryParameter["faceToken"] = faceToken;
45
+ if (baseTokenAmount !== void 0 && baseTokenAmount !== null) localVarQueryParameter["baseTokenAmount"] = baseTokenAmount;
46
+ if (recvWindow !== void 0 && recvWindow !== null) localVarQueryParameter["recvWindow"] = recvWindow;
47
+ let _timeUnit;
48
+ if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
49
+ return {
50
+ endpoint: "/sapi/v1/giftcard/buyCode",
51
+ method: "POST",
52
+ params: localVarQueryParameter,
53
+ timeUnit: _timeUnit
54
+ };
55
+ },
56
+ createASingleTokenGiftCard: async (token, amount, recvWindow) => {
57
+ (0, __binance_common.assertParamExists)("createASingleTokenGiftCard", "token", token);
58
+ (0, __binance_common.assertParamExists)("createASingleTokenGiftCard", "amount", amount);
59
+ const localVarQueryParameter = {};
60
+ if (token !== void 0 && token !== null) localVarQueryParameter["token"] = token;
61
+ if (amount !== void 0 && amount !== null) localVarQueryParameter["amount"] = amount;
62
+ if (recvWindow !== void 0 && recvWindow !== null) localVarQueryParameter["recvWindow"] = recvWindow;
63
+ let _timeUnit;
64
+ if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
65
+ return {
66
+ endpoint: "/sapi/v1/giftcard/createCode",
67
+ method: "POST",
68
+ params: localVarQueryParameter,
69
+ timeUnit: _timeUnit
70
+ };
71
+ },
72
+ fetchRsaPublicKey: async (recvWindow) => {
73
+ const localVarQueryParameter = {};
74
+ if (recvWindow !== void 0 && recvWindow !== null) localVarQueryParameter["recvWindow"] = recvWindow;
75
+ let _timeUnit;
76
+ if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
77
+ return {
78
+ endpoint: "/sapi/v1/giftcard/cryptography/rsa-public-key",
79
+ method: "GET",
80
+ params: localVarQueryParameter,
81
+ timeUnit: _timeUnit
82
+ };
83
+ },
84
+ fetchTokenLimit: async (baseToken, recvWindow) => {
85
+ (0, __binance_common.assertParamExists)("fetchTokenLimit", "baseToken", baseToken);
86
+ const localVarQueryParameter = {};
87
+ if (baseToken !== void 0 && baseToken !== null) localVarQueryParameter["baseToken"] = baseToken;
88
+ if (recvWindow !== void 0 && recvWindow !== null) localVarQueryParameter["recvWindow"] = recvWindow;
89
+ let _timeUnit;
90
+ if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
91
+ return {
92
+ endpoint: "/sapi/v1/giftcard/buyCode/token-limit",
93
+ method: "GET",
94
+ params: localVarQueryParameter,
95
+ timeUnit: _timeUnit
96
+ };
97
+ },
98
+ redeemABinanceGiftCard: async (code, externalUid, recvWindow) => {
99
+ (0, __binance_common.assertParamExists)("redeemABinanceGiftCard", "code", code);
100
+ const localVarQueryParameter = {};
101
+ if (code !== void 0 && code !== null) localVarQueryParameter["code"] = code;
102
+ if (externalUid !== void 0 && externalUid !== null) localVarQueryParameter["externalUid"] = externalUid;
103
+ if (recvWindow !== void 0 && recvWindow !== null) localVarQueryParameter["recvWindow"] = recvWindow;
104
+ let _timeUnit;
105
+ if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
106
+ return {
107
+ endpoint: "/sapi/v1/giftcard/redeemCode",
108
+ method: "POST",
109
+ params: localVarQueryParameter,
110
+ timeUnit: _timeUnit
111
+ };
112
+ },
113
+ verifyBinanceGiftCardByGiftCardNumber: async (referenceNo, recvWindow) => {
114
+ (0, __binance_common.assertParamExists)("verifyBinanceGiftCardByGiftCardNumber", "referenceNo", referenceNo);
115
+ const localVarQueryParameter = {};
116
+ if (referenceNo !== void 0 && referenceNo !== null) localVarQueryParameter["referenceNo"] = referenceNo;
117
+ if (recvWindow !== void 0 && recvWindow !== null) localVarQueryParameter["recvWindow"] = recvWindow;
118
+ let _timeUnit;
119
+ if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
120
+ return {
121
+ endpoint: "/sapi/v1/giftcard/verify",
122
+ method: "GET",
123
+ params: localVarQueryParameter,
124
+ timeUnit: _timeUnit
125
+ };
126
+ }
127
+ };
128
+ };
129
+ /**
130
+ * MarketDataApi - object-oriented interface
131
+ * @class MarketDataApi
132
+ */
133
+ var MarketDataApi = class {
134
+ constructor(configuration) {
135
+ this.configuration = configuration;
136
+ this.localVarAxiosParamCreator = MarketDataApiAxiosParamCreator(configuration);
137
+ }
138
+ /**
139
+ * * This API is for creating a dual-token ( stablecoin-denominated) Binance Gift Card. You may create a gift card using USDT as baseToken, that is redeemable to another designated token (faceToken). For example, you can create a fixed-value BTC gift card and pay with 100 USDT plus minting fee. This gift card can keep the value fixed at 100 USDT before redemption, and will be redeemable to BTC equivalent to 100 USDT upon redemption.
140
+ * Once successfully created, the amount of baseToken (e.g. USDT) in the fixed-value gift card along with the fee would be deducted from your funding wallet.
141
+ *
142
+ *
143
+ * To get started with, please make sure:
144
+ * You have a Binance account
145
+ * You have passed KYB
146
+ * You have a sufficient balance(Gift Card amount and fee amount) in your Binance funding wallet
147
+ * You need Enable Withdrawals for the API Key which requests this endpoint.
148
+ *
149
+ * Weight: 1
150
+ *
151
+ * @summary Create a dual-token gift card(fixed value, discount feature)(TRADE)
152
+ * @param {CreateADualTokenGiftCardRequest} requestParameters Request parameters.
153
+ * @returns {Promise<RestApiResponse<CreateADualTokenGiftCardResponse>>}
154
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
155
+ * @memberof MarketDataApi
156
+ * @see {@link https://developers.binance.com/docs/gift_card/market-data/Create-a-dual-token-gift-card Binance API Documentation}
157
+ */
158
+ async createADualTokenGiftCard(requestParameters) {
159
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.createADualTokenGiftCard(requestParameters?.baseToken, requestParameters?.faceToken, requestParameters?.baseTokenAmount, requestParameters?.recvWindow);
160
+ return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
161
+ }
162
+ /**
163
+ * This API is for creating a Binance Gift Card.
164
+ *
165
+ * To get started with, please make sure:
166
+ *
167
+ * You have a Binance account
168
+ * You have passed KYB
169
+ * You have a sufficient balance(Gift Card amount and fee amount) in your Binance funding wallet
170
+ * You need `Enable Withdrawals` for the API Key which requests this endpoint.
171
+ *
172
+ * Weight: 1
173
+ *
174
+ * @summary Create a single-token gift card (USER_DATA)
175
+ * @param {CreateASingleTokenGiftCardRequest} requestParameters Request parameters.
176
+ * @returns {Promise<RestApiResponse<CreateASingleTokenGiftCardResponse>>}
177
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
178
+ * @memberof MarketDataApi
179
+ * @see {@link https://developers.binance.com/docs/gift_card/market-data/Create-a-single-token-gift-card Binance API Documentation}
180
+ */
181
+ async createASingleTokenGiftCard(requestParameters) {
182
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.createASingleTokenGiftCard(requestParameters?.token, requestParameters?.amount, requestParameters?.recvWindow);
183
+ return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
184
+ }
185
+ /**
186
+ * This API is for fetching the RSA Public Key.
187
+ * This RSA Public key will be used to encrypt the card code.
188
+ *
189
+ **Please note that the RSA Public key fetched is valid only for the current day.**
190
+ *
191
+ * Weight: 1
192
+ *
193
+ * @summary Fetch RSA Public Key(USER_DATA)
194
+ * @param {FetchRsaPublicKeyRequest} requestParameters Request parameters.
195
+ * @returns {Promise<RestApiResponse<FetchRsaPublicKeyResponse>>}
196
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
197
+ * @memberof MarketDataApi
198
+ * @see {@link https://developers.binance.com/docs/gift_card/market-data/Fetch-RSA-Public-Key Binance API Documentation}
199
+ */
200
+ async fetchRsaPublicKey(requestParameters = {}) {
201
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.fetchRsaPublicKey(requestParameters?.recvWindow);
202
+ return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
203
+ }
204
+ /**
205
+ * This API is to help you verify which tokens are available for you to create Stablecoin-Denominated gift cards as mentioned in section 2 and its’ limitation.
206
+ *
207
+ * Weight: 1
208
+ *
209
+ * @summary Fetch Token Limit(USER_DATA)
210
+ * @param {FetchTokenLimitRequest} requestParameters Request parameters.
211
+ * @returns {Promise<RestApiResponse<FetchTokenLimitResponse>>}
212
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
213
+ * @memberof MarketDataApi
214
+ * @see {@link https://developers.binance.com/docs/gift_card/market-data/Fetch-Token-Limit Binance API Documentation}
215
+ */
216
+ async fetchTokenLimit(requestParameters) {
217
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.fetchTokenLimit(requestParameters?.baseToken, requestParameters?.recvWindow);
218
+ return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
219
+ }
220
+ /**
221
+ * This API is for redeeming a Binance Gift Card
222
+ * Once redeemed, the coins will be deposited in your funding wallet.
223
+ *
224
+ * Parameter code can be sent in two formats:
225
+ * Plaintext
226
+ * Encrypted
227
+ *
228
+ * Sending code in Encrypted format provides more security than sending it as a plaintext. To send card code in encrypted format the following steps must be followed:
229
+ * Fetch RSA public key from api stated below.
230
+ * Use the below algorithm to encrypt the card code using the RSA public key fetched above: `RSA/ECB/OAEPWithSHA-256AndMGF1Padding`
231
+ **A sample code snippet (JAVA) is stated below for reference, the same approach can be used for different languages like C#, PERL, PYTHON, SHELL etc.:**
232
+ *
233
+ * Weight: 1
234
+ *
235
+ * @summary Redeem a Binance Gift Card(USER_DATA)
236
+ * @param {RedeemABinanceGiftCardRequest} requestParameters Request parameters.
237
+ * @returns {Promise<RestApiResponse<RedeemABinanceGiftCardResponse>>}
238
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
239
+ * @memberof MarketDataApi
240
+ * @see {@link https://developers.binance.com/docs/gift_card/market-data/Redeem-a-Binance-Gift-Card Binance API Documentation}
241
+ */
242
+ async redeemABinanceGiftCard(requestParameters) {
243
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.redeemABinanceGiftCard(requestParameters?.code, requestParameters?.externalUid, requestParameters?.recvWindow);
244
+ return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
245
+ }
246
+ /**
247
+ * This API is for verifying whether the Binance Gift Card is valid or not by entering Gift Card Number.
248
+ *
249
+ **Please note that if you enter the wrong Gift Card Number 5 times within an hour, you will no longer be able to verify any Gift Card Number for that hour.**
250
+ *
251
+ * Weight: 1
252
+ *
253
+ * @summary Verify Binance Gift Card by Gift Card Number(USER_DATA)
254
+ * @param {VerifyBinanceGiftCardByGiftCardNumberRequest} requestParameters Request parameters.
255
+ * @returns {Promise<RestApiResponse<VerifyBinanceGiftCardByGiftCardNumberResponse>>}
256
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
257
+ * @memberof MarketDataApi
258
+ * @see {@link https://developers.binance.com/docs/gift_card/market-data/Verify-Binance-Gift-Card-by-Gift-Card-Number Binance API Documentation}
259
+ */
260
+ async verifyBinanceGiftCardByGiftCardNumber(requestParameters) {
261
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.verifyBinanceGiftCardByGiftCardNumber(requestParameters?.referenceNo, requestParameters?.recvWindow);
262
+ return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
263
+ }
264
+ };
265
+
266
+ //#endregion
267
+ //#region src/rest-api/rest-api.ts
268
+ /**
269
+ * Binance Gift Card REST API
270
+ *
271
+ * OpenAPI Specification for the Binance Gift Card REST API
272
+ *
273
+ * The version of the OpenAPI document: 1.0.0
274
+ *
275
+ *
276
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
277
+ * https://openapi-generator.tech
278
+ * Do not edit the class manually.
279
+ */
280
+ var RestAPI = class {
281
+ constructor(configuration) {
282
+ this.configuration = configuration;
283
+ this.marketDataApi = new MarketDataApi(configuration);
284
+ }
285
+ /**
286
+ * Generic function to send a request.
287
+ * @param endpoint - The API endpoint to call.
288
+ * @param method - HTTP method to use (GET, POST, DELETE, etc.).
289
+ * @param params - Query parameters for the request.
290
+ *
291
+ * @returns A promise resolving to the response data object.
292
+ */
293
+ sendRequest(endpoint, method, params = {}) {
294
+ return (0, __binance_common.sendRequest)(this.configuration, endpoint, method, params, void 0);
295
+ }
296
+ /**
297
+ * Generic function to send a signed request.
298
+ * @param endpoint - The API endpoint to call.
299
+ * @param method - HTTP method to use (GET, POST, DELETE, etc.).
300
+ * @param params - Query parameters for the request.
301
+ *
302
+ * @returns A promise resolving to the response data object.
303
+ */
304
+ sendSignedRequest(endpoint, method, params = {}) {
305
+ return (0, __binance_common.sendRequest)(this.configuration, endpoint, method, params, void 0, { isSigned: true });
306
+ }
307
+ /**
308
+ * * This API is for creating a dual-token ( stablecoin-denominated) Binance Gift Card. You may create a gift card using USDT as baseToken, that is redeemable to another designated token (faceToken). For example, you can create a fixed-value BTC gift card and pay with 100 USDT plus minting fee. This gift card can keep the value fixed at 100 USDT before redemption, and will be redeemable to BTC equivalent to 100 USDT upon redemption.
309
+ * Once successfully created, the amount of baseToken (e.g. USDT) in the fixed-value gift card along with the fee would be deducted from your funding wallet.
310
+ *
311
+ *
312
+ * To get started with, please make sure:
313
+ * You have a Binance account
314
+ * You have passed KYB
315
+ * You have a sufficient balance(Gift Card amount and fee amount) in your Binance funding wallet
316
+ * You need Enable Withdrawals for the API Key which requests this endpoint.
317
+ *
318
+ * Weight: 1
319
+ *
320
+ * @summary Create a dual-token gift card(fixed value, discount feature)(TRADE)
321
+ * @param {CreateADualTokenGiftCardRequest} requestParameters Request parameters.
322
+ *
323
+ * @returns {Promise<RestApiResponse<CreateADualTokenGiftCardResponse>>}
324
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
325
+ * @see {@link https://developers.binance.com/docs/gift_card/market-data/Create-a-dual-token-gift-card Binance API Documentation}
326
+ */
327
+ createADualTokenGiftCard(requestParameters) {
328
+ return this.marketDataApi.createADualTokenGiftCard(requestParameters);
329
+ }
330
+ /**
331
+ * This API is for creating a Binance Gift Card.
332
+ *
333
+ * To get started with, please make sure:
334
+ *
335
+ * You have a Binance account
336
+ * You have passed KYB
337
+ * You have a sufficient balance(Gift Card amount and fee amount) in your Binance funding wallet
338
+ * You need `Enable Withdrawals` for the API Key which requests this endpoint.
339
+ *
340
+ * Weight: 1
341
+ *
342
+ * @summary Create a single-token gift card (USER_DATA)
343
+ * @param {CreateASingleTokenGiftCardRequest} requestParameters Request parameters.
344
+ *
345
+ * @returns {Promise<RestApiResponse<CreateASingleTokenGiftCardResponse>>}
346
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
347
+ * @see {@link https://developers.binance.com/docs/gift_card/market-data/Create-a-single-token-gift-card Binance API Documentation}
348
+ */
349
+ createASingleTokenGiftCard(requestParameters) {
350
+ return this.marketDataApi.createASingleTokenGiftCard(requestParameters);
351
+ }
352
+ /**
353
+ * This API is for fetching the RSA Public Key.
354
+ * This RSA Public key will be used to encrypt the card code.
355
+ *
356
+ **Please note that the RSA Public key fetched is valid only for the current day.**
357
+ *
358
+ * Weight: 1
359
+ *
360
+ * @summary Fetch RSA Public Key(USER_DATA)
361
+ * @param {FetchRsaPublicKeyRequest} requestParameters Request parameters.
362
+ *
363
+ * @returns {Promise<RestApiResponse<FetchRsaPublicKeyResponse>>}
364
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
365
+ * @see {@link https://developers.binance.com/docs/gift_card/market-data/Fetch-RSA-Public-Key Binance API Documentation}
366
+ */
367
+ fetchRsaPublicKey(requestParameters = {}) {
368
+ return this.marketDataApi.fetchRsaPublicKey(requestParameters);
369
+ }
370
+ /**
371
+ * This API is to help you verify which tokens are available for you to create Stablecoin-Denominated gift cards as mentioned in section 2 and its’ limitation.
372
+ *
373
+ * Weight: 1
374
+ *
375
+ * @summary Fetch Token Limit(USER_DATA)
376
+ * @param {FetchTokenLimitRequest} requestParameters Request parameters.
377
+ *
378
+ * @returns {Promise<RestApiResponse<FetchTokenLimitResponse>>}
379
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
380
+ * @see {@link https://developers.binance.com/docs/gift_card/market-data/Fetch-Token-Limit Binance API Documentation}
381
+ */
382
+ fetchTokenLimit(requestParameters) {
383
+ return this.marketDataApi.fetchTokenLimit(requestParameters);
384
+ }
385
+ /**
386
+ * This API is for redeeming a Binance Gift Card
387
+ * Once redeemed, the coins will be deposited in your funding wallet.
388
+ *
389
+ * Parameter code can be sent in two formats:
390
+ * Plaintext
391
+ * Encrypted
392
+ *
393
+ * Sending code in Encrypted format provides more security than sending it as a plaintext. To send card code in encrypted format the following steps must be followed:
394
+ * Fetch RSA public key from api stated below.
395
+ * Use the below algorithm to encrypt the card code using the RSA public key fetched above: `RSA/ECB/OAEPWithSHA-256AndMGF1Padding`
396
+ **A sample code snippet (JAVA) is stated below for reference, the same approach can be used for different languages like C#, PERL, PYTHON, SHELL etc.:**
397
+ *
398
+ * Weight: 1
399
+ *
400
+ * @summary Redeem a Binance Gift Card(USER_DATA)
401
+ * @param {RedeemABinanceGiftCardRequest} requestParameters Request parameters.
402
+ *
403
+ * @returns {Promise<RestApiResponse<RedeemABinanceGiftCardResponse>>}
404
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
405
+ * @see {@link https://developers.binance.com/docs/gift_card/market-data/Redeem-a-Binance-Gift-Card Binance API Documentation}
406
+ */
407
+ redeemABinanceGiftCard(requestParameters) {
408
+ return this.marketDataApi.redeemABinanceGiftCard(requestParameters);
409
+ }
410
+ /**
411
+ * This API is for verifying whether the Binance Gift Card is valid or not by entering Gift Card Number.
412
+ *
413
+ **Please note that if you enter the wrong Gift Card Number 5 times within an hour, you will no longer be able to verify any Gift Card Number for that hour.**
414
+ *
415
+ * Weight: 1
416
+ *
417
+ * @summary Verify Binance Gift Card by Gift Card Number(USER_DATA)
418
+ * @param {VerifyBinanceGiftCardByGiftCardNumberRequest} requestParameters Request parameters.
419
+ *
420
+ * @returns {Promise<RestApiResponse<VerifyBinanceGiftCardByGiftCardNumberResponse>>}
421
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
422
+ * @see {@link https://developers.binance.com/docs/gift_card/market-data/Verify-Binance-Gift-Card-by-Gift-Card-Number Binance API Documentation}
423
+ */
424
+ verifyBinanceGiftCardByGiftCardNumber(requestParameters) {
425
+ return this.marketDataApi.verifyBinanceGiftCardByGiftCardNumber(requestParameters);
426
+ }
427
+ };
428
+
429
+ //#endregion
430
+ //#region src/rest-api/index.ts
431
+ var rest_api_exports = /* @__PURE__ */ __export({
432
+ MarketDataApi: () => MarketDataApi,
433
+ RestAPI: () => RestAPI
434
+ });
435
+
436
+ //#endregion
437
+ //#region src/gift-card.ts
438
+ var GiftCard = class {
439
+ constructor(config) {
440
+ const userAgent = (0, __binance_common.buildUserAgent)(name, version);
441
+ if (config?.configurationRestAPI) {
442
+ const configRestAPI = new __binance_common.ConfigurationRestAPI(config.configurationRestAPI);
443
+ configRestAPI.basePath = configRestAPI.basePath || __binance_common.GIFT_CARD_REST_API_PROD_URL;
444
+ configRestAPI.baseOptions = configRestAPI.baseOptions || {};
445
+ configRestAPI.baseOptions.headers = {
446
+ ...configRestAPI.baseOptions.headers || {},
447
+ "User-Agent": userAgent
448
+ };
449
+ this.restAPI = new RestAPI(configRestAPI);
450
+ }
451
+ }
452
+ };
453
+
454
+ //#endregion
455
+ Object.defineProperty(exports, 'BadRequestError', {
456
+ enumerable: true,
457
+ get: function () {
458
+ return __binance_common.BadRequestError;
459
+ }
460
+ });
461
+ Object.defineProperty(exports, 'ConfigurationGiftCard', {
462
+ enumerable: true,
463
+ get: function () {
464
+ return ConfigurationGiftCard;
465
+ }
466
+ });
467
+ Object.defineProperty(exports, 'ConnectorClientError', {
468
+ enumerable: true,
469
+ get: function () {
470
+ return __binance_common.ConnectorClientError;
471
+ }
472
+ });
473
+ Object.defineProperty(exports, 'ForbiddenError', {
474
+ enumerable: true,
475
+ get: function () {
476
+ return __binance_common.ForbiddenError;
477
+ }
478
+ });
479
+ Object.defineProperty(exports, 'GIFT_CARD_REST_API_PROD_URL', {
480
+ enumerable: true,
481
+ get: function () {
482
+ return __binance_common.GIFT_CARD_REST_API_PROD_URL;
483
+ }
484
+ });
485
+ exports.GiftCard = GiftCard;
486
+ Object.defineProperty(exports, 'GiftCardRestAPI', {
487
+ enumerable: true,
488
+ get: function () {
489
+ return rest_api_exports;
490
+ }
491
+ });
492
+ Object.defineProperty(exports, 'NetworkError', {
493
+ enumerable: true,
494
+ get: function () {
495
+ return __binance_common.NetworkError;
496
+ }
497
+ });
498
+ Object.defineProperty(exports, 'NotFoundError', {
499
+ enumerable: true,
500
+ get: function () {
501
+ return __binance_common.NotFoundError;
502
+ }
503
+ });
504
+ Object.defineProperty(exports, 'RateLimitBanError', {
505
+ enumerable: true,
506
+ get: function () {
507
+ return __binance_common.RateLimitBanError;
508
+ }
509
+ });
510
+ Object.defineProperty(exports, 'RequiredError', {
511
+ enumerable: true,
512
+ get: function () {
513
+ return __binance_common.RequiredError;
514
+ }
515
+ });
516
+ Object.defineProperty(exports, 'ServerError', {
517
+ enumerable: true,
518
+ get: function () {
519
+ return __binance_common.ServerError;
520
+ }
521
+ });
522
+ Object.defineProperty(exports, 'TooManyRequestsError', {
523
+ enumerable: true,
524
+ get: function () {
525
+ return __binance_common.TooManyRequestsError;
526
+ }
527
+ });
528
+ Object.defineProperty(exports, 'UnauthorizedError', {
529
+ enumerable: true,
530
+ get: function () {
531
+ return __binance_common.UnauthorizedError;
532
+ }
533
+ });
534
+ //# sourceMappingURL=index.js.map