Skip to content

Commit

Permalink
refactor: use getAccounts to check if account is new
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesposito committed Jul 31, 2023
1 parent 76a8c67 commit a95471b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3385,13 +3385,12 @@ export default class MetamaskController extends EventEmitter {
await new Promise((resolve) => setTimeout(resolve, 5_000));
}

const { identities: oldIdentities } =
this.preferencesController.store.getState();
const oldAccounts = await this.coreKeyringController.getAccounts();

const { addedAccountAddress } =
await this.coreKeyringController.addNewAccount(accountCount);

if (Object.keys(oldIdentities).length === accountCount) {
if (!oldAccounts.includes(addedAccountAddress)) {
this.preferencesController.setSelectedAddress(addedAccountAddress);
}

Expand Down

0 comments on commit a95471b

Please sign in to comment.