diff --git a/packages/poseidon-proof/build.tsconfig.json b/packages/poseidon-proof/build.tsconfig.json index 2d4a1d6da..09b37d986 100644 --- a/packages/poseidon-proof/build.tsconfig.json +++ b/packages/poseidon-proof/build.tsconfig.json @@ -2,7 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "baseUrl": ".", - "declarationDir": "dist/types" + "declarationDir": "dist/types", + "resolveJsonModule": true }, "include": ["src"] } diff --git a/packages/poseidon-proof/package.json b/packages/poseidon-proof/package.json index 5557cd5a1..6da05508f 100644 --- a/packages/poseidon-proof/package.json +++ b/packages/poseidon-proof/package.json @@ -1,6 +1,6 @@ { "name": "@zk-kit/poseidon-proof", - "version": "0.3.0", + "version": "0.4.0", "description": "A library to generate and verify Poseidon proofs.", "license": "MIT", "main": "dist/index.js", @@ -45,7 +45,7 @@ "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/keccak256": "^5.7.0", - "@zk-kit/groth16": "0.3.0", + "@zk-kit/groth16": "0.4.0", "download": "^8.0.0", "tmp": "^0.2.1" } diff --git a/packages/poseidon-proof/src/config.ts b/packages/poseidon-proof/src/config.ts index 65d282708..402020e70 100644 --- a/packages/poseidon-proof/src/config.ts +++ b/packages/poseidon-proof/src/config.ts @@ -1,7 +1,4 @@ -import pkg from "../package.json" - -export const libraryName = pkg.name.split("/")[1] - +// eslint-disable-next-line import/prefer-default-export export const defaultSnarkArtifacts = { wasmFilePath: "https://zkkit.cedoor.dev/poseidon-proof.wasm", zkeyFilePath: "https://zkkit.cedoor.dev/poseidon-proof.zkey" diff --git a/packages/poseidon-proof/src/generate.ts b/packages/poseidon-proof/src/generate.ts index e5a0f6797..d52754ee6 100644 --- a/packages/poseidon-proof/src/generate.ts +++ b/packages/poseidon-proof/src/generate.ts @@ -4,7 +4,7 @@ import { NumericString, prove } from "@zk-kit/groth16" import download from "download" import fs from "fs" import tmp from "tmp" -import { defaultSnarkArtifacts, libraryName } from "./config" +import { defaultSnarkArtifacts } from "./config" import hash from "./hash" import packProof from "./packProof" import { PoseidonProof, SnarkArtifacts } from "./types" @@ -34,7 +34,7 @@ export default async function generate( /* istanbul ignore next */ if (!snarkArtifacts) { if (isNode()) { - const tmpDir = libraryName + const tmpDir = "poseidon-proof" const tmpPath = `${tmp.tmpdir}/${tmpDir}` if (!fs.existsSync(tmpPath)) { diff --git a/packages/poseidon-proof/src/index.test.ts b/packages/poseidon-proof/tests/index.test.ts similarity index 87% rename from packages/poseidon-proof/src/index.test.ts rename to packages/poseidon-proof/tests/index.test.ts index 76ada93d7..f3e6d6db1 100644 --- a/packages/poseidon-proof/src/index.test.ts +++ b/packages/poseidon-proof/tests/index.test.ts @@ -1,11 +1,11 @@ import { buildBn128 } from "@zk-kit/groth16" import { poseidon1, poseidon2 } from "poseidon-lite" -import generate from "./generate" -import packProof from "./packProof" -import { PoseidonProof } from "./types" -import unpackProof from "./unpackProof" -import verify from "./verify" -import hash from "./hash" +import generate from "../src/generate" +import packProof from "../src/packProof" +import { PoseidonProof } from "../src/types" +import unpackProof from "../src/unpackProof" +import verify from "../src/verify" +import hash from "../src/hash" describe("PoseidonProof", () => { const preimage = 2 diff --git a/packages/poseidon-proof/tsconfig.json b/packages/poseidon-proof/tsconfig.json index dfaf0c1ad..98496a5a1 100644 --- a/packages/poseidon-proof/tsconfig.json +++ b/packages/poseidon-proof/tsconfig.json @@ -1,4 +1,7 @@ { "extends": "../../tsconfig.json", - "include": ["src", "rollup.config.ts"] + "compilerOptions": { + "resolveJsonModule": true + }, + "include": ["src", "tests", "rollup.config.ts"] } diff --git a/tsconfig.json b/tsconfig.json index 9de0656b9..b27f99d7f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,6 @@ "target": "ES5", "module": "ES2020", "moduleResolution": "node", - "resolveJsonModule": true, "esModuleInterop": true, "preserveConstEnums": true, "skipLibCheck": true, diff --git a/yarn.lock b/yarn.lock index 5e5e48449..9ff63c1e5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4448,17 +4448,7 @@ __metadata: languageName: node linkType: hard -"@zk-kit/groth16@npm:0.3.0": - version: 0.3.0 - resolution: "@zk-kit/groth16@npm:0.3.0" - dependencies: - circom_runtime: 0.1.24 - ffjavascript: 0.2.60 - checksum: f177fffd7e28c1f6617a67758c017bb962bde8829a6b90bea8053c0c164386b73b58cfe26c2481435bbc0de0c14d8301c23818e4a0450979bceb525f64e9db51 - languageName: node - linkType: hard - -"@zk-kit/groth16@workspace:packages/groth16": +"@zk-kit/groth16@0.4.0, @zk-kit/groth16@workspace:packages/groth16": version: 0.0.0-use.local resolution: "@zk-kit/groth16@workspace:packages/groth16" dependencies: @@ -4526,7 +4516,7 @@ __metadata: "@rollup/plugin-json": ^5.0.1 "@types/download": ^8.0.5 "@types/tmp": ^0.2.6 - "@zk-kit/groth16": 0.3.0 + "@zk-kit/groth16": 0.4.0 download: ^8.0.0 poseidon-lite: ^0.2.0 rollup-plugin-cleanup: ^3.2.1