@binance/common 2.1.1 → 2.2.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 CHANGED
@@ -690,7 +690,9 @@ const DERIVATIVES_TRADING_USDS_FUTURES_WS_API_TESTNET_URL = "wss://testnet.binan
690
690
  const DERIVATIVES_TRADING_USDS_FUTURES_WS_STREAMS_PROD_URL = "wss://fstream.binance.com";
691
691
  const DERIVATIVES_TRADING_USDS_FUTURES_WS_STREAMS_TESTNET_URL = "wss://stream.binancefuture.com";
692
692
  const DERIVATIVES_TRADING_OPTIONS_REST_API_PROD_URL = "https://eapi.binance.com";
693
- const DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_PROD_URL = "wss://nbstream.binance.com/eoptions";
693
+ const DERIVATIVES_TRADING_OPTIONS_REST_API_TESTNET_URL = "https://testnet.binancefuture.com";
694
+ const DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_PROD_URL = "wss://fstream.binance.com";
695
+ const DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_TESTNET_URL = "wss://fstream.binancefuture.com";
694
696
  const DERIVATIVES_TRADING_PORTFOLIO_MARGIN_REST_API_PROD_URL = "https://papi.binance.com";
695
697
  const DERIVATIVES_TRADING_PORTFOLIO_MARGIN_REST_API_TESTNET_URL = "https://testnet.binancefuture.com";
696
698
  const DERIVATIVES_TRADING_PORTFOLIO_MARGIN_WS_STREAMS_PROD_URL = "wss://fstream.binance.com/pm";
