Skip to content

Commit

Permalink
make consent awaitable
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Dec 14, 2023
1 parent 061baa8 commit 93ed1b7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion example/src/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ test('canManagePreferences', async () => {
)
}

bo.contacts.deny([alixConversation.peerAddress])
await bo.contacts.deny([alixConversation.peerAddress])
await delayToPropogate()

const deniedState = await bo.contacts.isDenied(alixConversation.peerAddress)
Expand Down
14 changes: 10 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,18 @@ export async function isDenied(
return await XMTPModule.isDenied(clientAddress, address)
}

export function denyContacts(clientAddress: string, addresses: string[]) {
XMTPModule.denyContacts(clientAddress, addresses)
export async function denyContacts(
clientAddress: string,
addresses: string[]
): Promise<void> {
return await XMTPModule.denyContacts(clientAddress, addresses)
}

export function allowContacts(clientAddress: string, addresses: string[]) {
XMTPModule.allowContacts(clientAddress, addresses)
export async function allowContacts(
clientAddress: string,
addresses: string[]
): Promise<void> {
return await XMTPModule.allowContacts(clientAddress, addresses)
}

export async function refreshConsentList(
Expand Down
8 changes: 4 additions & 4 deletions src/lib/Contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export default class Contacts {
return await XMTPModule.isDenied(this.client.address, address)
}

deny(addresses: string[]) {
XMTPModule.denyContacts(this.client.address, addresses)
async deny(addresses: string[]): Promise<void> {
return await XMTPModule.denyContacts(this.client.address, addresses)
}

allow(addresses: string[]) {
XMTPModule.allowContacts(this.client.address, addresses)
async allow(addresses: string[]): Promise<void> {
return await XMTPModule.allowContacts(this.client.address, addresses)
}

async refreshConsentList(): Promise<ConsentListEntry[]> {
Expand Down

0 comments on commit 93ed1b7

Please sign in to comment.