Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tokens): lowercase tokens addresses in map to avoid duplicates #3289

Merged
merged 2 commits into from
Oct 31, 2023

Conversation

shoom3301
Copy link
Collaborator

@shoom3301 shoom3301 commented Oct 30, 2023

Summary

There are two fixes in this PR:

  1. Used added tokens may contain tokens with mixedCased addresses and it causes token duplicates.

image

  1. When the list of user-added tokens is too long, it goes out of the container.
image

The state file.

todo-1 (1).json

To Test

  1. Open Dapp from this PR
  2. Clean all browser data for this URL: Console -> Application -> Storage -> "Clear site data"
  3. Copy the content of the file above and run in the console: var state = <PUT_THE_FILE_CONTENT>, press Enter
  4. Run the code in the console: localStorage.clear(); var stateObj = JSON.parse(state); Object.keys(stateObj).forEach(key => localStorage.setItem(key, stateObj[key]))
  5. Reload the page
  • There is no alert with text "There is more than one token..."
  1. Open user-added tokens list
  • The list should be scrollable when there is no enough space for all tokens

@shoom3301 shoom3301 requested a review from a team October 30, 2023 06:19
@shoom3301 shoom3301 self-assigned this Oct 30, 2023
@vercel
Copy link

vercel bot commented Oct 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
swap-dev ✅ Ready (Inspect) Visit Preview Oct 30, 2023 6:19am

Copy link
Collaborator

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copied localStorage did not work for me this time.
But I manually added a bunch of tokens and it worked fine.
Did not try the lower case vs checksummed address.

@shoom3301 shoom3301 merged commit 0abd162 into develop Oct 31, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2023
@alfetopito alfetopito deleted the fix/tokens-map-lowercase branch October 31, 2023 14:42
Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants