@lukso/transaction-decoder 1.3.3 → 1.3.4-dev.ba618e9

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/browser.cjs CHANGED
@@ -6792,7 +6792,36 @@ var JSONbigString = {
6792
6792
  }
6793
6793
  return value;
6794
6794
  });
6795
- }, "parse")
6795
+ }, "parse"),
6796
+ /**
6797
+ * Read an object and convert BigInt string values to actual BigInts
6798
+ * Walks through the object hierarchy looking for strings ending with 'n'
6799
+ * Also passes through existing BigInt values unchanged
6800
+ */
6801
+ read: /* @__PURE__ */ __name((obj) => {
6802
+ if (obj === null || obj === void 0) {
6803
+ return obj;
6804
+ }
6805
+ if (typeof obj === "bigint") {
6806
+ return obj;
6807
+ }
6808
+ if (typeof obj === "string" && /^\d+n$/.test(obj)) {
6809
+ return BigInt(obj.slice(0, -1));
6810
+ }
6811
+ if (Array.isArray(obj)) {
6812
+ return obj.map((item) => JSONbigString.read(item));
6813
+ }
6814
+ if (typeof obj === "object") {
6815
+ const result = {};
6816
+ for (const key in obj) {
6817
+ if (Object.hasOwn(obj, key)) {
6818
+ result[key] = JSONbigString.read(obj[key]);
6819
+ }
6820
+ }
6821
+ return result;
6822
+ }
6823
+ return obj;
6824
+ }, "read")
6796
6825
  };
6797
6826
 
6798
6827
  // src/index.ts