optimize handling of token owner waku messages (#557)
* optimize handling of token owner waku messages * Create silent-comics-rule.md
This commit is contained in:
parent
a7008b5108
commit
4106248634
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"@status-im/js": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
optimize handling of token owner waku messages
|
|
@ -4,7 +4,6 @@ import { createDecoder } from '@waku/message-encryption/symmetric'
|
||||||
import { createLightNode, waitForRemotePeer } from '@waku/sdk'
|
import { createLightNode, waitForRemotePeer } from '@waku/sdk'
|
||||||
import { bytesToHex, concatBytes } from 'ethereum-cryptography/utils'
|
import { bytesToHex, concatBytes } from 'ethereum-cryptography/utils'
|
||||||
|
|
||||||
import { isEncrypted } from '../client/community/is-encrypted'
|
|
||||||
import { contracts } from '../consts/contracts'
|
import { contracts } from '../consts/contracts'
|
||||||
import { peers } from '../consts/peers'
|
import { peers } from '../consts/peers'
|
||||||
import { providers } from '../consts/providers'
|
import { providers } from '../consts/providers'
|
||||||
|
@ -252,21 +251,14 @@ class RequestClient {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEncrypted(decodedCommunityDescription.tokenPermissions)) {
|
const ownerTokenPermission = Object.values(
|
||||||
// todo?: zod
|
decodedCommunityDescription.tokenPermissions
|
||||||
const permission = Object.values(
|
).find(
|
||||||
decodedCommunityDescription.tokenPermissions
|
permission =>
|
||||||
).find(
|
permission.type === CommunityTokenPermission_Type.BECOME_TOKEN_OWNER
|
||||||
permission =>
|
)
|
||||||
permission.type ===
|
if (ownerTokenPermission) {
|
||||||
CommunityTokenPermission_Type.BECOME_TOKEN_OWNER
|
const criteria = ownerTokenPermission.tokenCriteria[0]
|
||||||
)
|
|
||||||
|
|
||||||
if (!permission) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
const criteria = permission.tokenCriteria[0]
|
|
||||||
const contracts = criteria?.contractAddresses
|
const contracts = criteria?.contractAddresses
|
||||||
const chainId = Object.keys(contracts)[0]
|
const chainId = Object.keys(contracts)[0]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue