diff --git a/apps/subgraph/README.md b/apps/subgraph/README.md index 0fa25361f..5ad4e3759 100644 --- a/apps/subgraph/README.md +++ b/apps/subgraph/README.md @@ -42,13 +42,13 @@ ## Networks -| Semaphore version | Sepolia | Goerli | Mumbai | Optimism Goerli | Arbitrum Goerli | Arbitrum One | -| ----------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | -| v2.0 | N/A | N/A | N/A | N/A | N/A | [semaphore-protocol/arbitrum](https://thegraph.com/hosted-service/subgraph/semaphore-protocol/arbitrum) | -| v2.5 | N/A | [semaphore-protocol/goerli](https://thegraph.com/hosted-service/subgraph/semaphore-protocol/goerli) | N/A | N/A | N/A | N/A | -| v2.6 | N/A | [semaphore-protocol/goerli-5259d3](https://thegraph.com/hosted-service/subgraph/semaphore-protocol/goerli-5259d3) | N/A | N/A | N/A | [semaphore-protocol/arbitrum-86337c](https://thegraph.com/hosted-service/subgraph/semaphore-protocol/arbitrum-86337c) | -| v3.0 - v3.1 | N/A | [semaphore-protocol/goerli-89490c](https://thegraph.com/hosted-service/subgraph/semaphore-protocol/goerli-89490c) | N/A | N/A | N/A | [semaphore-protocol/arbitrum-72dca3](https://thegraph.com/hosted-service/subgraph/semaphore-protocol/arbitrum-72dca3) | -| >= v3.2 | [semaphore-sepolia](https://api.studio.thegraph.com/query/14377/semaphore-sepolia/v3.6.1) | [semaphore-goerli](https://api.studio.thegraph.com/query/14377/semaphore-goerli/v3.6.1) | [semaphore-mumbai](https://api.studio.thegraph.com/query/14377/semaphore-mumbai/v3.6.1) | [semaphore-optimism-goerli](https://api.studio.thegraph.com/query/14377/semaphore-optimism-goerli/v3.6.1) | [semaphore-arbitrum-goerli](https://api.studio.thegraph.com/query/14377/semaphore-arbitrum-goerli/v3.6.1) | [semaphore-arbitrum](https://api.studio.thegraph.com/query/14377/semaphore-arbitrum/v3.6.1) | +| Semaphore version | Sepolia | Mumbai | Optimism Sepolia | Arbitrum Sepolia | Arbitrum One | +| ----------------- | ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ---------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------- | +| v2.0 | N/A | N/A | N/A | N/A | [semaphore-protocol/arbitrum](https://thegraph.com/hosted-service/subgraph/semaphore-protocol/arbitrum) | +| v2.5 | N/A | N/A | N/A | N/A | N/A | +| v2.6 | N/A | N/A | N/A | N/A | [semaphore-protocol/arbitrum-86337c](https://thegraph.com/hosted-service/subgraph/semaphore-protocol/arbitrum-86337c) | +| v3.0 - v3.1 | N/A | N/A | N/A | N/A | [semaphore-protocol/arbitrum-72dca3](https://thegraph.com/hosted-service/subgraph/semaphore-protocol/arbitrum-72dca3) | +| >= v3.2 | [semaphore-sepolia](https://api.studio.thegraph.com/query/14377/semaphore-sepolia/v3.6.1) | [semaphore-mumbai](https://api.studio.thegraph.com/query/14377/semaphore-mumbai/v3.6.1) | N/A | N/A | [semaphore-arbitrum](https://api.studio.thegraph.com/query/14377/semaphore-arbitrum/v3.6.1) | ## 🛠 Install diff --git a/apps/subgraph/docker-compose-graph.yml b/apps/subgraph/docker-compose-graph.yml index 332efbc5b..1bbe6a31f 100644 --- a/apps/subgraph/docker-compose-graph.yml +++ b/apps/subgraph/docker-compose-graph.yml @@ -20,7 +20,7 @@ services: postgres_port: 5432 ipfs: "ipfs:5001" ethereum: "localhost:http://host.docker.internal:8545" # Should use the `localhost` as network name in subgraph.yml - # ethereum: 'goerli:https://goerli.infura.io/v3/YOUR-API-KEY' + # ethereum: 'sepolia:https://sepolia.infura.io/v3/YOUR-API-KEY' GRAPH_LOG: info GRAPH_ALLOW_NON_DETERMINISTIC_IPFS: 1 networks: diff --git a/apps/subgraph/networks.json b/apps/subgraph/networks.json index 2066652d3..e16bc47d0 100644 --- a/apps/subgraph/networks.json +++ b/apps/subgraph/networks.json @@ -5,25 +5,19 @@ "startBlock": 3231111 } }, - "goerli": { - "Semaphore": { - "address": "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131", - "startBlock": 8777695 - } - }, "mumbai": { "Semaphore": { "address": "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131", "startBlock": 33995010 } }, - "optimism-goerli": { + "optimism-sepolia": { "Semaphore": { "address": "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131", "startBlock": 7632846 } }, - "arbitrum-goerli": { + "arbitrum-sepolia": { "Semaphore": { "address": "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131", "startBlock": 15174410 diff --git a/package.json b/package.json index ec3d654db..6751c89e0 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,8 @@ "private": true, "scripts": { "build:libraries": "yarn workspaces foreach -t --no-private run build", - "build:subgraph": "yarn workspace semaphore-subgraph codegen goerli && yarn workspace semaphore-subgraph build", + "build:subgraph": "yarn workspace semaphore-subgraph codegen sepolia && yarn workspace semaphore-subgraph build", "compile:contracts": "yarn workspace semaphore-contracts compile", - "remove:template-files": "ts-node scripts/remove-template-files.ts", "test": "yarn test:libraries && yarn test:contracts && yarn test:circuits && yarn test:subgraph", "test:libraries": "jest --coverage", "test:subgraph": "yarn workspace semaphore-subgraph test", @@ -21,8 +20,10 @@ "prettier:write": "prettier -w .", "docs": "typedoc --cname js.semaphore.pse.dev --githubPages true", "version:bump": "yarn workspaces foreach --no-private version -d ${0} && yarn version apply --all && git commit -am \"chore: v${0}\" && git tag v${0}", - "version:publish": "yarn build:libraries && yarn remove:template-files && yarn workspaces foreach --no-private npm publish --tolerate-republish --access public", + "version:publish": "yarn build:libraries && yarn clean:cli-templates && yarn workspaces foreach --no-private npm publish --tolerate-republish --access public", "version:release": "changelogithub", + "clean": "ts-node scripts/clean-apps.ts && ts-node scripts/clean-packages.ts && yarn clean:cli-templates && rimraf node_modules", + "clean:cli-templates": "ts-node scripts/clean-cli-templates.ts", "commit": "cz", "precommit": "lint-staged", "postinstall": "husky install" diff --git a/packages/cli-template-contracts-hardhat/README.md b/packages/cli-template-contracts-hardhat/README.md index a2e1a66f1..0510bdeda 100644 --- a/packages/cli-template-contracts-hardhat/README.md +++ b/packages/cli-template-contracts-hardhat/README.md @@ -44,7 +44,7 @@ cp .env.example .env 3. And deploy your contract. ```bash -yarn deploy --semaphore --group --network goerli +yarn deploy --semaphore --group --network sepolia ``` > **Note** diff --git a/packages/cli-template-contracts-hardhat/hardhat.config.ts b/packages/cli-template-contracts-hardhat/hardhat.config.ts index 984204e34..8a3d6b9bd 100644 --- a/packages/cli-template-contracts-hardhat/hardhat.config.ts +++ b/packages/cli-template-contracts-hardhat/hardhat.config.ts @@ -21,11 +21,6 @@ function getNetworks(): NetworksUserConfig { const infuraApiKey = process.env.INFURA_API_KEY return { - goerli: { - url: `https://goerli.infura.io/v3/${infuraApiKey}`, - chainId: 5, - accounts - }, sepolia: { url: `https://sepolia.infura.io/v3/${infuraApiKey}`, chainId: 11155111, @@ -36,13 +31,18 @@ function getNetworks(): NetworksUserConfig { chainId: 80001, accounts }, - "optimism-goerli": { - url: `https://optimism-goerli.infura.io/v3/${infuraApiKey}`, - chainId: 420, + "optimism-sepolia": { + url: `https://optimism-sepolia.infura.io/v3/${infuraApiKey}`, + chainId: 11155420, + accounts + }, + "arbitrum-sepolia": { + url: "https://sepolia-rollup.arbitrum.io/rpc", + chainId: 7745327, accounts }, arbitrum: { - url: `https://arbitrum-mainnet.infura.io/v3/${infuraApiKey}`, + url: "https://arb1.arbitrum.io/rpc", chainId: 42161, accounts } diff --git a/packages/cli-template-monorepo-ethers/README.md b/packages/cli-template-monorepo-ethers/README.md index efc383bad..70a93dbdf 100644 --- a/packages/cli-template-monorepo-ethers/README.md +++ b/packages/cli-template-monorepo-ethers/README.md @@ -25,7 +25,7 @@ yarn dev 1. Go to the `apps/contracts` directory and deploy your contract: ```bash -yarn deploy --semaphore --group --network arbitrum-goerli +yarn deploy --semaphore --group --network arbitrum-sepolia ``` 2. Update your `.env` file with your new contract address, the group id and the semaphore contract address. diff --git a/packages/cli-template-monorepo-ethers/apps/contracts/hardhat.config.ts b/packages/cli-template-monorepo-ethers/apps/contracts/hardhat.config.ts index 4e862668c..a96c5de40 100644 --- a/packages/cli-template-monorepo-ethers/apps/contracts/hardhat.config.ts +++ b/packages/cli-template-monorepo-ethers/apps/contracts/hardhat.config.ts @@ -23,11 +23,6 @@ function getNetworks(): NetworksUserConfig { const infuraApiKey = process.env.INFURA_API_KEY return { - goerli: { - url: `https://goerli.infura.io/v3/${infuraApiKey}`, - chainId: 5, - accounts - }, sepolia: { url: `https://sepolia.infura.io/v3/${infuraApiKey}`, chainId: 11155111, @@ -38,14 +33,14 @@ function getNetworks(): NetworksUserConfig { chainId: 80001, accounts }, - "optimism-goerli": { - url: `https://optimism-goerli.infura.io/v3/${infuraApiKey}`, - chainId: 420, + "optimism-sepolia": { + url: `https://optimism-sepolia.infura.io/v3/${infuraApiKey}`, + chainId: 11155420, accounts }, - "arbitrum-goerli": { - url: "https://goerli-rollup.arbitrum.io/rpc", - chainId: 421613, + "arbitrum-sepolia": { + url: "https://sepolia-rollup.arbitrum.io/rpc", + chainId: 7745327, accounts }, arbitrum: { diff --git a/packages/cli-template-monorepo-subgraph/README.md b/packages/cli-template-monorepo-subgraph/README.md index efc383bad..70a93dbdf 100644 --- a/packages/cli-template-monorepo-subgraph/README.md +++ b/packages/cli-template-monorepo-subgraph/README.md @@ -25,7 +25,7 @@ yarn dev 1. Go to the `apps/contracts` directory and deploy your contract: ```bash -yarn deploy --semaphore --group --network arbitrum-goerli +yarn deploy --semaphore --group --network arbitrum-sepolia ``` 2. Update your `.env` file with your new contract address, the group id and the semaphore contract address. diff --git a/packages/cli-template-monorepo-subgraph/apps/contracts/hardhat.config.ts b/packages/cli-template-monorepo-subgraph/apps/contracts/hardhat.config.ts index 4e862668c..a96c5de40 100644 --- a/packages/cli-template-monorepo-subgraph/apps/contracts/hardhat.config.ts +++ b/packages/cli-template-monorepo-subgraph/apps/contracts/hardhat.config.ts @@ -23,11 +23,6 @@ function getNetworks(): NetworksUserConfig { const infuraApiKey = process.env.INFURA_API_KEY return { - goerli: { - url: `https://goerli.infura.io/v3/${infuraApiKey}`, - chainId: 5, - accounts - }, sepolia: { url: `https://sepolia.infura.io/v3/${infuraApiKey}`, chainId: 11155111, @@ -38,14 +33,14 @@ function getNetworks(): NetworksUserConfig { chainId: 80001, accounts }, - "optimism-goerli": { - url: `https://optimism-goerli.infura.io/v3/${infuraApiKey}`, - chainId: 420, + "optimism-sepolia": { + url: `https://optimism-sepolia.infura.io/v3/${infuraApiKey}`, + chainId: 11155420, accounts }, - "arbitrum-goerli": { - url: "https://goerli-rollup.arbitrum.io/rpc", - chainId: 421613, + "arbitrum-sepolia": { + url: "https://sepolia-rollup.arbitrum.io/rpc", + chainId: 7745327, accounts }, arbitrum: { diff --git a/packages/cli/README.md b/packages/cli/README.md index 767b06669..7b13066ae 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -76,9 +76,9 @@ Options: Commands: create [options] [project-directory] Create a Semaphore project with a supported template. - get-groups [options] Get the list of groups from a supported network (e.g. goerli or arbitrum). - get-group [options] [group-id] Get the data of a group from a supported network (e.g. goerli or arbitrum). - get-members [options] [group-id] Get the members of a group from a supported network (e.g. goerli or arbitrum). - get-proofs [options] [group-id] Get the proofs of a group from a supported network (e.g. goerli or arbitrum). + get-groups [options] Get the list of groups from a supported network (e.g. sepolia or arbitrum). + get-group [options] [group-id] Get the data of a group from a supported network (e.g. sepolia or arbitrum). + get-members [options] [group-id] Get the members of a group from a supported network (e.g. sepolia or arbitrum). + get-proofs [options] [group-id] Get the proofs of a group from a supported network (e.g. sepolia or arbitrum). help [command] Display help for a specific command. ``` diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index c5a628989..4a40fea85 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -117,7 +117,7 @@ program program .command("get-groups") - .description("Get the list of groups from a supported network (e.g. goerli or arbitrum).") + .description("Get the list of groups from a supported network (e.g. sepolia or arbitrum).") .option("-n, --network ", "Supported Ethereum network.") .allowExcessArguments(false) .action(async ({ network }) => { @@ -146,7 +146,7 @@ program program .command("get-group") - .description("Get the data of a group from a supported network (e.g. goerli or arbitrum).") + .description("Get the data of a group from a supported network (e.g. sepolia or arbitrum).") .argument("[group-id]", "Identifier of the group.") .option("-n, --network ", "Supported Ethereum network.") .allowExcessArguments(false) @@ -217,7 +217,7 @@ program program .command("get-members") - .description("Get the members of a group from a supported network (e.g. goerli or arbitrum).") + .description("Get the members of a group from a supported network (e.g. sepolia or arbitrum).") .argument("[group-id]", "Identifier of the group.") .option("-n, --network ", "Supported Ethereum network.") .allowExcessArguments(false) @@ -283,7 +283,7 @@ program program .command("get-proofs") - .description("Get the proofs of a group from a supported network (e.g. goerli or arbitrum).") + .description("Get the proofs of a group from a supported network (e.g. sepolia or arbitrum).") .argument("[group-id]", "Identifier of the group.") .option("-n, --network ", "Supported Ethereum network.") .allowExcessArguments(false) diff --git a/packages/contracts/contracts/README.md b/packages/contracts/contracts/README.md index 982f0a781..614846325 100644 --- a/packages/contracts/contracts/README.md +++ b/packages/contracts/contracts/README.md @@ -107,14 +107,14 @@ yarn deploy:semaphore --semaphoreVerifier
> **Note** > Run `yarn deploy:semaphore --help` to see the complete list. -If you want to deploy your contract in a specific network you can set up the `DEFAULT_NETWORK` variable in your `.env` file with the name of one of our supported networks (hardhat, localhost, goerli, arbitrum). Or you can specify it as an option: +If you want to deploy your contract in a specific network you can set up the `DEFAULT_NETWORK` variable in your `.env` file with the name of one of our supported networks (hardhat, localhost, sepolia, arbitrum). Or you can specify it as an option: ```bash -yarn deploy:semaphore --network goerli yarn deploy:semaphore --network sepolia yarn deploy:semaphore --network mumbai -yarn deploy:semaphore --network optimism-goerli +yarn deploy:semaphore --network optimism-sepolia +yarn deploy:semaphore --network arbitrum-sepolia yarn deploy:semaphore --network arbitrum ``` -If you want to deploy contracts on Goerli or Arbitrum, remember to provide a valid private key and an Infura API in your `.env` file. +If you want to deploy contracts on Sepolia or Arbitrum, remember to provide a valid private key and an Infura API in your `.env` file. diff --git a/packages/contracts/hardhat.config.ts b/packages/contracts/hardhat.config.ts index 1cd148cbb..981806011 100644 --- a/packages/contracts/hardhat.config.ts +++ b/packages/contracts/hardhat.config.ts @@ -22,11 +22,6 @@ function getNetworks(): NetworksUserConfig { const accounts = [`0x${process.env.BACKEND_PRIVATE_KEY}`] return { - goerli: { - url: `https://goerli.infura.io/v3/${infuraApiKey}`, - chainId: 5, - accounts - }, sepolia: { url: `https://sepolia.infura.io/v3/${infuraApiKey}`, chainId: 11155111, @@ -37,14 +32,14 @@ function getNetworks(): NetworksUserConfig { chainId: 80001, accounts }, - "optimism-goerli": { - url: `https://optimism-goerli.infura.io/v3/${infuraApiKey}`, - chainId: 420, + "optimism-sepolia": { + url: `https://optimism-sepolia.infura.io/v3/${infuraApiKey}`, + chainId: 11155420, accounts }, - "arbitrum-goerli": { - url: "https://goerli-rollup.arbitrum.io/rpc", - chainId: 421613, + "arbitrum-sepolia": { + url: "https://sepolia-rollup.arbitrum.io/rpc", + chainId: 7745327, accounts }, arbitrum: { diff --git a/packages/data/README.md b/packages/data/README.md index 265636188..f6404ca69 100644 --- a/packages/data/README.md +++ b/packages/data/README.md @@ -127,7 +127,7 @@ await semaphoreSubgraph.isGroupMember( ) ``` -\# **new Ethers**(networkOrEthereumURL: Network | string = "goerli", options: EthersOptions = {}): _SemaphoreEthers_ +\# **new Ethers**(networkOrEthereumURL: Network | string = "sepolia", options: EthersOptions = {}): _SemaphoreEthers_ ```typescript import { SemaphoreEthers } from "@semaphore-protocol/data" diff --git a/packages/data/package.json b/packages/data/package.json index a44d0c57a..77fe0511c 100644 --- a/packages/data/package.json +++ b/packages/data/package.json @@ -35,8 +35,7 @@ "rollup-plugin-typescript2": "^0.31.2" }, "dependencies": { - "@ethersproject/contracts": "^5.7.0", - "@ethersproject/providers": "^5.7.0", - "axios": "^0.27.2" + "axios": "^0.27.2", + "ethers": "6.10.0" } } diff --git a/packages/data/src/ethers.test.ts b/packages/data/src/ethers.test.ts index 1b40fdacf..49cd11a90 100644 --- a/packages/data/src/ethers.test.ts +++ b/packages/data/src/ethers.test.ts @@ -6,8 +6,9 @@ jest.mock("./getEvents", () => ({ default: jest.fn() })) -jest.mock("@ethersproject/contracts", () => ({ +jest.mock("ethers", () => ({ __esModule: true, + ...jest.requireActual("ethers"), Contract: jest.fn( () => ({ @@ -29,12 +30,12 @@ describe("SemaphoreEthers", () => { semaphore = new SemaphoreEthers() const semaphore1 = new SemaphoreEthers("arbitrum") const semaphore2 = new SemaphoreEthers("mumbai") - const semaphore3 = new SemaphoreEthers("optimism-goerli") - const semaphore4 = new SemaphoreEthers("arbitrum-goerli") - const semaphore5 = new SemaphoreEthers("arbitrum-goerli", { - address: "0x0000000000000000000000000000000000000000", - startBlock: 0 - }) + // const semaphore3 = new SemaphoreEthers("optimism-sepolia") + // const semaphore4 = new SemaphoreEthers("arbitrum-sepolia") + // const semaphore5 = new SemaphoreEthers("arbitrum-sepolia", { + // address: "0x0000000000000000000000000000000000000000", + // startBlock: 0 + // }) const semaphore6 = new SemaphoreEthers("homestead", { address: "0x0000000000000000000000000000000000000000", startBlock: 0 @@ -44,9 +45,9 @@ describe("SemaphoreEthers", () => { expect(semaphore.contract).toBeInstanceOf(Object) expect(semaphore1.network).toBe("arbitrum") expect(semaphore2.network).toBe("maticmum") - expect(semaphore3.network).toBe("optimism-goerli") - expect(semaphore4.network).toBe("arbitrum-goerli") - expect(semaphore5.options.address).toContain("0x000000") + // expect(semaphore3.network).toBe("optimism-sepolia") + // expect(semaphore4.network).toBe("arbitrum-sepolia") + // expect(semaphore5.options.address).toContain("0x000000") expect(semaphore6.network).toBe("homestead") expect(semaphore6.options.startBlock).toBe(0) expect(semaphore6.options.address).toContain("0x000000") @@ -104,7 +105,7 @@ describe("SemaphoreEthers", () => { it("Should throw an error if the provider is not supported", () => { const fun = () => - new SemaphoreEthers("goerli", { + new SemaphoreEthers("sepolia", { provider: "hello" as any }) diff --git a/packages/data/src/ethers.ts b/packages/data/src/ethers.ts index 1f0e6c357..cf9a36725 100644 --- a/packages/data/src/ethers.ts +++ b/packages/data/src/ethers.ts @@ -1,18 +1,18 @@ -import { Contract } from "@ethersproject/contracts" import { AlchemyProvider, AnkrProvider, CloudflareProvider, + Contract, EtherscanProvider, InfuraProvider, JsonRpcProvider, PocketProvider, Provider -} from "@ethersproject/providers" +} from "ethers" import checkParameter from "./checkParameter" import getEvents from "./getEvents" import SemaphoreABI from "./semaphoreABI.json" -import { EthersOptions, GroupResponse, EthersNetwork } from "./types" +import { EthersNetwork, EthersOptions, GroupResponse } from "./types" export default class SemaphoreEthers { private _network: EthersNetwork | string @@ -46,7 +46,7 @@ export default class SemaphoreEthers { options.address ??= "0xc60E0Ee1a2770d5F619858C641f14FC4a6401520" options.startBlock ??= 77278430 break - case "arbitrum-goerli": + case "arbitrum-sepolia": options.address ??= "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131" options.startBlock ??= 15174410 break @@ -54,15 +54,11 @@ export default class SemaphoreEthers { options.address ??= "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131" options.startBlock ??= 33995010 break - case "goerli": - options.address ??= "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131" - options.startBlock ??= 8777695 - break case "sepolia": options.address ??= "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131" options.startBlock ??= 3231111 break - case "optimism-goerli": + case "optimism-sepolia": options.address ??= "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131" options.startBlock ??= 7632846 break @@ -84,7 +80,7 @@ export default class SemaphoreEthers { provider = new AlchemyProvider(networkOrEthereumURL, options.apiKey) break case "cloudflare": - provider = new CloudflareProvider(networkOrEthereumURL, options.apiKey) + provider = new CloudflareProvider(networkOrEthereumURL) break case "etherscan": provider = new EtherscanProvider(networkOrEthereumURL, options.apiKey) diff --git a/packages/data/src/getEvents.ts b/packages/data/src/getEvents.ts index 9197429ca..8b7437563 100644 --- a/packages/data/src/getEvents.ts +++ b/packages/data/src/getEvents.ts @@ -1,5 +1,5 @@ /* istanbul ignore file */ -import { Contract } from "@ethersproject/contracts" +import { Contract, EventLog } from "ethers" /** * Returns the list of events of a contract with possible filters. @@ -16,7 +16,7 @@ export default async function getEvents( startBlock: number = 0 ): Promise { const filter = contract.filters[eventName](...filterArgs) - const events = await contract.queryFilter(filter, startBlock) + const events = (await contract.queryFilter(filter, startBlock)) as EventLog[] return events.map(({ args, blockNumber }) => ({ ...args, blockNumber })) } diff --git a/packages/data/src/getURL.ts b/packages/data/src/getURL.ts index 193ef6667..dde09f89d 100644 --- a/packages/data/src/getURL.ts +++ b/packages/data/src/getURL.ts @@ -8,10 +8,9 @@ import { SupportedNetwork } from "./types" export default function getURL(supportedNetwork: SupportedNetwork | string): string { switch (supportedNetwork) { case "sepolia": - case "goerli": case "mumbai": - case "optimism-goerli": - case "arbitrum-goerli": + case "optimism-sepolia": + case "arbitrum-sepolia": case "arbitrum": return `https://api.studio.thegraph.com/query/14377/semaphore-${supportedNetwork}/v3.6.1` default: diff --git a/packages/data/src/index.test.ts b/packages/data/src/index.test.ts index 8320b0c98..0fb047734 100644 --- a/packages/data/src/index.test.ts +++ b/packages/data/src/index.test.ts @@ -5,7 +5,7 @@ describe("Data", () => { it("Should return a list of supported networks", () => { const supportedNetworks = getSupportedNetworks() - expect(supportedNetworks).toHaveLength(6) + expect(supportedNetworks).toHaveLength(5) expect(supportedNetworks).toContain("sepolia") }) }) diff --git a/packages/data/src/types/index.ts b/packages/data/src/types/index.ts index 15c07a851..61daab393 100644 --- a/packages/data/src/types/index.ts +++ b/packages/data/src/types/index.ts @@ -1,22 +1,20 @@ export enum SupportedNetwork { SEPOLIA = "sepolia", - GOERLI = "goerli", MUMBAI = "mumbai", - OPTIMISM_GOERLI = "optimism-goerli", - ARBITRUM_GOERLI = "arbitrum-goerli", + OPTIMISM_SEPOLIA = "optimism-sepolia", + ARBITRUM_SEPOLIA = "arbitrum-sepolia", ARBITRUM = "arbitrum" } export type EthersNetwork = | "homestead" | "matic" - | "goerli" | "arbitrum" | "maticmum" | "mumbai" - | "arbitrum-goerli" + | "arbitrum-sepolia" | "optimism" - | "optimism-goerli" + | "optimism-sepolia" | "sepolia" export type GroupOptions = { diff --git a/scripts/clean-apps.ts b/scripts/clean-apps.ts new file mode 100644 index 000000000..e4ab667f3 --- /dev/null +++ b/scripts/clean-apps.ts @@ -0,0 +1,30 @@ +import { readdirSync, rmSync } from "fs" + +const folderName = "apps" + +const gitIgnored = [ + "node_modules", + "build", + ".next", + "generated", + "out", + "subgraph.yaml", + "tests/.bin", + ".docusaurus", + ".cache-loader" +] + +async function main() { + const apps = readdirSync(folderName, { withFileTypes: true }) + .filter((file) => file.isDirectory()) + .map((dir) => dir.name) + + apps.map((app) => gitIgnored.map((f) => rmSync(`${folderName}/${app}/${f}`, { recursive: true, force: true }))) +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error) + process.exit(1) + }) diff --git a/scripts/clean-cli-templates.ts b/scripts/clean-cli-templates.ts new file mode 100644 index 000000000..ae61c94b5 --- /dev/null +++ b/scripts/clean-cli-templates.ts @@ -0,0 +1,26 @@ +import { rmSync } from "fs" + +const folderName = "packages" + +const gitIgnored = [ + "contracts/build", + "contracts/cache", + "contracts/node_modules", + "web-app/node_modules", + "web-app/.next" +] + +const packages = ["cli-template-monorepo-ethers", "cli-template-monorepo-subgraph"] + +async function main() { + packages.map((pkg) => + gitIgnored.map((f) => rmSync(`${folderName}/${pkg}/apps/${f}`, { recursive: true, force: true })) + ) +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error) + process.exit(1) + }) diff --git a/scripts/clean-packages.ts b/scripts/clean-packages.ts new file mode 100644 index 000000000..3aefd8c7a --- /dev/null +++ b/scripts/clean-packages.ts @@ -0,0 +1,23 @@ +import { readdirSync, rmSync } from "fs" + +const folderName = "packages" + +const gitIgnored = ["node_modules", "dist", "build", "ptau", "artifacts", "typechain-types", "cache"] + +async function main() { + const apps = readdirSync(folderName, { withFileTypes: true }) + .filter((file) => file.isDirectory()) + .map((dir) => dir.name) + + apps.map((app) => gitIgnored.map((f) => rmSync(`${folderName}/${app}/${f}`, { recursive: true, force: true }))) + + rmSync(`${folderName}/circuit/main`, { recursive: true, force: true }) + rmSync(`${folderName}/circuit/test`, { recursive: true, force: true }) +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error) + process.exit(1) + }) diff --git a/scripts/remove-template-files.ts b/scripts/remove-template-files.ts deleted file mode 100644 index 8f00c2feb..000000000 --- a/scripts/remove-template-files.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { rmSync } from "fs" - -async function main() { - const templates = ["cli-template-monorepo-ethers", "cli-template-monorepo-subgraph"] - const files: string[] = [ - "contracts/build", - "contracts/cache", - "contracts/node_modules", - "web-app/node_modules", - "web-app/.next", - "web-app/next-env.d.ts" - ] - - templates.map((template) => - files.map((file) => rmSync(`packages/${template}/apps/${file}`, { recursive: true, force: true })) - ) -} - -main() - .then(() => process.exit(0)) - .catch((error) => { - console.error(error) - process.exit(1) - }) diff --git a/yarn.lock b/yarn.lock index b52f0c204..5538732dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5984,7 +5984,7 @@ __metadata: languageName: node linkType: hard -"@ethersproject/contracts@npm:5.7.0, @ethersproject/contracts@npm:^5.7.0": +"@ethersproject/contracts@npm:5.7.0": version: 5.7.0 resolution: "@ethersproject/contracts@npm:5.7.0" dependencies: @@ -6133,7 +6133,7 @@ __metadata: languageName: node linkType: hard -"@ethersproject/providers@npm:5.7.2, @ethersproject/providers@npm:^5.4.7, @ethersproject/providers@npm:^5.7.0, @ethersproject/providers@npm:^5.7.1, @ethersproject/providers@npm:^5.7.2": +"@ethersproject/providers@npm:5.7.2, @ethersproject/providers@npm:^5.4.7, @ethersproject/providers@npm:^5.7.1, @ethersproject/providers@npm:^5.7.2": version: 5.7.2 resolution: "@ethersproject/providers@npm:5.7.2" dependencies: @@ -8700,10 +8700,9 @@ __metadata: version: 0.0.0-use.local resolution: "@semaphore-protocol/data@workspace:packages/data" dependencies: - "@ethersproject/contracts": ^5.7.0 - "@ethersproject/providers": ^5.7.0 "@rollup/plugin-json": ^6.0.0 axios: ^0.27.2 + ethers: 6.10.0 rollup-plugin-cleanup: ^3.2.1 rollup-plugin-typescript2: ^0.31.2 languageName: unknown @@ -16971,6 +16970,21 @@ __metadata: languageName: node linkType: hard +"ethers@npm:6.10.0": + version: 6.10.0 + resolution: "ethers@npm:6.10.0" + dependencies: + "@adraffy/ens-normalize": 1.10.0 + "@noble/curves": 1.2.0 + "@noble/hashes": 1.3.2 + "@types/node": 18.15.13 + aes-js: 4.0.0-beta.5 + tslib: 2.4.0 + ws: 8.5.0 + checksum: 6f0a834b9b9bb31eceda9ac0a841b1061d5e2eefb5d0b042013db1c5abf48fa993ec0a602ae4c64d9e259d495fc01c100cf61f17e928e09eb43f0c7860f2a317 + languageName: node + linkType: hard + "ethers@npm:^4.0.32, ethers@npm:^4.0.40": version: 4.0.49 resolution: "ethers@npm:4.0.49"