From 4a6286dfcaf8b83cd00ce3b494c59a3d63a477b8 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Mon, 4 Nov 2024 14:14:21 +0200 Subject: [PATCH 1/3] Updated README --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ee68bfd..2646716 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ This config contains all the information required to generate TypeScript binding - `basePath` - Path to the root directory of the project where circuits are stored. - `projectRoot` - Absolute path to the root directory of the project. -- `circuitsArtifactsPaths` - Array of paths to the circuits' Artifact files. +- `circuitsArtifactsPaths` - Array of paths to the circuits' artifact files. - `outputTypesDir` - Path to the directory where the generated types will be stored. - Optional. Default: `generated-types/circuits`. @@ -53,18 +53,21 @@ const generator = new CircuitTypesGenerator(config); await generator.generateTypes(); ``` -Also, this function generates the `hardhat.d.ts` file, where you can find all of the possible objects that can be retrieved by the function below. +Also, this function generates the `hardhat.d.ts` file, where you can find all the possible objects that can be retrieved by the function below. -#### getCircuitObject(circuitName: string): Promise +#### getCircuitObject(circuitName: string, protocolType?: string): Promise Returns the constructible object for the given circuit. ```typescript const generator = new CircuitTypesGenerator(config); await generator.generateTypes(); -const circuitObject = await generator.getCircuitObject("MyCircuit"); +const circuitObject = await generator.getCircuitObject("MyCircuit", "groth16"); ``` +The package supports generation of circuits by the `groth16` and `plonk` protocols at the same time. +In this case, you will have to specify the protocol type when retrieving the object. + After the `circuitObject` is retrieved, check out the [zkit](https://github.com/dl-solarity/zkit) documentation to see how to work with it. To ensure that the object can be imported, check the `hardhat.d.ts` file. From cee807aa738b6feaa0ba1dd212642bcfaf0bafde Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Mon, 4 Nov 2024 14:15:02 +0200 Subject: [PATCH 2/3] Updated versions --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1ca29f4..55ad498 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@solarity/zktype", - "version": "0.4.0-rc.1", + "version": "0.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@solarity/zktype", - "version": "0.4.0-rc.1", + "version": "0.4.0", "license": "MIT", "dependencies": { "ejs": "3.1.10", diff --git a/package.json b/package.json index 5d26817..3142bc7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@solarity/zktype", - "version": "0.4.0-rc.1", + "version": "0.4.0", "description": "Unleash TypeScript bindings for Circom circuits", "main": "dist/index.js", "types": "dist/index.d.ts", From e57e65fbf48bd79c909f542bdb244eed3638827a Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Mon, 4 Nov 2024 14:43:45 +0200 Subject: [PATCH 3/3] Updated config example --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2646716..936d7b7 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,13 @@ To create a `CircuitTypesGenerator` object, it is necessary to pass a config: ```typescript ZKTypeConfig = { - basePath: string; - projectRoot: string; - circuitsASTPaths: string[]; - outputTypesDir?: string; -}; + basePath: "circuits", + projectRoot: process.cwd(), + circuitsArtifactsPaths: [ + "circuits/auth/Matrix_artifacts.json", + ], + outputTypesDir: "generated-types/circuits", +} ``` This config contains all the information required to generate TypeScript bindings for given circuits.