diff --git a/example/src/tests/groupTests.ts b/example/src/tests/groupTests.ts index 6f4ab050e..4df83a94e 100644 --- a/example/src/tests/groupTests.ts +++ b/example/src/tests/groupTests.ts @@ -950,6 +950,8 @@ test('can stream groups', async () => { throw Error('Unexpected num groups (should be 1): ' + groups.length) } + assert(groups[0].members.length == 2, "should be 2") + // bo creates a group with alix so a stream callback is fired // eslint-disable-next-line @typescript-eslint/no-unused-vars const boGroup = await boClient.conversations.newGroup([alixClient.address]) @@ -2035,12 +2037,9 @@ test('can create new installation without breaking group', async () => { 233, 120, 198, 96, 154, 65, 132, 17, 132, 96, 250, 40, 103, 35, 125, 64, 166, 83, 208, 224, 254, 44, 205, 227, 175, 49, 234, 129, 74, 252, 135, 145, ]) - const wallet1 = new Wallet( - '0xc54c62dd3ad018ef94f20f0722cae33919e65270ad74f2d1794291088800f788' - ) - const wallet2 = new Wallet( - '0x8d40c1c40473975cc6bbdc0465e70cc2e98f45f3c3474ca9b809caa9c4f53c0b' - ) + const wallet1 = Wallet.createRandom() + const wallet2 = Wallet.createRandom() + const client1 = await Client.create(wallet1, { env: 'local', appVersion: 'Testing/0.0.0', diff --git a/src/lib/Conversations.ts b/src/lib/Conversations.ts index 693df85ec..8d4cd8dce 100644 --- a/src/lib/Conversations.ts +++ b/src/lib/Conversations.ts @@ -8,6 +8,7 @@ import { } from './ConversationContainer' import { DecodedMessage } from './DecodedMessage' import { Group, GroupParams } from './Group' +import { Member } from './Member' import { CreateGroupOptions } from './types/CreateGroupOptions' import { EventTypes } from './types/EventTypes' import { PermissionPolicySet } from './types/PermissionPolicySet' @@ -149,7 +150,10 @@ export default class Conversations< return } this.known[group.id] = true - await callback(new Group(this.client, group)) + const members = group['members'].map((mem: string) => { + return Member.from(mem) + }) + await callback(new Group(this.client, group, members)) } ) this.subscriptions[EventTypes.Group] = groupsSubscription @@ -286,10 +290,16 @@ export default class Conversations< this.known[conversationContainer.topic] = true if (conversationContainer.version === ConversationVersion.GROUP) { + const members = conversationContainer['members'].map( + (mem: string) => { + return Member.from(mem) + } + ) return await callback( new Group( this.client, - conversationContainer as unknown as GroupParams + conversationContainer as unknown as GroupParams, + members ) ) } else { diff --git a/src/lib/Group.ts b/src/lib/Group.ts index 459bfd6d2..92621e4cf 100644 --- a/src/lib/Group.ts +++ b/src/lib/Group.ts @@ -18,6 +18,7 @@ export type PermissionUpdateOption = 'allow' | 'deny' | 'admin' | 'super_admin' export interface GroupParams { id: string createdAt: number + members: string[] creatorInboxId: InboxId topic: string name: string