ZK3 Client

The ZK3 client is a wrapper around the ZK3 GraphQL API.


import { ZK3Client } from 'zk3-sdk'

const zk3 = new ZK3Client()
// or if you plan on calling client methods from within useEffect in a component:
const zk3 = useMemo(() => new ZK3Client(), [])


Get Circle

// @param: id: string
// @return: circle object or null if circle doesn't exist
await zk3.getCircle(id)

Get Circles

// @param: commitment: string (optional)
// @return: array of circle objects that the commitment is a part of 
// or all circles if no commitment is provided
await zk3.getCircles(commitment)

Get Stats

// @return: stats object containing number of circles, 
// identities and proofs generated so far
await zk3.getStats()

All of the other methods of the client are used internally for the various hooks that enable seamless functionality in React. It is heavily recommended you use the hooks instead of the client methods.

Last updated