mirror of
https://github.com/CryptKeeperZK/semaphore.git
synced 2026-01-08 23:17:58 -05:00
chore: add env var to download all snark artifacts
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
DEFAULT_NETWORK=hardhat
|
||||
TREE_DEPTH=20
|
||||
ALL_SNARK_ARTIFACTS=true
|
||||
REPORT_GAS=false
|
||||
BACKEND_PRIVATE_KEY=
|
||||
INFURA_API_KEY=
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
import download from "download"
|
||||
import fs from "fs"
|
||||
import dotenv from "dotenv"
|
||||
|
||||
dotenv.config()
|
||||
|
||||
async function main() {
|
||||
const snarkArtifactsPath = "./snark-artifacts"
|
||||
const url = `https://www.trusted-setup-pse.org/semaphore/${process.env.TREE_DEPTH || 20}`
|
||||
|
||||
if (!fs.existsSync(snarkArtifactsPath)) {
|
||||
fs.mkdirSync(snarkArtifactsPath, { recursive: true })
|
||||
}
|
||||
if (process.env.ALL_SNARK_ARTIFACTS === "true") {
|
||||
const url = `https://www.trusted-setup-pse.org/semaphore/semaphore.zip`
|
||||
|
||||
await download(url, snarkArtifactsPath, {
|
||||
extract: true
|
||||
})
|
||||
} else {
|
||||
const url = `https://www.trusted-setup-pse.org/semaphore/${process.env.TREE_DEPTH || 20}`
|
||||
|
||||
if (!fs.existsSync(`${snarkArtifactsPath}/semaphore.zkey`)) {
|
||||
await download(`${url}/semaphore.wasm`, snarkArtifactsPath)
|
||||
await download(`${url}/semaphore.zkey`, snarkArtifactsPath)
|
||||
await download(`${url}/semaphore.json`, snarkArtifactsPath)
|
||||
|
||||
Reference in New Issue
Block a user