mirror of
https://github.com/semaphore-protocol/semaphore.git
synced 2026-04-28 03:00:41 -04:00
22 lines
661 B
TypeScript
22 lines
661 B
TypeScript
import { readFileSync, writeFileSync } from "fs"
|
|
|
|
type DeployedContracts = {
|
|
Pairing: string
|
|
SemaphoreVerifier: string
|
|
Poseidon: string
|
|
IncrementalBinaryTree: string
|
|
Semaphore: string
|
|
}
|
|
|
|
export function getDeployedContracts(network: string | undefined): DeployedContracts | null {
|
|
try {
|
|
return JSON.parse(readFileSync(`./deployed-contracts/${network}.json`, "utf8"))
|
|
} catch (error) {
|
|
return null
|
|
}
|
|
}
|
|
|
|
export function saveDeployedContracts(network: string | undefined, deployedContracts: DeployedContracts) {
|
|
writeFileSync(`./deployed-contracts/${network}.json`, JSON.stringify(deployedContracts, null, 4))
|
|
}
|