@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/index.d.cts CHANGED
@@ -721,6 +721,12 @@ declare const JSONbigString: {
721
721
  * Parse a JSON string, converting strings ending with 'n' back to BigInt
722
722
  */
723
723
  parse: (text: string) => any;
724
+ /**
725
+ * Read an object and convert BigInt string values to actual BigInts
726
+ * Walks through the object hierarchy looking for strings ending with 'n'
727
+ * Also passes through existing BigInt values unchanged
728
+ */
729
+ read: (obj: any) => any;
724
730
  };
725
731
 
726
732
  declare const getTransaction: (jsonTransaction: unknown) => _preact_signals_core.Signal<TransactionState> | undefined;
package/dist/index.d.ts CHANGED
@@ -721,6 +721,12 @@ declare const JSONbigString: {
721
721
  * Parse a JSON string, converting strings ending with 'n' back to BigInt
722
722
  */
723
723
  parse: (text: string) => any;
724
+ /**
725
+ * Read an object and convert BigInt string values to actual BigInts
726
+ * Walks through the object hierarchy looking for strings ending with 'n'
727
+ * Also passes through existing BigInt values unchanged
728
+ */
729
+ read: (obj: any) => any;
724
730
  };
725
731
 
726
732
  declare const getTransaction: (jsonTransaction: unknown) => _preact_signals_core.Signal<TransactionState> | undefined;
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  parseLSP23DeploymentsFromHypersync,
36
36
  resolveAddresses,
37
37
  subscribe
38
- } from "./chunk-Z2373EJ6.js";
38
+ } from "./chunk-SSY7TTU2.js";
39
39
  import {
40
40
  consumerModel,
41
41
  createGlobalInstance,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukso/transaction-decoder",
3
- "version": "1.3.3",
3
+ "version": "1.3.4-dev.ba618e9",
4
4
  "description": "Transaction decoder for LUKSO blockchain with reactive state management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -51,10 +51,10 @@
51
51
  "graphql-request": "^7.4.0",
52
52
  "graphql-ws": "^6.0.6",
53
53
  "lru-cache": "^11.2.4",
54
- "viem": "^2.43.1"
54
+ "viem": "^2.43.3"
55
55
  },
56
56
  "devDependencies": {
57
- "@biomejs/biome": "^2.3.9",
57
+ "@biomejs/biome": "^2.3.10",
58
58
  "@types/debug": "^4.1.12",
59
59
  "@types/node": "^25.0.3",
60
60
  "tsup": "^8.5.1",
@@ -42,6 +42,46 @@ export const JSONbigString = {
42
42
  return value
43
43
  })
44
44
  },
45
+
46
+ /**
47
+ * Read an object and convert BigInt string values to actual BigInts
48
+ * Walks through the object hierarchy looking for strings ending with 'n'
49
+ * Also passes through existing BigInt values unchanged
50
+ */
51
+ read: (obj: any): any => {
52
+ if (obj === null || obj === undefined) {
53
+ return obj
54
+ }
55
+
56
+ // Pass through BigInt values as-is
57
+ if (typeof obj === 'bigint') {
58
+ return obj
59
+ }
60
+
61
+ // Handle string values that look like BigInt (e.g., "123n")
62
+ if (typeof obj === 'string' && /^\d+n$/.test(obj)) {
63
+ return BigInt(obj.slice(0, -1))
64
+ }
65
+
66
+ // Handle arrays
67
+ if (Array.isArray(obj)) {
68
+ return obj.map((item) => JSONbigString.read(item))
69
+ }
70
+
71
+ // Handle objects
72
+ if (typeof obj === 'object') {
73
+ const result: any = {}
74
+ for (const key in obj) {
75
+ if (Object.hasOwn(obj, key)) {
76
+ result[key] = JSONbigString.read(obj[key])
77
+ }
78
+ }
79
+ return result
80
+ }
81
+
82
+ // Return other primitives as-is (numbers, booleans, etc.)
83
+ return obj
84
+ },
45
85
  }
46
86
 
47
87
  export default JSONbigString