From 93ed1b7f31e95fe4425dd64cbdeda53f7ca9d229 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Wed, 13 Dec 2023 19:35:55 -0800 Subject: [PATCH] make consent awaitable --- example/src/tests.ts | 2 +- src/index.ts | 14 ++++++++++---- src/lib/Contacts.ts | 8 ++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/example/src/tests.ts b/example/src/tests.ts index 4d2c97122..21e8cf6bb 100644 --- a/example/src/tests.ts +++ b/example/src/tests.ts @@ -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) diff --git a/src/index.ts b/src/index.ts index d924bf230..c2440883f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 { + 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 { + return await XMTPModule.allowContacts(clientAddress, addresses) } export async function refreshConsentList( diff --git a/src/lib/Contacts.ts b/src/lib/Contacts.ts index 4738fc6d7..3ea970f9f 100644 --- a/src/lib/Contacts.ts +++ b/src/lib/Contacts.ts @@ -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 { + return await XMTPModule.denyContacts(this.client.address, addresses) } - allow(addresses: string[]) { - XMTPModule.allowContacts(this.client.address, addresses) + async allow(addresses: string[]): Promise { + return await XMTPModule.allowContacts(this.client.address, addresses) } async refreshConsentList(): Promise {