@dorafactory/maci-sdk 0.1.3-pre.8 → 0.1.3-pre.9

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.ts CHANGED
@@ -5,6 +5,6 @@ export * from './libs/crypto';
5
5
  export * from './types';
6
6
  export type * from './types';
7
7
  export { circuits, getDefaultParams, type NetworkConfig } from './libs/const';
8
- export { stringizing, bigInt2Buffer } from './libs/crypto/bigintUtils';
8
+ export { stringizing, destringizing, bigInt2Buffer, } from './libs/crypto/bigintUtils';
9
9
  export { isValidAddress } from './utils';
10
10
  export { getAMaciRoundCircuitFee } from './libs/contract/utils';
package/dist/index.js CHANGED
@@ -49,7 +49,9 @@ __export(index_exports, {
49
49
  UserAccount: () => UserAccount,
50
50
  batchGenMessage: () => batchGenMessage,
51
51
  bigInt2Buffer: () => bigInt2Buffer,
52
+ buffer2Bigint: () => buffer2Bigint,
52
53
  circuits: () => circuits,
54
+ destringizing: () => destringizing,
53
55
  formatPrivKeyForBabyJub: () => formatPrivKeyForBabyJub,
54
56
  genAddKeyInput: () => genAddKeyInput,
55
57
  genEcdhSharedKey: () => genEcdhSharedKey,
@@ -565,6 +567,28 @@ var bigInt2Buffer = (i) => {
565
567
  }
566
568
  return Buffer.from(hex, "hex");
567
569
  };
570
+ var buffer2Bigint = (buffer) => {
571
+ const buf = Buffer.isBuffer(buffer) ? buffer : Buffer.from(buffer);
572
+ const hex = buf.toString("hex");
573
+ return BigInt("0x" + hex);
574
+ };
575
+ var destringizing = (o, path = []) => {
576
+ if (path.includes(o)) {
577
+ throw new Error("loop nesting!");
578
+ }
579
+ const newPath = [...path, o];
580
+ if (Array.isArray(o)) {
581
+ return o.map((item) => destringizing(item, newPath));
582
+ } else if (typeof o === "object" && o !== null) {
583
+ const output = {};
584
+ for (const key in o) {
585
+ output[key] = destringizing(o[key], newPath);
586
+ }
587
+ return output;
588
+ } else {
589
+ return BigInt(o);
590
+ }
591
+ };
568
592
 
569
593
  // src/libs/crypto/keys.ts
570
594
  var import_poseidon_cipher2 = require("@zk-kit/poseidon-cipher");
@@ -8571,7 +8595,9 @@ var MaciClient2 = class {
8571
8595
  UserAccount,
8572
8596
  batchGenMessage,
8573
8597
  bigInt2Buffer,
8598
+ buffer2Bigint,
8574
8599
  circuits,
8600
+ destringizing,
8575
8601
  formatPrivKeyForBabyJub,
8576
8602
  genAddKeyInput,
8577
8603
  genEcdhSharedKey,