Skip to content

Commit

Permalink
Merge pull request #540 from semaphore-protocol/website/reflect-prs
Browse files Browse the repository at this point in the history
Reflect missing PRs on website after porting documentation to `semaphore` repository
  • Loading branch information
0xjei authored Jan 9, 2024
2 parents 514f309 + b61e1dd commit 767df87
Show file tree
Hide file tree
Showing 13 changed files with 257 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import TabItem from "@theme/TabItem"

# Semaphore data

Para obtener datos on-chain del contrato [Semaphore.sol](https://github.com/semaphore-protocol/semaphore/blob/main/packages/contracts/contracts/Semaphore.sol), puedes usar la librería [@semaphore-protocol/data](https://github.com/semaphore-protocol/semaphore/tree/main/packages/data).
Para obtener datos on-chain del contrato [Semaphore.sol](https://github.com/semaphore-protocol/semaphore/blob/main/packages/contracts/contracts/Semaphore.sol), puedes usar la librería [@semaphore-protocol/data](https://github.com/semaphore-protocol/semaphore/tree/main/packages/data).

Hay dos formas para hacer esto, usando [`SemaphoreSubgraph`](https://github.com/semaphore-protocol/semaphore/blob/main/packages/data/src/subgraph.ts) o [`SemaphoreEthers`](https://github.com/semaphore-protocol/semaphore/blob/main/packages/data/src/ethers.ts). La clase `SemaphoreSubgraph` usa el [subgrafo de Semaphore](https://github.com/semaphore-protocol/subgraph), el cual usa [The Graph Protocol](https://thegraph.com/) detrás del telón, y la clase `SemaphoreEthers` usa [Ethers](https://github.com/ethers-io/ethers.js/).

Expand All @@ -23,6 +23,7 @@ groupId="package-managers"
values={[
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]}>
<TabItem value="npm">

Expand All @@ -37,12 +38,19 @@ npm install @semaphore-protocol/data
yarn add @semaphore-protocol/data
```

</TabItem>
<TabItem value="pnpm">

```bash
pnpm add @semaphore-protocol/data
```

</TabItem>
</Tabs>

## Obtener datos usando SemaphoreSubgraph

Para obtener datos usando el subgrafo de Semaphore puedes usar la clase [`SemaphoreSubgraph`](https://github.com/semaphore-protocol/semaphore/blob/main/packages/data/src/subgraph.ts) del paquete [@semaphore-protocol/data](https://github.com/semaphore-protocol/semaphore/tree/main/packages/data).
Para obtener datos usando el subgrafo de Semaphore puedes usar la clase [`SemaphoreSubgraph`](https://github.com/semaphore-protocol/semaphore/blob/main/packages/data/src/subgraph.ts) del paquete [@semaphore-protocol/data](https://github.com/semaphore-protocol/semaphore/tree/main/packages/data).

```typescript
import { SemaphoreSubgraph } from "@semaphore-protocol/data"
Expand Down Expand Up @@ -109,7 +117,7 @@ const group = new Group(groupId, 20, members)

## Obtener datos usando SemaphoreEthers

Para obtener datos usando Ethers puedes usar la clase [`SemaphoreEthers`](https://github.com/semaphore-protocol/semaphore/blob/main/packages/data/src/ethers.ts) del paquete [@semaphore-protocol/data](https://github.com/semaphore-protocol/semaphore/tree/main/packages/data).
Para obtener datos usando Ethers puedes usar la clase [`SemaphoreEthers`](https://github.com/semaphore-protocol/semaphore/blob/main/packages/data/src/ethers.ts) del paquete [@semaphore-protocol/data](https://github.com/semaphore-protocol/semaphore/tree/main/packages/data).

```typescript
import { SemaphoreEthers } from "@semaphore-protocol/data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Utilice la clase `Group` de la librería [`@semaphore-protocol/group`](https://g

- `Group id`: un identificar único para el grupo;
- `Tree depth`: (_default `20`_) el número máximo de usuarios que puede contener un grupo, el valor por defecto es 20 (`max size = 2 ^ tree depth`).
- `Members`: (_default `[]`_) la lista de miembros para inicializar el grupo.
- `Members`: (_default `[]`_) la lista de miembros para inicializar el grupo.

#### Instalar librería:

Expand All @@ -49,6 +49,7 @@ groupId="package-managers"
values={[
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]}>
<TabItem value="npm">

Expand All @@ -63,6 +64,13 @@ npm install @semaphore-protocol/group
yarn add @semaphore-protocol/group
```

</TabItem>
<TabItem value="pnpm">

```bash
pnpm add @semaphore-protocol/group
```

</TabItem>
</Tabs>

Expand Down Expand Up @@ -148,4 +156,4 @@ Alternativamente, puede utilizar un contrato [`Semaphore.sol`](https://github.co

:::caution
`Semaphore.sol` incluye un mecanismo para verificar pruebas Semaphore creadas con raíces de árboles de Merkle antiguas. La duración de este mecanismo puede ser definido por el admin en la función `createGroup`. Por lo tanto, los miembros de un grupo pueden continuar generando pruebas válidas incluso después de ser removidos. Para más información ver el issue [#98](https://github.com/semaphore-protocol/semaphore/issues/98).
:::
:::
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,26 @@ groupId="package-managers"
values={[
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]}>
<TabItem value="npm">

```bash
npm install @semaphore-protocol/identity
```

</TabItem>
<TabItem value="yarn">

```bash
yarn add @semaphore-protocol/identity
```

</TabItem>
<TabItem value="pnpm">

```bash
pnpm add @semaphore-protocol/identity
```

</TabItem>
</Tabs>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ groupId="package-managers"
values={[
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]}>
<TabItem value="npm">

Expand All @@ -51,6 +52,12 @@ npm install @semaphore-protocol/proof
```bash
yarn add @semaphore-protocol/proof
```
</TabItem>
<TabItem value="pnpm">

```bash
pnpm add @semaphore-protocol/proof
```

</TabItem>
</Tabs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ groupId="package-managers"
values={[
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]}>
<TabItem value="npm">

Expand All @@ -51,6 +52,14 @@ npm i
cd my-app
yarn
```
</TabItem>

<TabItem value="pnpm">

```bash
cd my-app
pnpm install
```

</TabItem>
</Tabs>
Expand All @@ -63,21 +72,21 @@ El comando `create` creará un directorio con el nombre my-app (o cualquier nomb
my-app
├── .yarn
├── apps
   └── contracts
│ │   └── contracts
| │ │   └── Feedback.sol
│ │   └── scripts
| │ │   └── download-snark-artifacts.ts
│ │   └── tasks
| │ │   └── deploy.ts
│ │   └── test
| │ │   └── Feedback.ts
│ │   └── hardhat.config.ts
│ │   └── package.json
│ │   └── tsconfig.json
   └── web-app
└── contracts
│ │ └── contracts
| │ │ └── Feedback.sol
│ │ └── scripts
| │ │ └── download-snark-artifacts.ts
│ │ └── tasks
| │ │ └── deploy.ts
│ │ └── test
| │ │ └── Feedback.ts
│ │ └── hardhat.config.ts
│ │ └── package.json
│ │ └── tsconfig.json
└── web-app
├── scripts
   └── copy-contracts-artifacts.ts
└── copy-contracts-artifacts.ts
├── .editorconfig
├── .env
├── .env.example
Expand Down Expand Up @@ -112,6 +121,7 @@ groupId="package-managers"
values={[
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]}>
<TabItem value="npm">

Expand All @@ -126,6 +136,13 @@ npm run compile
yarn compile
```

</TabItem>
<TabItem value="pnpm">

```bash
pnpm compile
```

</TabItem>
</Tabs>

Expand All @@ -139,6 +156,7 @@ groupId="package-managers"
values={[
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]}>
<TabItem value="npm">

Expand All @@ -153,6 +171,13 @@ npm test
yarn test
```

</TabItem>
<TabItem value="pnpm">

```bash
pnpm test
```

</TabItem>
</Tabs>

Expand All @@ -164,6 +189,7 @@ groupId="package-managers"
values={[
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]}>
<TabItem value="npm">

Expand All @@ -178,6 +204,13 @@ npm run test:coverage
yarn test:coverage
```

</TabItem>
<TabItem value="pnpm">

```bash
pnpm test:coverage
```

</TabItem>
</Tabs>

Expand All @@ -189,6 +222,7 @@ groupId="package-managers"
values={[
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]}>
<TabItem value="npm">

Expand All @@ -203,6 +237,13 @@ npm run test:report-gas
yarn test:report-gas
```

</TabItem>
<TabItem value="pnpm">

```bash
pnpm test:report-gas
```

</TabItem>
</Tabs>

Expand All @@ -226,6 +267,7 @@ En la carpeta raíz del proyecto:
values={[
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]}>
<TabItem value="npm">

Expand All @@ -240,6 +282,13 @@ En la carpeta raíz del proyecto:
yarn deploy --semaphore <semaphore-address> --group <group-id> --network goerli
```

</TabItem>
<TabItem value="pnpm">

```bash
pnpm deploy --semaphore <semaphore-address> --group <group-id> --network goerli
```

</TabItem>
</Tabs>

Expand All @@ -261,6 +310,7 @@ groupId="package-managers"
values={[
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]}>
<TabItem value="npm">

Expand All @@ -276,4 +326,11 @@ yarn dev
```

</TabItem>
</Tabs>
<TabItem value="pnpm">

```bash
pnpm dev
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ groupId="package-managers"
values={[
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]}>
<TabItem value="npm">

Expand All @@ -89,6 +90,13 @@ npm install @esbuild-plugins/node-globals-polyfill
yarn add @esbuild-plugins/node-globals-polyfill
```

</TabItem>
<TabItem value="pnpm">

```bash
pnpm add @esbuild-plugins/node-globals-polyfill
```

</TabItem>
</Tabs>

Expand All @@ -98,6 +106,7 @@ groupId="package-managers"
values={[
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]}>
<TabItem value="npm">

Expand All @@ -112,6 +121,13 @@ npm install @esbuild-plugins/node-modules-polyfill
yarn add @esbuild-plugins/node-modules-polyfill
```

</TabItem>
<TabItem value="pnpm">

```bash
pnpm add @esbuild-plugins/node-modules-polyfill
```

</TabItem>
</Tabs>

Expand Down Expand Up @@ -220,4 +236,4 @@ Para comprobarlo, puede utilizar la [Semaphore CLI](https://github.com/semaphore

### Transacción revertida al usar el mismo external nullifier

Cuando genera una prueba usando el mismo external nullifier que usó para verificar una prueba antes, la transacción se revertirá porque ese external nullifier ya se usó. Si desea enviar y verificar varias pruebas de la misma identidad, debe usar un external nullifier diferente cada vez que genere una prueba.
Cuando genera una prueba usando el mismo external nullifier que usó para verificar una prueba antes, la transacción se revertirá porque ese external nullifier ya se usó. Si desea enviar y verificar varias pruebas de la misma identidad, debe usar un external nullifier diferente cada vez que genere una prueba.
Loading

0 comments on commit 767df87

Please sign in to comment.