Skip to content

Commit

Permalink
refactor(poseidon-proof): make node imports dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
cedoor committed Nov 24, 2023
1 parent a7210dc commit 9af8926
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/poseidon-proof/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zk-kit/poseidon-proof",
"version": "0.4.0",
"version": "0.4.1",
"description": "A library to generate and verify Poseidon proofs.",
"license": "MIT",
"main": "dist/index.js",
Expand Down
8 changes: 5 additions & 3 deletions packages/poseidon-proof/src/generate.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { BigNumber } from "@ethersproject/bignumber"
import { BytesLike, Hexable } from "@ethersproject/bytes"
import { NumericString, prove } from "@zk-kit/groth16"
import download from "download"
import fs from "fs"
import tmp from "tmp"

import { defaultSnarkArtifacts } from "./config"
import hash from "./hash"
import packProof from "./packProof"
Expand Down Expand Up @@ -34,6 +32,10 @@ export default async function generate(
/* istanbul ignore next */
if (!snarkArtifacts) {
if (isNode()) {
const { default: download } = await import("download")
const { default: fs } = await import("fs")
const { default: tmp } = await import("tmp")

const tmpDir = "poseidon-proof"
const tmpPath = `${tmp.tmpdir}/${tmpDir}`

Expand Down

0 comments on commit 9af8926

Please sign in to comment.