From f271edb4dbd4d65801e9099ea98cf7ac44234edd Mon Sep 17 00:00:00 2001 From: Michele Esposito Date: Tue, 25 Jul 2023 14:25:01 +0200 Subject: [PATCH] refactor: replace missed interaction --- app/scripts/metamask-controller.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 8e23a6c335d3..75ab3639390f 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -2925,12 +2925,10 @@ export default class MetamaskController extends EventEmitter { // seek out the first zero balance while (lastBalance !== '0x0') { - await keyringController.addNewAccount(primaryKeyring); + const { addedAccountAddress } = + await this.coreKeyringController.addNewAccount(accounts.length); accounts = await keyringController.getAccounts(); - lastBalance = await this.getBalance( - accounts[accounts.length - 1], - ethQuery, - ); + lastBalance = await this.getBalance(addedAccountAddress, ethQuery); } // remove extra zero balance account potentially created from seeking ahead