Skip to content

Commit 1a13e37

Browse files
authored
chore: bump assets controller to v7.2.1 (#30067)
## **Description** Bumps `@metamask/assets-controllers` from v7.0.0 to v7.2.1 to pick up the latest bug fixes and improvements from the upstream package. ## **Changelog** CHANGELOG entry: bump assets controller to v7.2.1 ## **Related issues** Fixes: N/A ## **Manual testing steps** ```gherkin Feature: Assets display Scenario: user views their token balances Given the user has tokens on one or more networks When user opens the wallet Then token balances and asset info are displayed correctly ``` ## **Screenshots/Recordings** N/A — dependency bump with no UI changes. ### **Before** N/A ### **After** N/A ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] 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. #### Performance checks (if applicable) - [ ] I've tested on Android - [ ] I've tested with a power user scenario - [ ] I've instrumented key operations with Sentry traces for production performance metrics ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Dependency bump to a new major version of `@metamask/assets-controller` and updates to the AssetsController messenger event surface could affect asset updates on network add/remove flows. > > **Overview** > Updates the app to use `@metamask/assets-controller` `^7.1.2` (from `^6.2.1`), with corresponding `yarn.lock` changes. > > Aligns the AssetsController messenger typing and delegation to include the new `NetworkController:networkAdded` and `NetworkController:networkRemoved` events, and updates the associated unit test expectations. > > Adjusts the test `initial-background-state.json` asset identifiers to use checksummed token addresses in the `AssetsController.assetsInfo` keys. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a6f2b98. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 825cbe0 commit 1a13e37

5 files changed

Lines changed: 20 additions & 12 deletions

File tree

app/core/Engine/messengers/assets-controller/assets-controller-messenger.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ describe('getAssetsControllerMessenger', () => {
6868
'AccountsController:accountBalancesUpdated',
6969
'PermissionController:stateChange',
7070
'TransactionController:unapprovedTransactionAdded',
71+
'NetworkController:networkRemoved',
72+
'NetworkController:networkAdded',
7173
]),
7274
}),
7375
);

app/core/Engine/messengers/assets-controller/assets-controller-messenger.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import type {
99
NetworkControllerGetStateAction,
1010
NetworkControllerGetNetworkClientByIdAction,
1111
NetworkControllerStateChangeEvent,
12+
NetworkControllerNetworkAddedEvent,
13+
NetworkControllerNetworkRemovedEvent,
1214
} from '@metamask/network-controller';
1315
import type {
1416
AccountsControllerAccountBalancesUpdatesEvent,
@@ -81,7 +83,9 @@ type AssetsControllerAllowedEvents =
8183
| TransactionControllerIncomingTransactionsReceivedEvent
8284
| AccountsControllerAccountBalancesUpdatesEvent
8385
| PermissionControllerStateChange
84-
| TransactionControllerUnapprovedTransactionAddedEvent;
86+
| TransactionControllerUnapprovedTransactionAddedEvent
87+
| NetworkControllerNetworkRemovedEvent
88+
| NetworkControllerNetworkAddedEvent;
8589

8690
/** Re-export package type so init receives the type expected by AssetsController constructor. */
8791
export type AssetsControllerMessenger = PackageAssetsControllerMessenger;
@@ -134,6 +138,8 @@ export function getAssetsControllerMessenger(
134138
'AccountsController:accountBalancesUpdated',
135139
'PermissionController:stateChange',
136140
'TransactionController:unapprovedTransactionAdded',
141+
'NetworkController:networkRemoved',
142+
'NetworkController:networkAdded',
137143
],
138144
messenger,
139145
});

