Skip to content

Commit af4fe8d

Browse files
vplasenciacedoor
andauthored
fix: cli templates (#830)
* fix(cli-template-monorepo-ethers): update hook dependencies * fix(cli-template-monorepo-subgraph): update hook dependencies * docs: update template readme files * Update packages/cli-template-contracts-hardhat/README.md Co-authored-by: Cedoor <me@cedoor.dev> * style: format code * docs: update note text style --------- Co-authored-by: Cedoor <me@cedoor.dev>
1 parent 90caadf commit af4fe8d

File tree

13 files changed

+35
-44
lines changed

13 files changed

+35
-44
lines changed

packages/cli-template-contracts-hardhat/README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,17 @@ cp .env.example .env
4646

4747
2. Add your environment variables.
4848

49-
> **Note**
49+
> [!NOTE]
5050
> You should at least set a valid Ethereum URL (e.g. Infura) and a private key with some ethers.
5151
5252
3. And deploy your contract.
5353

5454
```bash
55-
yarn deploy --semaphore <semaphore-address> --group <group-id> --network sepolia
55+
yarn deploy --semaphore <semaphore-address> --network sepolia
5656
```
5757

58-
> **Note**
59-
> Check the Semaphore contract addresses [here](https://docs.semaphore.pse.dev/deployed-contracts#semaphore).
60-
61-
> **Warning**
62-
> The group id is a number!
58+
> [!NOTE]
59+
> Check the Semaphore contract addresses [here](https://docs.semaphore.pse.dev/deployed-contracts).
6360
6461
### Code quality and formatting
6562

packages/cli-template-monorepo-ethers/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,16 @@ yarn dev
2525
1. Go to the `apps/contracts` directory and deploy your contract:
2626

2727
```bash
28-
yarn deploy --semaphore <semaphore-address> --group <group-id> --network arbitrum-sepolia
28+
yarn deploy --semaphore <semaphore-address> --network sepolia
2929
```
3030

31-
2. Update your `.env` file with your new contract address, the group id and the semaphore contract address.
31+
2. Update your `apps/web-app/.env.production` file with your new contract address and the group id.
3232

3333
3. Copy your contract artifacts from `apps/contracts/artifacts/contracts/` folder to `apps/web-app/contract-artifacts` folder manually.
3434

35-
> **Note**
35+
> [!NOTE]
3636
> Check the Semaphore contract addresses [here](https://docs.semaphore.pse.dev/deployed-contracts).
3737
38-
> **Warning**
39-
> The group id is a number!
40-
4138
### Code quality and formatting
4239

4340
Run [ESLint](https://eslint.org/) and [solhint](https://github.com/protofire/solhint) to analyze the code and catch bugs:
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
NEXT_PUBLIC_DEFAULT_NETWORK=sepolia
2-
NEXT_PUBLIC_FEEDBACK_CONTRACT_ADDRESS=0xC6446BB589E141fFACeaCd91953CbB0F2055C7e5
3-
NEXT_PUBLIC_SEMAPHORE_CONTRACT_ADDRESS=0x5B8e7cC7bAC61A4b952d472b67056B2f260ba6dc
2+
NEXT_PUBLIC_FEEDBACK_CONTRACT_ADDRESS=
3+
NEXT_PUBLIC_SEMAPHORE_CONTRACT_ADDRESS=0x1e0d7FF1610e480fC93BdEC510811ea2Ba6d7c2f
44
NEXT_PUBLIC_OPENZEPPELIN_AUTOTASK_WEBHOOK=https://api.defender.openzeppelin.com/actions/20fce2ae-844b-4ec0-a6a2-90a3350a9d2c/runs/webhook/303216d1-fa7d-4fca-8c5b-7ba1ba544fc7/2T7i9xrkZA5j37hoaQLUuw
5-
NEXT_PUBLIC_GROUP_ID=9
5+
NEXT_PUBLIC_GROUP_ID=

packages/cli-template-monorepo-ethers/apps/web-app/src/app/groups/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ export default function GroupsPage() {
2424
}
2525

2626
setIdentity(new Identity(privateKey))
27-
}, [])
27+
}, [router])
2828

2929
useEffect(() => {
3030
if (_users.length > 0) {
3131
setLogs(`${_users.length} user${_users.length > 1 ? "s" : ""} retrieved from the group 🤙🏽`)
3232
}
33-
}, [_users])
33+
}, [_users, setLogs])
3434

3535
const joinGroup = useCallback(async () => {
3636
if (!_identity) {
@@ -72,7 +72,7 @@ export default function GroupsPage() {
7272
}
7373

7474
setLoading(false)
75-
}, [_identity])
75+
}, [_identity, addUser, setLogs])
7676

7777
const userHasJoined = useCallback((identity: Identity) => _users.includes(identity.commitment.toString()), [_users])
7878

packages/cli-template-monorepo-ethers/apps/web-app/src/app/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function IdentitiesPage() {
2323
} else {
2424
setLogs("Create your Semaphore identity 👆🏽")
2525
}
26-
}, [])
26+
}, [setLogs])
2727

2828
const createIdentity = useCallback(async () => {
2929
const identity = new Identity()
@@ -33,7 +33,7 @@ export default function IdentitiesPage() {
3333
localStorage.setItem("identity", identity.privateKey.toString())
3434

3535
setLogs("Your new Semaphore identity has just been created 🎉")
36-
}, [])
36+
}, [setLogs])
3737

3838
return (
3939
<>

packages/cli-template-monorepo-ethers/apps/web-app/src/app/proofs/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ export default function ProofsPage() {
2424
}
2525

2626
setIdentity(new Identity(privateKey))
27-
}, [])
27+
}, [router])
2828

2929
useEffect(() => {
3030
if (_feedback.length > 0) {
3131
setLogs(`${_feedback.length} feedback retrieved from the group 🤙🏽`)
3232
}
33-
}, [_feedback])
33+
}, [_feedback, setLogs])
3434

3535
const sendFeedback = useCallback(async () => {
3636
if (!_identity) {
@@ -105,7 +105,7 @@ export default function ProofsPage() {
105105
setLoading(false)
106106
}
107107
}
108-
}, [_identity, _users])
108+
}, [_identity, _users, addFeedback, setLogs])
109109

110110
return (
111111
<>

packages/cli-template-monorepo-ethers/apps/web-app/src/components/PageContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function PageContainer({
2121
useEffect(() => {
2222
semaphore.refreshUsers()
2323
semaphore.refreshFeedback()
24-
}, [])
24+
}, [semaphore])
2525

2626
function getExplorerLink(network: SupportedNetwork, address: string) {
2727
switch (network) {

packages/cli-template-monorepo-subgraph/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,16 @@ yarn dev
2525
1. Go to the `apps/contracts` directory and deploy your contract:
2626

2727
```bash
28-
yarn deploy --semaphore <semaphore-address> --group <group-id> --network arbitrum-sepolia
28+
yarn deploy --semaphore <semaphore-address> --network sepolia
2929
```
3030

31-
2. Update your `.env` file with your new contract address, the group id and the semaphore contract address.
31+
2. Update your `apps/web-app/.env.production` file with your new contract address and the group id.
3232

3333
3. Copy your contract artifacts from `apps/contracts/artifacts/contracts/` folder to `apps/web-app/contract-artifacts` folder manually.
3434

35-
> **Note**
35+
> [!NOTE]
3636
> Check the Semaphore contract addresses [here](https://docs.semaphore.pse.dev/deployed-contracts).
3737
38-
> **Warning**
39-
> The group id is a number!
40-
4138
### Code quality and formatting
4239

4340
Run [ESLint](https://eslint.org/) and [solhint](https://github.com/protofire/solhint) to analyze the code and catch bugs:
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
NEXT_PUBLIC_DEFAULT_NETWORK=sepolia
2-
NEXT_PUBLIC_FEEDBACK_CONTRACT_ADDRESS=0xC6446BB589E141fFACeaCd91953CbB0F2055C7e5
3-
NEXT_PUBLIC_SEMAPHORE_CONTRACT_ADDRESS=0x5B8e7cC7bAC61A4b952d472b67056B2f260ba6dc
2+
NEXT_PUBLIC_FEEDBACK_CONTRACT_ADDRESS=
3+
NEXT_PUBLIC_SEMAPHORE_CONTRACT_ADDRESS=0x1e0d7FF1610e480fC93BdEC510811ea2Ba6d7c2f
44
NEXT_PUBLIC_OPENZEPPELIN_AUTOTASK_WEBHOOK=https://api.defender.openzeppelin.com/actions/20fce2ae-844b-4ec0-a6a2-90a3350a9d2c/runs/webhook/303216d1-fa7d-4fca-8c5b-7ba1ba544fc7/2T7i9xrkZA5j37hoaQLUuw
5-
NEXT_PUBLIC_GROUP_ID=9
5+
NEXT_PUBLIC_GROUP_ID=

packages/cli-template-monorepo-subgraph/apps/web-app/src/app/groups/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ export default function GroupsPage() {
2424
}
2525

2626
setIdentity(new Identity(privateKey))
27-
}, [])
27+
}, [router])
2828

2929
useEffect(() => {
3030
if (_users.length > 0) {
3131
setLogs(`${_users.length} user${_users.length > 1 ? "s" : ""} retrieved from the group 🤙🏽`)
3232
}
33-
}, [_users])
33+
}, [_users, setLogs])
3434

3535
const joinGroup = useCallback(async () => {
3636
if (!_identity) {
@@ -72,7 +72,7 @@ export default function GroupsPage() {
7272
}
7373

7474
setLoading(false)
75-
}, [_identity])
75+
}, [_identity, addUser, setLogs])
7676

7777
const userHasJoined = useCallback((identity: Identity) => _users.includes(identity.commitment.toString()), [_users])
7878

0 commit comments

Comments
 (0)