Skip to content

Commit

Permalink
fix up the can message tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Dec 5, 2024
1 parent 99206ea commit 4d4a485
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
9 changes: 7 additions & 2 deletions example/src/tests/clientTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,16 @@ test('static can message', async () => {

const addressMap = await Client.canMessage('local', [
alix.address,
'RANDOM',
'0x4E9ce36E442e55EcD9025B9a6E0D88485d628A67',
bo.address,
])

assert(addressMap['RANDOM'] === false, `should not be able to message RANDOM`)
assert(
addressMap[
'0x4E9ce36E442e55EcD9025B9a6E0D88485d628A67'.toLocaleLowerCase()
] === false,
`should not be able to message 0x4E9ce36E442e55EcD9025B9a6E0D88485d628A67`
)

assert(
addressMap[alix.address.toLowerCase()] === true,
Expand Down
6 changes: 3 additions & 3 deletions example/src/tests/groupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -866,12 +866,12 @@ test('canMessage', async () => {
const canMessageV3 = await caro.canMessage([
caro.address,
alix.address,
'RANDOM',
'0x4E9ce36E442e55EcD9025B9a6E0D88485d628A67',
])

assert(
canMessageV3['RANDOM'] === false,
`should not be able to message RANDOM`
canMessageV3['0x4E9ce36E442e55EcD9025B9a6E0D88485d628A67'] === false,
`should not be able to message 0x4E9ce36E442e55EcD9025B9a6E0D88485d628A67`
)

assert(
Expand Down
2 changes: 1 addition & 1 deletion ios/XMTPReactNative.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Pod::Spec.new do |s|
s.source_files = "**/*.{h,m,swift}"

s.dependency "MessagePacker"
s.dependency "XMTP", "= 3.0.13"
s.dependency "XMTP", "= 3.0.14"
s.dependency 'CSecp256k1', '~> 0.2'
s.dependency "SQLCipher", "= 4.5.7"
end
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export async function staticCanMessage(
environment: XMTPEnvironment,
peerAddresses: Address[]
): Promise<{ [key: Address]: boolean }> {
return await XMTPModule.canMessage(environment, peerAddresses)
return await XMTPModule.staticCanMessage(environment, peerAddresses)
}

export async function getOrCreateInboxId(
Expand Down
6 changes: 4 additions & 2 deletions src/lib/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ export class Client<
return await XMTPModule.getOrCreateInboxId(address, env)
}


/**
* Determines whether the current user can send messages to the specified peers.
*
Expand All @@ -302,7 +301,10 @@ export class Client<
* @param {XMTPEnvironment} env - Environment to see if the address is on the network for
* @returns {Promise<{ [key: Address]: boolean }>} A Promise resolving to a hash of addresses and booleans if they can message on the network.
*/
static async canMessage(env: XMTPEnvironment, addresses: Address[]): Promise<{ [key: Address]: boolean }> {
static async canMessage(
env: XMTPEnvironment,
addresses: Address[]
): Promise<{ [key: Address]: boolean }> {
return await XMTPModule.staticCanMessage(env, addresses)
}

Expand Down

0 comments on commit 4d4a485

Please sign in to comment.