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

Add support for symbols containing unicode chars #176

Merged
merged 3 commits into from
Dec 12, 2022

Conversation

alexandrebini
Copy link
Contributor

@alexandrebini alexandrebini commented Sep 7, 2022

@alexandrebini alexandrebini changed the title [#175] Supporting unicode symbols Supporting unicode symbols Sep 7, 2022
@alexandrebini alexandrebini changed the title Supporting unicode symbols Add support for symbols containing unicode chars Sep 7, 2022
src/tokenlist.schema.json Outdated Show resolved Hide resolved
src/tokenlist.schema.json Outdated Show resolved Hide resolved
src/tokenlist.schema.json Show resolved Hide resolved
Copy link

@tolitsjr tolitsjr left a comment

Choose a reason for hiding this comment

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

@@ -63,6 +64,10 @@ describe('schema', () => {
checkSchema(emptyList, false);
});

it('works for empty names and symbols', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zzmp @tolitsjr Yes, you can have empty names and symbols.

Check 0xc31C535F4d9A789df0c16D461B4F811543b72FEb and 0xF336f5624D34c3Be82eF3EFc4978bd2397B1524A on polygon.

Choose a reason for hiding this comment

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

I have many errors in the past I want to make amends

@@ -231,19 +231,33 @@
"name": {
"type": "string",
"description": "The name of the token",
"minLength": 1,
"minLength": 0,
"maxLength": 40,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zzmp btw, this limit isn't correct. You can have more than 40 chars and as far as I know there isn't a limit.

This pair is one https://dexscreener.com/polygon/0x841120E51aD43EfE489244728532854A352073aD

Choose a reason for hiding this comment

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

Ok thanks I lost all my devices and I was able to recover some databases now

Choose a reason for hiding this comment

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

Ok

@zzmp zzmp requested a review from matteenm October 25, 2022 20:39
Copy link
Contributor

@matteenm matteenm left a comment

Choose a reason for hiding this comment

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

Given there are existing applications that parse/store these fields from token lists, I think we should err on the side of caution in terms of what strings are allowed in the fields of a valid list (in the context of input sanitization). imo consumers of token lists should not have to worry about potentially malicious values in the list. So I would prefer we append the desired new characters/symbols to the original regex pattern rather than allowing essentially any string. Happy to hear your thoughts on this.

@alexandrebini
Copy link
Contributor Author

@matteenm I get your point. But I'm not sure if this package should be that strict.

If you try to use for example the Polygon Tokens List (from their GitHub) you will see that the validation won't pass on symbols (it is also not passing for tags, but that's another issue). And here we are talking about an 'official' list.

At DEX Screener we are tracking 40k+ tokens. If I need to whitelist every single special char I have, well, you know how that regexp will be in the end.

I don't mind dropping this PR btw. I'm basically removing all special chars on my end in order to get the Uniswap widget working - otherwise, I can't even use the Polygon token list I mentioned.

Let me know your thoughts!

Copy link

@13364174888 13364174888 left a comment

Choose a reason for hiding this comment

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

0x50655c814b96dA35E42942f6510014ddEA38A152

@zzmp zzmp merged commit 61c4411 into Uniswap:main Dec 12, 2022
Copy link

@Karimsultan Karimsultan left a comment

Choose a reason for hiding this comment

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

Cool

@THU2447 THU2447 linked an issue May 21, 2023 that may be closed by this pull request
tiendn pushed a commit to tiendn/token-lists that referenced this pull request Jun 11, 2024
@@ -0,0 +1,25 @@
{
"name": "My Token List",
Copy link

Choose a reason for hiding this comment

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

Nice

Copy link

@drewgitgit drewgitgit left a comment

Choose a reason for hiding this comment

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

Finished

Copy link

@drewgitgit drewgitgit left a comment

Choose a reason for hiding this comment

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

Nice

Copy link

@drewgitgit drewgitgit left a comment

Choose a reason for hiding this comment

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

0

@@ -231,19 +231,33 @@
"name": {
"type": "string",
"description": "The name of the token",
"minLength": 1,

Choose a reason for hiding this comment

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

0

Copy link

Choose a reason for hiding this comment

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

Release coin

"examples": [
"USD Coin"
]
},
"symbol": {
"type": "string",
"description": "The symbol for the token; must be alphanumeric",

Choose a reason for hiding this comment

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

],

"examples": [
"USD Coin"
]
},
"symbol": {
"type": "string",
"description": "The symbol for the token; must be alphanumeric",
"pattern": "^[a-zA-Z0-9+\\-%/$.]+$",

Choose a reason for hiding this comment

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

"examples":

"examples": [
"USD Coin"
]
},
"symbol": {
"type": "string",
"description": "The symbol for the token; must be alphanumeric",
"pattern": "^[a-zA-Z0-9+\\-%/$.]+$",
"minLength": 1,

Choose a reason for hiding this comment

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

USD COIN

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

Successfully merging this pull request may close these issues.

withdrow mode