app/util/test/initial-background-state.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,19 +479,19 @@
479479
"assetPreferences": {},
480480
"assetsBalance": {},
481481
"assetsInfo": {
482-
"eip155:1/erc20:0xaca92e438df0b2401ff60da7e4337b687a2435da": {
482+
"eip155:1/erc20:0xacA92E438df0B2401fF60dA7E4337B687a2435DA": {
483483
"decimals": 6,
484484
"name": "MetaMask USD",
485485
"symbol": "mUSD",
486486
"type": "erc20"
487487
},
488-
"eip155:143/erc20:0xaca92e438df0b2401ff60da7e4337b687a2435da": {
488+
"eip155:143/erc20:0xacA92E438df0B2401fF60dA7E4337B687a2435DA": {
489489
"decimals": 6,
490490
"name": "MetaMask USD",
491491
"symbol": "mUSD",
492492
"type": "erc20"
493493
},
494-
"eip155:59144/erc20:0xaca92e438df0b2401ff60da7e4337b687a2435da": {
494+
"eip155:59144/erc20:0xacA92E438df0B2401fF60dA7E4337B687a2435DA": {
495495
"decimals": 6,
496496
"name": "MetaMask USD",
497497
"symbol": "mUSD",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
"@metamask/analytics-controller": "^1.0.0",
244244
"@metamask/app-metadata-controller": "^2.0.0",
245245
"@metamask/approval-controller": "^9.0.0",
246-
"@metamask/assets-controller": "^6.2.1",
246+
"@metamask/assets-controller": "^7.1.2",
247247
"@metamask/assets-controllers": "^106.0.0",
248248
"@metamask/authenticated-user-storage": "^1.0.0",
249249
"@metamask/base-controller": "^9.0.1",

yarn.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7648,7 +7648,7 @@ __metadata:
76487648
languageName: node
76497649
linkType: hard
76507650

7651-
"@metamask/assets-controller@npm:^6.2.1, @metamask/assets-controller@npm:^6.4.0":
7651+
"@metamask/assets-controller@npm:^6.4.0":
76527652
version: 6.4.0
76537653
resolution: "@metamask/assets-controller@npm:6.4.0"
76547654
dependencies:
@@ -8975,20 +8975,20 @@ __metadata:
89758975
linkType: hard
89768976

89778977
"@metamask/keyring-sdk@npm:^2.0.2":
8978-
version: 2.0.2
8979-
resolution: "@metamask/keyring-sdk@npm:2.0.2"
8978+
version: 2.1.1
8979+
resolution: "@metamask/keyring-sdk@npm:2.1.1"
89808980
dependencies:
89818981
"@ethereumjs/tx": "npm:^5.4.0"
89828982
"@metamask/eth-sig-util": "npm:^8.2.0"
89838983
"@metamask/keyring-api": "npm:^23.1.0"
8984-
"@metamask/keyring-utils": "npm:^3.2.0"
8984+
"@metamask/keyring-utils": "npm:^3.3.1"
89858985
"@metamask/scure-bip39": "npm:^2.1.1"
89868986
"@metamask/superstruct": "npm:^3.1.0"
89878987
"@metamask/utils": "npm:^11.11.0"
89888988
async-mutex: "npm:^0.5.0"
89898989
ethereum-cryptography: "npm:^2.2.1"
89908990
uuid: "npm:^9.0.1"
8991-
checksum: 10/2f456613df81580b032215ddf1c90fa9440442d631945329094a488743a71fdbbfe787c2c0809a315a1368ddbf9d3755faa936c54094cb32958fe8222f7e7a86
8991+
checksum: 10/bd10f41e124a61dd53c3914ab8f53e3519bc90905668f83e386bd0c7053754e446396a39b88f88228b2a001ee02762b287495e284ff3052ff5b7636803ac437b
89928992
languageName: node
89938993
linkType: hard
89948994

@@ -9056,7 +9056,7 @@ __metadata:
90569056
languageName: node
90579057
linkType: hard
90589058

9059-
"@metamask/keyring-utils@npm:^3.1.0, @metamask/keyring-utils@npm:^3.2.0, @metamask/keyring-utils@npm:^3.2.1":
9059+
"@metamask/keyring-utils@npm:^3.1.0, @metamask/keyring-utils@npm:^3.2.0, @metamask/keyring-utils@npm:^3.2.1, @metamask/keyring-utils@npm:^3.3.1":
90609060
version: 3.3.1
90619061
resolution: "@metamask/keyring-utils@npm:3.3.1"
90629062
dependencies:
@@ -35324,7 +35324,7 @@ __metadata:
3532435324
"@metamask/analytics-controller": "npm:^1.0.0"
3532535325
"@metamask/app-metadata-controller": "npm:^2.0.0"
3532635326
"@metamask/approval-controller": "npm:^9.0.0"
35327-
"@metamask/assets-controller": "npm:^6.2.1"
35327+
"@metamask/assets-controller": "npm:^7.1.2"
3532835328
"@metamask/assets-controllers": "npm:^106.0.0"
3532935329
"@metamask/authenticated-user-storage": "npm:^1.0.0"
3533035330
"@metamask/auto-changelog": "npm:^5.3.0"

0 commit comments

Comments
 (0)