@@ -952,10 +954,11 @@ var WebsocketCommon = class WebsocketCommon extends WebsocketEventEmitter {
952
954
  * In 'single' mode, returns the first connection in the pool.
953
955
  * In 'pool' mode, filters and returns connections that are ready for use.
954
956
  * @param allowNonEstablishedWebsockets - Optional flag to include non-established WebSocket connections.
957
+ * @param urlPath - Optional URL path to filter connections.
955
958
  * @returns An array of available WebSocket connections.
956
959
  */
957
- getAvailableConnections(allowNonEstablishedWebsockets = false) {
958
- if (this.mode === "single") return [this.connectionPool[0]];
960
+ getAvailableConnections(allowNonEstablishedWebsockets = false, urlPath) {
961
+ if (this.mode === "single" && !urlPath) return [this.connectionPool[0]];
959
962
  return this.connectionPool.filter((connection) => this.isConnectionReady(connection, allowNonEstablishedWebsockets));
960
963
  }
961
964
  /**
@@ -964,10 +967,14 @@ var WebsocketCommon = class WebsocketCommon extends WebsocketEventEmitter {
964
967
  * If the connection mode is 'pool', it returns an available connection from the pool,
965
968
  * using a round-robin selection strategy. If no available connections are found, it throws an error.
966
969
  * @param allowNonEstablishedWebsockets - A boolean indicating whether to allow connections that are not established.
970
+ * @param urlPath - An optional URL path to filter connections.
967
971
  * @returns {WebsocketConnection} The selected WebSocket connection.
968
972
  */
969
- getConnection(allowNonEstablishedWebsockets = false) {
970
- const availableConnections = this.getAvailableConnections(allowNonEstablishedWebsockets);
973
+ getConnection(allowNonEstablishedWebsockets = false, urlPath) {
974
+ const availableConnections = this.getAvailableConnections(allowNonEstablishedWebsockets, urlPath).filter((connection) => {
975
+ if (urlPath) return connection.urlPath === urlPath;
976
+ return true;
977
+ });
971
978
  if (availableConnections.length === 0) throw new Error("No available Websocket connections are ready.");
972
979
  const selectedConnection = availableConnections[this.roundRobinIndex % availableConnections.length];
973
980
  this.roundRobinIndex = (this.roundRobinIndex + 1) % availableConnections.length;
@@ -1165,14 +1172,15 @@ var WebsocketCommon = class WebsocketCommon extends WebsocketEventEmitter {
1165
1172
  /**
1166
1173
  * Connects all WebSocket connections in the pool
1167
1174
  * @param url - The Websocket server URL.
1175
+ * @param connections - An optional array of WebSocket connections to connect. If not provided, all connections in the pool are connected.
1168
1176
  * @returns A promise that resolves when all connections are established.
1169
1177
  */
1170
- async connectPool(url) {
1171
- const connectPromises = this.connectionPool.map((connection) => new Promise((resolve, reject) => {
1178
+ async connectPool(url, connections) {
1179
+ const connectPromises = (connections ?? this.connectionPool).map((connection) => new Promise((resolve, reject) => {
1172
1180
  this.initConnect(url, false, connection);
1173
- connection.ws?.on("open", () => resolve());
1174
- connection.ws?.on("error", (err) => reject(err));
1175
- connection.ws?.on("close", () => reject(/* @__PURE__ */ new Error("Connection closed unexpectedly.")));
1181
+ connection.ws?.once("open", () => resolve());
1182
+ connection.ws?.once("error", (err) => reject(err));
1183
+ connection.ws?.once("close", () => reject(/* @__PURE__ */ new Error("Connection closed unexpectedly.")));
1176
1184
  }));
1177
1185
  await Promise.all(connectPromises);
1178
1186
  }
@@ -1451,7 +1459,7 @@ var WebsocketAPIBase = class extends WebsocketCommon {
1451
1459
  }
1452
1460
  };
1453
1461
  var WebsocketStreamsBase = class extends WebsocketCommon {
1454
- constructor(configuration, connectionPool = []) {
1462
+ constructor(configuration, connectionPool = [], urlPaths = []) {
1455
1463
  super(configuration, connectionPool);
1456
1464
  this.streamConnectionMap = /* @__PURE__ */ new Map();
1457
1465
  this.streamIdIsStrictlyNumber = false;
@@ -1459,14 +1467,42 @@ var WebsocketStreamsBase = class extends WebsocketCommon {
1459
1467
  this.logger = Logger.getInstance();
1460
1468
  this.configuration = configuration;
1461
1469
  this.wsURL = configuration.wsURL;
1470
+ this.urlPaths = urlPaths;
1471
+ this.ensurePoolSizeForUrlPaths();
1472
+ }
1473
+ /**
1474
+ * Ensures the connection pool has the required size based on the configured mode and number of URL paths.
1475
+ *
1476
+ * If no URL paths are configured, the method returns early without modifications.
1477
+ * In 'pool' mode, the pool size is multiplied by the number of URL paths.
1478
+ * In 'single' mode, only one connection per URL path is maintained.
1479
+ *
1480
+ * New connections are initialized with unique IDs and default state flags when the pool
1481
+ * size is less than the expected size.
1482
+ *
1483
+ * @private
1484
+ * @returns {void}
1485
+ */
1486
+ ensurePoolSizeForUrlPaths() {
1487
+ if (this.urlPaths.length === 0) return;
1488
+ const expected = ((this.configuration?.mode ?? "single") === "pool" && this.configuration?.poolSize ? this.configuration.poolSize : 1) * this.urlPaths.length;
1489
+ while (this.connectionPool.length < expected) this.connectionPool.push({
1490
+ id: randomString(),
1491
+ closeInitiated: false,
1492
+ reconnectionPending: false,
1493
+ renewalPending: false,
1494
+ pendingRequests: /* @__PURE__ */ new Map(),
1495
+ pendingSubscriptions: []
1496
+ });
1462
1497
  }
1463
1498
  /**
1464
1499
  * Formats the WebSocket URL for a given stream or streams.
1465
1500
  * @param streams - Array of stream names to include in the URL.
1501
+ * @param urlPath - Optional URL path to include in the WebSocket URL.
1466
1502
  * @returns The formatted WebSocket URL with the provided streams.
1467
1503
  */
1468
- prepareURL(streams = []) {
1469
- let url = `${this.wsURL}/stream?streams=${streams.join("/")}`;
1504
+ prepareURL(streams = [], urlPath) {
1505
+ let url = `${urlPath ? `${this.wsURL}/${urlPath}` : this.wsURL}/stream?streams=${streams.join("/")}`;
1470
1506
  if (this.configuration?.timeUnit) try {
1471
1507
  const _timeUnit = validateTimeUnit(this.configuration.timeUnit);
1472
1508
  url = `${url}${url.includes("?") ? "&" : "?"}timeUnit=${_timeUnit}`;
@@ -1482,22 +1518,24 @@ var WebsocketStreamsBase = class extends WebsocketCommon {
1482
1518
  * @returns The formatted WebSocket URL with streams and optional parameters.
1483
1519
  */
1484
1520
  getReconnectURL(url, targetConnection) {
1485
- const streams = Array.from(this.streamConnectionMap.keys()).filter((stream) => this.streamConnectionMap.get(stream) === targetConnection);
1486
- return this.prepareURL(streams);
1521
+ const streams = Array.from(this.streamConnectionMap.keys()).filter((stream) => this.streamConnectionMap.get(stream) === targetConnection).map((key) => key.includes("::") ? key.split("::").slice(1).join("::") : key);
1522
+ return this.prepareURL(streams, targetConnection?.urlPath);
1487
1523
  }
1488
1524
  /**
1489
1525
  * Handles subscription to streams and assigns them to specific connections
1490
1526
  * @param streams Array of stream names to subscribe to
1527
+ * @param urlPath Optional URL path for the streams
1491
1528
  * @returns Map of connections to streams
1492
1529
  */
1493
- handleStreamAssignment(streams) {
1530
+ handleStreamAssignment(streams, urlPath) {
1494
1531
  const connectionStreamMap = /* @__PURE__ */ new Map();
1495
1532
  streams.forEach((stream) => {
1496
- if (!this.streamCallbackMap.has(stream)) this.streamCallbackMap.set(stream, /* @__PURE__ */ new Set());
1497
- let connection = this.streamConnectionMap.get(stream);
1533
+ const key = this.streamKey(stream, urlPath);
1534
+ if (!this.streamCallbackMap.has(key)) this.streamCallbackMap.set(key, /* @__PURE__ */ new Set());
1535
+ let connection = this.streamConnectionMap.get(key);
1498
1536
  if (!connection || connection.closeInitiated || connection.reconnectionPending) {
1499
- connection = this.getConnection(true);
1500
- this.streamConnectionMap.set(stream, connection);
1537
+ connection = this.getConnection(true, urlPath);
1538
+ this.streamConnectionMap.set(key, connection);
1501
1539
  }
1502
1540
  if (!connectionStreamMap.has(connection)) connectionStreamMap.set(connection, []);
1503
1541
  connectionStreamMap.get(connection)?.push(stream);
@@ -1543,7 +1581,10 @@ var WebsocketStreamsBase = class extends WebsocketCommon {
1543
1581
  try {
1544
1582
  const parsedData = JSONParse(data);
1545
1583
  const streamName = parsedData?.stream;
1546
- if (streamName && this.streamCallbackMap.has(streamName)) this.streamCallbackMap.get(streamName)?.forEach((callback) => callback(parsedData.data));
1584
+ if (streamName) {
1585
+ const key = this.streamKey(streamName, connection?.urlPath);
1586
+ if (this.streamCallbackMap.has(key)) this.streamCallbackMap.get(key)?.forEach((callback) => callback(parsedData.data));
1587
+ }
1547
1588
  } catch (error) {
1548
1589
  this.logger.error("Failed to parse WebSocket message:", data, error);
1549
1590
  }
@@ -1561,6 +1602,15 @@ var WebsocketStreamsBase = class extends WebsocketCommon {
1561
1602
  super.onOpen(url, targetConnection, oldWSConnection);
1562
1603
  }
1563
1604
  /**
1605
+ * Generates a stream key by combining a stream name with an optional URL path.
1606
+ * @param stream - The stream name to use as the key or suffix.
1607
+ * @param urlPath - Optional URL path to prepend to the stream name.
1608
+ * @returns A stream key in the format `urlPath::stream` if urlPath is provided, otherwise just the stream name.
1609
+ */
1610
+ streamKey(stream, urlPath) {
1611
+ return urlPath ? `${urlPath}::${stream}` : stream;
1612
+ }
1613
+ /**
1564
1614
  * Connects to the WebSocket server and subscribes to the specified streams.
1565
1615
  * This method returns a Promise that resolves when the connection is established,
1566
1616
  * or rejects with an error if the connection fails to be established within 10 seconds.
@@ -1573,7 +1623,15 @@ var WebsocketStreamsBase = class extends WebsocketCommon {
1573
1623
  const timeout = setTimeout(() => {
1574
1624
  reject(/* @__PURE__ */ new Error("Websocket connection timed out"));
1575
1625
  }, 1e4);
1576
- this.connectPool(this.prepareURL(streams)).then(() => resolve()).catch((error) => reject(error)).finally(() => clearTimeout(timeout));
1626
+ const basePoolSize = (this.configuration?.mode ?? "single") === "pool" && this.configuration?.poolSize ? this.configuration.poolSize : 1;
1627
+ const connections = this.urlPaths.length > 0 ? this.urlPaths.map((path, i) => {
1628
+ const start = i * basePoolSize;
1629
+ const end = start + basePoolSize;
1630
+ const subset = this.connectionPool.slice(start, end);
1631
+ subset.forEach((c) => c.urlPath = path);
1632
+ return this.connectPool(this.prepareURL(streams, path), subset);
1633
+ }) : [this.connectPool(this.prepareURL(streams))];
1634
+ Promise.all(connections).then(() => resolve()).catch((error) => reject(error)).finally(() => clearTimeout(timeout));
1577
1635
  });
1578
1636
  }
1579
1637
  /**
@@ -1590,17 +1648,21 @@ var WebsocketStreamsBase = class extends WebsocketCommon {
1590
1648
  * Handles both single and pool modes
1591
1649
  * @param stream Single stream name or array of stream names to subscribe to
1592
1650
  * @param id Optional subscription ID
1651
+ * @param urlPath Optional URL path for the streams
1593
1652
  * @returns void
1594
1653
  */
1595
- subscribe(stream, id) {
1596
- const streams = (Array.isArray(stream) ? stream : [stream]).filter((stream$1) => !this.streamConnectionMap.has(stream$1));
1597
- this.handleStreamAssignment(streams).forEach((streams$1, connection) => {
1654
+ subscribe(stream, id, urlPath) {
1655
+ const streams = (Array.isArray(stream) ? stream : [stream]).filter((stream$1) => {
1656
+ const key = this.streamKey(stream$1, urlPath);
1657
+ return !this.streamConnectionMap.has(key);
1658
+ });
1659
+ this.handleStreamAssignment(streams, urlPath).forEach((assignedStreams, connection) => {
1598
1660
  if (!this.isConnected(connection)) {
1599
- this.logger.info(`Connection ${connection.id} is not ready. Queuing subscription for streams: ${streams$1}`);
1600
- connection.pendingSubscriptions?.push(...streams$1);
1661
+ this.logger.info(`Connection ${connection.id} is not ready. Queuing subscription for streams: ${assignedStreams}`);
1662
+ connection.pendingSubscriptions?.push(...assignedStreams);
1601
1663
  return;
1602
1664
  }
1603
- this.sendSubscriptionPayload(connection, streams$1, id);
1665
+ this.sendSubscriptionPayload(connection, assignedStreams, id);
1604
1666
  });
1605
1667
  }
1606
1668
  /**
@@ -1608,16 +1670,18 @@ var WebsocketStreamsBase = class extends WebsocketCommon {
1608
1670
  * Handles both single and pool modes
1609
1671
  * @param stream Single stream name or array of stream names to unsubscribe from
1610
1672
  * @param id Optional unsubscription ID
1673
+ * @param urlPath Optional URL path for the streams
1611
1674
  * @returns void
1612
1675
  */
1613
- unsubscribe(stream, id) {
1676
+ unsubscribe(stream, id, urlPath) {
1614
1677
  (Array.isArray(stream) ? stream : [stream]).forEach((stream$1) => {
1615
- const connection = this.streamConnectionMap.get(stream$1);
1678
+ const key = this.streamKey(stream$1, urlPath);
1679
+ const connection = this.streamConnectionMap.get(key);
1616
1680
  if (!connection || !connection.ws || !this.isConnected(connection)) {
1617
1681
  this.logger.warn(`Stream ${stream$1} not associated with an active connection.`);
1618
1682
  return;
1619
1683
  }
1620
- if (!this.streamCallbackMap.has(stream$1) || this.streamCallbackMap.get(stream$1)?.size === 0) {
1684
+ if (!this.streamCallbackMap.has(key) || this.streamCallbackMap.get(key)?.size === 0) {
1621
1685
  const payload = {
1622
1686
  method: "UNSUBSCRIBE",
1623
1687
  params: [stream$1],
@@ -1625,8 +1689,8 @@ var WebsocketStreamsBase = class extends WebsocketCommon {
1625
1689
  };
1626
1690
  this.logger.debug("UNSUBSCRIBE", payload);
1627
1691
  this.send(JSON.stringify(payload), void 0, false, 0, connection);
1628
- this.streamConnectionMap.delete(stream$1);
1629
- this.streamCallbackMap.delete(stream$1);
1692
+ this.streamConnectionMap.delete(key);
1693
+ this.streamCallbackMap.delete(key);
1630
1694
  }
1631
1695
  });
1632
1696
  }
@@ -1636,7 +1700,9 @@ var WebsocketStreamsBase = class extends WebsocketCommon {
1636
1700
  * @returns `true` if the stream is currently subscribed, `false` otherwise.
1637
1701
  */
1638
1702
  isSubscribed(stream) {
1639
- return this.streamConnectionMap.has(stream);
1703
+ if (this.streamConnectionMap.has(stream)) return true;
1704
+ for (const key of this.streamConnectionMap.keys()) if (key.endsWith(`::${stream}`)) return true;
1705
+ return false;
1640
1706
  }
1641
1707
  };
1642
1708
  /**
@@ -1646,10 +1712,12 @@ var WebsocketStreamsBase = class extends WebsocketCommon {
1646
1712
  * @param {WebsocketAPIBase | WebsocketStreamsBase} websocketBase The WebSocket base instance
1647
1713
  * @param {string} streamOrId The stream identifier
1648
1714
  * @param {string} [id] Optional additional identifier
1715
+ * @param {string} [urlPath] Optional URL path for the stream
1649
1716
  * @returns {WebsocketStream<T>} A stream handler with methods to register callbacks and unsubscribe
1650
1717
  */
1651
- function createStreamHandler(websocketBase, streamOrId, id) {
1652
- if (websocketBase instanceof WebsocketStreamsBase) websocketBase.subscribe(streamOrId, id);
1718
+ function createStreamHandler(websocketBase, streamOrId, id, urlPath) {
1719
+ const key = websocketBase instanceof WebsocketStreamsBase ? websocketBase.streamKey(streamOrId, urlPath) : streamOrId;
1720
+ if (websocketBase instanceof WebsocketStreamsBase) websocketBase.subscribe(streamOrId, id, urlPath);
1653
1721
  let registeredCallback;
1654
1722
  return {
1655
1723
  on: (event, callback) => {
@@ -1659,18 +1727,18 @@ function createStreamHandler(websocketBase, streamOrId, id) {
1659
1727
  websocketBase.logger.error(`Error in stream callback: ${err}`);
1660
1728
  });
1661
1729
  };
1662
- const callbackSet = websocketBase.streamCallbackMap.get(streamOrId) ?? /* @__PURE__ */ new Set();
1730
+ const callbackSet = websocketBase.streamCallbackMap.get(key) ?? /* @__PURE__ */ new Set();
1663
1731
  callbackSet.add(registeredCallback);
1664
- websocketBase.streamCallbackMap.set(streamOrId, callbackSet);
1732
+ websocketBase.streamCallbackMap.set(key, callbackSet);
1665
1733
  }
1666
1734
  },
1667
1735
  unsubscribe: () => {
1668
- if (registeredCallback) websocketBase.streamCallbackMap.get(streamOrId)?.delete(registeredCallback);
1669
- if (websocketBase instanceof WebsocketStreamsBase) websocketBase.unsubscribe(streamOrId, id);
1736
+ if (registeredCallback) websocketBase.streamCallbackMap.get(key)?.delete(registeredCallback);
1737
+ if (websocketBase instanceof WebsocketStreamsBase) websocketBase.unsubscribe(streamOrId, id, urlPath);
1670
1738
  }
1671
1739
  };
1672
1740
  }
1673
1741
 
1674
1742
  //#endregion
1675
- export { ALGO_REST_API_PROD_URL, 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_WS_STREAMS_PROD_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, PAY_REST_API_PROD_URL, REBATE_REST_API_PROD_URL, RateLimitBanError, RequiredError, 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, ServerError, TimeUnit, TooManyRequestsError, UnauthorizedError, VIP_LOAN_REST_API_PROD_URL, WALLET_REST_API_PROD_URL, WebsocketAPIBase, WebsocketCommon, WebsocketEventEmitter, 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 };
1743
+ export { ALGO_REST_API_PROD_URL, 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, PAY_REST_API_PROD_URL, REBATE_REST_API_PROD_URL, RateLimitBanError, RequiredError, 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, ServerError, TimeUnit, TooManyRequestsError, UnauthorizedError, VIP_LOAN_REST_API_PROD_URL, WALLET_REST_API_PROD_URL, WebsocketAPIBase, WebsocketCommon, WebsocketEventEmitter, 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 };
1676
1744
  //# sourceMappingURL=index.mjs.map