diff --git a/src/app/modules/main/communities/module.nim b/src/app/modules/main/communities/module.nim index 4374964c00..002b09eefb 100644 --- a/src/app/modules/main/communities/module.nim +++ b/src/app/modules/main/communities/module.nim @@ -591,10 +591,13 @@ proc buildTokensAndCollectiblesFromCommunities(self: Module, communities: seq[Co infiniteSupply, ) - if tokenMetadata.tokenType == TokenType.ERC20: + if tokenMetadata.tokenType == TokenType.ERC20 and + not self.view.tokenListModel().hasItem(tokenMetadata.symbol, community.id): # Community ERC20 tokens tokenListItems.add(communityTokenItem) - else: + + if tokenMetadata.tokenType == TokenType.ERC721 and + not self.view.collectiblesListModel().hasItem(tokenMetadata.symbol, community.id): # Community collectibles (ERC721 and others) collectiblesListItems.add(communityTokenItem) @@ -651,12 +654,12 @@ method onCommunityTokenMetadataAdded*(self: Module, communityId: string, tokenMe ) if tokenMetadata.tokenType == TokenType.ERC721 and - not self.view.collectiblesListModel().hasItem(tokenMetadata.symbol): + not self.view.collectiblesListModel().hasItem(tokenMetadata.symbol, communityId): self.view.collectiblesListModel.addItems(@[tokenListItem]) return if tokenMetadata.tokenType == TokenType.ERC20 and - not self.view.tokenListModel().hasItem(tokenMetadata.symbol): + not self.view.tokenListModel().hasItem(tokenMetadata.symbol, communityId): self.view.tokenListModel.addItems(@[tokenListItem]) method shareCommunityUrlWithChatKey*(self: Module, communityId: string): string = diff --git a/src/app/modules/shared_models/token_list_model.nim b/src/app/modules/shared_models/token_list_model.nim index 8053824725..f550053242 100644 --- a/src/app/modules/shared_models/token_list_model.nim +++ b/src/app/modules/shared_models/token_list_model.nim @@ -56,9 +56,9 @@ QtObject: self.endResetModel() self.countChanged() - proc hasItem*(self: TokenListModel, symbol: string): bool = + proc hasItem*(self: TokenListModel, symbol: string, communityId: string): bool = for item in self.items: - if item.getSymbol() == symbol: + if item.getSymbol() == symbol and item.getCommunityId() == communityId: return true return false