Skip to content
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

feat: Bump @metamask/providers to ^20.0.0 #29936

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
764 changes: 0 additions & 764 deletions .yarn/patches/@metamask-providers-npm-19.0.0-3d962c6f1a.patch

This file was deleted.

1 change: 0 additions & 1 deletion app/scripts/controllers/permissions/enums.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export enum NOTIFICATION_NAMES {
accountsChanged = 'metamask_accountsChanged',
unlockStateChanged = 'metamask_unlockStateChanged',
chainChanged = 'metamask_chainChanged',
}
30 changes: 9 additions & 21 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2834,6 +2834,10 @@ export default class MetamaskController extends EventEmitter {
if (chains.length > 0 && !chains.includes(currentChainIdForOrigin)) {
const networkClientId =
this.networkController.findNetworkClientIdByChainId(chains[0]);
// setActiveNetwork should be called before setNetworkClientIdForDomain
// to ensure that the isConnected value can be accurately inferred from
// NetworkController.state.networksMetadata in return value of
// `metamask_getProviderState` requests and `metamask_chainChanged` events.
this.networkController.setActiveNetwork(networkClientId);
ffmcgee725 marked this conversation as resolved.
Show resolved Hide resolved
this.selectedNetworkController.setNetworkClientIdForDomain(
origin,
Expand Down Expand Up @@ -3092,7 +3096,11 @@ export default class MetamaskController extends EventEmitter {
const providerNetworkState = await this.getProviderNetworkState(origin);

return {
isUnlocked: this.isUnlocked(),
/**
* We default `isUnlocked` to `true` because even though we no longer emit events depending on this,
* embedded dapp providers might listen directly to our streams, and therefore depend on it, so we leave it here.
*/
isUnlocked: true,
ffmcgee725 marked this conversation as resolved.
Show resolved Hide resolved
accounts: this.getPermittedAccounts(origin),
...providerNetworkState,
};
Expand Down Expand Up @@ -6558,20 +6566,8 @@ export default class MetamaskController extends EventEmitter {

/**
* Handle global application unlock.
* Notifies all connections that the extension is unlocked, and which
* account(s) are currently accessible, if any.
*/
_onUnlock() {
this.notifyAllConnections((origin) => {
return {
method: NOTIFICATION_NAMES.unlockStateChanged,
params: {
isUnlocked: true,
accounts: this.getPermittedAccounts(origin),
},
};
});

this.unMarkPasswordForgotten();

// In the current implementation, this handler is triggered by a
Expand All @@ -6582,16 +6578,8 @@ export default class MetamaskController extends EventEmitter {

/**
* Handle global application lock.
* Notifies all connections that the extension is locked.
*/
_onLock() {
this.notifyAllConnections({
method: NOTIFICATION_NAMES.unlockStateChanged,
params: {
isUnlocked: false,
},
});

// In the current implementation, this handler is triggered by a
// KeyringController event. Other controllers subscribe to the 'lock'
// event of the MetaMaskController itself.
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@
"tslib@npm:^2.3.0": "~2.6.0",
"tslib@npm:^2.3.1": "~2.6.0",
"tslib@npm:^2.4.0": "~2.6.0",
"tslib@npm:^2.6.2": "~2.6.0",
"@metamask/providers@npm:^18.3.1": "patch:@metamask/providers@npm%3A19.0.0#~/.yarn/patches/@metamask-providers-npm-19.0.0-3d962c6f1a.patch"
"tslib@npm:^2.6.2": "~2.6.0"
},
"dependencies": {
"@babel/runtime": "patch:@babel/runtime@npm%3A7.25.9#~/.yarn/patches/@babel-runtime-npm-7.25.9-fe8c62510a.patch",
Expand Down Expand Up @@ -339,7 +338,7 @@
"@metamask/ppom-validator": "0.36.0",
"@metamask/preinstalled-example-snap": "^0.3.0",
"@metamask/profile-sync-controller": "^4.1.1",
"@metamask/providers": "patch:@metamask/providers@npm%3A19.0.0#~/.yarn/patches/@metamask-providers-npm-19.0.0-3d962c6f1a.patch",
"@metamask/providers": "^20.0.0",
"@metamask/queued-request-controller": "^7.0.1",
"@metamask/rate-limit-controller": "^6.0.2",
"@metamask/remote-feature-flag-controller": "^1.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ export const NetworkListMenu = ({ onClose }: { onClose: () => void }) => {
// the dapp via silent switchEthereumChain that the
// network has changed due to user action
if (selectedTabOrigin && domains[selectedTabOrigin]) {
// setActiveNetwork should be called before setNetworkClientIdForDomain
// to ensure that the isConnected value can be accurately inferred from
// NetworkController.state.networksMetadata in return value of
// `metamask_getProviderState` requests and `metamask_chainChanged` events.
setNetworkClientIdForDomain(selectedTabOrigin, networkClientId);
}

Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6038,9 +6038,9 @@ __metadata:
languageName: node
linkType: hard

"@metamask/providers@npm:19.0.0":
version: 19.0.0
resolution: "@metamask/providers@npm:19.0.0"
"@metamask/providers@npm:^18.3.1":
version: 18.3.1
resolution: "@metamask/providers@npm:18.3.1"
dependencies:
"@metamask/json-rpc-engine": "npm:^10.0.2"
"@metamask/json-rpc-middleware-stream": "npm:^8.0.6"
Expand All @@ -6055,13 +6055,13 @@ __metadata:
readable-stream: "npm:^3.6.2"
peerDependencies:
webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0
checksum: 10/e45b2e90aa45db689bed582e85181d6964daff3c4b651ffc8503edcec2206a1b76677c0ae6fc0b29cef37a1b33775545e73bd1cf62802a4fc5e2841973cdafb6
checksum: 10/0e21ba9cce926a49dedbfe30fc964cd2349ee6bf9156f525fb894dcbc147a3ae480384884131a6b1a0a508989b547d8c8d2aeb3d10e11f67a8ee5230c45631a8
languageName: node
linkType: hard

"@metamask/providers@patch:@metamask/providers@npm%3A19.0.0#~/.yarn/patches/@metamask-providers-npm-19.0.0-3d962c6f1a.patch":
version: 19.0.0
resolution: "@metamask/providers@patch:@metamask/providers@npm%3A19.0.0#~/.yarn/patches/@metamask-providers-npm-19.0.0-3d962c6f1a.patch::version=19.0.0&hash=46053a"
"@metamask/providers@npm:^20.0.0":
version: 20.0.0
resolution: "@metamask/providers@npm:20.0.0"
dependencies:
"@metamask/json-rpc-engine": "npm:^10.0.2"
"@metamask/json-rpc-middleware-stream": "npm:^8.0.6"
Expand All @@ -6076,7 +6076,7 @@ __metadata:
readable-stream: "npm:^3.6.2"
peerDependencies:
webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0
checksum: 10/2999f2613502ea9b26e7693e6113d55e22cca783cc670a88b8fd9b4fc135da2db1687880fea968e6848596050eb52f3bc704438b265aa1eeebf449d7916a5d71
checksum: 10/b958d03a9380d86e605db239109a3debcc1ffde90371abe5beb82a5bed46c7718303a2bb92ec269eae16eff145b9ebbfcb3445a2b6bad4f297a590ee725a5bad
languageName: node
linkType: hard

Expand Down Expand Up @@ -26669,7 +26669,7 @@ __metadata:
"@metamask/preferences-controller": "npm:^15.0.1"
"@metamask/preinstalled-example-snap": "npm:^0.3.0"
"@metamask/profile-sync-controller": "npm:^4.1.1"
"@metamask/providers": "patch:@metamask/providers@npm%3A19.0.0#~/.yarn/patches/@metamask-providers-npm-19.0.0-3d962c6f1a.patch"
"@metamask/providers": "npm:^20.0.0"
"@metamask/queued-request-controller": "npm:^7.0.1"
"@metamask/rate-limit-controller": "npm:^6.0.2"
"@metamask/remote-feature-flag-controller": "npm:^1.3.0"
Expand Down
Loading