Skip to content

Commit

Permalink
fix: remove 'isUnlocked' check from _notifyAccountsChange on metamask…
Browse files Browse the repository at this point in the history
… controller
  • Loading branch information
ffmcgee725 committed Feb 11, 2025
1 parent 7b56a80 commit 7be8143
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7108,21 +7108,19 @@ export default class MetamaskController extends EventEmitter {
}

_notifyAccountsChange(origin, newAccounts) {
if (this.isUnlocked()) {
this.notifyConnections(origin, {
method: NOTIFICATION_NAMES.accountsChanged,
// This should be the same as the return value of `eth_accounts`,
// namely an array of the current / most recently selected Ethereum
// account.
params:
newAccounts.length < 2
? // If the length is 1 or 0, the accounts are sorted by definition.
newAccounts
: // If the length is 2 or greater, we have to execute
// `eth_accounts` vi this method.
this.getPermittedAccounts(origin),
});
}
this.notifyConnections(origin, {
method: NOTIFICATION_NAMES.accountsChanged,
// This should be the same as the return value of `eth_accounts`,
// namely an array of the current / most recently selected Ethereum
// account.
params:
newAccounts.length < 2
? // If the length is 1 or 0, the accounts are sorted by definition.
newAccounts
: // If the length is 2 or greater, we have to execute
// `eth_accounts` vi this method.
this.getPermittedAccounts(origin),
});

this.permissionLogController.updateAccountsHistory(origin, newAccounts);
}
Expand Down

0 comments on commit 7be8143

Please sign in to comment.