Uniswap / widgets

widgets-uniswap.vercel.app
GNU General Public License v3.0
123 stars 175 forks source link

Non-latin character tokens #598

Open mastbmawstaken opened 1 year ago

mastbmawstaken commented 1 year ago

Bug Description When you try to search for non-latin tokens the response we get is the following error

Error: Tokens failed validation: /tokens/0/name must match pattern "^[ \w.'+-%/À-ÖØ-öø-ÿ:&[]()]+$"

Steps to Reproduce

  1. Create a Next.JS app with react and install Uniswap widgets with their dependencies. Create a simple page with the Swap widget.
  2. Create a custom list with a non-latin name/symbol. Example:

const MY_TOKEN_LIST = [ { "name": "Dumplings", "address": "0x1da74e8beceaa94d4dc6020e4f2ffe3c6ea7176d", "symbol": "饺子", "decimals": 18, "chainId": 1, "logoURI": "/logo.png" }]

  1. Run the app and try to swap ETH/BNB... for the token above (or any token that doesn't use latin characters).

Expected Behavior I expected to be able to swap for these tokens but I'm prompted with the error above.

Additional Context Same token, different response:

image

Widget

image

Official App