A library to query Semaphore contracts.
This library allows you to query the Semaphore.sol contract data (i.e. groups) using the Semaphore subgraph on Kovan, Goerli, and Arbitrum One. It can be used on Node.js and browsers. |
---|
Install the @semaphore-protocol/subgraph
package with npm:
npm i @semaphore-protocol/subgraph
or yarn:
yarn add @semaphore-protocol/subgraph
You can also load it using a script
tag using unpkg:
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://unpkg.com/@semaphore-protocol/subgraph/"></script>
or JSDelivr:
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@semaphore-protocol/subgraph/"></script>
# new Subgraph(network: Network = "arbitrum" ): Subgraph
import { Subgraph } from "@semaphore-protocol/subgraph"
const subgraph = new Subgraph()
# getGroups(options?: GroupOptions)
const groups = subgraph.getGroups()
// or
const groups = subgraph.getGroups({ members: true, verifiedProofs: true })
# getGroup(groupId: string, options?: GroupOptions)
const group = subgraph.getGroup("1")
// or
const { members, verifiedProofs } = subgraph.getGroup("1", { members: true, verifiedProofs: true })