Skip to content

Commit 4afb3bc

Browse files
authored
chore: bump keyring-api to ^10.1.0 + eth-snap-keyring to ^5.0.1 (#28545)
## **Description** Updating the `keyring-api` and Snap keyring alongside other controllers that depend on those versions too. Some controllers from [this release](MetaMask/core#4956) were left out from this PR mainly because the current major version being used in the extension is not updated yet. The current included controllers do have a peer dependency to either the `keyring-controller` or the `accounts-controller` which is why they are being included in this PR. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28545?quickstart=1) ## **Related issues** - MetaMask/core#4956 ## **Manual testing steps** N/A ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] 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). - [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-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.
1 parent 1124dae commit 4afb3bc

16 files changed

+325
-329
lines changed

.yarn/patches/@metamask-assets-controllers-npm-44.0.0-c223d56176.patch

-35
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
diff --git a/dist/TokenDetectionController.cjs b/dist/TokenDetectionController.cjs
2+
index 8fd5efde7a3c24080f8a43f79d10300e8c271245..66f656d9a55f1154024a8c18a9fe27b4ed39a21d 100644
3+
--- a/dist/TokenDetectionController.cjs
4+
+++ b/dist/TokenDetectionController.cjs
5+
@@ -250,17 +250,20 @@ _TokenDetectionController_intervalId = new WeakMap(), _TokenDetectionController_
6+
}
7+
});
8+
this.messagingSystem.subscribe('AccountsController:selectedEvmAccountChange',
9+
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
10+
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
11+
- async (selectedAccount) => {
12+
- const isSelectedAccountIdChanged = __classPrivateFieldGet(this, _TokenDetectionController_selectedAccountId, "f") !== selectedAccount.id;
13+
- if (isSelectedAccountIdChanged) {
14+
- __classPrivateFieldSet(this, _TokenDetectionController_selectedAccountId, selectedAccount.id, "f");
15+
- await __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_restartTokenDetection).call(this, {
16+
- selectedAddress: selectedAccount.address,
17+
- });
18+
- }
19+
- });
20+
+ // TODO: Either fix this lint violation or explain why it's necessary to ignore.
21+
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
22+
+ async (selectedAccount) => {
23+
+ const { networkConfigurationsByChainId } = this.messagingSystem.call('NetworkController:getState');
24+
+ const chainIds = Object.keys(networkConfigurationsByChainId);
25+
+ const isSelectedAccountIdChanged = __classPrivateFieldGet(this, _TokenDetectionController_selectedAccountId, "f") !== selectedAccount.id;
26+
+ if (isSelectedAccountIdChanged) {
27+
+ __classPrivateFieldSet(this, _TokenDetectionController_selectedAccountId, selectedAccount.id, "f");
28+
+ await __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_restartTokenDetection).call(this, {
29+
+ selectedAddress: selectedAccount.address,
30+
+ chainIds,
31+
+ });
32+
+ }
33+
+ });
34+
}, _TokenDetectionController_stopPolling = function _TokenDetectionController_stopPolling() {
35+
if (__classPrivateFieldGet(this, _TokenDetectionController_intervalId, "f")) {
36+
clearInterval(__classPrivateFieldGet(this, _TokenDetectionController_intervalId, "f"));
137
diff --git a/dist/assetsUtil.cjs b/dist/assetsUtil.cjs
238
index 48571b8c1b78e94d88e1837e986b5f8735ac651b..61246f51500c8cab48f18296a73629fb73454caa 100644
339
--- a/dist/assetsUtil.cjs
@@ -33,39 +69,3 @@ index e7eaad2cfa8b233c4fd42a51f745233a1cc5c387..bf8ec7819f678c2f185d6a85d7e3ea81
3369
/**
3470
* The list of currencies that can be supplied as the `vsCurrency` parameter to
3571
* the `/spot-prices` endpoint, in lowercase form.
36-
diff --git a/dist/TokenDetectionController.cjs b/dist/TokenDetectionController.cjs
37-
index 8fd5efde7a3c24080f8a43f79d10300e8c271245..a3c334ac7dd2e5698e6b54a73491b7145c2a9010 100644
38-
--- a/dist/TokenDetectionController.cjs
39-
+++ b/dist/TokenDetectionController.cjs
40-
@@ -250,17 +250,20 @@ _TokenDetectionController_intervalId = new WeakMap(), _TokenDetectionController_
41-
}
42-
});
43-
this.messagingSystem.subscribe('AccountsController:selectedEvmAccountChange',
44-
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
45-
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
46-
- async (selectedAccount) => {
47-
- const isSelectedAccountIdChanged = __classPrivateFieldGet(this, _TokenDetectionController_selectedAccountId, "f") !== selectedAccount.id;
48-
- if (isSelectedAccountIdChanged) {
49-
- __classPrivateFieldSet(this, _TokenDetectionController_selectedAccountId, selectedAccount.id, "f");
50-
- await __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_restartTokenDetection).call(this, {
51-
- selectedAddress: selectedAccount.address,
52-
- });
53-
- }
54-
- });
55-
+ // TODO: Either fix this lint violation or explain why it's necessary to ignore.
56-
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
57-
+ async (selectedAccount) => {
58-
+ const { networkConfigurationsByChainId } = this.messagingSystem.call('NetworkController:getState');
59-
+ const chainIds = Object.keys(networkConfigurationsByChainId);
60-
+ const isSelectedAccountIdChanged = __classPrivateFieldGet(this, _TokenDetectionController_selectedAccountId, "f") !== selectedAccount.id;
61-
+ if (isSelectedAccountIdChanged) {
62-
+ __classPrivateFieldSet(this, _TokenDetectionController_selectedAccountId, selectedAccount.id, "f");
63-
+ await __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_restartTokenDetection).call(this, {
64-
+ selectedAddress: selectedAccount.address,
65-
+ chainIds,
66-
+ });
67-
+ }
68-
+ });
69-
}, _TokenDetectionController_stopPolling = function _TokenDetectionController_stopPolling() {
70-
if (__classPrivateFieldGet(this, _TokenDetectionController_intervalId, "f")) {
71-
clearInterval(__classPrivateFieldGet(this, _TokenDetectionController_intervalId, "f"));

app/scripts/metamask-controller.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2307,7 +2307,7 @@ describe('MetaMaskController', () => {
23072307
...mockEvmAccount,
23082308
id: '21690786-6abd-45d8-a9f0-9ff1d8ca76a1',
23092309
type: BtcAccountType.P2wpkh,
2310-
methods: [BtcMethod.SendMany],
2310+
methods: [BtcMethod.SendBitcoin],
23112311
address: 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq',
23122312
};
23132313

@@ -2415,7 +2415,7 @@ describe('MetaMaskController', () => {
24152415
...mockEvmAccount,
24162416
id: '21690786-6abd-45d8-a9f0-9ff1d8ca76a1',
24172417
type: BtcAccountType.P2wpkh,
2418-
methods: [BtcMethod.SendMany],
2418+
methods: [BtcMethod.SendBitcoin],
24192419
address: 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq',
24202420
// We need to have a "Snap account" account here, since the MultichainBalancesController will
24212421
// filter it out otherwise!

lavamoat/browserify/beta/policy.json

+39-41
Original file line numberDiff line numberDiff line change
@@ -613,29 +613,14 @@
613613
"packages": {
614614
"@ethereumjs/tx>@ethereumjs/util": true,
615615
"@ethereumjs/tx>ethereum-cryptography": true,
616-
"@metamask/accounts-controller>@metamask/utils": true,
617616
"@metamask/base-controller": true,
618617
"@metamask/eth-snap-keyring": true,
619618
"@metamask/keyring-api": true,
620619
"@metamask/keyring-controller": true,
620+
"@metamask/utils": true,
621621
"uuid": true
622622
}
623623
},
624-
"@metamask/accounts-controller>@metamask/utils": {
625-
"globals": {
626-
"TextDecoder": true,
627-
"TextEncoder": true
628-
},
629-
"packages": {
630-
"@metamask/utils>@metamask/superstruct": true,
631-
"@metamask/utils>@scure/base": true,
632-
"@metamask/utils>pony-cause": true,
633-
"@noble/hashes": true,
634-
"browserify>buffer": true,
635-
"nock>debug": true,
636-
"semver": true
637-
}
638-
},
639624
"@metamask/address-book-controller": {
640625
"packages": {
641626
"@metamask/base-controller": true,
@@ -1121,14 +1106,25 @@
11211106
},
11221107
"packages": {
11231108
"@ethereumjs/tx": true,
1124-
"@metamask/eth-sig-util": true,
1109+
"@metamask/eth-snap-keyring>@metamask/eth-sig-util": true,
11251110
"@metamask/eth-snap-keyring>@metamask/utils": true,
11261111
"@metamask/eth-snap-keyring>uuid": true,
11271112
"@metamask/keyring-api": true,
11281113
"@metamask/utils>@metamask/superstruct": true,
11291114
"webpack>events": true
11301115
}
11311116
},
1117+
"@metamask/eth-snap-keyring>@metamask/eth-sig-util": {
1118+
"packages": {
1119+
"@ethereumjs/tx>@ethereumjs/util": true,
1120+
"@ethereumjs/tx>ethereum-cryptography": true,
1121+
"@metamask/abi-utils": true,
1122+
"@metamask/eth-sig-util>tweetnacl": true,
1123+
"@metamask/eth-snap-keyring>@metamask/utils": true,
1124+
"@metamask/utils>@scure/base": true,
1125+
"browserify>buffer": true
1126+
}
1127+
},
11321128
"@metamask/eth-snap-keyring>@metamask/utils": {
11331129
"globals": {
11341130
"TextDecoder": true,
@@ -1549,12 +1545,12 @@
15491545
"@ethereumjs/tx>@ethereumjs/util": true,
15501546
"@metamask/base-controller": true,
15511547
"@metamask/browser-passworder": true,
1552-
"@metamask/eth-sig-util": true,
15531548
"@metamask/keyring-controller>@metamask/eth-hd-keyring": true,
1549+
"@metamask/keyring-controller>@metamask/eth-sig-util": true,
15541550
"@metamask/keyring-controller>@metamask/eth-simple-keyring": true,
1555-
"@metamask/keyring-controller>@metamask/utils": true,
15561551
"@metamask/keyring-controller>ethereumjs-wallet": true,
1557-
"@metamask/name-controller>async-mutex": true
1552+
"@metamask/name-controller>async-mutex": true,
1553+
"@metamask/utils": true
15581554
}
15591555
},
15601556
"@metamask/keyring-controller>@metamask/eth-hd-keyring": {
@@ -1585,17 +1581,18 @@
15851581
"semver": true
15861582
}
15871583
},
1588-
"@metamask/keyring-controller>@metamask/eth-simple-keyring": {
1584+
"@metamask/keyring-controller>@metamask/eth-sig-util": {
15891585
"packages": {
15901586
"@ethereumjs/tx>@ethereumjs/util": true,
15911587
"@ethereumjs/tx>ethereum-cryptography": true,
1592-
"@metamask/eth-sig-util": true,
1593-
"@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/utils": true,
1594-
"browserify>buffer": true,
1595-
"crypto-browserify>randombytes": true
1588+
"@metamask/abi-utils": true,
1589+
"@metamask/eth-sig-util>tweetnacl": true,
1590+
"@metamask/keyring-controller>@metamask/eth-sig-util>@metamask/utils": true,
1591+
"@metamask/utils>@scure/base": true,
1592+
"browserify>buffer": true
15961593
}
15971594
},
1598-
"@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/utils": {
1595+
"@metamask/keyring-controller>@metamask/eth-sig-util>@metamask/utils": {
15991596
"globals": {
16001597
"TextDecoder": true,
16011598
"TextEncoder": true
@@ -1610,7 +1607,17 @@
16101607
"semver": true
16111608
}
16121609
},
1613-
"@metamask/keyring-controller>@metamask/utils": {
1610+
"@metamask/keyring-controller>@metamask/eth-simple-keyring": {
1611+
"packages": {
1612+
"@ethereumjs/tx>@ethereumjs/util": true,
1613+
"@ethereumjs/tx>ethereum-cryptography": true,
1614+
"@metamask/eth-sig-util": true,
1615+
"@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/utils": true,
1616+
"browserify>buffer": true,
1617+
"crypto-browserify>randombytes": true
1618+
}
1619+
},
1620+
"@metamask/keyring-controller>@metamask/eth-simple-keyring>@metamask/utils": {
16141621
"globals": {
16151622
"TextDecoder": true,
16161623
"TextEncoder": true
@@ -2007,10 +2014,10 @@
20072014
"@metamask/base-controller": true,
20082015
"@metamask/controller-utils": true,
20092016
"@metamask/notification-services-controller>@contentful/rich-text-html-renderer": true,
2010-
"@metamask/notification-services-controller>@metamask/utils": true,
2017+
"@metamask/notification-services-controller>bignumber.js": true,
20112018
"@metamask/notification-services-controller>firebase": true,
20122019
"@metamask/profile-sync-controller": true,
2013-
"bignumber.js": true,
2020+
"@metamask/utils": true,
20142021
"loglevel": true,
20152022
"uuid": true
20162023
}
@@ -2020,19 +2027,10 @@
20202027
"SuppressedError": true
20212028
}
20222029
},
2023-
"@metamask/notification-services-controller>@metamask/utils": {
2030+
"@metamask/notification-services-controller>bignumber.js": {
20242031
"globals": {
2025-
"TextDecoder": true,
2026-
"TextEncoder": true
2027-
},
2028-
"packages": {
2029-
"@metamask/utils>@metamask/superstruct": true,
2030-
"@metamask/utils>@scure/base": true,
2031-
"@metamask/utils>pony-cause": true,
2032-
"@noble/hashes": true,
2033-
"browserify>buffer": true,
2034-
"nock>debug": true,
2035-
"semver": true
2032+
"crypto": true,
2033+
"define": true
20362034
}
20372035
},
20382036
"@metamask/notification-services-controller>firebase": {

0 commit comments

Comments
 (0)