bitpay / bitcore

A full stack for bitcoin and blockchain-based applications
https://bitcore.io/
MIT License
4.85k stars 2.09k forks source link

[BCC] Fix adding like token to wallet #3654

Closed kajoseph closed 10 months ago

kajoseph commented 10 months ago

The current behavior is that it just keeps appending to wallet.tokens. The problem is that there is a) no check to see if the token already exists (to prevent duplication) and querying balance only grabs the first entry in the array.

This PR checks for duplicity and prompts the user to replace the existing token. This is most helpful in dev/test environments when you might want to update the token address.