Skip to content

Latest commit

 

History

History
 
 

subgraph

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 Kovan, 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 = "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 })