-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: token decimals fetched from the chain #7540
Conversation
… the symbol, decimals and name are fetchable from the chain, also reseted all the state when the address text input change when an address does not have 42 chars, added styling to address the value of symbols and decimals text input when fetched from the chain
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. |
…lues from the chain on wallet_watchAsset jsonRPC method
Can test(s) be added for this invariant? |
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.
Existing test failing: https://github.com/MetaMask/metamask-mobile/actions/runs/6566850147/job/17838459943?pr=7540
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #7540 +/- ##
==========================================
+ Coverage 34.61% 34.69% +0.07%
==========================================
Files 1019 1020 +1
Lines 27193 27249 +56
Branches 2218 2228 +10
==========================================
+ Hits 9413 9453 +40
- Misses 17289 17301 +12
- Partials 491 495 +4
☔ View full report in Codecov by Sentry. |
Kudos, SonarCloud Quality Gate passed! |
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.
QA Passed
Description
The problem was that the user was able to insert wrong the token decimals values, and with that would get the wrong tokens amounts in their wallet.
It was also added to the wallet_watchAsset JSON rpc method
Note for review
wallet_watchAsset
methodManual testing steps
Scenario 1:
_1. Step1: Go to import token on wallet view
_2. Step2: change tab to custom token
_3. Step3: add
0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599
(WBTC) as token address_4. Step4: It should block all the symbol and decimals field
Scenario 2
Step1: Go to in app browser
Step2: Go to coingecko website
Step3: Browse WBTC
Step4: look for the MM icon
Step5: Add it via coin gecko
Step6: It should work as expected
Screenshots/Recordings
importing token on custom token screen
http://recordit.co/ENT3D6Y0wn
import token on coin gecko
https://recordit.co/Ikwc5adYZn
import token on test dapp with wrong symbol and decimals (WBTC contract)
https://recordit.co/zoixJsK4Sc
import WBTC on polygon network
https://recordit.co/zTtxIthF4C
E2E build
https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/1d5eb4d0-faff-456b-b66b-6e55718f4cdf
Related issues
_Fixes #
Pre-merge author checklist
Pre-merge reviewer checklist