fix: Cherry pick fix for Tokens disappearing after upgrade#9169
Merged
owencraston merged 1 commit intorelease/7.20.0from Apr 8, 2024
Merged
fix: Cherry pick fix for Tokens disappearing after upgrade#9169owencraston merged 1 commit intorelease/7.20.0from
owencraston merged 1 commit intorelease/7.20.0from
Conversation
## **Description**
The variable `newlySelectedInternalAccount.address`, that was being
returned by the `AccountsController:selectedAccountChange` event was on
a lowercase format. We were duplicating the accounts, so one account was
checksummed and another not, which was making the tokens be on storage
but not showing because the new selected account was not with tokens
imported.
This is a how the data storage was:
```
{"allDetectedTokens": {"0x1": {"0x2990079bcdEe240329a520d2444386FC119da21a": [Array]}, "0xa86a": {"0x2990079bcdEe240329a520d2444386FC119da21a": [Array], "0x2990079bcdee240329a520d2444386fc119da21a": [Array]}}, "allIgnoredTokens": {}, "allTokens": {"0xa86a": {"0x2990079bcdEe240329a520d2444386FC119da21a": [Array]}}, "detectedTokens": [{"address": "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", "aggregators": [Array], "decimals": 6, "image": "https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7.png", "isERC721": false, "name": "TetherToken", "symbol": "USDT"}, {"address": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", "aggregators": [Array], "decimals": 6, "image": "https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e.png", "isERC721": false, "name": "USD Coin", "symbol": "USDC"}, {"address": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", "aggregators": [Array], "decimals": 18, "image": "https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7.png", "isERC721": false, "name": "Wrapped AVAX", "symbol": "WAVAX"}, {"address": "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", "aggregators": [Array], "decimals": 18, "image": "https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab.png", "isERC721": false, "name": "Wrapped Ether", "symbol": "WETH.E"}, {"address": "0x50b7545627a5162F82A992c33b87aDc75187B218", "aggregators": [Array], "decimals": 8, "image": "https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0x50b7545627a5162f82a992c33b87adc75187b218.png", "isERC721": false, "name": "Wrapped BTC", "symbol": "WBTC.E"}, {"address": "0x63a72806098Bd3D9520cC43356dD78afe5D386D9", "aggregators": [Array], "decimals": 18, "image": "https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0x63a72806098bd3d9520cc43356dd78afe5d386d9.png", "isERC721": false, "name": "Aave Token", "symbol": "AAVE.E"}, {"address": "0x8b82A291F83ca07Af22120ABa21632088fC92931", "aggregators": [Array], "decimals": 18, "image": "https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0x8b82a291f83ca07af22120aba21632088fc92931.png", "isERC721": false, "name": "Ethereum Wormhole ", "symbol": "ETH"}, {"address": "0x120AD3e5A7c796349e591F1570D9f7980F4eA9cb", "aggregators": [Array], "decimals": 6, "image": "https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0x120ad3e5a7c796349e591f1570d9f7980f4ea9cb.png", "isERC721": false, "name": "Axelar Wrapped LUNA", "symbol": "LUNA"}], "ignoredTokens": [], "tokens": []}
```
This is how it is now:
```
{
"allDetectedTokens":{
"0x1":{
"0x2990079bcdEe240329a520d2444386FC119da21a":[
"Array"
]
},
"0xa86a":{
"0x2990079bcdEe240329a520d2444386FC119da21a":[
"Array"
]
}
},
"allIgnoredTokens":{
},
"allTokens":{
"0xa86a":{
"0x2990079bcdEe240329a520d2444386FC119da21a":[
"Array"
]
}
},
"detectedTokens":[
],
"ignoredTokens":[
],
"tokens":[
{
"address":"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
"aggregators":[
"Array"
],
"balanceError":null,
"decimals":6,
"image":"https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7.png",
"name":"TetherToken",
"symbol":"USDT"
},
{
"address":"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
"aggregators":[
"Array"
],
"balanceError":null,
"decimals":6,
"image":"https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e.png",
"name":"USD Coin",
"symbol":"USDC"
},
{
"address":"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
"aggregators":[
"Array"
],
"balanceError":null,
"decimals":18,
"image":"https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7.png",
"name":"Wrapped AVAX",
"symbol":"WAVAX"
},
{
"address":"0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",
"aggregators":[
"Array"
],
"balanceError":null,
"decimals":18,
"image":"https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab.png",
"name":"Wrapped Ether",
"symbol":"WETH.E"
},
{
"address":"0x50b7545627a5162F82A992c33b87aDc75187B218",
"aggregators":[
"Array"
],
"balanceError":null,
"decimals":8,
"image":"https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0x50b7545627a5162f82a992c33b87adc75187b218.png",
"name":"Wrapped BTC",
"symbol":"WBTC.E"
},
{
"address":"0x63a72806098Bd3D9520cC43356dD78afe5D386D9",
"aggregators":[
"Array"
],
"balanceError":null,
"decimals":18,
"image":"https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0x63a72806098bd3d9520cc43356dd78afe5d386d9.png",
"name":"Aave Token",
"symbol":"AAVE.E"
},
{
"address":"0x8b82A291F83ca07Af22120ABa21632088fC92931",
"aggregators":[
"Array"
],
"balanceError":null,
"decimals":18,
"image":"https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0x8b82a291f83ca07af22120aba21632088fc92931.png",
"name":"Ethereum Wormhole ",
"symbol":"ETH"
},
{
"address":"0x120AD3e5A7c796349e591F1570D9f7980F4eA9cb",
"aggregators":[
"Array"
],
"balanceError":null,
"decimals":6,
"image":"https://static.metafi.codefi.network/api/v1/tokenIcons/43114/0x120ad3e5a7c796349e591f1570d9f7980f4ea9cb.png",
"name":"Axelar Wrapped LUNA",
"symbol":"LUNA"
}
]
}
```
## **Related issues**
Fixes: #9122
## **Manual testing steps**
1. Go to uniswap, pancake swap, open sea
2. Connect with those dapps
3. Disconnected with those dapps
4. Performed a swap on uniswap on avalanche and binance smart chain
## **Screenshots/Recordings**
Upgrade path recording:
Uploading Screen Recording 2024-04-05 at 13.14.41.mov…
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.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-mobile/blob/main/.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.
Contributor
|
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. |
owencraston
approved these changes
Apr 8, 2024
Contributor
owencraston
left a comment
There was a problem hiding this comment.
screen-20240408-200805.mp4
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
This PR cherry picks this changes on this PR
Related issues
Fixes: #9111
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
if applicable
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
Pre-merge reviewer checklist
app, test code being changed).
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Description
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Standards.
if applicable
guidelines).
Not required for external contributors.
Pre-merge reviewer checklist
app, test code being changed).
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Description
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist