fix(community_tokens): ignore wallet events from watch only accounts

Fixes #13407
This commit is contained in:
Jonathan Rainville 2024-02-26 16:35:06 -05:00
parent b623c8fb2b
commit 5b8f37cba2
1 changed files with 11 additions and 0 deletions

View File

@ -334,6 +334,12 @@ QtObject:
try: try:
let dataMessageJson = parseJson(jsonMessage) let dataMessageJson = parseJson(jsonMessage)
let tokenDataPayload = fromJson(dataMessageJson, CommunityCollectiblesReceivedPayload) let tokenDataPayload = fromJson(dataMessageJson, CommunityCollectiblesReceivedPayload)
let watchOnlyAccounts = self.walletAccountService.getWatchOnlyAccounts()
if any(watchOnlyAccounts, proc (x: WalletAccountDto): bool = x.address == accounts[0]):
# skip events on watch-only accounts
return
for coll in tokenDataPayload.collectibles: for coll in tokenDataPayload.collectibles:
if not coll.communityData.isSome(): if not coll.communityData.isSome():
continue continue
@ -406,6 +412,11 @@ QtObject:
if len(tokenDataPayload.communityId) == 0: if len(tokenDataPayload.communityId) == 0:
return return
let watchOnlyAccounts = self.walletAccountService.getWatchOnlyAccounts()
if any(watchOnlyAccounts, proc (x: WalletAccountDto): bool = x.address == accounts[0]):
# skip events on watch-only accounts
return
var accountName, accountAddress: string var accountName, accountAddress: string
if len(accounts) > 0: if len(accounts) > 0:
accountAddress = accounts[0] accountAddress = accounts[0]