Skip to content

Commit

Permalink
docs: update group parameter types
Browse files Browse the repository at this point in the history
Former-commit-id: 56c7fc8
  • Loading branch information
cedoor committed Mar 28, 2024
1 parent 072d94f commit 663bea7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions apps/docs/versioned_docs/version-V4-beta/guides/groups.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ You can also initialize a group with multiple members by passing the list of ide

```ts
const members = [
"11237622825477336339577122413451117718539783476837539122310492284566644730311",
"9332663527862709610616009715800254142772436825222910251631161087138559093425",
"13255821893820536903335282929376140649646180444238593676033702344407594536519"
11237622825477336339577122413451117718539783476837539122310492284566644730311n,
9332663527862709610616009715800254142772436825222910251631161087138559093425n,
13255821893820536903335282929376140649646180444238593676033702344407594536519n
]

const group2 = new Group(members)
Expand Down Expand Up @@ -117,7 +117,7 @@ group.removeMember(0)
To update members in a group, pass the member index and the new value to the `updateMember` method. For example:

```ts
group.updateMember(0, 2)
group.updateMember(0, 2n)
```

:::caution
Expand Down
18 changes: 9 additions & 9 deletions packages/group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const { commitment } = new Identity()

group.addMember(commitment)

// "12989101133047504182892154686643420754368236204022364847543591045056549053997"
// 12989101133047504182892154686643420754368236204022364847543591045056549053997n
console.log(group.members[0])
```

Expand All @@ -121,31 +121,31 @@ group.addMembers([identity1.commitment, identity2.commitment])
```typescript
import { Group } from "@semaphore-protocol/group"

const group = new Group([1, 3])
const group = new Group([1n, 3n])

group.updateMember(0, 2)

console.log(group.members[0]) // "2"
console.log(group.members[0]) // "2n"
```

\# **removeMember**(index: _number_)

```typescript
import { Group } from "@semaphore-protocol/group"

const group = new Group([1, 3])
const group = new Group([1n, 3n])

group.removeMember(0)

console.log(group.members[0]) // "0"
console.log(group.members[0]) // 0n
```

\# **indexOf**(member: _BigNumberish_): _number_

```typescript
import { Group } from "@semaphore-protocol/group"

const group = new Group([1])
const group = new Group([1n])

const index = group.indexOf(1)

Expand All @@ -157,7 +157,7 @@ console.log(index) // 0
```typescript
import { Group } from "@semaphore-protocol/group"

const group = new Group([1, 3])
const group = new Group([1n, 3n])

const proof = group.generateMerkleProof(0)

Expand All @@ -177,7 +177,7 @@ console.log(proof)
```typescript
import { Group } from "@semaphore-protocol/group"

const group = new Group([1, 2, 3])
const group = new Group([1n, 2n, 3n])

const exportedGroup = group.export()

Expand All @@ -192,7 +192,7 @@ console.log(exportedGroup)
```typescript
import { Group } from "@semaphore-protocol/group"

const group1 = new Group([1, 2, 3])
const group1 = new Group([1n, 2n, 3n])

const exportedGroup = group.export()

Expand Down

0 comments on commit 663bea7

Please sign in to comment.