-
Notifications
You must be signed in to change notification settings - Fork 5k
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
feat: Make the valid Token Symbol Length Parametric #17642
base: main
Are you sure you want to change the base?
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
I have read the CLA Document and I hereby sign the CLA |
83278d1
to
2456926
Compare
2456926
to
dc2de82
Compare
ping |
dc2de82
to
162fc2d
Compare
@@ -367,8 +367,8 @@ class ImportToken extends Component { | |||
const symbolLength = customSymbol.length; | |||
let customSymbolError = null; | |||
|
|||
if (symbolLength <= 0 || symbolLength >= 12) { | |||
customSymbolError = this.context.t('symbolBetweenZeroTwelve'); | |||
if (symbolLength === 0 || symbolLength >= 100) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this could be replaced with a configuration variable, this could be changed in teh future without requiring any changes to localization files.
See how other messages utilize templating by $1
,$2
, etc to create dynamic templates, where the max-length could be a new template value here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@legobeat good idea! it is parametric now.
97d28c9
to
57acbca
Compare
This PR has been automatically marked as stale because it has not had recent activity in the last 60 days. It will be closed in 14 days. Thank you for your contributions. |
This PR has been automatically marked as stale because it has not had recent activity in the last 60 days. It will be closed in 14 days. Thank you for your contributions. |
This PR has been automatically marked as stale because it has not had recent activity in the last 60 days. It will be closed in 14 days. Thank you for your contributions. |
Sorry to keep bumping here but our users have reported issues adding tokens due to this. @legobeat any update on getting this merged in? |
@fredwes Unfortunately, I don't have any further insights on the progress to share at this time. @MetaMask/extension-devs Could we get some eyes on this, please? Any UI/UX concerns? |
This is a good idea, and MetaMask should support longer symbol lengths. There are other parts of the codebase that would need to be updated. At least here but maybe others. And it would require some UI work to consider every place showing symbols to make sure they render correctly, and do something like an ... ellipses or truncation to make it fit. So I don't think this can be merged as is. |
This PR has been automatically marked as stale because it has not had recent activity in the last 60 days. It will be closed in 14 days. Thank you for your contributions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
The pull request updates localization files to support a parametric token symbol length, increasing the limit to 20 characters.
- Updated validation message for token symbol length in
app/_locales/et/messages.json
to be parametric. - Similar updates made across multiple localization files, including
app/_locales/cs/messages.json
,app/_locales/am/messages.json
, and others. - Removed old fixed-length messages and replaced them with dynamic messages using placeholders.
- Ensured consistency in validation logic across all affected localization files.
- No security issues or logical errors identified; changes are straightforward localization updates.
30 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #17642 +/- ##
========================================
Coverage 70.10% 70.10%
========================================
Files 1430 1430
Lines 50147 50148 +1
Branches 13872 13872
========================================
+ Hits 35152 35153 +1
Misses 14995 14995 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
This pull request implements changes to increase the token symbol length limit from 12 to 20 characters, addressing issue #9243. The main changes include:
- Updated localization files to support a parametric token symbol length, replacing fixed-length messages with dynamic ones using placeholders.
- Modified the
ConfirmInfoRowTextTokenUnits
component to handle longer token amounts by implementing ashortenString
function that truncates long amounts to 15 characters with a tooltip showing the full amount. - Removed auto-detect token and NFT modals, suggesting a shift in how token detection is handled.
- Updated various test files to accommodate the new token symbol length limit.
- Made changes to Snap-related components and utilities, which may indirectly support the new token symbol length.
Key points to note:
- The changes are primarily focused on UI components and localization, ensuring consistent handling of longer token symbols across the application.
- The implementation follows the approach suggested in the issue, making the token symbol length parametric rather than hard-coded.
- While many files were touched, the core changes related to token symbol length are concentrated in a few key areas, particularly localization and the
ConfirmInfoRowTextTokenUnits
component. - The removal of auto-detect token functionality may be related to accommodating longer token symbols, but this change might require further explanation or documentation.
Overall, the changes appear to successfully implement the requested feature while maintaining consistency across the application. However, it would be beneficial to have more context on the removal of auto-detect functionality and its relation to the increased token symbol length.
288 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
adjust user interface.
Hey @bergeron, thanks for your feedback. I also adjusted MetaMask Core to support this change. Looking forward to your feedback. |
This PR has been automatically marked as stale because it has not had recent activity in the last 60 days. It will be closed in 14 days. Thank you for your contributions. |
not stale |
Correct, not stale, and this stale bot is also counter-productive. |
This pull request is to resolve issue #9243.