From d21d6e2f15645ce82fba9b491db453194e254549 Mon Sep 17 00:00:00 2001 From: Han <56923450+waddaboo@users.noreply.github.com> Date: Thu, 17 Oct 2024 18:18:39 +0800 Subject: [PATCH 1/9] feat(api): add type to group to indicate group type --- apps/api/src/app/groups/docSchemas/group.ts | 2 ++ apps/api/src/app/groups/docSchemas/groupResponse.ts | 2 ++ apps/api/src/app/groups/dto/create-group.dto.ts | 10 +++++++++- apps/api/src/app/groups/entities/group.entity.ts | 8 ++++++++ apps/api/src/app/groups/groups.service.ts | 2 ++ apps/api/src/app/groups/types/index.ts | 5 +++++ 6 files changed, 28 insertions(+), 1 deletion(-) diff --git a/apps/api/src/app/groups/docSchemas/group.ts b/apps/api/src/app/groups/docSchemas/group.ts index bfca9425..1175c097 100644 --- a/apps/api/src/app/groups/docSchemas/group.ts +++ b/apps/api/src/app/groups/docSchemas/group.ts @@ -8,6 +8,8 @@ export class Group { @ApiProperty() description: string @ApiProperty() + type: string + @ApiProperty() admin: string @ApiProperty() treeDepth: number diff --git a/apps/api/src/app/groups/docSchemas/groupResponse.ts b/apps/api/src/app/groups/docSchemas/groupResponse.ts index 7f890bcd..62b48760 100644 --- a/apps/api/src/app/groups/docSchemas/groupResponse.ts +++ b/apps/api/src/app/groups/docSchemas/groupResponse.ts @@ -8,6 +8,8 @@ export class GroupResponse { @ApiProperty() description: string @ApiProperty() + type: string + @ApiProperty() adminId: string @ApiProperty() treeDepth: number diff --git a/apps/api/src/app/groups/dto/create-group.dto.ts b/apps/api/src/app/groups/dto/create-group.dto.ts index 7fc0bad1..799e6ed8 100644 --- a/apps/api/src/app/groups/dto/create-group.dto.ts +++ b/apps/api/src/app/groups/dto/create-group.dto.ts @@ -8,9 +8,11 @@ import { MinLength, NotContains, IsNumberString, - IsJSON + IsJSON, + IsEnum } from "class-validator" import { ApiProperty } from "@nestjs/swagger" +import { GroupType } from "../types" export class CreateGroupDto { @IsString() @@ -30,6 +32,12 @@ export class CreateGroupDto { @ApiProperty() readonly description: string + @IsEnum(GroupType) + @ApiProperty({ + enum: GroupType + }) + readonly type: GroupType + @IsNumber() @Min(16) @Max(32) diff --git a/apps/api/src/app/groups/entities/group.entity.ts b/apps/api/src/app/groups/entities/group.entity.ts index 05cc20c9..38827b29 100644 --- a/apps/api/src/app/groups/entities/group.entity.ts +++ b/apps/api/src/app/groups/entities/group.entity.ts @@ -12,6 +12,7 @@ import { import { OAuthAccount } from "../../credentials/entities/credentials-account.entity" import { Member } from "./member.entity" import { Invite } from "../../invites/entities/invite.entity" +import { GroupType } from "../types" @Entity("groups") export class Group { @@ -25,6 +26,13 @@ export class Group { @Column() description: string + @Column({ + type: "simple-enum", + enum: GroupType, + nullable: true + }) + type: GroupType + @Column({ name: "admin_id" }) adminId: string diff --git a/apps/api/src/app/groups/groups.service.ts b/apps/api/src/app/groups/groups.service.ts index 8db01f55..72d2e264 100644 --- a/apps/api/src/app/groups/groups.service.ts +++ b/apps/api/src/app/groups/groups.service.ts @@ -149,6 +149,7 @@ export class GroupsService { id: groupId, name, description, + type, treeDepth, fingerprintDuration, credentials @@ -167,6 +168,7 @@ export class GroupsService { id: _groupId, name, description, + type, treeDepth, fingerprintDuration, credentials, diff --git a/apps/api/src/app/groups/types/index.ts b/apps/api/src/app/groups/types/index.ts index 478ae130..2b7b09bc 100644 --- a/apps/api/src/app/groups/types/index.ts +++ b/apps/api/src/app/groups/types/index.ts @@ -4,3 +4,8 @@ export type MerkleProof = { siblings: any[] pathIndices: number[] } + +export enum GroupType { + ONCHAIN = "on-chain", + OFFCHAIN = "off-chain" +} From 90445fcac9098a812aacf5fa682536a81afba9aa Mon Sep 17 00:00:00 2001 From: Han <56923450+waddaboo@users.noreply.github.com> Date: Thu, 17 Oct 2024 18:19:26 +0800 Subject: [PATCH 2/9] test(api): update test to include group type --- .../credentials/credentials.service.test.ts | 9 ++++ .../api/src/app/groups/groups.service.test.ts | 54 +++++++++++++++---- .../src/app/invites/invites.service.test.ts | 7 +++ 3 files changed, 61 insertions(+), 9 deletions(-) diff --git a/apps/api/src/app/credentials/credentials.service.test.ts b/apps/api/src/app/credentials/credentials.service.test.ts index ae8d7775..fe2aa60a 100644 --- a/apps/api/src/app/credentials/credentials.service.test.ts +++ b/apps/api/src/app/credentials/credentials.service.test.ts @@ -14,6 +14,7 @@ import { InvitesService } from "../invites/invites.service" import { OAuthAccount } from "./entities/credentials-account.entity" import { CredentialsService } from "./credentials.service" import { AdminsModule } from "../admins/admins.module" +import { GroupType } from "../groups/types" jest.mock("@bandada/utils", () => { const originalModule = jest.requireActual("@bandada/utils") @@ -83,6 +84,7 @@ describe("CredentialsService", () => { { name: "Group1", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: JSON.stringify({ @@ -104,6 +106,7 @@ describe("CredentialsService", () => { { name: "Group2", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -186,6 +189,7 @@ describe("CredentialsService", () => { { name: "Group2", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: JSON.stringify({ @@ -232,6 +236,7 @@ describe("CredentialsService", () => { { name: "Group2", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: JSON.stringify({ @@ -337,6 +342,7 @@ describe("CredentialsService", () => { { name: "Group2", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: JSON.stringify({ @@ -387,6 +393,7 @@ describe("CredentialsService", () => { { name: "Group3", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: JSON.stringify({ @@ -439,6 +446,7 @@ describe("CredentialsService", () => { { name: "Group4", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: JSON.stringify({ @@ -492,6 +500,7 @@ describe("CredentialsService", () => { { name: "Group5", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: JSON.stringify({ diff --git a/apps/api/src/app/groups/groups.service.test.ts b/apps/api/src/app/groups/groups.service.test.ts index 4d353337..a45279b3 100644 --- a/apps/api/src/app/groups/groups.service.test.ts +++ b/apps/api/src/app/groups/groups.service.test.ts @@ -13,6 +13,7 @@ import { AdminsModule } from "../admins/admins.module" import { Admin } from "../admins/entities/admin.entity" import { CreateGroupDto } from "./dto/create-group.dto" import { UpdateGroupDto } from "./dto/update-group.dto" +import { GroupType } from "./types" jest.mock("@bandada/utils", () => { const originalModule = jest.requireActual("@bandada/utils") @@ -66,6 +67,7 @@ describe("GroupsService", () => { { name: "Group1", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -77,16 +79,19 @@ describe("GroupsService", () => { describe("# createGroup", () => { it("Should create a group", async () => { - const { treeDepth, members } = await groupsService.createGroup( - { - name: "Group2", - description: "This is a description", - treeDepth: 16, - fingerprintDuration: 3600 - }, - "admin" - ) + const { type, treeDepth, members } = + await groupsService.createGroup( + { + name: "Group2", + description: "This is a description", + type: GroupType.OFFCHAIN, + treeDepth: 16, + fingerprintDuration: 3600 + }, + "admin" + ) + expect(type).toBe(GroupType.OFFCHAIN) expect(treeDepth).toBe(16) expect(members).toHaveLength(0) }) @@ -98,6 +103,7 @@ describe("GroupsService", () => { { name: "Group3", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -126,6 +132,7 @@ describe("GroupsService", () => { { name: "Group4", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: { @@ -200,6 +207,7 @@ describe("GroupsService", () => { { name: "Group01", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -211,6 +219,7 @@ describe("GroupsService", () => { { name: "Group02", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -229,6 +238,7 @@ describe("GroupsService", () => { { name: "MemberGroup", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -319,6 +329,7 @@ describe("GroupsService", () => { { name: "MemberGroup", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -382,6 +393,7 @@ describe("GroupsService", () => { { name: "Group2", description: "This is a new group", + type: GroupType.OFFCHAIN, treeDepth: 21, fingerprintDuration: 3600 }, @@ -426,6 +438,7 @@ describe("GroupsService", () => { { name: "Group2", description: "This is a new group", + type: GroupType.OFFCHAIN, treeDepth: 21, fingerprintDuration: 3600 }, @@ -455,6 +468,7 @@ describe("GroupsService", () => { const groupDto: CreateGroupDto = { name: "Group", description: "This is a new group", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 } @@ -611,6 +625,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -618,6 +633,7 @@ describe("GroupsService", () => { id: "2", name: "Group2", description: "This is a new group2", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -625,6 +641,7 @@ describe("GroupsService", () => { id: "3", name: "Group3", description: "This is a new group3", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 } @@ -785,6 +802,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 } @@ -888,6 +906,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -895,6 +914,7 @@ describe("GroupsService", () => { id: "2", name: "Group2", description: "This is a new group2", + type: GroupType.OFFCHAIN, treeDepth: 32, fingerprintDuration: 7200 } @@ -1028,6 +1048,7 @@ describe("GroupsService", () => { { name: "Group2", description: "This is a new group", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -1178,6 +1199,7 @@ describe("GroupsService", () => { { name: "Group2", description: "This is a new group", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -1202,6 +1224,7 @@ describe("GroupsService", () => { { name: "Credential Group", description: "This is a new group", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: { @@ -1350,6 +1373,7 @@ describe("GroupsService", () => { { name: "Group2", description: "This is a new group", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -1398,6 +1422,7 @@ describe("GroupsService", () => { { name: "Group2", description: "This is a new group", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -1425,6 +1450,7 @@ describe("GroupsService", () => { { name: "Credential Group", description: "This is a new group", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: { @@ -1476,6 +1502,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 } @@ -1518,6 +1545,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -1525,6 +1553,7 @@ describe("GroupsService", () => { id: "2", name: "Group2", description: "This is a new group2", + type: GroupType.OFFCHAIN, treeDepth: 32, fingerprintDuration: 7200 } @@ -1571,6 +1600,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 } @@ -1623,6 +1653,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -1630,6 +1661,7 @@ describe("GroupsService", () => { id: "2", name: "Group2", description: "This is a new group2", + type: GroupType.OFFCHAIN, treeDepth: 32, fingerprintDuration: 7200 } @@ -1706,6 +1738,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 } @@ -1778,6 +1811,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -1785,6 +1819,7 @@ describe("GroupsService", () => { id: "2", name: "Group2", description: "This is a new group2", + type: GroupType.OFFCHAIN, treeDepth: 32, fingerprintDuration: 7200 } @@ -1879,6 +1914,7 @@ describe("GroupsService", () => { { name: "Fingerprint Group", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, diff --git a/apps/api/src/app/invites/invites.service.test.ts b/apps/api/src/app/invites/invites.service.test.ts index b9513c82..b165c1db 100644 --- a/apps/api/src/app/invites/invites.service.test.ts +++ b/apps/api/src/app/invites/invites.service.test.ts @@ -11,6 +11,7 @@ import { InvitesService } from "./invites.service" import { AdminsModule } from "../admins/admins.module" import { AdminsService } from "../admins/admins.service" import { Admin } from "../admins/entities/admin.entity" +import { GroupType } from "../groups/types" jest.mock("@bandada/utils", () => { const originalModule = jest.requireActual("@bandada/utils") @@ -71,6 +72,7 @@ describe("InvitesService", () => { { name: "Group1", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600 }, @@ -104,6 +106,7 @@ describe("InvitesService", () => { { name: "Group2", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: { @@ -159,6 +162,7 @@ describe("InvitesService", () => { { name: "Group2", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: { @@ -189,6 +193,7 @@ describe("InvitesService", () => { { name: "Group3", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: { @@ -283,6 +288,7 @@ describe("InvitesService", () => { { name: "Group2", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: { @@ -317,6 +323,7 @@ describe("InvitesService", () => { { name: "Group3", description: "This is a description", + type: GroupType.OFFCHAIN, treeDepth: 16, fingerprintDuration: 3600, credentials: { From ef064b1f99a32657f81629b80eb587f5d284d5a1 Mon Sep 17 00:00:00 2001 From: Han <56923450+waddaboo@users.noreply.github.com> Date: Thu, 17 Oct 2024 20:15:59 +0800 Subject: [PATCH 3/9] feat(api): update string enum to string literal --- apps/api/src/app/groups/dto/create-group.dto.ts | 4 ++-- apps/api/src/app/groups/entities/group.entity.ts | 2 +- apps/api/src/app/groups/types/index.ts | 5 +---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/api/src/app/groups/dto/create-group.dto.ts b/apps/api/src/app/groups/dto/create-group.dto.ts index 799e6ed8..a5c49bdd 100644 --- a/apps/api/src/app/groups/dto/create-group.dto.ts +++ b/apps/api/src/app/groups/dto/create-group.dto.ts @@ -32,9 +32,9 @@ export class CreateGroupDto { @ApiProperty() readonly description: string - @IsEnum(GroupType) + @IsEnum(["on-chain", "off-chain"]) @ApiProperty({ - enum: GroupType + enum: ["on-chain", "off-chain"] }) readonly type: GroupType diff --git a/apps/api/src/app/groups/entities/group.entity.ts b/apps/api/src/app/groups/entities/group.entity.ts index 38827b29..1c56afdd 100644 --- a/apps/api/src/app/groups/entities/group.entity.ts +++ b/apps/api/src/app/groups/entities/group.entity.ts @@ -28,7 +28,7 @@ export class Group { @Column({ type: "simple-enum", - enum: GroupType, + enum: ["on-chain", "off-chain"], nullable: true }) type: GroupType diff --git a/apps/api/src/app/groups/types/index.ts b/apps/api/src/app/groups/types/index.ts index 2b7b09bc..8846571e 100644 --- a/apps/api/src/app/groups/types/index.ts +++ b/apps/api/src/app/groups/types/index.ts @@ -5,7 +5,4 @@ export type MerkleProof = { pathIndices: number[] } -export enum GroupType { - ONCHAIN = "on-chain", - OFFCHAIN = "off-chain" -} +export type GroupType = "on-chain" | "off-chain" From 13cfb79a4345130e26627f99da8cd458c9a54d42 Mon Sep 17 00:00:00 2001 From: Han <56923450+waddaboo@users.noreply.github.com> Date: Thu, 17 Oct 2024 20:16:56 +0800 Subject: [PATCH 4/9] test(api): update test for group type string literal --- .../credentials/credentials.service.test.ts | 17 +++-- .../api/src/app/groups/groups.service.test.ts | 69 +++++++++---------- .../src/app/invites/invites.service.test.ts | 13 ++-- 3 files changed, 48 insertions(+), 51 deletions(-) diff --git a/apps/api/src/app/credentials/credentials.service.test.ts b/apps/api/src/app/credentials/credentials.service.test.ts index fe2aa60a..b00d5a4c 100644 --- a/apps/api/src/app/credentials/credentials.service.test.ts +++ b/apps/api/src/app/credentials/credentials.service.test.ts @@ -14,7 +14,6 @@ import { InvitesService } from "../invites/invites.service" import { OAuthAccount } from "./entities/credentials-account.entity" import { CredentialsService } from "./credentials.service" import { AdminsModule } from "../admins/admins.module" -import { GroupType } from "../groups/types" jest.mock("@bandada/utils", () => { const originalModule = jest.requireActual("@bandada/utils") @@ -84,7 +83,7 @@ describe("CredentialsService", () => { { name: "Group1", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: JSON.stringify({ @@ -106,7 +105,7 @@ describe("CredentialsService", () => { { name: "Group2", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -189,7 +188,7 @@ describe("CredentialsService", () => { { name: "Group2", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: JSON.stringify({ @@ -236,7 +235,7 @@ describe("CredentialsService", () => { { name: "Group2", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: JSON.stringify({ @@ -342,7 +341,7 @@ describe("CredentialsService", () => { { name: "Group2", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: JSON.stringify({ @@ -393,7 +392,7 @@ describe("CredentialsService", () => { { name: "Group3", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: JSON.stringify({ @@ -446,7 +445,7 @@ describe("CredentialsService", () => { { name: "Group4", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: JSON.stringify({ @@ -500,7 +499,7 @@ describe("CredentialsService", () => { { name: "Group5", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: JSON.stringify({ diff --git a/apps/api/src/app/groups/groups.service.test.ts b/apps/api/src/app/groups/groups.service.test.ts index a45279b3..d3f6e07d 100644 --- a/apps/api/src/app/groups/groups.service.test.ts +++ b/apps/api/src/app/groups/groups.service.test.ts @@ -13,7 +13,6 @@ import { AdminsModule } from "../admins/admins.module" import { Admin } from "../admins/entities/admin.entity" import { CreateGroupDto } from "./dto/create-group.dto" import { UpdateGroupDto } from "./dto/update-group.dto" -import { GroupType } from "./types" jest.mock("@bandada/utils", () => { const originalModule = jest.requireActual("@bandada/utils") @@ -67,7 +66,7 @@ describe("GroupsService", () => { { name: "Group1", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -84,14 +83,14 @@ describe("GroupsService", () => { { name: "Group2", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, "admin" ) - expect(type).toBe(GroupType.OFFCHAIN) + expect(type).toBe("off-chain") expect(treeDepth).toBe(16) expect(members).toHaveLength(0) }) @@ -103,7 +102,7 @@ describe("GroupsService", () => { { name: "Group3", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -132,7 +131,7 @@ describe("GroupsService", () => { { name: "Group4", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: { @@ -207,7 +206,7 @@ describe("GroupsService", () => { { name: "Group01", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -219,7 +218,7 @@ describe("GroupsService", () => { { name: "Group02", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -238,7 +237,7 @@ describe("GroupsService", () => { { name: "MemberGroup", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -329,7 +328,7 @@ describe("GroupsService", () => { { name: "MemberGroup", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -393,7 +392,7 @@ describe("GroupsService", () => { { name: "Group2", description: "This is a new group", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 21, fingerprintDuration: 3600 }, @@ -438,7 +437,7 @@ describe("GroupsService", () => { { name: "Group2", description: "This is a new group", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 21, fingerprintDuration: 3600 }, @@ -468,7 +467,7 @@ describe("GroupsService", () => { const groupDto: CreateGroupDto = { name: "Group", description: "This is a new group", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 } @@ -625,7 +624,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -633,7 +632,7 @@ describe("GroupsService", () => { id: "2", name: "Group2", description: "This is a new group2", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -641,7 +640,7 @@ describe("GroupsService", () => { id: "3", name: "Group3", description: "This is a new group3", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 } @@ -802,7 +801,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 } @@ -906,7 +905,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -914,7 +913,7 @@ describe("GroupsService", () => { id: "2", name: "Group2", description: "This is a new group2", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 32, fingerprintDuration: 7200 } @@ -1048,7 +1047,7 @@ describe("GroupsService", () => { { name: "Group2", description: "This is a new group", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -1199,7 +1198,7 @@ describe("GroupsService", () => { { name: "Group2", description: "This is a new group", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -1224,7 +1223,7 @@ describe("GroupsService", () => { { name: "Credential Group", description: "This is a new group", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: { @@ -1373,7 +1372,7 @@ describe("GroupsService", () => { { name: "Group2", description: "This is a new group", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -1422,7 +1421,7 @@ describe("GroupsService", () => { { name: "Group2", description: "This is a new group", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -1450,7 +1449,7 @@ describe("GroupsService", () => { { name: "Credential Group", description: "This is a new group", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: { @@ -1502,7 +1501,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 } @@ -1545,7 +1544,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -1553,7 +1552,7 @@ describe("GroupsService", () => { id: "2", name: "Group2", description: "This is a new group2", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 32, fingerprintDuration: 7200 } @@ -1600,7 +1599,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 } @@ -1653,7 +1652,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -1661,7 +1660,7 @@ describe("GroupsService", () => { id: "2", name: "Group2", description: "This is a new group2", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 32, fingerprintDuration: 7200 } @@ -1738,7 +1737,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 } @@ -1811,7 +1810,7 @@ describe("GroupsService", () => { id: "1", name: "Group1", description: "This is a new group1", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -1819,7 +1818,7 @@ describe("GroupsService", () => { id: "2", name: "Group2", description: "This is a new group2", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 32, fingerprintDuration: 7200 } @@ -1914,7 +1913,7 @@ describe("GroupsService", () => { { name: "Fingerprint Group", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, diff --git a/apps/api/src/app/invites/invites.service.test.ts b/apps/api/src/app/invites/invites.service.test.ts index b165c1db..47ff68b7 100644 --- a/apps/api/src/app/invites/invites.service.test.ts +++ b/apps/api/src/app/invites/invites.service.test.ts @@ -11,7 +11,6 @@ import { InvitesService } from "./invites.service" import { AdminsModule } from "../admins/admins.module" import { AdminsService } from "../admins/admins.service" import { Admin } from "../admins/entities/admin.entity" -import { GroupType } from "../groups/types" jest.mock("@bandada/utils", () => { const originalModule = jest.requireActual("@bandada/utils") @@ -72,7 +71,7 @@ describe("InvitesService", () => { { name: "Group1", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, @@ -106,7 +105,7 @@ describe("InvitesService", () => { { name: "Group2", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: { @@ -162,7 +161,7 @@ describe("InvitesService", () => { { name: "Group2", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: { @@ -193,7 +192,7 @@ describe("InvitesService", () => { { name: "Group3", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: { @@ -288,7 +287,7 @@ describe("InvitesService", () => { { name: "Group2", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: { @@ -323,7 +322,7 @@ describe("InvitesService", () => { { name: "Group3", description: "This is a description", - type: GroupType.OFFCHAIN, + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials: { From 2d52a3a42aad594aecce25d9e6eac645a8d8cb3b Mon Sep 17 00:00:00 2001 From: Han <56923450+waddaboo@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:09:28 +0800 Subject: [PATCH 5/9] feat(api-sdk): add group type to api sdk --- libs/api-sdk/src/index.test.ts | 24 ++++++++++++++++++++++++ libs/api-sdk/src/types/index.ts | 3 +++ 2 files changed, 27 insertions(+) diff --git a/libs/api-sdk/src/index.test.ts b/libs/api-sdk/src/index.test.ts index 28664d43..66c0d8a0 100644 --- a/libs/api-sdk/src/index.test.ts +++ b/libs/api-sdk/src/index.test.ts @@ -94,6 +94,7 @@ describe("Bandada API SDK", () => { const expectedGroup: GroupCreationDetails = { name: "Group1", description: "This is a new group", + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 } @@ -105,6 +106,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 16, fingerprintDuration: 3600, @@ -142,6 +144,7 @@ describe("Bandada API SDK", () => { const expectedGroup: GroupCreationDetails = { name: "Group1", description: "This is a new group", + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials @@ -154,6 +157,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 16, fingerprintDuration: 3600, @@ -205,6 +209,7 @@ describe("Bandada API SDK", () => { const expectedGroup: GroupCreationDetails = { name: "Group1", description: "This is a new group", + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials @@ -217,6 +222,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 16, fingerprintDuration: 3600, @@ -251,12 +257,14 @@ describe("Bandada API SDK", () => { { name: "Group1", description: "This is a new group", + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, { name: "Group2", description: "This is a new group", + type: "off-chain", treeDepth: 32, fingerprintDuration: 7200 } @@ -269,6 +277,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 16, fingerprintDuration: 3600, @@ -280,6 +289,7 @@ describe("Bandada API SDK", () => { id: "20402173435763029700781503965200", name: "Group2", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 32, fingerprintDuration: 7200, @@ -352,6 +362,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 16, fingerprintDuration: 3600, @@ -401,6 +412,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group1", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 32, fingerprintDuration: 7200, @@ -412,6 +424,7 @@ describe("Bandada API SDK", () => { id: "20402173435763029700781503965200", name: "Group1", description: "This is a new group2", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 32, fingerprintDuration: 7200, @@ -446,6 +459,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 16, fingerprintDuration: 3600, @@ -466,6 +480,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 16, fingerprintDuration: 3600, @@ -489,6 +504,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 16, fingerprintDuration: 3600, @@ -516,6 +532,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 16, fingerprintDuration: 3600, @@ -546,6 +563,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 16, fingerprintDuration: 3600, @@ -571,6 +589,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 16, fingerprintDuration: 3600, @@ -598,6 +617,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 16, fingerprintDuration: 3600, @@ -625,6 +645,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 16, fingerprintDuration: 3600, @@ -646,6 +667,7 @@ describe("Bandada API SDK", () => { id: "10402173435763029700781503965100", name: "Group1", description: "This is a new group", + type: "off-chain", admin: "0xdf558148e66850ac48dbe2c8119b0eefa7d08bfd19c997c90a142eb97916b847", treeDepth: 16, fingerprintDuration: 3600, @@ -854,6 +876,7 @@ describe("Bandada API SDK", () => { id: groupId, name: groupName, description: "This is Group 1", + type: "off-chain", adminId: "0x63229164c457584616006e31d1e171e6cdd4163695bc9c4bf0227095998ffa4c", treeDepth: 16, @@ -894,6 +917,7 @@ describe("Bandada API SDK", () => { id: groupId, name: groupName, description: "This is Group 1", + type: "off-chain", adminId: "0x63229164c457584616006e31d1e171e6cdd4163695bc9c4bf0227095998ffa4c", treeDepth: 16, diff --git a/libs/api-sdk/src/types/index.ts b/libs/api-sdk/src/types/index.ts index b78166c8..d890d5d7 100644 --- a/libs/api-sdk/src/types/index.ts +++ b/libs/api-sdk/src/types/index.ts @@ -1,5 +1,7 @@ export type Credential = any +export type GroupType = "on-chain" | "off-chain" + export type Group = { id: string name: string @@ -16,6 +18,7 @@ export type Group = { export type GroupCreationDetails = { name: string description: string + type: GroupType treeDepth: number fingerprintDuration: number credentials?: Credential From 9f0de74e440ffa25881b95cbd61ee79a3cac6b6b Mon Sep 17 00:00:00 2001 From: Han <56923450+waddaboo@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:39:37 +0800 Subject: [PATCH 6/9] docs(api-sdk): update group type api sdk docs --- apps/docs/docs/api-sdk.md | 5 +++++ libs/api-sdk/README.md | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/apps/docs/docs/api-sdk.md b/apps/docs/docs/api-sdk.md index 9f09dad3..56cd3afe 100644 --- a/apps/docs/docs/api-sdk.md +++ b/apps/docs/docs/api-sdk.md @@ -102,6 +102,7 @@ Creates a Bandada group. const groupCreateDetails = { name: "Group 1", description: "This is Group 1.", + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 } @@ -128,6 +129,7 @@ const credentials = { const groupCreateDetails = { name: "Group 1", description: "This is Group 1.", + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials @@ -167,6 +169,7 @@ const credentials = { const groupCreateDetails = { name: "Group 1", description: "This is Group 1.", + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials @@ -187,12 +190,14 @@ const groupsCreateDetails = [ { name: "Group 1", description: "This is Group 1.", + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, { name: "Group 2", description: "This is Group 2.", + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 } diff --git a/libs/api-sdk/README.md b/libs/api-sdk/README.md index 6bb8d57e..bc860d53 100644 --- a/libs/api-sdk/README.md +++ b/libs/api-sdk/README.md @@ -125,6 +125,7 @@ Creates a Bandada group. const groupCreateDetails = { name: "Group 1", description: "This is Group 1.", + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 } @@ -151,6 +152,7 @@ const credentials = { const groupCreateDetails = { name: "Group 1", description: "This is Group 1.", + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials @@ -190,6 +192,7 @@ const credentials = { const groupCreateDetails = { name: "Group 1", description: "This is Group 1.", + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600, credentials @@ -210,12 +213,14 @@ const groupsCreateDetails = [ { name: "Group 1", description: "This is Group 1.", + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 }, { name: "Group 2", description: "This is Group 2.", + type: "off-chain", treeDepth: 16, fingerprintDuration: 3600 } From e32fab49be09d7dd59e0f2e686515a43217ac6b2 Mon Sep 17 00:00:00 2001 From: Han <56923450+waddaboo@users.noreply.github.com> Date: Fri, 18 Oct 2024 17:18:03 +0800 Subject: [PATCH 7/9] fix(api-sdk): fix missing type in group type --- libs/api-sdk/src/types/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/api-sdk/src/types/index.ts b/libs/api-sdk/src/types/index.ts index d890d5d7..27173792 100644 --- a/libs/api-sdk/src/types/index.ts +++ b/libs/api-sdk/src/types/index.ts @@ -6,6 +6,7 @@ export type Group = { id: string name: string description: string + type: GroupType | null admin: string treeDepth: number fingerprint: string @@ -35,6 +36,7 @@ type GroupSummary = { id: string name: string description: string + type: GroupType | null adminId: string treeDepth: number fingerprintDuration: number From c728aba31b4b3ef7c16edfcf146bcb7cfa2e1693 Mon Sep 17 00:00:00 2001 From: Han <56923450+waddaboo@users.noreply.github.com> Date: Fri, 18 Oct 2024 19:24:12 +0800 Subject: [PATCH 8/9] fix(api): fix missing type in mapGroupToResponseDTO --- apps/api/src/app/groups/groups.utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/api/src/app/groups/groups.utils.ts b/apps/api/src/app/groups/groups.utils.ts index 5c56e519..a6f1728c 100644 --- a/apps/api/src/app/groups/groups.utils.ts +++ b/apps/api/src/app/groups/groups.utils.ts @@ -5,6 +5,7 @@ export function mapGroupToResponseDTO(group: Group, fingerprint: string = "") { id: group.id, name: group.name, description: group.description, + type: group.type, admin: group.adminId, treeDepth: group.treeDepth, fingerprint, From 8ded48598774d137eba0216cef0714dff0771650 Mon Sep 17 00:00:00 2001 From: Han <56923450+waddaboo@users.noreply.github.com> Date: Fri, 18 Oct 2024 19:27:19 +0800 Subject: [PATCH 9/9] feat(dashboard): add group type to dashboard --- apps/dashboard/src/api/bandadaAPI.ts | 7 ++++++- .../components/new-group-stepper/final-preview-step.tsx | 1 + apps/dashboard/src/types/Group.ts | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/dashboard/src/api/bandadaAPI.ts b/apps/dashboard/src/api/bandadaAPI.ts index 8d477445..3ff2f726 100644 --- a/apps/dashboard/src/api/bandadaAPI.ts +++ b/apps/dashboard/src/api/bandadaAPI.ts @@ -1,6 +1,6 @@ import { ApiKeyActions, request } from "@bandada/utils" import { SiweMessage } from "siwe" -import { Admin, Group } from "../types" +import { Admin, Group, GroupType } from "../types" import createAlert from "../utils/createAlert" const API_URL = import.meta.env.VITE_API_URL @@ -80,12 +80,16 @@ export async function getGroup(groupId: string): Promise { * It creates a new group. * @param name The group name. * @param description The group description. + * @param type The group type ("on-chain" | "off-chain"). * @param treeDepth The Merkle tree depth. + * @param fingerprintDuration The fingerprint duration. + * @param credentials The group credentials. * @returns The group details. */ export async function createGroup( name: string, description: string, + type: GroupType, treeDepth: number, fingerprintDuration: number, credentials?: any @@ -97,6 +101,7 @@ export async function createGroup( { name, description, + type, treeDepth, fingerprintDuration, credentials: JSON.stringify(credentials) diff --git a/apps/dashboard/src/components/new-group-stepper/final-preview-step.tsx b/apps/dashboard/src/components/new-group-stepper/final-preview-step.tsx index 549added..147df4b8 100644 --- a/apps/dashboard/src/components/new-group-stepper/final-preview-step.tsx +++ b/apps/dashboard/src/components/new-group-stepper/final-preview-step.tsx @@ -47,6 +47,7 @@ export default function FinalPreviewStep({ const response = await bandadaAPI.createGroup( group.name, group.description, + group.type, group.treeDepth, group.fingerprintDuration, group.credentials diff --git a/apps/dashboard/src/types/Group.ts b/apps/dashboard/src/types/Group.ts index 127892df..44a58c5f 100644 --- a/apps/dashboard/src/types/Group.ts +++ b/apps/dashboard/src/types/Group.ts @@ -1,8 +1,10 @@ +export type GroupType = "off-chain" | "on-chain" + export type Group = { id: string name: string - type?: string description?: string + type?: GroupType treeDepth: number credentials?: string fingerprintDuration?: number