postchain-client 1.3.1 → 1.3.2

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.
@@ -2151,9 +2151,21 @@ function nextEndpoint(endpointPool) {
2151
2151
  return endpointPool[Math.floor(Math.random() * endpointPool.length)];
2152
2152
  }
2153
2153
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
2154
+ function convertToPrintable(responseObject) {
2155
+ if (typeof responseObject === "bigint") {
2156
+ return responseObject + "n";
2157
+ }
2158
+ else if (typeof responseObject === "object") {
2159
+ return JSON.stringify(responseObject, (key, value) => typeof value === "bigint" ? value + "n" : value);
2160
+ }
2161
+ else {
2162
+ return responseObject;
2163
+ }
2164
+ }
2154
2165
 
2155
2166
  var restclientutil = /*#__PURE__*/Object.freeze({
2156
2167
  __proto__: null,
2168
+ convertToPrintable: convertToPrintable,
2157
2169
  getBrid: getBrid,
2158
2170
  nextEndpoint: nextEndpoint,
2159
2171
  requestWithRetry: requestWithRetry,
@@ -2307,9 +2319,7 @@ function validateInput(endpointPool, failOverConfig) {
2307
2319
  */
2308
2320
  function handleGetResponse(error$1, statusCode, responseObject, callback) {
2309
2321
  try {
2310
- const responseObjectPrintable = typeof responseObject === "object"
2311
- ? JSON.stringify(responseObject)
2312
- : responseObject;
2322
+ const responseObjectPrintable = convertToPrintable(responseObject);
2313
2323
  debug(`error: ${error$1}, status code: ${statusCode}, response body: ${responseObjectPrintable}`);
2314
2324
  if (error$1) {
2315
2325
  callback(error$1, null);
@@ -2338,9 +2348,7 @@ function handleGetResponse(error$1, statusCode, responseObject, callback) {
2338
2348
  * @param callback the callback function to propagate the error and response back to the caller
2339
2349
  */
2340
2350
  function handlePostResponse(error$1, statusCode, responseObject, callback) {
2341
- const responseObjectPrintable = typeof responseObject === "object"
2342
- ? JSON.stringify(responseObject)
2343
- : responseObject;
2351
+ const responseObjectPrintable = convertToPrintable(responseObject);
2344
2352
  debug(`error: ${error$1}, status code: ${statusCode}, response body: ${responseObjectPrintable}`);
2345
2353
  try {
2346
2354
  if (error$1) {