Skip to content

Commit

Permalink
Merge pull request #179 from xmtp/np/consent-return
Browse files Browse the repository at this point in the history
Make allow and deny awaitable
  • Loading branch information
nplasterer authored Dec 15, 2023
2 parents 061baa8 + 93ed1b7 commit ad6055b
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 ad6055b

Please sign in to comment.