@binance/common 2.2.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -11,6 +11,7 @@ declare const TimeUnit: {
11
11
  };
12
12
  type TimeUnit = (typeof TimeUnit)[keyof typeof TimeUnit];
13
13
  declare const ALGO_REST_API_PROD_URL = "https://api.binance.com";
14
+ declare const ALPHA_REST_API_PROD_URL = "https://www.binance.com";
14
15
  declare const C2C_REST_API_PROD_URL = "https://api.binance.com";
15
16
  declare const CONVERT_REST_API_PROD_URL = "https://api.binance.com";
16
17
  declare const COPY_TRADING_REST_API_PROD_URL = "https://api.binance.com";
@@ -312,7 +313,8 @@ declare class ConfigurationWebsocketStreams {
312
313
  * @param msg - An optional error message.
313
314
  */
314
315
  declare class ConnectorClientError extends Error {
315
- constructor(msg?: string);
316
+ code?: number;
317
+ constructor(msg?: string, code?: number);
316
318
  }
317
319
  /**
318
320
  * Represents an error that occurs when a required parameter is missing or undefined.
@@ -328,28 +330,32 @@ declare class RequiredError extends Error {
328
330
  * @param msg - An optional error message.
329
331
  */
330
332
  declare class UnauthorizedError extends Error {
331
- constructor(msg?: string);
333
+ code?: number;
334
+ constructor(msg?: string, code?: number);
332
335
  }
333
336
  /**
334
337
  * Represents an error that occurs when a resource is forbidden to the client.
335
338
  * @param msg - An optional error message.
336
339
  */
337
340
  declare class ForbiddenError extends Error {
338
- constructor(msg?: string);
341
+ code?: number;
342
+ constructor(msg?: string, code?: number);
339
343
  }
340
344
  /**
341
345
  * Represents an error that occurs when client is doing too many requests.
342
346
  * @param msg - An optional error message.
343
347
  */
344
348
  declare class TooManyRequestsError extends Error {
345
- constructor(msg?: string);
349
+ code?: number;
350
+ constructor(msg?: string, code?: number);
346
351
  }
347
352
  /**
348
353
  * Represents an error that occurs when client's IP has been banned.
349
354
  * @param msg - An optional error message.
350
355
  */
351
356
  declare class RateLimitBanError extends Error {
352
- constructor(msg?: string);
357
+ code?: number;
358
+ constructor(msg?: string, code?: number);
353
359
  }
354
360
  /**
355
361
  * Represents an error that occurs when there is an internal server error.
@@ -372,14 +378,16 @@ declare class NetworkError extends Error {
372
378
  * @param msg - An optional error message.
373
379
  */
374
380
  declare class NotFoundError extends Error {
375
- constructor(msg?: string);
381
+ code?: number;
382
+ constructor(msg?: string, code?: number);
376
383
  }
377
384
  /**
378
385
  * Represents an error that occurs when a request is invalid or cannot be otherwise served.
379
386
  * @param msg - An optional error message.
380
387
  */
381
388
  declare class BadRequestError extends Error {
382
- constructor(msg?: string);
389
+ code?: number;
390
+ constructor(msg?: string, code?: number);
383
391
  }
384
392
  //#endregion
385
393
  //#region src/logger.d.ts
@@ -1140,5 +1148,5 @@ interface WebsocketStream<T> {
1140
1148
  */
1141
1149
  declare function createStreamHandler<T>(websocketBase: WebsocketAPIBase | WebsocketStreamsBase, streamOrId: string, id?: number | string, urlPath?: string): WebsocketStream<T>;
1142
1150
  //#endregion
1143
- export { ALGO_REST_API_PROD_URL, AxiosRequestArgs, BadRequestError, C2C_REST_API_PROD_URL, CONVERT_REST_API_PROD_URL, COPY_TRADING_REST_API_PROD_URL, CRYPTO_LOAN_REST_API_PROD_URL, ConfigurationRestAPI, ConfigurationWebsocketAPI, ConfigurationWebsocketStreams, ConnectorClientError, DERIVATIVES_TRADING_COIN_FUTURES_REST_API_PROD_URL, DERIVATIVES_TRADING_COIN_FUTURES_REST_API_TESTNET_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_API_PROD_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_API_TESTNET_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_STREAMS_TESTNET_URL, DERIVATIVES_TRADING_OPTIONS_REST_API_PROD_URL, DERIVATIVES_TRADING_OPTIONS_REST_API_TESTNET_URL, DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_TESTNET_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_PRO_REST_API_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_PRO_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_REST_API_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_REST_API_TESTNET_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_WS_STREAMS_TESTNET_URL, DERIVATIVES_TRADING_USDS_FUTURES_REST_API_PROD_URL, DERIVATIVES_TRADING_USDS_FUTURES_REST_API_TESTNET_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_API_PROD_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_API_TESTNET_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_STREAMS_TESTNET_URL, DUAL_INVESTMENT_REST_API_PROD_URL, FIAT_REST_API_PROD_URL, ForbiddenError, GIFT_CARD_REST_API_PROD_URL, LogLevel, Logger, MARGIN_TRADING_REST_API_PROD_URL, MARGIN_TRADING_RISK_WS_STREAMS_PROD_URL, MARGIN_TRADING_WS_STREAMS_PROD_URL, MINING_REST_API_PROD_URL, NFT_REST_API_PROD_URL, NetworkError, NotFoundError, ObjectType, PAY_REST_API_PROD_URL, REBATE_REST_API_PROD_URL, RateLimitBanError, RequestArgs, RequiredError, RestApiRateLimit, RestApiResponse, SIMPLE_EARN_REST_API_PROD_URL, SPOT_REST_API_MARKET_URL, SPOT_REST_API_PROD_URL, SPOT_REST_API_TESTNET_URL, SPOT_WS_API_PROD_URL, SPOT_WS_API_TESTNET_URL, SPOT_WS_STREAMS_MARKET_URL, SPOT_WS_STREAMS_PROD_URL, SPOT_WS_STREAMS_TESTNET_URL, STAKING_REST_API_PROD_URL, SUB_ACCOUNT_REST_API_PROD_URL, SendMessageOptions, ServerError, TimeUnit, TimerRecord, TooManyRequestsError, UnauthorizedError, VIP_LOAN_REST_API_PROD_URL, WALLET_REST_API_PROD_URL, WebsocketAPIBase, WebsocketApiRateLimit, WebsocketApiResponse, WebsocketCommon, WebsocketConnection, WebsocketEventEmitter, WebsocketSendMsgConfig, WebsocketSendMsgOptions, WebsocketStream, WebsocketStreamsBase, assertParamExists, buildQueryString, buildUserAgent, buildWebsocketAPIMessage, clearSignerCache, createStreamHandler, delay, getSignature, getTimestamp, httpRequestFunction, normalizeScientificNumbers, normalizeStreamId, parseCustomHeaders, parseRateLimitHeaders, randomInteger, randomString, removeEmptyValue, replaceWebsocketStreamsPlaceholders, sanitizeHeaderValue, sendRequest, setSearchParams, shouldRetryRequest, sortObject, toPathString, validateTimeUnit };
1151
+ export { ALGO_REST_API_PROD_URL, ALPHA_REST_API_PROD_URL, AxiosRequestArgs, BadRequestError, C2C_REST_API_PROD_URL, CONVERT_REST_API_PROD_URL, COPY_TRADING_REST_API_PROD_URL, CRYPTO_LOAN_REST_API_PROD_URL, ConfigurationRestAPI, ConfigurationWebsocketAPI, ConfigurationWebsocketStreams, ConnectorClientError, DERIVATIVES_TRADING_COIN_FUTURES_REST_API_PROD_URL, DERIVATIVES_TRADING_COIN_FUTURES_REST_API_TESTNET_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_API_PROD_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_API_TESTNET_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_STREAMS_TESTNET_URL, DERIVATIVES_TRADING_OPTIONS_REST_API_PROD_URL, DERIVATIVES_TRADING_OPTIONS_REST_API_TESTNET_URL, DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_TESTNET_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_PRO_REST_API_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_PRO_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_REST_API_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_REST_API_TESTNET_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_WS_STREAMS_TESTNET_URL, DERIVATIVES_TRADING_USDS_FUTURES_REST_API_PROD_URL, DERIVATIVES_TRADING_USDS_FUTURES_REST_API_TESTNET_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_API_PROD_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_API_TESTNET_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_STREAMS_TESTNET_URL, DUAL_INVESTMENT_REST_API_PROD_URL, FIAT_REST_API_PROD_URL, ForbiddenError, GIFT_CARD_REST_API_PROD_URL, LogLevel, Logger, MARGIN_TRADING_REST_API_PROD_URL, MARGIN_TRADING_RISK_WS_STREAMS_PROD_URL, MARGIN_TRADING_WS_STREAMS_PROD_URL, MINING_REST_API_PROD_URL, NFT_REST_API_PROD_URL, NetworkError, NotFoundError, ObjectType, PAY_REST_API_PROD_URL, REBATE_REST_API_PROD_URL, RateLimitBanError, RequestArgs, RequiredError, RestApiRateLimit, RestApiResponse, SIMPLE_EARN_REST_API_PROD_URL, SPOT_REST_API_MARKET_URL, SPOT_REST_API_PROD_URL, SPOT_REST_API_TESTNET_URL, SPOT_WS_API_PROD_URL, SPOT_WS_API_TESTNET_URL, SPOT_WS_STREAMS_MARKET_URL, SPOT_WS_STREAMS_PROD_URL, SPOT_WS_STREAMS_TESTNET_URL, STAKING_REST_API_PROD_URL, SUB_ACCOUNT_REST_API_PROD_URL, SendMessageOptions, ServerError, TimeUnit, TimerRecord, TooManyRequestsError, UnauthorizedError, VIP_LOAN_REST_API_PROD_URL, WALLET_REST_API_PROD_URL, WebsocketAPIBase, WebsocketApiRateLimit, WebsocketApiResponse, WebsocketCommon, WebsocketConnection, WebsocketEventEmitter, WebsocketSendMsgConfig, WebsocketSendMsgOptions, WebsocketStream, WebsocketStreamsBase, assertParamExists, buildQueryString, buildUserAgent, buildWebsocketAPIMessage, clearSignerCache, createStreamHandler, delay, getSignature, getTimestamp, httpRequestFunction, normalizeScientificNumbers, normalizeStreamId, parseCustomHeaders, parseRateLimitHeaders, randomInteger, randomString, removeEmptyValue, replaceWebsocketStreamsPlaceholders, sanitizeHeaderValue, sendRequest, setSearchParams, shouldRetryRequest, sortObject, toPathString, validateTimeUnit };
1144
1152
  //# sourceMappingURL=index.d.mts.map
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ declare const TimeUnit: {
11
11
  };
12
12
  type TimeUnit = (typeof TimeUnit)[keyof typeof TimeUnit];
13
13
  declare const ALGO_REST_API_PROD_URL = "https://api.binance.com";
14
+ declare const ALPHA_REST_API_PROD_URL = "https://www.binance.com";
14
15
  declare const C2C_REST_API_PROD_URL = "https://api.binance.com";
15
16
  declare const CONVERT_REST_API_PROD_URL = "https://api.binance.com";
16
17
  declare const COPY_TRADING_REST_API_PROD_URL = "https://api.binance.com";
@@ -312,7 +313,8 @@ declare class ConfigurationWebsocketStreams {
312
313
  * @param msg - An optional error message.
313
314
  */
314
315
  declare class ConnectorClientError extends Error {
315
- constructor(msg?: string);
316
+ code?: number;
317
+ constructor(msg?: string, code?: number);
316
318
  }
317
319
  /**
318
320
  * Represents an error that occurs when a required parameter is missing or undefined.
@@ -328,28 +330,32 @@ declare class RequiredError extends Error {
328
330
  * @param msg - An optional error message.
329
331
  */
330
332
  declare class UnauthorizedError extends Error {
331
- constructor(msg?: string);
333
+ code?: number;
334
+ constructor(msg?: string, code?: number);
332
335
  }
333
336
  /**
334
337
  * Represents an error that occurs when a resource is forbidden to the client.
335
338
  * @param msg - An optional error message.
336
339
  */
337
340
  declare class ForbiddenError extends Error {
338
- constructor(msg?: string);
341
+ code?: number;
342
+ constructor(msg?: string, code?: number);
339
343
  }
340
344
  /**
341
345
  * Represents an error that occurs when client is doing too many requests.
342
346
  * @param msg - An optional error message.
343
347
  */
344
348
  declare class TooManyRequestsError extends Error {
345
- constructor(msg?: string);
349
+ code?: number;
350
+ constructor(msg?: string, code?: number);
346
351
  }
347
352
  /**
348
353
  * Represents an error that occurs when client's IP has been banned.
349
354
  * @param msg - An optional error message.
350
355
  */
351
356
  declare class RateLimitBanError extends Error {
352
- constructor(msg?: string);
357
+ code?: number;
358
+ constructor(msg?: string, code?: number);
353
359
  }
354
360
  /**
355
361
  * Represents an error that occurs when there is an internal server error.
@@ -372,14 +378,16 @@ declare class NetworkError extends Error {
372
378
  * @param msg - An optional error message.
373
379
  */
374
380
  declare class NotFoundError extends Error {
375
- constructor(msg?: string);
381
+ code?: number;
382
+ constructor(msg?: string, code?: number);
376
383
  }
377
384
  /**
378
385
  * Represents an error that occurs when a request is invalid or cannot be otherwise served.
379
386
  * @param msg - An optional error message.
380
387
  */
381
388
  declare class BadRequestError extends Error {
382
- constructor(msg?: string);
389
+ code?: number;
390
+ constructor(msg?: string, code?: number);
383
391
  }
384
392
  //#endregion
385
393
  //#region src/logger.d.ts
@@ -1140,5 +1148,5 @@ interface WebsocketStream<T> {
1140
1148
  */
1141
1149
  declare function createStreamHandler<T>(websocketBase: WebsocketAPIBase | WebsocketStreamsBase, streamOrId: string, id?: number | string, urlPath?: string): WebsocketStream<T>;
1142
1150
  //#endregion
1143
- export { ALGO_REST_API_PROD_URL, AxiosRequestArgs, BadRequestError, C2C_REST_API_PROD_URL, CONVERT_REST_API_PROD_URL, COPY_TRADING_REST_API_PROD_URL, CRYPTO_LOAN_REST_API_PROD_URL, ConfigurationRestAPI, ConfigurationWebsocketAPI, ConfigurationWebsocketStreams, ConnectorClientError, DERIVATIVES_TRADING_COIN_FUTURES_REST_API_PROD_URL, DERIVATIVES_TRADING_COIN_FUTURES_REST_API_TESTNET_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_API_PROD_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_API_TESTNET_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_STREAMS_TESTNET_URL, DERIVATIVES_TRADING_OPTIONS_REST_API_PROD_URL, DERIVATIVES_TRADING_OPTIONS_REST_API_TESTNET_URL, DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_TESTNET_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_PRO_REST_API_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_PRO_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_REST_API_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_REST_API_TESTNET_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_WS_STREAMS_TESTNET_URL, DERIVATIVES_TRADING_USDS_FUTURES_REST_API_PROD_URL, DERIVATIVES_TRADING_USDS_FUTURES_REST_API_TESTNET_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_API_PROD_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_API_TESTNET_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_STREAMS_TESTNET_URL, DUAL_INVESTMENT_REST_API_PROD_URL, FIAT_REST_API_PROD_URL, ForbiddenError, GIFT_CARD_REST_API_PROD_URL, LogLevel, Logger, MARGIN_TRADING_REST_API_PROD_URL, MARGIN_TRADING_RISK_WS_STREAMS_PROD_URL, MARGIN_TRADING_WS_STREAMS_PROD_URL, MINING_REST_API_PROD_URL, NFT_REST_API_PROD_URL, NetworkError, NotFoundError, ObjectType, PAY_REST_API_PROD_URL, REBATE_REST_API_PROD_URL, RateLimitBanError, RequestArgs, RequiredError, RestApiRateLimit, RestApiResponse, SIMPLE_EARN_REST_API_PROD_URL, SPOT_REST_API_MARKET_URL, SPOT_REST_API_PROD_URL, SPOT_REST_API_TESTNET_URL, SPOT_WS_API_PROD_URL, SPOT_WS_API_TESTNET_URL, SPOT_WS_STREAMS_MARKET_URL, SPOT_WS_STREAMS_PROD_URL, SPOT_WS_STREAMS_TESTNET_URL, STAKING_REST_API_PROD_URL, SUB_ACCOUNT_REST_API_PROD_URL, SendMessageOptions, ServerError, TimeUnit, TimerRecord, TooManyRequestsError, UnauthorizedError, VIP_LOAN_REST_API_PROD_URL, WALLET_REST_API_PROD_URL, WebsocketAPIBase, WebsocketApiRateLimit, WebsocketApiResponse, WebsocketCommon, WebsocketConnection, WebsocketEventEmitter, WebsocketSendMsgConfig, WebsocketSendMsgOptions, WebsocketStream, WebsocketStreamsBase, assertParamExists, buildQueryString, buildUserAgent, buildWebsocketAPIMessage, clearSignerCache, createStreamHandler, delay, getSignature, getTimestamp, httpRequestFunction, normalizeScientificNumbers, normalizeStreamId, parseCustomHeaders, parseRateLimitHeaders, randomInteger, randomString, removeEmptyValue, replaceWebsocketStreamsPlaceholders, sanitizeHeaderValue, sendRequest, setSearchParams, shouldRetryRequest, sortObject, toPathString, validateTimeUnit };
1151
+ export { ALGO_REST_API_PROD_URL, ALPHA_REST_API_PROD_URL, AxiosRequestArgs, BadRequestError, C2C_REST_API_PROD_URL, CONVERT_REST_API_PROD_URL, COPY_TRADING_REST_API_PROD_URL, CRYPTO_LOAN_REST_API_PROD_URL, ConfigurationRestAPI, ConfigurationWebsocketAPI, ConfigurationWebsocketStreams, ConnectorClientError, DERIVATIVES_TRADING_COIN_FUTURES_REST_API_PROD_URL, DERIVATIVES_TRADING_COIN_FUTURES_REST_API_TESTNET_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_API_PROD_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_API_TESTNET_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_COIN_FUTURES_WS_STREAMS_TESTNET_URL, DERIVATIVES_TRADING_OPTIONS_REST_API_PROD_URL, DERIVATIVES_TRADING_OPTIONS_REST_API_TESTNET_URL, DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_TESTNET_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_PRO_REST_API_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_PRO_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_REST_API_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_REST_API_TESTNET_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_WS_STREAMS_TESTNET_URL, DERIVATIVES_TRADING_USDS_FUTURES_REST_API_PROD_URL, DERIVATIVES_TRADING_USDS_FUTURES_REST_API_TESTNET_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_API_PROD_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_API_TESTNET_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_STREAMS_PROD_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_STREAMS_TESTNET_URL, DUAL_INVESTMENT_REST_API_PROD_URL, FIAT_REST_API_PROD_URL, ForbiddenError, GIFT_CARD_REST_API_PROD_URL, LogLevel, Logger, MARGIN_TRADING_REST_API_PROD_URL, MARGIN_TRADING_RISK_WS_STREAMS_PROD_URL, MARGIN_TRADING_WS_STREAMS_PROD_URL, MINING_REST_API_PROD_URL, NFT_REST_API_PROD_URL, NetworkError, NotFoundError, ObjectType, PAY_REST_API_PROD_URL, REBATE_REST_API_PROD_URL, RateLimitBanError, RequestArgs, RequiredError, RestApiRateLimit, RestApiResponse, SIMPLE_EARN_REST_API_PROD_URL, SPOT_REST_API_MARKET_URL, SPOT_REST_API_PROD_URL, SPOT_REST_API_TESTNET_URL, SPOT_WS_API_PROD_URL, SPOT_WS_API_TESTNET_URL, SPOT_WS_STREAMS_MARKET_URL, SPOT_WS_STREAMS_PROD_URL, SPOT_WS_STREAMS_TESTNET_URL, STAKING_REST_API_PROD_URL, SUB_ACCOUNT_REST_API_PROD_URL, SendMessageOptions, ServerError, TimeUnit, TimerRecord, TooManyRequestsError, UnauthorizedError, VIP_LOAN_REST_API_PROD_URL, WALLET_REST_API_PROD_URL, WebsocketAPIBase, WebsocketApiRateLimit, WebsocketApiResponse, WebsocketCommon, WebsocketConnection, WebsocketEventEmitter, WebsocketSendMsgConfig, WebsocketSendMsgOptions, WebsocketStream, WebsocketStreamsBase, assertParamExists, buildQueryString, buildUserAgent, buildWebsocketAPIMessage, clearSignerCache, createStreamHandler, delay, getSignature, getTimestamp, httpRequestFunction, normalizeScientificNumbers, normalizeStreamId, parseCustomHeaders, parseRateLimitHeaders, randomInteger, randomString, removeEmptyValue, replaceWebsocketStreamsPlaceholders, sanitizeHeaderValue, sendRequest, setSearchParams, shouldRetryRequest, sortObject, toPathString, validateTimeUnit };
1144
1152
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -372,16 +372,17 @@ const httpRequestFunction = async function(axiosArgs, configuration) {
372
372
  else if (typeof responseData === "object") data = responseData;
373
373
  }
374
374
  const errorMsg = data.msg;
375
+ const errorCode = typeof data.code === "number" ? data.code : void 0;
375
376
  switch (status) {
376
- case 400: throw new BadRequestError(errorMsg);
377
- case 401: throw new UnauthorizedError(errorMsg);
378
- case 403: throw new ForbiddenError(errorMsg);
379
- case 404: throw new NotFoundError(errorMsg);
380
- case 418: throw new RateLimitBanError(errorMsg);
381
- case 429: throw new TooManyRequestsError(errorMsg);
377
+ case 400: throw new BadRequestError(errorMsg, errorCode);
378
+ case 401: throw new UnauthorizedError(errorMsg, errorCode);
379
+ case 403: throw new ForbiddenError(errorMsg, errorCode);
380
+ case 404: throw new NotFoundError(errorMsg, errorCode);
381
+ case 418: throw new RateLimitBanError(errorMsg, errorCode);
382
+ case 429: throw new TooManyRequestsError(errorMsg, errorCode);
382
383
  default:
383
384
  if (status >= 500 && status < 600) throw new ServerError(`Server error: ${status}`, status);
384
- throw new ConnectorClientError(errorMsg);
385
+ throw new ConnectorClientError(errorMsg, errorCode);
385
386
  }
386
387
  } else {
387
388
  if (retries > 0 && attempt >= retries) lastError = /* @__PURE__ */ new Error(`Request failed after ${retries} retries`);
@@ -701,6 +702,7 @@ const TimeUnit = {
701
702
  microsecond: "microsecond"
702
703
  };
703
704
  const ALGO_REST_API_PROD_URL = "https://api.binance.com";
705
+ const ALPHA_REST_API_PROD_URL = "https://www.binance.com";
704
706
  const C2C_REST_API_PROD_URL = "https://api.binance.com";
705
707
  const CONVERT_REST_API_PROD_URL = "https://api.binance.com";
706
708
  const COPY_TRADING_REST_API_PROD_URL = "https://api.binance.com";
@@ -758,10 +760,11 @@ const WALLET_REST_API_PROD_URL = "https://api.binance.com";
758
760
  * @param msg - An optional error message.
759
761
  */
760
762
  var ConnectorClientError = class ConnectorClientError extends Error {
761
- constructor(msg) {
763
+ constructor(msg, code) {
762
764
  super(msg || "An unexpected error occurred.");
763
765
  Object.setPrototypeOf(this, ConnectorClientError.prototype);
764
766
  this.name = "ConnectorClientError";
767
+ this.code = code;
765
768
  }
766
769
  };
767
770
  /**
@@ -782,10 +785,11 @@ var RequiredError = class RequiredError extends Error {
782
785
  * @param msg - An optional error message.
783
786
  */
784
787
  var UnauthorizedError = class UnauthorizedError extends Error {
785
- constructor(msg) {
788
+ constructor(msg, code) {
786
789
  super(msg || "Unauthorized access. Authentication required.");
787
790
  Object.setPrototypeOf(this, UnauthorizedError.prototype);
788
791
  this.name = "UnauthorizedError";
792
+ this.code = code;
789
793
  }
790
794
  };
791
795
  /**
@@ -793,10 +797,11 @@ var UnauthorizedError = class UnauthorizedError extends Error {
793
797
  * @param msg - An optional error message.
794
798
  */
795
799
  var ForbiddenError = class ForbiddenError extends Error {
796
- constructor(msg) {
800
+ constructor(msg, code) {
797
801
  super(msg || "Access to the requested resource is forbidden.");
798
802
  Object.setPrototypeOf(this, ForbiddenError.prototype);
799
803
  this.name = "ForbiddenError";
804
+ this.code = code;
800
805
  }
801
806
  };
802
807
  /**
@@ -804,10 +809,11 @@ var ForbiddenError = class ForbiddenError extends Error {
804
809
  * @param msg - An optional error message.
805
810
  */
806
811
  var TooManyRequestsError = class TooManyRequestsError extends Error {
807
- constructor(msg) {
812
+ constructor(msg, code) {
808
813
  super(msg || "Too many requests. You are being rate-limited.");
809
814
  Object.setPrototypeOf(this, TooManyRequestsError.prototype);
810
815
  this.name = "TooManyRequestsError";
816
+ this.code = code;
811
817
  }
812
818
  };
813
819
  /**
@@ -815,10 +821,11 @@ var TooManyRequestsError = class TooManyRequestsError extends Error {
815
821
  * @param msg - An optional error message.
816
822
  */
817
823
  var RateLimitBanError = class RateLimitBanError extends Error {
818
- constructor(msg) {
824
+ constructor(msg, code) {
819
825
  super(msg || "The IP address has been banned for exceeding rate limits.");
820
826
  Object.setPrototypeOf(this, RateLimitBanError.prototype);
821
827
  this.name = "RateLimitBanError";
828
+ this.code = code;
822
829
  }
823
830
  };
824
831
  /**
@@ -850,10 +857,11 @@ var NetworkError = class NetworkError extends Error {
850
857
  * @param msg - An optional error message.
851
858
  */
852
859
  var NotFoundError = class NotFoundError extends Error {
853
- constructor(msg) {
860
+ constructor(msg, code) {
854
861
  super(msg || "The requested resource was not found.");
855
862
  Object.setPrototypeOf(this, NotFoundError.prototype);
856
863
  this.name = "NotFoundError";
864
+ this.code = code;
857
865
  }
858
866
  };
859
867
  /**
@@ -861,10 +869,11 @@ var NotFoundError = class NotFoundError extends Error {
861
869
  * @param msg - An optional error message.
862
870
  */
863
871
  var BadRequestError = class BadRequestError extends Error {
864
- constructor(msg) {
872
+ constructor(msg, code) {
865
873
  super(msg || "The request was invalid or cannot be otherwise served.");
866
874
  Object.setPrototypeOf(this, BadRequestError.prototype);
867
875
  this.name = "BadRequestError";
876
+ this.code = code;
868
877
  }
869
878
  };
870
879
 
@@ -1769,6 +1778,7 @@ function createStreamHandler(websocketBase, streamOrId, id, urlPath) {
1769
1778
 
1770
1779
  //#endregion
1771
1780
  exports.ALGO_REST_API_PROD_URL = ALGO_REST_API_PROD_URL;
1781
+ exports.ALPHA_REST_API_PROD_URL = ALPHA_REST_API_PROD_URL;
1772
1782
  exports.BadRequestError = BadRequestError;
1773
1783
  exports.C2C_REST_API_PROD_URL = C2C_REST_API_PROD_URL;
1774
1784
  exports.CONVERT_REST_API_PROD_URL = CONVERT_REST_API_PROD_URL;