Skip to content

Commit

Permalink
feat: add identitycommitment as groups filter
Browse files Browse the repository at this point in the history
Allow to filter on identity commitments when getting subgraph groups
  • Loading branch information
wslyvh committed Aug 14, 2023
1 parent 7d26d4e commit 369257d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/data/src/subgraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,15 @@ export default class SemaphoreSubgraph {
let filtersQuery = ""

if (options.filters) {
const { admin, timestamp, timestampGte, timestampLte } = options.filters
const { admin, identityCommitment, timestamp, timestampGte, timestampLte } = options.filters
const filterFragments = []

if (admin) {
filterFragments.push(`admin: "${admin}"`)
}
if (identityCommitment) {
filterFragments.push(`members_: { identityCommitment: "${identityCommitment}" }`)
}

/* istanbul ignore next */
if (timestamp) {
Expand Down
1 change: 1 addition & 0 deletions packages/data/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export type GroupOptions = {
verifiedProofs?: boolean
filters?: {
admin?: string
identityCommitment?: string
timestamp?: Date
timestampGte?: Date
timestampLte?: Date
Expand Down

0 comments on commit 369257d

Please sign in to comment.