diff --git a/.changeset/silent-comics-rule.md b/.changeset/silent-comics-rule.md new file mode 100644 index 00000000..04d461ce --- /dev/null +++ b/.changeset/silent-comics-rule.md @@ -0,0 +1,5 @@ +--- +"@status-im/js": patch +--- + +optimize handling of token owner waku messages diff --git a/packages/status-js/src/request-client/request-client.ts b/packages/status-js/src/request-client/request-client.ts index 3a7f3a6e..e732aa99 100644 --- a/packages/status-js/src/request-client/request-client.ts +++ b/packages/status-js/src/request-client/request-client.ts @@ -4,7 +4,6 @@ import { createDecoder } from '@waku/message-encryption/symmetric' import { createLightNode, waitForRemotePeer } from '@waku/sdk' import { bytesToHex, concatBytes } from 'ethereum-cryptography/utils' -import { isEncrypted } from '../client/community/is-encrypted' import { contracts } from '../consts/contracts' import { peers } from '../consts/peers' import { providers } from '../consts/providers' @@ -252,21 +251,14 @@ class RequestClient { continue } - if (isEncrypted(decodedCommunityDescription.tokenPermissions)) { - // todo?: zod - const permission = Object.values( - decodedCommunityDescription.tokenPermissions - ).find( - permission => - permission.type === - CommunityTokenPermission_Type.BECOME_TOKEN_OWNER - ) - - if (!permission) { - continue - } - - const criteria = permission.tokenCriteria[0] + const ownerTokenPermission = Object.values( + decodedCommunityDescription.tokenPermissions + ).find( + permission => + permission.type === CommunityTokenPermission_Type.BECOME_TOKEN_OWNER + ) + if (ownerTokenPermission) { + const criteria = ownerTokenPermission.tokenCriteria[0] const contracts = criteria?.contractAddresses const chainId = Object.keys(contracts)[0]