Files
semaphore/packages/subgraph
cedoor 44860d70b9 chore: v3.0.0
Former-commit-id: 439a357173
2023-01-26 22:52:52 +01:00
..
2023-01-23 16:22:59 +01:00
2022-09-16 16:50:30 +02:00
2023-01-26 22:52:52 +01:00
2022-09-16 16:50:30 +02:00

Semaphore subgraph

A library to query Semaphore contracts.

Github license NPM version Downloads Linter eslint Code style prettier

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 })