Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Permit message, dataTree value incorrectly using default ERC20 d…
…ecimals for non-ERC20 token values (#28142) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Removes bug where fetchErc20Decimals was used in `ui/pages/confirmations/components/confirm/info/typed-sign/typed-sign.tsx` info component and passed to the message dataTree to be used. fetchErc20Decimals was incorrectly used as it cannot be assumed that the token contract is an ERC20 standard. Fixed by calling useGetTokenStandardAndDetails instead which will use the default 18 decimals digit if the standard is an ERC20 token with no decimals found in the details. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28142?quickstart=1) ## **Related issues** Fixes: #28118 ## **Manual testing steps** 1. Go to test-dapp 2. Test Permit button 3. Observe both the simulation and message value display "3,000" (contract is not an ERC20 standard so it does not apply default 18 decimals) ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <img width="640" src="https://private-user-images.githubusercontent.com/104780023/380556504-95ff2704-fca4-411e-b2b6-40dc6b099531.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzAxOTcyMjAsIm5iZiI6MTczMDE5NjkyMCwicGF0aCI6Ii8xMDQ3ODAwMjMvMzgwNTU2NTA0LTk1ZmYyNzA0LWZjYTQtNDExZS1iMmI2LTQwZGM2YjA5OTUzMS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQxMDI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MTAyOVQxMDE1MjBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wMDU4NjhhMGE0OGZhNjg4YzY0YmM3ZWRhNWFjYmUwNjFlZTY2ZDZjN2IyMDg1MjI0NGEyNTM2OTIyOGNmZjAzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.MipJ95Oyanm_83vnd1FYq14ua0HgEiH_7GMt3hRDGLE"> ### **After** <img width="320" src="https://github.com/user-attachments/assets/eea77452-3aa0-49b3-84a6-401ffb189b40"> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
- Loading branch information