@mentaproject/client 0.0.7 → 0.0.8

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.
@@ -1,11 +1,12 @@
1
1
  function isClassInstance(obj) {
2
- if (obj === null || typeof obj !== 'object' || !obj.constructor) {
2
+ if (!obj)
3
+ return false;
4
+ const constructor = obj.constructor;
5
+ const nativeConstructors = [Array, Date, RegExp, Map, Set, Promise, Function, Number, String, Boolean, Error, Object];
6
+ if (nativeConstructors.includes(constructor)) {
3
7
  return false;
4
8
  }
5
- // Les constructeurs de classes ES6 commencent par "class " quand on les convertit en string.
6
- // Attention: cela peut être sensible à la minification ou à des transpilers très spécifiques,
7
- // mais c'est généralement fiable pour les classes définies avec le mot-clé `class`.
8
- return obj.constructor.toString().startsWith('class ');
9
+ return true;
9
10
  }
10
11
  ;
11
12
  function convertBigintsToStrings(obj) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mentaproject/client",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "High level EVM library used into the Menta App to facilitate Blockchain interactions. ",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/test.ts CHANGED
@@ -15,7 +15,7 @@ const client = new MentaClient({
15
15
 
16
16
  (async () => {
17
17
  const firstTx = await client.transactions.get({ hash: "0xeae261aeada2db19fee5cc4dfd47d575ff2380a5fb6a4039685d5044fdc8e2bb" });
18
- const json = await firstTx.toJSON();
18
+ const json = await firstTx.toJSON(3);
19
19
 
20
20
  writeFileSync("./test.json", JSON.stringify(json, null, 2));
21
21
  })()