@solarity/zkit 0.1.0 → 0.2.0

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.
@@ -31,70 +31,42 @@ const ejs_1 = __importDefault(require("ejs"));
31
31
  const fs_1 = __importDefault(require("fs"));
32
32
  const path_1 = __importDefault(require("path"));
33
33
  const snarkjs = __importStar(require("snarkjs"));
34
- const config_1 = require("../config/config");
35
- const utils_1 = require("../utils/utils");
36
- const { CircomRunner, bindings } = require("@distributedlab/circom2");
37
34
  /**
38
35
  * `CircuitZKit` represents a single circuit and provides a high-level API to work with it.
39
- *
40
- * @dev This class is not meant to be used directly. Use the `CircomZKit` to create its instance.
41
36
  */
42
37
  class CircuitZKit {
43
- _circuit;
44
- _manager;
45
- /**
46
- * Creates a new instance of `CircuitZKit`.
47
- *
48
- * @param {string} _circuit - The path to the circuit.
49
- * @param {ManagerZKit} _manager - The manager that maintains the global state.
50
- */
51
- constructor(_circuit, _manager) {
52
- this._circuit = _circuit;
53
- this._manager = _manager;
38
+ _config;
39
+ constructor(_config) {
40
+ this._config = _config;
54
41
  }
55
42
  /**
56
- * Compiles the circuit and generates the artifacts.
43
+ * Returns the Solidity verifier template for the specified proving system.
57
44
  *
58
- * @dev If compilation fails, the latest valid artifacts will be preserved.
59
- * @dev Doesn't show the compilation error if `quiet` is set to `true`.
60
- *
61
- * @param {Partial<CompileOptions>} [options=defaultCompileOptions] - Compilation options.
45
+ * @param {VerifierTemplateType} templateType - The template type.
46
+ * @returns {string} The Solidity verifier template.
62
47
  */
63
- async compile(options = config_1.defaultCompileOptions) {
64
- const tempDir = this._manager.getTempDir();
65
- try {
66
- const artifactDir = this._getDir("artifact");
67
- fs_1.default.mkdirSync(tempDir, { recursive: true });
68
- const overriddenOptions = { ...config_1.defaultCompileOptions, ...options };
69
- await this._compile(overriddenOptions, tempDir);
70
- await this._generateZKey(tempDir);
71
- await this._generateVKey(tempDir);
72
- this._moveFromTempDirToOutDir(tempDir, artifactDir);
73
- }
74
- finally {
75
- fs_1.default.rmSync(tempDir, { recursive: true, force: true });
48
+ static getTemplate(templateType) {
49
+ switch (templateType) {
50
+ case "groth16":
51
+ return fs_1.default.readFileSync(path_1.default.join(__dirname, "templates", "verifier_groth16.sol.ejs"), "utf8");
52
+ default:
53
+ throw new Error(`Ambiguous template type: ${templateType}.`);
76
54
  }
77
55
  }
78
56
  /**
79
- * Creates a verifier contract.
57
+ * Creates a Solidity verifier contract.
80
58
  */
81
59
  async createVerifier() {
82
- const tempDir = this._manager.getTempDir();
83
- try {
84
- const verifierDir = this._getDir("verifier");
85
- fs_1.default.mkdirSync(tempDir, { recursive: true });
86
- const vKeyFile = this._mustGetFile("vkey");
87
- const verifierFile = this._getFile("sol", tempDir);
88
- const groth16Template = this._manager.getTemplate("groth16");
89
- const templateParams = JSON.parse(fs_1.default.readFileSync(vKeyFile, "utf-8"));
90
- templateParams["verifier_id"] = this.getVerifierId();
91
- const verifierCode = ejs_1.default.render(groth16Template, templateParams);
92
- fs_1.default.writeFileSync(verifierFile, verifierCode, "utf-8");
93
- this._moveFromTempDirToOutDir(tempDir, verifierDir);
94
- }
95
- finally {
96
- fs_1.default.rmSync(tempDir, { recursive: true, force: true });
60
+ const vKeyFilePath = this.mustGetArtifactsFilePath("vkey");
61
+ const verifierFilePath = path_1.default.join(this._config.verifierDirPath, `${this.getVerifierName()}.sol`);
62
+ const verifierTemplate = CircuitZKit.getTemplate(this.getTemplateType());
63
+ if (!fs_1.default.existsSync(this._config.verifierDirPath)) {
64
+ fs_1.default.mkdirSync(this._config.verifierDirPath, { recursive: true });
97
65
  }
66
+ const templateParams = JSON.parse(fs_1.default.readFileSync(vKeyFilePath, "utf-8"));
67
+ templateParams["verifier_id"] = this.getVerifierName();
68
+ const verifierCode = ejs_1.default.render(verifierTemplate, templateParams);
69
+ fs_1.default.writeFileSync(verifierFilePath, verifierCode, "utf-8");
98
70
  }
99
71
  /**
100
72
  * Generates a proof for the given inputs.
@@ -106,8 +78,8 @@ class CircuitZKit {
106
78
  * @todo Add support for other proving systems.
107
79
  */
108
80
  async generateProof(inputs) {
109
- const zKeyFile = this._mustGetFile("zkey");
110
- const wasmFile = this._mustGetFile("wasm");
81
+ const zKeyFile = this.mustGetArtifactsFilePath("zkey");
82
+ const wasmFile = this.mustGetArtifactsFilePath("wasm");
111
83
  return (await snarkjs.groth16.fullProve(inputs, wasmFile, zKeyFile));
112
84
  }
113
85
  /**
@@ -120,7 +92,7 @@ class CircuitZKit {
120
92
  * @returns {Promise<boolean>} Whether the proof is valid.
121
93
  */
122
94
  async verifyProof(proof) {
123
- const vKeyFile = this._mustGetFile("vkey");
95
+ const vKeyFile = this.mustGetArtifactsFilePath("vkey");
124
96
  const verifier = JSON.parse(fs_1.default.readFileSync(vKeyFile).toString());
125
97
  return await snarkjs.groth16.verify(verifier, proof.publicSignals, proof.proof);
126
98
  }
@@ -136,206 +108,76 @@ class CircuitZKit {
136
108
  return JSON.parse(`[${calldata}]`);
137
109
  }
138
110
  /**
139
- * Returns the circuit ID. The circuit ID is the name of the circuit file without the extension.
140
- *
141
- * @returns {string} The circuit ID.
142
- */
143
- getCircuitId() {
144
- return path_1.default.parse(this._circuit).name;
145
- }
146
- /**
147
- * Returns the verifier ID. The verifier ID is the name of the circuit file without the extension, suffixed with "Verifier".
148
- *
149
- * @returns {string} The verifier ID.
150
- */
151
- getVerifierId() {
152
- return `${path_1.default.parse(this._circuit).name}Verifier`;
153
- }
154
- /**
155
- * Generates zero-knowledge key for the circuit.
156
- *
157
- * @param {string} outDir - The directory to save the generated key.
158
- * @todo This method may cause issues https://github.com/iden3/snarkjs/issues/494
159
- */
160
- async _generateZKey(outDir) {
161
- const r1csFile = this._getFile("r1cs", outDir);
162
- const zKeyFile = this._getFile("zkey", outDir);
163
- const constraints = await this._getConstraints(outDir);
164
- const ptauFile = await this._manager.fetchPtauFile(constraints);
165
- await snarkjs.zKey.newZKey(r1csFile, ptauFile, zKeyFile);
166
- }
167
- /**
168
- * Generates verification key for the circuit.
111
+ * Returns the circuit name. The circuit name is the name of the circuit file without the extension.
169
112
  *
170
- * @param {string} outDir - The directory to save the generated key.
113
+ * @returns {string} The circuit name.
171
114
  */
172
- async _generateVKey(outDir) {
173
- const zKeyFile = this._getFile("zkey", outDir);
174
- const vKeyFile = this._getFile("vkey", outDir);
175
- const vKeyData = await snarkjs.zKey.exportVerificationKey(zKeyFile);
176
- fs_1.default.writeFileSync(vKeyFile, JSON.stringify(vKeyData));
115
+ getCircuitName() {
116
+ return this._config.circuitName;
177
117
  }
178
118
  /**
179
- * Returns the arguments to compile the circuit.
119
+ * Returns the verifier name. The verifier name is the name of the circuit file without the extension, suffixed with "Verifier".
180
120
  *
181
- * @param {CompileOptions} options - Compilation options.
182
- * @param {string} outDir - The directory to save the compiled artifacts.
183
- * @returns {string[]} The arguments to compile the circuit.
121
+ * @returns {string} The verifier name.
184
122
  */
185
- _getCompileArgs(options, outDir) {
186
- let args = [this._circuit, "--r1cs", "--wasm"];
187
- options.sym && args.push("--sym");
188
- options.json && args.push("--json");
189
- options.c && args.push("--c");
190
- args.push("-o", outDir);
191
- return args;
123
+ getVerifierName() {
124
+ return `${this._config.circuitName}Verifier`;
192
125
  }
193
126
  /**
194
- * Compiles the circuit.
127
+ * Returns the type of verifier template that was stored in the config
195
128
  *
196
- * @param {CompileOptions} options - Compilation options.
197
- * @param {string} outDir - The directory to save the compiled artifacts.
129
+ * @returns {VerifierTemplateType} The verifier template type.
198
130
  */
199
- async _compile(options, outDir) {
200
- const args = this._getCompileArgs(options, outDir);
201
- try {
202
- await this._getCircomRunner(args, options.quiet).execute(this._manager.getCompiler());
203
- }
204
- catch (err) {
205
- if (options.quiet) {
206
- throw new Error('Compilation failed with an unknown error. Consider passing "quiet=false" flag to see the compilation error.', { cause: err });
207
- }
208
- throw new Error("Compilation failed.", { cause: err });
209
- }
131
+ getTemplateType() {
132
+ return this._config.templateType ?? "groth16";
210
133
  }
211
134
  /**
212
- * Returns the number of constraints in the circuit. This value is used to fetch the correct `ptau` file.
135
+ * Returns the path to the file of the given type inside artifacts directory. Throws an error if the file doesn't exist.
213
136
  *
214
- * @param {string} outDir - The directory where the compiled artifacts are saved.
215
- * @returns {Promise<number>} The number of constraints in the circuit.
137
+ * @param {ArtifactsFileType} fileType - The type of the file.
138
+ * @returns {string} The path to the file.
216
139
  */
217
- async _getConstraints(outDir) {
218
- const r1csFile = this._getFile("r1cs", outDir);
219
- const r1csDescriptor = fs_1.default.openSync(r1csFile, "r");
220
- const readBytes = (position, length) => {
221
- const buffer = Buffer.alloc(length);
222
- fs_1.default.readSync(r1csDescriptor, buffer, { length, position });
223
- return BigInt(`0x${buffer.reverse().toString("hex")}`);
224
- };
225
- /// @dev https://github.com/iden3/r1csfile/blob/d82959da1f88fbd06db0407051fde94afbf8824a/doc/r1cs_bin_format.md#format-of-the-file
226
- const numberOfSections = readBytes(8, 4);
227
- let sectionStart = 12;
228
- for (let i = 0; i < numberOfSections; ++i) {
229
- const sectionType = Number(readBytes(sectionStart, 4));
230
- const sectionSize = Number(readBytes(sectionStart + 4, 8));
231
- /// @dev Reading header section
232
- if (sectionType == 1) {
233
- const totalConstraintsOffset = 4 + 8 + 4 + 32 + 4 + 4 + 4 + 4 + 8;
234
- return Number(readBytes(sectionStart + totalConstraintsOffset, 4));
235
- }
236
- sectionStart += 4 + 8 + sectionSize;
140
+ mustGetArtifactsFilePath(fileType) {
141
+ const file = this.getArtifactsFilePath(fileType);
142
+ if (!fs_1.default.existsSync(file)) {
143
+ throw new Error(`Expected the file "${file}" to exist`);
237
144
  }
238
- throw new Error("Header section is not found.");
145
+ return file;
239
146
  }
240
147
  /**
241
- * Returns the path to the file of the given type.
148
+ * Returns the path to the file of the given type inside artifacts directory.
242
149
  *
243
- * @param {FileType} fileType - The type of the file.
244
- * @param {string | undefined} temp - The temporary directory to use.
150
+ * @param {ArtifactsFileType} fileType - The type of the file.
245
151
  * @returns {string} The path to the file.
246
152
  */
247
- _getFile(fileType, temp) {
248
- const circuitId = this.getCircuitId();
153
+ getArtifactsFilePath(fileType) {
154
+ const circuitName = this.getCircuitName();
155
+ let fileName;
156
+ let fileDir = this._config.circuitArtifactsPath;
249
157
  switch (fileType) {
250
158
  case "r1cs":
251
- return path_1.default.join(temp ?? this._getDir("artifact"), `${circuitId}.r1cs`);
159
+ fileName = `${circuitName}.r1cs`;
160
+ break;
252
161
  case "zkey":
253
- return path_1.default.join(temp ?? this._getDir("artifact"), `${circuitId}.zkey`);
162
+ fileName = `${circuitName}.zkey`;
163
+ break;
254
164
  case "vkey":
255
- return path_1.default.join(temp ?? this._getDir("artifact"), `${circuitId}.vkey.json`);
165
+ fileName = `${circuitName}.vkey.json`;
166
+ break;
256
167
  case "sym":
257
- return path_1.default.join(temp ?? this._getDir("artifact"), `${circuitId}.sym`);
168
+ fileName = `${circuitName}.sym`;
169
+ break;
258
170
  case "json":
259
- return path_1.default.join(temp ?? this._getDir("artifact"), `${circuitId}.json`);
171
+ fileName = `${circuitName}_constraints.json`;
172
+ break;
260
173
  case "wasm":
261
- return path_1.default.join(temp ?? this._getDir("artifact"), `${circuitId}_js`, `${circuitId}.wasm`);
262
- case "sol":
263
- return path_1.default.join(temp ?? this._getDir("verifier"), `${circuitId}Verifier.sol`);
174
+ fileName = `${circuitName}.wasm`;
175
+ fileDir = path_1.default.join(fileDir, `${circuitName}_js`);
176
+ break;
264
177
  default:
265
178
  throw new Error(`Ambiguous file type: ${fileType}.`);
266
179
  }
267
- }
268
- /**
269
- * Returns the path to the directory of the given type.
270
- *
271
- * @param {DirType} dirType - The type of the directory.
272
- * @returns {string} The path to the directory.
273
- */
274
- _getDir(dirType) {
275
- const circuitRelativePath = path_1.default.relative(this._manager.getCircuitsDir(), this._circuit);
276
- switch (dirType) {
277
- case "circuit":
278
- return path_1.default.join(this._manager.getCircuitsDir(), circuitRelativePath, "..");
279
- case "artifact":
280
- return path_1.default.join(this._manager.getArtifactsDir(), circuitRelativePath);
281
- case "verifier":
282
- return path_1.default.join(this._manager.getVerifiersDir(), circuitRelativePath, "..");
283
- default:
284
- throw new Error(`Ambiguous dir type: ${dirType}.`);
285
- }
286
- }
287
- /**
288
- * Returns the path to the file of the given type. Throws an error if the file doesn't exist.
289
- *
290
- * @param {FileType} fileType - The type of the file.
291
- * @param {string | undefined} temp - The temporary directory to use.
292
- * @returns {string} The path to the file.
293
- */
294
- _mustGetFile(fileType, temp) {
295
- const file = this._getFile(fileType, temp);
296
- if (!fs_1.default.existsSync(file)) {
297
- throw new Error(`Expected the file "${file}" to exist`);
298
- }
299
- return file;
300
- }
301
- /**
302
- * Moves the files from the temporary directory to the output directory.
303
- *
304
- * @param {string} tempDir - The temporary directory.
305
- * @param {string} outDir - The output directory.
306
- */
307
- _moveFromTempDirToOutDir(tempDir, outDir) {
308
- fs_1.default.rmSync(outDir, { recursive: true, force: true });
309
- fs_1.default.mkdirSync(outDir, { recursive: true });
310
- (0, utils_1.readDirRecursively)(tempDir, (dir, file) => {
311
- const correspondingOutDir = path_1.default.join(outDir, path_1.default.relative(tempDir, dir));
312
- const correspondingOutFile = path_1.default.join(outDir, path_1.default.relative(tempDir, file));
313
- if (!fs_1.default.existsSync(correspondingOutDir)) {
314
- fs_1.default.mkdirSync(correspondingOutDir);
315
- }
316
- fs_1.default.copyFileSync(file, correspondingOutFile);
317
- });
318
- }
319
- /**
320
- * Returns a new instance of `CircomRunner`. The `CircomRunner` is used to compile the circuit.
321
- *
322
- * @param {string[]} args - The arguments to run the `circom` compiler.
323
- * @param {boolean} quiet - Whether to suppress the compilation error.
324
- * @returns {typeof CircomRunner} The `CircomRunner` instance.
325
- */
326
- _getCircomRunner(args, quiet) {
327
- return new CircomRunner({
328
- args,
329
- preopens: { "/": "/" },
330
- bindings: {
331
- ...bindings,
332
- exit(code) {
333
- throw new Error(`Compilation error. Exit code: ${code}.`);
334
- },
335
- fs: fs_1.default,
336
- },
337
- quiet,
338
- });
180
+ return path_1.default.join(fileDir, fileName);
339
181
  }
340
182
  }
341
183
  exports.C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,GAAG,GAAG,WAAW,OAAO,CAAC;gBACjC,MAAM;YACR,KAAK,MAAM;gBACT,QAAQ,GAAG,GAAG,WAAW,YAAY,CAAC;gBACtC,MAAM;YACR,KAAK,KAAK;gBACR,QAAQ,GAAG,GAAG,WAAW,MAAM,CAAC;gBAChC,MAAM;YACR,KAAK,MAAM;gBACT,QAAQ,GAAG,GAAG,WAAW,mBAAmB,CAAC;gBAC7C,MAAM;YACR,KAAK,MAAM;gBACT,QAAQ,GAAG,GAAG,WAAW,OAAO,CAAC;gBACjC,OAAO,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,WAAW,KAAK,CAAC,CAAC;gBAClD,MAAM;YACR;gBACE,MAAM,IAAI,KAAK,CAAC,wBAAwB,QAAQ,GAAG,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;CACF;AAtKD,kCAsKC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- export * from "./core/CircomZKit";
2
1
  export * from "./core/CircuitZKit";
3
- export * from "./core/ManagerZKit";
4
- export { NumericString, PublicSignals, Groth16Proof, Calldata, ProofStruct, Inputs, CircuitInfo } from "./types/types";
5
- export { CompileOptions, ManagerZKitConfig, defaultCompileOptions, defaultManagerOptions } from "./config/config";
2
+ export * from "./types/circuit-zkit";
6
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEvH,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -14,11 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.defaultManagerOptions = exports.defaultCompileOptions = void 0;
18
- __exportStar(require("./core/CircomZKit"), exports);
19
17
  __exportStar(require("./core/CircuitZKit"), exports);
20
- __exportStar(require("./core/ManagerZKit"), exports);
21
- var config_1 = require("./config/config");
22
- Object.defineProperty(exports, "defaultCompileOptions", { enumerable: true, get: function () { return config_1.defaultCompileOptions; } });
23
- Object.defineProperty(exports, "defaultManagerOptions", { enumerable: true, get: function () { return config_1.defaultManagerOptions; } });
18
+ __exportStar(require("./types/circuit-zkit"), exports);
24
19
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,qDAAmC;AACnC,qDAAmC;AAInC,0CAAkH;AAAtE,+GAAA,qBAAqB,OAAA;AAAE,+GAAA,qBAAqB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,uDAAqC"}
@@ -0,0 +1,43 @@
1
+ export type NumericString = `${number}` | string;
2
+ export type PublicSignals = NumericString[];
3
+ export type Groth16Proof = {
4
+ pi_a: [NumericString, NumericString];
5
+ pi_b: [[NumericString, NumericString], [NumericString, NumericString]];
6
+ pi_c: [NumericString, NumericString];
7
+ protocol: string;
8
+ curve: string;
9
+ };
10
+ export type Calldata = [
11
+ [
12
+ NumericString,
13
+ NumericString
14
+ ],
15
+ [
16
+ [NumericString, NumericString],
17
+ [NumericString, NumericString]
18
+ ],
19
+ [
20
+ NumericString,
21
+ NumericString
22
+ ],
23
+ [
24
+ NumericString
25
+ ]
26
+ ];
27
+ export type ProofStruct = {
28
+ proof: Groth16Proof;
29
+ publicSignals: PublicSignals;
30
+ };
31
+ export type NumberLike = number | bigint | string;
32
+ export type ArrayLike = NumberLike[] | ArrayLike[];
33
+ export type InputLike = NumberLike | ArrayLike;
34
+ export type Inputs = Record<string, InputLike>;
35
+ export type ArtifactsFileType = "r1cs" | "zkey" | "vkey" | "sym" | "json" | "wasm";
36
+ export type VerifierTemplateType = "groth16";
37
+ export type CircuitZKitConfig = {
38
+ circuitName: string;
39
+ circuitArtifactsPath: string;
40
+ verifierDirPath: string;
41
+ templateType?: VerifierTemplateType;
42
+ };
43
+ //# sourceMappingURL=circuit-zkit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circuit-zkit.d.ts","sourceRoot":"","sources":["../../src/types/circuit-zkit.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;AAEjD,MAAM,MAAM,aAAa,GAAG,aAAa,EAAE,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IACrC,IAAI,EAAE,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC;IACvE,IAAI,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB;QAAC,aAAa;QAAE,aAAa;KAAC;IAC9B;QAAC,CAAC,aAAa,EAAE,aAAa,CAAC;QAAE,CAAC,aAAa,EAAE,aAAa,CAAC;KAAC;IAChE;QAAC,aAAa;QAAE,aAAa;KAAC;IAC9B;QAAC,aAAa;KAAC;CAChB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,YAAY,CAAC;IACpB,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,SAAS,GAAG,UAAU,EAAE,GAAG,SAAS,EAAE,CAAC;AACnD,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAE/C,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAE/C,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AACnF,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACrC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=circuit-zkit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circuit-zkit.js","sourceRoot":"","sources":["../../src/types/circuit-zkit.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solarity/zkit",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "author": "Distributed Lab",
6
6
  "readme": "README.md",
@@ -26,25 +26,36 @@
26
26
  "scripts": {
27
27
  "prepare": "husky",
28
28
  "build": "tsc",
29
- "test": "jest --forceExit",
30
- "lint-fix": "prettier --write 'src/**/*.ts'",
29
+ "test": "mocha --recursive 'test/**/*.ts' --exit",
30
+ "coverage": "nyc mocha --recursive 'test/**/*.ts' --exit",
31
+ "lint-fix": "prettier --write \"./**/*.ts\"",
31
32
  "publish-to-npm": "npm run lint-fix && bash ./scripts/publish.sh"
32
33
  },
34
+ "nyc": {
35
+ "reporter": [
36
+ "html",
37
+ "text"
38
+ ]
39
+ },
33
40
  "dependencies": {
34
- "@distributedlab/circom2": "0.2.18-rc.2",
35
41
  "ejs": "3.1.10",
36
- "snarkjs": "0.7.3",
37
- "uuid": "9.0.1"
42
+ "snarkjs": "0.7.3"
38
43
  },
39
44
  "devDependencies": {
45
+ "@nomicfoundation/hardhat-ethers": "3.0.5",
40
46
  "@types/ejs": "^3.1.5",
41
- "@types/jest": "^29.5.12",
42
47
  "@types/snarkjs": "^0.7.8",
43
- "@types/uuid": "^9.0.8",
48
+ "@types/chai": "^4.3.12",
49
+ "@types/chai-as-promised": "^7.1.8",
50
+ "@types/mocha": "^10.0.6",
51
+ "chai": "^4.4.1",
52
+ "chai-as-promised": "^7.1.1",
53
+ "mocha": "^10.3.0",
54
+ "nyc": "^15.1.0",
55
+ "ethers": "6.11.1",
56
+ "hardhat": "2.20.1",
44
57
  "husky": "^9.0.11",
45
- "jest": "^29.7.0",
46
58
  "prettier": "^3.2.5",
47
- "ts-jest": "^29.1.2",
48
59
  "ts-node": "^10.9.2",
49
60
  "typescript": "^5.4.5"
50
61
  }