mirror of
https://github.com/semaphore-protocol/semaphore.git
synced 2026-01-13 16:48:00 -05:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f679583498 | ||
|
|
05926d0ef7 | ||
|
|
eef277281d | ||
|
|
b96467f3d4 | ||
|
|
e530412f27 | ||
|
|
4df7693367 | ||
|
|
0ca80ca716 | ||
|
|
ed8141e873 | ||
|
|
0f4aca3ded | ||
|
|
6e2ef756bc | ||
|
|
c2dce437b4 | ||
|
|
8b91d75c6f | ||
|
|
abfcf9f006 | ||
|
|
a2e8f5a15c | ||
|
|
f77df8d98f |
4
.github/pull_request_template.md
vendored
4
.github/pull_request_template.md
vendored
@@ -29,10 +29,12 @@
|
||||
|
||||
<!-- Please check if the PR fulfills these requirements. -->
|
||||
|
||||
- [ ] My code follows the style guidelines of this project
|
||||
- [ ] I have performed a self-review of my code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] My changes generate no new warnings
|
||||
- [ ] I have run `yarn format` and `yarn lint` without getting any errors
|
||||
- [ ] I have added tests that prove my fix is effective or that my feature works
|
||||
- [ ] New and existing unit tests pass locally with my changes
|
||||
|
||||
> [!IMPORTANT]
|
||||
> We do not accept minor grammatical fixes (e.g., correcting typos, rewording sentences) unless they significantly improve clarity in technical documentation. These contributions, while appreciated, are not a priority for merging. If there is a grammatical error feel free to message the team.
|
||||
|
||||
2
.github/workflows/production.yml
vendored
2
.github/workflows/production.yml
vendored
@@ -34,7 +34,7 @@ jobs:
|
||||
run: yarn lint
|
||||
|
||||
test-subgraph:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04 # Context: https://github.com/graphprotocol/graph-tooling/issues/1546#issuecomment-2589680195
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
2
.github/workflows/pull-requests.yml
vendored
2
.github/workflows/pull-requests.yml
vendored
@@ -75,7 +75,7 @@ jobs:
|
||||
run: yarn run eslint ${{ steps.changed-files.outputs.to_lint_all_changed_files }} --ext .cjs,.js,.jsx,.ts,.tsx
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04 # Context: https://github.com/graphprotocol/graph-tooling/issues/1546#issuecomment-2589680195
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -22,7 +22,7 @@ Pull requests are great if you want to add a feature or fix a bug. Here's a quic
|
||||
|
||||
3. Add a test for your change. Only refactoring and documentation changes require no new tests.
|
||||
|
||||
4. Make sure to check out the [Style Guide](/CONTRIBUTING#style-guide) and ensure that your code complies with the rules.
|
||||
4. Make sure to check out the [Style Guide](/CONTRIBUTING.md#style-guide) and ensure that your code complies with the rules.
|
||||
|
||||
5. Make the test pass.
|
||||
|
||||
@@ -30,6 +30,9 @@ Pull requests are great if you want to add a feature or fix a bug. Here's a quic
|
||||
|
||||
7. Push to your fork and submit a pull request on our `main` branch. Please provide us with some explanation of why you made the changes you made. For new features make sure to explain a standard use case to us.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> We do not accept minor grammatical fixes (e.g., correcting typos, rewording sentences) unless they significantly improve clarity in technical documentation. These contributions, while appreciated, are not a priority for merging. If there is a grammatical error feel free to message the team.
|
||||
|
||||
## CI (Github Actions) Tests
|
||||
|
||||
We use GitHub Actions to test each PR before it is merged.
|
||||
|
||||
@@ -281,7 +281,7 @@ Install the dependencies:
|
||||
cd semaphore && yarn
|
||||
```
|
||||
|
||||
And build the repositiory:
|
||||
And build the repository:
|
||||
|
||||
```bash
|
||||
yarn build
|
||||
|
||||
@@ -390,8 +390,5 @@
|
||||
},
|
||||
"footer.right.connect.link2": {
|
||||
"message": "X (Twitter)"
|
||||
},
|
||||
"footer.copyright": {
|
||||
"message": "Copyright © 2024 Ethereum Foundation"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,8 +390,5 @@
|
||||
},
|
||||
"footer.right.connect.link2": {
|
||||
"message": "X (Twitter)"
|
||||
},
|
||||
"footer.copyright": {
|
||||
"message": "Copyright © 2024 Ethereum Foundation"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ Para utilizar los contratos e interfaces Semaphore en su proyecto, instale el pa
|
||||
|
||||
Semaphore ofrece los siguientes contratos base:
|
||||
|
||||
- [`SemaphoreVerifier.sol`](https://github.com/semaphore-protocol/semaphore/blob/main/packages/contracts/base/SemaphoreVerifier.sol): contiene una función para verificar pruebas Semaphore;
|
||||
- [`SemaphoreVerifier.sol`](https://github.com/semaphore-protocol/semaphore/blob/v3.15.2/packages/contracts/contracts/base/SemaphoreVerifier.sol): contiene una función para verificar pruebas Semaphore;
|
||||
- [`SemaphoreGroups.sol`](https://github.com/semaphore-protocol/semaphore/blob/main/packages/contracts/base/SemaphoreGroups.sol): contiene las funciones para crear grupos y añadir/remover/actualizar miembros.
|
||||
|
||||
Los contratos base están relacionados de forma muy cercana al protocolo.
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"@docusaurus/core": "3.5.2",
|
||||
"@docusaurus/preset-classic": "3.5.2",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"@semaphore-protocol/utils": "4.8.1",
|
||||
"@semaphore-protocol/utils": "4.9.0",
|
||||
"@svgr/webpack": "^5.5.0",
|
||||
"clsx": "^1.2.1",
|
||||
"docusaurus-plugin-sass": "^0.2.5",
|
||||
|
||||
@@ -54,11 +54,7 @@ function Footer() {
|
||||
<hr />
|
||||
|
||||
<div>
|
||||
<p>
|
||||
{translate({
|
||||
id: "footer.copyright"
|
||||
})}
|
||||
</p>
|
||||
<p>Copyright © {new Date().getFullYear()} Ethereum Foundation</p>
|
||||
|
||||
<Logo
|
||||
style={{ marginRight: -8 }}
|
||||
|
||||
@@ -33,7 +33,7 @@ Semaphore is designed to be a simple and generic _privacy layer_ for decentraliz
|
||||
|
||||
## About the code
|
||||
|
||||
The core of the protocol is the [circuit logic](https://github.com/semaphore-protocol/semaphore/tree/main/packages/circuits/semaphore.circom).
|
||||
The core of the protocol is the [circuit logic](https://github.com/semaphore-protocol/semaphore/tree/main/packages/circuits/src/semaphore.circom).
|
||||
In addition to circuits,
|
||||
Semaphore provides [Solidity contracts](https://github.com/semaphore-protocol/semaphore/tree/main/packages/contracts)
|
||||
and [JavaScript libraries](https://github.com/semaphore-protocol/semaphore/tree/main#-packages) that allow developers to generate zero-knowledge proofs and verify them with minimal effort.
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
"test": "graph test Semaphore -v 0.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@graphprotocol/graph-cli": "0.78.0",
|
||||
"@graphprotocol/graph-ts": "0.35.1",
|
||||
"@graphprotocol/graph-cli": "0.95.0",
|
||||
"@graphprotocol/graph-ts": "0.37.0",
|
||||
"@semaphore-protocol/utils": "workspace:packages/utils"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mustache": "^4.2.2",
|
||||
"matchstick-as": "0.5.0",
|
||||
"@types/mustache": "^4.2.5",
|
||||
"matchstick-as": "0.6.0",
|
||||
"mustache": "^4.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ export default function Home() {
|
||||
<VStack mb="32" spacing="32">
|
||||
<VStack w="full" maxW="1110px">
|
||||
<Heading fontSize={{ base: "30px", md: "44px" }} pb="90px">
|
||||
2024 Roadmap
|
||||
2024-2025 Roadmap
|
||||
</Heading>
|
||||
|
||||
<HStack display={{ base: "none", md: "flex" }} w="full" mt="60px">
|
||||
|
||||
@@ -88,7 +88,7 @@ export default function Footer() {
|
||||
</Link>
|
||||
|
||||
<Text fontSize={{ base: "12px", md: "14px" }} color="text.500" pt="2">
|
||||
Copyright © 2024 Ethereum Foundation
|
||||
Copyright © {new Date().getFullYear()} Ethereum Foundation
|
||||
</Text>
|
||||
</VStack>
|
||||
</VStack>
|
||||
|
||||
@@ -40,5 +40,12 @@
|
||||
"date": "2024-01-01",
|
||||
"authors": ["Vivek Bhupatiraju"],
|
||||
"url": "https://vivs.wiki/Semaphore"
|
||||
},
|
||||
{
|
||||
"title": "Getting Started with Semaphore: Building Privacy-Preserving dApps on Ethereum",
|
||||
"minRead": 7,
|
||||
"date": "2024-12-09",
|
||||
"authors": ["glasswing"],
|
||||
"url": "https://mirror.xyz/0xBE98D44c29D179588b7E717Db8898529e5cD770F/5Xlv1jzwJKfKgP-m257kjivBlUIM_cwTzsmpf9F0Su8"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -565,5 +565,15 @@
|
||||
"links": {
|
||||
"github": "https://github.com/evgongora/VeilEscrow"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Obscurus",
|
||||
"categories": ["Voting", "Privacy"],
|
||||
"tagline": "An anonymity layer for Safe Wallet owners, built using Semaphore and Zodiac.",
|
||||
"pse": false,
|
||||
"icon": "",
|
||||
"links": {
|
||||
"github": "https://github.com/quartz-technology/obscurus"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -23,16 +23,16 @@
|
||||
"name": "Support more Testnets/Mainnets",
|
||||
"done": true
|
||||
},
|
||||
{
|
||||
"name": "Documentation improvements",
|
||||
"done": false
|
||||
},
|
||||
{
|
||||
"name": "New Explorer",
|
||||
"done": true
|
||||
},
|
||||
{
|
||||
"name": "Semaphore Spec",
|
||||
"done": false
|
||||
},
|
||||
{
|
||||
"name": "RLN extension",
|
||||
"name": "Semaphore Rust Implementation",
|
||||
"done": false
|
||||
}
|
||||
]
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
"scripts": {
|
||||
"build": "yarn build:libraries && yarn build:subgraph && yarn build:website && yarn build:docs",
|
||||
"build:libraries": "yarn workspaces foreach -Apt --no-private run build",
|
||||
"clean:subgraph": "rimraf apps/subgraph/node_modules",
|
||||
"build:subgraph": "yarn clean:subgraph && yarn workspace semaphore-subgraph build:sepolia",
|
||||
"build:subgraph": "yarn workspace semaphore-subgraph build:sepolia",
|
||||
"build:website": "yarn workspace semaphore-website build",
|
||||
"build:docs": "yarn workspace semaphore-docs build",
|
||||
"compile:contracts": "yarn workspace semaphore-contracts compile",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/circuits",
|
||||
"version": "4.8.1",
|
||||
"version": "4.9.0",
|
||||
"description": "Semaphore Circom circuits to generate zero-knowledge proofs.",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-contracts-foundry",
|
||||
"version": "4.8.1",
|
||||
"version": "4.9.0",
|
||||
"description": "Semaphore Foundry template.",
|
||||
"license": "Unlicense",
|
||||
"devDependencies": {
|
||||
"@semaphore-protocol/contracts": "4.8.1",
|
||||
"@semaphore-protocol/contracts": "4.9.0",
|
||||
"@zk-kit/lean-imt.sol": "2.0.0",
|
||||
"forge-std": "github:foundry-rs/forge-std#v1.9.4",
|
||||
"poseidon-solidity": "0.0.5",
|
||||
@@ -38,7 +38,8 @@
|
||||
".editorconfig",
|
||||
".env.example",
|
||||
".prettierignore",
|
||||
".prettierrc.json"
|
||||
".prettierrc.json",
|
||||
".solhint.json"
|
||||
],
|
||||
"packageManager": "yarn@4.1.0"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-contracts-hardhat",
|
||||
"version": "4.8.1",
|
||||
"version": "4.9.0",
|
||||
"description": "Semaphore Hardhat template.",
|
||||
"license": "Unlicense",
|
||||
"files": [
|
||||
@@ -16,7 +16,8 @@
|
||||
".prettierrc.json",
|
||||
"hardhat.config.ts",
|
||||
"tsconfig.json",
|
||||
"README.md"
|
||||
"README.md",
|
||||
".solhint.json"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
@@ -41,9 +42,9 @@
|
||||
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
|
||||
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
|
||||
"@nomicfoundation/hardhat-verify": "^2.0.0",
|
||||
"@semaphore-protocol/core": "4.8.1",
|
||||
"@semaphore-protocol/hardhat": "4.8.1",
|
||||
"@semaphore-protocol/utils": "4.8.1",
|
||||
"@semaphore-protocol/core": "4.9.0",
|
||||
"@semaphore-protocol/hardhat": "4.9.0",
|
||||
"@semaphore-protocol/utils": "4.9.0",
|
||||
"@typechain/ethers-v6": "^0.5.0",
|
||||
"@typechain/hardhat": "^9.0.0",
|
||||
"@types/chai": "^4.2.0",
|
||||
@@ -71,7 +72,7 @@
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/contracts": "4.8.1"
|
||||
"@semaphore-protocol/contracts": "4.9.0"
|
||||
},
|
||||
"packageManager": "yarn@4.1.0"
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
|
||||
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
|
||||
"@nomicfoundation/hardhat-verify": "^2.0.0",
|
||||
"@semaphore-protocol/core": "4.8.1",
|
||||
"@semaphore-protocol/hardhat": "4.8.1",
|
||||
"@semaphore-protocol/utils": "4.8.1",
|
||||
"@semaphore-protocol/core": "4.9.0",
|
||||
"@semaphore-protocol/hardhat": "4.9.0",
|
||||
"@semaphore-protocol/utils": "4.9.0",
|
||||
"@typechain/ethers-v6": "^0.5.0",
|
||||
"@typechain/hardhat": "^9.0.0",
|
||||
"@types/chai": "^4.2.0",
|
||||
@@ -50,7 +50,7 @@
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/contracts": "4.8.1"
|
||||
"@semaphore-protocol/contracts": "4.9.0"
|
||||
},
|
||||
"packageManager": "yarn@4.1.0"
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/core": "4.8.1",
|
||||
"@semaphore-protocol/data": "4.8.1",
|
||||
"@semaphore-protocol/utils": "4.8.1",
|
||||
"@semaphore-protocol/core": "4.9.0",
|
||||
"@semaphore-protocol/data": "4.9.0",
|
||||
"@semaphore-protocol/utils": "4.9.0",
|
||||
"ethers": "^6.13.4",
|
||||
"next": "14.1.0",
|
||||
"next-pwa": "^5.6.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-monorepo-ethers",
|
||||
"version": "4.8.1",
|
||||
"version": "4.9.0",
|
||||
"description": "Semaphore Hardhat + Next.js + SemaphoreEthers template.",
|
||||
"license": "Unlicense",
|
||||
"files": [
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
|
||||
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
|
||||
"@nomicfoundation/hardhat-verify": "^2.0.0",
|
||||
"@semaphore-protocol/core": "4.8.1",
|
||||
"@semaphore-protocol/hardhat": "4.8.1",
|
||||
"@semaphore-protocol/utils": "4.8.1",
|
||||
"@semaphore-protocol/core": "4.9.0",
|
||||
"@semaphore-protocol/hardhat": "4.9.0",
|
||||
"@semaphore-protocol/utils": "4.9.0",
|
||||
"@typechain/ethers-v6": "^0.5.0",
|
||||
"@typechain/hardhat": "^9.0.0",
|
||||
"@types/chai": "^4.2.0",
|
||||
@@ -50,7 +50,7 @@
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/contracts": "4.8.1"
|
||||
"@semaphore-protocol/contracts": "4.9.0"
|
||||
},
|
||||
"packageManager": "yarn@4.1.0"
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/core": "4.8.1",
|
||||
"@semaphore-protocol/data": "4.8.1",
|
||||
"@semaphore-protocol/utils": "4.8.1",
|
||||
"@semaphore-protocol/core": "4.9.0",
|
||||
"@semaphore-protocol/data": "4.9.0",
|
||||
"@semaphore-protocol/utils": "4.9.0",
|
||||
"ethers": "^6.13.4",
|
||||
"next": "14.1.0",
|
||||
"next-pwa": "^5.6.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli-template-monorepo-subgraph",
|
||||
"version": "4.8.1",
|
||||
"version": "4.9.0",
|
||||
"description": "Semaphore Hardhat + Next.js + SemaphoreSubgraph template.",
|
||||
"license": "Unlicense",
|
||||
"files": [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/cli",
|
||||
"type": "module",
|
||||
"version": "4.8.1",
|
||||
"version": "4.9.0",
|
||||
"description": "A command line tool to set up your Semaphore project and get group data.",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
@@ -41,8 +41,8 @@
|
||||
"rollup-plugin-cleanup": "^3.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/data": "4.8.1",
|
||||
"@semaphore-protocol/utils": "4.8.1",
|
||||
"@semaphore-protocol/data": "4.9.0",
|
||||
"@semaphore-protocol/utils": "4.9.0",
|
||||
"axios": "^1.6.7",
|
||||
"boxen": "^7.1.1",
|
||||
"chalk": "^5.3.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/contracts",
|
||||
"version": "4.8.1",
|
||||
"version": "4.9.0",
|
||||
"description": "Semaphore contracts to manage groups and broadcast anonymous signals.",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/core",
|
||||
"version": "4.8.1",
|
||||
"version": "4.9.0",
|
||||
"description": "Core library for the essential Semaphore features.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
@@ -42,8 +42,8 @@
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/group": "4.8.1",
|
||||
"@semaphore-protocol/identity": "4.8.1",
|
||||
"@semaphore-protocol/proof": "4.8.1"
|
||||
"@semaphore-protocol/group": "4.9.0",
|
||||
"@semaphore-protocol/identity": "4.9.0",
|
||||
"@semaphore-protocol/proof": "4.9.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/data",
|
||||
"version": "4.8.1",
|
||||
"version": "4.9.0",
|
||||
"description": "A library for querying Semaphore smart contract.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
@@ -37,7 +37,8 @@
|
||||
"rollup-plugin-cleanup": "^3.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/utils": "4.8.1",
|
||||
"@semaphore-protocol/utils": "4.9.0",
|
||||
"@zk-kit/utils": "1.3.0",
|
||||
"axios": "1.6.6",
|
||||
"ethers": "6.13.4"
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* Validates the type of a given parameter against an expected type.
|
||||
* Throws a {@link TypeError} if the validation fails.
|
||||
* This function is useful for ensuring that function arguments conform to expected types at runtime.
|
||||
* @param value The value of the parameter to check.
|
||||
* @param name The name of the parameter, used in the error message for easier debugging.
|
||||
* @param type The expected JavaScript type as a string (e.g., 'string', 'number', 'object').
|
||||
* @throws {TypeError} Throws an error if the type of `value` does not match the `type`.
|
||||
*/
|
||||
export default function checkParameter(value: any, name: string, type: string) {
|
||||
if (typeof value !== type) {
|
||||
throw new TypeError(`Parameter '${name}' is not ${type === "object" ? "an" : "a"} ${type}`)
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,8 @@ import {
|
||||
Provider
|
||||
} from "ethers/providers"
|
||||
import { SemaphoreABI } from "@semaphore-protocol/utils/constants"
|
||||
import { requireString } from "@zk-kit/utils/error-handlers"
|
||||
import { EthersNetwork, EthersOptions, GroupResponse } from "./types"
|
||||
import checkParameter from "./checkParameter"
|
||||
import getEvents from "./getEvents"
|
||||
|
||||
/**
|
||||
@@ -40,16 +40,16 @@ export default class SemaphoreEthers {
|
||||
* @param options Configuration options for the ethers provider and the Semaphore contract.
|
||||
*/
|
||||
constructor(networkOrEthereumURL: EthersNetwork | string = defaultNetwork, options: EthersOptions = {}) {
|
||||
checkParameter(networkOrEthereumURL, "networkOrEthereumURL", "string")
|
||||
requireString(networkOrEthereumURL, "networkOrEthereumURL")
|
||||
|
||||
if (options.provider) {
|
||||
checkParameter(options.provider, "provider", "string")
|
||||
requireString(options.provider, "provider")
|
||||
} else if (!networkOrEthereumURL.startsWith("http")) {
|
||||
options.provider = "infura"
|
||||
}
|
||||
|
||||
if (options.apiKey) {
|
||||
checkParameter(options.apiKey, "apiKey", "string")
|
||||
requireString(options.apiKey, "apiKey")
|
||||
}
|
||||
|
||||
if (isSupportedNetwork(networkOrEthereumURL)) {
|
||||
@@ -140,7 +140,7 @@ export default class SemaphoreEthers {
|
||||
* @returns A promise that resolves to a GroupResponse object.
|
||||
*/
|
||||
async getGroup(groupId: string): Promise<GroupResponse> {
|
||||
checkParameter(groupId, "groupId", "string")
|
||||
requireString(groupId, "groupId")
|
||||
|
||||
const groupAdmin = await this._contract.getGroupAdmin(groupId)
|
||||
|
||||
@@ -172,7 +172,7 @@ export default class SemaphoreEthers {
|
||||
* @returns A promise that resolves to an array of member identity commitments as strings.
|
||||
*/
|
||||
async getGroupMembers(groupId: string): Promise<string[]> {
|
||||
checkParameter(groupId, "groupId", "string")
|
||||
requireString(groupId, "groupId")
|
||||
|
||||
const groupAdmin = await this._contract.getGroupAdmin(groupId)
|
||||
|
||||
@@ -257,7 +257,7 @@ export default class SemaphoreEthers {
|
||||
* @returns A promise that resolves to an array of validated proofs.
|
||||
*/
|
||||
async getGroupValidatedProofs(groupId: string): Promise<any> {
|
||||
checkParameter(groupId, "groupId", "string")
|
||||
requireString(groupId, "groupId")
|
||||
|
||||
const groupAdmin = await this._contract.getGroupAdmin(groupId)
|
||||
|
||||
@@ -290,8 +290,8 @@ export default class SemaphoreEthers {
|
||||
* @returns A promise that resolves to true if the member is part of the group, otherwise false.
|
||||
*/
|
||||
async isGroupMember(groupId: string, member: string): Promise<boolean> {
|
||||
checkParameter(groupId, "groupId", "string")
|
||||
checkParameter(member, "member", "string")
|
||||
requireString(groupId, "groupId")
|
||||
requireString(member, "member")
|
||||
|
||||
return this._contract.hasMember(groupId, member)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { defaultNetwork, SupportedNetwork } from "@semaphore-protocol/utils/networks"
|
||||
import { AxiosRequestConfig } from "axios"
|
||||
import checkParameter from "./checkParameter"
|
||||
import { requireString, requireObject, requireBoolean } from "@zk-kit/utils/error-handlers"
|
||||
import getURL from "./getURL"
|
||||
import request from "./request"
|
||||
import { GroupOptions, GroupResponse } from "./types"
|
||||
@@ -24,7 +24,7 @@ export default class SemaphoreSubgraph {
|
||||
* @param networkOrSubgraphURL Either a supported network identifier or a direct URL to the subgraph.
|
||||
*/
|
||||
constructor(networkOrSubgraphURL: SupportedNetwork | string = defaultNetwork) {
|
||||
checkParameter(networkOrSubgraphURL, "networkOrSubgraphURL", "string")
|
||||
requireString(networkOrSubgraphURL, "networkOrSubgraphURL")
|
||||
|
||||
if (typeof networkOrSubgraphURL === "string" && networkOrSubgraphURL.startsWith("http")) {
|
||||
this._url = networkOrSubgraphURL
|
||||
@@ -73,12 +73,12 @@ export default class SemaphoreSubgraph {
|
||||
* @returns A promise that resolves to an array of group details.
|
||||
*/
|
||||
async getGroups(options: GroupOptions = {}): Promise<GroupResponse[]> {
|
||||
checkParameter(options, "options", "object")
|
||||
requireObject(options, "options")
|
||||
|
||||
const { members = false, validatedProofs = false } = options
|
||||
|
||||
checkParameter(members, "members", "boolean")
|
||||
checkParameter(validatedProofs, "validatedProofs", "boolean")
|
||||
requireBoolean(members, "members")
|
||||
requireBoolean(validatedProofs, "validatedProofs")
|
||||
|
||||
let filtersQuery = ""
|
||||
|
||||
@@ -164,13 +164,13 @@ export default class SemaphoreSubgraph {
|
||||
* @returns A promise that resolves to the details of the specified group.
|
||||
*/
|
||||
async getGroup(groupId: string, options: Omit<GroupOptions, "filters"> = {}): Promise<GroupResponse> {
|
||||
checkParameter(groupId, "groupId", "string")
|
||||
checkParameter(options, "options", "object")
|
||||
requireString(groupId, "groupId")
|
||||
requireObject(options, "options")
|
||||
|
||||
const { members = false, validatedProofs = false } = options
|
||||
|
||||
checkParameter(members, "members", "boolean")
|
||||
checkParameter(validatedProofs, "validatedProofs", "boolean")
|
||||
requireBoolean(members, "members")
|
||||
requireBoolean(validatedProofs, "validatedProofs")
|
||||
|
||||
const config: AxiosRequestConfig = {
|
||||
method: "post",
|
||||
@@ -247,8 +247,8 @@ export default class SemaphoreSubgraph {
|
||||
* @returns A promise that resolves to true if the member is part of the group, otherwise false.
|
||||
*/
|
||||
async isGroupMember(groupId: string, member: string): Promise<boolean> {
|
||||
checkParameter(groupId, "groupId", "string")
|
||||
checkParameter(member, "member", "string")
|
||||
requireString(groupId, "groupId")
|
||||
requireString(member, "member")
|
||||
|
||||
const config: AxiosRequestConfig = {
|
||||
method: "post",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/group",
|
||||
"version": "4.8.1",
|
||||
"version": "4.9.0",
|
||||
"description": "A library to create and manage Semaphore groups.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
@@ -37,7 +37,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@zk-kit/lean-imt": "2.2.2",
|
||||
"@zk-kit/utils": "1.2.1",
|
||||
"@zk-kit/utils": "1.3.0",
|
||||
"poseidon-lite": "0.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/hardhat",
|
||||
"version": "4.8.1",
|
||||
"version": "4.9.0",
|
||||
"description": "A Hardhat plugin to deploy Semaphore contracts.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
@@ -41,7 +41,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@nomicfoundation/hardhat-ethers": "^3.0.0",
|
||||
"@semaphore-protocol/contracts": "4.8.1",
|
||||
"@semaphore-protocol/contracts": "4.9.0",
|
||||
"ethers": "^6.13.4",
|
||||
"hardhat-dependency-compiler": "^1.1.3"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/identity",
|
||||
"version": "4.8.1",
|
||||
"version": "4.9.0",
|
||||
"description": "A library to create Semaphore identities.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
@@ -39,7 +39,7 @@
|
||||
"dependencies": {
|
||||
"@zk-kit/baby-jubjub": "1.0.3",
|
||||
"@zk-kit/eddsa-poseidon": "1.0.4",
|
||||
"@zk-kit/utils": "1.2.1",
|
||||
"@zk-kit/utils": "1.3.0",
|
||||
"poseidon-lite": "0.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/proof",
|
||||
"version": "4.8.1",
|
||||
"version": "4.9.0",
|
||||
"description": "A library to generate and verify Semaphore proofs.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
@@ -47,13 +47,13 @@
|
||||
"rollup-plugin-cleanup": "^3.2.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@semaphore-protocol/group": "4.8.1",
|
||||
"@semaphore-protocol/identity": "4.8.1"
|
||||
"@semaphore-protocol/group": "4.9.0",
|
||||
"@semaphore-protocol/identity": "4.9.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@semaphore-protocol/utils": "4.8.1",
|
||||
"@semaphore-protocol/utils": "4.9.0",
|
||||
"@zk-kit/artifacts": "1.8.0",
|
||||
"@zk-kit/utils": "1.2.1",
|
||||
"@zk-kit/utils": "1.3.0",
|
||||
"ethers": "6.13.4",
|
||||
"snarkjs": "0.7.4"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@semaphore-protocol/utils",
|
||||
"version": "4.8.1",
|
||||
"version": "4.9.0",
|
||||
"description": "A library to provide utility functions to the other Semaphore packages.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
|
||||
Reference in New Issue
Block a user