@binance/common 1.2.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2,6 +2,7 @@
2
2
  import crypto from "crypto";
3
3
  import fs from "fs";
4
4
  import https from "https";
5
+ import { JSONParse } from "json-with-bigint";
5
6
  import { platform, arch } from "os";
6
7
  import globalAxios from "axios";
7
8
  var signerCache = /* @__PURE__ */ new WeakMap();
@@ -179,7 +180,7 @@ var httpRequestFunction = async function(axiosArgs, configuration) {
179
180
  return {
180
181
  data: async () => {
181
182
  try {
182
- return JSON.parse(response.data);
183
+ return JSONParse(response.data);
183
184
  } catch (err) {
184
185
  throw new Error(`Failed to parse JSON response: ${err}`);
185
186
  }
@@ -205,7 +206,7 @@ var httpRequestFunction = async function(axiosArgs, configuration) {
205
206
  if (responseData && responseData !== null) {
206
207
  if (typeof responseData === "string" && responseData !== "")
207
208
  try {
208
- data = JSON.parse(responseData);
209
+ data = JSONParse(responseData);
209
210
  } catch {
210
211
  data = {};
211
212
  }
@@ -663,6 +664,7 @@ var Logger = class _Logger {
663
664
  // src/websocket.ts
664
665
  import { EventEmitter } from "events";
665
666
  import WebSocketClient from "ws";
667
+ import { JSONParse as JSONParse2 } from "json-with-bigint";
666
668
  var WebsocketEventEmitter = class {
667
669
  constructor() {
668
670
  this.eventEmitter = new EventEmitter();
@@ -1224,7 +1226,7 @@ var WebsocketAPIBase = class extends WebsocketCommon {
1224
1226
  */
1225
1227
  onMessage(data, connection) {
1226
1228
  try {
1227
- const message = JSON.parse(data);
1229
+ const message = JSONParse2(data);
1228
1230
  const { id, status } = message;
1229
1231
  if (id && connection.pendingRequests.has(id)) {
1230
1232
  const request = connection.pendingRequests.get(id);
@@ -1412,7 +1414,7 @@ var WebsocketStreamsBase = class extends WebsocketCommon {
1412
1414
  */
1413
1415
  onMessage(data, connection) {
1414
1416
  try {
1415
- const parsedData = JSON.parse(data);
1417
+ const parsedData = JSONParse2(data);
1416
1418
  const streamName = parsedData?.stream;
1417
1419
  if (streamName && this.streamCallbackMap.has(streamName))
1418
1420
  this.streamCallbackMap.get(streamName)?.forEach((callback) => callback(parsedData.data));