@semaphore-protocol/subgraph
v3.1.0
Published
A library to query Semaphore contracts.
Downloads
18
Readme
| This library allows you to query the Semaphore.sol
contract data (i.e. groups) using the Semaphore subgraph on Goerli and Arbitrum One. It can be used on Node.js and browsers. |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
🛠 Install
npm or yarn
Install the @semaphore-protocol/subgraph
package with npm:
npm i @semaphore-protocol/subgraph
or yarn:
yarn add @semaphore-protocol/subgraph
CDN
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>
📜 Usage
# new Subgraph(network: Network = "goerli" ): 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 })