@binance/common 1.2.4 → 1.2.6
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 +16 -27
- package/dist/index.d.ts +16 -27
- package/dist/index.js +24 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -34
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -10,7 +10,6 @@ declare const TimeUnit: {
|
|
|
10
10
|
};
|
|
11
11
|
type TimeUnit = (typeof TimeUnit)[keyof typeof TimeUnit];
|
|
12
12
|
declare const ALGO_REST_API_PROD_URL = "https://api.binance.com";
|
|
13
|
-
declare const AUTO_INVEST_REST_API_PROD_URL = "https://api.binance.com";
|
|
14
13
|
declare const C2C_REST_API_PROD_URL = "https://api.binance.com";
|
|
15
14
|
declare const CONVERT_REST_API_PROD_URL = "https://api.binance.com";
|
|
16
15
|
declare const COPY_TRADING_REST_API_PROD_URL = "https://api.binance.com";
|
|
@@ -506,12 +505,16 @@ interface RequestArgs {
|
|
|
506
505
|
*/
|
|
507
506
|
declare const clearSignerCache: () => void;
|
|
508
507
|
/**
|
|
509
|
-
*
|
|
508
|
+
* Builds a URL query string from the given parameters object.
|
|
510
509
|
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
510
|
+
* Iterates over the key-value pairs in the `params` object, serializes each value,
|
|
511
|
+
* and encodes it for use in a URL. Only keys with non-null and non-undefined values
|
|
512
|
+
* are included in the resulting query string.
|
|
513
|
+
*
|
|
514
|
+
* @param params - An object containing key-value pairs to be serialized into a query string.
|
|
515
|
+
* @returns A URL-encoded query string representing the provided parameters.
|
|
513
516
|
*/
|
|
514
|
-
declare function buildQueryString(params:
|
|
517
|
+
declare function buildQueryString(params: Record<string, unknown>): string;
|
|
515
518
|
/**
|
|
516
519
|
* Generates a random string of 16 hexadecimal characters.
|
|
517
520
|
*
|
|
@@ -550,7 +553,7 @@ declare const getSignature: (configuration: {
|
|
|
550
553
|
apiSecret?: string;
|
|
551
554
|
privateKey?: string | Buffer;
|
|
552
555
|
privateKeyPassphrase?: string;
|
|
553
|
-
}, queryParams:
|
|
556
|
+
}, queryParams: Record<string, unknown>) => string;
|
|
554
557
|
/**
|
|
555
558
|
* Asserts that a function parameter exists and is not null or undefined.
|
|
556
559
|
*
|
|
@@ -561,28 +564,14 @@ declare const getSignature: (configuration: {
|
|
|
561
564
|
*/
|
|
562
565
|
declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
|
|
563
566
|
/**
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
* It supports different types of parameters:
|
|
568
|
-
* - Arrays can be stringified or recursively added
|
|
569
|
-
* - Objects are flattened with dot notation keys
|
|
570
|
-
* - Primitive values are converted to strings
|
|
571
|
-
*
|
|
572
|
-
* @param urlSearchParams The URLSearchParams object to modify
|
|
573
|
-
* @param parameter The parameter to flatten (can be an object, array, or primitive)
|
|
574
|
-
* @param key Optional key for nested parameters, used for creating dot-notation keys
|
|
575
|
-
*/
|
|
576
|
-
declare function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: unknown, key?: string): void;
|
|
577
|
-
/**
|
|
578
|
-
* Sets the search parameters of the provided URL by flattening the given objects into the URL's search parameters.
|
|
579
|
-
*
|
|
580
|
-
* This function takes a URL and one or more objects, and updates the URL's search parameters by flattening the objects into key-value pairs. It uses the `setFlattenedQueryParams` function to recursively flatten the objects.
|
|
567
|
+
* Sets the search parameters of a given URL object based on the provided key-value pairs.
|
|
568
|
+
* Only parameters with non-null and non-undefined values are included.
|
|
569
|
+
* Values are serialized using the `serializeValue` function before being set.
|
|
581
570
|
*
|
|
582
|
-
* @param url - The URL
|
|
583
|
-
* @param
|
|
571
|
+
* @param url - The URL object whose search parameters will be updated.
|
|
572
|
+
* @param params - An object containing key-value pairs to be set as search parameters.
|
|
584
573
|
*/
|
|
585
|
-
declare
|
|
574
|
+
declare function setSearchParams(url: URL, params: Record<string, unknown>): void;
|
|
586
575
|
/**
|
|
587
576
|
* Converts a URL object to a full path string, including pathname, search parameters, and hash.
|
|
588
577
|
*
|
|
@@ -1083,4 +1072,4 @@ interface WebsocketStream<T> {
|
|
|
1083
1072
|
*/
|
|
1084
1073
|
declare function createStreamHandler<T>(websocketBase: WebsocketAPIBase | WebsocketStreamsBase, streamOrId: string, id?: string): WebsocketStream<T>;
|
|
1085
1074
|
|
|
1086
|
-
export { ALGO_REST_API_PROD_URL,
|
|
1075
|
+
export { ALGO_REST_API_PROD_URL, type 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_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, type ObjectType, PAY_REST_API_PROD_URL, REBATE_REST_API_PROD_URL, RateLimitBanError, type RequestArgs, RequiredError, type RestApiRateLimit, type 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, type SendMessageOptions, ServerError, TimeUnit, type TimerRecord, TooManyRequestsError, UnauthorizedError, VIP_LOAN_REST_API_PROD_URL, WALLET_REST_API_PROD_URL, WebsocketAPIBase, type WebsocketApiRateLimit, type WebsocketApiResponse, WebsocketCommon, type WebsocketConnection, WebsocketEventEmitter, type WebsocketSendMsgConfig, type WebsocketSendMsgOptions, type WebsocketStream, WebsocketStreamsBase, assertParamExists, buildQueryString, buildUserAgent, buildWebsocketAPIMessage, clearSignerCache, createStreamHandler, delay, getSignature, getTimestamp, httpRequestFunction, normalizeScientificNumbers, parseCustomHeaders, parseRateLimitHeaders, randomString, removeEmptyValue, replaceWebsocketStreamsPlaceholders, sanitizeHeaderValue, sendRequest, setSearchParams, shouldRetryRequest, sortObject, toPathString, validateTimeUnit };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ declare const TimeUnit: {
|
|
|
10
10
|
};
|
|
11
11
|
type TimeUnit = (typeof TimeUnit)[keyof typeof TimeUnit];
|
|
12
12
|
declare const ALGO_REST_API_PROD_URL = "https://api.binance.com";
|
|
13
|
-
declare const AUTO_INVEST_REST_API_PROD_URL = "https://api.binance.com";
|
|
14
13
|
declare const C2C_REST_API_PROD_URL = "https://api.binance.com";
|
|
15
14
|
declare const CONVERT_REST_API_PROD_URL = "https://api.binance.com";
|
|
16
15
|
declare const COPY_TRADING_REST_API_PROD_URL = "https://api.binance.com";
|
|
@@ -506,12 +505,16 @@ interface RequestArgs {
|
|
|
506
505
|
*/
|
|
507
506
|
declare const clearSignerCache: () => void;
|
|
508
507
|
/**
|
|
509
|
-
*
|
|
508
|
+
* Builds a URL query string from the given parameters object.
|
|
510
509
|
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
510
|
+
* Iterates over the key-value pairs in the `params` object, serializes each value,
|
|
511
|
+
* and encodes it for use in a URL. Only keys with non-null and non-undefined values
|
|
512
|
+
* are included in the resulting query string.
|
|
513
|
+
*
|
|
514
|
+
* @param params - An object containing key-value pairs to be serialized into a query string.
|
|
515
|
+
* @returns A URL-encoded query string representing the provided parameters.
|
|
513
516
|
*/
|
|
514
|
-
declare function buildQueryString(params:
|
|
517
|
+
declare function buildQueryString(params: Record<string, unknown>): string;
|
|
515
518
|
/**
|
|
516
519
|
* Generates a random string of 16 hexadecimal characters.
|
|
517
520
|
*
|
|
@@ -550,7 +553,7 @@ declare const getSignature: (configuration: {
|
|
|
550
553
|
apiSecret?: string;
|
|
551
554
|
privateKey?: string | Buffer;
|
|
552
555
|
privateKeyPassphrase?: string;
|
|
553
|
-
}, queryParams:
|
|
556
|
+
}, queryParams: Record<string, unknown>) => string;
|
|
554
557
|
/**
|
|
555
558
|
* Asserts that a function parameter exists and is not null or undefined.
|
|
556
559
|
*
|
|
@@ -561,28 +564,14 @@ declare const getSignature: (configuration: {
|
|
|
561
564
|
*/
|
|
562
565
|
declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
|
|
563
566
|
/**
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
* It supports different types of parameters:
|
|
568
|
-
* - Arrays can be stringified or recursively added
|
|
569
|
-
* - Objects are flattened with dot notation keys
|
|
570
|
-
* - Primitive values are converted to strings
|
|
571
|
-
*
|
|
572
|
-
* @param urlSearchParams The URLSearchParams object to modify
|
|
573
|
-
* @param parameter The parameter to flatten (can be an object, array, or primitive)
|
|
574
|
-
* @param key Optional key for nested parameters, used for creating dot-notation keys
|
|
575
|
-
*/
|
|
576
|
-
declare function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: unknown, key?: string): void;
|
|
577
|
-
/**
|
|
578
|
-
* Sets the search parameters of the provided URL by flattening the given objects into the URL's search parameters.
|
|
579
|
-
*
|
|
580
|
-
* This function takes a URL and one or more objects, and updates the URL's search parameters by flattening the objects into key-value pairs. It uses the `setFlattenedQueryParams` function to recursively flatten the objects.
|
|
567
|
+
* Sets the search parameters of a given URL object based on the provided key-value pairs.
|
|
568
|
+
* Only parameters with non-null and non-undefined values are included.
|
|
569
|
+
* Values are serialized using the `serializeValue` function before being set.
|
|
581
570
|
*
|
|
582
|
-
* @param url - The URL
|
|
583
|
-
* @param
|
|
571
|
+
* @param url - The URL object whose search parameters will be updated.
|
|
572
|
+
* @param params - An object containing key-value pairs to be set as search parameters.
|
|
584
573
|
*/
|
|
585
|
-
declare
|
|
574
|
+
declare function setSearchParams(url: URL, params: Record<string, unknown>): void;
|
|
586
575
|
/**
|
|
587
576
|
* Converts a URL object to a full path string, including pathname, search parameters, and hash.
|
|
588
577
|
*
|
|
@@ -1083,4 +1072,4 @@ interface WebsocketStream<T> {
|
|
|
1083
1072
|
*/
|
|
1084
1073
|
declare function createStreamHandler<T>(websocketBase: WebsocketAPIBase | WebsocketStreamsBase, streamOrId: string, id?: string): WebsocketStream<T>;
|
|
1085
1074
|
|
|
1086
|
-
export { ALGO_REST_API_PROD_URL,
|
|
1075
|
+
export { ALGO_REST_API_PROD_URL, type 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_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, type ObjectType, PAY_REST_API_PROD_URL, REBATE_REST_API_PROD_URL, RateLimitBanError, type RequestArgs, RequiredError, type RestApiRateLimit, type 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, type SendMessageOptions, ServerError, TimeUnit, type TimerRecord, TooManyRequestsError, UnauthorizedError, VIP_LOAN_REST_API_PROD_URL, WALLET_REST_API_PROD_URL, WebsocketAPIBase, type WebsocketApiRateLimit, type WebsocketApiResponse, WebsocketCommon, type WebsocketConnection, WebsocketEventEmitter, type WebsocketSendMsgConfig, type WebsocketSendMsgOptions, type WebsocketStream, WebsocketStreamsBase, assertParamExists, buildQueryString, buildUserAgent, buildWebsocketAPIMessage, clearSignerCache, createStreamHandler, delay, getSignature, getTimestamp, httpRequestFunction, normalizeScientificNumbers, parseCustomHeaders, parseRateLimitHeaders, randomString, removeEmptyValue, replaceWebsocketStreamsPlaceholders, sanitizeHeaderValue, sendRequest, setSearchParams, shouldRetryRequest, sortObject, toPathString, validateTimeUnit };
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
ALGO_REST_API_PROD_URL: () => ALGO_REST_API_PROD_URL,
|
|
34
|
-
AUTO_INVEST_REST_API_PROD_URL: () => AUTO_INVEST_REST_API_PROD_URL,
|
|
35
34
|
BadRequestError: () => BadRequestError,
|
|
36
35
|
C2C_REST_API_PROD_URL: () => C2C_REST_API_PROD_URL,
|
|
37
36
|
CONVERT_REST_API_PROD_URL: () => CONVERT_REST_API_PROD_URL,
|
|
@@ -117,7 +116,6 @@ __export(index_exports, {
|
|
|
117
116
|
replaceWebsocketStreamsPlaceholders: () => replaceWebsocketStreamsPlaceholders,
|
|
118
117
|
sanitizeHeaderValue: () => sanitizeHeaderValue,
|
|
119
118
|
sendRequest: () => sendRequest,
|
|
120
|
-
setFlattenedQueryParams: () => setFlattenedQueryParams,
|
|
121
119
|
setSearchParams: () => setSearchParams,
|
|
122
120
|
shouldRetryRequest: () => shouldRetryRequest,
|
|
123
121
|
sortObject: () => sortObject,
|
|
@@ -178,13 +176,22 @@ var RequestSigner = class {
|
|
|
178
176
|
var clearSignerCache = function() {
|
|
179
177
|
signerCache = /* @__PURE__ */ new WeakMap();
|
|
180
178
|
};
|
|
179
|
+
function serializeValue(value) {
|
|
180
|
+
if (value === null || value === void 0) return "";
|
|
181
|
+
if (Array.isArray(value) || typeof value === "object" && value !== null)
|
|
182
|
+
return JSON.stringify(value);
|
|
183
|
+
return String(value);
|
|
184
|
+
}
|
|
181
185
|
function buildQueryString(params) {
|
|
182
186
|
if (!params) return "";
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
const pairs = [];
|
|
188
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
189
|
+
if (value !== null && value !== void 0) {
|
|
190
|
+
const serializedValue = serializeValue(value);
|
|
191
|
+
pairs.push(`${key}=${encodeURIComponent(serializedValue)}`);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
return pairs.join("&");
|
|
188
195
|
}
|
|
189
196
|
function randomString() {
|
|
190
197
|
return import_crypto.default.randomBytes(16).toString("hex");
|
|
@@ -219,34 +226,16 @@ var assertParamExists = function(functionName, paramName, paramValue) {
|
|
|
219
226
|
);
|
|
220
227
|
}
|
|
221
228
|
};
|
|
222
|
-
function
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
for (const item of parameter) {
|
|
229
|
-
setFlattenedQueryParams(urlSearchParams, item, "");
|
|
230
|
-
}
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
if (typeof parameter === "object") {
|
|
234
|
-
for (const subKey of Object.keys(parameter)) {
|
|
235
|
-
const subVal = parameter[subKey];
|
|
236
|
-
const newKey = key ? `${key}.${subKey}` : subKey;
|
|
237
|
-
setFlattenedQueryParams(urlSearchParams, subVal, newKey);
|
|
229
|
+
function setSearchParams(url, params) {
|
|
230
|
+
const searchParams = new URLSearchParams();
|
|
231
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
232
|
+
if (value !== null && value !== void 0) {
|
|
233
|
+
const serializedValue = serializeValue(value);
|
|
234
|
+
searchParams.set(key, serializedValue);
|
|
238
235
|
}
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
const str = String(parameter);
|
|
242
|
-
if (urlSearchParams.has(key)) urlSearchParams.append(key, str);
|
|
243
|
-
else urlSearchParams.set(key, str);
|
|
244
|
-
}
|
|
245
|
-
var setSearchParams = function(url, ...objects) {
|
|
246
|
-
const searchParams = new URLSearchParams(url.search);
|
|
247
|
-
setFlattenedQueryParams(searchParams, objects);
|
|
236
|
+
});
|
|
248
237
|
url.search = searchParams.toString();
|
|
249
|
-
}
|
|
238
|
+
}
|
|
250
239
|
var toPathString = function(url) {
|
|
251
240
|
return url.pathname + url.search + url.hash;
|
|
252
241
|
};
|
|
@@ -617,7 +606,6 @@ var TimeUnit = {
|
|
|
617
606
|
microsecond: "microsecond"
|
|
618
607
|
};
|
|
619
608
|
var ALGO_REST_API_PROD_URL = "https://api.binance.com";
|
|
620
|
-
var AUTO_INVEST_REST_API_PROD_URL = "https://api.binance.com";
|
|
621
609
|
var C2C_REST_API_PROD_URL = "https://api.binance.com";
|
|
622
610
|
var CONVERT_REST_API_PROD_URL = "https://api.binance.com";
|
|
623
611
|
var COPY_TRADING_REST_API_PROD_URL = "https://api.binance.com";
|
|
@@ -1089,6 +1077,7 @@ var WebsocketCommon = class _WebsocketCommon extends WebsocketEventEmitter {
|
|
|
1089
1077
|
} else if (targetConnection.closeInitiated) {
|
|
1090
1078
|
this.closeConnectionGracefully(targetConnection.ws, targetConnection);
|
|
1091
1079
|
} else {
|
|
1080
|
+
targetConnection.reconnectionPending = false;
|
|
1092
1081
|
this.emit("open", this);
|
|
1093
1082
|
}
|
|
1094
1083
|
this.sessionReLogon(targetConnection);
|
|
@@ -1202,6 +1191,7 @@ var WebsocketCommon = class _WebsocketCommon extends WebsocketEventEmitter {
|
|
|
1202
1191
|
ws.on("close", (closeEventCode, reason) => {
|
|
1203
1192
|
this.emit("close", closeEventCode, reason);
|
|
1204
1193
|
if (!targetConnection.closeInitiated && !isRenewal) {
|
|
1194
|
+
this.cleanup(ws);
|
|
1205
1195
|
this.logger.warn(
|
|
1206
1196
|
`Connection with id ${targetConnection.id} closed due to ${closeEventCode}: ${reason}`
|
|
1207
1197
|
);
|
|
@@ -1680,7 +1670,6 @@ function createStreamHandler(websocketBase, streamOrId, id) {
|
|
|
1680
1670
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1681
1671
|
0 && (module.exports = {
|
|
1682
1672
|
ALGO_REST_API_PROD_URL,
|
|
1683
|
-
AUTO_INVEST_REST_API_PROD_URL,
|
|
1684
1673
|
BadRequestError,
|
|
1685
1674
|
C2C_REST_API_PROD_URL,
|
|
1686
1675
|
CONVERT_REST_API_PROD_URL,
|
|
@@ -1766,7 +1755,6 @@ function createStreamHandler(websocketBase, streamOrId, id) {
|
|
|
1766
1755
|
replaceWebsocketStreamsPlaceholders,
|
|
1767
1756
|
sanitizeHeaderValue,
|
|
1768
1757
|
sendRequest,
|
|
1769
|
-
setFlattenedQueryParams,
|
|
1770
1758
|
setSearchParams,
|
|
1771
1759
|
shouldRetryRequest,
|
|
1772
1760
|
sortObject,
|